shaderObject: possible alignment issues
qbojj opened this issue · 0 comments
qbojj commented
Because of the manual memory sub-allocation inside of objects (eg. FullDrawStateData
, Shader
and CommandBufferData
), memory may be misaligned either due VU or to ISO C alignment requirement.
Example of this would be if Shader
was created with strlen( pName ) + 1
not being a multiple of 4, then spirv_data
is not aligned to 4 which breaks VUID-VkShaderModuleCreateInfo-codeSize-08735.
Places use dynamic allocation with extended fields:
Shader
: all dynamically added members must be aligned apart fromname
(either to VU or ISO C alignment) and all of them are susceptibleFullDrawStateData
: all dynamically added fields are arrays that have alignment of 4 (at least for now) and the class is already aligned to 8 (or 4 on 32-bit systems ?) so will not break the alignment unless an new dynamic state extension with greater alignment requirement was added.CommandBufferData
: class already aligned to 8 (4 on 32-bit ?) and only allocating additionally aFullDrawStateData
so again it will not break unless something was added toFullDrawStateData
that increases alignment requirements.
Also in some places pfnAllocation
is called with alignment=0, but I would expect a real alignment here.