Fix size calculation for compressed array textures in GL

This commit is contained in:
baldurk
2017-04-24 22:02:39 +01:00
parent 527b1f7538
commit 498039fcc2
5 changed files with 9 additions and 10 deletions
+4 -4
View File
@@ -837,7 +837,7 @@ void GLResourceManager::PrepareTextureInitialContents(ResourceId liveid, Resourc
for(int trg = 0; trg < count; trg++)
{
size_t size = GetCompressedByteSize(w, h, d, details.internalFormat, i);
size_t size = GetCompressedByteSize(w, h, d, details.internalFormat);
byte *buf = new byte[size];
@@ -1150,7 +1150,7 @@ bool GLResourceManager::Serialise_InitialState(ResourceId resid, GLResource res)
for(int trg = 0; trg < count; trg++)
{
size_t size = GetCompressedByteSize(w, h, d, details.internalFormat, i);
size_t size = GetCompressedByteSize(w, h, d, details.internalFormat);
byte *buf = new byte[size];
@@ -1317,7 +1317,7 @@ bool GLResourceManager::Serialise_InitialState(ResourceId resid, GLResource res)
{
if(isCompressed)
{
GLsizei compSize = (GLsizei)GetCompressedByteSize(w, h, d, internalformat, m);
GLsizei compSize = (GLsizei)GetCompressedByteSize(w, h, d, internalformat);
vector<byte> dummy;
dummy.resize(compSize);
@@ -1786,7 +1786,7 @@ void GLResourceManager::Apply_InitialState(GLResource live, InitialContentData i
for(int trg = 0; trg < count; trg++)
{
size_t size = GetCompressedByteSize(w, h, d, details.internalFormat, i);
size_t size = GetCompressedByteSize(w, h, d, details.internalFormat);
if(details.curType == eGL_TEXTURE_CUBE_MAP)
size /= 6;
+2 -3
View File
@@ -712,9 +712,8 @@ void GLReplay::CacheTexture(ResourceId id)
{
if(compressed)
{
gl.glGetTextureLevelParameterivEXT(res.resource.name, levelQueryType, m,
eGL_TEXTURE_COMPRESSED_IMAGE_SIZE, &compressed);
tex.byteSize += compressed;
tex.byteSize += (uint64_t)GetCompressedByteSize(
RDCMAX(1U, tex.width >> m), RDCMAX(1U, tex.height >> m), 1, (GLenum)fmt);
}
else if(tex.format.special)
{
+1 -1
View File
@@ -30,7 +30,7 @@ byte GLResourceRecord::markerValue[32] = {
0xaa, 0xbb, 0xcc, 0xdd, 0x88, 0x77, 0x66, 0x55, 0x01, 0x23, 0x45, 0x67, 0x98, 0x76, 0x54, 0x32,
};
size_t GetCompressedByteSize(GLsizei w, GLsizei h, GLsizei d, GLenum internalformat, int mip)
size_t GetCompressedByteSize(GLsizei w, GLsizei h, GLsizei d, GLenum internalformat)
{
if(!IsCompressedFormat(internalformat))
{
+1 -1
View File
@@ -30,7 +30,7 @@
struct GLHookSet;
size_t GetCompressedByteSize(GLsizei w, GLsizei h, GLsizei d, GLenum internalformat, int mip);
size_t GetCompressedByteSize(GLsizei w, GLsizei h, GLsizei d, GLenum internalformat);
size_t GetByteSize(GLsizei w, GLsizei h, GLsizei d, GLenum format, GLenum type);
GLenum GetBaseFormat(GLenum internalFormat);
GLenum GetDataType(GLenum internalFormat);
+1 -1
View File
@@ -1109,7 +1109,7 @@ void APIENTRY _glCopyImageSubData(GLuint srcName, GLenum srcTarget, GLint srcLev
count = 1;
}
size_t size = GetCompressedByteSize(srcWidth, srcHeight, srcDepth, fmt, srcLevel);
size_t size = GetCompressedByteSize(srcWidth, srcHeight, srcDepth, fmt);
if(srcTarget == eGL_TEXTURE_CUBE_MAP)
size /= 6;