// TODO: think about explicit layout (UBO/SSBO) storage classes
// TODO: avoid doing per-lane work in some cases if we can?
- Int4 res = Int4(0);
+ int constantOffset = 0;
+ Int4 dynamicOffset = Int4(0);
auto & baseObject = getObject(id);
auto typeId = baseObject.definition.word(1);
if (baseObject.kind == Object::Kind::Value)
- res += As<Int4>(routine->getValue(id)[0]);
+ dynamicOffset += As<Int4>(routine->getValue(id)[0]);
for (auto i = 0u; i < numIndexes; i++)
{
for (auto j = 0; j < memberIndex; j++) {
offsetIntoStruct += getType(type.definition.word(2 + memberIndex)).sizeInComponents;
}
- res += Int4(offsetIntoStruct);
+ constantOffset += offsetIntoStruct;
break;
}
auto stride = getType(type.definition.word(2)).sizeInComponents;
auto & obj = getObject(indexIds[i]);
if (obj.kind == Object::Kind::Constant)
- res += Int4(stride * GetConstantInt(indexIds[i]));
+ constantOffset += stride * GetConstantInt(indexIds[i]);
else
- res += Int4(stride) * As<Int4>(routine->getValue(indexIds[i])[0]);
+ dynamicOffset += Int4(stride) * As<Int4>(routine->getValue(indexIds[i])[0]);
break;
}
}
}
- return res;
+ return dynamicOffset + Int4(constantOffset);
}
void SpirvShader::Decorations::Apply(spv::Decoration decoration, uint32_t arg)