more fixes
This commit is contained in:
@@ -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)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user