Skip to content
Snippets Groups Projects
Commit 4e42170a authored by Rye Mutt's avatar Rye Mutt :bread:
Browse files

Add cubemap array textures to video memory tracking

parent 0f7b8c04
No related branches found
No related tags found
2 merge requests!3Update to main branch,!2Rebase onto current main branch
......@@ -42,6 +42,9 @@
//#pragma optimize("", off)
// tex mem tracking
extern void alloc_tex_image(U32 width, U32 height, U32 pixformat, U32 count);
// MUST match order of OpenGL face-layers
GLenum LLCubeMapArray::sTargets[6] =
{
......@@ -139,6 +142,8 @@ void LLCubeMapArray::allocate(U32 resolution, U32 components, U32 count, BOOL us
++mip;
}
alloc_tex_image(resolution, resolution, format, count * 6);
mImage->setAddressMode(LLTexUnit::TAM_CLAMP);
if (use_mips)
......
......@@ -63,11 +63,12 @@ static U64 sTextureBytes = 0;
// track a texture alloc on the currently bound texture.
// asserts that no currently tracked alloc exists
static void alloc_tex_image(U32 width, U32 height, U32 pixformat)
void alloc_tex_image(U32 width, U32 height, U32 pixformat, U32 count)
{
U32 texUnit = gGL.getCurrentTexUnitIndex();
U32 texName = gGL.getTexUnit(texUnit)->getCurrTexture();
U64 size = LLImageGL::dataFormatBytes(pixformat, width, height);
size *= count;
llassert(size >= 0);
......@@ -285,7 +286,10 @@ S32 LLImageGL::dataFormatBits(S32 dataformat)
case GL_RGB: return 24;
case GL_SRGB: return 24;
case GL_RGB8: return 24;
case GL_RGB16F: return 48;
case GL_RGBA: return 32;
case GL_RGBA8: return 32;
case GL_RGBA16F: return 64;
case GL_SRGB_ALPHA: return 32;
case GL_BGRA: return 32; // Used for QuickTime media textures on the Mac
case GL_DEPTH_COMPONENT: return 24;
......@@ -1532,7 +1536,7 @@ void LLImageGL::setManualImage(U32 target, S32 miplevel, S32 intformat, S32 widt
sub_image_lines(target, miplevel, 0, 0, width, height, pixformat, pixtype, src, width);
}
}
alloc_tex_image(width, height, pixformat);
alloc_tex_image(width, height, pixformat, 1);
}
stop_glerror();
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment