OSDN Git Service

Carry decorations down type tree in WalkExplicitLayoutAccessChain
authorChris Forbes <chrisforbes@google.com>
Tue, 19 Mar 2019 16:06:19 +0000 (09:06 -0700)
committerChris Forbes <chrisforbes@google.com>
Tue, 19 Mar 2019 20:38:13 +0000 (20:38 +0000)
Bug: b/128690261
Bug: b/128872954
Test: dEQP-VK.*push_constant*
Test: dEQP-VK.glsl.*
Test: dEQP-VK.spirv_assembly.*
Change-Id: I0f8d103288777cd03347b32366ed5c5606e38b8d
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/27588
Presubmit-Ready: Chris Forbes <chrisforbes@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Tested-by: Chris Forbes <chrisforbes@google.com>
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>

src/Pipeline/SpirvShader.cpp

index 46a8fd5..f348c03 100644 (file)
@@ -751,6 +751,8 @@ namespace sw
                SIMD::Int dynamicOffset = SIMD::Int(0);
                auto &baseObject = getObject(id);
                Type::ID typeId = getType(baseObject.type).element;
+               Decorations d{};
+               ApplyDecorationsForId(&d, baseObject.type);
 
                // The <base> operand is an intermediate value itself, ie produced by a previous OpAccessChain.
                // Start with its offset and build from there.
@@ -767,7 +769,6 @@ namespace sw
                        case spv::OpTypeStruct:
                        {
                                int memberIndex = GetConstantInt(indexIds[i]);
-                               Decorations d{};
                                ApplyDecorationsForIdMember(&d, typeId, memberIndex);
                                ASSERT(d.HasOffset);
                                constantOffset += d.Offset / sizeof(float);
@@ -778,7 +779,6 @@ namespace sw
                        case spv::OpTypeRuntimeArray:
                        {
                                // TODO: b/127950082: Check bounds.
-                               Decorations d{};
                                ApplyDecorationsForId(&d, typeId);
                                ASSERT(d.HasArrayStride);
                                auto & obj = getObject(indexIds[i]);
@@ -792,7 +792,6 @@ namespace sw
                        case spv::OpTypeMatrix:
                        {
                                // TODO: b/127950082: Check bounds.
-                               Decorations d{};
                                ApplyDecorationsForId(&d, typeId);
                                ASSERT(d.HasMatrixStride);
                                auto & obj = getObject(indexIds[i]);