Fix bug in printing trailing comma when dumping AST for a structure.
authorAshwin Lele <alele@nvidia.com>
Wed, 17 Jul 2019 21:40:58 +0000 (14:40 -0700)
committerAshwin Lele <alele@nvidia.com>
Wed, 17 Jul 2019 21:40:58 +0000 (14:40 -0700)
Test/baseResults/310.vert.out
Test/baseResults/320.vert.out
Test/baseResults/330.frag.out
Test/baseResults/410.geom.out
Test/baseResults/420.vert.out
Test/baseResults/430.vert.out
Test/baseResults/440.vert.out
glslang/Include/Types.h

index baf0987..a910e34 100644 (file)
@@ -269,7 +269,7 @@ ERROR: node is still EOpNull!
 0:117            'gl_InstanceID' ( gl_InstanceId highp int InstanceId)
 0:118      move second child to first child ( temp highp 4-component vector of float)
 0:118        gl_Position: direct index for structure ( gl_Position highp 4-component vector of float Position)
-0:118          'anon@1' ( out block{ gl_Position highp 4-component vector of float Position gl_Position})
+0:118          'anon@1' ( out block{ gl_Position highp 4-component vector of float Position gl_Position})
 0:118          Constant:
 0:118            0 (const uint)
 0:118        Constant:
@@ -278,7 +278,7 @@ ERROR: node is still EOpNull!
 0:118          1.000000
 0:118          1.000000
 0:119      gl_PointSize: direct index for structure ( gl_PointSize highp void PointSize)
-0:119        'anon@1' ( out block{ gl_Position highp 4-component vector of float Position gl_Position})
+0:119        'anon@1' ( out block{ gl_Position highp 4-component vector of float Position gl_Position})
 0:119        Constant:
 0:119          1 (const uint)
 0:153  Function Definition: pfooBad( ( global void)
@@ -940,7 +940,7 @@ ERROR: node is still EOpNull!
 0:?     'anon@0' ( out block{layout( location=12) out highp int aAnon, layout( location=13) out highp 4-component vector of float vAnon})
 0:?     'aliased' (layout( location=12) smooth out highp int)
 0:?     'inbinst' ( in block{ in highp int a})
-0:?     'anon@1' ( out block{ gl_Position highp 4-component vector of float Position gl_Position})
+0:?     'anon@1' ( out block{ gl_Position highp 4-component vector of float Position gl_Position})
 0:?     'smon' ( smooth out block{ out highp int i})
 0:?     'fmon' ( flat out block{ out highp int i})
 0:?     'cmon' ( centroid out block{ out highp int i})
@@ -1184,7 +1184,7 @@ ERROR: node is still EOpNull!
 0:?     'anon@0' ( out block{layout( location=12) out highp int aAnon, layout( location=13) out highp 4-component vector of float vAnon})
 0:?     'aliased' (layout( location=12) smooth out highp int)
 0:?     'inbinst' ( in block{ in highp int a})
-0:?     'anon@1' ( out block{ gl_Position highp 4-component vector of float Position gl_Position})
+0:?     'anon@1' ( out block{ gl_Position highp 4-component vector of float Position gl_Position})
 0:?     'smon' ( smooth out block{ out highp int i})
 0:?     'fmon' ( flat out block{ out highp int i})
 0:?     'cmon' ( centroid out block{ out highp int i})
index 2838ab8..bf127d4 100644 (file)
@@ -49,7 +49,7 @@ ERROR: node is still EOpNull!
 0:26            'gl_InstanceID' ( gl_InstanceId highp int InstanceId)
 0:27      move second child to first child ( temp highp 4-component vector of float)
 0:27        gl_Position: direct index for structure ( gl_Position highp 4-component vector of float Position)
-0:27          'anon@1' ( out block{ gl_Position highp 4-component vector of float Position gl_Position})
+0:27          'anon@1' ( out block{ gl_Position highp 4-component vector of float Position gl_Position})
 0:27          Constant:
 0:27            0 (const uint)
 0:27        Constant:
@@ -58,7 +58,7 @@ ERROR: node is still EOpNull!
 0:27          1.000000
 0:27          1.000000
 0:28      gl_PointSize: direct index for structure ( gl_PointSize highp void PointSize)
-0:28        'anon@1' ( out block{ gl_Position highp 4-component vector of float Position gl_Position})
+0:28        'anon@1' ( out block{ gl_Position highp 4-component vector of float Position gl_Position})
 0:28        Constant:
 0:28          1 (const uint)
 0:62  Function Definition: pfoo( ( global void)
@@ -623,7 +623,7 @@ ERROR: node is still EOpNull!
 0:?     'anon@0' ( out block{layout( location=12) out highp int aAnon, layout( location=13) out highp 4-component vector of float vAnon})
 0:?     'aliased' (layout( location=12) smooth out highp int)
 0:?     'inbinst' ( in block{ in highp int a})
-0:?     'anon@1' ( out block{ gl_Position highp 4-component vector of float Position gl_Position})
+0:?     'anon@1' ( out block{ gl_Position highp 4-component vector of float Position gl_Position})
 0:?     'smon' ( smooth out block{ out highp int i})
 0:?     'fmon' ( flat out block{ out highp int i})
 0:?     'cmon' ( centroid out block{ out highp int i})
@@ -709,7 +709,7 @@ ERROR: node is still EOpNull!
 0:26            'gl_InstanceID' ( gl_InstanceId highp int InstanceId)
 0:27      move second child to first child ( temp highp 4-component vector of float)
 0:27        gl_Position: direct index for structure ( gl_Position highp 4-component vector of float Position)
-0:27          'anon@1' ( out block{ gl_Position highp 4-component vector of float Position gl_Position})
+0:27          'anon@1' ( out block{ gl_Position highp 4-component vector of float Position gl_Position})
 0:27          Constant:
 0:27            0 (const uint)
 0:27        Constant:
@@ -718,7 +718,7 @@ ERROR: node is still EOpNull!
 0:27          1.000000
 0:27          1.000000
 0:28      gl_PointSize: direct index for structure ( gl_PointSize highp void PointSize)
-0:28        'anon@1' ( out block{ gl_Position highp 4-component vector of float Position gl_Position})
+0:28        'anon@1' ( out block{ gl_Position highp 4-component vector of float Position gl_Position})
 0:28        Constant:
 0:28          1 (const uint)
 0:?   Linker Objects
@@ -726,7 +726,7 @@ ERROR: node is still EOpNull!
 0:?     'anon@0' ( out block{layout( location=12) out highp int aAnon, layout( location=13) out highp 4-component vector of float vAnon})
 0:?     'aliased' (layout( location=12) smooth out highp int)
 0:?     'inbinst' ( in block{ in highp int a})
-0:?     'anon@1' ( out block{ gl_Position highp 4-component vector of float Position gl_Position})
+0:?     'anon@1' ( out block{ gl_Position highp 4-component vector of float Position gl_Position})
 0:?     'smon' ( smooth out block{ out highp int i})
 0:?     'fmon' ( flat out block{ out highp int i})
 0:?     'cmon' ( centroid out block{ out highp int i})
index 7745631..36ba7a2 100644 (file)
@@ -71,7 +71,7 @@ ERROR: node is still EOpNull!
 0:23        move second child to first child ( temp 4-component vector of float)
 0:23          'c' ( temp 4-component vector of float)
 0:23          gl_Color: direct index for structure ( in 4-component vector of float Color)
-0:23            'anon@0' ( in block{ in 4-component vector of float Color gl_Color})
+0:23            'anon@0' ( in block{ in 4-component vector of float Color gl_Color})
 0:23            Constant:
 0:23              2 (const uint)
 0:24      move second child to first child ( temp 4-component vector of float)
@@ -93,7 +93,7 @@ ERROR: node is still EOpNull!
 0:?     'inVar' ( smooth in 4-component vector of float)
 0:?     'outVar' (layout( location=0 index=0) out 4-component vector of float)
 0:?     'varyingVar' ( smooth in 4-component vector of float)
-0:?     'anon@0' ( in block{ in 4-component vector of float Color gl_Color})
+0:?     'anon@0' ( in block{ in 4-component vector of float Color gl_Color})
 0:?     'gl_name' ( in block{ in int gl_i})
 0:?     'start' ( const int)
 0:?       6 (const int)
@@ -158,7 +158,7 @@ ERROR: node is still EOpNull!
 0:?     'inVar' ( smooth in 4-component vector of float)
 0:?     'outVar' (layout( location=0 index=0) out 4-component vector of float)
 0:?     'varyingVar' ( smooth in 4-component vector of float)
-0:?     'anon@0' ( in block{ in 4-component vector of float Color gl_Color})
+0:?     'anon@0' ( in block{ in 4-component vector of float Color gl_Color})
 0:?     'gl_name' ( in block{ in int gl_i})
 0:?     'start' ( const int)
 0:?       6 (const int)
index ab5ad47..c38ba48 100644 (file)
@@ -38,12 +38,12 @@ ERROR: node is still EOpNull!
 0:30              0 (const int)
 0:31      move second child to first child ( temp float)
 0:31        gl_PointSize: direct index for structure (layout( stream=0) gl_PointSize float PointSize)
-0:31          'anon@0' (layout( stream=0) out block{layout( stream=0) gl_PointSize float PointSize gl_PointSize})
+0:31          'anon@0' (layout( stream=0) out block{layout( stream=0) gl_PointSize float PointSize gl_PointSize})
 0:31          Constant:
 0:31            1 (const uint)
 0:31        'p' ( temp float)
 0:33      gl_Position: direct index for structure (layout( stream=0) gl_Position void Position)
-0:33        'anon@0' (layout( stream=0) out block{layout( stream=0) gl_PointSize float PointSize gl_PointSize})
+0:33        'anon@0' (layout( stream=0) out block{layout( stream=0) gl_PointSize float PointSize gl_PointSize})
 0:33        Constant:
 0:33          0 (const uint)
 0:36  Function Definition: foo5( ( global float)
@@ -54,7 +54,7 @@ ERROR: node is still EOpNull!
 0:38          4.000000
 0:?   Linker Objects
 0:?     'gl_in' ( in unsized 2-element array of block{ in float PointSize gl_PointSize})
-0:?     'anon@0' (layout( stream=0) out block{layout( stream=0) gl_PointSize float PointSize gl_PointSize})
+0:?     'anon@0' (layout( stream=0) out block{layout( stream=0) gl_PointSize float PointSize gl_PointSize})
 
 
 Linked geometry stage:
@@ -78,5 +78,5 @@ ERROR: node is still EOpNull!
 0:5          7 (const int)
 0:?   Linker Objects
 0:?     'gl_in' ( in 2-element array of block{ in float PointSize gl_PointSize})
-0:?     'anon@0' (layout( stream=0) out block{layout( stream=0) gl_PointSize float PointSize gl_PointSize})
+0:?     'anon@0' (layout( stream=0) out block{layout( stream=0) gl_PointSize float PointSize gl_PointSize})
 
index c572d97..3d49327 100644 (file)
@@ -281,7 +281,7 @@ ERROR: node is still EOpNull!
 0:?     'sampb3' (layout( binding=80) uniform sampler2D)
 0:?     'sampb4' (layout( binding=31) uniform sampler2D)
 0:?     'sampb5' (layout( binding=79) uniform 2-element array of sampler2D)
-0:?     'anon@3' ( out block{ out 4-element array of float ClipDistance gl_ClipDistance})
+0:?     'anon@3' ( out block{ out 4-element array of float ClipDistance gl_ClipDistance})
 0:?     'patchIn' ( patch in 4-component vector of float)
 0:?     'patchOut' ( smooth patch out 4-component vector of float)
 0:?     'comma0' ( temp int)
@@ -363,7 +363,7 @@ ERROR: node is still EOpNull!
 0:?     'sampb3' (layout( binding=80) uniform sampler2D)
 0:?     'sampb4' (layout( binding=31) uniform sampler2D)
 0:?     'sampb5' (layout( binding=79) uniform 2-element array of sampler2D)
-0:?     'anon@3' ( out block{ out 4-element array of float ClipDistance gl_ClipDistance})
+0:?     'anon@3' ( out block{ out 4-element array of float ClipDistance gl_ClipDistance})
 0:?     'patchIn' ( patch in 4-component vector of float)
 0:?     'patchOut' ( smooth patch out 4-component vector of float)
 0:?     'comma0' ( temp int)
index d741d35..4bac5fc 100644 (file)
@@ -78,7 +78,7 @@ ERROR: node is still EOpNull!
 0:16      move second child to first child ( temp float)
 0:16        direct index ( temp float ClipDistance)
 0:16          gl_ClipDistance: direct index for structure ( out 17-element array of float ClipDistance)
-0:16            'anon@0' ( out block{ out 17-element array of float ClipDistance gl_ClipDistance})
+0:16            'anon@0' ( out block{ out 17-element array of float ClipDistance gl_ClipDistance})
 0:16            Constant:
 0:16              2 (const uint)
 0:16          Constant:
@@ -206,7 +206,7 @@ ERROR: node is still EOpNull!
 0:?     'uv4' (layout( location=4) uniform 4-component vector of float)
 0:?     'b1' (layout( location=2) in block{ in 4-component vector of float v})
 0:?     'b2' (layout( location=2) out block{ out 4-component vector of float v})
-0:?     'anon@0' ( out block{ out 17-element array of float ClipDistance gl_ClipDistance})
+0:?     'anon@0' ( out block{ out 17-element array of float ClipDistance gl_ClipDistance})
 0:?     'cs' (layout( location=10) smooth out 2-element array of structure{ global 7-element array of 3X2 matrix of float m,  global float f})
 0:?     'cf' (layout( location=54) smooth out float)
 0:?     'cg' (layout( location=53) smooth out float)
@@ -281,7 +281,7 @@ ERROR: node is still EOpNull!
 0:?     'uv4' (layout( location=4) uniform 4-component vector of float)
 0:?     'b1' (layout( location=2) in block{ in 4-component vector of float v})
 0:?     'b2' (layout( location=2) out block{ out 4-component vector of float v})
-0:?     'anon@0' ( out block{ out 17-element array of float ClipDistance gl_ClipDistance})
+0:?     'anon@0' ( out block{ out 17-element array of float ClipDistance gl_ClipDistance})
 0:?     'cs' (layout( location=10) smooth out 2-element array of structure{ global 7-element array of 3X2 matrix of float m,  global float f})
 0:?     'cf' (layout( location=54) smooth out float)
 0:?     'cg' (layout( location=53) smooth out float)
index 5af757a..6c975c0 100644 (file)
@@ -156,7 +156,7 @@ ERROR: node is still EOpNull!
 0:?     'bbinst9' ( out block{layout( xfb_buffer=4 xfb_offset=1) out bool b, layout( xfb_buffer=4 xfb_offset=12) out structure{ global bool b,  global structure{ global int i,  global double d,  global float f} s,  global 2-component vector of float v2} t, layout( xfb_buffer=4 xfb_offset=52) out 3X3 matrix of float m3, layout( xfb_buffer=4 xfb_offset=90) out int i, layout( xfb_buffer=4 xfb_offset=98) out double d, layout( xfb_buffer=4 xfb_offset=108) out structure{ global int a} s})
 0:?     'bm' (layout( xfb_buffer=5 xfb_offset=0) smooth out float)
 0:?     'bbinst10' ( out block{layout( xfb_buffer=7 xfb_offset=0) out 4X4 matrix of double m1, layout( xfb_buffer=7 xfb_offset=128) out 4X4 matrix of double m2, layout( xfb_buffer=7 xfb_offset=256) out float f})
-0:?     'anon@0' ( out block{layout( xfb_buffer=3 xfb_offset=36) gl_Position 4-component vector of float Position gl_Position, layout( xfb_buffer=3 xfb_offset=32) gl_PointSize float PointSize gl_PointSize})
+0:?     'anon@0' ( out block{layout( xfb_buffer=3 xfb_offset=36) gl_Position 4-component vector of float Position gl_Position, layout( xfb_buffer=3 xfb_offset=32) gl_PointSize float PointSize gl_PointSize})
 0:?     'gl_VertexID' ( gl_VertexId int VertexId)
 0:?     'gl_InstanceID' ( gl_InstanceId int InstanceId)
 
@@ -241,7 +241,7 @@ ERROR: node is still EOpNull!
 0:?     'bbinst9' ( out block{layout( xfb_buffer=4 xfb_offset=1) out bool b, layout( xfb_buffer=4 xfb_offset=12) out structure{ global bool b,  global structure{ global int i,  global double d,  global float f} s,  global 2-component vector of float v2} t, layout( xfb_buffer=4 xfb_offset=52) out 3X3 matrix of float m3, layout( xfb_buffer=4 xfb_offset=90) out int i, layout( xfb_buffer=4 xfb_offset=98) out double d, layout( xfb_buffer=4 xfb_offset=108) out structure{ global int a} s})
 0:?     'bm' (layout( xfb_buffer=5 xfb_offset=0) smooth out float)
 0:?     'bbinst10' ( out block{layout( xfb_buffer=7 xfb_offset=0) out 4X4 matrix of double m1, layout( xfb_buffer=7 xfb_offset=128) out 4X4 matrix of double m2, layout( xfb_buffer=7 xfb_offset=256) out float f})
-0:?     'anon@0' ( out block{layout( xfb_buffer=3 xfb_offset=36) gl_Position 4-component vector of float Position gl_Position, layout( xfb_buffer=3 xfb_offset=32) gl_PointSize float PointSize gl_PointSize})
+0:?     'anon@0' ( out block{layout( xfb_buffer=3 xfb_offset=36) gl_Position 4-component vector of float Position gl_Position, layout( xfb_buffer=3 xfb_offset=32) gl_PointSize float PointSize gl_PointSize})
 0:?     'gl_VertexID' ( gl_VertexId int VertexId)
 0:?     'gl_InstanceID' ( gl_InstanceId int InstanceId)
 
index 989c34a..dbc2877 100644 (file)
@@ -2050,13 +2050,15 @@ public:
         // Add struct/block members
         if (isStruct() && structure) {
             appendStr("{");
+            bool hasHiddenMember = true;
             for (size_t i = 0; i < structure->size(); ++i) {
                 if (! (*structure)[i].type->hiddenMember()) {
+                    if (!hasHiddenMember) 
+                        appendStr(", ");
                     typeString.append((*structure)[i].type->getCompleteString());
                     typeString.append(" ");
                     typeString.append((*structure)[i].type->getFieldName());
-                    if (i < structure->size() - 1)
-                        appendStr(", ");
+                    hasHiddenMember = false;
                 }
             }
             appendStr("}");