Fix calculation of scalar offsets for task payload in SPIR-V reflection

This commit is contained in:
baldurk
2023-12-14 13:16:24 +00:00
parent 3766b9fa2f
commit 6dcbafe329
2 changed files with 20 additions and 7 deletions
@@ -432,10 +432,10 @@ StructSizes CalculateStructProps(uint32_t emptyStructSize, const ShaderConstant
if(matSize > 1)
ret.extendedAlign = ret.baseAlign = c.type.matrixByteStride;
ret.scalarSize = ret.scalarAlign * RDCMAX(c.type.rows, (uint8_t)1) *
RDCMAX(c.type.columns, (uint8_t)1) * RDCMAX(c.type.elements, 1U);
ret.baseSize = ret.baseAlign * matSize * RDCMAX(c.type.elements, 1U);
ret.extendedSize = ret.extendedAlign * matSize * RDCMAX(c.type.elements, 1U);
ret.scalarSize =
ret.scalarAlign * RDCMAX(c.type.rows, (uint8_t)1) * RDCMAX(c.type.columns, (uint8_t)1);
ret.baseSize = ret.baseAlign * matSize;
ret.extendedSize = ret.extendedAlign * matSize;
}
else
{
@@ -483,6 +483,10 @@ 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);
return ret;
}
@@ -1875,6 +1879,10 @@ void Reflector::MakeConstantBlockVariables(rdcspv::StorageClass storage, const D
else if(capabilities.find(rdcspv::Capability::StoragePushConstant16) != capabilities.end())
emptyStructSize = 2;
}
else if(storage == rdcspv::StorageClass::TaskPayloadWorkgroupEXT)
{
return;
}
for(size_t i = 0; i < cblock.size(); i++)
{
+8 -3
View File
@@ -1510,13 +1510,18 @@ static void LayOutStorageStruct(rdcspv::Editor &editor, const rdcarray<SpecConst
if(childType.type == rdcspv::DataType::ArrayType)
memberTypeId = childType.InnerType();
if(childType.type == rdcspv::DataType::StructType ||
(childType.type == rdcspv::DataType::ArrayType &&
editor.GetDataType(childType.InnerType()).type == rdcspv::DataType::StructType))
if(childType.type == rdcspv::DataType::StructType)
{
offset = AlignUp16(offset);
LayOutStorageStruct(editor, specInfo, outputTypeReplacements, childType, memberTypeId, size);
}
else if(childType.type == rdcspv::DataType::ArrayType &&
editor.GetDataType(childType.InnerType()).type == rdcspv::DataType::StructType)
{
offset = AlignUp16(offset);
LayOutStorageStruct(editor, specInfo, outputTypeReplacements,
editor.GetDataType(childType.InnerType()), memberTypeId, size);
}
else if(childType.type == rdcspv::DataType::ArrayType)
{
const rdcspv::DataType &arrayInnerType = editor.GetDataType(childType.InnerType());