more fixes

This commit is contained in:
Till Wübbers
2025-04-29 08:01:26 +02:00
parent 171e25ac76
commit 02c40aeea6
5 changed files with 76 additions and 5 deletions

View File

@@ -235,8 +235,18 @@ namespace Game
*_orientation = imageContainer.m_orientation;
}
const bgfx::Memory* mem =
bgfx::makeRef(data->data + imageContainer.m_offset, data->size - imageContainer.m_offset);
// We're working with ktx textures, so the size should be in front of the actual data
const uint32_t* texSizePtr = reinterpret_cast<uint32_t*>(data->data + imageContainer.m_offset);
uint8_t* dataPtr = data->data + imageContainer.m_offset + sizeof(uint32_t);
uint32_t dataSize = data->size - imageContainer.m_offset - sizeof(uint32_t);
// Extra sanity check
if (*texSizePtr != dataSize)
{
LOG_WARN("Texture size sanity check failed! %u != %u", texSizePtr, dataSize);
return handle;
}
const bgfx::Memory* mem = bgfx::makeRef(dataPtr, dataSize);
if (NULL != _info)
{