mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-08-23 23:16:31 +00:00
Fix calculation of array size when calculating struct sizes
* Non-tightly packed arrays can be larger based on the stride than base size multiplied by element count, e.g. with a 4-byte uint with a 16-byte array stride.
This commit is contained in:
@@ -484,9 +484,13 @@ StructSizes CalculateStructProps(uint32_t emptyStructSize, const ShaderConstant
|
||||
}
|
||||
}
|
||||
|
||||
ret.scalarSize *= RDCMAX(c.type.elements, 1U);
|
||||
ret.baseSize *= RDCMAX(c.type.elements, 1U);
|
||||
ret.extendedSize *= RDCMAX(c.type.elements, 1U);
|
||||
if(c.type.elements > 1)
|
||||
{
|
||||
const uint32_t nonFinalArraySize = (c.type.elements - 1) * c.type.arrayByteStride;
|
||||
ret.scalarSize += nonFinalArraySize;
|
||||
ret.baseSize += nonFinalArraySize;
|
||||
ret.extendedSize += nonFinalArraySize;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user