Make sure all arrays preserve 'depth' when calculating mip dims

This commit is contained in:
baldurk committed 2014-12-13 21:15:42 +00:00
1 parent f55e8cdd37
commit 35a13fe160
1 file changed
+17 -8
+17 -8
View File
@@ -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