Fix GLES initial state readback of compressed cubemaps

This commit is contained in:
baldurk
2018-06-20 22:27:16 +01:00
parent 44edfc64cc
commit 67037ed4a1
+8 -2
View File
@@ -781,6 +781,9 @@ void GLResourceManager::PrepareTextureInitialContents(ResourceId liveid, Resourc
{
size_t size = GetCompressedByteSize(w, h, d, details.internalFormat);
if(details.curType == eGL_TEXTURE_CUBE_MAP)
size /= 6;
byte *buf = new byte[size];
if(IsGLES)
@@ -1475,8 +1478,11 @@ bool GLResourceManager::Serialise_InitialState(SerialiserType &ser, ResourceId r
{
if(IsGLES)
{
details.compressedData[i].resize(size);
memcpy(details.compressedData[i].data(), scratchBuf, size);
size_t startOffs =
IsCubeFace(targets[trg]) ? CubeTargetIndex(targets[trg]) * size : 0;
details.compressedData[i].resize(startOffs + size);
memcpy(details.compressedData[i].data() + startOffs, scratchBuf, size);
}
if(TextureState.dim == 1)