diff --git a/src/video_core/renderer_vulkan/renderer_vulkan.cpp b/src/video_core/renderer_vulkan/renderer_vulkan.cpp index c6ad53723..d360eef5f 100644 --- a/src/video_core/renderer_vulkan/renderer_vulkan.cpp +++ b/src/video_core/renderer_vulkan/renderer_vulkan.cpp @@ -159,6 +159,8 @@ RendererVulkan::RendererVulkan(Core::System& system, Pica::PicaCore& pica_, BuildLayouts(); CreateTextureRenderPass(); AllocateSMAATextures(); + AllocatePPTextures(); + CreatePPTextureFramebuffers(); BuildPipelines(); if (secondary_window) { secondary_present_window_ptr = std::make_unique( @@ -172,6 +174,13 @@ RendererVulkan::~RendererVulkan() { main_present_window.WaitPresent(); device.waitIdle(); + vmaDestroyBuffer(instance.GetAllocator(), areaTexInfo.buffer, areaTexInfo.bufferAllocation); + vmaDestroyBuffer(instance.GetAllocator(), searchTexInfo.buffer, searchTexInfo.bufferAllocation); + device.destroyImageView(areaTexInfo.image_view); + vmaDestroyImage(instance.GetAllocator(), areaTexInfo.image, areaTexInfo.imageAllocation); + device.destroyImageView(searchTexInfo.image_view); + vmaDestroyImage(instance.GetAllocator(), searchTexInfo.image, searchTexInfo.imageAllocation); + device.destroyShaderModule(present_vertex_shader); for (u32 i = 0; i < PRESENT_PIPELINES; i++) { device.destroyPipeline(present_pipelines[i]); @@ -216,6 +225,16 @@ RendererVulkan::~RendererVulkan() { device.destroyImageView(antialiasTextures[j].image_view); vmaDestroyImage(instance.GetAllocator(), antialiasTextures[j].image, antialiasTextures[j].allocation); } + + for (int i = 0; i < intermediateOutputSizeTextures.size(); i++) { + for (int j = 0; j < intermediateOutputSizeTextures[0].size(); j++){ + for (int k = 0; k < intermediateOutputSizeTextures[0][0].size(); k++){ + device.destroyFramebuffer(intermediateOutputSizeTextureFBOs[i][j][k]); + device.destroyImageView(intermediateOutputSizeTextures[i][j][k].image_view); + vmaDestroyImage(instance.GetAllocator(), intermediateOutputSizeTextures[i][j][k].image, intermediateOutputSizeTextures[i][j][k].allocation); + } + } + } device.destroyRenderPass(textureRenderpass); device.destroyPipeline(cursor_pipeline); device.destroyShaderModule(cursor_vertex_shader); @@ -612,6 +631,10 @@ void RendererVulkan::CreateTextureFramebuffer(TextureInfo& texture, vk::Framebuf if (texture.width == 0 || texture.height == 0){ return; } + vk::Device device = instance.GetDevice(); + if (framebuffer){ + device.destroyFramebuffer(framebuffer); + } const vk::FramebufferCreateInfo framebuffer_info = { .renderPass = textureRenderpass, .attachmentCount = 1, @@ -1607,9 +1630,6 @@ void RendererVulkan::DrawSingleScreen(u32 screen_id, float screenLeft, float scr std::vector screen_ids; std::vector texturesToSample; - - - currentPass = 0; if (antialiasingMode == 1){ screen_ids.assign({screen_id});