From 4f1c94f83fda6fa89a6ce077e3a5db73effa3668 Mon Sep 17 00:00:00 2001 From: baldurk Date: Tue, 11 Nov 2014 00:00:35 +0000 Subject: [PATCH] Make sure invalid/undefined and texture buffers are properly cached --- renderdoc/driver/gl/gl_replay.cpp | 41 ++++++++++++++++--------------- 1 file changed, 21 insertions(+), 20 deletions(-) diff --git a/renderdoc/driver/gl/gl_replay.cpp b/renderdoc/driver/gl/gl_replay.cpp index 388542fb0..34e9db9c5 100644 --- a/renderdoc/driver/gl/gl_replay.cpp +++ b/renderdoc/driver/gl/gl_replay.cpp @@ -320,10 +320,26 @@ void GLReplay::CacheTexture(ResourceId id) auto &res = m_pDriver->m_Textures[id]; - if(res.resource.Namespace == eResUnknown) + if(res.resource.Namespace == eResUnknown || res.curType == eGL_NONE) { - RDCERR("Details for invalid texture id %llu requested", id); - RDCEraseEl(tex); + if(res.resource.Namespace == eResUnknown) + RDCERR("Details for invalid texture id %llu requested", id); + + tex.name = L""; + tex.customName = false; + tex.format = ResourceFormat(); + tex.dimension = 1; + tex.width = tex.height = tex.depth = 1; + tex.cubemap = false; + tex.mips = 1; + tex.arraysize = 1; + tex.numSubresources = 1; + tex.creationFlags = 0; + tex.msQual = 0; + tex.msSamp = 1; + tex.byteSize = 1; + + m_CachedTextures[id] = tex; return; } @@ -331,22 +347,6 @@ void GLReplay::CacheTexture(ResourceId id) tex.ID = m_pDriver->GetResourceManager()->GetOriginalID(id); - if(res.curType == eGL_NONE) - { - tex.customName = false; - tex.format = ResourceFormat(); - tex.dimension = 0; - tex.width = tex.height = tex.depth = 0; - tex.cubemap = false; - tex.mips = 0; - tex.arraysize = 0; - tex.numSubresources = 0; - tex.creationFlags = 0; - tex.msQual = tex.msSamp = 0; - tex.byteSize = 0; - return; - } - gl.glBindTexture(res.curType, res.resource.name); GLenum levelQueryType = res.curType; @@ -468,7 +468,8 @@ void GLReplay::CacheTexture(ResourceId id) gl.glGetTexLevelParameteriv(levelQueryType, 0, eGL_TEXTURE_BUFFER_SIZE, (GLint *)&tex.width); tex.byteSize = tex.width/(tex.format.compByteWidth*tex.format.compCount); - + + m_CachedTextures[id] = tex; return; }