mirror of
https://github.com/wheremyfoodat/Panda3DS.git
synced 2025-04-21 21:05:50 +12:00
Add in-place swapchain recreation
Lots of todos, this should probably just be its own self-contained object to allow the emulator to render "headlessly" regardless of a swapchain existing or not.
This commit is contained in:
parent
34b87e50bd
commit
e2e49b7291
2 changed files with 221 additions and 192 deletions
|
@ -4,6 +4,8 @@
|
|||
class GPU;
|
||||
|
||||
class RendererVK final : public Renderer {
|
||||
SDL_Window* targetWindow;
|
||||
|
||||
// The order of these `Unique*` members is important, they will be destroyed in RAII order
|
||||
vk::UniqueInstance instance = {};
|
||||
vk::UniqueDebugUtilsMessengerEXT debugMessenger = {};
|
||||
|
@ -12,6 +14,8 @@ class RendererVK final : public Renderer {
|
|||
|
||||
vk::PhysicalDevice physicalDevice = {};
|
||||
|
||||
vk::UniqueDevice device = {};
|
||||
|
||||
vk::Queue presentQueue = {};
|
||||
u32 presentQueueFamily = ~0u;
|
||||
vk::Queue graphicsQueue = {};
|
||||
|
@ -21,18 +25,13 @@ class RendererVK final : public Renderer {
|
|||
vk::Queue transferQueue = {};
|
||||
u32 transferQueueFamily = ~0u;
|
||||
|
||||
vk::UniqueDevice device = {};
|
||||
vk::UniqueCommandPool commandPool = {};
|
||||
|
||||
vk::UniqueSwapchainKHR swapchain = {};
|
||||
u32 swapchainImageCount = ~0u;
|
||||
std::vector<vk::Image> swapchainImages = {};
|
||||
std::vector<vk::UniqueImageView> swapchainImageViews = {};
|
||||
|
||||
|
||||
// Global synchronization primitives
|
||||
|
||||
vk::UniqueCommandPool commandPool = {};
|
||||
|
||||
// Per-swapchain-image data
|
||||
// Each vector is `swapchainImageCount` in size
|
||||
std::vector<vk::UniqueCommandBuffer> presentCommandBuffers = {};
|
||||
|
@ -40,6 +39,9 @@ class RendererVK final : public Renderer {
|
|||
std::vector<vk::UniqueSemaphore> renderFinishedSemaphore = {};
|
||||
std::vector<vk::UniqueFence> frameFinishedFences = {};
|
||||
|
||||
// Recreate the swapchain, possibly re-using the old one in the case of a resize
|
||||
vk::Result recreateSwapchain(vk::SurfaceKHR surface, vk::Extent2D swapchainExtent);
|
||||
|
||||
u64 currentFrame = 0;
|
||||
public:
|
||||
RendererVK(GPU& gpu, const std::array<u32, regNum>& internalRegs);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue