From 9a5689f63284844dab7a61217d6e574bee48a714 Mon Sep 17 00:00:00 2001 From: John Kessenich Date: Thu, 22 Aug 2019 06:58:26 -0600 Subject: [PATCH] GLSL: Inherit memory qualifiers, both declaratively and in execution. Fixes #1870, probably others. --- Test/310.inheritMemory.frag | 43 ++++++ Test/baseResults/310.comp.out | 114 +++++++------- Test/baseResults/310.inheritMemory.frag.out | 229 ++++++++++++++++++++++++++++ Test/baseResults/430.comp.out | 14 +- Test/baseResults/specExamples.vert.out | 4 +- Test/baseResults/specExamplesConf.vert.out | 4 +- Test/baseResults/spv.coopmat.comp.out | 4 +- glslang/Include/Types.h | 14 -- glslang/MachineIndependent/ParseHelper.cpp | 32 +++- glslang/MachineIndependent/ParseHelper.h | 1 + gtests/AST.FromFile.cpp | 1 + 11 files changed, 371 insertions(+), 89 deletions(-) create mode 100644 Test/310.inheritMemory.frag create mode 100644 Test/baseResults/310.inheritMemory.frag.out diff --git a/Test/310.inheritMemory.frag b/Test/310.inheritMemory.frag new file mode 100644 index 0000000..bdf1283 --- /dev/null +++ b/Test/310.inheritMemory.frag @@ -0,0 +1,43 @@ +#version 310 es +precision mediump float; + +struct S { + float buff[10]; +}; + +layout(std430, binding=2) readonly buffer RoBuff { + float buff_ro[10]; + S s_ro; +} ro_buffer; + +layout(std430, binding=2) buffer Buff { + float buff[10]; + S s; +} non_ro_buffer; + +void non_ro_fun(float[10] buff) { } +void non_ro_funf(float el) { } +void non_ro_funS(S s) { } + +out vec4 fragColor; + +void main() +{ + S s; + + non_ro_fun(s.buff); + non_ro_funf(s.buff[3]); + non_ro_funS(s); + + non_ro_fun(non_ro_buffer.buff); + non_ro_fun(non_ro_buffer.s.buff); + non_ro_funf(non_ro_buffer.buff[3]); + non_ro_funf(non_ro_buffer.s.buff[3]); + non_ro_funS(non_ro_buffer.s); + + non_ro_fun(ro_buffer.buff_ro); + non_ro_fun(ro_buffer.s_ro.buff); + non_ro_funf(ro_buffer.buff_ro[3]); + non_ro_funf(ro_buffer.s_ro.buff[3]); + non_ro_funS(ro_buffer.s_ro); +} diff --git a/Test/baseResults/310.comp.out b/Test/baseResults/310.comp.out index b4136b0..538b750 100644 --- a/Test/baseResults/310.comp.out +++ b/Test/baseResults/310.comp.out @@ -119,9 +119,9 @@ ERROR: node is still EOpNull! 0:59 Function Parameters: 0:61 Sequence 0:61 move second child to first child ( temp highp float) -0:61 direct index (layout( column_major shared) temp highp float) -0:61 values: direct index for structure (layout( column_major shared) buffer unsized 3-element array of highp float) -0:61 'ro' (layout( column_major shared) readonly buffer block{layout( column_major shared) buffer highp int value, layout( column_major shared) buffer unsized 3-element array of highp float values}) +0:61 direct index (layout( column_major shared) readonly temp highp float) +0:61 values: direct index for structure (layout( column_major shared) readonly buffer unsized 3-element array of highp float) +0:61 'ro' (layout( column_major shared) readonly buffer block{layout( column_major shared) readonly buffer highp int value, layout( column_major shared) readonly buffer unsized 3-element array of highp float values}) 0:61 Constant: 0:61 1 (const int) 0:61 Constant: @@ -129,8 +129,8 @@ ERROR: node is still EOpNull! 0:61 Constant: 0:61 4.700000 0:62 array length ( temp int) -0:62 values: direct index for structure (layout( column_major shared) buffer unsized 3-element array of highp float) -0:62 'ro' (layout( column_major shared) readonly buffer block{layout( column_major shared) buffer highp int value, layout( column_major shared) buffer unsized 3-element array of highp float values}) +0:62 values: direct index for structure (layout( column_major shared) readonly buffer unsized 3-element array of highp float) +0:62 'ro' (layout( column_major shared) readonly buffer block{layout( column_major shared) readonly buffer highp int value, layout( column_major shared) readonly buffer unsized 3-element array of highp float values}) 0:62 Constant: 0:62 1 (const int) 0:63 Pre-Increment ( temp highp 4-component vector of float) @@ -282,9 +282,9 @@ ERROR: node is still EOpNull! 0:? Sequence 0:194 move second child to first child ( temp highp float) 0:194 'g' ( temp highp float) -0:194 direct index (layout( column_major shared) temp highp float) -0:194 values: direct index for structure (layout( column_major shared) buffer unsized 3-element array of highp float) -0:194 'wo' (layout( column_major shared) writeonly buffer block{layout( column_major shared) buffer highp int value, layout( column_major shared) buffer unsized 3-element array of highp float values}) +0:194 direct index (layout( column_major shared) writeonly temp highp float) +0:194 values: direct index for structure (layout( column_major shared) writeonly buffer unsized 3-element array of highp float) +0:194 'wo' (layout( column_major shared) writeonly buffer block{layout( column_major shared) writeonly buffer highp int value, layout( column_major shared) writeonly buffer unsized 3-element array of highp float values}) 0:194 Constant: 0:194 1 (const int) 0:194 Constant: @@ -292,42 +292,42 @@ ERROR: node is still EOpNull! 0:195 Sequence 0:195 move second child to first child ( temp highp float) 0:195 'f' ( temp highp float) -0:195 direct index (layout( column_major shared) temp highp float) -0:195 values: direct index for structure (layout( column_major shared) buffer unsized 3-element array of highp float) -0:195 'wo' (layout( column_major shared) writeonly buffer block{layout( column_major shared) buffer highp int value, layout( column_major shared) buffer unsized 3-element array of highp float values}) +0:195 direct index (layout( column_major shared) writeonly temp highp float) +0:195 values: direct index for structure (layout( column_major shared) writeonly buffer unsized 3-element array of highp float) +0:195 'wo' (layout( column_major shared) writeonly buffer block{layout( column_major shared) writeonly buffer highp int value, layout( column_major shared) writeonly buffer unsized 3-element array of highp float values}) 0:195 Constant: 0:195 1 (const int) 0:195 Constant: 0:195 2 (const int) 0:196 Pre-Increment ( temp highp float) -0:196 direct index (layout( column_major shared) temp highp float) -0:196 values: direct index for structure (layout( column_major shared) buffer unsized 3-element array of highp float) -0:196 'wo' (layout( column_major shared) writeonly buffer block{layout( column_major shared) buffer highp int value, layout( column_major shared) buffer unsized 3-element array of highp float values}) +0:196 direct index (layout( column_major shared) writeonly temp highp float) +0:196 values: direct index for structure (layout( column_major shared) writeonly buffer unsized 3-element array of highp float) +0:196 'wo' (layout( column_major shared) writeonly buffer block{layout( column_major shared) writeonly buffer highp int value, layout( column_major shared) writeonly buffer unsized 3-element array of highp float values}) 0:196 Constant: 0:196 1 (const int) 0:196 Constant: 0:196 2 (const int) 0:197 Post-Decrement ( temp highp float) -0:197 direct index (layout( column_major shared) temp highp float) -0:197 values: direct index for structure (layout( column_major shared) buffer unsized 3-element array of highp float) -0:197 'wo' (layout( column_major shared) writeonly buffer block{layout( column_major shared) buffer highp int value, layout( column_major shared) buffer unsized 3-element array of highp float values}) +0:197 direct index (layout( column_major shared) writeonly temp highp float) +0:197 values: direct index for structure (layout( column_major shared) writeonly buffer unsized 3-element array of highp float) +0:197 'wo' (layout( column_major shared) writeonly buffer block{layout( column_major shared) writeonly buffer highp int value, layout( column_major shared) writeonly buffer unsized 3-element array of highp float values}) 0:197 Constant: 0:197 1 (const int) 0:197 Constant: 0:197 2 (const int) 0:198 add ( temp highp float) 0:198 'f' ( temp highp float) -0:198 direct index (layout( column_major shared) temp highp float) -0:198 values: direct index for structure (layout( column_major shared) buffer unsized 3-element array of highp float) -0:198 'wo' (layout( column_major shared) writeonly buffer block{layout( column_major shared) buffer highp int value, layout( column_major shared) buffer unsized 3-element array of highp float values}) +0:198 direct index (layout( column_major shared) writeonly temp highp float) +0:198 values: direct index for structure (layout( column_major shared) writeonly buffer unsized 3-element array of highp float) +0:198 'wo' (layout( column_major shared) writeonly buffer block{layout( column_major shared) writeonly buffer highp int value, layout( column_major shared) writeonly buffer unsized 3-element array of highp float values}) 0:198 Constant: 0:198 1 (const int) 0:198 Constant: 0:198 2 (const int) 0:199 subtract ( temp highp float) -0:199 direct index (layout( column_major shared) temp highp float) -0:199 values: direct index for structure (layout( column_major shared) buffer unsized 3-element array of highp float) -0:199 'wo' (layout( column_major shared) writeonly buffer block{layout( column_major shared) buffer highp int value, layout( column_major shared) buffer unsized 3-element array of highp float values}) +0:199 direct index (layout( column_major shared) writeonly temp highp float) +0:199 values: direct index for structure (layout( column_major shared) writeonly buffer unsized 3-element array of highp float) +0:199 'wo' (layout( column_major shared) writeonly buffer block{layout( column_major shared) writeonly buffer highp int value, layout( column_major shared) writeonly buffer unsized 3-element array of highp float values}) 0:199 Constant: 0:199 1 (const int) 0:199 Constant: @@ -339,9 +339,9 @@ ERROR: node is still EOpNull! 0:201 true case 0:201 'f' ( temp highp float) 0:201 false case -0:201 direct index (layout( column_major shared) temp highp float) -0:201 values: direct index for structure (layout( column_major shared) buffer unsized 3-element array of highp float) -0:201 'wo' (layout( column_major shared) writeonly buffer block{layout( column_major shared) buffer highp int value, layout( column_major shared) buffer unsized 3-element array of highp float values}) +0:201 direct index (layout( column_major shared) writeonly temp highp float) +0:201 values: direct index for structure (layout( column_major shared) writeonly buffer unsized 3-element array of highp float) +0:201 'wo' (layout( column_major shared) writeonly buffer block{layout( column_major shared) writeonly buffer highp int value, layout( column_major shared) writeonly buffer unsized 3-element array of highp float values}) 0:201 Constant: 0:201 1 (const int) 0:201 Constant: @@ -350,9 +350,9 @@ ERROR: node is still EOpNull! 0:202 Condition 0:202 'b' ( temp bool) 0:202 true case -0:202 direct index (layout( column_major shared) temp highp float) -0:202 values: direct index for structure (layout( column_major shared) buffer unsized 3-element array of highp float) -0:202 'wo' (layout( column_major shared) writeonly buffer block{layout( column_major shared) buffer highp int value, layout( column_major shared) buffer unsized 3-element array of highp float values}) +0:202 direct index (layout( column_major shared) writeonly temp highp float) +0:202 values: direct index for structure (layout( column_major shared) writeonly buffer unsized 3-element array of highp float) +0:202 'wo' (layout( column_major shared) writeonly buffer block{layout( column_major shared) writeonly buffer highp int value, layout( column_major shared) writeonly buffer unsized 3-element array of highp float values}) 0:202 Constant: 0:202 1 (const int) 0:202 Constant: @@ -363,9 +363,9 @@ ERROR: node is still EOpNull! 0:203 Condition 0:203 Compare Equal ( temp bool) 0:203 'f' ( temp highp float) -0:203 direct index (layout( column_major shared) temp highp float) -0:203 values: direct index for structure (layout( column_major shared) buffer unsized 3-element array of highp float) -0:203 'wo' (layout( column_major shared) writeonly buffer block{layout( column_major shared) buffer highp int value, layout( column_major shared) buffer unsized 3-element array of highp float values}) +0:203 direct index (layout( column_major shared) writeonly temp highp float) +0:203 values: direct index for structure (layout( column_major shared) writeonly buffer unsized 3-element array of highp float) +0:203 'wo' (layout( column_major shared) writeonly buffer block{layout( column_major shared) writeonly buffer highp int value, layout( column_major shared) writeonly buffer unsized 3-element array of highp float values}) 0:203 Constant: 0:203 1 (const int) 0:203 Constant: @@ -377,9 +377,9 @@ ERROR: node is still EOpNull! 0:205 Condition 0:205 Compare Greater Than or Equal ( temp bool) 0:205 'f' ( temp highp float) -0:205 direct index (layout( column_major shared) temp highp float) -0:205 values: direct index for structure (layout( column_major shared) buffer unsized 3-element array of highp float) -0:205 'wo' (layout( column_major shared) writeonly buffer block{layout( column_major shared) buffer highp int value, layout( column_major shared) buffer unsized 3-element array of highp float values}) +0:205 direct index (layout( column_major shared) writeonly temp highp float) +0:205 values: direct index for structure (layout( column_major shared) writeonly buffer unsized 3-element array of highp float) +0:205 'wo' (layout( column_major shared) writeonly buffer block{layout( column_major shared) writeonly buffer highp int value, layout( column_major shared) writeonly buffer unsized 3-element array of highp float values}) 0:205 Constant: 0:205 1 (const int) 0:205 Constant: @@ -391,9 +391,9 @@ ERROR: node is still EOpNull! 0:207 'f' ( temp highp float) 0:207 direct index ( temp highp float) 0:207 Construct vec3 ( temp highp 3-component vector of float) -0:207 direct index (layout( column_major shared) temp highp float) -0:207 values: direct index for structure (layout( column_major shared) buffer unsized 3-element array of highp float) -0:207 'wo' (layout( column_major shared) writeonly buffer block{layout( column_major shared) buffer highp int value, layout( column_major shared) buffer unsized 3-element array of highp float values}) +0:207 direct index (layout( column_major shared) writeonly temp highp float) +0:207 values: direct index for structure (layout( column_major shared) writeonly buffer unsized 3-element array of highp float) +0:207 'wo' (layout( column_major shared) writeonly buffer block{layout( column_major shared) writeonly buffer highp int value, layout( column_major shared) writeonly buffer unsized 3-element array of highp float values}) 0:207 Constant: 0:207 1 (const int) 0:207 Constant: @@ -401,14 +401,14 @@ ERROR: node is still EOpNull! 0:207 Constant: 0:207 0 (const int) 0:208 Bitwise not ( temp highp int) -0:208 value: direct index for structure (layout( column_major shared) buffer highp int) -0:208 'wo' (layout( column_major shared) writeonly buffer block{layout( column_major shared) buffer highp int value, layout( column_major shared) buffer unsized 3-element array of highp float values}) +0:208 value: direct index for structure (layout( column_major shared) writeonly buffer highp int) +0:208 'wo' (layout( column_major shared) writeonly buffer block{layout( column_major shared) writeonly buffer highp int value, layout( column_major shared) writeonly buffer unsized 3-element array of highp float values}) 0:208 Constant: 0:208 0 (const int) 0:209 move second child to first child ( temp highp float) -0:209 direct index (layout( column_major shared) temp highp float) -0:209 values: direct index for structure (layout( column_major shared) buffer unsized 3-element array of highp float) -0:209 'wo' (layout( column_major shared) writeonly buffer block{layout( column_major shared) buffer highp int value, layout( column_major shared) buffer unsized 3-element array of highp float values}) +0:209 direct index (layout( column_major shared) writeonly temp highp float) +0:209 values: direct index for structure (layout( column_major shared) writeonly buffer unsized 3-element array of highp float) +0:209 'wo' (layout( column_major shared) writeonly buffer block{layout( column_major shared) writeonly buffer highp int value, layout( column_major shared) writeonly buffer unsized 3-element array of highp float values}) 0:209 Constant: 0:209 1 (const int) 0:209 Constant: @@ -420,22 +420,22 @@ ERROR: node is still EOpNull! 0:? Sequence 0:221 move second child to first child ( temp highp float) 0:221 'g' ( temp highp float) -0:221 direct index (layout( column_major shared) temp highp float) -0:221 values: direct index for structure (layout( column_major shared) buffer unsized 3-element array of highp float) -0:221 'wo' (layout( column_major shared) writeonly buffer block{layout( column_major shared) buffer highp int value, layout( column_major shared) buffer unsized 3-element array of highp float values}) +0:221 direct index (layout( column_major shared) writeonly temp highp float) +0:221 values: direct index for structure (layout( column_major shared) writeonly buffer unsized 3-element array of highp float) +0:221 'wo' (layout( column_major shared) writeonly buffer block{layout( column_major shared) writeonly buffer highp int value, layout( column_major shared) writeonly buffer unsized 3-element array of highp float values}) 0:221 Constant: 0:221 1 (const int) 0:221 Constant: 0:221 2 (const int) 0:222 Bitwise not ( temp highp int) -0:222 value: direct index for structure (layout( column_major shared) buffer highp int) -0:222 'wo' (layout( column_major shared) writeonly buffer block{layout( column_major shared) buffer highp int value, layout( column_major shared) buffer unsized 3-element array of highp float values}) +0:222 value: direct index for structure (layout( column_major shared) writeonly buffer highp int) +0:222 'wo' (layout( column_major shared) writeonly buffer block{layout( column_major shared) writeonly buffer highp int value, layout( column_major shared) writeonly buffer unsized 3-element array of highp float values}) 0:222 Constant: 0:222 0 (const int) 0:223 move second child to first child ( temp highp float) -0:223 direct index (layout( column_major shared) temp highp float) -0:223 values: direct index for structure (layout( column_major shared) buffer unsized 3-element array of highp float) -0:223 'wo' (layout( column_major shared) writeonly buffer block{layout( column_major shared) buffer highp int value, layout( column_major shared) buffer unsized 3-element array of highp float values}) +0:223 direct index (layout( column_major shared) writeonly temp highp float) +0:223 values: direct index for structure (layout( column_major shared) writeonly buffer unsized 3-element array of highp float) +0:223 'wo' (layout( column_major shared) writeonly buffer block{layout( column_major shared) writeonly buffer highp int value, layout( column_major shared) writeonly buffer unsized 3-element array of highp float values}) 0:223 Constant: 0:223 1 (const int) 0:223 Constant: @@ -443,8 +443,8 @@ ERROR: node is still EOpNull! 0:223 Constant: 0:223 3.400000 0:224 move second child to first child ( temp highp int) -0:224 value: direct index for structure (layout( column_major shared) buffer highp int) -0:224 'wo' (layout( column_major shared) writeonly buffer block{layout( column_major shared) buffer highp int value, layout( column_major shared) buffer unsized 3-element array of highp float values}) +0:224 value: direct index for structure (layout( column_major shared) writeonly buffer highp int) +0:224 'wo' (layout( column_major shared) writeonly buffer block{layout( column_major shared) writeonly buffer highp int value, layout( column_major shared) writeonly buffer unsized 3-element array of highp float values}) 0:224 Constant: 0:224 0 (const int) 0:224 Constant: @@ -477,7 +477,7 @@ ERROR: node is still EOpNull! 0:? 'arrX' ( global 2-element array of highp int) 0:? 'arrY' ( global 1-element array of highp int) 0:? 'arrZ' ( global 4096-element array of highp int) -0:? 'ro' (layout( column_major shared) readonly buffer block{layout( column_major shared) buffer highp int value, layout( column_major shared) buffer unsized 3-element array of highp float values}) +0:? 'ro' (layout( column_major shared) readonly buffer block{layout( column_major shared) readonly buffer highp int value, layout( column_major shared) readonly buffer unsized 3-element array of highp float values}) 0:? 'v' ( buffer highp 4-component vector of float) 0:? 'us2dbad' ( uniform mediump usampler2D) 0:? 'us2d' ( uniform highp usampler2D) @@ -516,7 +516,7 @@ ERROR: node is still EOpNull! 0:? 'badQ1' (layout( rgba32f) coherent volatile restrict uniform highp image2D) 0:? 'badQ2' (layout( rgba8i) coherent volatile restrict uniform highp iimage2D) 0:? 'badQ3' (layout( rgba16ui) coherent volatile restrict uniform highp uimage2D) -0:? 'wo' (layout( column_major shared) writeonly buffer block{layout( column_major shared) buffer highp int value, layout( column_major shared) buffer unsized 3-element array of highp float values}) +0:? 'wo' (layout( column_major shared) writeonly buffer block{layout( column_major shared) writeonly buffer highp int value, layout( column_major shared) writeonly buffer unsized 3-element array of highp float values}) 0:? 'multio' (layout( column_major shared) buffer block{layout( column_major shared) readonly buffer highp int value, layout( column_major shared) writeonly buffer unsized 1-element array of highp float values}) 0:? 'inbi' ( in block{ in highp int a}) 0:? 'outbi' ( out block{ out highp int a}) @@ -571,7 +571,7 @@ ERROR: node is still EOpNull! 0:? 'arrX' ( global 2-element array of highp int) 0:? 'arrY' ( global 1-element array of highp int) 0:? 'arrZ' ( global 4096-element array of highp int) -0:? 'ro' (layout( column_major shared) readonly buffer block{layout( column_major shared) buffer highp int value, layout( column_major shared) buffer unsized 3-element array of highp float values}) +0:? 'ro' (layout( column_major shared) readonly buffer block{layout( column_major shared) readonly buffer highp int value, layout( column_major shared) readonly buffer unsized 3-element array of highp float values}) 0:? 'v' ( buffer highp 4-component vector of float) 0:? 'us2dbad' ( uniform mediump usampler2D) 0:? 'us2d' ( uniform highp usampler2D) @@ -610,7 +610,7 @@ ERROR: node is still EOpNull! 0:? 'badQ1' (layout( rgba32f) coherent volatile restrict uniform highp image2D) 0:? 'badQ2' (layout( rgba8i) coherent volatile restrict uniform highp iimage2D) 0:? 'badQ3' (layout( rgba16ui) coherent volatile restrict uniform highp uimage2D) -0:? 'wo' (layout( column_major shared) writeonly buffer block{layout( column_major shared) buffer highp int value, layout( column_major shared) buffer unsized 3-element array of highp float values}) +0:? 'wo' (layout( column_major shared) writeonly buffer block{layout( column_major shared) writeonly buffer highp int value, layout( column_major shared) writeonly buffer unsized 3-element array of highp float values}) 0:? 'multio' (layout( column_major shared) buffer block{layout( column_major shared) readonly buffer highp int value, layout( column_major shared) writeonly buffer unsized 1-element array of highp float values}) 0:? 'inbi' ( in block{ in highp int a}) 0:? 'outbi' ( out block{ out highp int a}) diff --git a/Test/baseResults/310.inheritMemory.frag.out b/Test/baseResults/310.inheritMemory.frag.out new file mode 100644 index 0000000..769a096 --- /dev/null +++ b/Test/baseResults/310.inheritMemory.frag.out @@ -0,0 +1,229 @@ +310.inheritMemory.frag +ERROR: 0:38: 'readonly' : argument cannot drop memory qualifier when passed to formal parameter +ERROR: 0:39: 'readonly' : argument cannot drop memory qualifier when passed to formal parameter +ERROR: 0:40: 'readonly' : argument cannot drop memory qualifier when passed to formal parameter +ERROR: 0:41: 'readonly' : argument cannot drop memory qualifier when passed to formal parameter +ERROR: 0:42: 'readonly' : argument cannot drop memory qualifier when passed to formal parameter +ERROR: 5 compilation errors. No code generated. + + +Shader version: 310 +ERROR: node is still EOpNull! +0:18 Function Definition: non_ro_fun(f1[10]; ( global void) +0:18 Function Parameters: +0:18 'buff' ( in 10-element array of mediump float) +0:19 Function Definition: non_ro_funf(f1; ( global void) +0:19 Function Parameters: +0:19 'el' ( in mediump float) +0:20 Function Definition: non_ro_funS(struct-S-f1[10]1; ( global void) +0:20 Function Parameters: +0:20 's' ( in structure{ global 10-element array of mediump float buff}) +0:24 Function Definition: main( ( global void) +0:24 Function Parameters: +0:? Sequence +0:28 Function Call: non_ro_fun(f1[10]; ( global void) +0:28 buff: direct index for structure ( global 10-element array of mediump float) +0:28 's' ( temp structure{ global 10-element array of mediump float buff}) +0:28 Constant: +0:28 0 (const int) +0:29 Function Call: non_ro_funf(f1; ( global void) +0:29 direct index ( temp mediump float) +0:29 buff: direct index for structure ( global 10-element array of mediump float) +0:29 's' ( temp structure{ global 10-element array of mediump float buff}) +0:29 Constant: +0:29 0 (const int) +0:29 Constant: +0:29 3 (const int) +0:30 Function Call: non_ro_funS(struct-S-f1[10]1; ( global void) +0:30 's' ( temp structure{ global 10-element array of mediump float buff}) +0:32 Function Call: non_ro_fun(f1[10]; ( global void) +0:32 buff: direct index for structure (layout( column_major std430 offset=0) buffer 10-element array of mediump float) +0:32 'non_ro_buffer' (layout( binding=2 column_major std430) buffer block{layout( column_major std430 offset=0) buffer 10-element array of mediump float buff, layout( column_major std430 offset=40) buffer structure{ global 10-element array of mediump float buff} s}) +0:32 Constant: +0:32 0 (const int) +0:33 Function Call: non_ro_fun(f1[10]; ( global void) +0:33 buff: direct index for structure ( global 10-element array of mediump float) +0:33 s: direct index for structure (layout( column_major std430 offset=40) buffer structure{ global 10-element array of mediump float buff}) +0:33 'non_ro_buffer' (layout( binding=2 column_major std430) buffer block{layout( column_major std430 offset=0) buffer 10-element array of mediump float buff, layout( column_major std430 offset=40) buffer structure{ global 10-element array of mediump float buff} s}) +0:33 Constant: +0:33 1 (const int) +0:33 Constant: +0:33 0 (const int) +0:34 Function Call: non_ro_funf(f1; ( global void) +0:34 direct index (layout( column_major std430 offset=0) temp mediump float) +0:34 buff: direct index for structure (layout( column_major std430 offset=0) buffer 10-element array of mediump float) +0:34 'non_ro_buffer' (layout( binding=2 column_major std430) buffer block{layout( column_major std430 offset=0) buffer 10-element array of mediump float buff, layout( column_major std430 offset=40) buffer structure{ global 10-element array of mediump float buff} s}) +0:34 Constant: +0:34 0 (const int) +0:34 Constant: +0:34 3 (const int) +0:35 Function Call: non_ro_funf(f1; ( global void) +0:35 direct index ( temp mediump float) +0:35 buff: direct index for structure ( global 10-element array of mediump float) +0:35 s: direct index for structure (layout( column_major std430 offset=40) buffer structure{ global 10-element array of mediump float buff}) +0:35 'non_ro_buffer' (layout( binding=2 column_major std430) buffer block{layout( column_major std430 offset=0) buffer 10-element array of mediump float buff, layout( column_major std430 offset=40) buffer structure{ global 10-element array of mediump float buff} s}) +0:35 Constant: +0:35 1 (const int) +0:35 Constant: +0:35 0 (const int) +0:35 Constant: +0:35 3 (const int) +0:36 Function Call: non_ro_funS(struct-S-f1[10]1; ( global void) +0:36 s: direct index for structure (layout( column_major std430 offset=40) buffer structure{ global 10-element array of mediump float buff}) +0:36 'non_ro_buffer' (layout( binding=2 column_major std430) buffer block{layout( column_major std430 offset=0) buffer 10-element array of mediump float buff, layout( column_major std430 offset=40) buffer structure{ global 10-element array of mediump float buff} s}) +0:36 Constant: +0:36 1 (const int) +0:38 Function Call: non_ro_fun(f1[10]; ( global void) +0:38 buff_ro: direct index for structure (layout( column_major std430 offset=0) readonly buffer 10-element array of mediump float) +0:38 'ro_buffer' (layout( binding=2 column_major std430) readonly buffer block{layout( column_major std430 offset=0) readonly buffer 10-element array of mediump float buff_ro, layout( column_major std430 offset=40) readonly buffer structure{ global 10-element array of mediump float buff} s_ro}) +0:38 Constant: +0:38 0 (const int) +0:39 Function Call: non_ro_fun(f1[10]; ( global void) +0:39 buff: direct index for structure ( readonly global 10-element array of mediump float) +0:39 s_ro: direct index for structure (layout( column_major std430 offset=40) readonly buffer structure{ global 10-element array of mediump float buff}) +0:39 'ro_buffer' (layout( binding=2 column_major std430) readonly buffer block{layout( column_major std430 offset=0) readonly buffer 10-element array of mediump float buff_ro, layout( column_major std430 offset=40) readonly buffer structure{ global 10-element array of mediump float buff} s_ro}) +0:39 Constant: +0:39 1 (const int) +0:39 Constant: +0:39 0 (const int) +0:40 Function Call: non_ro_funf(f1; ( global void) +0:40 direct index (layout( column_major std430 offset=0) readonly temp mediump float) +0:40 buff_ro: direct index for structure (layout( column_major std430 offset=0) readonly buffer 10-element array of mediump float) +0:40 'ro_buffer' (layout( binding=2 column_major std430) readonly buffer block{layout( column_major std430 offset=0) readonly buffer 10-element array of mediump float buff_ro, layout( column_major std430 offset=40) readonly buffer structure{ global 10-element array of mediump float buff} s_ro}) +0:40 Constant: +0:40 0 (const int) +0:40 Constant: +0:40 3 (const int) +0:41 Function Call: non_ro_funf(f1; ( global void) +0:41 direct index ( readonly temp mediump float) +0:41 buff: direct index for structure ( readonly global 10-element array of mediump float) +0:41 s_ro: direct index for structure (layout( column_major std430 offset=40) readonly buffer structure{ global 10-element array of mediump float buff}) +0:41 'ro_buffer' (layout( binding=2 column_major std430) readonly buffer block{layout( column_major std430 offset=0) readonly buffer 10-element array of mediump float buff_ro, layout( column_major std430 offset=40) readonly buffer structure{ global 10-element array of mediump float buff} s_ro}) +0:41 Constant: +0:41 1 (const int) +0:41 Constant: +0:41 0 (const int) +0:41 Constant: +0:41 3 (const int) +0:42 Function Call: non_ro_funS(struct-S-f1[10]1; ( global void) +0:42 s_ro: direct index for structure (layout( column_major std430 offset=40) readonly buffer structure{ global 10-element array of mediump float buff}) +0:42 'ro_buffer' (layout( binding=2 column_major std430) readonly buffer block{layout( column_major std430 offset=0) readonly buffer 10-element array of mediump float buff_ro, layout( column_major std430 offset=40) readonly buffer structure{ global 10-element array of mediump float buff} s_ro}) +0:42 Constant: +0:42 1 (const int) +0:? Linker Objects +0:? 'ro_buffer' (layout( binding=2 column_major std430) readonly buffer block{layout( column_major std430 offset=0) readonly buffer 10-element array of mediump float buff_ro, layout( column_major std430 offset=40) readonly buffer structure{ global 10-element array of mediump float buff} s_ro}) +0:? 'non_ro_buffer' (layout( binding=2 column_major std430) buffer block{layout( column_major std430 offset=0) buffer 10-element array of mediump float buff, layout( column_major std430 offset=40) buffer structure{ global 10-element array of mediump float buff} s}) +0:? 'fragColor' ( out mediump 4-component vector of float) + + +Linked fragment stage: + + +Shader version: 310 +ERROR: node is still EOpNull! +0:18 Function Definition: non_ro_fun(f1[10]; ( global void) +0:18 Function Parameters: +0:18 'buff' ( in 10-element array of mediump float) +0:19 Function Definition: non_ro_funf(f1; ( global void) +0:19 Function Parameters: +0:19 'el' ( in mediump float) +0:20 Function Definition: non_ro_funS(struct-S-f1[10]1; ( global void) +0:20 Function Parameters: +0:20 's' ( in structure{ global 10-element array of mediump float buff}) +0:24 Function Definition: main( ( global void) +0:24 Function Parameters: +0:? Sequence +0:28 Function Call: non_ro_fun(f1[10]; ( global void) +0:28 buff: direct index for structure ( global 10-element array of mediump float) +0:28 's' ( temp structure{ global 10-element array of mediump float buff}) +0:28 Constant: +0:28 0 (const int) +0:29 Function Call: non_ro_funf(f1; ( global void) +0:29 direct index ( temp mediump float) +0:29 buff: direct index for structure ( global 10-element array of mediump float) +0:29 's' ( temp structure{ global 10-element array of mediump float buff}) +0:29 Constant: +0:29 0 (const int) +0:29 Constant: +0:29 3 (const int) +0:30 Function Call: non_ro_funS(struct-S-f1[10]1; ( global void) +0:30 's' ( temp structure{ global 10-element array of mediump float buff}) +0:32 Function Call: non_ro_fun(f1[10]; ( global void) +0:32 buff: direct index for structure (layout( column_major std430 offset=0) buffer 10-element array of mediump float) +0:32 'non_ro_buffer' (layout( binding=2 column_major std430) buffer block{layout( column_major std430 offset=0) buffer 10-element array of mediump float buff, layout( column_major std430 offset=40) buffer structure{ global 10-element array of mediump float buff} s}) +0:32 Constant: +0:32 0 (const int) +0:33 Function Call: non_ro_fun(f1[10]; ( global void) +0:33 buff: direct index for structure ( global 10-element array of mediump float) +0:33 s: direct index for structure (layout( column_major std430 offset=40) buffer structure{ global 10-element array of mediump float buff}) +0:33 'non_ro_buffer' (layout( binding=2 column_major std430) buffer block{layout( column_major std430 offset=0) buffer 10-element array of mediump float buff, layout( column_major std430 offset=40) buffer structure{ global 10-element array of mediump float buff} s}) +0:33 Constant: +0:33 1 (const int) +0:33 Constant: +0:33 0 (const int) +0:34 Function Call: non_ro_funf(f1; ( global void) +0:34 direct index (layout( column_major std430 offset=0) temp mediump float) +0:34 buff: direct index for structure (layout( column_major std430 offset=0) buffer 10-element array of mediump float) +0:34 'non_ro_buffer' (layout( binding=2 column_major std430) buffer block{layout( column_major std430 offset=0) buffer 10-element array of mediump float buff, layout( column_major std430 offset=40) buffer structure{ global 10-element array of mediump float buff} s}) +0:34 Constant: +0:34 0 (const int) +0:34 Constant: +0:34 3 (const int) +0:35 Function Call: non_ro_funf(f1; ( global void) +0:35 direct index ( temp mediump float) +0:35 buff: direct index for structure ( global 10-element array of mediump float) +0:35 s: direct index for structure (layout( column_major std430 offset=40) buffer structure{ global 10-element array of mediump float buff}) +0:35 'non_ro_buffer' (layout( binding=2 column_major std430) buffer block{layout( column_major std430 offset=0) buffer 10-element array of mediump float buff, layout( column_major std430 offset=40) buffer structure{ global 10-element array of mediump float buff} s}) +0:35 Constant: +0:35 1 (const int) +0:35 Constant: +0:35 0 (const int) +0:35 Constant: +0:35 3 (const int) +0:36 Function Call: non_ro_funS(struct-S-f1[10]1; ( global void) +0:36 s: direct index for structure (layout( column_major std430 offset=40) buffer structure{ global 10-element array of mediump float buff}) +0:36 'non_ro_buffer' (layout( binding=2 column_major std430) buffer block{layout( column_major std430 offset=0) buffer 10-element array of mediump float buff, layout( column_major std430 offset=40) buffer structure{ global 10-element array of mediump float buff} s}) +0:36 Constant: +0:36 1 (const int) +0:38 Function Call: non_ro_fun(f1[10]; ( global void) +0:38 buff_ro: direct index for structure (layout( column_major std430 offset=0) readonly buffer 10-element array of mediump float) +0:38 'ro_buffer' (layout( binding=2 column_major std430) readonly buffer block{layout( column_major std430 offset=0) readonly buffer 10-element array of mediump float buff_ro, layout( column_major std430 offset=40) readonly buffer structure{ global 10-element array of mediump float buff} s_ro}) +0:38 Constant: +0:38 0 (const int) +0:39 Function Call: non_ro_fun(f1[10]; ( global void) +0:39 buff: direct index for structure ( readonly global 10-element array of mediump float) +0:39 s_ro: direct index for structure (layout( column_major std430 offset=40) readonly buffer structure{ global 10-element array of mediump float buff}) +0:39 'ro_buffer' (layout( binding=2 column_major std430) readonly buffer block{layout( column_major std430 offset=0) readonly buffer 10-element array of mediump float buff_ro, layout( column_major std430 offset=40) readonly buffer structure{ global 10-element array of mediump float buff} s_ro}) +0:39 Constant: +0:39 1 (const int) +0:39 Constant: +0:39 0 (const int) +0:40 Function Call: non_ro_funf(f1; ( global void) +0:40 direct index (layout( column_major std430 offset=0) readonly temp mediump float) +0:40 buff_ro: direct index for structure (layout( column_major std430 offset=0) readonly buffer 10-element array of mediump float) +0:40 'ro_buffer' (layout( binding=2 column_major std430) readonly buffer block{layout( column_major std430 offset=0) readonly buffer 10-element array of mediump float buff_ro, layout( column_major std430 offset=40) readonly buffer structure{ global 10-element array of mediump float buff} s_ro}) +0:40 Constant: +0:40 0 (const int) +0:40 Constant: +0:40 3 (const int) +0:41 Function Call: non_ro_funf(f1; ( global void) +0:41 direct index ( readonly temp mediump float) +0:41 buff: direct index for structure ( readonly global 10-element array of mediump float) +0:41 s_ro: direct index for structure (layout( column_major std430 offset=40) readonly buffer structure{ global 10-element array of mediump float buff}) +0:41 'ro_buffer' (layout( binding=2 column_major std430) readonly buffer block{layout( column_major std430 offset=0) readonly buffer 10-element array of mediump float buff_ro, layout( column_major std430 offset=40) readonly buffer structure{ global 10-element array of mediump float buff} s_ro}) +0:41 Constant: +0:41 1 (const int) +0:41 Constant: +0:41 0 (const int) +0:41 Constant: +0:41 3 (const int) +0:42 Function Call: non_ro_funS(struct-S-f1[10]1; ( global void) +0:42 s_ro: direct index for structure (layout( column_major std430 offset=40) readonly buffer structure{ global 10-element array of mediump float buff}) +0:42 'ro_buffer' (layout( binding=2 column_major std430) readonly buffer block{layout( column_major std430 offset=0) readonly buffer 10-element array of mediump float buff_ro, layout( column_major std430 offset=40) readonly buffer structure{ global 10-element array of mediump float buff} s_ro}) +0:42 Constant: +0:42 1 (const int) +0:? Linker Objects +0:? 'ro_buffer' (layout( binding=2 column_major std430) readonly buffer block{layout( column_major std430 offset=0) readonly buffer 10-element array of mediump float buff_ro, layout( column_major std430 offset=40) readonly buffer structure{ global 10-element array of mediump float buff} s_ro}) +0:? 'non_ro_buffer' (layout( binding=2 column_major std430) buffer block{layout( column_major std430 offset=0) buffer 10-element array of mediump float buff, layout( column_major std430 offset=40) buffer structure{ global 10-element array of mediump float buff} s}) +0:? 'fragColor' ( out mediump 4-component vector of float) + diff --git a/Test/baseResults/430.comp.out b/Test/baseResults/430.comp.out index 599cd8e..ef8d19e 100644 --- a/Test/baseResults/430.comp.out +++ b/Test/baseResults/430.comp.out @@ -55,9 +55,9 @@ ERROR: node is still EOpNull! 0:63 Function Parameters: 0:65 Sequence 0:65 move second child to first child ( temp float) -0:65 direct index (layout( column_major shared) temp float) -0:65 values: direct index for structure (layout( column_major shared) buffer unsized 3-element array of float) -0:65 'ro' (layout( column_major shared) readonly buffer block{layout( column_major shared) buffer int value, layout( column_major shared) buffer unsized 3-element array of float values}) +0:65 direct index (layout( column_major shared) readonly temp float) +0:65 values: direct index for structure (layout( column_major shared) readonly buffer unsized 3-element array of float) +0:65 'ro' (layout( column_major shared) readonly buffer block{layout( column_major shared) readonly buffer int value, layout( column_major shared) readonly buffer unsized 3-element array of float values}) 0:65 Constant: 0:65 1 (const int) 0:65 Constant: @@ -65,8 +65,8 @@ ERROR: node is still EOpNull! 0:65 Constant: 0:65 4.700000 0:66 array length ( temp int) -0:66 values: direct index for structure (layout( column_major shared) buffer unsized 3-element array of float) -0:66 'ro' (layout( column_major shared) readonly buffer block{layout( column_major shared) buffer int value, layout( column_major shared) buffer unsized 3-element array of float values}) +0:66 values: direct index for structure (layout( column_major shared) readonly buffer unsized 3-element array of float) +0:66 'ro' (layout( column_major shared) readonly buffer block{layout( column_major shared) readonly buffer int value, layout( column_major shared) readonly buffer unsized 3-element array of float values}) 0:66 Constant: 0:66 1 (const int) 0:67 Barrier ( global void) @@ -140,7 +140,7 @@ ERROR: node is still EOpNull! 0:? 'arrX' ( global 2-element array of int) 0:? 'arrY' ( global 1-element array of int) 0:? 'arrZ' ( global 4096-element array of int) -0:? 'ro' (layout( column_major shared) readonly buffer block{layout( column_major shared) buffer int value, layout( column_major shared) buffer unsized 3-element array of float values}) +0:? 'ro' (layout( column_major shared) readonly buffer block{layout( column_major shared) readonly buffer int value, layout( column_major shared) readonly buffer unsized 3-element array of float values}) 0:? 'roll' ( uniform double) 0:? 'destTex' ( writeonly uniform image2D) 0:? 'inbi' ( in block{ in int a}) @@ -201,7 +201,7 @@ ERROR: node is still EOpNull! 0:? 'arrX' ( global 2-element array of int) 0:? 'arrY' ( global 1-element array of int) 0:? 'arrZ' ( global 4096-element array of int) -0:? 'ro' (layout( column_major shared) readonly buffer block{layout( column_major shared) buffer int value, layout( column_major shared) buffer unsized 3-element array of float values}) +0:? 'ro' (layout( column_major shared) readonly buffer block{layout( column_major shared) readonly buffer int value, layout( column_major shared) readonly buffer unsized 3-element array of float values}) 0:? 'roll' ( uniform double) 0:? 'destTex' ( writeonly uniform image2D) 0:? 'inbi' ( in block{ in int a}) diff --git a/Test/baseResults/specExamples.vert.out b/Test/baseResults/specExamples.vert.out index 3a83f3b..1dbf9a2 100644 --- a/Test/baseResults/specExamples.vert.out +++ b/Test/baseResults/specExamples.vert.out @@ -307,7 +307,7 @@ ERROR: node is still EOpNull! 0:? 'c' ( in 4-component vector of float) 0:? 'd' ( in 4-component vector of float) 0:? 'v' ( noContraction smooth out 4-component vector of float) -0:? 'anon@6' (layout( column_major shared) coherent buffer block{layout( column_major shared) readonly buffer 4-component vector of float member1, layout( column_major shared) buffer 4-component vector of float member2}) +0:? 'anon@6' (layout( column_major shared) coherent buffer block{layout( column_major shared) coherent readonly buffer 4-component vector of float member1, layout( column_major shared) coherent buffer 4-component vector of float member2}) 0:? 'anon@7' (layout( column_major shared) buffer block{layout( column_major shared) coherent readonly buffer 4-component vector of float member1A, layout( column_major shared) coherent buffer 4-component vector of float member2A}) 0:? 'shv' ( shared 4-component vector of float) 0:? 'img1' (layout( rgba32f) uniform image2D) @@ -590,7 +590,7 @@ ERROR: node is still EOpNull! 0:? 'c' ( in 4-component vector of float) 0:? 'd' ( in 4-component vector of float) 0:? 'v' ( noContraction smooth out 4-component vector of float) -0:? 'anon@6' (layout( column_major shared) coherent buffer block{layout( column_major shared) readonly buffer 4-component vector of float member1, layout( column_major shared) buffer 4-component vector of float member2}) +0:? 'anon@6' (layout( column_major shared) coherent buffer block{layout( column_major shared) coherent readonly buffer 4-component vector of float member1, layout( column_major shared) coherent buffer 4-component vector of float member2}) 0:? 'anon@7' (layout( column_major shared) buffer block{layout( column_major shared) coherent readonly buffer 4-component vector of float member1A, layout( column_major shared) coherent buffer 4-component vector of float member2A}) 0:? 'shv' ( shared 4-component vector of float) 0:? 'img1' (layout( rgba32f) uniform image2D) diff --git a/Test/baseResults/specExamplesConf.vert.out b/Test/baseResults/specExamplesConf.vert.out index 6487de2..94f48a5 100644 --- a/Test/baseResults/specExamplesConf.vert.out +++ b/Test/baseResults/specExamplesConf.vert.out @@ -308,7 +308,7 @@ ERROR: node is still EOpNull! 0:? 'c' ( in 4-component vector of float) 0:? 'd' ( in 4-component vector of float) 0:? 'v' ( noContraction smooth out 4-component vector of float) -0:? 'anon@6' (layout( column_major shared) coherent buffer block{layout( column_major shared) readonly buffer 4-component vector of float member1, layout( column_major shared) buffer 4-component vector of float member2}) +0:? 'anon@6' (layout( column_major shared) coherent buffer block{layout( column_major shared) coherent readonly buffer 4-component vector of float member1, layout( column_major shared) coherent buffer 4-component vector of float member2}) 0:? 'anon@7' (layout( column_major shared) buffer block{layout( column_major shared) coherent readonly buffer 4-component vector of float member1A, layout( column_major shared) coherent buffer 4-component vector of float member2A}) 0:? 'shv' ( shared 4-component vector of float) 0:? 'img1' (layout( rgba32f) uniform image2D) @@ -591,7 +591,7 @@ ERROR: node is still EOpNull! 0:? 'c' ( in 4-component vector of float) 0:? 'd' ( in 4-component vector of float) 0:? 'v' ( noContraction smooth out 4-component vector of float) -0:? 'anon@6' (layout( column_major shared) coherent buffer block{layout( column_major shared) readonly buffer 4-component vector of float member1, layout( column_major shared) buffer 4-component vector of float member2}) +0:? 'anon@6' (layout( column_major shared) coherent buffer block{layout( column_major shared) coherent readonly buffer 4-component vector of float member1, layout( column_major shared) coherent buffer 4-component vector of float member2}) 0:? 'anon@7' (layout( column_major shared) buffer block{layout( column_major shared) coherent readonly buffer 4-component vector of float member1A, layout( column_major shared) coherent buffer 4-component vector of float member2A}) 0:? 'shv' ( shared 4-component vector of float) 0:? 'img1' (layout( rgba32f) uniform image2D) diff --git a/Test/baseResults/spv.coopmat.comp.out b/Test/baseResults/spv.coopmat.comp.out index 0507129..acdcbc4 100644 --- a/Test/baseResults/spv.coopmat.comp.out +++ b/Test/baseResults/spv.coopmat.comp.out @@ -282,7 +282,7 @@ spv.coopmat.comp 101: 100(ptr) AccessChain 91(block16) 99 102: 85(ptr) Load 101 MakePointerVisibleKHR NonPrivatePointerKHR 71 104: 103(ptr) AccessChain 102 58 31 - 105: 32 CooperativeMatrixLoadNV 104 74 76 Aligned 16 + 105: 32 CooperativeMatrixLoadNV 104 74 76 Aligned MakePointerVisibleKHR NonPrivatePointerKHR 16 71 Store 98(tempArg) 105 106: 32 Load 98(tempArg) Store 34(m) 106 @@ -290,7 +290,7 @@ spv.coopmat.comp 108: 100(ptr) AccessChain 91(block16) 99 109: 85(ptr) Load 108 MakePointerVisibleKHR NonPrivatePointerKHR 71 110: 103(ptr) AccessChain 109 58 31 - CooperativeMatrixStoreNV 110 107 74 76 Aligned 16 + CooperativeMatrixStoreNV 110 107 74 76 Aligned MakePointerAvailableKHR NonPrivatePointerKHR 16 71 113: 50 Load 112(A) 115: 10 Load 114(B) 117: 32 Load 116(C) diff --git a/glslang/Include/Types.h b/glslang/Include/Types.h index 3720de7..131b930 100644 --- a/glslang/Include/Types.h +++ b/glslang/Include/Types.h @@ -539,20 +539,6 @@ public: writeonly = false; } - // Drop just the storage qualification, which perhaps should - // never be done, as it is fundamentally inconsistent, but need to - // explore what downstream consumers need. - // E.g., in a dereference, it is an inconsistency between: - // A) partially dereferenced resource is still in the storage class it started in - // B) partially dereferenced resource is a new temporary object - // If A, then nothing should change, if B, then everything should change, but this is half way. - void makePartialTemporary() - { - storage = EvqTemporary; - specConstant = false; - nonUniform = false; - } - const char* semanticName; TStorageQualifier storage : 6; TBuiltInVariable builtIn : 9; diff --git a/glslang/MachineIndependent/ParseHelper.cpp b/glslang/MachineIndependent/ParseHelper.cpp index 5720658..1e2a965 100644 --- a/glslang/MachineIndependent/ParseHelper.cpp +++ b/glslang/MachineIndependent/ParseHelper.cpp @@ -473,7 +473,7 @@ TIntermTyped* TParseContext::handleBracketDereference(const TSourceLoc& loc, TIn profileRequires(base->getLoc(), EEsProfile, 320, Num_AEP_gpu_shader5, AEP_gpu_shader5, "variable indexing uniform block array"); else { - // input/output blocks either don't exist or can be variable indexed + // input/output blocks either don't exist or can't be variably indexed } } else if (language == EShLangFragment && base->getQualifier().isPipeOutput()) requireProfile(base->getLoc(), ~EEsProfile, "variable indexing fragment shader output array"); @@ -487,8 +487,8 @@ TIntermTyped* TParseContext::handleBracketDereference(const TSourceLoc& loc, TIn result = intermediate.addIndex(EOpIndexIndirect, base, index, loc); } - // Insert valid dereferenced result - TType newType(base->getType(), 0); // dereferenced type + // Insert valid dereferenced result type + TType newType(base->getType(), 0); if (base->getType().getQualifier().isConstant() && index->getQualifier().isConstant()) { newType.getQualifier().storage = EvqConst; // If base or index is a specialization constant, the result should also be a specialization constant. @@ -496,11 +496,14 @@ TIntermTyped* TParseContext::handleBracketDereference(const TSourceLoc& loc, TIn newType.getQualifier().makeSpecConstant(); } } else { - newType.getQualifier().makePartialTemporary(); + newType.getQualifier().storage = EvqTemporary; + newType.getQualifier().specConstant = false; } result->setType(newType); #ifndef GLSLANG_WEB + inheritMemoryQualifiers(base->getQualifier(), result->getWritableType().getQualifier()); + // Propagate nonuniform if (base->getQualifier().isNonUniform() || index->getQualifier().isNonUniform()) result->getWritableType().getQualifier().nonUniform = true; @@ -881,6 +884,7 @@ TIntermTyped* TParseContext::handleDotDereference(const TSourceLoc& loc, TInterm if ((*fields)[member].type->getQualifier().isIo()) intermediate.addIoAccessed(field); } + inheritMemoryQualifiers(base->getQualifier(), result->getWritableType().getQualifier()); } else error(loc, "no such field in structure", field.c_str(), ""); } else @@ -7124,6 +7128,23 @@ TIntermTyped* TParseContext::constructAggregate(TIntermNode* node, const TType& return converted; } +// If a memory qualifier is present in 'to', also make it present in 'from'. +void TParseContext::inheritMemoryQualifiers(const TQualifier& from, TQualifier& to) +{ +#ifndef GLSLANG_WEB + if (from.isReadOnly()) + to.readonly = from.readonly; + if (from.isWriteOnly()) + to.writeonly = from.writeonly; + if (from.coherent) + to.coherent = from.coherent; + if (from.volatil) + to.volatil = from.volatil; + if (from.restrict) + to.restrict = from.restrict; +#endif +} + // // Do everything needed to add an interface block. // @@ -7139,7 +7160,7 @@ void TParseContext::declareBlock(const TSourceLoc& loc, TTypeList& typeList, con requireProfile(loc, ~EEsProfile, "array-of-array of block"); } - // fix and check for member storage qualifiers and types that don't belong within a block + // Inherit and check member storage qualifiers WRT to the block-level qualifier. for (unsigned int member = 0; member < typeList.size(); ++member) { TType& memberType = *typeList[member].type; TQualifier& memberQualifier = memberType.getQualifier(); @@ -7149,6 +7170,7 @@ void TParseContext::declareBlock(const TSourceLoc& loc, TTypeList& typeList, con error(memberLoc, "member storage qualifier cannot contradict block storage qualifier", memberType.getFieldName().c_str(), ""); memberQualifier.storage = currentBlockQualifier.storage; #ifndef GLSLANG_WEB + inheritMemoryQualifiers(currentBlockQualifier, memberQualifier); if (currentBlockQualifier.perPrimitiveNV) memberQualifier.perPrimitiveNV = currentBlockQualifier.perPrimitiveNV; if (currentBlockQualifier.perViewNV) diff --git a/glslang/MachineIndependent/ParseHelper.h b/glslang/MachineIndependent/ParseHelper.h index 1f63e84..5cee05e 100644 --- a/glslang/MachineIndependent/ParseHelper.h +++ b/glslang/MachineIndependent/ParseHelper.h @@ -410,6 +410,7 @@ public: TIntermTyped* addConstructor(const TSourceLoc&, TIntermNode*, const TType&); TIntermTyped* constructAggregate(TIntermNode*, const TType&, int, const TSourceLoc&); TIntermTyped* constructBuiltIn(const TType&, TOperator, TIntermTyped*, const TSourceLoc&, bool subset); + void inheritMemoryQualifiers(const TQualifier& from, TQualifier& to); void declareBlock(const TSourceLoc&, TTypeList& typeList, const TString* instanceName = 0, TArraySizes* arraySizes = 0); void blockStageIoCheck(const TSourceLoc&, const TQualifier&); void blockQualifierCheck(const TSourceLoc&, const TQualifier&, bool instanceName); diff --git a/gtests/AST.FromFile.cpp b/gtests/AST.FromFile.cpp index 35aa32e..5004671 100644 --- a/gtests/AST.FromFile.cpp +++ b/gtests/AST.FromFile.cpp @@ -121,6 +121,7 @@ INSTANTIATE_TEST_CASE_P( "310.tesc", "310.tese", "310implicitSizeArrayError.vert", + "310.inheritMemory.frag", "310AofA.vert", "310runtimeArray.vert", "320.comp", -- 2.7.4