From 5ad5a0af49a921c246f906b2fe560fc8a83abfac Mon Sep 17 00:00:00 2001 From: baldurk Date: Thu, 27 Nov 2014 19:52:26 +0000 Subject: [PATCH] Potentially overestimate compressed image size to avoid crashes * I need to investigate this more. It seems that on AMD the compressed image size returned is the size of the whole cubemap, and then you get each face one-by-one. On nVidia the compressed image size is the size of one face, so dividing by 6 gives too little space. * I don't know which one is standard correct, but that kind of doesn't matter since I probably need to query the size for maybe a 1x1 cubemap or a known dimension & compression format (like BC1 1 byte per pixel). --- renderdoc/driver/gl/gl_manager.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/renderdoc/driver/gl/gl_manager.cpp b/renderdoc/driver/gl/gl_manager.cpp index 1b0d300aa..66025a9d0 100644 --- a/renderdoc/driver/gl/gl_manager.cpp +++ b/renderdoc/driver/gl/gl_manager.cpp @@ -474,8 +474,12 @@ bool GLResourceManager::Serialise_InitialState(GLResource res) // cubemaps return the compressed image size for the whole texture, but we read it // face by face - if(t == eGL_TEXTURE_CUBE_MAP) - size /= 6; + // + // Disabled since it seems nvidia doesn't return the whole image size, but just the size per face, + // and it's not clear which is right (or how to handle that anyway). Worst case this means we serialise out + // too much data (since only the first face of data will be used). + //if(t == eGL_TEXTURE_CUBE_MAP) + // size /= 6; byte *buf = new byte[size];