From 4e841ca3a62d9abb7d8d18393915f8b69273cf41 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Thu, 27 Aug 2020 16:51:39 +0200 Subject: [PATCH] Naming fix, better names for temp fbos --- GPU/Common/FramebufferManagerCommon.cpp | 14 ++++++++------ ext/native/thin3d/thin3d_vulkan.cpp | 2 ++ 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/GPU/Common/FramebufferManagerCommon.cpp b/GPU/Common/FramebufferManagerCommon.cpp index 29470e8ce9..b3348cbc36 100644 --- a/GPU/Common/FramebufferManagerCommon.cpp +++ b/GPU/Common/FramebufferManagerCommon.cpp @@ -1760,8 +1760,8 @@ void FramebufferManagerCommon::DestroyAllFBOs() { tempFBOs_.clear(); } -Draw::Framebuffer *FramebufferManagerCommon::GetTempFBO(TempFBO reason, u16 w, u16 h, Draw::FBColorDepth depth) { - u64 key = ((u64)reason << 48) | ((u64)depth << 32) | ((u32)w << 16) | h; +Draw::Framebuffer *FramebufferManagerCommon::GetTempFBO(TempFBO reason, u16 w, u16 h, Draw::FBColorDepth color_depth) { + u64 key = ((u64)reason << 48) | ((u64)color_depth << 32) | ((u32)w << 16) | h; auto it = tempFBOs_.find(key); if (it != tempFBOs_.end()) { it->second.last_frame_used = gpuStats.numFlips; @@ -1770,10 +1770,12 @@ Draw::Framebuffer *FramebufferManagerCommon::GetTempFBO(TempFBO reason, u16 w, u textureCache_->ForgetLastTexture(); bool z_stencil = reason == TempFBO::STENCIL; - const char *name = "temp_fbo"; - Draw::Framebuffer *fbo = draw_->CreateFramebuffer({ w, h, 1, 1, z_stencil, depth, name }); - if (!fbo) - return fbo; + char name[128]; + snprintf(name, sizeof(name), "temp_fbo_%dx%d%s", w, h, z_stencil ? "_depth" : ""); + Draw::Framebuffer *fbo = draw_->CreateFramebuffer({ w, h, 1, 1, z_stencil, color_depth, name }); + if (!fbo) { + return nullptr; + } const TempFBOInfo info = { fbo, gpuStats.numFlips }; tempFBOs_[key] = info; diff --git a/ext/native/thin3d/thin3d_vulkan.cpp b/ext/native/thin3d/thin3d_vulkan.cpp index 7e4b504515..3308c7f657 100644 --- a/ext/native/thin3d/thin3d_vulkan.cpp +++ b/ext/native/thin3d/thin3d_vulkan.cpp @@ -1460,6 +1460,8 @@ private: Framebuffer *VKContext::CreateFramebuffer(const FramebufferDesc &desc) { VkCommandBuffer cmd = renderManager_.GetInitCmd(); + // TODO: We always create with depth here, even when it's not needed (such as color temp FBOs). + // Should optimize those away. VKRFramebuffer *vkrfb = new VKRFramebuffer(vulkan_, cmd, renderManager_.GetFramebufferRenderPass(), desc.width, desc.height, desc.tag); return new VKFramebuffer(vkrfb); }