Fix decorations bleeding to following block members
Block members were getting decorations applied from all previous
block members. For example, in this case:
in InterfaceBlock {
layout(location = 0) in vec4 in_color_smooth;
layout(location = 1) in flat vec4 in_color_flat;
layout(location = 2) in noperspective vec4 in_color_noperspective;
layout(location = 3) in centroid vec4 in_color_centroid;
}
- the member at location 2 would get decorated with both flat and
noperspective
- the member at location 3 would get decorated with both flat,
noperspective and centroid
I added a local variable for the member decorations in order to not
bleed information between block members.
Bug: b/163600604
Change-Id: I6b79609f19ae2f2f48909af929f798a48b4cde34
Tests: dEQP-VK.draw.multiple_interpolation.structured.*
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/47649
Presubmit-Ready: Alexis Hétu <sugoi@google.com>
Kokoro-Result: kokoro <noreply+kokoro@google.com>
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
diff --git a/src/Pipeline/SpirvShader.cpp b/src/Pipeline/SpirvShader.cpp
index 0374aaa..854515c 100644
--- a/src/Pipeline/SpirvShader.cpp
+++ b/src/Pipeline/SpirvShader.cpp
@@ -1018,8 +1018,9 @@
// iterate over members, which may themselves have Location/Component decorations
for(auto i = 0u; i < obj.definition.wordCount() - 2; i++)
{
- ApplyDecorationsForIdMember(&d, id, i);
- d.Location = VisitInterfaceInner(obj.definition.word(i + 2), d, f);
+ Decorations dMember = d;
+ ApplyDecorationsForIdMember(&dMember, id, i);
+ d.Location = VisitInterfaceInner(obj.definition.word(i + 2), dMember, f);
d.Component = 0; // Implicit locations always have component=0
}
return d.Location;