SPV: Memory qualifiers should decorate top-level block members

This commit is contained in:
Rex Xu 2017-07-27 14:33:16 +08:00
parent f1f5058a3c
commit 286ca432cf
5 changed files with 3 additions and 10 deletions

View File

@ -2531,7 +2531,9 @@ void TGlslangToSpvTraverser::decorateStructType(const glslang::TType& type,
}
addMemberDecoration(spvType, member, TranslateInvariantDecoration(memberQualifier));
if (qualifier.storage == glslang::EvqBuffer) {
if (type.getBasicType() == glslang::EbtBlock &&
qualifier.storage == glslang::EvqBuffer) {
// Add memory decorations only to top-level members of shader storage block
std::vector<spv::Decoration> memory;
TranslateMemoryDecoration(memberQualifier, memory);
for (unsigned int i = 0; i < memory.size(); ++i)

View File

@ -208,9 +208,7 @@ gl_FragCoord origin is upper left
MemberDecorate 15(sbuf2) 0 Offset 0
Decorate 15(sbuf2) BufferBlock
Decorate 17(sbuf2) DescriptorSet 0
MemberDecorate 28(sb_t) 0 Coherent
MemberDecorate 28(sb_t) 0 Offset 0
MemberDecorate 28(sb_t) 1 Coherent
MemberDecorate 28(sb_t) 1 Offset 12
Decorate 29 ArrayStride 16
MemberDecorate 30(sbuf) 0 Coherent

View File

@ -221,11 +221,8 @@ gl_FragCoord origin is upper left
Name 89 "pos"
Name 92 "@entryPointOutput"
Name 93 "param"
MemberDecorate 19(sb_t) 0 NonWritable
MemberDecorate 19(sb_t) 0 Offset 0
MemberDecorate 19(sb_t) 1 NonWritable
MemberDecorate 19(sb_t) 1 Offset 12
MemberDecorate 19(sb_t) 2 NonWritable
MemberDecorate 19(sb_t) 2 Offset 16
Decorate 20 ArrayStride 32
MemberDecorate 21(sbuf) 0 NonWritable

View File

@ -44,9 +44,7 @@ spv.memoryQualifier.frag
Decorate 44(iCube) DescriptorSet 0
Decorate 44(iCube) Binding 3
Decorate 44(iCube) NonReadable
MemberDecorate 49(Data) 0 Coherent
MemberDecorate 49(Data) 0 Offset 0
MemberDecorate 49(Data) 1 Coherent
MemberDecorate 49(Data) 1 Offset 8
MemberDecorate 50(Buffer) 0 Coherent
MemberDecorate 50(Buffer) 0 Volatile

View File

@ -30,9 +30,7 @@ spv.ssbo.autoassign.frag
Name 92 "pos"
Name 95 "@entryPointOutput"
Name 96 "param"
MemberDecorate 14(BufType) 0 NonWritable
MemberDecorate 14(BufType) 0 Offset 0
MemberDecorate 14(BufType) 1 NonWritable
MemberDecorate 14(BufType) 1 Offset 16
Decorate 15 ArrayStride 32
MemberDecorate 16(SB0) 0 NonWritable