From 35a13fe1606860285600f65cb444dc517a8c2dda Mon Sep 17 00:00:00 2001 From: baldurk Date: Sat, 13 Dec 2014 21:15:42 +0000 Subject: [PATCH] Make sure all arrays preserve 'depth' when calculating mip dims --- renderdoc/driver/gl/gl_manager.cpp | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/renderdoc/driver/gl/gl_manager.cpp b/renderdoc/driver/gl/gl_manager.cpp index 12fd2abb2..2f63177a5 100644 --- a/renderdoc/driver/gl/gl_manager.cpp +++ b/renderdoc/driver/gl/gl_manager.cpp @@ -278,7 +278,9 @@ bool GLResourceManager::Prepare_InitialState(GLResource res) if(details.curType == eGL_TEXTURE_CUBE_MAP) d *= 6; - else if(details.curType == eGL_TEXTURE_CUBE_MAP_ARRAY) + else if(details.curType == eGL_TEXTURE_CUBE_MAP_ARRAY || + details.curType == eGL_TEXTURE_1D_ARRAY || + details.curType == eGL_TEXTURE_2D_ARRAY) d = details.depth; // it seems like everything explodes if I do glCopyImageSubData on a D32F_S8 texture - in-program the overlay @@ -543,10 +545,6 @@ bool GLResourceManager::Serialise_InitialState(GLResource res) { for(int i=0; i < mips; i++) { - int w = RDCMAX(details.width>>i, 1); - int h = RDCMAX(details.height>>i, 1); - int d = RDCMAX(details.depth>>i, 1); - GLenum targets[] = { eGL_TEXTURE_CUBE_MAP_POSITIVE_X, eGL_TEXTURE_CUBE_MAP_NEGATIVE_X, @@ -612,7 +610,9 @@ bool GLResourceManager::Serialise_InitialState(GLResource res) int h = RDCMAX(details.height>>i, 1); int d = RDCMAX(details.depth>>i, 1); - if(t == eGL_TEXTURE_CUBE_MAP_ARRAY) + if(t == eGL_TEXTURE_CUBE_MAP_ARRAY || + t == eGL_TEXTURE_1D_ARRAY || + t == eGL_TEXTURE_2D_ARRAY) d = details.depth; size = GetByteSize(w, h, d, fmt, type, 0); @@ -743,6 +743,11 @@ bool GLResourceManager::Serialise_InitialState(GLResource res) uint32_t h = RDCMAX(height>>i, 1U); uint32_t d = RDCMAX(depth>>i, 1U); + if(textype == eGL_TEXTURE_CUBE_MAP_ARRAY || + textype == eGL_TEXTURE_1D_ARRAY || + textype == eGL_TEXTURE_2D_ARRAY) + d = depth; + GLenum targets[] = { eGL_TEXTURE_CUBE_MAP_POSITIVE_X, eGL_TEXTURE_CUBE_MAP_NEGATIVE_X, @@ -793,7 +798,9 @@ bool GLResourceManager::Serialise_InitialState(GLResource res) uint32_t h = RDCMAX(height>>i, 1U); uint32_t d = RDCMAX(depth>>i, 1U); - if(textype == eGL_TEXTURE_CUBE_MAP_ARRAY) + if(textype == eGL_TEXTURE_CUBE_MAP_ARRAY || + textype == eGL_TEXTURE_1D_ARRAY || + textype == eGL_TEXTURE_2D_ARRAY) d = depth; GLenum targets[] = { @@ -965,7 +972,9 @@ void GLResourceManager::Apply_InitialState(GLResource live, InitialContentData i if(details.curType == eGL_TEXTURE_CUBE_MAP) d *= 6; - else if(details.curType == eGL_TEXTURE_CUBE_MAP_ARRAY) + else if(details.curType == eGL_TEXTURE_CUBE_MAP_ARRAY || + details.curType == eGL_TEXTURE_1D_ARRAY || + details.curType == eGL_TEXTURE_2D_ARRAY) d = details.depth; // it seems like everything explodes if I do glCopyImageSubData on a D32F_S8 texture - on replay loads of things