diff --git a/Test/baseResults/hlsl.clipdistance-1.geom.out b/Test/baseResults/hlsl.clipdistance-1.geom.out
index c9263bc096e4be9ac4bd9dbda1e942fc3aa52d80..bde7822f2d0f54f89def8f3bf66ac950e7618f17 100644
--- a/Test/baseResults/hlsl.clipdistance-1.geom.out
+++ b/Test/baseResults/hlsl.clipdistance-1.geom.out
@@ -1,80 +1,276 @@
 hlsl.clipdistance-1.geom
-ERROR: 0:13: '' : unimplemented: clip/cull not currently implemented for this stage 
-ERROR: 0:13: '' : unimplemented: clip/cull not currently implemented for this stage 
-ERROR: 0:20: '' : unimplemented: clip/cull not currently implemented for this stage 
-ERROR: 0:20: '' : unimplemented: clip/cull not currently implemented for this stage 
-ERROR: 4 compilation errors.  No code generated.
-
-
 Shader version: 500
 invocations = -1
 max_vertices = 3
 input primitive = triangles
 output primitive = line_strip
-ERROR: node is still EOpNull!
-0:13  Function Definition: @main(vf4[3];u1[3];struct-S-vf4-f1-f11;f1[3];f1[3]; ( temp void)
-0:13    Function Parameters: 
-0:13      'pos' ( in 3-element array of 4-component vector of float)
-0:13      'VertexID' ( in 3-element array of uint)
-0:13      'OutputStream' ( out structure{ temp 4-component vector of float pos,  temp float clip,  temp float cull})
-0:13      'clip' ( in 3-element array of float)
-0:13      'cull' ( in 3-element array of float)
+0:? Sequence
+0:11  Function Definition: @main(vf4[3];u1[3];struct-S-vf4-vf21;vf4[3]; ( temp void)
+0:11    Function Parameters: 
+0:11      'pos' ( in 3-element array of 4-component vector of float)
+0:11      'VertexID' ( in 3-element array of uint)
+0:11      'OutputStream' ( out structure{ temp 4-component vector of float pos,  temp 2-component vector of float clip})
+0:11      'clip' ( in 3-element array of 4-component vector of float)
 0:?     Sequence
-0:16      move second child to first child ( temp 4-component vector of float)
-0:16        pos: direct index for structure ( temp 4-component vector of float)
-0:16          's' ( temp structure{ temp 4-component vector of float pos,  temp float clip,  temp float cull})
-0:16          Constant:
-0:16            0 (const int)
-0:16        direct index ( temp 4-component vector of float)
-0:16          'pos' ( in 3-element array of 4-component vector of float)
-0:16          Constant:
-0:16            0 (const int)
-0:17      move second child to first child ( temp float)
-0:17        clip: direct index for structure ( temp float)
-0:17          's' ( temp structure{ temp 4-component vector of float pos,  temp float clip,  temp float cull})
-0:17          Constant:
-0:17            1 (const int)
-0:17        direct index ( temp float)
-0:17          'clip' ( in 3-element array of float)
-0:17          Constant:
-0:17            0 (const int)
-0:18      move second child to first child ( temp float)
-0:18        cull: direct index for structure ( temp float)
-0:18          's' ( temp structure{ temp 4-component vector of float pos,  temp float clip,  temp float cull})
-0:18          Constant:
-0:18            2 (const int)
-0:18        direct index ( temp float)
-0:18          'cull' ( in 3-element array of float)
-0:18          Constant:
-0:18            0 (const int)
-0:20      Sequence
-0:20        Sequence
-0:20          move second child to first child ( temp 4-component vector of float)
+0:14      move second child to first child ( temp 4-component vector of float)
+0:14        pos: direct index for structure ( temp 4-component vector of float)
+0:14          's' ( temp structure{ temp 4-component vector of float pos,  temp 2-component vector of float clip})
+0:14          Constant:
+0:14            0 (const int)
+0:14        direct index ( temp 4-component vector of float)
+0:14          'pos' ( in 3-element array of 4-component vector of float)
+0:14          Constant:
+0:14            0 (const int)
+0:15      move second child to first child ( temp 2-component vector of float)
+0:15        clip: direct index for structure ( temp 2-component vector of float)
+0:15          's' ( temp structure{ temp 4-component vector of float pos,  temp 2-component vector of float clip})
+0:15          Constant:
+0:15            1 (const int)
+0:15        vector swizzle ( temp 2-component vector of float)
+0:15          direct index ( temp 4-component vector of float)
+0:15            'clip' ( in 3-element array of 4-component vector of float)
+0:15            Constant:
+0:15              0 (const int)
+0:15          Sequence
+0:15            Constant:
+0:15              0 (const int)
+0:15            Constant:
+0:15              1 (const int)
+0:17      Sequence
+0:17        Sequence
+0:17          move second child to first child ( temp 4-component vector of float)
 0:?             'OutputStream.pos' ( out 4-component vector of float Position)
-0:20            pos: direct index for structure ( temp 4-component vector of float)
-0:20              's' ( temp structure{ temp 4-component vector of float pos,  temp float clip,  temp float cull})
-0:20              Constant:
-0:20                0 (const int)
-0:20        EmitVertex ( temp void)
-0:13  Function Definition: main( ( temp void)
-0:13    Function Parameters: 
+0:17            pos: direct index for structure ( temp 4-component vector of float)
+0:17              's' ( temp structure{ temp 4-component vector of float pos,  temp 2-component vector of float clip})
+0:17              Constant:
+0:17                0 (const int)
+0:?           Sequence
+0:17            move second child to first child ( temp float)
+0:17              direct index ( out float ClipDistance)
+0:?                 'OutputStream.clip' ( out 2-element array of float ClipDistance)
+0:17                Constant:
+0:17                  0 (const int)
+0:17              direct index ( temp float)
+0:17                clip: direct index for structure ( temp 2-component vector of float)
+0:17                  's' ( temp structure{ temp 4-component vector of float pos,  temp 2-component vector of float clip})
+0:17                  Constant:
+0:17                    1 (const int)
+0:17                Constant:
+0:17                  0 (const int)
+0:17            move second child to first child ( temp float)
+0:17              direct index ( out float ClipDistance)
+0:?                 'OutputStream.clip' ( out 2-element array of float ClipDistance)
+0:17                Constant:
+0:17                  1 (const int)
+0:17              direct index ( temp float)
+0:17                clip: direct index for structure ( temp 2-component vector of float)
+0:17                  's' ( temp structure{ temp 4-component vector of float pos,  temp 2-component vector of float clip})
+0:17                  Constant:
+0:17                    1 (const int)
+0:17                Constant:
+0:17                  1 (const int)
+0:17        EmitVertex ( temp void)
+0:11  Function Definition: main( ( temp void)
+0:11    Function Parameters: 
 0:?     Sequence
-0:13      move second child to first child ( temp 3-element array of 4-component vector of float)
+0:11      move second child to first child ( temp 3-element array of 4-component vector of float)
 0:?         'pos' ( temp 3-element array of 4-component vector of float)
 0:?         'pos' ( in 3-element array of 4-component vector of float Position)
-0:13      move second child to first child ( temp 3-element array of uint)
+0:11      move second child to first child ( temp 3-element array of uint)
 0:?         'VertexID' ( temp 3-element array of uint)
 0:?         'VertexID' (layout( location=0) in 3-element array of uint)
-0:13      Function Call: @main(vf4[3];u1[3];struct-S-vf4-f1-f11;f1[3];f1[3]; ( temp void)
+0:?       Sequence
+0:11        move second child to first child ( temp float)
+0:11          direct index ( temp float)
+0:11            direct index ( temp 4-component vector of float)
+0:?               'clip' ( temp 3-element array of 4-component vector of float)
+0:11              Constant:
+0:11                0 (const int)
+0:11            Constant:
+0:11              0 (const int)
+0:11          direct index ( in float ClipDistance)
+0:11            direct index ( in 4-element array of float ClipDistance)
+0:?               'clip' ( in 3-element array of 4-element array of float ClipDistance)
+0:11              Constant:
+0:11                0 (const int)
+0:11            Constant:
+0:11              0 (const int)
+0:11        move second child to first child ( temp float)
+0:11          direct index ( temp float)
+0:11            direct index ( temp 4-component vector of float)
+0:?               'clip' ( temp 3-element array of 4-component vector of float)
+0:11              Constant:
+0:11                0 (const int)
+0:11            Constant:
+0:11              1 (const int)
+0:11          direct index ( in float ClipDistance)
+0:11            direct index ( in 4-element array of float ClipDistance)
+0:?               'clip' ( in 3-element array of 4-element array of float ClipDistance)
+0:11              Constant:
+0:11                0 (const int)
+0:11            Constant:
+0:11              1 (const int)
+0:11        move second child to first child ( temp float)
+0:11          direct index ( temp float)
+0:11            direct index ( temp 4-component vector of float)
+0:?               'clip' ( temp 3-element array of 4-component vector of float)
+0:11              Constant:
+0:11                0 (const int)
+0:11            Constant:
+0:11              2 (const int)
+0:11          direct index ( in float ClipDistance)
+0:11            direct index ( in 4-element array of float ClipDistance)
+0:?               'clip' ( in 3-element array of 4-element array of float ClipDistance)
+0:11              Constant:
+0:11                0 (const int)
+0:11            Constant:
+0:11              2 (const int)
+0:11        move second child to first child ( temp float)
+0:11          direct index ( temp float)
+0:11            direct index ( temp 4-component vector of float)
+0:?               'clip' ( temp 3-element array of 4-component vector of float)
+0:11              Constant:
+0:11                0 (const int)
+0:11            Constant:
+0:11              3 (const int)
+0:11          direct index ( in float ClipDistance)
+0:11            direct index ( in 4-element array of float ClipDistance)
+0:?               'clip' ( in 3-element array of 4-element array of float ClipDistance)
+0:11              Constant:
+0:11                0 (const int)
+0:11            Constant:
+0:11              3 (const int)
+0:11        move second child to first child ( temp float)
+0:11          direct index ( temp float)
+0:11            direct index ( temp 4-component vector of float)
+0:?               'clip' ( temp 3-element array of 4-component vector of float)
+0:11              Constant:
+0:11                1 (const int)
+0:11            Constant:
+0:11              0 (const int)
+0:11          direct index ( in float ClipDistance)
+0:11            direct index ( in 4-element array of float ClipDistance)
+0:?               'clip' ( in 3-element array of 4-element array of float ClipDistance)
+0:11              Constant:
+0:11                1 (const int)
+0:11            Constant:
+0:11              0 (const int)
+0:11        move second child to first child ( temp float)
+0:11          direct index ( temp float)
+0:11            direct index ( temp 4-component vector of float)
+0:?               'clip' ( temp 3-element array of 4-component vector of float)
+0:11              Constant:
+0:11                1 (const int)
+0:11            Constant:
+0:11              1 (const int)
+0:11          direct index ( in float ClipDistance)
+0:11            direct index ( in 4-element array of float ClipDistance)
+0:?               'clip' ( in 3-element array of 4-element array of float ClipDistance)
+0:11              Constant:
+0:11                1 (const int)
+0:11            Constant:
+0:11              1 (const int)
+0:11        move second child to first child ( temp float)
+0:11          direct index ( temp float)
+0:11            direct index ( temp 4-component vector of float)
+0:?               'clip' ( temp 3-element array of 4-component vector of float)
+0:11              Constant:
+0:11                1 (const int)
+0:11            Constant:
+0:11              2 (const int)
+0:11          direct index ( in float ClipDistance)
+0:11            direct index ( in 4-element array of float ClipDistance)
+0:?               'clip' ( in 3-element array of 4-element array of float ClipDistance)
+0:11              Constant:
+0:11                1 (const int)
+0:11            Constant:
+0:11              2 (const int)
+0:11        move second child to first child ( temp float)
+0:11          direct index ( temp float)
+0:11            direct index ( temp 4-component vector of float)
+0:?               'clip' ( temp 3-element array of 4-component vector of float)
+0:11              Constant:
+0:11                1 (const int)
+0:11            Constant:
+0:11              3 (const int)
+0:11          direct index ( in float ClipDistance)
+0:11            direct index ( in 4-element array of float ClipDistance)
+0:?               'clip' ( in 3-element array of 4-element array of float ClipDistance)
+0:11              Constant:
+0:11                1 (const int)
+0:11            Constant:
+0:11              3 (const int)
+0:11        move second child to first child ( temp float)
+0:11          direct index ( temp float)
+0:11            direct index ( temp 4-component vector of float)
+0:?               'clip' ( temp 3-element array of 4-component vector of float)
+0:11              Constant:
+0:11                2 (const int)
+0:11            Constant:
+0:11              0 (const int)
+0:11          direct index ( in float ClipDistance)
+0:11            direct index ( in 4-element array of float ClipDistance)
+0:?               'clip' ( in 3-element array of 4-element array of float ClipDistance)
+0:11              Constant:
+0:11                2 (const int)
+0:11            Constant:
+0:11              0 (const int)
+0:11        move second child to first child ( temp float)
+0:11          direct index ( temp float)
+0:11            direct index ( temp 4-component vector of float)
+0:?               'clip' ( temp 3-element array of 4-component vector of float)
+0:11              Constant:
+0:11                2 (const int)
+0:11            Constant:
+0:11              1 (const int)
+0:11          direct index ( in float ClipDistance)
+0:11            direct index ( in 4-element array of float ClipDistance)
+0:?               'clip' ( in 3-element array of 4-element array of float ClipDistance)
+0:11              Constant:
+0:11                2 (const int)
+0:11            Constant:
+0:11              1 (const int)
+0:11        move second child to first child ( temp float)
+0:11          direct index ( temp float)
+0:11            direct index ( temp 4-component vector of float)
+0:?               'clip' ( temp 3-element array of 4-component vector of float)
+0:11              Constant:
+0:11                2 (const int)
+0:11            Constant:
+0:11              2 (const int)
+0:11          direct index ( in float ClipDistance)
+0:11            direct index ( in 4-element array of float ClipDistance)
+0:?               'clip' ( in 3-element array of 4-element array of float ClipDistance)
+0:11              Constant:
+0:11                2 (const int)
+0:11            Constant:
+0:11              2 (const int)
+0:11        move second child to first child ( temp float)
+0:11          direct index ( temp float)
+0:11            direct index ( temp 4-component vector of float)
+0:?               'clip' ( temp 3-element array of 4-component vector of float)
+0:11              Constant:
+0:11                2 (const int)
+0:11            Constant:
+0:11              3 (const int)
+0:11          direct index ( in float ClipDistance)
+0:11            direct index ( in 4-element array of float ClipDistance)
+0:?               'clip' ( in 3-element array of 4-element array of float ClipDistance)
+0:11              Constant:
+0:11                2 (const int)
+0:11            Constant:
+0:11              3 (const int)
+0:11      Function Call: @main(vf4[3];u1[3];struct-S-vf4-vf21;vf4[3]; ( temp void)
 0:?         'pos' ( temp 3-element array of 4-component vector of float)
 0:?         'VertexID' ( temp 3-element array of uint)
-0:?         'OutputStream' ( temp structure{ temp 4-component vector of float pos,  temp float clip,  temp float cull})
-0:?         'clip' ( temp 3-element array of float)
-0:?         'cull' ( temp 3-element array of float)
+0:?         'OutputStream' ( temp structure{ temp 4-component vector of float pos,  temp 2-component vector of float clip})
+0:?         'clip' ( temp 3-element array of 4-component vector of float)
 0:?   Linker Objects
 0:?     'pos' ( in 3-element array of 4-component vector of float Position)
 0:?     'VertexID' (layout( location=0) in 3-element array of uint)
 0:?     'OutputStream.pos' ( out 4-component vector of float Position)
+0:?     'clip' ( in 3-element array of 4-element array of float ClipDistance)
+0:?     'OutputStream.clip' ( out 2-element array of float ClipDistance)
 
 
 Linked geometry stage:
@@ -85,69 +281,457 @@ invocations = 1
 max_vertices = 3
 input primitive = triangles
 output primitive = line_strip
-ERROR: node is still EOpNull!
-0:13  Function Definition: @main(vf4[3];u1[3];struct-S-vf4-f1-f11;f1[3];f1[3]; ( temp void)
-0:13    Function Parameters: 
-0:13      'pos' ( in 3-element array of 4-component vector of float)
-0:13      'VertexID' ( in 3-element array of uint)
-0:13      'OutputStream' ( out structure{ temp 4-component vector of float pos,  temp float clip,  temp float cull})
-0:13      'clip' ( in 3-element array of float)
-0:13      'cull' ( in 3-element array of float)
+0:? Sequence
+0:11  Function Definition: @main(vf4[3];u1[3];struct-S-vf4-vf21;vf4[3]; ( temp void)
+0:11    Function Parameters: 
+0:11      'pos' ( in 3-element array of 4-component vector of float)
+0:11      'VertexID' ( in 3-element array of uint)
+0:11      'OutputStream' ( out structure{ temp 4-component vector of float pos,  temp 2-component vector of float clip})
+0:11      'clip' ( in 3-element array of 4-component vector of float)
 0:?     Sequence
-0:16      move second child to first child ( temp 4-component vector of float)
-0:16        pos: direct index for structure ( temp 4-component vector of float)
-0:16          's' ( temp structure{ temp 4-component vector of float pos,  temp float clip,  temp float cull})
-0:16          Constant:
-0:16            0 (const int)
-0:16        direct index ( temp 4-component vector of float)
-0:16          'pos' ( in 3-element array of 4-component vector of float)
-0:16          Constant:
-0:16            0 (const int)
-0:17      move second child to first child ( temp float)
-0:17        clip: direct index for structure ( temp float)
-0:17          's' ( temp structure{ temp 4-component vector of float pos,  temp float clip,  temp float cull})
-0:17          Constant:
-0:17            1 (const int)
-0:17        direct index ( temp float)
-0:17          'clip' ( in 3-element array of float)
-0:17          Constant:
-0:17            0 (const int)
-0:18      move second child to first child ( temp float)
-0:18        cull: direct index for structure ( temp float)
-0:18          's' ( temp structure{ temp 4-component vector of float pos,  temp float clip,  temp float cull})
-0:18          Constant:
-0:18            2 (const int)
-0:18        direct index ( temp float)
-0:18          'cull' ( in 3-element array of float)
-0:18          Constant:
-0:18            0 (const int)
-0:20      Sequence
-0:20        Sequence
-0:20          move second child to first child ( temp 4-component vector of float)
+0:14      move second child to first child ( temp 4-component vector of float)
+0:14        pos: direct index for structure ( temp 4-component vector of float)
+0:14          's' ( temp structure{ temp 4-component vector of float pos,  temp 2-component vector of float clip})
+0:14          Constant:
+0:14            0 (const int)
+0:14        direct index ( temp 4-component vector of float)
+0:14          'pos' ( in 3-element array of 4-component vector of float)
+0:14          Constant:
+0:14            0 (const int)
+0:15      move second child to first child ( temp 2-component vector of float)
+0:15        clip: direct index for structure ( temp 2-component vector of float)
+0:15          's' ( temp structure{ temp 4-component vector of float pos,  temp 2-component vector of float clip})
+0:15          Constant:
+0:15            1 (const int)
+0:15        vector swizzle ( temp 2-component vector of float)
+0:15          direct index ( temp 4-component vector of float)
+0:15            'clip' ( in 3-element array of 4-component vector of float)
+0:15            Constant:
+0:15              0 (const int)
+0:15          Sequence
+0:15            Constant:
+0:15              0 (const int)
+0:15            Constant:
+0:15              1 (const int)
+0:17      Sequence
+0:17        Sequence
+0:17          move second child to first child ( temp 4-component vector of float)
 0:?             'OutputStream.pos' ( out 4-component vector of float Position)
-0:20            pos: direct index for structure ( temp 4-component vector of float)
-0:20              's' ( temp structure{ temp 4-component vector of float pos,  temp float clip,  temp float cull})
-0:20              Constant:
-0:20                0 (const int)
-0:20        EmitVertex ( temp void)
-0:13  Function Definition: main( ( temp void)
-0:13    Function Parameters: 
+0:17            pos: direct index for structure ( temp 4-component vector of float)
+0:17              's' ( temp structure{ temp 4-component vector of float pos,  temp 2-component vector of float clip})
+0:17              Constant:
+0:17                0 (const int)
+0:?           Sequence
+0:17            move second child to first child ( temp float)
+0:17              direct index ( out float ClipDistance)
+0:?                 'OutputStream.clip' ( out 2-element array of float ClipDistance)
+0:17                Constant:
+0:17                  0 (const int)
+0:17              direct index ( temp float)
+0:17                clip: direct index for structure ( temp 2-component vector of float)
+0:17                  's' ( temp structure{ temp 4-component vector of float pos,  temp 2-component vector of float clip})
+0:17                  Constant:
+0:17                    1 (const int)
+0:17                Constant:
+0:17                  0 (const int)
+0:17            move second child to first child ( temp float)
+0:17              direct index ( out float ClipDistance)
+0:?                 'OutputStream.clip' ( out 2-element array of float ClipDistance)
+0:17                Constant:
+0:17                  1 (const int)
+0:17              direct index ( temp float)
+0:17                clip: direct index for structure ( temp 2-component vector of float)
+0:17                  's' ( temp structure{ temp 4-component vector of float pos,  temp 2-component vector of float clip})
+0:17                  Constant:
+0:17                    1 (const int)
+0:17                Constant:
+0:17                  1 (const int)
+0:17        EmitVertex ( temp void)
+0:11  Function Definition: main( ( temp void)
+0:11    Function Parameters: 
 0:?     Sequence
-0:13      move second child to first child ( temp 3-element array of 4-component vector of float)
+0:11      move second child to first child ( temp 3-element array of 4-component vector of float)
 0:?         'pos' ( temp 3-element array of 4-component vector of float)
 0:?         'pos' ( in 3-element array of 4-component vector of float Position)
-0:13      move second child to first child ( temp 3-element array of uint)
+0:11      move second child to first child ( temp 3-element array of uint)
 0:?         'VertexID' ( temp 3-element array of uint)
 0:?         'VertexID' (layout( location=0) in 3-element array of uint)
-0:13      Function Call: @main(vf4[3];u1[3];struct-S-vf4-f1-f11;f1[3];f1[3]; ( temp void)
+0:?       Sequence
+0:11        move second child to first child ( temp float)
+0:11          direct index ( temp float)
+0:11            direct index ( temp 4-component vector of float)
+0:?               'clip' ( temp 3-element array of 4-component vector of float)
+0:11              Constant:
+0:11                0 (const int)
+0:11            Constant:
+0:11              0 (const int)
+0:11          direct index ( in float ClipDistance)
+0:11            direct index ( in 4-element array of float ClipDistance)
+0:?               'clip' ( in 3-element array of 4-element array of float ClipDistance)
+0:11              Constant:
+0:11                0 (const int)
+0:11            Constant:
+0:11              0 (const int)
+0:11        move second child to first child ( temp float)
+0:11          direct index ( temp float)
+0:11            direct index ( temp 4-component vector of float)
+0:?               'clip' ( temp 3-element array of 4-component vector of float)
+0:11              Constant:
+0:11                0 (const int)
+0:11            Constant:
+0:11              1 (const int)
+0:11          direct index ( in float ClipDistance)
+0:11            direct index ( in 4-element array of float ClipDistance)
+0:?               'clip' ( in 3-element array of 4-element array of float ClipDistance)
+0:11              Constant:
+0:11                0 (const int)
+0:11            Constant:
+0:11              1 (const int)
+0:11        move second child to first child ( temp float)
+0:11          direct index ( temp float)
+0:11            direct index ( temp 4-component vector of float)
+0:?               'clip' ( temp 3-element array of 4-component vector of float)
+0:11              Constant:
+0:11                0 (const int)
+0:11            Constant:
+0:11              2 (const int)
+0:11          direct index ( in float ClipDistance)
+0:11            direct index ( in 4-element array of float ClipDistance)
+0:?               'clip' ( in 3-element array of 4-element array of float ClipDistance)
+0:11              Constant:
+0:11                0 (const int)
+0:11            Constant:
+0:11              2 (const int)
+0:11        move second child to first child ( temp float)
+0:11          direct index ( temp float)
+0:11            direct index ( temp 4-component vector of float)
+0:?               'clip' ( temp 3-element array of 4-component vector of float)
+0:11              Constant:
+0:11                0 (const int)
+0:11            Constant:
+0:11              3 (const int)
+0:11          direct index ( in float ClipDistance)
+0:11            direct index ( in 4-element array of float ClipDistance)
+0:?               'clip' ( in 3-element array of 4-element array of float ClipDistance)
+0:11              Constant:
+0:11                0 (const int)
+0:11            Constant:
+0:11              3 (const int)
+0:11        move second child to first child ( temp float)
+0:11          direct index ( temp float)
+0:11            direct index ( temp 4-component vector of float)
+0:?               'clip' ( temp 3-element array of 4-component vector of float)
+0:11              Constant:
+0:11                1 (const int)
+0:11            Constant:
+0:11              0 (const int)
+0:11          direct index ( in float ClipDistance)
+0:11            direct index ( in 4-element array of float ClipDistance)
+0:?               'clip' ( in 3-element array of 4-element array of float ClipDistance)
+0:11              Constant:
+0:11                1 (const int)
+0:11            Constant:
+0:11              0 (const int)
+0:11        move second child to first child ( temp float)
+0:11          direct index ( temp float)
+0:11            direct index ( temp 4-component vector of float)
+0:?               'clip' ( temp 3-element array of 4-component vector of float)
+0:11              Constant:
+0:11                1 (const int)
+0:11            Constant:
+0:11              1 (const int)
+0:11          direct index ( in float ClipDistance)
+0:11            direct index ( in 4-element array of float ClipDistance)
+0:?               'clip' ( in 3-element array of 4-element array of float ClipDistance)
+0:11              Constant:
+0:11                1 (const int)
+0:11            Constant:
+0:11              1 (const int)
+0:11        move second child to first child ( temp float)
+0:11          direct index ( temp float)
+0:11            direct index ( temp 4-component vector of float)
+0:?               'clip' ( temp 3-element array of 4-component vector of float)
+0:11              Constant:
+0:11                1 (const int)
+0:11            Constant:
+0:11              2 (const int)
+0:11          direct index ( in float ClipDistance)
+0:11            direct index ( in 4-element array of float ClipDistance)
+0:?               'clip' ( in 3-element array of 4-element array of float ClipDistance)
+0:11              Constant:
+0:11                1 (const int)
+0:11            Constant:
+0:11              2 (const int)
+0:11        move second child to first child ( temp float)
+0:11          direct index ( temp float)
+0:11            direct index ( temp 4-component vector of float)
+0:?               'clip' ( temp 3-element array of 4-component vector of float)
+0:11              Constant:
+0:11                1 (const int)
+0:11            Constant:
+0:11              3 (const int)
+0:11          direct index ( in float ClipDistance)
+0:11            direct index ( in 4-element array of float ClipDistance)
+0:?               'clip' ( in 3-element array of 4-element array of float ClipDistance)
+0:11              Constant:
+0:11                1 (const int)
+0:11            Constant:
+0:11              3 (const int)
+0:11        move second child to first child ( temp float)
+0:11          direct index ( temp float)
+0:11            direct index ( temp 4-component vector of float)
+0:?               'clip' ( temp 3-element array of 4-component vector of float)
+0:11              Constant:
+0:11                2 (const int)
+0:11            Constant:
+0:11              0 (const int)
+0:11          direct index ( in float ClipDistance)
+0:11            direct index ( in 4-element array of float ClipDistance)
+0:?               'clip' ( in 3-element array of 4-element array of float ClipDistance)
+0:11              Constant:
+0:11                2 (const int)
+0:11            Constant:
+0:11              0 (const int)
+0:11        move second child to first child ( temp float)
+0:11          direct index ( temp float)
+0:11            direct index ( temp 4-component vector of float)
+0:?               'clip' ( temp 3-element array of 4-component vector of float)
+0:11              Constant:
+0:11                2 (const int)
+0:11            Constant:
+0:11              1 (const int)
+0:11          direct index ( in float ClipDistance)
+0:11            direct index ( in 4-element array of float ClipDistance)
+0:?               'clip' ( in 3-element array of 4-element array of float ClipDistance)
+0:11              Constant:
+0:11                2 (const int)
+0:11            Constant:
+0:11              1 (const int)
+0:11        move second child to first child ( temp float)
+0:11          direct index ( temp float)
+0:11            direct index ( temp 4-component vector of float)
+0:?               'clip' ( temp 3-element array of 4-component vector of float)
+0:11              Constant:
+0:11                2 (const int)
+0:11            Constant:
+0:11              2 (const int)
+0:11          direct index ( in float ClipDistance)
+0:11            direct index ( in 4-element array of float ClipDistance)
+0:?               'clip' ( in 3-element array of 4-element array of float ClipDistance)
+0:11              Constant:
+0:11                2 (const int)
+0:11            Constant:
+0:11              2 (const int)
+0:11        move second child to first child ( temp float)
+0:11          direct index ( temp float)
+0:11            direct index ( temp 4-component vector of float)
+0:?               'clip' ( temp 3-element array of 4-component vector of float)
+0:11              Constant:
+0:11                2 (const int)
+0:11            Constant:
+0:11              3 (const int)
+0:11          direct index ( in float ClipDistance)
+0:11            direct index ( in 4-element array of float ClipDistance)
+0:?               'clip' ( in 3-element array of 4-element array of float ClipDistance)
+0:11              Constant:
+0:11                2 (const int)
+0:11            Constant:
+0:11              3 (const int)
+0:11      Function Call: @main(vf4[3];u1[3];struct-S-vf4-vf21;vf4[3]; ( temp void)
 0:?         'pos' ( temp 3-element array of 4-component vector of float)
 0:?         'VertexID' ( temp 3-element array of uint)
-0:?         'OutputStream' ( temp structure{ temp 4-component vector of float pos,  temp float clip,  temp float cull})
-0:?         'clip' ( temp 3-element array of float)
-0:?         'cull' ( temp 3-element array of float)
+0:?         'OutputStream' ( temp structure{ temp 4-component vector of float pos,  temp 2-component vector of float clip})
+0:?         'clip' ( temp 3-element array of 4-component vector of float)
 0:?   Linker Objects
 0:?     'pos' ( in 3-element array of 4-component vector of float Position)
 0:?     'VertexID' (layout( location=0) in 3-element array of uint)
 0:?     'OutputStream.pos' ( out 4-component vector of float Position)
+0:?     'clip' ( in 3-element array of 4-element array of float ClipDistance)
+0:?     'OutputStream.clip' ( out 2-element array of float ClipDistance)
+
+// Module Version 10000
+// Generated by (magic number): 80001
+// Id's are bound by 118
 
-SPIR-V is not generated for failed compile or link
+                              Capability Geometry
+                              Capability ClipDistance
+               1:             ExtInstImport  "GLSL.std.450"
+                              MemoryModel Logical GLSL450
+                              EntryPoint Geometry 4  "main" 38 44 57 61 68
+                              ExecutionMode 4 Triangles
+                              ExecutionMode 4 Invocations 1
+                              ExecutionMode 4 OutputLineStrip
+                              ExecutionMode 4 OutputVertices 3
+                              Source HLSL 500
+                              Name 4  "main"
+                              Name 15  "S"
+                              MemberName 15(S) 0  "pos"
+                              MemberName 15(S) 1  "clip"
+                              Name 22  "@main(vf4[3];u1[3];struct-S-vf4-vf21;vf4[3];"
+                              Name 18  "pos"
+                              Name 19  "VertexID"
+                              Name 20  "OutputStream"
+                              Name 21  "clip"
+                              Name 24  "s"
+                              Name 38  "OutputStream.pos"
+                              Name 44  "OutputStream.clip"
+                              Name 55  "pos"
+                              Name 57  "pos"
+                              Name 59  "VertexID"
+                              Name 61  "VertexID"
+                              Name 63  "clip"
+                              Name 68  "clip"
+                              Name 108  "OutputStream"
+                              Name 109  "param"
+                              Name 111  "param"
+                              Name 113  "param"
+                              Name 114  "param"
+                              Decorate 38(OutputStream.pos) BuiltIn Position
+                              Decorate 44(OutputStream.clip) BuiltIn ClipDistance
+                              Decorate 57(pos) BuiltIn Position
+                              Decorate 61(VertexID) Location 0
+                              Decorate 68(clip) BuiltIn ClipDistance
+               2:             TypeVoid
+               3:             TypeFunction 2
+               6:             TypeFloat 32
+               7:             TypeVector 6(float) 4
+               8:             TypeInt 32 0
+               9:      8(int) Constant 3
+              10:             TypeArray 7(fvec4) 9
+              11:             TypePointer Function 10
+              12:             TypeArray 8(int) 9
+              13:             TypePointer Function 12
+              14:             TypeVector 6(float) 2
+           15(S):             TypeStruct 7(fvec4) 14(fvec2)
+              16:             TypePointer Function 15(S)
+              17:             TypeFunction 2 11(ptr) 13(ptr) 16(ptr) 11(ptr)
+              25:             TypeInt 32 1
+              26:     25(int) Constant 0
+              27:             TypePointer Function 7(fvec4)
+              31:     25(int) Constant 1
+              35:             TypePointer Function 14(fvec2)
+              37:             TypePointer Output 7(fvec4)
+38(OutputStream.pos):     37(ptr) Variable Output
+              41:      8(int) Constant 2
+              42:             TypeArray 6(float) 41
+              43:             TypePointer Output 42
+44(OutputStream.clip):     43(ptr) Variable Output
+              45:      8(int) Constant 0
+              46:             TypePointer Function 6(float)
+              49:             TypePointer Output 6(float)
+              51:      8(int) Constant 1
+              56:             TypePointer Input 10
+         57(pos):     56(ptr) Variable Input
+              60:             TypePointer Input 12
+    61(VertexID):     60(ptr) Variable Input
+              64:      8(int) Constant 4
+              65:             TypeArray 6(float) 64
+              66:             TypeArray 65 9
+              67:             TypePointer Input 66
+        68(clip):     67(ptr) Variable Input
+              69:             TypePointer Input 6(float)
+              76:     25(int) Constant 2
+              80:     25(int) Constant 3
+         4(main):           2 Function None 3
+               5:             Label
+         55(pos):     11(ptr) Variable Function
+    59(VertexID):     13(ptr) Variable Function
+        63(clip):     11(ptr) Variable Function
+108(OutputStream):     16(ptr) Variable Function
+      109(param):     11(ptr) Variable Function
+      111(param):     13(ptr) Variable Function
+      113(param):     16(ptr) Variable Function
+      114(param):     11(ptr) Variable Function
+              58:          10 Load 57(pos)
+                              Store 55(pos) 58
+              62:          12 Load 61(VertexID)
+                              Store 59(VertexID) 62
+              70:     69(ptr) AccessChain 68(clip) 26 26
+              71:    6(float) Load 70
+              72:     46(ptr) AccessChain 63(clip) 26 45
+                              Store 72 71
+              73:     69(ptr) AccessChain 68(clip) 26 31
+              74:    6(float) Load 73
+              75:     46(ptr) AccessChain 63(clip) 26 51
+                              Store 75 74
+              77:     69(ptr) AccessChain 68(clip) 26 76
+              78:    6(float) Load 77
+              79:     46(ptr) AccessChain 63(clip) 26 41
+                              Store 79 78
+              81:     69(ptr) AccessChain 68(clip) 26 80
+              82:    6(float) Load 81
+              83:     46(ptr) AccessChain 63(clip) 26 9
+                              Store 83 82
+              84:     69(ptr) AccessChain 68(clip) 31 26
+              85:    6(float) Load 84
+              86:     46(ptr) AccessChain 63(clip) 31 45
+                              Store 86 85
+              87:     69(ptr) AccessChain 68(clip) 31 31
+              88:    6(float) Load 87
+              89:     46(ptr) AccessChain 63(clip) 31 51
+                              Store 89 88
+              90:     69(ptr) AccessChain 68(clip) 31 76
+              91:    6(float) Load 90
+              92:     46(ptr) AccessChain 63(clip) 31 41
+                              Store 92 91
+              93:     69(ptr) AccessChain 68(clip) 31 80
+              94:    6(float) Load 93
+              95:     46(ptr) AccessChain 63(clip) 31 9
+                              Store 95 94
+              96:     69(ptr) AccessChain 68(clip) 76 26
+              97:    6(float) Load 96
+              98:     46(ptr) AccessChain 63(clip) 76 45
+                              Store 98 97
+              99:     69(ptr) AccessChain 68(clip) 76 31
+             100:    6(float) Load 99
+             101:     46(ptr) AccessChain 63(clip) 76 51
+                              Store 101 100
+             102:     69(ptr) AccessChain 68(clip) 76 76
+             103:    6(float) Load 102
+             104:     46(ptr) AccessChain 63(clip) 76 41
+                              Store 104 103
+             105:     69(ptr) AccessChain 68(clip) 76 80
+             106:    6(float) Load 105
+             107:     46(ptr) AccessChain 63(clip) 76 9
+                              Store 107 106
+             110:          10 Load 55(pos)
+                              Store 109(param) 110
+             112:          12 Load 59(VertexID)
+                              Store 111(param) 112
+             115:          10 Load 63(clip)
+                              Store 114(param) 115
+             116:           2 FunctionCall 22(@main(vf4[3];u1[3];struct-S-vf4-vf21;vf4[3];) 109(param) 111(param) 113(param) 114(param)
+             117:       15(S) Load 113(param)
+                              Store 108(OutputStream) 117
+                              Return
+                              FunctionEnd
+22(@main(vf4[3];u1[3];struct-S-vf4-vf21;vf4[3];):           2 Function None 17
+         18(pos):     11(ptr) FunctionParameter
+    19(VertexID):     13(ptr) FunctionParameter
+20(OutputStream):     16(ptr) FunctionParameter
+        21(clip):     11(ptr) FunctionParameter
+              23:             Label
+           24(s):     16(ptr) Variable Function
+              28:     27(ptr) AccessChain 18(pos) 26
+              29:    7(fvec4) Load 28
+              30:     27(ptr) AccessChain 24(s) 26
+                              Store 30 29
+              32:     27(ptr) AccessChain 21(clip) 26
+              33:    7(fvec4) Load 32
+              34:   14(fvec2) VectorShuffle 33 33 0 1
+              36:     35(ptr) AccessChain 24(s) 31
+                              Store 36 34
+              39:     27(ptr) AccessChain 24(s) 26
+              40:    7(fvec4) Load 39
+                              Store 38(OutputStream.pos) 40
+              47:     46(ptr) AccessChain 24(s) 31 45
+              48:    6(float) Load 47
+              50:     49(ptr) AccessChain 44(OutputStream.clip) 26
+                              Store 50 48
+              52:     46(ptr) AccessChain 24(s) 31 51
+              53:    6(float) Load 52
+              54:     49(ptr) AccessChain 44(OutputStream.clip) 31
+                              Store 54 53
+                              EmitVertex
+                              Return
+                              FunctionEnd
diff --git a/Test/baseResults/hlsl.clipdistance-2.geom.out b/Test/baseResults/hlsl.clipdistance-2.geom.out
index a2b568af43a70732e7017ccb50d0943d245b6051..158cb2c860d0b1e149f67036fac8da50ebf7cae0 100644
--- a/Test/baseResults/hlsl.clipdistance-2.geom.out
+++ b/Test/baseResults/hlsl.clipdistance-2.geom.out
@@ -1,15 +1,10 @@
 hlsl.clipdistance-2.geom
-ERROR: 0:11: '' : unimplemented: clip/cull not currently implemented for this stage 
-ERROR: 0:18: '' : unimplemented: clip/cull not currently implemented for this stage 
-ERROR: 2 compilation errors.  No code generated.
-
-
 Shader version: 500
 invocations = -1
 max_vertices = 3
 input primitive = triangles
 output primitive = line_strip
-ERROR: node is still EOpNull!
+0:? Sequence
 0:11  Function Definition: @main(vf4[3];u1[3];struct-S-vf4-vf2[2]1;vf2[3][2]; ( temp void)
 0:11    Function Parameters: 
 0:11      'pos' ( in 3-element array of 4-component vector of float)
@@ -64,6 +59,67 @@ ERROR: node is still EOpNull!
 0:18              's' ( temp structure{ temp 4-component vector of float pos,  temp 2-element array of 2-component vector of float clip})
 0:18              Constant:
 0:18                0 (const int)
+0:?           Sequence
+0:18            move second child to first child ( temp float)
+0:18              direct index ( out float ClipDistance)
+0:?                 'OutputStream.clip' ( out 4-element array of float ClipDistance)
+0:18                Constant:
+0:18                  0 (const int)
+0:18              direct index ( temp float)
+0:18                direct index ( temp 2-component vector of float)
+0:18                  clip: direct index for structure ( temp 2-element array of 2-component vector of float)
+0:18                    's' ( temp structure{ temp 4-component vector of float pos,  temp 2-element array of 2-component vector of float clip})
+0:18                    Constant:
+0:18                      1 (const int)
+0:18                  Constant:
+0:18                    0 (const int)
+0:18                Constant:
+0:18                  0 (const int)
+0:18            move second child to first child ( temp float)
+0:18              direct index ( out float ClipDistance)
+0:?                 'OutputStream.clip' ( out 4-element array of float ClipDistance)
+0:18                Constant:
+0:18                  1 (const int)
+0:18              direct index ( temp float)
+0:18                direct index ( temp 2-component vector of float)
+0:18                  clip: direct index for structure ( temp 2-element array of 2-component vector of float)
+0:18                    's' ( temp structure{ temp 4-component vector of float pos,  temp 2-element array of 2-component vector of float clip})
+0:18                    Constant:
+0:18                      1 (const int)
+0:18                  Constant:
+0:18                    0 (const int)
+0:18                Constant:
+0:18                  1 (const int)
+0:18            move second child to first child ( temp float)
+0:18              direct index ( out float ClipDistance)
+0:?                 'OutputStream.clip' ( out 4-element array of float ClipDistance)
+0:18                Constant:
+0:18                  2 (const int)
+0:18              direct index ( temp float)
+0:18                direct index ( temp 2-component vector of float)
+0:18                  clip: direct index for structure ( temp 2-element array of 2-component vector of float)
+0:18                    's' ( temp structure{ temp 4-component vector of float pos,  temp 2-element array of 2-component vector of float clip})
+0:18                    Constant:
+0:18                      1 (const int)
+0:18                  Constant:
+0:18                    1 (const int)
+0:18                Constant:
+0:18                  0 (const int)
+0:18            move second child to first child ( temp float)
+0:18              direct index ( out float ClipDistance)
+0:?                 'OutputStream.clip' ( out 4-element array of float ClipDistance)
+0:18                Constant:
+0:18                  3 (const int)
+0:18              direct index ( temp float)
+0:18                direct index ( temp 2-component vector of float)
+0:18                  clip: direct index for structure ( temp 2-element array of 2-component vector of float)
+0:18                    's' ( temp structure{ temp 4-component vector of float pos,  temp 2-element array of 2-component vector of float clip})
+0:18                    Constant:
+0:18                      1 (const int)
+0:18                  Constant:
+0:18                    1 (const int)
+0:18                Constant:
+0:18                  1 (const int)
 0:18        EmitVertex ( temp void)
 0:11  Function Definition: main( ( temp void)
 0:11    Function Parameters: 
@@ -74,6 +130,223 @@ ERROR: node is still EOpNull!
 0:11      move second child to first child ( temp 3-element array of uint)
 0:?         'VertexID' ( temp 3-element array of uint)
 0:?         'VertexID' (layout( location=0) in 3-element array of uint)
+0:?       Sequence
+0:11        move second child to first child ( temp float)
+0:11          direct index ( temp float)
+0:11            direct index ( temp 2-component vector of float)
+0:11              direct index ( temp 2-element array of 2-component vector of float)
+0:?                 'clip' ( temp 3-element array of 2-element array of 2-component vector of float)
+0:11                Constant:
+0:11                  0 (const int)
+0:11              Constant:
+0:11                0 (const int)
+0:11            Constant:
+0:11              0 (const int)
+0:11          direct index ( in float ClipDistance)
+0:11            direct index ( in 4-element array of float ClipDistance)
+0:?               'clip' ( in 3-element array of 4-element array of float ClipDistance)
+0:11              Constant:
+0:11                0 (const int)
+0:11            Constant:
+0:11              0 (const int)
+0:11        move second child to first child ( temp float)
+0:11          direct index ( temp float)
+0:11            direct index ( temp 2-component vector of float)
+0:11              direct index ( temp 2-element array of 2-component vector of float)
+0:?                 'clip' ( temp 3-element array of 2-element array of 2-component vector of float)
+0:11                Constant:
+0:11                  0 (const int)
+0:11              Constant:
+0:11                0 (const int)
+0:11            Constant:
+0:11              1 (const int)
+0:11          direct index ( in float ClipDistance)
+0:11            direct index ( in 4-element array of float ClipDistance)
+0:?               'clip' ( in 3-element array of 4-element array of float ClipDistance)
+0:11              Constant:
+0:11                0 (const int)
+0:11            Constant:
+0:11              1 (const int)
+0:11        move second child to first child ( temp float)
+0:11          direct index ( temp float)
+0:11            direct index ( temp 2-component vector of float)
+0:11              direct index ( temp 2-element array of 2-component vector of float)
+0:?                 'clip' ( temp 3-element array of 2-element array of 2-component vector of float)
+0:11                Constant:
+0:11                  0 (const int)
+0:11              Constant:
+0:11                1 (const int)
+0:11            Constant:
+0:11              0 (const int)
+0:11          direct index ( in float ClipDistance)
+0:11            direct index ( in 4-element array of float ClipDistance)
+0:?               'clip' ( in 3-element array of 4-element array of float ClipDistance)
+0:11              Constant:
+0:11                0 (const int)
+0:11            Constant:
+0:11              2 (const int)
+0:11        move second child to first child ( temp float)
+0:11          direct index ( temp float)
+0:11            direct index ( temp 2-component vector of float)
+0:11              direct index ( temp 2-element array of 2-component vector of float)
+0:?                 'clip' ( temp 3-element array of 2-element array of 2-component vector of float)
+0:11                Constant:
+0:11                  0 (const int)
+0:11              Constant:
+0:11                1 (const int)
+0:11            Constant:
+0:11              1 (const int)
+0:11          direct index ( in float ClipDistance)
+0:11            direct index ( in 4-element array of float ClipDistance)
+0:?               'clip' ( in 3-element array of 4-element array of float ClipDistance)
+0:11              Constant:
+0:11                0 (const int)
+0:11            Constant:
+0:11              3 (const int)
+0:11        move second child to first child ( temp float)
+0:11          direct index ( temp float)
+0:11            direct index ( temp 2-component vector of float)
+0:11              direct index ( temp 2-element array of 2-component vector of float)
+0:?                 'clip' ( temp 3-element array of 2-element array of 2-component vector of float)
+0:11                Constant:
+0:11                  1 (const int)
+0:11              Constant:
+0:11                0 (const int)
+0:11            Constant:
+0:11              0 (const int)
+0:11          direct index ( in float ClipDistance)
+0:11            direct index ( in 4-element array of float ClipDistance)
+0:?               'clip' ( in 3-element array of 4-element array of float ClipDistance)
+0:11              Constant:
+0:11                1 (const int)
+0:11            Constant:
+0:11              0 (const int)
+0:11        move second child to first child ( temp float)
+0:11          direct index ( temp float)
+0:11            direct index ( temp 2-component vector of float)
+0:11              direct index ( temp 2-element array of 2-component vector of float)
+0:?                 'clip' ( temp 3-element array of 2-element array of 2-component vector of float)
+0:11                Constant:
+0:11                  1 (const int)
+0:11              Constant:
+0:11                0 (const int)
+0:11            Constant:
+0:11              1 (const int)
+0:11          direct index ( in float ClipDistance)
+0:11            direct index ( in 4-element array of float ClipDistance)
+0:?               'clip' ( in 3-element array of 4-element array of float ClipDistance)
+0:11              Constant:
+0:11                1 (const int)
+0:11            Constant:
+0:11              1 (const int)
+0:11        move second child to first child ( temp float)
+0:11          direct index ( temp float)
+0:11            direct index ( temp 2-component vector of float)
+0:11              direct index ( temp 2-element array of 2-component vector of float)
+0:?                 'clip' ( temp 3-element array of 2-element array of 2-component vector of float)
+0:11                Constant:
+0:11                  1 (const int)
+0:11              Constant:
+0:11                1 (const int)
+0:11            Constant:
+0:11              0 (const int)
+0:11          direct index ( in float ClipDistance)
+0:11            direct index ( in 4-element array of float ClipDistance)
+0:?               'clip' ( in 3-element array of 4-element array of float ClipDistance)
+0:11              Constant:
+0:11                1 (const int)
+0:11            Constant:
+0:11              2 (const int)
+0:11        move second child to first child ( temp float)
+0:11          direct index ( temp float)
+0:11            direct index ( temp 2-component vector of float)
+0:11              direct index ( temp 2-element array of 2-component vector of float)
+0:?                 'clip' ( temp 3-element array of 2-element array of 2-component vector of float)
+0:11                Constant:
+0:11                  1 (const int)
+0:11              Constant:
+0:11                1 (const int)
+0:11            Constant:
+0:11              1 (const int)
+0:11          direct index ( in float ClipDistance)
+0:11            direct index ( in 4-element array of float ClipDistance)
+0:?               'clip' ( in 3-element array of 4-element array of float ClipDistance)
+0:11              Constant:
+0:11                1 (const int)
+0:11            Constant:
+0:11              3 (const int)
+0:11        move second child to first child ( temp float)
+0:11          direct index ( temp float)
+0:11            direct index ( temp 2-component vector of float)
+0:11              direct index ( temp 2-element array of 2-component vector of float)
+0:?                 'clip' ( temp 3-element array of 2-element array of 2-component vector of float)
+0:11                Constant:
+0:11                  2 (const int)
+0:11              Constant:
+0:11                0 (const int)
+0:11            Constant:
+0:11              0 (const int)
+0:11          direct index ( in float ClipDistance)
+0:11            direct index ( in 4-element array of float ClipDistance)
+0:?               'clip' ( in 3-element array of 4-element array of float ClipDistance)
+0:11              Constant:
+0:11                2 (const int)
+0:11            Constant:
+0:11              0 (const int)
+0:11        move second child to first child ( temp float)
+0:11          direct index ( temp float)
+0:11            direct index ( temp 2-component vector of float)
+0:11              direct index ( temp 2-element array of 2-component vector of float)
+0:?                 'clip' ( temp 3-element array of 2-element array of 2-component vector of float)
+0:11                Constant:
+0:11                  2 (const int)
+0:11              Constant:
+0:11                0 (const int)
+0:11            Constant:
+0:11              1 (const int)
+0:11          direct index ( in float ClipDistance)
+0:11            direct index ( in 4-element array of float ClipDistance)
+0:?               'clip' ( in 3-element array of 4-element array of float ClipDistance)
+0:11              Constant:
+0:11                2 (const int)
+0:11            Constant:
+0:11              1 (const int)
+0:11        move second child to first child ( temp float)
+0:11          direct index ( temp float)
+0:11            direct index ( temp 2-component vector of float)
+0:11              direct index ( temp 2-element array of 2-component vector of float)
+0:?                 'clip' ( temp 3-element array of 2-element array of 2-component vector of float)
+0:11                Constant:
+0:11                  2 (const int)
+0:11              Constant:
+0:11                1 (const int)
+0:11            Constant:
+0:11              0 (const int)
+0:11          direct index ( in float ClipDistance)
+0:11            direct index ( in 4-element array of float ClipDistance)
+0:?               'clip' ( in 3-element array of 4-element array of float ClipDistance)
+0:11              Constant:
+0:11                2 (const int)
+0:11            Constant:
+0:11              2 (const int)
+0:11        move second child to first child ( temp float)
+0:11          direct index ( temp float)
+0:11            direct index ( temp 2-component vector of float)
+0:11              direct index ( temp 2-element array of 2-component vector of float)
+0:?                 'clip' ( temp 3-element array of 2-element array of 2-component vector of float)
+0:11                Constant:
+0:11                  2 (const int)
+0:11              Constant:
+0:11                1 (const int)
+0:11            Constant:
+0:11              1 (const int)
+0:11          direct index ( in float ClipDistance)
+0:11            direct index ( in 4-element array of float ClipDistance)
+0:?               'clip' ( in 3-element array of 4-element array of float ClipDistance)
+0:11              Constant:
+0:11                2 (const int)
+0:11            Constant:
+0:11              3 (const int)
 0:11      Function Call: @main(vf4[3];u1[3];struct-S-vf4-vf2[2]1;vf2[3][2]; ( temp void)
 0:?         'pos' ( temp 3-element array of 4-component vector of float)
 0:?         'VertexID' ( temp 3-element array of uint)
@@ -83,6 +356,8 @@ ERROR: node is still EOpNull!
 0:?     'pos' ( in 3-element array of 4-component vector of float Position)
 0:?     'VertexID' (layout( location=0) in 3-element array of uint)
 0:?     'OutputStream.pos' ( out 4-component vector of float Position)
+0:?     'clip' ( in 3-element array of 4-element array of float ClipDistance)
+0:?     'OutputStream.clip' ( out 4-element array of float ClipDistance)
 
 
 Linked geometry stage:
@@ -93,7 +368,7 @@ invocations = 1
 max_vertices = 3
 input primitive = triangles
 output primitive = line_strip
-ERROR: node is still EOpNull!
+0:? Sequence
 0:11  Function Definition: @main(vf4[3];u1[3];struct-S-vf4-vf2[2]1;vf2[3][2]; ( temp void)
 0:11    Function Parameters: 
 0:11      'pos' ( in 3-element array of 4-component vector of float)
@@ -148,6 +423,67 @@ ERROR: node is still EOpNull!
 0:18              's' ( temp structure{ temp 4-component vector of float pos,  temp 2-element array of 2-component vector of float clip})
 0:18              Constant:
 0:18                0 (const int)
+0:?           Sequence
+0:18            move second child to first child ( temp float)
+0:18              direct index ( out float ClipDistance)
+0:?                 'OutputStream.clip' ( out 4-element array of float ClipDistance)
+0:18                Constant:
+0:18                  0 (const int)
+0:18              direct index ( temp float)
+0:18                direct index ( temp 2-component vector of float)
+0:18                  clip: direct index for structure ( temp 2-element array of 2-component vector of float)
+0:18                    's' ( temp structure{ temp 4-component vector of float pos,  temp 2-element array of 2-component vector of float clip})
+0:18                    Constant:
+0:18                      1 (const int)
+0:18                  Constant:
+0:18                    0 (const int)
+0:18                Constant:
+0:18                  0 (const int)
+0:18            move second child to first child ( temp float)
+0:18              direct index ( out float ClipDistance)
+0:?                 'OutputStream.clip' ( out 4-element array of float ClipDistance)
+0:18                Constant:
+0:18                  1 (const int)
+0:18              direct index ( temp float)
+0:18                direct index ( temp 2-component vector of float)
+0:18                  clip: direct index for structure ( temp 2-element array of 2-component vector of float)
+0:18                    's' ( temp structure{ temp 4-component vector of float pos,  temp 2-element array of 2-component vector of float clip})
+0:18                    Constant:
+0:18                      1 (const int)
+0:18                  Constant:
+0:18                    0 (const int)
+0:18                Constant:
+0:18                  1 (const int)
+0:18            move second child to first child ( temp float)
+0:18              direct index ( out float ClipDistance)
+0:?                 'OutputStream.clip' ( out 4-element array of float ClipDistance)
+0:18                Constant:
+0:18                  2 (const int)
+0:18              direct index ( temp float)
+0:18                direct index ( temp 2-component vector of float)
+0:18                  clip: direct index for structure ( temp 2-element array of 2-component vector of float)
+0:18                    's' ( temp structure{ temp 4-component vector of float pos,  temp 2-element array of 2-component vector of float clip})
+0:18                    Constant:
+0:18                      1 (const int)
+0:18                  Constant:
+0:18                    1 (const int)
+0:18                Constant:
+0:18                  0 (const int)
+0:18            move second child to first child ( temp float)
+0:18              direct index ( out float ClipDistance)
+0:?                 'OutputStream.clip' ( out 4-element array of float ClipDistance)
+0:18                Constant:
+0:18                  3 (const int)
+0:18              direct index ( temp float)
+0:18                direct index ( temp 2-component vector of float)
+0:18                  clip: direct index for structure ( temp 2-element array of 2-component vector of float)
+0:18                    's' ( temp structure{ temp 4-component vector of float pos,  temp 2-element array of 2-component vector of float clip})
+0:18                    Constant:
+0:18                      1 (const int)
+0:18                  Constant:
+0:18                    1 (const int)
+0:18                Constant:
+0:18                  1 (const int)
 0:18        EmitVertex ( temp void)
 0:11  Function Definition: main( ( temp void)
 0:11    Function Parameters: 
@@ -158,6 +494,223 @@ ERROR: node is still EOpNull!
 0:11      move second child to first child ( temp 3-element array of uint)
 0:?         'VertexID' ( temp 3-element array of uint)
 0:?         'VertexID' (layout( location=0) in 3-element array of uint)
+0:?       Sequence
+0:11        move second child to first child ( temp float)
+0:11          direct index ( temp float)
+0:11            direct index ( temp 2-component vector of float)
+0:11              direct index ( temp 2-element array of 2-component vector of float)
+0:?                 'clip' ( temp 3-element array of 2-element array of 2-component vector of float)
+0:11                Constant:
+0:11                  0 (const int)
+0:11              Constant:
+0:11                0 (const int)
+0:11            Constant:
+0:11              0 (const int)
+0:11          direct index ( in float ClipDistance)
+0:11            direct index ( in 4-element array of float ClipDistance)
+0:?               'clip' ( in 3-element array of 4-element array of float ClipDistance)
+0:11              Constant:
+0:11                0 (const int)
+0:11            Constant:
+0:11              0 (const int)
+0:11        move second child to first child ( temp float)
+0:11          direct index ( temp float)
+0:11            direct index ( temp 2-component vector of float)
+0:11              direct index ( temp 2-element array of 2-component vector of float)
+0:?                 'clip' ( temp 3-element array of 2-element array of 2-component vector of float)
+0:11                Constant:
+0:11                  0 (const int)
+0:11              Constant:
+0:11                0 (const int)
+0:11            Constant:
+0:11              1 (const int)
+0:11          direct index ( in float ClipDistance)
+0:11            direct index ( in 4-element array of float ClipDistance)
+0:?               'clip' ( in 3-element array of 4-element array of float ClipDistance)
+0:11              Constant:
+0:11                0 (const int)
+0:11            Constant:
+0:11              1 (const int)
+0:11        move second child to first child ( temp float)
+0:11          direct index ( temp float)
+0:11            direct index ( temp 2-component vector of float)
+0:11              direct index ( temp 2-element array of 2-component vector of float)
+0:?                 'clip' ( temp 3-element array of 2-element array of 2-component vector of float)
+0:11                Constant:
+0:11                  0 (const int)
+0:11              Constant:
+0:11                1 (const int)
+0:11            Constant:
+0:11              0 (const int)
+0:11          direct index ( in float ClipDistance)
+0:11            direct index ( in 4-element array of float ClipDistance)
+0:?               'clip' ( in 3-element array of 4-element array of float ClipDistance)
+0:11              Constant:
+0:11                0 (const int)
+0:11            Constant:
+0:11              2 (const int)
+0:11        move second child to first child ( temp float)
+0:11          direct index ( temp float)
+0:11            direct index ( temp 2-component vector of float)
+0:11              direct index ( temp 2-element array of 2-component vector of float)
+0:?                 'clip' ( temp 3-element array of 2-element array of 2-component vector of float)
+0:11                Constant:
+0:11                  0 (const int)
+0:11              Constant:
+0:11                1 (const int)
+0:11            Constant:
+0:11              1 (const int)
+0:11          direct index ( in float ClipDistance)
+0:11            direct index ( in 4-element array of float ClipDistance)
+0:?               'clip' ( in 3-element array of 4-element array of float ClipDistance)
+0:11              Constant:
+0:11                0 (const int)
+0:11            Constant:
+0:11              3 (const int)
+0:11        move second child to first child ( temp float)
+0:11          direct index ( temp float)
+0:11            direct index ( temp 2-component vector of float)
+0:11              direct index ( temp 2-element array of 2-component vector of float)
+0:?                 'clip' ( temp 3-element array of 2-element array of 2-component vector of float)
+0:11                Constant:
+0:11                  1 (const int)
+0:11              Constant:
+0:11                0 (const int)
+0:11            Constant:
+0:11              0 (const int)
+0:11          direct index ( in float ClipDistance)
+0:11            direct index ( in 4-element array of float ClipDistance)
+0:?               'clip' ( in 3-element array of 4-element array of float ClipDistance)
+0:11              Constant:
+0:11                1 (const int)
+0:11            Constant:
+0:11              0 (const int)
+0:11        move second child to first child ( temp float)
+0:11          direct index ( temp float)
+0:11            direct index ( temp 2-component vector of float)
+0:11              direct index ( temp 2-element array of 2-component vector of float)
+0:?                 'clip' ( temp 3-element array of 2-element array of 2-component vector of float)
+0:11                Constant:
+0:11                  1 (const int)
+0:11              Constant:
+0:11                0 (const int)
+0:11            Constant:
+0:11              1 (const int)
+0:11          direct index ( in float ClipDistance)
+0:11            direct index ( in 4-element array of float ClipDistance)
+0:?               'clip' ( in 3-element array of 4-element array of float ClipDistance)
+0:11              Constant:
+0:11                1 (const int)
+0:11            Constant:
+0:11              1 (const int)
+0:11        move second child to first child ( temp float)
+0:11          direct index ( temp float)
+0:11            direct index ( temp 2-component vector of float)
+0:11              direct index ( temp 2-element array of 2-component vector of float)
+0:?                 'clip' ( temp 3-element array of 2-element array of 2-component vector of float)
+0:11                Constant:
+0:11                  1 (const int)
+0:11              Constant:
+0:11                1 (const int)
+0:11            Constant:
+0:11              0 (const int)
+0:11          direct index ( in float ClipDistance)
+0:11            direct index ( in 4-element array of float ClipDistance)
+0:?               'clip' ( in 3-element array of 4-element array of float ClipDistance)
+0:11              Constant:
+0:11                1 (const int)
+0:11            Constant:
+0:11              2 (const int)
+0:11        move second child to first child ( temp float)
+0:11          direct index ( temp float)
+0:11            direct index ( temp 2-component vector of float)
+0:11              direct index ( temp 2-element array of 2-component vector of float)
+0:?                 'clip' ( temp 3-element array of 2-element array of 2-component vector of float)
+0:11                Constant:
+0:11                  1 (const int)
+0:11              Constant:
+0:11                1 (const int)
+0:11            Constant:
+0:11              1 (const int)
+0:11          direct index ( in float ClipDistance)
+0:11            direct index ( in 4-element array of float ClipDistance)
+0:?               'clip' ( in 3-element array of 4-element array of float ClipDistance)
+0:11              Constant:
+0:11                1 (const int)
+0:11            Constant:
+0:11              3 (const int)
+0:11        move second child to first child ( temp float)
+0:11          direct index ( temp float)
+0:11            direct index ( temp 2-component vector of float)
+0:11              direct index ( temp 2-element array of 2-component vector of float)
+0:?                 'clip' ( temp 3-element array of 2-element array of 2-component vector of float)
+0:11                Constant:
+0:11                  2 (const int)
+0:11              Constant:
+0:11                0 (const int)
+0:11            Constant:
+0:11              0 (const int)
+0:11          direct index ( in float ClipDistance)
+0:11            direct index ( in 4-element array of float ClipDistance)
+0:?               'clip' ( in 3-element array of 4-element array of float ClipDistance)
+0:11              Constant:
+0:11                2 (const int)
+0:11            Constant:
+0:11              0 (const int)
+0:11        move second child to first child ( temp float)
+0:11          direct index ( temp float)
+0:11            direct index ( temp 2-component vector of float)
+0:11              direct index ( temp 2-element array of 2-component vector of float)
+0:?                 'clip' ( temp 3-element array of 2-element array of 2-component vector of float)
+0:11                Constant:
+0:11                  2 (const int)
+0:11              Constant:
+0:11                0 (const int)
+0:11            Constant:
+0:11              1 (const int)
+0:11          direct index ( in float ClipDistance)
+0:11            direct index ( in 4-element array of float ClipDistance)
+0:?               'clip' ( in 3-element array of 4-element array of float ClipDistance)
+0:11              Constant:
+0:11                2 (const int)
+0:11            Constant:
+0:11              1 (const int)
+0:11        move second child to first child ( temp float)
+0:11          direct index ( temp float)
+0:11            direct index ( temp 2-component vector of float)
+0:11              direct index ( temp 2-element array of 2-component vector of float)
+0:?                 'clip' ( temp 3-element array of 2-element array of 2-component vector of float)
+0:11                Constant:
+0:11                  2 (const int)
+0:11              Constant:
+0:11                1 (const int)
+0:11            Constant:
+0:11              0 (const int)
+0:11          direct index ( in float ClipDistance)
+0:11            direct index ( in 4-element array of float ClipDistance)
+0:?               'clip' ( in 3-element array of 4-element array of float ClipDistance)
+0:11              Constant:
+0:11                2 (const int)
+0:11            Constant:
+0:11              2 (const int)
+0:11        move second child to first child ( temp float)
+0:11          direct index ( temp float)
+0:11            direct index ( temp 2-component vector of float)
+0:11              direct index ( temp 2-element array of 2-component vector of float)
+0:?                 'clip' ( temp 3-element array of 2-element array of 2-component vector of float)
+0:11                Constant:
+0:11                  2 (const int)
+0:11              Constant:
+0:11                1 (const int)
+0:11            Constant:
+0:11              1 (const int)
+0:11          direct index ( in float ClipDistance)
+0:11            direct index ( in 4-element array of float ClipDistance)
+0:?               'clip' ( in 3-element array of 4-element array of float ClipDistance)
+0:11              Constant:
+0:11                2 (const int)
+0:11            Constant:
+0:11              3 (const int)
 0:11      Function Call: @main(vf4[3];u1[3];struct-S-vf4-vf2[2]1;vf2[3][2]; ( temp void)
 0:?         'pos' ( temp 3-element array of 4-component vector of float)
 0:?         'VertexID' ( temp 3-element array of uint)
@@ -167,5 +720,205 @@ ERROR: node is still EOpNull!
 0:?     'pos' ( in 3-element array of 4-component vector of float Position)
 0:?     'VertexID' (layout( location=0) in 3-element array of uint)
 0:?     'OutputStream.pos' ( out 4-component vector of float Position)
+0:?     'clip' ( in 3-element array of 4-element array of float ClipDistance)
+0:?     'OutputStream.clip' ( out 4-element array of float ClipDistance)
+
+// Module Version 10000
+// Generated by (magic number): 80001
+// Id's are bound by 128
 
-SPIR-V is not generated for failed compile or link
+                              Capability Geometry
+                              Capability ClipDistance
+               1:             ExtInstImport  "GLSL.std.450"
+                              MemoryModel Logical GLSL450
+                              EntryPoint Geometry 4  "main" 44 50 71 75 80
+                              ExecutionMode 4 Triangles
+                              ExecutionMode 4 Invocations 1
+                              ExecutionMode 4 OutputLineStrip
+                              ExecutionMode 4 OutputVertices 3
+                              Source HLSL 500
+                              Name 4  "main"
+                              Name 17  "S"
+                              MemberName 17(S) 0  "pos"
+                              MemberName 17(S) 1  "clip"
+                              Name 26  "@main(vf4[3];u1[3];struct-S-vf4-vf2[2]1;vf2[3][2];"
+                              Name 22  "pos"
+                              Name 23  "VertexID"
+                              Name 24  "OutputStream"
+                              Name 25  "clip"
+                              Name 28  "s"
+                              Name 44  "OutputStream.pos"
+                              Name 50  "OutputStream.clip"
+                              Name 69  "pos"
+                              Name 71  "pos"
+                              Name 73  "VertexID"
+                              Name 75  "VertexID"
+                              Name 77  "clip"
+                              Name 80  "clip"
+                              Name 118  "OutputStream"
+                              Name 119  "param"
+                              Name 121  "param"
+                              Name 123  "param"
+                              Name 124  "param"
+                              Decorate 44(OutputStream.pos) BuiltIn Position
+                              Decorate 50(OutputStream.clip) BuiltIn ClipDistance
+                              Decorate 71(pos) BuiltIn Position
+                              Decorate 75(VertexID) Location 0
+                              Decorate 80(clip) BuiltIn ClipDistance
+               2:             TypeVoid
+               3:             TypeFunction 2
+               6:             TypeFloat 32
+               7:             TypeVector 6(float) 4
+               8:             TypeInt 32 0
+               9:      8(int) Constant 3
+              10:             TypeArray 7(fvec4) 9
+              11:             TypePointer Function 10
+              12:             TypeArray 8(int) 9
+              13:             TypePointer Function 12
+              14:             TypeVector 6(float) 2
+              15:      8(int) Constant 2
+              16:             TypeArray 14(fvec2) 15
+           17(S):             TypeStruct 7(fvec4) 16
+              18:             TypePointer Function 17(S)
+              19:             TypeArray 16 9
+              20:             TypePointer Function 19
+              21:             TypeFunction 2 11(ptr) 13(ptr) 18(ptr) 20(ptr)
+              29:             TypeInt 32 1
+              30:     29(int) Constant 0
+              31:             TypePointer Function 7(fvec4)
+              35:     29(int) Constant 1
+              36:             TypePointer Function 14(fvec2)
+              43:             TypePointer Output 7(fvec4)
+44(OutputStream.pos):     43(ptr) Variable Output
+              47:      8(int) Constant 4
+              48:             TypeArray 6(float) 47
+              49:             TypePointer Output 48
+50(OutputStream.clip):     49(ptr) Variable Output
+              51:      8(int) Constant 0
+              52:             TypePointer Function 6(float)
+              55:             TypePointer Output 6(float)
+              57:      8(int) Constant 1
+              61:     29(int) Constant 2
+              65:     29(int) Constant 3
+              70:             TypePointer Input 10
+         71(pos):     70(ptr) Variable Input
+              74:             TypePointer Input 12
+    75(VertexID):     74(ptr) Variable Input
+              78:             TypeArray 48 9
+              79:             TypePointer Input 78
+        80(clip):     79(ptr) Variable Input
+              81:             TypePointer Input 6(float)
+         4(main):           2 Function None 3
+               5:             Label
+         69(pos):     11(ptr) Variable Function
+    73(VertexID):     13(ptr) Variable Function
+        77(clip):     20(ptr) Variable Function
+118(OutputStream):     18(ptr) Variable Function
+      119(param):     11(ptr) Variable Function
+      121(param):     13(ptr) Variable Function
+      123(param):     18(ptr) Variable Function
+      124(param):     20(ptr) Variable Function
+              72:          10 Load 71(pos)
+                              Store 69(pos) 72
+              76:          12 Load 75(VertexID)
+                              Store 73(VertexID) 76
+              82:     81(ptr) AccessChain 80(clip) 30 30
+              83:    6(float) Load 82
+              84:     52(ptr) AccessChain 77(clip) 30 30 51
+                              Store 84 83
+              85:     81(ptr) AccessChain 80(clip) 30 35
+              86:    6(float) Load 85
+              87:     52(ptr) AccessChain 77(clip) 30 30 57
+                              Store 87 86
+              88:     81(ptr) AccessChain 80(clip) 30 61
+              89:    6(float) Load 88
+              90:     52(ptr) AccessChain 77(clip) 30 35 51
+                              Store 90 89
+              91:     81(ptr) AccessChain 80(clip) 30 65
+              92:    6(float) Load 91
+              93:     52(ptr) AccessChain 77(clip) 30 35 57
+                              Store 93 92
+              94:     81(ptr) AccessChain 80(clip) 35 30
+              95:    6(float) Load 94
+              96:     52(ptr) AccessChain 77(clip) 35 30 51
+                              Store 96 95
+              97:     81(ptr) AccessChain 80(clip) 35 35
+              98:    6(float) Load 97
+              99:     52(ptr) AccessChain 77(clip) 35 30 57
+                              Store 99 98
+             100:     81(ptr) AccessChain 80(clip) 35 61
+             101:    6(float) Load 100
+             102:     52(ptr) AccessChain 77(clip) 35 35 51
+                              Store 102 101
+             103:     81(ptr) AccessChain 80(clip) 35 65
+             104:    6(float) Load 103
+             105:     52(ptr) AccessChain 77(clip) 35 35 57
+                              Store 105 104
+             106:     81(ptr) AccessChain 80(clip) 61 30
+             107:    6(float) Load 106
+             108:     52(ptr) AccessChain 77(clip) 61 30 51
+                              Store 108 107
+             109:     81(ptr) AccessChain 80(clip) 61 35
+             110:    6(float) Load 109
+             111:     52(ptr) AccessChain 77(clip) 61 30 57
+                              Store 111 110
+             112:     81(ptr) AccessChain 80(clip) 61 61
+             113:    6(float) Load 112
+             114:     52(ptr) AccessChain 77(clip) 61 35 51
+                              Store 114 113
+             115:     81(ptr) AccessChain 80(clip) 61 65
+             116:    6(float) Load 115
+             117:     52(ptr) AccessChain 77(clip) 61 35 57
+                              Store 117 116
+             120:          10 Load 69(pos)
+                              Store 119(param) 120
+             122:          12 Load 73(VertexID)
+                              Store 121(param) 122
+             125:          19 Load 77(clip)
+                              Store 124(param) 125
+             126:           2 FunctionCall 26(@main(vf4[3];u1[3];struct-S-vf4-vf2[2]1;vf2[3][2];) 119(param) 121(param) 123(param) 124(param)
+             127:       17(S) Load 123(param)
+                              Store 118(OutputStream) 127
+                              Return
+                              FunctionEnd
+26(@main(vf4[3];u1[3];struct-S-vf4-vf2[2]1;vf2[3][2];):           2 Function None 21
+         22(pos):     11(ptr) FunctionParameter
+    23(VertexID):     13(ptr) FunctionParameter
+24(OutputStream):     18(ptr) FunctionParameter
+        25(clip):     20(ptr) FunctionParameter
+              27:             Label
+           28(s):     18(ptr) Variable Function
+              32:     31(ptr) AccessChain 22(pos) 30
+              33:    7(fvec4) Load 32
+              34:     31(ptr) AccessChain 28(s) 30
+                              Store 34 33
+              37:     36(ptr) AccessChain 25(clip) 30 30
+              38:   14(fvec2) Load 37
+              39:     36(ptr) AccessChain 28(s) 35 30
+                              Store 39 38
+              40:     36(ptr) AccessChain 25(clip) 30 35
+              41:   14(fvec2) Load 40
+              42:     36(ptr) AccessChain 28(s) 35 35
+                              Store 42 41
+              45:     31(ptr) AccessChain 28(s) 30
+              46:    7(fvec4) Load 45
+                              Store 44(OutputStream.pos) 46
+              53:     52(ptr) AccessChain 28(s) 35 30 51
+              54:    6(float) Load 53
+              56:     55(ptr) AccessChain 50(OutputStream.clip) 30
+                              Store 56 54
+              58:     52(ptr) AccessChain 28(s) 35 30 57
+              59:    6(float) Load 58
+              60:     55(ptr) AccessChain 50(OutputStream.clip) 35
+                              Store 60 59
+              62:     52(ptr) AccessChain 28(s) 35 35 51
+              63:    6(float) Load 62
+              64:     55(ptr) AccessChain 50(OutputStream.clip) 61
+                              Store 64 63
+              66:     52(ptr) AccessChain 28(s) 35 35 57
+              67:    6(float) Load 66
+              68:     55(ptr) AccessChain 50(OutputStream.clip) 65
+                              Store 68 67
+                              EmitVertex
+                              Return
+                              FunctionEnd
diff --git a/Test/baseResults/hlsl.clipdistance-3.geom.out b/Test/baseResults/hlsl.clipdistance-3.geom.out
new file mode 100644
index 0000000000000000000000000000000000000000..d48c73ac0ad5ed68536b68558436d9099c24e045
--- /dev/null
+++ b/Test/baseResults/hlsl.clipdistance-3.geom.out
@@ -0,0 +1,830 @@
+hlsl.clipdistance-3.geom
+Shader version: 500
+invocations = -1
+max_vertices = 3
+input primitive = triangles
+output primitive = line_strip
+0:? Sequence
+0:12  Function Definition: @main(vf4[3];u1[3];struct-S-vf4-vf2-vf21;vf4[3]; ( temp void)
+0:12    Function Parameters: 
+0:12      'pos' ( in 3-element array of 4-component vector of float)
+0:12      'VertexID' ( in 3-element array of uint)
+0:12      'OutputStream' ( out structure{ temp 4-component vector of float pos,  temp 2-component vector of float clip0,  temp 2-component vector of float clip1})
+0:12      'clip' ( in 3-element array of 4-component vector of float)
+0:?     Sequence
+0:15      move second child to first child ( temp 4-component vector of float)
+0:15        pos: direct index for structure ( temp 4-component vector of float)
+0:15          's' ( temp structure{ temp 4-component vector of float pos,  temp 2-component vector of float clip0,  temp 2-component vector of float clip1})
+0:15          Constant:
+0:15            0 (const int)
+0:15        direct index ( temp 4-component vector of float)
+0:15          'pos' ( in 3-element array of 4-component vector of float)
+0:15          Constant:
+0:15            0 (const int)
+0:16      move second child to first child ( temp 2-component vector of float)
+0:16        clip0: direct index for structure ( temp 2-component vector of float)
+0:16          's' ( temp structure{ temp 4-component vector of float pos,  temp 2-component vector of float clip0,  temp 2-component vector of float clip1})
+0:16          Constant:
+0:16            1 (const int)
+0:16        vector swizzle ( temp 2-component vector of float)
+0:16          direct index ( temp 4-component vector of float)
+0:16            'clip' ( in 3-element array of 4-component vector of float)
+0:16            Constant:
+0:16              0 (const int)
+0:16          Sequence
+0:16            Constant:
+0:16              0 (const int)
+0:16            Constant:
+0:16              1 (const int)
+0:17      move second child to first child ( temp 2-component vector of float)
+0:17        clip1: direct index for structure ( temp 2-component vector of float)
+0:17          's' ( temp structure{ temp 4-component vector of float pos,  temp 2-component vector of float clip0,  temp 2-component vector of float clip1})
+0:17          Constant:
+0:17            2 (const int)
+0:17        vector swizzle ( temp 2-component vector of float)
+0:17          direct index ( temp 4-component vector of float)
+0:17            'clip' ( in 3-element array of 4-component vector of float)
+0:17            Constant:
+0:17              0 (const int)
+0:17          Sequence
+0:17            Constant:
+0:17              2 (const int)
+0:17            Constant:
+0:17              3 (const int)
+0:19      Sequence
+0:19        Sequence
+0:19          move second child to first child ( temp 4-component vector of float)
+0:?             'OutputStream.pos' ( out 4-component vector of float Position)
+0:19            pos: direct index for structure ( temp 4-component vector of float)
+0:19              's' ( temp structure{ temp 4-component vector of float pos,  temp 2-component vector of float clip0,  temp 2-component vector of float clip1})
+0:19              Constant:
+0:19                0 (const int)
+0:?           Sequence
+0:19            move second child to first child ( temp float)
+0:19              direct index ( out float ClipDistance)
+0:?                 'OutputStream.clip1' ( out 4-element array of float ClipDistance)
+0:19                Constant:
+0:19                  0 (const int)
+0:19              direct index ( temp float)
+0:19                clip0: direct index for structure ( temp 2-component vector of float)
+0:19                  's' ( temp structure{ temp 4-component vector of float pos,  temp 2-component vector of float clip0,  temp 2-component vector of float clip1})
+0:19                  Constant:
+0:19                    1 (const int)
+0:19                Constant:
+0:19                  0 (const int)
+0:19            move second child to first child ( temp float)
+0:19              direct index ( out float ClipDistance)
+0:?                 'OutputStream.clip1' ( out 4-element array of float ClipDistance)
+0:19                Constant:
+0:19                  1 (const int)
+0:19              direct index ( temp float)
+0:19                clip0: direct index for structure ( temp 2-component vector of float)
+0:19                  's' ( temp structure{ temp 4-component vector of float pos,  temp 2-component vector of float clip0,  temp 2-component vector of float clip1})
+0:19                  Constant:
+0:19                    1 (const int)
+0:19                Constant:
+0:19                  1 (const int)
+0:?           Sequence
+0:19            move second child to first child ( temp float)
+0:19              direct index ( out float ClipDistance)
+0:?                 'OutputStream.clip1' ( out 4-element array of float ClipDistance)
+0:19                Constant:
+0:19                  2 (const int)
+0:19              direct index ( temp float)
+0:19                clip1: direct index for structure ( temp 2-component vector of float)
+0:19                  's' ( temp structure{ temp 4-component vector of float pos,  temp 2-component vector of float clip0,  temp 2-component vector of float clip1})
+0:19                  Constant:
+0:19                    2 (const int)
+0:19                Constant:
+0:19                  0 (const int)
+0:19            move second child to first child ( temp float)
+0:19              direct index ( out float ClipDistance)
+0:?                 'OutputStream.clip1' ( out 4-element array of float ClipDistance)
+0:19                Constant:
+0:19                  3 (const int)
+0:19              direct index ( temp float)
+0:19                clip1: direct index for structure ( temp 2-component vector of float)
+0:19                  's' ( temp structure{ temp 4-component vector of float pos,  temp 2-component vector of float clip0,  temp 2-component vector of float clip1})
+0:19                  Constant:
+0:19                    2 (const int)
+0:19                Constant:
+0:19                  1 (const int)
+0:19        EmitVertex ( temp void)
+0:12  Function Definition: main( ( temp void)
+0:12    Function Parameters: 
+0:?     Sequence
+0:12      move second child to first child ( temp 3-element array of 4-component vector of float)
+0:?         'pos' ( temp 3-element array of 4-component vector of float)
+0:?         'pos' ( in 3-element array of 4-component vector of float Position)
+0:12      move second child to first child ( temp 3-element array of uint)
+0:?         'VertexID' ( temp 3-element array of uint)
+0:?         'VertexID' (layout( location=0) in 3-element array of uint)
+0:?       Sequence
+0:12        move second child to first child ( temp float)
+0:12          direct index ( temp float)
+0:12            direct index ( temp 4-component vector of float)
+0:?               'clip' ( temp 3-element array of 4-component vector of float)
+0:12              Constant:
+0:12                0 (const int)
+0:12            Constant:
+0:12              0 (const int)
+0:12          direct index ( in float ClipDistance)
+0:12            direct index ( in 4-element array of float ClipDistance)
+0:?               'clip' ( in 3-element array of 4-element array of float ClipDistance)
+0:12              Constant:
+0:12                0 (const int)
+0:12            Constant:
+0:12              0 (const int)
+0:12        move second child to first child ( temp float)
+0:12          direct index ( temp float)
+0:12            direct index ( temp 4-component vector of float)
+0:?               'clip' ( temp 3-element array of 4-component vector of float)
+0:12              Constant:
+0:12                0 (const int)
+0:12            Constant:
+0:12              1 (const int)
+0:12          direct index ( in float ClipDistance)
+0:12            direct index ( in 4-element array of float ClipDistance)
+0:?               'clip' ( in 3-element array of 4-element array of float ClipDistance)
+0:12              Constant:
+0:12                0 (const int)
+0:12            Constant:
+0:12              1 (const int)
+0:12        move second child to first child ( temp float)
+0:12          direct index ( temp float)
+0:12            direct index ( temp 4-component vector of float)
+0:?               'clip' ( temp 3-element array of 4-component vector of float)
+0:12              Constant:
+0:12                0 (const int)
+0:12            Constant:
+0:12              2 (const int)
+0:12          direct index ( in float ClipDistance)
+0:12            direct index ( in 4-element array of float ClipDistance)
+0:?               'clip' ( in 3-element array of 4-element array of float ClipDistance)
+0:12              Constant:
+0:12                0 (const int)
+0:12            Constant:
+0:12              2 (const int)
+0:12        move second child to first child ( temp float)
+0:12          direct index ( temp float)
+0:12            direct index ( temp 4-component vector of float)
+0:?               'clip' ( temp 3-element array of 4-component vector of float)
+0:12              Constant:
+0:12                0 (const int)
+0:12            Constant:
+0:12              3 (const int)
+0:12          direct index ( in float ClipDistance)
+0:12            direct index ( in 4-element array of float ClipDistance)
+0:?               'clip' ( in 3-element array of 4-element array of float ClipDistance)
+0:12              Constant:
+0:12                0 (const int)
+0:12            Constant:
+0:12              3 (const int)
+0:12        move second child to first child ( temp float)
+0:12          direct index ( temp float)
+0:12            direct index ( temp 4-component vector of float)
+0:?               'clip' ( temp 3-element array of 4-component vector of float)
+0:12              Constant:
+0:12                1 (const int)
+0:12            Constant:
+0:12              0 (const int)
+0:12          direct index ( in float ClipDistance)
+0:12            direct index ( in 4-element array of float ClipDistance)
+0:?               'clip' ( in 3-element array of 4-element array of float ClipDistance)
+0:12              Constant:
+0:12                1 (const int)
+0:12            Constant:
+0:12              0 (const int)
+0:12        move second child to first child ( temp float)
+0:12          direct index ( temp float)
+0:12            direct index ( temp 4-component vector of float)
+0:?               'clip' ( temp 3-element array of 4-component vector of float)
+0:12              Constant:
+0:12                1 (const int)
+0:12            Constant:
+0:12              1 (const int)
+0:12          direct index ( in float ClipDistance)
+0:12            direct index ( in 4-element array of float ClipDistance)
+0:?               'clip' ( in 3-element array of 4-element array of float ClipDistance)
+0:12              Constant:
+0:12                1 (const int)
+0:12            Constant:
+0:12              1 (const int)
+0:12        move second child to first child ( temp float)
+0:12          direct index ( temp float)
+0:12            direct index ( temp 4-component vector of float)
+0:?               'clip' ( temp 3-element array of 4-component vector of float)
+0:12              Constant:
+0:12                1 (const int)
+0:12            Constant:
+0:12              2 (const int)
+0:12          direct index ( in float ClipDistance)
+0:12            direct index ( in 4-element array of float ClipDistance)
+0:?               'clip' ( in 3-element array of 4-element array of float ClipDistance)
+0:12              Constant:
+0:12                1 (const int)
+0:12            Constant:
+0:12              2 (const int)
+0:12        move second child to first child ( temp float)
+0:12          direct index ( temp float)
+0:12            direct index ( temp 4-component vector of float)
+0:?               'clip' ( temp 3-element array of 4-component vector of float)
+0:12              Constant:
+0:12                1 (const int)
+0:12            Constant:
+0:12              3 (const int)
+0:12          direct index ( in float ClipDistance)
+0:12            direct index ( in 4-element array of float ClipDistance)
+0:?               'clip' ( in 3-element array of 4-element array of float ClipDistance)
+0:12              Constant:
+0:12                1 (const int)
+0:12            Constant:
+0:12              3 (const int)
+0:12        move second child to first child ( temp float)
+0:12          direct index ( temp float)
+0:12            direct index ( temp 4-component vector of float)
+0:?               'clip' ( temp 3-element array of 4-component vector of float)
+0:12              Constant:
+0:12                2 (const int)
+0:12            Constant:
+0:12              0 (const int)
+0:12          direct index ( in float ClipDistance)
+0:12            direct index ( in 4-element array of float ClipDistance)
+0:?               'clip' ( in 3-element array of 4-element array of float ClipDistance)
+0:12              Constant:
+0:12                2 (const int)
+0:12            Constant:
+0:12              0 (const int)
+0:12        move second child to first child ( temp float)
+0:12          direct index ( temp float)
+0:12            direct index ( temp 4-component vector of float)
+0:?               'clip' ( temp 3-element array of 4-component vector of float)
+0:12              Constant:
+0:12                2 (const int)
+0:12            Constant:
+0:12              1 (const int)
+0:12          direct index ( in float ClipDistance)
+0:12            direct index ( in 4-element array of float ClipDistance)
+0:?               'clip' ( in 3-element array of 4-element array of float ClipDistance)
+0:12              Constant:
+0:12                2 (const int)
+0:12            Constant:
+0:12              1 (const int)
+0:12        move second child to first child ( temp float)
+0:12          direct index ( temp float)
+0:12            direct index ( temp 4-component vector of float)
+0:?               'clip' ( temp 3-element array of 4-component vector of float)
+0:12              Constant:
+0:12                2 (const int)
+0:12            Constant:
+0:12              2 (const int)
+0:12          direct index ( in float ClipDistance)
+0:12            direct index ( in 4-element array of float ClipDistance)
+0:?               'clip' ( in 3-element array of 4-element array of float ClipDistance)
+0:12              Constant:
+0:12                2 (const int)
+0:12            Constant:
+0:12              2 (const int)
+0:12        move second child to first child ( temp float)
+0:12          direct index ( temp float)
+0:12            direct index ( temp 4-component vector of float)
+0:?               'clip' ( temp 3-element array of 4-component vector of float)
+0:12              Constant:
+0:12                2 (const int)
+0:12            Constant:
+0:12              3 (const int)
+0:12          direct index ( in float ClipDistance)
+0:12            direct index ( in 4-element array of float ClipDistance)
+0:?               'clip' ( in 3-element array of 4-element array of float ClipDistance)
+0:12              Constant:
+0:12                2 (const int)
+0:12            Constant:
+0:12              3 (const int)
+0:12      Function Call: @main(vf4[3];u1[3];struct-S-vf4-vf2-vf21;vf4[3]; ( temp void)
+0:?         'pos' ( temp 3-element array of 4-component vector of float)
+0:?         'VertexID' ( temp 3-element array of uint)
+0:?         'OutputStream' ( temp structure{ temp 4-component vector of float pos,  temp 2-component vector of float clip0,  temp 2-component vector of float clip1})
+0:?         'clip' ( temp 3-element array of 4-component vector of float)
+0:?   Linker Objects
+0:?     'pos' ( in 3-element array of 4-component vector of float Position)
+0:?     'VertexID' (layout( location=0) in 3-element array of uint)
+0:?     'OutputStream.pos' ( out 4-component vector of float Position)
+0:?     'clip' ( in 3-element array of 4-element array of float ClipDistance)
+0:?     'OutputStream.clip1' ( out 4-element array of float ClipDistance)
+
+
+Linked geometry stage:
+
+
+Shader version: 500
+invocations = 1
+max_vertices = 3
+input primitive = triangles
+output primitive = line_strip
+0:? Sequence
+0:12  Function Definition: @main(vf4[3];u1[3];struct-S-vf4-vf2-vf21;vf4[3]; ( temp void)
+0:12    Function Parameters: 
+0:12      'pos' ( in 3-element array of 4-component vector of float)
+0:12      'VertexID' ( in 3-element array of uint)
+0:12      'OutputStream' ( out structure{ temp 4-component vector of float pos,  temp 2-component vector of float clip0,  temp 2-component vector of float clip1})
+0:12      'clip' ( in 3-element array of 4-component vector of float)
+0:?     Sequence
+0:15      move second child to first child ( temp 4-component vector of float)
+0:15        pos: direct index for structure ( temp 4-component vector of float)
+0:15          's' ( temp structure{ temp 4-component vector of float pos,  temp 2-component vector of float clip0,  temp 2-component vector of float clip1})
+0:15          Constant:
+0:15            0 (const int)
+0:15        direct index ( temp 4-component vector of float)
+0:15          'pos' ( in 3-element array of 4-component vector of float)
+0:15          Constant:
+0:15            0 (const int)
+0:16      move second child to first child ( temp 2-component vector of float)
+0:16        clip0: direct index for structure ( temp 2-component vector of float)
+0:16          's' ( temp structure{ temp 4-component vector of float pos,  temp 2-component vector of float clip0,  temp 2-component vector of float clip1})
+0:16          Constant:
+0:16            1 (const int)
+0:16        vector swizzle ( temp 2-component vector of float)
+0:16          direct index ( temp 4-component vector of float)
+0:16            'clip' ( in 3-element array of 4-component vector of float)
+0:16            Constant:
+0:16              0 (const int)
+0:16          Sequence
+0:16            Constant:
+0:16              0 (const int)
+0:16            Constant:
+0:16              1 (const int)
+0:17      move second child to first child ( temp 2-component vector of float)
+0:17        clip1: direct index for structure ( temp 2-component vector of float)
+0:17          's' ( temp structure{ temp 4-component vector of float pos,  temp 2-component vector of float clip0,  temp 2-component vector of float clip1})
+0:17          Constant:
+0:17            2 (const int)
+0:17        vector swizzle ( temp 2-component vector of float)
+0:17          direct index ( temp 4-component vector of float)
+0:17            'clip' ( in 3-element array of 4-component vector of float)
+0:17            Constant:
+0:17              0 (const int)
+0:17          Sequence
+0:17            Constant:
+0:17              2 (const int)
+0:17            Constant:
+0:17              3 (const int)
+0:19      Sequence
+0:19        Sequence
+0:19          move second child to first child ( temp 4-component vector of float)
+0:?             'OutputStream.pos' ( out 4-component vector of float Position)
+0:19            pos: direct index for structure ( temp 4-component vector of float)
+0:19              's' ( temp structure{ temp 4-component vector of float pos,  temp 2-component vector of float clip0,  temp 2-component vector of float clip1})
+0:19              Constant:
+0:19                0 (const int)
+0:?           Sequence
+0:19            move second child to first child ( temp float)
+0:19              direct index ( out float ClipDistance)
+0:?                 'OutputStream.clip1' ( out 4-element array of float ClipDistance)
+0:19                Constant:
+0:19                  0 (const int)
+0:19              direct index ( temp float)
+0:19                clip0: direct index for structure ( temp 2-component vector of float)
+0:19                  's' ( temp structure{ temp 4-component vector of float pos,  temp 2-component vector of float clip0,  temp 2-component vector of float clip1})
+0:19                  Constant:
+0:19                    1 (const int)
+0:19                Constant:
+0:19                  0 (const int)
+0:19            move second child to first child ( temp float)
+0:19              direct index ( out float ClipDistance)
+0:?                 'OutputStream.clip1' ( out 4-element array of float ClipDistance)
+0:19                Constant:
+0:19                  1 (const int)
+0:19              direct index ( temp float)
+0:19                clip0: direct index for structure ( temp 2-component vector of float)
+0:19                  's' ( temp structure{ temp 4-component vector of float pos,  temp 2-component vector of float clip0,  temp 2-component vector of float clip1})
+0:19                  Constant:
+0:19                    1 (const int)
+0:19                Constant:
+0:19                  1 (const int)
+0:?           Sequence
+0:19            move second child to first child ( temp float)
+0:19              direct index ( out float ClipDistance)
+0:?                 'OutputStream.clip1' ( out 4-element array of float ClipDistance)
+0:19                Constant:
+0:19                  2 (const int)
+0:19              direct index ( temp float)
+0:19                clip1: direct index for structure ( temp 2-component vector of float)
+0:19                  's' ( temp structure{ temp 4-component vector of float pos,  temp 2-component vector of float clip0,  temp 2-component vector of float clip1})
+0:19                  Constant:
+0:19                    2 (const int)
+0:19                Constant:
+0:19                  0 (const int)
+0:19            move second child to first child ( temp float)
+0:19              direct index ( out float ClipDistance)
+0:?                 'OutputStream.clip1' ( out 4-element array of float ClipDistance)
+0:19                Constant:
+0:19                  3 (const int)
+0:19              direct index ( temp float)
+0:19                clip1: direct index for structure ( temp 2-component vector of float)
+0:19                  's' ( temp structure{ temp 4-component vector of float pos,  temp 2-component vector of float clip0,  temp 2-component vector of float clip1})
+0:19                  Constant:
+0:19                    2 (const int)
+0:19                Constant:
+0:19                  1 (const int)
+0:19        EmitVertex ( temp void)
+0:12  Function Definition: main( ( temp void)
+0:12    Function Parameters: 
+0:?     Sequence
+0:12      move second child to first child ( temp 3-element array of 4-component vector of float)
+0:?         'pos' ( temp 3-element array of 4-component vector of float)
+0:?         'pos' ( in 3-element array of 4-component vector of float Position)
+0:12      move second child to first child ( temp 3-element array of uint)
+0:?         'VertexID' ( temp 3-element array of uint)
+0:?         'VertexID' (layout( location=0) in 3-element array of uint)
+0:?       Sequence
+0:12        move second child to first child ( temp float)
+0:12          direct index ( temp float)
+0:12            direct index ( temp 4-component vector of float)
+0:?               'clip' ( temp 3-element array of 4-component vector of float)
+0:12              Constant:
+0:12                0 (const int)
+0:12            Constant:
+0:12              0 (const int)
+0:12          direct index ( in float ClipDistance)
+0:12            direct index ( in 4-element array of float ClipDistance)
+0:?               'clip' ( in 3-element array of 4-element array of float ClipDistance)
+0:12              Constant:
+0:12                0 (const int)
+0:12            Constant:
+0:12              0 (const int)
+0:12        move second child to first child ( temp float)
+0:12          direct index ( temp float)
+0:12            direct index ( temp 4-component vector of float)
+0:?               'clip' ( temp 3-element array of 4-component vector of float)
+0:12              Constant:
+0:12                0 (const int)
+0:12            Constant:
+0:12              1 (const int)
+0:12          direct index ( in float ClipDistance)
+0:12            direct index ( in 4-element array of float ClipDistance)
+0:?               'clip' ( in 3-element array of 4-element array of float ClipDistance)
+0:12              Constant:
+0:12                0 (const int)
+0:12            Constant:
+0:12              1 (const int)
+0:12        move second child to first child ( temp float)
+0:12          direct index ( temp float)
+0:12            direct index ( temp 4-component vector of float)
+0:?               'clip' ( temp 3-element array of 4-component vector of float)
+0:12              Constant:
+0:12                0 (const int)
+0:12            Constant:
+0:12              2 (const int)
+0:12          direct index ( in float ClipDistance)
+0:12            direct index ( in 4-element array of float ClipDistance)
+0:?               'clip' ( in 3-element array of 4-element array of float ClipDistance)
+0:12              Constant:
+0:12                0 (const int)
+0:12            Constant:
+0:12              2 (const int)
+0:12        move second child to first child ( temp float)
+0:12          direct index ( temp float)
+0:12            direct index ( temp 4-component vector of float)
+0:?               'clip' ( temp 3-element array of 4-component vector of float)
+0:12              Constant:
+0:12                0 (const int)
+0:12            Constant:
+0:12              3 (const int)
+0:12          direct index ( in float ClipDistance)
+0:12            direct index ( in 4-element array of float ClipDistance)
+0:?               'clip' ( in 3-element array of 4-element array of float ClipDistance)
+0:12              Constant:
+0:12                0 (const int)
+0:12            Constant:
+0:12              3 (const int)
+0:12        move second child to first child ( temp float)
+0:12          direct index ( temp float)
+0:12            direct index ( temp 4-component vector of float)
+0:?               'clip' ( temp 3-element array of 4-component vector of float)
+0:12              Constant:
+0:12                1 (const int)
+0:12            Constant:
+0:12              0 (const int)
+0:12          direct index ( in float ClipDistance)
+0:12            direct index ( in 4-element array of float ClipDistance)
+0:?               'clip' ( in 3-element array of 4-element array of float ClipDistance)
+0:12              Constant:
+0:12                1 (const int)
+0:12            Constant:
+0:12              0 (const int)
+0:12        move second child to first child ( temp float)
+0:12          direct index ( temp float)
+0:12            direct index ( temp 4-component vector of float)
+0:?               'clip' ( temp 3-element array of 4-component vector of float)
+0:12              Constant:
+0:12                1 (const int)
+0:12            Constant:
+0:12              1 (const int)
+0:12          direct index ( in float ClipDistance)
+0:12            direct index ( in 4-element array of float ClipDistance)
+0:?               'clip' ( in 3-element array of 4-element array of float ClipDistance)
+0:12              Constant:
+0:12                1 (const int)
+0:12            Constant:
+0:12              1 (const int)
+0:12        move second child to first child ( temp float)
+0:12          direct index ( temp float)
+0:12            direct index ( temp 4-component vector of float)
+0:?               'clip' ( temp 3-element array of 4-component vector of float)
+0:12              Constant:
+0:12                1 (const int)
+0:12            Constant:
+0:12              2 (const int)
+0:12          direct index ( in float ClipDistance)
+0:12            direct index ( in 4-element array of float ClipDistance)
+0:?               'clip' ( in 3-element array of 4-element array of float ClipDistance)
+0:12              Constant:
+0:12                1 (const int)
+0:12            Constant:
+0:12              2 (const int)
+0:12        move second child to first child ( temp float)
+0:12          direct index ( temp float)
+0:12            direct index ( temp 4-component vector of float)
+0:?               'clip' ( temp 3-element array of 4-component vector of float)
+0:12              Constant:
+0:12                1 (const int)
+0:12            Constant:
+0:12              3 (const int)
+0:12          direct index ( in float ClipDistance)
+0:12            direct index ( in 4-element array of float ClipDistance)
+0:?               'clip' ( in 3-element array of 4-element array of float ClipDistance)
+0:12              Constant:
+0:12                1 (const int)
+0:12            Constant:
+0:12              3 (const int)
+0:12        move second child to first child ( temp float)
+0:12          direct index ( temp float)
+0:12            direct index ( temp 4-component vector of float)
+0:?               'clip' ( temp 3-element array of 4-component vector of float)
+0:12              Constant:
+0:12                2 (const int)
+0:12            Constant:
+0:12              0 (const int)
+0:12          direct index ( in float ClipDistance)
+0:12            direct index ( in 4-element array of float ClipDistance)
+0:?               'clip' ( in 3-element array of 4-element array of float ClipDistance)
+0:12              Constant:
+0:12                2 (const int)
+0:12            Constant:
+0:12              0 (const int)
+0:12        move second child to first child ( temp float)
+0:12          direct index ( temp float)
+0:12            direct index ( temp 4-component vector of float)
+0:?               'clip' ( temp 3-element array of 4-component vector of float)
+0:12              Constant:
+0:12                2 (const int)
+0:12            Constant:
+0:12              1 (const int)
+0:12          direct index ( in float ClipDistance)
+0:12            direct index ( in 4-element array of float ClipDistance)
+0:?               'clip' ( in 3-element array of 4-element array of float ClipDistance)
+0:12              Constant:
+0:12                2 (const int)
+0:12            Constant:
+0:12              1 (const int)
+0:12        move second child to first child ( temp float)
+0:12          direct index ( temp float)
+0:12            direct index ( temp 4-component vector of float)
+0:?               'clip' ( temp 3-element array of 4-component vector of float)
+0:12              Constant:
+0:12                2 (const int)
+0:12            Constant:
+0:12              2 (const int)
+0:12          direct index ( in float ClipDistance)
+0:12            direct index ( in 4-element array of float ClipDistance)
+0:?               'clip' ( in 3-element array of 4-element array of float ClipDistance)
+0:12              Constant:
+0:12                2 (const int)
+0:12            Constant:
+0:12              2 (const int)
+0:12        move second child to first child ( temp float)
+0:12          direct index ( temp float)
+0:12            direct index ( temp 4-component vector of float)
+0:?               'clip' ( temp 3-element array of 4-component vector of float)
+0:12              Constant:
+0:12                2 (const int)
+0:12            Constant:
+0:12              3 (const int)
+0:12          direct index ( in float ClipDistance)
+0:12            direct index ( in 4-element array of float ClipDistance)
+0:?               'clip' ( in 3-element array of 4-element array of float ClipDistance)
+0:12              Constant:
+0:12                2 (const int)
+0:12            Constant:
+0:12              3 (const int)
+0:12      Function Call: @main(vf4[3];u1[3];struct-S-vf4-vf2-vf21;vf4[3]; ( temp void)
+0:?         'pos' ( temp 3-element array of 4-component vector of float)
+0:?         'VertexID' ( temp 3-element array of uint)
+0:?         'OutputStream' ( temp structure{ temp 4-component vector of float pos,  temp 2-component vector of float clip0,  temp 2-component vector of float clip1})
+0:?         'clip' ( temp 3-element array of 4-component vector of float)
+0:?   Linker Objects
+0:?     'pos' ( in 3-element array of 4-component vector of float Position)
+0:?     'VertexID' (layout( location=0) in 3-element array of uint)
+0:?     'OutputStream.pos' ( out 4-component vector of float Position)
+0:?     'clip' ( in 3-element array of 4-element array of float ClipDistance)
+0:?     'OutputStream.clip1' ( out 4-element array of float ClipDistance)
+
+// Module Version 10000
+// Generated by (magic number): 80001
+// Id's are bound by 127
+
+                              Capability Geometry
+                              Capability ClipDistance
+               1:             ExtInstImport  "GLSL.std.450"
+                              MemoryModel Logical GLSL450
+                              EntryPoint Geometry 4  "main" 43 49 69 73 78
+                              ExecutionMode 4 Triangles
+                              ExecutionMode 4 Invocations 1
+                              ExecutionMode 4 OutputLineStrip
+                              ExecutionMode 4 OutputVertices 3
+                              Source HLSL 500
+                              Name 4  "main"
+                              Name 15  "S"
+                              MemberName 15(S) 0  "pos"
+                              MemberName 15(S) 1  "clip0"
+                              MemberName 15(S) 2  "clip1"
+                              Name 22  "@main(vf4[3];u1[3];struct-S-vf4-vf2-vf21;vf4[3];"
+                              Name 18  "pos"
+                              Name 19  "VertexID"
+                              Name 20  "OutputStream"
+                              Name 21  "clip"
+                              Name 24  "s"
+                              Name 43  "OutputStream.pos"
+                              Name 49  "OutputStream.clip1"
+                              Name 67  "pos"
+                              Name 69  "pos"
+                              Name 71  "VertexID"
+                              Name 73  "VertexID"
+                              Name 75  "clip"
+                              Name 78  "clip"
+                              Name 117  "OutputStream"
+                              Name 118  "param"
+                              Name 120  "param"
+                              Name 122  "param"
+                              Name 123  "param"
+                              Decorate 43(OutputStream.pos) BuiltIn Position
+                              Decorate 49(OutputStream.clip1) BuiltIn ClipDistance
+                              Decorate 69(pos) BuiltIn Position
+                              Decorate 73(VertexID) Location 0
+                              Decorate 78(clip) BuiltIn ClipDistance
+               2:             TypeVoid
+               3:             TypeFunction 2
+               6:             TypeFloat 32
+               7:             TypeVector 6(float) 4
+               8:             TypeInt 32 0
+               9:      8(int) Constant 3
+              10:             TypeArray 7(fvec4) 9
+              11:             TypePointer Function 10
+              12:             TypeArray 8(int) 9
+              13:             TypePointer Function 12
+              14:             TypeVector 6(float) 2
+           15(S):             TypeStruct 7(fvec4) 14(fvec2) 14(fvec2)
+              16:             TypePointer Function 15(S)
+              17:             TypeFunction 2 11(ptr) 13(ptr) 16(ptr) 11(ptr)
+              25:             TypeInt 32 1
+              26:     25(int) Constant 0
+              27:             TypePointer Function 7(fvec4)
+              31:     25(int) Constant 1
+              35:             TypePointer Function 14(fvec2)
+              37:     25(int) Constant 2
+              42:             TypePointer Output 7(fvec4)
+43(OutputStream.pos):     42(ptr) Variable Output
+              46:      8(int) Constant 4
+              47:             TypeArray 6(float) 46
+              48:             TypePointer Output 47
+49(OutputStream.clip1):     48(ptr) Variable Output
+              50:      8(int) Constant 0
+              51:             TypePointer Function 6(float)
+              54:             TypePointer Output 6(float)
+              56:      8(int) Constant 1
+              63:     25(int) Constant 3
+              68:             TypePointer Input 10
+         69(pos):     68(ptr) Variable Input
+              72:             TypePointer Input 12
+    73(VertexID):     72(ptr) Variable Input
+              76:             TypeArray 47 9
+              77:             TypePointer Input 76
+        78(clip):     77(ptr) Variable Input
+              79:             TypePointer Input 6(float)
+              88:      8(int) Constant 2
+         4(main):           2 Function None 3
+               5:             Label
+         67(pos):     11(ptr) Variable Function
+    71(VertexID):     13(ptr) Variable Function
+        75(clip):     11(ptr) Variable Function
+117(OutputStream):     16(ptr) Variable Function
+      118(param):     11(ptr) Variable Function
+      120(param):     13(ptr) Variable Function
+      122(param):     16(ptr) Variable Function
+      123(param):     11(ptr) Variable Function
+              70:          10 Load 69(pos)
+                              Store 67(pos) 70
+              74:          12 Load 73(VertexID)
+                              Store 71(VertexID) 74
+              80:     79(ptr) AccessChain 78(clip) 26 26
+              81:    6(float) Load 80
+              82:     51(ptr) AccessChain 75(clip) 26 50
+                              Store 82 81
+              83:     79(ptr) AccessChain 78(clip) 26 31
+              84:    6(float) Load 83
+              85:     51(ptr) AccessChain 75(clip) 26 56
+                              Store 85 84
+              86:     79(ptr) AccessChain 78(clip) 26 37
+              87:    6(float) Load 86
+              89:     51(ptr) AccessChain 75(clip) 26 88
+                              Store 89 87
+              90:     79(ptr) AccessChain 78(clip) 26 63
+              91:    6(float) Load 90
+              92:     51(ptr) AccessChain 75(clip) 26 9
+                              Store 92 91
+              93:     79(ptr) AccessChain 78(clip) 31 26
+              94:    6(float) Load 93
+              95:     51(ptr) AccessChain 75(clip) 31 50
+                              Store 95 94
+              96:     79(ptr) AccessChain 78(clip) 31 31
+              97:    6(float) Load 96
+              98:     51(ptr) AccessChain 75(clip) 31 56
+                              Store 98 97
+              99:     79(ptr) AccessChain 78(clip) 31 37
+             100:    6(float) Load 99
+             101:     51(ptr) AccessChain 75(clip) 31 88
+                              Store 101 100
+             102:     79(ptr) AccessChain 78(clip) 31 63
+             103:    6(float) Load 102
+             104:     51(ptr) AccessChain 75(clip) 31 9
+                              Store 104 103
+             105:     79(ptr) AccessChain 78(clip) 37 26
+             106:    6(float) Load 105
+             107:     51(ptr) AccessChain 75(clip) 37 50
+                              Store 107 106
+             108:     79(ptr) AccessChain 78(clip) 37 31
+             109:    6(float) Load 108
+             110:     51(ptr) AccessChain 75(clip) 37 56
+                              Store 110 109
+             111:     79(ptr) AccessChain 78(clip) 37 37
+             112:    6(float) Load 111
+             113:     51(ptr) AccessChain 75(clip) 37 88
+                              Store 113 112
+             114:     79(ptr) AccessChain 78(clip) 37 63
+             115:    6(float) Load 114
+             116:     51(ptr) AccessChain 75(clip) 37 9
+                              Store 116 115
+             119:          10 Load 67(pos)
+                              Store 118(param) 119
+             121:          12 Load 71(VertexID)
+                              Store 120(param) 121
+             124:          10 Load 75(clip)
+                              Store 123(param) 124
+             125:           2 FunctionCall 22(@main(vf4[3];u1[3];struct-S-vf4-vf2-vf21;vf4[3];) 118(param) 120(param) 122(param) 123(param)
+             126:       15(S) Load 122(param)
+                              Store 117(OutputStream) 126
+                              Return
+                              FunctionEnd
+22(@main(vf4[3];u1[3];struct-S-vf4-vf2-vf21;vf4[3];):           2 Function None 17
+         18(pos):     11(ptr) FunctionParameter
+    19(VertexID):     13(ptr) FunctionParameter
+20(OutputStream):     16(ptr) FunctionParameter
+        21(clip):     11(ptr) FunctionParameter
+              23:             Label
+           24(s):     16(ptr) Variable Function
+              28:     27(ptr) AccessChain 18(pos) 26
+              29:    7(fvec4) Load 28
+              30:     27(ptr) AccessChain 24(s) 26
+                              Store 30 29
+              32:     27(ptr) AccessChain 21(clip) 26
+              33:    7(fvec4) Load 32
+              34:   14(fvec2) VectorShuffle 33 33 0 1
+              36:     35(ptr) AccessChain 24(s) 31
+                              Store 36 34
+              38:     27(ptr) AccessChain 21(clip) 26
+              39:    7(fvec4) Load 38
+              40:   14(fvec2) VectorShuffle 39 39 2 3
+              41:     35(ptr) AccessChain 24(s) 37
+                              Store 41 40
+              44:     27(ptr) AccessChain 24(s) 26
+              45:    7(fvec4) Load 44
+                              Store 43(OutputStream.pos) 45
+              52:     51(ptr) AccessChain 24(s) 31 50
+              53:    6(float) Load 52
+              55:     54(ptr) AccessChain 49(OutputStream.clip1) 26
+                              Store 55 53
+              57:     51(ptr) AccessChain 24(s) 31 56
+              58:    6(float) Load 57
+              59:     54(ptr) AccessChain 49(OutputStream.clip1) 31
+                              Store 59 58
+              60:     51(ptr) AccessChain 24(s) 37 50
+              61:    6(float) Load 60
+              62:     54(ptr) AccessChain 49(OutputStream.clip1) 37
+                              Store 62 61
+              64:     51(ptr) AccessChain 24(s) 37 56
+              65:    6(float) Load 64
+              66:     54(ptr) AccessChain 49(OutputStream.clip1) 63
+                              Store 66 65
+                              EmitVertex
+                              Return
+                              FunctionEnd
diff --git a/Test/baseResults/hlsl.clipdistance-4.geom.out b/Test/baseResults/hlsl.clipdistance-4.geom.out
new file mode 100644
index 0000000000000000000000000000000000000000..82d0c0afdd8936da900e5a3c439e1e9c8c439ab3
--- /dev/null
+++ b/Test/baseResults/hlsl.clipdistance-4.geom.out
@@ -0,0 +1,819 @@
+hlsl.clipdistance-4.geom
+Shader version: 500
+invocations = -1
+max_vertices = 3
+input primitive = triangles
+output primitive = line_strip
+0:? Sequence
+0:13  Function Definition: @main(vf4[3];u1[3];struct-S-vf4-vf2-vf21;vf2[3];vf2[3]; ( temp void)
+0:13    Function Parameters: 
+0:13      'pos' ( in 3-element array of 4-component vector of float)
+0:13      'VertexID' ( in 3-element array of uint)
+0:13      'OutputStream' ( out structure{ temp 4-component vector of float pos,  temp 2-component vector of float clip0,  temp 2-component vector of float clip1})
+0:13      'clip0' ( in 3-element array of 2-component vector of float)
+0:13      'clip1' ( in 3-element array of 2-component vector of float)
+0:?     Sequence
+0:16      move second child to first child ( temp 4-component vector of float)
+0:16        pos: direct index for structure ( temp 4-component vector of float)
+0:16          's' ( temp structure{ temp 4-component vector of float pos,  temp 2-component vector of float clip0,  temp 2-component vector of float clip1})
+0:16          Constant:
+0:16            0 (const int)
+0:16        direct index ( temp 4-component vector of float)
+0:16          'pos' ( in 3-element array of 4-component vector of float)
+0:16          Constant:
+0:16            0 (const int)
+0:17      move second child to first child ( temp 2-component vector of float)
+0:17        clip0: direct index for structure ( temp 2-component vector of float)
+0:17          's' ( temp structure{ temp 4-component vector of float pos,  temp 2-component vector of float clip0,  temp 2-component vector of float clip1})
+0:17          Constant:
+0:17            1 (const int)
+0:17        direct index ( temp 2-component vector of float)
+0:17          'clip0' ( in 3-element array of 2-component vector of float)
+0:17          Constant:
+0:17            0 (const int)
+0:18      move second child to first child ( temp 2-component vector of float)
+0:18        clip1: direct index for structure ( temp 2-component vector of float)
+0:18          's' ( temp structure{ temp 4-component vector of float pos,  temp 2-component vector of float clip0,  temp 2-component vector of float clip1})
+0:18          Constant:
+0:18            2 (const int)
+0:18        direct index ( temp 2-component vector of float)
+0:18          'clip1' ( in 3-element array of 2-component vector of float)
+0:18          Constant:
+0:18            0 (const int)
+0:20      Sequence
+0:20        Sequence
+0:20          move second child to first child ( temp 4-component vector of float)
+0:?             'OutputStream.pos' ( out 4-component vector of float Position)
+0:20            pos: direct index for structure ( temp 4-component vector of float)
+0:20              's' ( temp structure{ temp 4-component vector of float pos,  temp 2-component vector of float clip0,  temp 2-component vector of float clip1})
+0:20              Constant:
+0:20                0 (const int)
+0:?           Sequence
+0:20            move second child to first child ( temp float)
+0:20              direct index ( out float ClipDistance)
+0:?                 'OutputStream.clip1' ( out 4-element array of float ClipDistance)
+0:20                Constant:
+0:20                  0 (const int)
+0:20              direct index ( temp float)
+0:20                clip0: direct index for structure ( temp 2-component vector of float)
+0:20                  's' ( temp structure{ temp 4-component vector of float pos,  temp 2-component vector of float clip0,  temp 2-component vector of float clip1})
+0:20                  Constant:
+0:20                    1 (const int)
+0:20                Constant:
+0:20                  0 (const int)
+0:20            move second child to first child ( temp float)
+0:20              direct index ( out float ClipDistance)
+0:?                 'OutputStream.clip1' ( out 4-element array of float ClipDistance)
+0:20                Constant:
+0:20                  1 (const int)
+0:20              direct index ( temp float)
+0:20                clip0: direct index for structure ( temp 2-component vector of float)
+0:20                  's' ( temp structure{ temp 4-component vector of float pos,  temp 2-component vector of float clip0,  temp 2-component vector of float clip1})
+0:20                  Constant:
+0:20                    1 (const int)
+0:20                Constant:
+0:20                  1 (const int)
+0:?           Sequence
+0:20            move second child to first child ( temp float)
+0:20              direct index ( out float ClipDistance)
+0:?                 'OutputStream.clip1' ( out 4-element array of float ClipDistance)
+0:20                Constant:
+0:20                  2 (const int)
+0:20              direct index ( temp float)
+0:20                clip1: direct index for structure ( temp 2-component vector of float)
+0:20                  's' ( temp structure{ temp 4-component vector of float pos,  temp 2-component vector of float clip0,  temp 2-component vector of float clip1})
+0:20                  Constant:
+0:20                    2 (const int)
+0:20                Constant:
+0:20                  0 (const int)
+0:20            move second child to first child ( temp float)
+0:20              direct index ( out float ClipDistance)
+0:?                 'OutputStream.clip1' ( out 4-element array of float ClipDistance)
+0:20                Constant:
+0:20                  3 (const int)
+0:20              direct index ( temp float)
+0:20                clip1: direct index for structure ( temp 2-component vector of float)
+0:20                  's' ( temp structure{ temp 4-component vector of float pos,  temp 2-component vector of float clip0,  temp 2-component vector of float clip1})
+0:20                  Constant:
+0:20                    2 (const int)
+0:20                Constant:
+0:20                  1 (const int)
+0:20        EmitVertex ( temp void)
+0:13  Function Definition: main( ( temp void)
+0:13    Function Parameters: 
+0:?     Sequence
+0:13      move second child to first child ( temp 3-element array of 4-component vector of float)
+0:?         'pos' ( temp 3-element array of 4-component vector of float)
+0:?         'pos' ( in 3-element array of 4-component vector of float Position)
+0:13      move second child to first child ( temp 3-element array of uint)
+0:?         'VertexID' ( temp 3-element array of uint)
+0:?         'VertexID' (layout( location=0) in 3-element array of uint)
+0:?       Sequence
+0:13        move second child to first child ( temp float)
+0:13          direct index ( temp float)
+0:13            direct index ( temp 2-component vector of float)
+0:?               'clip0' ( temp 3-element array of 2-component vector of float)
+0:13              Constant:
+0:13                0 (const int)
+0:13            Constant:
+0:13              0 (const int)
+0:13          direct index ( in float ClipDistance)
+0:13            direct index ( in 4-element array of float ClipDistance)
+0:?               'clip0' ( in 3-element array of 4-element array of float ClipDistance)
+0:13              Constant:
+0:13                0 (const int)
+0:13            Constant:
+0:13              0 (const int)
+0:13        move second child to first child ( temp float)
+0:13          direct index ( temp float)
+0:13            direct index ( temp 2-component vector of float)
+0:?               'clip0' ( temp 3-element array of 2-component vector of float)
+0:13              Constant:
+0:13                0 (const int)
+0:13            Constant:
+0:13              1 (const int)
+0:13          direct index ( in float ClipDistance)
+0:13            direct index ( in 4-element array of float ClipDistance)
+0:?               'clip0' ( in 3-element array of 4-element array of float ClipDistance)
+0:13              Constant:
+0:13                0 (const int)
+0:13            Constant:
+0:13              1 (const int)
+0:13        move second child to first child ( temp float)
+0:13          direct index ( temp float)
+0:13            direct index ( temp 2-component vector of float)
+0:?               'clip0' ( temp 3-element array of 2-component vector of float)
+0:13              Constant:
+0:13                1 (const int)
+0:13            Constant:
+0:13              0 (const int)
+0:13          direct index ( in float ClipDistance)
+0:13            direct index ( in 4-element array of float ClipDistance)
+0:?               'clip0' ( in 3-element array of 4-element array of float ClipDistance)
+0:13              Constant:
+0:13                0 (const int)
+0:13            Constant:
+0:13              2 (const int)
+0:13        move second child to first child ( temp float)
+0:13          direct index ( temp float)
+0:13            direct index ( temp 2-component vector of float)
+0:?               'clip0' ( temp 3-element array of 2-component vector of float)
+0:13              Constant:
+0:13                1 (const int)
+0:13            Constant:
+0:13              1 (const int)
+0:13          direct index ( in float ClipDistance)
+0:13            direct index ( in 4-element array of float ClipDistance)
+0:?               'clip0' ( in 3-element array of 4-element array of float ClipDistance)
+0:13              Constant:
+0:13                0 (const int)
+0:13            Constant:
+0:13              3 (const int)
+0:13        move second child to first child ( temp float)
+0:13          direct index ( temp float)
+0:13            direct index ( temp 2-component vector of float)
+0:?               'clip0' ( temp 3-element array of 2-component vector of float)
+0:13              Constant:
+0:13                2 (const int)
+0:13            Constant:
+0:13              0 (const int)
+0:13          direct index ( in float ClipDistance)
+0:13            direct index ( in 4-element array of float ClipDistance)
+0:?               'clip0' ( in 3-element array of 4-element array of float ClipDistance)
+0:13              Constant:
+0:13                1 (const int)
+0:13            Constant:
+0:13              0 (const int)
+0:13        move second child to first child ( temp float)
+0:13          direct index ( temp float)
+0:13            direct index ( temp 2-component vector of float)
+0:?               'clip0' ( temp 3-element array of 2-component vector of float)
+0:13              Constant:
+0:13                2 (const int)
+0:13            Constant:
+0:13              1 (const int)
+0:13          direct index ( in float ClipDistance)
+0:13            direct index ( in 4-element array of float ClipDistance)
+0:?               'clip0' ( in 3-element array of 4-element array of float ClipDistance)
+0:13              Constant:
+0:13                1 (const int)
+0:13            Constant:
+0:13              1 (const int)
+0:?       Sequence
+0:13        move second child to first child ( temp float)
+0:13          direct index ( temp float)
+0:13            direct index ( temp 2-component vector of float)
+0:?               'clip1' ( temp 3-element array of 2-component vector of float)
+0:13              Constant:
+0:13                0 (const int)
+0:13            Constant:
+0:13              0 (const int)
+0:13          direct index ( in float ClipDistance)
+0:13            direct index ( in 4-element array of float ClipDistance)
+0:?               'clip0' ( in 3-element array of 4-element array of float ClipDistance)
+0:13              Constant:
+0:13                0 (const int)
+0:13            Constant:
+0:13              2 (const int)
+0:13        move second child to first child ( temp float)
+0:13          direct index ( temp float)
+0:13            direct index ( temp 2-component vector of float)
+0:?               'clip1' ( temp 3-element array of 2-component vector of float)
+0:13              Constant:
+0:13                0 (const int)
+0:13            Constant:
+0:13              1 (const int)
+0:13          direct index ( in float ClipDistance)
+0:13            direct index ( in 4-element array of float ClipDistance)
+0:?               'clip0' ( in 3-element array of 4-element array of float ClipDistance)
+0:13              Constant:
+0:13                0 (const int)
+0:13            Constant:
+0:13              3 (const int)
+0:13        move second child to first child ( temp float)
+0:13          direct index ( temp float)
+0:13            direct index ( temp 2-component vector of float)
+0:?               'clip1' ( temp 3-element array of 2-component vector of float)
+0:13              Constant:
+0:13                1 (const int)
+0:13            Constant:
+0:13              0 (const int)
+0:13          direct index ( in float ClipDistance)
+0:13            direct index ( in 4-element array of float ClipDistance)
+0:?               'clip0' ( in 3-element array of 4-element array of float ClipDistance)
+0:13              Constant:
+0:13                1 (const int)
+0:13            Constant:
+0:13              2 (const int)
+0:13        move second child to first child ( temp float)
+0:13          direct index ( temp float)
+0:13            direct index ( temp 2-component vector of float)
+0:?               'clip1' ( temp 3-element array of 2-component vector of float)
+0:13              Constant:
+0:13                1 (const int)
+0:13            Constant:
+0:13              1 (const int)
+0:13          direct index ( in float ClipDistance)
+0:13            direct index ( in 4-element array of float ClipDistance)
+0:?               'clip0' ( in 3-element array of 4-element array of float ClipDistance)
+0:13              Constant:
+0:13                1 (const int)
+0:13            Constant:
+0:13              3 (const int)
+0:13        move second child to first child ( temp float)
+0:13          direct index ( temp float)
+0:13            direct index ( temp 2-component vector of float)
+0:?               'clip1' ( temp 3-element array of 2-component vector of float)
+0:13              Constant:
+0:13                2 (const int)
+0:13            Constant:
+0:13              0 (const int)
+0:13          direct index ( in float ClipDistance)
+0:13            direct index ( in 4-element array of float ClipDistance)
+0:?               'clip0' ( in 3-element array of 4-element array of float ClipDistance)
+0:13              Constant:
+0:13                2 (const int)
+0:13            Constant:
+0:13              2 (const int)
+0:13        move second child to first child ( temp float)
+0:13          direct index ( temp float)
+0:13            direct index ( temp 2-component vector of float)
+0:?               'clip1' ( temp 3-element array of 2-component vector of float)
+0:13              Constant:
+0:13                2 (const int)
+0:13            Constant:
+0:13              1 (const int)
+0:13          direct index ( in float ClipDistance)
+0:13            direct index ( in 4-element array of float ClipDistance)
+0:?               'clip0' ( in 3-element array of 4-element array of float ClipDistance)
+0:13              Constant:
+0:13                2 (const int)
+0:13            Constant:
+0:13              3 (const int)
+0:13      Function Call: @main(vf4[3];u1[3];struct-S-vf4-vf2-vf21;vf2[3];vf2[3]; ( temp void)
+0:?         'pos' ( temp 3-element array of 4-component vector of float)
+0:?         'VertexID' ( temp 3-element array of uint)
+0:?         'OutputStream' ( temp structure{ temp 4-component vector of float pos,  temp 2-component vector of float clip0,  temp 2-component vector of float clip1})
+0:?         'clip0' ( temp 3-element array of 2-component vector of float)
+0:?         'clip1' ( temp 3-element array of 2-component vector of float)
+0:?   Linker Objects
+0:?     'pos' ( in 3-element array of 4-component vector of float Position)
+0:?     'VertexID' (layout( location=0) in 3-element array of uint)
+0:?     'OutputStream.pos' ( out 4-component vector of float Position)
+0:?     'clip0' ( in 3-element array of 4-element array of float ClipDistance)
+0:?     'OutputStream.clip1' ( out 4-element array of float ClipDistance)
+
+
+Linked geometry stage:
+
+
+Shader version: 500
+invocations = 1
+max_vertices = 3
+input primitive = triangles
+output primitive = line_strip
+0:? Sequence
+0:13  Function Definition: @main(vf4[3];u1[3];struct-S-vf4-vf2-vf21;vf2[3];vf2[3]; ( temp void)
+0:13    Function Parameters: 
+0:13      'pos' ( in 3-element array of 4-component vector of float)
+0:13      'VertexID' ( in 3-element array of uint)
+0:13      'OutputStream' ( out structure{ temp 4-component vector of float pos,  temp 2-component vector of float clip0,  temp 2-component vector of float clip1})
+0:13      'clip0' ( in 3-element array of 2-component vector of float)
+0:13      'clip1' ( in 3-element array of 2-component vector of float)
+0:?     Sequence
+0:16      move second child to first child ( temp 4-component vector of float)
+0:16        pos: direct index for structure ( temp 4-component vector of float)
+0:16          's' ( temp structure{ temp 4-component vector of float pos,  temp 2-component vector of float clip0,  temp 2-component vector of float clip1})
+0:16          Constant:
+0:16            0 (const int)
+0:16        direct index ( temp 4-component vector of float)
+0:16          'pos' ( in 3-element array of 4-component vector of float)
+0:16          Constant:
+0:16            0 (const int)
+0:17      move second child to first child ( temp 2-component vector of float)
+0:17        clip0: direct index for structure ( temp 2-component vector of float)
+0:17          's' ( temp structure{ temp 4-component vector of float pos,  temp 2-component vector of float clip0,  temp 2-component vector of float clip1})
+0:17          Constant:
+0:17            1 (const int)
+0:17        direct index ( temp 2-component vector of float)
+0:17          'clip0' ( in 3-element array of 2-component vector of float)
+0:17          Constant:
+0:17            0 (const int)
+0:18      move second child to first child ( temp 2-component vector of float)
+0:18        clip1: direct index for structure ( temp 2-component vector of float)
+0:18          's' ( temp structure{ temp 4-component vector of float pos,  temp 2-component vector of float clip0,  temp 2-component vector of float clip1})
+0:18          Constant:
+0:18            2 (const int)
+0:18        direct index ( temp 2-component vector of float)
+0:18          'clip1' ( in 3-element array of 2-component vector of float)
+0:18          Constant:
+0:18            0 (const int)
+0:20      Sequence
+0:20        Sequence
+0:20          move second child to first child ( temp 4-component vector of float)
+0:?             'OutputStream.pos' ( out 4-component vector of float Position)
+0:20            pos: direct index for structure ( temp 4-component vector of float)
+0:20              's' ( temp structure{ temp 4-component vector of float pos,  temp 2-component vector of float clip0,  temp 2-component vector of float clip1})
+0:20              Constant:
+0:20                0 (const int)
+0:?           Sequence
+0:20            move second child to first child ( temp float)
+0:20              direct index ( out float ClipDistance)
+0:?                 'OutputStream.clip1' ( out 4-element array of float ClipDistance)
+0:20                Constant:
+0:20                  0 (const int)
+0:20              direct index ( temp float)
+0:20                clip0: direct index for structure ( temp 2-component vector of float)
+0:20                  's' ( temp structure{ temp 4-component vector of float pos,  temp 2-component vector of float clip0,  temp 2-component vector of float clip1})
+0:20                  Constant:
+0:20                    1 (const int)
+0:20                Constant:
+0:20                  0 (const int)
+0:20            move second child to first child ( temp float)
+0:20              direct index ( out float ClipDistance)
+0:?                 'OutputStream.clip1' ( out 4-element array of float ClipDistance)
+0:20                Constant:
+0:20                  1 (const int)
+0:20              direct index ( temp float)
+0:20                clip0: direct index for structure ( temp 2-component vector of float)
+0:20                  's' ( temp structure{ temp 4-component vector of float pos,  temp 2-component vector of float clip0,  temp 2-component vector of float clip1})
+0:20                  Constant:
+0:20                    1 (const int)
+0:20                Constant:
+0:20                  1 (const int)
+0:?           Sequence
+0:20            move second child to first child ( temp float)
+0:20              direct index ( out float ClipDistance)
+0:?                 'OutputStream.clip1' ( out 4-element array of float ClipDistance)
+0:20                Constant:
+0:20                  2 (const int)
+0:20              direct index ( temp float)
+0:20                clip1: direct index for structure ( temp 2-component vector of float)
+0:20                  's' ( temp structure{ temp 4-component vector of float pos,  temp 2-component vector of float clip0,  temp 2-component vector of float clip1})
+0:20                  Constant:
+0:20                    2 (const int)
+0:20                Constant:
+0:20                  0 (const int)
+0:20            move second child to first child ( temp float)
+0:20              direct index ( out float ClipDistance)
+0:?                 'OutputStream.clip1' ( out 4-element array of float ClipDistance)
+0:20                Constant:
+0:20                  3 (const int)
+0:20              direct index ( temp float)
+0:20                clip1: direct index for structure ( temp 2-component vector of float)
+0:20                  's' ( temp structure{ temp 4-component vector of float pos,  temp 2-component vector of float clip0,  temp 2-component vector of float clip1})
+0:20                  Constant:
+0:20                    2 (const int)
+0:20                Constant:
+0:20                  1 (const int)
+0:20        EmitVertex ( temp void)
+0:13  Function Definition: main( ( temp void)
+0:13    Function Parameters: 
+0:?     Sequence
+0:13      move second child to first child ( temp 3-element array of 4-component vector of float)
+0:?         'pos' ( temp 3-element array of 4-component vector of float)
+0:?         'pos' ( in 3-element array of 4-component vector of float Position)
+0:13      move second child to first child ( temp 3-element array of uint)
+0:?         'VertexID' ( temp 3-element array of uint)
+0:?         'VertexID' (layout( location=0) in 3-element array of uint)
+0:?       Sequence
+0:13        move second child to first child ( temp float)
+0:13          direct index ( temp float)
+0:13            direct index ( temp 2-component vector of float)
+0:?               'clip0' ( temp 3-element array of 2-component vector of float)
+0:13              Constant:
+0:13                0 (const int)
+0:13            Constant:
+0:13              0 (const int)
+0:13          direct index ( in float ClipDistance)
+0:13            direct index ( in 4-element array of float ClipDistance)
+0:?               'clip0' ( in 3-element array of 4-element array of float ClipDistance)
+0:13              Constant:
+0:13                0 (const int)
+0:13            Constant:
+0:13              0 (const int)
+0:13        move second child to first child ( temp float)
+0:13          direct index ( temp float)
+0:13            direct index ( temp 2-component vector of float)
+0:?               'clip0' ( temp 3-element array of 2-component vector of float)
+0:13              Constant:
+0:13                0 (const int)
+0:13            Constant:
+0:13              1 (const int)
+0:13          direct index ( in float ClipDistance)
+0:13            direct index ( in 4-element array of float ClipDistance)
+0:?               'clip0' ( in 3-element array of 4-element array of float ClipDistance)
+0:13              Constant:
+0:13                0 (const int)
+0:13            Constant:
+0:13              1 (const int)
+0:13        move second child to first child ( temp float)
+0:13          direct index ( temp float)
+0:13            direct index ( temp 2-component vector of float)
+0:?               'clip0' ( temp 3-element array of 2-component vector of float)
+0:13              Constant:
+0:13                1 (const int)
+0:13            Constant:
+0:13              0 (const int)
+0:13          direct index ( in float ClipDistance)
+0:13            direct index ( in 4-element array of float ClipDistance)
+0:?               'clip0' ( in 3-element array of 4-element array of float ClipDistance)
+0:13              Constant:
+0:13                0 (const int)
+0:13            Constant:
+0:13              2 (const int)
+0:13        move second child to first child ( temp float)
+0:13          direct index ( temp float)
+0:13            direct index ( temp 2-component vector of float)
+0:?               'clip0' ( temp 3-element array of 2-component vector of float)
+0:13              Constant:
+0:13                1 (const int)
+0:13            Constant:
+0:13              1 (const int)
+0:13          direct index ( in float ClipDistance)
+0:13            direct index ( in 4-element array of float ClipDistance)
+0:?               'clip0' ( in 3-element array of 4-element array of float ClipDistance)
+0:13              Constant:
+0:13                0 (const int)
+0:13            Constant:
+0:13              3 (const int)
+0:13        move second child to first child ( temp float)
+0:13          direct index ( temp float)
+0:13            direct index ( temp 2-component vector of float)
+0:?               'clip0' ( temp 3-element array of 2-component vector of float)
+0:13              Constant:
+0:13                2 (const int)
+0:13            Constant:
+0:13              0 (const int)
+0:13          direct index ( in float ClipDistance)
+0:13            direct index ( in 4-element array of float ClipDistance)
+0:?               'clip0' ( in 3-element array of 4-element array of float ClipDistance)
+0:13              Constant:
+0:13                1 (const int)
+0:13            Constant:
+0:13              0 (const int)
+0:13        move second child to first child ( temp float)
+0:13          direct index ( temp float)
+0:13            direct index ( temp 2-component vector of float)
+0:?               'clip0' ( temp 3-element array of 2-component vector of float)
+0:13              Constant:
+0:13                2 (const int)
+0:13            Constant:
+0:13              1 (const int)
+0:13          direct index ( in float ClipDistance)
+0:13            direct index ( in 4-element array of float ClipDistance)
+0:?               'clip0' ( in 3-element array of 4-element array of float ClipDistance)
+0:13              Constant:
+0:13                1 (const int)
+0:13            Constant:
+0:13              1 (const int)
+0:?       Sequence
+0:13        move second child to first child ( temp float)
+0:13          direct index ( temp float)
+0:13            direct index ( temp 2-component vector of float)
+0:?               'clip1' ( temp 3-element array of 2-component vector of float)
+0:13              Constant:
+0:13                0 (const int)
+0:13            Constant:
+0:13              0 (const int)
+0:13          direct index ( in float ClipDistance)
+0:13            direct index ( in 4-element array of float ClipDistance)
+0:?               'clip0' ( in 3-element array of 4-element array of float ClipDistance)
+0:13              Constant:
+0:13                0 (const int)
+0:13            Constant:
+0:13              2 (const int)
+0:13        move second child to first child ( temp float)
+0:13          direct index ( temp float)
+0:13            direct index ( temp 2-component vector of float)
+0:?               'clip1' ( temp 3-element array of 2-component vector of float)
+0:13              Constant:
+0:13                0 (const int)
+0:13            Constant:
+0:13              1 (const int)
+0:13          direct index ( in float ClipDistance)
+0:13            direct index ( in 4-element array of float ClipDistance)
+0:?               'clip0' ( in 3-element array of 4-element array of float ClipDistance)
+0:13              Constant:
+0:13                0 (const int)
+0:13            Constant:
+0:13              3 (const int)
+0:13        move second child to first child ( temp float)
+0:13          direct index ( temp float)
+0:13            direct index ( temp 2-component vector of float)
+0:?               'clip1' ( temp 3-element array of 2-component vector of float)
+0:13              Constant:
+0:13                1 (const int)
+0:13            Constant:
+0:13              0 (const int)
+0:13          direct index ( in float ClipDistance)
+0:13            direct index ( in 4-element array of float ClipDistance)
+0:?               'clip0' ( in 3-element array of 4-element array of float ClipDistance)
+0:13              Constant:
+0:13                1 (const int)
+0:13            Constant:
+0:13              2 (const int)
+0:13        move second child to first child ( temp float)
+0:13          direct index ( temp float)
+0:13            direct index ( temp 2-component vector of float)
+0:?               'clip1' ( temp 3-element array of 2-component vector of float)
+0:13              Constant:
+0:13                1 (const int)
+0:13            Constant:
+0:13              1 (const int)
+0:13          direct index ( in float ClipDistance)
+0:13            direct index ( in 4-element array of float ClipDistance)
+0:?               'clip0' ( in 3-element array of 4-element array of float ClipDistance)
+0:13              Constant:
+0:13                1 (const int)
+0:13            Constant:
+0:13              3 (const int)
+0:13        move second child to first child ( temp float)
+0:13          direct index ( temp float)
+0:13            direct index ( temp 2-component vector of float)
+0:?               'clip1' ( temp 3-element array of 2-component vector of float)
+0:13              Constant:
+0:13                2 (const int)
+0:13            Constant:
+0:13              0 (const int)
+0:13          direct index ( in float ClipDistance)
+0:13            direct index ( in 4-element array of float ClipDistance)
+0:?               'clip0' ( in 3-element array of 4-element array of float ClipDistance)
+0:13              Constant:
+0:13                2 (const int)
+0:13            Constant:
+0:13              2 (const int)
+0:13        move second child to first child ( temp float)
+0:13          direct index ( temp float)
+0:13            direct index ( temp 2-component vector of float)
+0:?               'clip1' ( temp 3-element array of 2-component vector of float)
+0:13              Constant:
+0:13                2 (const int)
+0:13            Constant:
+0:13              1 (const int)
+0:13          direct index ( in float ClipDistance)
+0:13            direct index ( in 4-element array of float ClipDistance)
+0:?               'clip0' ( in 3-element array of 4-element array of float ClipDistance)
+0:13              Constant:
+0:13                2 (const int)
+0:13            Constant:
+0:13              3 (const int)
+0:13      Function Call: @main(vf4[3];u1[3];struct-S-vf4-vf2-vf21;vf2[3];vf2[3]; ( temp void)
+0:?         'pos' ( temp 3-element array of 4-component vector of float)
+0:?         'VertexID' ( temp 3-element array of uint)
+0:?         'OutputStream' ( temp structure{ temp 4-component vector of float pos,  temp 2-component vector of float clip0,  temp 2-component vector of float clip1})
+0:?         'clip0' ( temp 3-element array of 2-component vector of float)
+0:?         'clip1' ( temp 3-element array of 2-component vector of float)
+0:?   Linker Objects
+0:?     'pos' ( in 3-element array of 4-component vector of float Position)
+0:?     'VertexID' (layout( location=0) in 3-element array of uint)
+0:?     'OutputStream.pos' ( out 4-component vector of float Position)
+0:?     'clip0' ( in 3-element array of 4-element array of float ClipDistance)
+0:?     'OutputStream.clip1' ( out 4-element array of float ClipDistance)
+
+// Module Version 10000
+// Generated by (magic number): 80001
+// Id's are bound by 130
+
+                              Capability Geometry
+                              Capability ClipDistance
+               1:             ExtInstImport  "GLSL.std.450"
+                              MemoryModel Logical GLSL450
+                              EntryPoint Geometry 4  "main" 44 50 70 74 79
+                              ExecutionMode 4 Triangles
+                              ExecutionMode 4 Invocations 1
+                              ExecutionMode 4 OutputLineStrip
+                              ExecutionMode 4 OutputVertices 3
+                              Source HLSL 500
+                              Name 4  "main"
+                              Name 15  "S"
+                              MemberName 15(S) 0  "pos"
+                              MemberName 15(S) 1  "clip0"
+                              MemberName 15(S) 2  "clip1"
+                              Name 25  "@main(vf4[3];u1[3];struct-S-vf4-vf2-vf21;vf2[3];vf2[3];"
+                              Name 20  "pos"
+                              Name 21  "VertexID"
+                              Name 22  "OutputStream"
+                              Name 23  "clip0"
+                              Name 24  "clip1"
+                              Name 27  "s"
+                              Name 44  "OutputStream.pos"
+                              Name 50  "OutputStream.clip1"
+                              Name 68  "pos"
+                              Name 70  "pos"
+                              Name 72  "VertexID"
+                              Name 74  "VertexID"
+                              Name 76  "clip0"
+                              Name 79  "clip0"
+                              Name 99  "clip1"
+                              Name 118  "OutputStream"
+                              Name 119  "param"
+                              Name 121  "param"
+                              Name 123  "param"
+                              Name 124  "param"
+                              Name 126  "param"
+                              Decorate 44(OutputStream.pos) BuiltIn Position
+                              Decorate 50(OutputStream.clip1) BuiltIn ClipDistance
+                              Decorate 70(pos) BuiltIn Position
+                              Decorate 74(VertexID) Location 0
+                              Decorate 79(clip0) BuiltIn ClipDistance
+               2:             TypeVoid
+               3:             TypeFunction 2
+               6:             TypeFloat 32
+               7:             TypeVector 6(float) 4
+               8:             TypeInt 32 0
+               9:      8(int) Constant 3
+              10:             TypeArray 7(fvec4) 9
+              11:             TypePointer Function 10
+              12:             TypeArray 8(int) 9
+              13:             TypePointer Function 12
+              14:             TypeVector 6(float) 2
+           15(S):             TypeStruct 7(fvec4) 14(fvec2) 14(fvec2)
+              16:             TypePointer Function 15(S)
+              17:             TypeArray 14(fvec2) 9
+              18:             TypePointer Function 17
+              19:             TypeFunction 2 11(ptr) 13(ptr) 16(ptr) 18(ptr) 18(ptr)
+              28:             TypeInt 32 1
+              29:     28(int) Constant 0
+              30:             TypePointer Function 7(fvec4)
+              34:     28(int) Constant 1
+              35:             TypePointer Function 14(fvec2)
+              39:     28(int) Constant 2
+              43:             TypePointer Output 7(fvec4)
+44(OutputStream.pos):     43(ptr) Variable Output
+              47:      8(int) Constant 4
+              48:             TypeArray 6(float) 47
+              49:             TypePointer Output 48
+50(OutputStream.clip1):     49(ptr) Variable Output
+              51:      8(int) Constant 0
+              52:             TypePointer Function 6(float)
+              55:             TypePointer Output 6(float)
+              57:      8(int) Constant 1
+              64:     28(int) Constant 3
+              69:             TypePointer Input 10
+         70(pos):     69(ptr) Variable Input
+              73:             TypePointer Input 12
+    74(VertexID):     73(ptr) Variable Input
+              77:             TypeArray 48 9
+              78:             TypePointer Input 77
+       79(clip0):     78(ptr) Variable Input
+              80:             TypePointer Input 6(float)
+         4(main):           2 Function None 3
+               5:             Label
+         68(pos):     11(ptr) Variable Function
+    72(VertexID):     13(ptr) Variable Function
+       76(clip0):     18(ptr) Variable Function
+       99(clip1):     18(ptr) Variable Function
+118(OutputStream):     16(ptr) Variable Function
+      119(param):     11(ptr) Variable Function
+      121(param):     13(ptr) Variable Function
+      123(param):     16(ptr) Variable Function
+      124(param):     18(ptr) Variable Function
+      126(param):     18(ptr) Variable Function
+              71:          10 Load 70(pos)
+                              Store 68(pos) 71
+              75:          12 Load 74(VertexID)
+                              Store 72(VertexID) 75
+              81:     80(ptr) AccessChain 79(clip0) 29 29
+              82:    6(float) Load 81
+              83:     52(ptr) AccessChain 76(clip0) 29 51
+                              Store 83 82
+              84:     80(ptr) AccessChain 79(clip0) 29 34
+              85:    6(float) Load 84
+              86:     52(ptr) AccessChain 76(clip0) 29 57
+                              Store 86 85
+              87:     80(ptr) AccessChain 79(clip0) 29 39
+              88:    6(float) Load 87
+              89:     52(ptr) AccessChain 76(clip0) 34 51
+                              Store 89 88
+              90:     80(ptr) AccessChain 79(clip0) 29 64
+              91:    6(float) Load 90
+              92:     52(ptr) AccessChain 76(clip0) 34 57
+                              Store 92 91
+              93:     80(ptr) AccessChain 79(clip0) 34 29
+              94:    6(float) Load 93
+              95:     52(ptr) AccessChain 76(clip0) 39 51
+                              Store 95 94
+              96:     80(ptr) AccessChain 79(clip0) 34 34
+              97:    6(float) Load 96
+              98:     52(ptr) AccessChain 76(clip0) 39 57
+                              Store 98 97
+             100:     80(ptr) AccessChain 79(clip0) 29 39
+             101:    6(float) Load 100
+             102:     52(ptr) AccessChain 99(clip1) 29 51
+                              Store 102 101
+             103:     80(ptr) AccessChain 79(clip0) 29 64
+             104:    6(float) Load 103
+             105:     52(ptr) AccessChain 99(clip1) 29 57
+                              Store 105 104
+             106:     80(ptr) AccessChain 79(clip0) 34 39
+             107:    6(float) Load 106
+             108:     52(ptr) AccessChain 99(clip1) 34 51
+                              Store 108 107
+             109:     80(ptr) AccessChain 79(clip0) 34 64
+             110:    6(float) Load 109
+             111:     52(ptr) AccessChain 99(clip1) 34 57
+                              Store 111 110
+             112:     80(ptr) AccessChain 79(clip0) 39 39
+             113:    6(float) Load 112
+             114:     52(ptr) AccessChain 99(clip1) 39 51
+                              Store 114 113
+             115:     80(ptr) AccessChain 79(clip0) 39 64
+             116:    6(float) Load 115
+             117:     52(ptr) AccessChain 99(clip1) 39 57
+                              Store 117 116
+             120:          10 Load 68(pos)
+                              Store 119(param) 120
+             122:          12 Load 72(VertexID)
+                              Store 121(param) 122
+             125:          17 Load 76(clip0)
+                              Store 124(param) 125
+             127:          17 Load 99(clip1)
+                              Store 126(param) 127
+             128:           2 FunctionCall 25(@main(vf4[3];u1[3];struct-S-vf4-vf2-vf21;vf2[3];vf2[3];) 119(param) 121(param) 123(param) 124(param) 126(param)
+             129:       15(S) Load 123(param)
+                              Store 118(OutputStream) 129
+                              Return
+                              FunctionEnd
+25(@main(vf4[3];u1[3];struct-S-vf4-vf2-vf21;vf2[3];vf2[3];):           2 Function None 19
+         20(pos):     11(ptr) FunctionParameter
+    21(VertexID):     13(ptr) FunctionParameter
+22(OutputStream):     16(ptr) FunctionParameter
+       23(clip0):     18(ptr) FunctionParameter
+       24(clip1):     18(ptr) FunctionParameter
+              26:             Label
+           27(s):     16(ptr) Variable Function
+              31:     30(ptr) AccessChain 20(pos) 29
+              32:    7(fvec4) Load 31
+              33:     30(ptr) AccessChain 27(s) 29
+                              Store 33 32
+              36:     35(ptr) AccessChain 23(clip0) 29
+              37:   14(fvec2) Load 36
+              38:     35(ptr) AccessChain 27(s) 34
+                              Store 38 37
+              40:     35(ptr) AccessChain 24(clip1) 29
+              41:   14(fvec2) Load 40
+              42:     35(ptr) AccessChain 27(s) 39
+                              Store 42 41
+              45:     30(ptr) AccessChain 27(s) 29
+              46:    7(fvec4) Load 45
+                              Store 44(OutputStream.pos) 46
+              53:     52(ptr) AccessChain 27(s) 34 51
+              54:    6(float) Load 53
+              56:     55(ptr) AccessChain 50(OutputStream.clip1) 29
+                              Store 56 54
+              58:     52(ptr) AccessChain 27(s) 34 57
+              59:    6(float) Load 58
+              60:     55(ptr) AccessChain 50(OutputStream.clip1) 34
+                              Store 60 59
+              61:     52(ptr) AccessChain 27(s) 39 51
+              62:    6(float) Load 61
+              63:     55(ptr) AccessChain 50(OutputStream.clip1) 39
+                              Store 63 62
+              65:     52(ptr) AccessChain 27(s) 39 57
+              66:    6(float) Load 65
+              67:     55(ptr) AccessChain 50(OutputStream.clip1) 64
+                              Store 67 66
+                              EmitVertex
+                              Return
+                              FunctionEnd
diff --git a/Test/baseResults/hlsl.semantic.geom.out b/Test/baseResults/hlsl.semantic.geom.out
index 38acc2732fc1e7843b2498743996ee60b15747e7..74f7a2681a6407ceae08864ad6af87015a3fe605 100755
--- a/Test/baseResults/hlsl.semantic.geom.out
+++ b/Test/baseResults/hlsl.semantic.geom.out
@@ -1,15 +1,10 @@
 hlsl.semantic.geom
-ERROR: 0:15: '' : unimplemented: clip/cull not currently implemented for this stage 
-ERROR: 0:15: '' : unimplemented: clip/cull not currently implemented for this stage 
-ERROR: 2 compilation errors.  No code generated.
-
-
 Shader version: 500
 invocations = -1
 max_vertices = 4
 input primitive = triangles
 output primitive = line_strip
-ERROR: node is still EOpNull!
+0:? Sequence
 0:13  Function Definition: @main(u1[3];struct-S-f1-f1-f1-u1-u1-i11; ( temp void)
 0:13    Function Parameters: 
 0:13      'VertexID' ( in 3-element array of uint)
@@ -23,6 +18,26 @@ ERROR: node is still EOpNull!
 0:15              's' ( temp structure{ temp float clip0,  temp float clip0,  temp float cull0,  temp uint vpai,  temp uint rtai,  temp int ii})
 0:15              Constant:
 0:15                0 (const int)
+0:?           Sequence
+0:15            move second child to first child ( temp float)
+0:15              direct index ( out float ClipDistance)
+0:?                 'OutputStream.clip0' ( out 1-element array of float ClipDistance)
+0:15                Constant:
+0:15                  0 (const int)
+0:15              clip0: direct index for structure ( temp float)
+0:15                's' ( temp structure{ temp float clip0,  temp float clip0,  temp float cull0,  temp uint vpai,  temp uint rtai,  temp int ii})
+0:15                Constant:
+0:15                  1 (const int)
+0:?           Sequence
+0:15            move second child to first child ( temp float)
+0:15              direct index ( out float CullDistance)
+0:?                 'OutputStream.cull0' ( out 1-element array of float CullDistance)
+0:15                Constant:
+0:15                  0 (const int)
+0:15              cull0: direct index for structure ( temp float)
+0:15                's' ( temp structure{ temp float clip0,  temp float clip0,  temp float cull0,  temp uint vpai,  temp uint rtai,  temp int ii})
+0:15                Constant:
+0:15                  2 (const int)
 0:15          move second child to first child ( temp uint)
 0:?             'OutputStream.vpai' ( out uint ViewportIndex)
 0:15            vpai: direct index for structure ( temp uint)
@@ -57,6 +72,8 @@ ERROR: node is still EOpNull!
 0:?     'OutputStream.vpai' ( out uint ViewportIndex)
 0:?     'OutputStream.rtai' ( out uint Layer)
 0:?     'OutputStream.ii' (layout( location=0) out int)
+0:?     'OutputStream.clip0' ( out 1-element array of float ClipDistance)
+0:?     'OutputStream.cull0' ( out 1-element array of float CullDistance)
 
 
 Linked geometry stage:
@@ -67,7 +84,7 @@ invocations = 1
 max_vertices = 4
 input primitive = triangles
 output primitive = line_strip
-ERROR: node is still EOpNull!
+0:? Sequence
 0:13  Function Definition: @main(u1[3];struct-S-f1-f1-f1-u1-u1-i11; ( temp void)
 0:13    Function Parameters: 
 0:13      'VertexID' ( in 3-element array of uint)
@@ -81,6 +98,26 @@ ERROR: node is still EOpNull!
 0:15              's' ( temp structure{ temp float clip0,  temp float clip0,  temp float cull0,  temp uint vpai,  temp uint rtai,  temp int ii})
 0:15              Constant:
 0:15                0 (const int)
+0:?           Sequence
+0:15            move second child to first child ( temp float)
+0:15              direct index ( out float ClipDistance)
+0:?                 'OutputStream.clip0' ( out 1-element array of float ClipDistance)
+0:15                Constant:
+0:15                  0 (const int)
+0:15              clip0: direct index for structure ( temp float)
+0:15                's' ( temp structure{ temp float clip0,  temp float clip0,  temp float cull0,  temp uint vpai,  temp uint rtai,  temp int ii})
+0:15                Constant:
+0:15                  1 (const int)
+0:?           Sequence
+0:15            move second child to first child ( temp float)
+0:15              direct index ( out float CullDistance)
+0:?                 'OutputStream.cull0' ( out 1-element array of float CullDistance)
+0:15                Constant:
+0:15                  0 (const int)
+0:15              cull0: direct index for structure ( temp float)
+0:15                's' ( temp structure{ temp float clip0,  temp float clip0,  temp float cull0,  temp uint vpai,  temp uint rtai,  temp int ii})
+0:15                Constant:
+0:15                  2 (const int)
 0:15          move second child to first child ( temp uint)
 0:?             'OutputStream.vpai' ( out uint ViewportIndex)
 0:15            vpai: direct index for structure ( temp uint)
@@ -115,5 +152,129 @@ ERROR: node is still EOpNull!
 0:?     'OutputStream.vpai' ( out uint ViewportIndex)
 0:?     'OutputStream.rtai' ( out uint Layer)
 0:?     'OutputStream.ii' (layout( location=0) out int)
+0:?     'OutputStream.clip0' ( out 1-element array of float ClipDistance)
+0:?     'OutputStream.cull0' ( out 1-element array of float CullDistance)
+
+// Module Version 10000
+// Generated by (magic number): 80001
+// Id's are bound by 65
 
-SPIR-V is not generated for failed compile or link
+                              Capability Geometry
+                              Capability ClipDistance
+                              Capability CullDistance
+                              Capability MultiViewport
+               1:             ExtInstImport  "GLSL.std.450"
+                              MemoryModel Logical GLSL450
+                              EntryPoint Geometry 4  "main" 20 29 34 40 45 50 57
+                              ExecutionMode 4 Triangles
+                              ExecutionMode 4 Invocations 1
+                              ExecutionMode 4 OutputLineStrip
+                              ExecutionMode 4 OutputVertices 4
+                              Source HLSL 500
+                              Name 4  "main"
+                              Name 12  "S"
+                              MemberName 12(S) 0  "clip0"
+                              MemberName 12(S) 1  "clip0"
+                              MemberName 12(S) 2  "cull0"
+                              MemberName 12(S) 3  "vpai"
+                              MemberName 12(S) 4  "rtai"
+                              MemberName 12(S) 5  "ii"
+                              Name 17  "@main(u1[3];struct-S-f1-f1-f1-u1-u1-i11;"
+                              Name 15  "VertexID"
+                              Name 16  "OutputStream"
+                              Name 20  "OutputStream.clip0"
+                              Name 21  "s"
+                              Name 29  "OutputStream.clip0"
+                              Name 34  "OutputStream.cull0"
+                              Name 40  "OutputStream.vpai"
+                              Name 45  "OutputStream.rtai"
+                              Name 50  "OutputStream.ii"
+                              Name 55  "VertexID"
+                              Name 57  "VertexID"
+                              Name 59  "OutputStream"
+                              Name 60  "param"
+                              Name 62  "param"
+                              Decorate 20(OutputStream.clip0) BuiltIn Position
+                              Decorate 29(OutputStream.clip0) BuiltIn ClipDistance
+                              Decorate 34(OutputStream.cull0) BuiltIn CullDistance
+                              Decorate 40(OutputStream.vpai) BuiltIn ViewportIndex
+                              Decorate 45(OutputStream.rtai) BuiltIn Layer
+                              Decorate 50(OutputStream.ii) Location 0
+                              Decorate 57(VertexID) Location 0
+               2:             TypeVoid
+               3:             TypeFunction 2
+               6:             TypeInt 32 0
+               7:      6(int) Constant 3
+               8:             TypeArray 6(int) 7
+               9:             TypePointer Function 8
+              10:             TypeFloat 32
+              11:             TypeInt 32 1
+           12(S):             TypeStruct 10(float) 10(float) 10(float) 6(int) 6(int) 11(int)
+              13:             TypePointer Function 12(S)
+              14:             TypeFunction 2 9(ptr) 13(ptr)
+              19:             TypePointer Output 10(float)
+20(OutputStream.clip0):     19(ptr) Variable Output
+              22:     11(int) Constant 0
+              23:             TypePointer Function 10(float)
+              26:      6(int) Constant 1
+              27:             TypeArray 10(float) 26
+              28:             TypePointer Output 27
+29(OutputStream.clip0):     28(ptr) Variable Output
+              30:     11(int) Constant 1
+34(OutputStream.cull0):     28(ptr) Variable Output
+              35:     11(int) Constant 2
+              39:             TypePointer Output 6(int)
+40(OutputStream.vpai):     39(ptr) Variable Output
+              41:     11(int) Constant 3
+              42:             TypePointer Function 6(int)
+45(OutputStream.rtai):     39(ptr) Variable Output
+              46:     11(int) Constant 4
+              49:             TypePointer Output 11(int)
+50(OutputStream.ii):     49(ptr) Variable Output
+              51:     11(int) Constant 5
+              52:             TypePointer Function 11(int)
+              56:             TypePointer Input 8
+    57(VertexID):     56(ptr) Variable Input
+         4(main):           2 Function None 3
+               5:             Label
+    55(VertexID):      9(ptr) Variable Function
+59(OutputStream):     13(ptr) Variable Function
+       60(param):      9(ptr) Variable Function
+       62(param):     13(ptr) Variable Function
+              58:           8 Load 57(VertexID)
+                              Store 55(VertexID) 58
+              61:           8 Load 55(VertexID)
+                              Store 60(param) 61
+              63:           2 FunctionCall 17(@main(u1[3];struct-S-f1-f1-f1-u1-u1-i11;) 60(param) 62(param)
+              64:       12(S) Load 62(param)
+                              Store 59(OutputStream) 64
+                              Return
+                              FunctionEnd
+17(@main(u1[3];struct-S-f1-f1-f1-u1-u1-i11;):           2 Function None 14
+    15(VertexID):      9(ptr) FunctionParameter
+16(OutputStream):     13(ptr) FunctionParameter
+              18:             Label
+           21(s):     13(ptr) Variable Function
+              24:     23(ptr) AccessChain 21(s) 22
+              25:   10(float) Load 24
+                              Store 20(OutputStream.clip0) 25
+              31:     23(ptr) AccessChain 21(s) 30
+              32:   10(float) Load 31
+              33:     19(ptr) AccessChain 29(OutputStream.clip0) 22
+                              Store 33 32
+              36:     23(ptr) AccessChain 21(s) 35
+              37:   10(float) Load 36
+              38:     19(ptr) AccessChain 34(OutputStream.cull0) 22
+                              Store 38 37
+              43:     42(ptr) AccessChain 21(s) 41
+              44:      6(int) Load 43
+                              Store 40(OutputStream.vpai) 44
+              47:     42(ptr) AccessChain 21(s) 46
+              48:      6(int) Load 47
+                              Store 45(OutputStream.rtai) 48
+              53:     52(ptr) AccessChain 21(s) 51
+              54:     11(int) Load 53
+                              Store 50(OutputStream.ii) 54
+                              EmitVertex
+                              Return
+                              FunctionEnd
diff --git a/Test/hlsl.clipdistance-1.geom b/Test/hlsl.clipdistance-1.geom
index d056ebd04dc21e8faf8a17697fb03fcacbbf15bc..76c34b355185e148e454f04a2eed71d8a547e876 100644
--- a/Test/hlsl.clipdistance-1.geom
+++ b/Test/hlsl.clipdistance-1.geom
@@ -1,21 +1,18 @@
 struct S {
-    float4 pos   : SV_Position;
-    float  clip  : SV_ClipDistance0;
-    float  cull  : SV_CullDistance0;
+    float4 pos     : SV_Position;
+    float2 clip    : SV_ClipDistance0;
 };
 
 [maxvertexcount(3)]
 void main(triangle in float4 pos[3] : SV_Position, 
           triangle in uint VertexID[3] : VertexID,
           inout LineStream<S> OutputStream,
-          triangle in float clip[3] : SV_ClipDistance,  // scalar float
-          triangle in float cull[3] : SV_CullDistance)  // scalar float
+          triangle in float4 clip[3] : SV_ClipDistance)   // externally: an array 3 of array 4 (not vec4!) of float.
 {
     S s;
 
     s.pos = pos[0];
-    s.clip = clip[0];
-    s.cull = cull[0];
+    s.clip = clip[0].xy;
 
     OutputStream.Append(s);
 }
diff --git a/Test/hlsl.clipdistance-2.geom b/Test/hlsl.clipdistance-2.geom
index 49d27349b2f48d6ff27b50bf54ad26f1005c312d..90f047feb7e6cba592946ff727415193b76b5fb7 100644
--- a/Test/hlsl.clipdistance-2.geom
+++ b/Test/hlsl.clipdistance-2.geom
@@ -7,7 +7,7 @@ struct S {
 void main(triangle in float4 pos[3] : SV_Position, 
           triangle in uint VertexID[3] : VertexID,
           inout LineStream<S> OutputStream,
-          triangle in float2 clip[3][2] : SV_ClipDistance)  // scalar float
+          triangle in float2 clip[3][2] : SV_ClipDistance) // externally: an array 3 of array 4 of float.
 {
     S s;
 
diff --git a/Test/hlsl.clipdistance-3.frag b/Test/hlsl.clipdistance-3.frag
index c590fa4f5be9297c55dbb3f5daeca7e370d9fac9..e2b6b8627e7f1e7fee806ea1fba5278be1e15d00 100644
--- a/Test/hlsl.clipdistance-3.frag
+++ b/Test/hlsl.clipdistance-3.frag
@@ -4,5 +4,3 @@ float4 main(in float4 pos : SV_Position,
 {
     return pos + clip[0] + cull[0];
 }
-
-
diff --git a/Test/hlsl.clipdistance-3.geom b/Test/hlsl.clipdistance-3.geom
new file mode 100644
index 0000000000000000000000000000000000000000..2aa4cd46d410c92d0ce4b37102dfbad797edf486
--- /dev/null
+++ b/Test/hlsl.clipdistance-3.geom
@@ -0,0 +1,20 @@
+struct S {
+    float4 pos     : SV_Position;
+    float2 clip0   : SV_ClipDistance0;  // clip0 and clip1 form an array of float[4] externally.
+    float2 clip1   : SV_ClipDistance1;
+};
+
+[maxvertexcount(3)]
+void main(triangle in float4 pos[3] : SV_Position, 
+          triangle in uint VertexID[3] : VertexID,
+          inout LineStream<S> OutputStream,
+          triangle in float4 clip[3] : SV_ClipDistance)   // externally: an array 3 of array 4 (not vec4!) of float.
+{
+    S s;
+
+    s.pos = pos[0];
+    s.clip0 = clip[0].xy;
+    s.clip1 = clip[0].zw;
+
+    OutputStream.Append(s);
+}
diff --git a/Test/hlsl.clipdistance-4.geom b/Test/hlsl.clipdistance-4.geom
new file mode 100644
index 0000000000000000000000000000000000000000..ff296a88ce35dabaaa14d7acb0de6238d182f37e
--- /dev/null
+++ b/Test/hlsl.clipdistance-4.geom
@@ -0,0 +1,21 @@
+struct S {
+    float4 pos     : SV_Position;
+    float2 clip0   : SV_ClipDistance0;  // clip0 and clip1 form an array of float[4] externally.
+    float2 clip1   : SV_ClipDistance1;
+};
+
+[maxvertexcount(3)]
+void main(triangle in float4 pos[3] : SV_Position, 
+          triangle in uint VertexID[3] : VertexID,
+          inout LineStream<S> OutputStream,
+          triangle in float2 clip0[3] : SV_ClipDistance0,  // test input arrayed semantic vars
+          triangle in float2 clip1[3] : SV_ClipDistance1)
+{
+    S s;
+
+    s.pos = pos[0];
+    s.clip0 = clip0[0];
+    s.clip1 = clip1[0];
+
+    OutputStream.Append(s);
+}
diff --git a/gtests/Hlsl.FromFile.cpp b/gtests/Hlsl.FromFile.cpp
index 0488eb7924cd1ec529aa7ef2340f1b878e384a0d..933d5139279edb1c1f44cc9994f8cbee81b64aa8 100644
--- a/gtests/Hlsl.FromFile.cpp
+++ b/gtests/Hlsl.FromFile.cpp
@@ -104,8 +104,10 @@ INSTANTIATE_TEST_CASE_P(
         {"hlsl.clipdistance-2.geom", "main"},
         {"hlsl.clipdistance-2.vert", "main"},
         {"hlsl.clipdistance-3.frag", "main"},
+        {"hlsl.clipdistance-3.geom", "main"},
         {"hlsl.clipdistance-3.vert", "main"},
         {"hlsl.clipdistance-4.frag", "main"},
+        {"hlsl.clipdistance-4.geom", "main"},
         {"hlsl.clipdistance-4.vert", "main"},
         {"hlsl.clipdistance-5.frag", "main"},
         {"hlsl.clipdistance-5.vert", "main"},
diff --git a/hlsl/hlslParseHelper.cpp b/hlsl/hlslParseHelper.cpp
index 9ad7198403c9271509cdb530b03bb7048d5aa0d7..3ee599c443437dc34c1b3e82e93942507e2551a2 100755
--- a/hlsl/hlslParseHelper.cpp
+++ b/hlsl/hlslParseHelper.cpp
@@ -66,8 +66,10 @@ HlslParseContext::HlslParseContext(TSymbolTable& symbolTable, TIntermediate& int
     entryPointFunction(nullptr),
     entryPointFunctionBody(nullptr),
     gsStreamOutput(nullptr),
-    clipDistanceVariable(nullptr),
-    cullDistanceVariable(nullptr)
+    clipDistanceInput(nullptr),
+    cullDistanceInput(nullptr),
+    clipDistanceOutput(nullptr),
+    cullDistanceOutput(nullptr)
 {
     globalUniformDefaults.clear();
     globalUniformDefaults.layoutMatrix = ElmRowMajor;
@@ -80,8 +82,10 @@ HlslParseContext::HlslParseContext(TSymbolTable& symbolTable, TIntermediate& int
     globalInputDefaults.clear();
     globalOutputDefaults.clear();
 
-    clipSemanticNSize.fill(0);
-    cullSemanticNSize.fill(0);
+    clipSemanticNSizeIn.fill(0);
+    cullSemanticNSizeIn.fill(0);
+    clipSemanticNSizeOut.fill(0);
+    cullSemanticNSizeOut.fill(0);
 
     // "Shaders in the transform
     // feedback capturing mode have an initial global default of
@@ -1152,14 +1156,18 @@ void HlslParseContext::splitBuiltIn(const TString& baseName, const TType& member
     if (arraySizes != nullptr && !memberType.isArray())
         ioVar->getWritableType().newArraySizes(*arraySizes);
 
-    fixBuiltInIoType(ioVar->getWritableType());
-
     splitBuiltIns[tInterstageIoData(memberType.getQualifier().builtIn, outerQualifier.storage)] = ioVar;
     if (!isClipOrCullDistance(ioVar->getType()))
         trackLinkage(*ioVar);
 
     // Merge qualifier from the user structure
     mergeQualifiers(ioVar->getWritableType().getQualifier(), outerQualifier);
+
+    // Fix the builtin type if needed (e.g, some types require fixed array sizes, no matter how the
+    // shader declared them).  This is done after mergeQualifiers(), in case fixBuiltInIoType looks
+    // at the qualifier to determine e.g, in or out qualifications.
+    fixBuiltInIoType(ioVar->getWritableType());
+
     // But, not location, we're losing that
     ioVar->getWritableType().getQualifier().layoutLocation = TQualifier::layoutLocationEnd;
 }
@@ -1483,10 +1491,18 @@ void HlslParseContext::fixBuiltInIoType(TType& type)
         }
     default:
         if (isClipOrCullDistance(type)) {
+            const int loc = type.getQualifier().layoutLocation;
+
             if (type.getQualifier().builtIn == EbvClipDistance) {
-                clipSemanticNSize[type.getQualifier().layoutLocation] = type.getVectorSize();
+                if (type.getQualifier().storage == EvqVaryingIn)
+                    clipSemanticNSizeIn[loc] = type.getVectorSize();
+                else
+                    clipSemanticNSizeOut[loc] = type.getVectorSize();
             } else {
-                cullSemanticNSize[type.getQualifier().layoutLocation] = type.getVectorSize();
+                if (type.getQualifier().storage == EvqVaryingIn)
+                    cullSemanticNSizeIn[loc] = type.getVectorSize();
+                else
+                    cullSemanticNSizeOut[loc] = type.getVectorSize();
             }
         }
 
@@ -2274,6 +2290,7 @@ TIntermAggregate* HlslParseContext::assignClipCullDistance(const TSourceLoc& loc
     switch (language) {
     case EShLangFragment:
     case EShLangVertex:
+    case EShLangGeometry:
         break;
     default:
         error(loc, "unimplemented: clip/cull not currently implemented for this stage", "", "");
@@ -2292,17 +2309,17 @@ TIntermAggregate* HlslParseContext::assignClipCullDistance(const TSourceLoc& loc
 
     const TBuiltInVariable builtInType = clipCullNode->getQualifier().builtIn;
 
-    decltype(clipSemanticNSize)* semanticNSize = nullptr;
+    decltype(clipSemanticNSizeIn)* semanticNSize = nullptr;
 
     // Refer to either the clip or the cull distance, depending on semantic.
     switch (builtInType) {
     case EbvClipDistance:
-        clipCullVar = &clipDistanceVariable;
-        semanticNSize = &clipSemanticNSize;
+        clipCullVar = isOutput ? &clipDistanceOutput : &clipDistanceInput;
+        semanticNSize = isOutput ? &clipSemanticNSizeOut : &clipSemanticNSizeIn;
         break;
     case EbvCullDistance:
-        clipCullVar = &cullDistanceVariable;
-        semanticNSize = &cullSemanticNSize;
+        clipCullVar = isOutput ? &cullDistanceOutput : &cullDistanceInput;
+        semanticNSize = isOutput ? &cullSemanticNSizeOut : &cullSemanticNSizeIn;
         break;
 
     // called invalidly: we expected a clip or a cull distance.
@@ -2328,28 +2345,48 @@ TIntermAggregate* HlslParseContext::assignClipCullDistance(const TSourceLoc& loc
         vecItems += (*semanticNSize)[x];
         arrayLoc += (*semanticNSize)[x];
     }
-        
-    // array sizes, or 1 if it's not an array:
-    const int internalNodeArraySize = (internalNode->getType().isArray() ? internalNode->getType().getOuterArraySize() : 1);
+ 
+
+    // It can have up to 2 array dimensions (in the case of geometry shader inputs)
+    const TArraySizes* const internalArraySizes = internalNode->getType().getArraySizes();
+    const int internalArrayDims = internalNode->getType().isArray() ? internalArraySizes->getNumDims() : 0;
     // vector sizes:
-    const int internalNodeVectorSize = internalNode->getType().getVectorSize();
+    const int internalVectorSize = internalNode->getType().getVectorSize();
+    // array sizes, or 1 if it's not an array:
+    const int internalInnerArraySize = (internalArrayDims > 0 ? internalArraySizes->getDimSize(internalArrayDims-1) : 1);
+    const int internalOuterArraySize = (internalArrayDims > 1 ? internalArraySizes->getDimSize(0) : 1);
+
+    // The created type may be an array of arrays, e.g, for geometry shader inputs.
+    const bool isImplicitlyArrayed = (language == EShLangGeometry && !isOutput);
 
     // If we haven't created the output already, create it now.
     if (*clipCullVar == nullptr) {
         // ClipDistance and CullDistance are handled specially in the entry point input/output copy
         // algorithm, because they may need to be unpacked from components of vectors (or a scalar)
         // into a float array, or vice versa.  Here, we make the array the right size and type,
-        // which depends on the incoming data, which has several potential dimensions: Semantic ID
-        // vector size array size Of those, semantic ID and array size cannot appear
-        // simultaneously.
-        const int requiredArraySize = arrayLoc * internalNodeArraySize;
+        // which depends on the incoming data, which has several potential dimensions:
+        //    * Semantic ID
+        //    * vector size 
+        //    * array size
+        // Of those, semantic ID and array size cannot appear simultaneously.
+        //
+        // Also to note: for implicitly arrayed forms (e.g, geometry shader inputs), we need to create two
+        // array dimensions.  The shader's declaration may have one or two array dimensions.  One is always
+        // the geometry's dimension.
+
+        const bool useInnerSize = internalArrayDims > 1 || !isImplicitlyArrayed;
+
+        const int requiredInnerArraySize = arrayLoc * (useInnerSize ? internalInnerArraySize : 1);
+        const int requiredOuterArraySize = (internalArrayDims > 0) ? internalArraySizes->getDimSize(0) : 1;
 
         TType clipCullType(EbtFloat, clipCullNode->getType().getQualifier().storage, 1);
         clipCullType.getQualifier() = clipCullNode->getType().getQualifier();
 
         // Create required array dimension
         TArraySizes arraySizes;
-        arraySizes.addInnerSize(requiredArraySize);
+        if (isImplicitlyArrayed)
+            arraySizes.addInnerSize(requiredOuterArraySize);
+        arraySizes.addInnerSize(requiredInnerArraySize);
         clipCullType.newArraySizes(arraySizes);
 
         // Obtain symbol name: we'll use that for the symbol we introduce.
@@ -2369,10 +2406,13 @@ TIntermAggregate* HlslParseContext::assignClipCullDistance(const TSourceLoc& loc
     // Create symbol for the clip or cull variable.
     TIntermSymbol* clipCullSym = intermediate.addSymbol(**clipCullVar);
 
-    // array sizes, or 1 if it's not an array:
-    const int clipCullSymArraySize = (clipCullSym->getType().isArray() ? clipCullSym->getType().getOuterArraySize() : 1);
     // vector sizes:
-    const int clipCullSymVectorSize = clipCullSym->getType().getVectorSize();
+    const int clipCullVectorSize = clipCullSym->getType().getVectorSize();
+
+    // array sizes, or 1 if it's not an array:
+    const TArraySizes* const clipCullArraySizes = clipCullSym->getType().getArraySizes();
+    const int clipCullOuterArraySize = isImplicitlyArrayed ? clipCullArraySizes->getDimSize(0) : 1;
+    const int clipCullInnerArraySize = clipCullArraySizes->getDimSize(isImplicitlyArrayed ? 1 : 0);
 
     // clipCullSym has got to be an array of scalar floats, per SPIR-V semantics.
     // fixBuiltInIoType() should have handled that upstream.
@@ -2390,8 +2430,9 @@ TIntermAggregate* HlslParseContext::assignClipCullDistance(const TSourceLoc& loc
     // If the types are homomorphic, use a simple assign.  No need to mess about with 
     // individual components.
     if (clipCullSym->getType().isArray() == internalNode->getType().isArray() &&
-        clipCullSymArraySize == internalNodeArraySize &&
-        clipCullSymVectorSize == internalNodeVectorSize) {
+        clipCullInnerArraySize == internalInnerArraySize &&
+        clipCullOuterArraySize == internalOuterArraySize &&
+        clipCullVectorSize == internalVectorSize) {
 
         if (isOutput)
             clipCullAssign = intermediate.addAssign(op, clipCullSym, internalNode, loc);
@@ -2407,47 +2448,61 @@ TIntermAggregate* HlslParseContext::assignClipCullDistance(const TSourceLoc& loc
     // We are going to copy each component of the internal (per array element if indicated) to sequential
     // array elements of the clipCullSym.  This tracks the lhs element we're writing to as we go along.
     // We may be starting in the middle - e.g, for a non-zero semantic ID calculated above.
-    int clipCullArrayPos = semanticOffset[semanticId];
+    int clipCullInnerArrayPos = semanticOffset[semanticId];
+    int clipCullOuterArrayPos = 0;
+
+    // Lambda to add an index to a node, set the type of the result, and return the new node.
+    const auto addIndex = [this, &loc](TIntermTyped* node, int pos) -> TIntermTyped* {
+        const TType derefType(node->getType(), 0);
+        node = intermediate.addIndex(EOpIndexDirect, node, intermediate.addConstantUnion(pos, loc), loc);
+        node->setType(derefType);
+        return node;
+    };
 
     // Loop through every component of every element of the internal, and copy to or from the matching external.
-    for (int internalArrayPos = 0; internalArrayPos < internalNodeArraySize; ++internalArrayPos) {
-        for (int internalComponent = 0; internalComponent < internalNodeVectorSize; ++internalComponent) {
-            TIntermTyped* clipCullMember = clipCullSym;
+    for (int internalOuterArrayPos = 0; internalOuterArrayPos < internalOuterArraySize; ++internalOuterArrayPos) {
+        for (int internalInnerArrayPos = 0; internalInnerArrayPos < internalInnerArraySize; ++internalInnerArrayPos) {
+            for (int internalComponent = 0; internalComponent < internalVectorSize; ++internalComponent) {
+                // clip/cull array member to read from / write to:
+                TIntermTyped* clipCullMember = clipCullSym;
+
+                // If implicitly arrayed, there is an outer array dimension involved
+                if (isImplicitlyArrayed)
+                    clipCullMember = addIndex(clipCullMember, clipCullOuterArrayPos);
+
+                // Index into proper array position for clip cull member
+                clipCullMember = addIndex(clipCullMember, clipCullInnerArrayPos++);
+
+                // if needed, start over with next outer array slice.
+                if (isImplicitlyArrayed && clipCullInnerArrayPos >= clipCullInnerArraySize) {
+                    clipCullInnerArrayPos = semanticOffset[semanticId];
+                    ++clipCullOuterArrayPos;
+                }
 
-            // array member to read from / write to:
-            {
-                const TType derefType(clipCullMember->getType(), 0);
-                clipCullMember = intermediate.addIndex(EOpIndexDirect, clipCullMember,
-                                                       intermediate.addConstantUnion(clipCullArrayPos++, loc), loc);
-                clipCullMember->setType(derefType);
-            }
+                // internal member to read from / write to:
+                TIntermTyped* internalMember = internalNode;
 
-            TIntermTyped* internalMember = internalNode;
+                // If internal node has outer array dimension, index appropriately.
+                if (internalArrayDims > 1)
+                    internalMember = addIndex(internalMember, internalOuterArrayPos);
 
-            // If internal node is an array, extract the element of interest
-            if (internalNode->getType().isArray()) {
-                const TType derefType(internalMember->getType(), 0);
-                internalMember = intermediate.addIndex(EOpIndexDirect, internalMember,
-                                                  intermediate.addConstantUnion(internalArrayPos, loc), loc);
-                internalMember->setType(derefType);
-            }
+                // If internal node has inner array dimension, index appropriately.
+                if (internalArrayDims > 0)
+                    internalMember = addIndex(internalMember, internalInnerArrayPos);
 
-            // If internal node is a vector, extract the component of interest.
-            if (internalNode->getType().isVector()) {
-                const TType derefType(internalMember->getType(), 0);
-                internalMember = intermediate.addIndex(EOpIndexDirect, internalMember,
-                                                  intermediate.addConstantUnion(internalComponent, loc), loc);
-                internalMember->setType(derefType);
-            }
+                // If internal node is a vector, extract the component of interest.
+                if (internalNode->getType().isVector())
+                    internalMember = addIndex(internalMember, internalComponent);
 
-            // Create an assignment: output from internal to clip cull, or input from clip cull to internal.
-            if (isOutput)
-                clipCullAssign = intermediate.addAssign(op, clipCullMember, internalMember, loc);
-            else
-                clipCullAssign = intermediate.addAssign(op, internalMember, clipCullMember, loc);
+                // Create an assignment: output from internal to clip cull, or input from clip cull to internal.
+                if (isOutput)
+                    clipCullAssign = intermediate.addAssign(op, clipCullMember, internalMember, loc);
+                else
+                    clipCullAssign = intermediate.addAssign(op, internalMember, clipCullMember, loc);
 
-            // Track assignment in the sequence.
-            assignList = intermediate.growAggregate(assignList, clipCullAssign);
+                // Track assignment in the sequence.
+                assignList = intermediate.growAggregate(assignList, clipCullAssign);
+            }
         }
     }
 
diff --git a/hlsl/hlslParseHelper.h b/hlsl/hlslParseHelper.h
index e545109cd29aacff77d0cbf7765912991ecf467a..a276d6e938776bf14479e4e772bfa3c7bd00cd43 100755
--- a/hlsl/hlslParseHelper.h
+++ b/hlsl/hlslParseHelper.h
@@ -435,12 +435,16 @@ protected:
 
     TVariable* gsStreamOutput;               // geometry shader stream outputs, for emit (Append method)
 
-    TVariable* clipDistanceVariable;         // synthesized clip distance variable (shader might have >1)
-    TVariable* cullDistanceVariable;         // synthesized cull distance variable (shader might have >1)
+    TVariable* clipDistanceOutput;           // synthesized clip distance out variable (shader might have >1)
+    TVariable* cullDistanceOutput;           // synthesized cull distance out variable (shader might have >1)
+    TVariable* clipDistanceInput;            // synthesized clip distance in variable (shader might have >1)
+    TVariable* cullDistanceInput;            // synthesized cull distance in variable (shader might have >1)
 
     static const int maxClipCullRegs = 2;
-    std::array<int, maxClipCullRegs> clipSemanticNSize; // vector, indexed by clip semantic ID
-    std::array<int, maxClipCullRegs> cullSemanticNSize; // vector, indexed by cull semantic ID
+    std::array<int, maxClipCullRegs> clipSemanticNSizeIn;  // vector, indexed by clip semantic ID
+    std::array<int, maxClipCullRegs> cullSemanticNSizeIn;  // vector, indexed by cull semantic ID
+    std::array<int, maxClipCullRegs> clipSemanticNSizeOut; // vector, indexed by clip semantic ID
+    std::array<int, maxClipCullRegs> cullSemanticNSizeOut; // vector, indexed by cull semantic ID
 
     // This tracks the first (mip level) argument to the .mips[][] operator.  Since this can be nested as
     // in tx.mips[tx.mips[0][1].x][2], we need a stack.  We also track the TSourceLoc for error reporting