Naming fix, better names for temp fbos

This commit is contained in:
Henrik Rydgård 2020-08-27 16:51:39 +02:00
parent 6e9d5ffbd7
commit 4e841ca3a6
2 changed files with 10 additions and 6 deletions

View File

@ -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;

View File

@ -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);
}