Commit 1c658230 by Chris Forbes

Adjust interface extraction to account for split types

OpVariable handling needs to be split out; variables are clearly not present in the type tree. Take care to apply the OpVariable's decorations in the right place. Bug: b/123779863 Change-Id: I2761a604683cf8b025f6b9ba1efa5383f53d7ed1 Reviewed-on: https://swiftshader-review.googlesource.com/c/24372Reviewed-by: 's avatarAlexis Hétu <sugoi@google.com> Tested-by: 's avatarChris Forbes <chrisforbes@google.com> Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>
parent 3f5a4792
...@@ -364,8 +364,6 @@ namespace sw ...@@ -364,8 +364,6 @@ namespace sw
auto const &obj = getType(id); auto const &obj = getType(id);
switch (obj.definition.opcode()) switch (obj.definition.opcode())
{ {
case spv::OpVariable:
return PopulateInterfaceInner(iface, obj.definition.word(1), d);
case spv::OpTypePointer: case spv::OpTypePointer:
return PopulateInterfaceInner(iface, obj.definition.word(3), d); return PopulateInterfaceInner(iface, obj.definition.word(3), d);
case spv::OpTypeMatrix: case spv::OpTypeMatrix:
...@@ -426,7 +424,16 @@ namespace sw ...@@ -426,7 +424,16 @@ namespace sw
{ {
// Walk a variable definition and populate the interface from it. // Walk a variable definition and populate the interface from it.
Decorations d{}; Decorations d{};
PopulateInterfaceInner(iface, id, d);
auto const it = decorations.find(id);
if (it != decorations.end())
{
d.Apply(it->second);
}
auto def = getObject(id).definition;
assert(def.opcode() == spv::OpVariable);
PopulateInterfaceInner(iface, def.word(1), d);
} }
void SpirvShader::Decorations::Apply(spv::Decoration decoration, uint32_t arg) void SpirvShader::Decorations::Apply(spv::Decoration decoration, uint32_t arg)
......
...@@ -229,6 +229,12 @@ namespace sw ...@@ -229,6 +229,12 @@ namespace sw
return it->second; return it->second;
} }
Object const &getObject(uint32_t id) const {
auto it = defs.find(id);
assert(it != defs.end());
return it->second;
}
void ProcessExecutionMode(InsnIterator it); void ProcessExecutionMode(InsnIterator it);
uint32_t ComputeTypeSize(InsnIterator insn); uint32_t ComputeTypeSize(InsnIterator insn);
......
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