Commit 5be4d706 by Chris Forbes

Add support for arrays to interface and size analyses

Only missing piece here was the array size, which is available since we support integer constants now. Bug: b/120799499 Change-Id: I8c42aa2ced86e8358be1ffbfaa14ca87b58cc138 Reviewed-on: https://swiftshader-review.googlesource.com/c/23449Reviewed-by: 's avatarAlexis Hétu <sugoi@google.com> Tested-by: 's avatarChris Forbes <chrisforbes@google.com>
parent bc3a0ee9
......@@ -245,10 +245,11 @@ namespace sw
return defs[insn.word(2)].sizeInComponents * insn.word(3);
case spv::OpTypeArray:
// This should be the element count * element size. Array sizes come from constant ids,
// which we haven't yet implemented.
UNIMPLEMENTED("Need constant support to get array size");
return 1;
{
// Element count * element size. Array sizes come from constant ids.
auto arraySize = GetConstantInt(insn.word(3));
return defs[insn.word(2)].sizeInComponents * arraySize;
}
case spv::OpTypeStruct:
{
......@@ -346,7 +347,15 @@ namespace sw
}
return d.Location;
}
// TODO: array
case spv::OpTypeArray:
{
auto arraySize = GetConstantInt(obj.definition.word(3));
for (auto i = 0u; i < arraySize; i++)
{
d.Location = PopulateInterfaceInner(iface, obj.definition.word(2), d);
}
return d.Location;
}
default:
// Intentionally partial; most opcodes do not participate in type hierarchies
return 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment