Make shader inputs/outputs only statically indexable Previously we used a Reactor array of SIMD variables to store shader inputs and outputs. This allows for dynamic indexing but that's not needed. LLVM has difficulties performing Scalar-Replacement-of-Aggregates (SROA) on this array, resulting in unnecessary initialization of all elements and presumably other loads and stores it could optimize. Bug: b/219942708 Change-Id: I4844b184db84ba2183e14c1f0b88b04a553a5626 Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/63028 Kokoro-Result: kokoro <noreply+kokoro@google.com> Tested-by: Nicolas Capens <nicolascapens@google.com> Reviewed-by: Alexis Hétu <sugoi@google.com>
diff --git a/src/Pipeline/SpirvShader.cpp b/src/Pipeline/SpirvShader.cpp index 726e457..3334677 100644 --- a/src/Pipeline/SpirvShader.cpp +++ b/src/Pipeline/SpirvShader.cpp
@@ -927,7 +927,7 @@ VisitInterface(resultId, [&userDefinedInterface](Decorations const &d, AttribType type) { // Populate a single scalar slot in the interface from a collection of decorations and the intended component type. - auto scalarSlot = (d.Location << 2) | d.Component; + int32_t scalarSlot = (d.Location << 2) | d.Component; ASSERT(scalarSlot >= 0 && scalarSlot < static_cast<int32_t>(userDefinedInterface.size()));