Browse Source

Updated glslang.

Branimir Karadžić 8 years ago
parent
commit
1d44a7a030
59 changed files with 6684 additions and 3304 deletions
  1. 61 17
      3rdparty/glslang/SPIRV/GlslangToSpv.cpp
  2. 10 0
      3rdparty/glslang/SPIRV/SpvBuilder.h
  3. 4 4
      3rdparty/glslang/Test/baseResults/hlsl.attribute.frag.out
  4. 5 5
      3rdparty/glslang/Test/baseResults/hlsl.basic.geom.out
  5. 122 0
      3rdparty/glslang/Test/baseResults/hlsl.clip.frag.out
  6. 98 92
      3rdparty/glslang/Test/baseResults/hlsl.conditional.frag.out
  7. 35 31
      3rdparty/glslang/Test/baseResults/hlsl.discard.frag.out
  8. 393 0
      3rdparty/glslang/Test/baseResults/hlsl.domain.1.tese.out
  9. 98 75
      3rdparty/glslang/Test/baseResults/hlsl.hull.1.tesc.out
  10. 110 87
      3rdparty/glslang/Test/baseResults/hlsl.hull.2.tesc.out
  11. 612 0
      3rdparty/glslang/Test/baseResults/hlsl.hull.ctrlpt-1.tesc.out
  12. 49 35
      3rdparty/glslang/Test/baseResults/hlsl.hull.void.tesc.out
  13. 65 61
      3rdparty/glslang/Test/baseResults/hlsl.if.frag.out
  14. 549 0
      3rdparty/glslang/Test/baseResults/hlsl.implicitBool.frag.out
  15. 335 0
      3rdparty/glslang/Test/baseResults/hlsl.intrinsic.frexp.frag.out
  16. 221 0
      3rdparty/glslang/Test/baseResults/hlsl.intrinsic.frexp.vert.out
  17. 1366 1402
      3rdparty/glslang/Test/baseResults/hlsl.intrinsics.frag.out
  18. 3 6
      3rdparty/glslang/Test/baseResults/hlsl.intrinsics.negative.frag.out
  19. 110 108
      3rdparty/glslang/Test/baseResults/hlsl.intrinsics.promote.frag.out
  20. 9 9
      3rdparty/glslang/Test/baseResults/hlsl.intrinsics.promote.outputs.frag.out
  21. 672 690
      3rdparty/glslang/Test/baseResults/hlsl.intrinsics.vert.out
  22. 130 128
      3rdparty/glslang/Test/baseResults/hlsl.load.buffer.dx10.frag.out
  23. 133 131
      3rdparty/glslang/Test/baseResults/hlsl.load.buffer.float.dx10.frag.out
  24. 71 65
      3rdparty/glslang/Test/baseResults/hlsl.logical.unary.frag.out
  25. 233 0
      3rdparty/glslang/Test/baseResults/hlsl.logicalConvert.frag.out
  26. 44 43
      3rdparty/glslang/Test/baseResults/hlsl.multiEntry.vert.out
  27. 180 0
      3rdparty/glslang/Test/baseResults/hlsl.namespace.frag.out
  28. 111 0
      3rdparty/glslang/Test/baseResults/hlsl.scalar-length.frag.out
  29. 7 5
      3rdparty/glslang/Test/baseResults/spv.bool.vert.out
  30. 40 38
      3rdparty/glslang/Test/baseResults/spv.deepRvalue.frag.out
  31. 11 9
      3rdparty/glslang/Test/baseResults/spv.image.frag.out
  32. 4 2
      3rdparty/glslang/Test/baseResults/spv.specConstantOperations.vert.out
  33. 12 0
      3rdparty/glslang/Test/hlsl.clip.frag
  34. 32 0
      3rdparty/glslang/Test/hlsl.domain.1.tese
  35. 43 0
      3rdparty/glslang/Test/hlsl.hull.ctrlpt-1.tesc
  36. 32 0
      3rdparty/glslang/Test/hlsl.implicitBool.frag
  37. 37 0
      3rdparty/glslang/Test/hlsl.intrinsic.frexp.frag
  38. 28 0
      3rdparty/glslang/Test/hlsl.intrinsic.frexp.vert
  39. 0 5
      3rdparty/glslang/Test/hlsl.intrinsics.frag
  40. 0 5
      3rdparty/glslang/Test/hlsl.intrinsics.vert
  41. 15 0
      3rdparty/glslang/Test/hlsl.logicalConvert.frag
  42. 23 0
      3rdparty/glslang/Test/hlsl.namespace.frag
  43. 6 0
      3rdparty/glslang/Test/hlsl.scalar-length.frag
  44. 2 2
      3rdparty/glslang/glslang/Include/revision.h
  45. 3 3
      3rdparty/glslang/glslang/MachineIndependent/Intermediate.cpp
  46. 1 1
      3rdparty/glslang/glslang/MachineIndependent/ParseContextBase.cpp
  47. 3 3
      3rdparty/glslang/glslang/MachineIndependent/ParseHelper.cpp
  48. 4 4
      3rdparty/glslang/glslang/MachineIndependent/ParseHelper.h
  49. 7 0
      3rdparty/glslang/glslang/MachineIndependent/intermOut.cpp
  50. 4 4
      3rdparty/glslang/glslang/MachineIndependent/iomapper.cpp
  51. 6 4
      3rdparty/glslang/glslang/MachineIndependent/linkValidate.cpp
  52. 10 1
      3rdparty/glslang/gtests/Hlsl.FromFile.cpp
  53. 136 72
      3rdparty/glslang/hlsl/hlslGrammar.cpp
  54. 3 4
      3rdparty/glslang/hlsl/hlslGrammar.h
  55. 366 141
      3rdparty/glslang/hlsl/hlslParseHelper.cpp
  56. 15 10
      3rdparty/glslang/hlsl/hlslParseHelper.h
  57. 2 2
      3rdparty/glslang/hlsl/hlslParseables.cpp
  58. 2 0
      3rdparty/glslang/hlsl/hlslScanContext.cpp
  59. 1 0
      3rdparty/glslang/hlsl/hlslTokens.h

+ 61 - 17
3rdparty/glslang/SPIRV/GlslangToSpv.cpp

@@ -869,14 +869,20 @@ TGlslangToSpvTraverser::TGlslangToSpvTraverser(const glslang::TIntermediate* gls
         builder.addCapability(spv::CapabilityShader);
         builder.addCapability(spv::CapabilityShader);
         break;
         break;
 
 
+    case EShLangTessEvaluation:
     case EShLangTessControl:
     case EShLangTessControl:
         builder.addCapability(spv::CapabilityTessellation);
         builder.addCapability(spv::CapabilityTessellation);
-        builder.addExecutionMode(shaderEntry, spv::ExecutionModeOutputVertices, glslangIntermediate->getVertices());
-        break;
 
 
-    case EShLangTessEvaluation:
-        builder.addCapability(spv::CapabilityTessellation);
-        switch (glslangIntermediate->getInputPrimitive()) {
+        glslang::TLayoutGeometry primitive;
+
+        if (glslangIntermediate->getStage() == EShLangTessControl) {
+            builder.addExecutionMode(shaderEntry, spv::ExecutionModeOutputVertices, glslangIntermediate->getVertices());
+            primitive = glslangIntermediate->getOutputPrimitive();
+        } else {
+            primitive = glslangIntermediate->getInputPrimitive();
+        }
+
+        switch (primitive) {
         case glslang::ElgTriangles:           mode = spv::ExecutionModeTriangles;     break;
         case glslang::ElgTriangles:           mode = spv::ExecutionModeTriangles;     break;
         case glslang::ElgQuads:               mode = spv::ExecutionModeQuads;         break;
         case glslang::ElgQuads:               mode = spv::ExecutionModeQuads;         break;
         case glslang::ElgIsolines:            mode = spv::ExecutionModeIsolines;      break;
         case glslang::ElgIsolines:            mode = spv::ExecutionModeIsolines;      break;
@@ -1823,7 +1829,15 @@ bool TGlslangToSpvTraverser::visitSelection(glslang::TVisit /* visit */, glslang
         node->getFalseBlock()->traverse(this);
         node->getFalseBlock()->traverse(this);
         spv::Id falseValue = accessChainLoad(node->getTrueBlock()->getAsTyped()->getType());
         spv::Id falseValue = accessChainLoad(node->getTrueBlock()->getAsTyped()->getType());
 
 
-        spv::Id select = builder.createTriOp(spv::OpSelect, convertGlslangToSpvType(node->getType()), condition, trueValue, falseValue);
+        // smear condition to vector, if necessary (AST is always scalar)
+        if (builder.isVector(trueValue))
+            condition = builder.smearScalar(spv::NoPrecision, condition, 
+                                            builder.makeVectorType(builder.makeBoolType(),
+                                                                   builder.getNumComponents(trueValue)));
+
+        spv::Id select = builder.createTriOp(spv::OpSelect,
+                                             convertGlslangToSpvType(node->getType()), condition,
+                                                                     trueValue, falseValue);
         builder.clearAccessChain();
         builder.clearAccessChain();
         builder.setAccessChainRValue(select);
         builder.setAccessChainRValue(select);
     };
     };
@@ -2272,12 +2286,21 @@ bool TGlslangToSpvTraverser::filterMember(const glslang::TType& member)
 {
 {
     auto& extensions = glslangIntermediate->getRequestedExtensions();
     auto& extensions = glslangIntermediate->getRequestedExtensions();
 
 
+    if (member.getFieldName() == "gl_ViewportMask" &&
+        extensions.find("GL_NV_viewport_array2") == extensions.end())
+        return true;
+    if (member.getFieldName() == "gl_SecondaryViewportMaskNV" &&
+        extensions.find("GL_NV_stereo_view_rendering") == extensions.end())
+        return true;
     if (member.getFieldName() == "gl_SecondaryPositionNV" &&
     if (member.getFieldName() == "gl_SecondaryPositionNV" &&
         extensions.find("GL_NV_stereo_view_rendering") == extensions.end())
         extensions.find("GL_NV_stereo_view_rendering") == extensions.end())
         return true;
         return true;
     if (member.getFieldName() == "gl_PositionPerViewNV" &&
     if (member.getFieldName() == "gl_PositionPerViewNV" &&
         extensions.find("GL_NVX_multiview_per_view_attributes") == extensions.end())
         extensions.find("GL_NVX_multiview_per_view_attributes") == extensions.end())
         return true;
         return true;
+    if (member.getFieldName() == "gl_ViewportMaskPerViewNV" &&
+        extensions.find("GL_NVX_multiview_per_view_attributes") == extensions.end())
+        return true;
 
 
     return false;
     return false;
 };
 };
@@ -2777,7 +2800,7 @@ void TGlslangToSpvTraverser::makeFunctions(const glslang::TIntermSequence& glslF
             if (paramType.containsOpaque() ||                                // sampler, etc.
             if (paramType.containsOpaque() ||                                // sampler, etc.
                 (paramType.getBasicType() == glslang::EbtBlock &&
                 (paramType.getBasicType() == glslang::EbtBlock &&
                  paramType.getQualifier().storage == glslang::EvqBuffer) ||  // SSBO
                  paramType.getQualifier().storage == glslang::EvqBuffer) ||  // SSBO
-                 p == 0 && implicitThis)                                     // implicit 'this'
+                (p == 0 && implicitThis))                                    // implicit 'this'
                 typeId = builder.makePointer(TranslateStorageClass(paramType), typeId);
                 typeId = builder.makePointer(TranslateStorageClass(paramType), typeId);
             else if (paramType.getQualifier().storage != glslang::EvqConstReadOnly)
             else if (paramType.getQualifier().storage != glslang::EvqConstReadOnly)
                 typeId = builder.makePointer(spv::StorageClassFunction, typeId);
                 typeId = builder.makePointer(spv::StorageClassFunction, typeId);
@@ -4609,6 +4632,9 @@ spv::Id TGlslangToSpvTraverser::createMiscOperation(glslang::TOperator op, spv::
     spv::Id typeId0 = 0;
     spv::Id typeId0 = 0;
     if (consumedOperands > 0)
     if (consumedOperands > 0)
         typeId0 = builder.getTypeId(operands[0]);
         typeId0 = builder.getTypeId(operands[0]);
+    spv::Id typeId1 = 0;
+    if (consumedOperands > 1)
+        typeId1 = builder.getTypeId(operands[1]);
     spv::Id frexpIntType = 0;
     spv::Id frexpIntType = 0;
 
 
     switch (op) {
     switch (op) {
@@ -4730,13 +4756,22 @@ spv::Id TGlslangToSpvTraverser::createMiscOperation(glslang::TOperator op, spv::
         libCall = spv::GLSLstd450Fma;
         libCall = spv::GLSLstd450Fma;
         break;
         break;
     case glslang::EOpFrexp:
     case glslang::EOpFrexp:
-        libCall = spv::GLSLstd450FrexpStruct;
-        if (builder.getNumComponents(operands[0]) == 1)
-            frexpIntType = builder.makeIntegerType(32, true);
-        else
-            frexpIntType = builder.makeVectorType(builder.makeIntegerType(32, true), builder.getNumComponents(operands[0]));
-        typeId = builder.makeStructResultType(typeId0, frexpIntType);
-        consumedOperands = 1;
+        {
+            libCall = spv::GLSLstd450FrexpStruct;
+            assert(builder.isPointerType(typeId1));
+            typeId1 = builder.getContainedTypeId(typeId1);
+#ifdef AMD_EXTENSIONS
+            int width = builder.getScalarTypeWidth(typeId1);
+#else
+            int width = 32;
+#endif
+            if (builder.getNumComponents(operands[0]) == 1)
+                frexpIntType = builder.makeIntegerType(width, true);
+            else
+                frexpIntType = builder.makeVectorType(builder.makeIntegerType(width, true), builder.getNumComponents(operands[0]));
+            typeId = builder.makeStructResultType(typeId0, frexpIntType);
+            consumedOperands = 1;
+        }
         break;
         break;
     case glslang::EOpLdexp:
     case glslang::EOpLdexp:
         libCall = spv::GLSLstd450Ldexp;
         libCall = spv::GLSLstd450Ldexp;
@@ -4844,9 +4879,18 @@ spv::Id TGlslangToSpvTraverser::createMiscOperation(glslang::TOperator op, spv::
         builder.createStore(builder.createCompositeExtract(id, typeId0, 1), operands[2]);
         builder.createStore(builder.createCompositeExtract(id, typeId0, 1), operands[2]);
         break;
         break;
     case glslang::EOpFrexp:
     case glslang::EOpFrexp:
-        assert(operands.size() == 2);
-        builder.createStore(builder.createCompositeExtract(id, frexpIntType, 1), operands[1]);
-        id = builder.createCompositeExtract(id, typeId0, 0);
+        {
+            assert(operands.size() == 2);
+            if (builder.isFloatType(builder.getScalarTypeId(typeId1))) {
+                // "exp" is floating-point type (from HLSL intrinsic)
+                spv::Id member1 = builder.createCompositeExtract(id, frexpIntType, 1);
+                member1 = builder.createUnaryOp(spv::OpConvertSToF, typeId1, member1);
+                builder.createStore(member1, operands[1]);
+            } else
+                // "exp" is integer type (from GLSL built-in function)
+                builder.createStore(builder.createCompositeExtract(id, frexpIntType, 1), operands[1]);
+            id = builder.createCompositeExtract(id, typeId0, 0);
+        }
         break;
         break;
     default:
     default:
         break;
         break;

+ 10 - 0
3rdparty/glslang/SPIRV/SpvBuilder.h

@@ -134,6 +134,9 @@ public:
     bool isSampledImage(Id resultId) const { return isSampledImageType(getTypeId(resultId)); }
     bool isSampledImage(Id resultId) const { return isSampledImageType(getTypeId(resultId)); }
 
 
     bool isBoolType(Id typeId)         const { return groupedTypes[OpTypeBool].size() > 0 && typeId == groupedTypes[OpTypeBool].back()->getResultId(); }
     bool isBoolType(Id typeId)         const { return groupedTypes[OpTypeBool].size() > 0 && typeId == groupedTypes[OpTypeBool].back()->getResultId(); }
+    bool isIntType(Id typeId)          const { return getTypeClass(typeId) == OpTypeInt && module.getInstruction(typeId)->getImmediateOperand(1) != 0; }
+    bool isUintType(Id typeId)         const { return getTypeClass(typeId) == OpTypeInt && module.getInstruction(typeId)->getImmediateOperand(1) == 0; }
+    bool isFloatType(Id typeId)        const { return getTypeClass(typeId) == OpTypeFloat; }
     bool isPointerType(Id typeId)      const { return getTypeClass(typeId) == OpTypePointer; }
     bool isPointerType(Id typeId)      const { return getTypeClass(typeId) == OpTypePointer; }
     bool isScalarType(Id typeId)       const { return getTypeClass(typeId) == OpTypeFloat  || getTypeClass(typeId) == OpTypeInt || getTypeClass(typeId) == OpTypeBool; }
     bool isScalarType(Id typeId)       const { return getTypeClass(typeId) == OpTypeFloat  || getTypeClass(typeId) == OpTypeInt || getTypeClass(typeId) == OpTypeBool; }
     bool isVectorType(Id typeId)       const { return getTypeClass(typeId) == OpTypeVector; }
     bool isVectorType(Id typeId)       const { return getTypeClass(typeId) == OpTypeVector; }
@@ -153,6 +156,13 @@ public:
     unsigned int getConstantScalar(Id resultId) const { return module.getInstruction(resultId)->getImmediateOperand(0); }
     unsigned int getConstantScalar(Id resultId) const { return module.getInstruction(resultId)->getImmediateOperand(0); }
     StorageClass getStorageClass(Id resultId) const { return getTypeStorageClass(getTypeId(resultId)); }
     StorageClass getStorageClass(Id resultId) const { return getTypeStorageClass(getTypeId(resultId)); }
 
 
+    int getScalarTypeWidth(Id typeId) const
+    {
+        Id scalarTypeId = getScalarTypeId(typeId);
+        assert(getTypeClass(scalarTypeId) == OpTypeInt || getTypeClass(scalarTypeId) == OpTypeFloat);
+        return module.getInstruction(scalarTypeId)->getImmediateOperand(0);
+    }
+
     int getTypeNumColumns(Id typeId) const
     int getTypeNumColumns(Id typeId) const
     {
     {
         assert(isMatrixType(typeId));
         assert(isMatrixType(typeId));

+ 4 - 4
3rdparty/glslang/Test/baseResults/hlsl.attribute.frag.out

@@ -9,7 +9,7 @@ gl_FragCoord origin is upper left
 0:11      Test condition and select ( temp void)
 0:11      Test condition and select ( temp void)
 0:11        Condition
 0:11        Condition
 0:11        Constant:
 0:11        Constant:
-0:11          0 (const int)
+0:11          false (const bool)
 0:11        true case is null
 0:11        true case is null
 0:2  Function Definition: PixelShaderFunction( ( temp void)
 0:2  Function Definition: PixelShaderFunction( ( temp void)
 0:2    Function Parameters: 
 0:2    Function Parameters: 
@@ -36,7 +36,7 @@ gl_FragCoord origin is upper left
 0:11      Test condition and select ( temp void)
 0:11      Test condition and select ( temp void)
 0:11        Condition
 0:11        Condition
 0:11        Constant:
 0:11        Constant:
-0:11          0 (const int)
+0:11          false (const bool)
 0:11        true case is null
 0:11        true case is null
 0:2  Function Definition: PixelShaderFunction( ( temp void)
 0:2  Function Definition: PixelShaderFunction( ( temp void)
 0:2    Function Parameters: 
 0:2    Function Parameters: 
@@ -71,8 +71,8 @@ gl_FragCoord origin is upper left
                7:             TypeVector 6(float) 4
                7:             TypeVector 6(float) 4
                8:             TypePointer Function 7(fvec4)
                8:             TypePointer Function 7(fvec4)
                9:             TypeFunction 2 8(ptr)
                9:             TypeFunction 2 8(ptr)
-              13:             TypeInt 32 1
-              14:     13(int) Constant 0
+              13:             TypeBool
+              14:    13(bool) ConstantFalse
               18:             TypePointer Input 7(fvec4)
               18:             TypePointer Input 7(fvec4)
        19(input):     18(ptr) Variable Input
        19(input):     18(ptr) Variable Input
 4(PixelShaderFunction):           2 Function None 3
 4(PixelShaderFunction):           2 Function None 3

+ 5 - 5
3rdparty/glslang/Test/baseResults/hlsl.basic.geom.out

@@ -60,14 +60,14 @@ output primitive = line_strip
 0:?         'VertexID' (layout( location=0) in 3-element array of uint)
 0:?         'VertexID' (layout( location=0) in 3-element array of uint)
 0:16      move second child to first child ( temp 3-element array of uint)
 0:16      move second child to first child ( temp 3-element array of uint)
 0:?         'test' ( temp 3-element array of uint)
 0:?         'test' ( temp 3-element array of uint)
-0:?         'test' (layout( location=3) in 3-element array of uint)
+0:?         'test' (layout( location=1) in 3-element array of uint)
 0:16      Function Call: @main(u1[3];u1[3];struct-PSInput-f1-i11; ( temp void)
 0:16      Function Call: @main(u1[3];u1[3];struct-PSInput-f1-i11; ( temp void)
 0:?         'VertexID' ( temp 3-element array of uint)
 0:?         'VertexID' ( temp 3-element array of uint)
 0:?         'test' ( temp 3-element array of uint)
 0:?         'test' ( temp 3-element array of uint)
 0:?         'OutputStream' ( temp structure{ temp float myfloat,  temp int something})
 0:?         'OutputStream' ( temp structure{ temp float myfloat,  temp int something})
 0:?   Linker Objects
 0:?   Linker Objects
 0:?     'VertexID' (layout( location=0) in 3-element array of uint)
 0:?     'VertexID' (layout( location=0) in 3-element array of uint)
-0:?     'test' (layout( location=3) in 3-element array of uint)
+0:?     'test' (layout( location=1) in 3-element array of uint)
 
 
 
 
 Linked geometry stage:
 Linked geometry stage:
@@ -134,14 +134,14 @@ output primitive = line_strip
 0:?         'VertexID' (layout( location=0) in 3-element array of uint)
 0:?         'VertexID' (layout( location=0) in 3-element array of uint)
 0:16      move second child to first child ( temp 3-element array of uint)
 0:16      move second child to first child ( temp 3-element array of uint)
 0:?         'test' ( temp 3-element array of uint)
 0:?         'test' ( temp 3-element array of uint)
-0:?         'test' (layout( location=3) in 3-element array of uint)
+0:?         'test' (layout( location=1) in 3-element array of uint)
 0:16      Function Call: @main(u1[3];u1[3];struct-PSInput-f1-i11; ( temp void)
 0:16      Function Call: @main(u1[3];u1[3];struct-PSInput-f1-i11; ( temp void)
 0:?         'VertexID' ( temp 3-element array of uint)
 0:?         'VertexID' ( temp 3-element array of uint)
 0:?         'test' ( temp 3-element array of uint)
 0:?         'test' ( temp 3-element array of uint)
 0:?         'OutputStream' ( temp structure{ temp float myfloat,  temp int something})
 0:?         'OutputStream' ( temp structure{ temp float myfloat,  temp int something})
 0:?   Linker Objects
 0:?   Linker Objects
 0:?     'VertexID' (layout( location=0) in 3-element array of uint)
 0:?     'VertexID' (layout( location=0) in 3-element array of uint)
-0:?     'test' (layout( location=3) in 3-element array of uint)
+0:?     'test' (layout( location=1) in 3-element array of uint)
 
 
 // Module Version 10000
 // Module Version 10000
 // Generated by (magic number): 80001
 // Generated by (magic number): 80001
@@ -173,7 +173,7 @@ output primitive = line_strip
                               Name 53  "param"
                               Name 53  "param"
                               Name 55  "param"
                               Name 55  "param"
                               Decorate 45(VertexID) Location 0
                               Decorate 45(VertexID) Location 0
-                              Decorate 48(test) Location 3
+                              Decorate 48(test) Location 1
                2:             TypeVoid
                2:             TypeVoid
                3:             TypeFunction 2
                3:             TypeFunction 2
                6:             TypeInt 32 0
                6:             TypeInt 32 0

+ 122 - 0
3rdparty/glslang/Test/baseResults/hlsl.clip.frag.out

@@ -0,0 +1,122 @@
+hlsl.clip.frag
+Shader version: 450
+gl_FragCoord origin is upper left
+0:? Sequence
+0:3  Function Definition: GetEntitySelectClip( ( temp float)
+0:3    Function Parameters: 
+0:?     Sequence
+0:4      Branch: Return with expression
+0:4        Constant:
+0:4          1.000000
+0:8  Function Definition: @main( ( temp 4-component vector of float)
+0:8    Function Parameters: 
+0:?     Sequence
+0:9      Test condition and select ( temp void)
+0:9        Condition
+0:9        Compare Less Than ( temp bool)
+0:9          Function Call: GetEntitySelectClip( ( temp float)
+0:9          Constant:
+0:9            0.000000
+0:9        true case
+0:9        Branch: Kill
+0:11      Branch: Return with expression
+0:11        Constant:
+0:11          0.000000
+0:11          0.000000
+0:11          0.000000
+0:11          0.000000
+0:8  Function Definition: main( ( temp void)
+0:8    Function Parameters: 
+0:?     Sequence
+0:8      move second child to first child ( temp 4-component vector of float)
+0:?         '@entryPointOutput' (layout( location=0) out 4-component vector of float)
+0:8        Function Call: @main( ( temp 4-component vector of float)
+0:?   Linker Objects
+0:?     '@entryPointOutput' (layout( location=0) out 4-component vector of float)
+
+
+Linked fragment stage:
+
+
+Shader version: 450
+gl_FragCoord origin is upper left
+0:? Sequence
+0:3  Function Definition: GetEntitySelectClip( ( temp float)
+0:3    Function Parameters: 
+0:?     Sequence
+0:4      Branch: Return with expression
+0:4        Constant:
+0:4          1.000000
+0:8  Function Definition: @main( ( temp 4-component vector of float)
+0:8    Function Parameters: 
+0:?     Sequence
+0:9      Test condition and select ( temp void)
+0:9        Condition
+0:9        Compare Less Than ( temp bool)
+0:9          Function Call: GetEntitySelectClip( ( temp float)
+0:9          Constant:
+0:9            0.000000
+0:9        true case
+0:9        Branch: Kill
+0:11      Branch: Return with expression
+0:11        Constant:
+0:11          0.000000
+0:11          0.000000
+0:11          0.000000
+0:11          0.000000
+0:8  Function Definition: main( ( temp void)
+0:8    Function Parameters: 
+0:?     Sequence
+0:8      move second child to first child ( temp 4-component vector of float)
+0:?         '@entryPointOutput' (layout( location=0) out 4-component vector of float)
+0:8        Function Call: @main( ( temp 4-component vector of float)
+0:?   Linker Objects
+0:?     '@entryPointOutput' (layout( location=0) out 4-component vector of float)
+
+// Module Version 10000
+// Generated by (magic number): 80001
+// Id's are bound by 30
+
+                              Capability Shader
+               1:             ExtInstImport  "GLSL.std.450"
+                              MemoryModel Logical GLSL450
+                              EntryPoint Fragment 4  "main" 28
+                              ExecutionMode 4 OriginUpperLeft
+                              Name 4  "main"
+                              Name 8  "GetEntitySelectClip("
+                              Name 12  "@main("
+                              Name 28  "@entryPointOutput"
+                              Decorate 28(@entryPointOutput) Location 0
+               2:             TypeVoid
+               3:             TypeFunction 2
+               6:             TypeFloat 32
+               7:             TypeFunction 6(float)
+              10:             TypeVector 6(float) 4
+              11:             TypeFunction 10(fvec4)
+              14:    6(float) Constant 1065353216
+              18:    6(float) Constant 0
+              19:             TypeBool
+              24:   10(fvec4) ConstantComposite 18 18 18 18
+              27:             TypePointer Output 10(fvec4)
+28(@entryPointOutput):     27(ptr) Variable Output
+         4(main):           2 Function None 3
+               5:             Label
+              29:   10(fvec4) FunctionCall 12(@main()
+                              Store 28(@entryPointOutput) 29
+                              Return
+                              FunctionEnd
+8(GetEntitySelectClip():    6(float) Function None 7
+               9:             Label
+                              ReturnValue 14
+                              FunctionEnd
+      12(@main():   10(fvec4) Function None 11
+              13:             Label
+              17:    6(float) FunctionCall 8(GetEntitySelectClip()
+              20:    19(bool) FOrdLessThan 17 18
+                              SelectionMerge 22 None
+                              BranchConditional 20 21 22
+              21:               Label
+                                Kill
+              22:             Label
+                              ReturnValue 24
+                              FunctionEnd

+ 98 - 92
3rdparty/glslang/Test/baseResults/hlsl.conditional.frag.out

@@ -55,7 +55,8 @@ gl_FragCoord origin is upper left
 0:12            'a' ( temp int)
 0:12            'a' ( temp int)
 0:12            Test condition and select ( temp int)
 0:12            Test condition and select ( temp int)
 0:12              Condition
 0:12              Condition
-0:12              'b' ( temp int)
+0:12              Convert int to bool ( temp bool)
+0:12                'b' ( temp int)
 0:12              true case
 0:12              true case
 0:12              move second child to first child ( temp int)
 0:12              move second child to first child ( temp int)
 0:12                'c' ( temp int)
 0:12                'c' ( temp int)
@@ -67,7 +68,8 @@ gl_FragCoord origin is upper left
 0:12          'b' ( temp int)
 0:12          'b' ( temp int)
 0:12          Test condition and select ( temp int)
 0:12          Test condition and select ( temp int)
 0:12            Condition
 0:12            Condition
-0:12            'a' ( temp int)
+0:12            Convert int to bool ( temp bool)
+0:12              'a' ( temp int)
 0:12            true case
 0:12            true case
 0:12            move second child to first child ( temp int)
 0:12            move second child to first child ( temp int)
 0:12              'd' ( temp int)
 0:12              'd' ( temp int)
@@ -179,7 +181,8 @@ gl_FragCoord origin is upper left
 0:12            'a' ( temp int)
 0:12            'a' ( temp int)
 0:12            Test condition and select ( temp int)
 0:12            Test condition and select ( temp int)
 0:12              Condition
 0:12              Condition
-0:12              'b' ( temp int)
+0:12              Convert int to bool ( temp bool)
+0:12                'b' ( temp int)
 0:12              true case
 0:12              true case
 0:12              move second child to first child ( temp int)
 0:12              move second child to first child ( temp int)
 0:12                'c' ( temp int)
 0:12                'c' ( temp int)
@@ -191,7 +194,8 @@ gl_FragCoord origin is upper left
 0:12          'b' ( temp int)
 0:12          'b' ( temp int)
 0:12          Test condition and select ( temp int)
 0:12          Test condition and select ( temp int)
 0:12            Condition
 0:12            Condition
-0:12            'a' ( temp int)
+0:12            Convert int to bool ( temp bool)
+0:12              'a' ( temp int)
 0:12            true case
 0:12            true case
 0:12            move second child to first child ( temp int)
 0:12            move second child to first child ( temp int)
 0:12              'd' ( temp int)
 0:12              'd' ( temp int)
@@ -245,12 +249,12 @@ gl_FragCoord origin is upper left
 
 
 // Module Version 10000
 // Module Version 10000
 // Generated by (magic number): 80001
 // Generated by (magic number): 80001
-// Id's are bound by 100
+// Id's are bound by 102
 
 
                               Capability Shader
                               Capability Shader
                1:             ExtInstImport  "GLSL.std.450"
                1:             ExtInstImport  "GLSL.std.450"
                               MemoryModel Logical GLSL450
                               MemoryModel Logical GLSL450
-                              EntryPoint Fragment 4  "PixelShaderFunction" 93 96
+                              EntryPoint Fragment 4  "PixelShaderFunction" 95 98
                               ExecutionMode 4 OriginUpperLeft
                               ExecutionMode 4 OriginUpperLeft
                               Name 4  "PixelShaderFunction"
                               Name 4  "PixelShaderFunction"
                               Name 11  "@PixelShaderFunction(vf4;"
                               Name 11  "@PixelShaderFunction(vf4;"
@@ -261,13 +265,13 @@ gl_FragCoord origin is upper left
                               Name 21  "d"
                               Name 21  "d"
                               Name 22  "ret"
                               Name 22  "ret"
                               Name 42  "e"
                               Name 42  "e"
-                              Name 59  "f"
-                              Name 91  "input"
+                              Name 64  "f"
                               Name 93  "input"
                               Name 93  "input"
-                              Name 96  "@entryPointOutput"
-                              Name 97  "param"
-                              Decorate 93(input) Location 0
-                              Decorate 96(@entryPointOutput) Location 0
+                              Name 95  "input"
+                              Name 98  "@entryPointOutput"
+                              Name 99  "param"
+                              Decorate 95(input) Location 0
+                              Decorate 98(@entryPointOutput) Location 0
                2:             TypeVoid
                2:             TypeVoid
                3:             TypeFunction 2
                3:             TypeFunction 2
                6:             TypeFloat 32
                6:             TypeFloat 32
@@ -279,27 +283,27 @@ gl_FragCoord origin is upper left
               16:     13(int) Constant 5
               16:     13(int) Constant 5
               18:     13(int) Constant 6
               18:     13(int) Constant 6
               20:     13(int) Constant 7
               20:     13(int) Constant 7
-              49:     13(int) Constant 10
-              57:     13(int) Constant 11
-              61:             TypeInt 32 0
-              62:     61(int) Constant 0
-              63:             TypePointer Function 6(float)
-              66:     61(int) Constant 1
-              69:             TypeBool
-              92:             TypePointer Input 7(fvec4)
-       93(input):     92(ptr) Variable Input
-              95:             TypePointer Output 7(fvec4)
-96(@entryPointOutput):     95(ptr) Variable Output
+              45:             TypeBool
+              46:             TypeInt 32 0
+              47:     46(int) Constant 0
+              53:     13(int) Constant 10
+              62:     13(int) Constant 11
+              66:             TypePointer Function 6(float)
+              69:     46(int) Constant 1
+              94:             TypePointer Input 7(fvec4)
+       95(input):     94(ptr) Variable Input
+              97:             TypePointer Output 7(fvec4)
+98(@entryPointOutput):     97(ptr) Variable Output
 4(PixelShaderFunction):           2 Function None 3
 4(PixelShaderFunction):           2 Function None 3
                5:             Label
                5:             Label
-       91(input):      8(ptr) Variable Function
-       97(param):      8(ptr) Variable Function
-              94:    7(fvec4) Load 93(input)
-                              Store 91(input) 94
-              98:    7(fvec4) Load 91(input)
-                              Store 97(param) 98
-              99:    7(fvec4) FunctionCall 11(@PixelShaderFunction(vf4;) 97(param)
-                              Store 96(@entryPointOutput) 99
+       93(input):      8(ptr) Variable Function
+       99(param):      8(ptr) Variable Function
+              96:    7(fvec4) Load 95(input)
+                              Store 93(input) 96
+             100:    7(fvec4) Load 93(input)
+                              Store 99(param) 100
+             101:    7(fvec4) FunctionCall 11(@PixelShaderFunction(vf4;) 99(param)
+                              Store 98(@entryPointOutput) 101
                               Return
                               Return
                               FunctionEnd
                               FunctionEnd
 11(@PixelShaderFunction(vf4;):    7(fvec4) Function None 9
 11(@PixelShaderFunction(vf4;):    7(fvec4) Function None 9
@@ -312,9 +316,9 @@ gl_FragCoord origin is upper left
          22(ret):      8(ptr) Variable Function
          22(ret):      8(ptr) Variable Function
            42(e):     14(ptr) Variable Function
            42(e):     14(ptr) Variable Function
               43:     14(ptr) Variable Function
               43:     14(ptr) Variable Function
-              51:     14(ptr) Variable Function
-           59(f):      8(ptr) Variable Function
-              60:      8(ptr) Variable Function
+              55:     14(ptr) Variable Function
+           64(f):      8(ptr) Variable Function
+              65:      8(ptr) Variable Function
                               Store 15(a) 16
                               Store 15(a) 16
                               Store 17(b) 18
                               Store 17(b) 18
                               Store 19(c) 20
                               Store 19(c) 20
@@ -340,63 +344,65 @@ gl_FragCoord origin is upper left
               41:    7(fvec4) FAdd 36 40
               41:    7(fvec4) FAdd 36 40
                               Store 22(ret) 41
                               Store 22(ret) 41
               44:     13(int) Load 17(b)
               44:     13(int) Load 17(b)
-                              SelectionMerge 46 None
-                              BranchConditional 44 45 48
-              45:               Label
-              47:     13(int)   Load 21(d)
-                                Store 19(c) 47
-                                Store 43 47
-                                Branch 46
-              48:               Label
-                                Store 43 49
-                                Branch 46
-              46:             Label
-              50:     13(int) Load 43
-                              Store 15(a) 50
-                              Store 42(e) 50
-              52:     13(int) Load 15(a)
-                              SelectionMerge 54 None
-                              BranchConditional 52 53 56
-              53:               Label
-              55:     13(int)   Load 19(c)
-                                Store 21(d) 55
-                                Store 51 55
-                                Branch 54
-              56:               Label
-                                Store 51 57
-                                Branch 54
-              54:             Label
-              58:     13(int) Load 51
-                              Store 17(b) 58
-              64:     63(ptr) AccessChain 22(ret) 62
-              65:    6(float) Load 64
-              67:     63(ptr) AccessChain 10(input) 66
+              48:    45(bool) INotEqual 44 47
+                              SelectionMerge 50 None
+                              BranchConditional 48 49 52
+              49:               Label
+              51:     13(int)   Load 21(d)
+                                Store 19(c) 51
+                                Store 43 51
+                                Branch 50
+              52:               Label
+                                Store 43 53
+                                Branch 50
+              50:             Label
+              54:     13(int) Load 43
+                              Store 15(a) 54
+                              Store 42(e) 54
+              56:     13(int) Load 15(a)
+              57:    45(bool) INotEqual 56 47
+                              SelectionMerge 59 None
+                              BranchConditional 57 58 61
+              58:               Label
+              60:     13(int)   Load 19(c)
+                                Store 21(d) 60
+                                Store 55 60
+                                Branch 59
+              61:               Label
+                                Store 55 62
+                                Branch 59
+              59:             Label
+              63:     13(int) Load 55
+                              Store 17(b) 63
+              67:     66(ptr) AccessChain 22(ret) 47
               68:    6(float) Load 67
               68:    6(float) Load 67
-              70:    69(bool) FOrdLessThan 65 68
-                              SelectionMerge 72 None
-                              BranchConditional 70 71 77
-              71:               Label
-              73:     13(int)   Load 19(c)
-              74:    6(float)   ConvertSToF 73
-              75:    7(fvec4)   Load 10(input)
-              76:    7(fvec4)   VectorTimesScalar 75 74
-                                Store 60 76
-                                Branch 72
-              77:               Label
-              78:     13(int)   Load 21(d)
-              79:    6(float)   ConvertSToF 78
-              80:    7(fvec4)   Load 10(input)
-              81:    7(fvec4)   VectorTimesScalar 80 79
-                                Store 60 81
-                                Branch 72
-              72:             Label
-              82:    7(fvec4) Load 60
-                              Store 59(f) 82
-              83:     13(int) Load 42(e)
-              84:    6(float) ConvertSToF 83
-              85:    7(fvec4) Load 22(ret)
-              86:    7(fvec4) VectorTimesScalar 85 84
-              87:    7(fvec4) Load 59(f)
-              88:    7(fvec4) FAdd 86 87
-                              ReturnValue 88
+              70:     66(ptr) AccessChain 10(input) 69
+              71:    6(float) Load 70
+              72:    45(bool) FOrdLessThan 68 71
+                              SelectionMerge 74 None
+                              BranchConditional 72 73 79
+              73:               Label
+              75:     13(int)   Load 19(c)
+              76:    6(float)   ConvertSToF 75
+              77:    7(fvec4)   Load 10(input)
+              78:    7(fvec4)   VectorTimesScalar 77 76
+                                Store 65 78
+                                Branch 74
+              79:               Label
+              80:     13(int)   Load 21(d)
+              81:    6(float)   ConvertSToF 80
+              82:    7(fvec4)   Load 10(input)
+              83:    7(fvec4)   VectorTimesScalar 82 81
+                                Store 65 83
+                                Branch 74
+              74:             Label
+              84:    7(fvec4) Load 65
+                              Store 64(f) 84
+              85:     13(int) Load 42(e)
+              86:    6(float) ConvertSToF 85
+              87:    7(fvec4) Load 22(ret)
+              88:    7(fvec4) VectorTimesScalar 87 86
+              89:    7(fvec4) Load 64(f)
+              90:    7(fvec4) FAdd 88 89
+                              ReturnValue 90
                               FunctionEnd
                               FunctionEnd

+ 35 - 31
3rdparty/glslang/Test/baseResults/hlsl.discard.frag.out

@@ -25,10 +25,11 @@ gl_FragCoord origin is upper left
 0:9            2 (const int)
 0:9            2 (const int)
 0:10      Test condition and select ( temp void)
 0:10      Test condition and select ( temp void)
 0:10        Condition
 0:10        Condition
-0:10        direct index ( temp float)
-0:10          'input' ( in 4-component vector of float)
-0:10          Constant:
-0:10            0 (const int)
+0:10        Convert float to bool ( temp bool)
+0:10          direct index ( temp float)
+0:10            'input' ( in 4-component vector of float)
+0:10            Constant:
+0:10              0 (const int)
 0:10        true case
 0:10        true case
 0:11        Branch: Kill
 0:11        Branch: Kill
 0:12      Sequence
 0:12      Sequence
@@ -80,10 +81,11 @@ gl_FragCoord origin is upper left
 0:9            2 (const int)
 0:9            2 (const int)
 0:10      Test condition and select ( temp void)
 0:10      Test condition and select ( temp void)
 0:10        Condition
 0:10        Condition
-0:10        direct index ( temp float)
-0:10          'input' ( in 4-component vector of float)
-0:10          Constant:
-0:10            0 (const int)
+0:10        Convert float to bool ( temp bool)
+0:10          direct index ( temp float)
+0:10            'input' ( in 4-component vector of float)
+0:10            Constant:
+0:10              0 (const int)
 0:10        true case
 0:10        true case
 0:11        Branch: Kill
 0:11        Branch: Kill
 0:12      Sequence
 0:12      Sequence
@@ -107,12 +109,12 @@ gl_FragCoord origin is upper left
 
 
 // Module Version 10000
 // Module Version 10000
 // Generated by (magic number): 80001
 // Generated by (magic number): 80001
-// Id's are bound by 48
+// Id's are bound by 50
 
 
                               Capability Shader
                               Capability Shader
                1:             ExtInstImport  "GLSL.std.450"
                1:             ExtInstImport  "GLSL.std.450"
                               MemoryModel Logical GLSL450
                               MemoryModel Logical GLSL450
-                              EntryPoint Fragment 4  "PixelShaderFunction" 43
+                              EntryPoint Fragment 4  "PixelShaderFunction" 45
                               ExecutionMode 4 OriginUpperLeft
                               ExecutionMode 4 OriginUpperLeft
                               Name 4  "PixelShaderFunction"
                               Name 4  "PixelShaderFunction"
                               Name 10  "foo(f1;"
                               Name 10  "foo(f1;"
@@ -120,11 +122,11 @@ gl_FragCoord origin is upper left
                               Name 16  "@PixelShaderFunction(vf4;"
                               Name 16  "@PixelShaderFunction(vf4;"
                               Name 15  "input"
                               Name 15  "input"
                               Name 25  "param"
                               Name 25  "param"
-                              Name 37  "f"
-                              Name 41  "input"
+                              Name 39  "f"
                               Name 43  "input"
                               Name 43  "input"
-                              Name 45  "param"
-                              Decorate 43(input) Location 0
+                              Name 45  "input"
+                              Name 47  "param"
+                              Decorate 45(input) Location 0
                2:             TypeVoid
                2:             TypeVoid
                3:             TypeFunction 2
                3:             TypeFunction 2
                6:             TypeFloat 32
                6:             TypeFloat 32
@@ -138,17 +140,18 @@ gl_FragCoord origin is upper left
               26:             TypeInt 32 0
               26:             TypeInt 32 0
               27:     26(int) Constant 2
               27:     26(int) Constant 2
               31:     26(int) Constant 0
               31:     26(int) Constant 0
-              42:             TypePointer Input 12(fvec4)
-       43(input):     42(ptr) Variable Input
+              34:    6(float) Constant 0
+              44:             TypePointer Input 12(fvec4)
+       45(input):     44(ptr) Variable Input
 4(PixelShaderFunction):           2 Function None 3
 4(PixelShaderFunction):           2 Function None 3
                5:             Label
                5:             Label
-       41(input):     13(ptr) Variable Function
-       45(param):     13(ptr) Variable Function
-              44:   12(fvec4) Load 43(input)
-                              Store 41(input) 44
-              46:   12(fvec4) Load 41(input)
-                              Store 45(param) 46
-              47:           2 FunctionCall 16(@PixelShaderFunction(vf4;) 45(param)
+       43(input):     13(ptr) Variable Function
+       47(param):     13(ptr) Variable Function
+              46:   12(fvec4) Load 45(input)
+                              Store 43(input) 46
+              48:   12(fvec4) Load 43(input)
+                              Store 47(param) 48
+              49:           2 FunctionCall 16(@PixelShaderFunction(vf4;) 47(param)
                               Return
                               Return
                               FunctionEnd
                               FunctionEnd
      10(foo(f1;):           2 Function None 8
      10(foo(f1;):           2 Function None 8
@@ -167,20 +170,21 @@ gl_FragCoord origin is upper left
        15(input):     13(ptr) FunctionParameter
        15(input):     13(ptr) FunctionParameter
               17:             Label
               17:             Label
        25(param):      7(ptr) Variable Function
        25(param):      7(ptr) Variable Function
-           37(f):      7(ptr) Variable Function
+           39(f):      7(ptr) Variable Function
               28:      7(ptr) AccessChain 15(input) 27
               28:      7(ptr) AccessChain 15(input) 27
               29:    6(float) Load 28
               29:    6(float) Load 28
                               Store 25(param) 29
                               Store 25(param) 29
               30:           2 FunctionCall 10(foo(f1;) 25(param)
               30:           2 FunctionCall 10(foo(f1;) 25(param)
               32:      7(ptr) AccessChain 15(input) 31
               32:      7(ptr) AccessChain 15(input) 31
               33:    6(float) Load 32
               33:    6(float) Load 32
-                              SelectionMerge 35 None
-                              BranchConditional 33 34 35
-              34:               Label
+              35:    20(bool) FOrdNotEqual 33 34
+                              SelectionMerge 37 None
+                              BranchConditional 35 36 37
+              36:               Label
                                 Kill
                                 Kill
-              35:             Label
-              38:      7(ptr) AccessChain 15(input) 31
-              39:    6(float) Load 38
-                              Store 37(f) 39
+              37:             Label
+              40:      7(ptr) AccessChain 15(input) 31
+              41:    6(float) Load 40
+                              Store 39(f) 41
                               Kill
                               Kill
                               FunctionEnd
                               FunctionEnd

+ 393 - 0
3rdparty/glslang/Test/baseResults/hlsl.domain.1.tese.out

@@ -0,0 +1,393 @@
+hlsl.domain.1.tese
+Shader version: 450
+input primitive = triangles
+vertex spacing = none
+triangle order = none
+0:? Sequence
+0:22  Function Definition: @main(struct-ds_in_t-vf4-vf31[3];vf3;struct-pcf_in_t-f1[3]-f11; ( temp structure{ temp 4-component vector of float pos,  temp 3-component vector of float norm})
+0:22    Function Parameters: 
+0:22      'i' ( const (read only) 3-element array of structure{ temp 4-component vector of float pos,  temp 3-component vector of float norm})
+0:22      'tesscoord' ( in 3-component vector of float)
+0:22      'pcf_data' ( in structure{ temp 3-element array of float flTessFactor,  temp float flInsideTessFactor})
+0:?     Sequence
+0:25      move second child to first child ( temp 4-component vector of float)
+0:25        pos: direct index for structure ( temp 4-component vector of float)
+0:25          'o' ( temp structure{ temp 4-component vector of float pos,  temp 3-component vector of float norm})
+0:25          Constant:
+0:25            0 (const int)
+0:25        add ( temp 4-component vector of float)
+0:25          pos: direct index for structure ( temp 4-component vector of float)
+0:25            direct index ( temp structure{ temp 4-component vector of float pos,  temp 3-component vector of float norm})
+0:25              'i' ( const (read only) 3-element array of structure{ temp 4-component vector of float pos,  temp 3-component vector of float norm})
+0:25              Constant:
+0:25                0 (const int)
+0:25            Constant:
+0:25              0 (const int)
+0:25          direct index ( temp float)
+0:25            'tesscoord' ( in 3-component vector of float)
+0:25            Constant:
+0:25              0 (const int)
+0:26      move second child to first child ( temp 3-component vector of float)
+0:26        norm: direct index for structure ( temp 3-component vector of float)
+0:26          'o' ( temp structure{ temp 4-component vector of float pos,  temp 3-component vector of float norm})
+0:26          Constant:
+0:26            1 (const int)
+0:26        add ( temp 3-component vector of float)
+0:26          norm: direct index for structure ( temp 3-component vector of float)
+0:26            direct index ( temp structure{ temp 4-component vector of float pos,  temp 3-component vector of float norm})
+0:26              'i' ( const (read only) 3-element array of structure{ temp 4-component vector of float pos,  temp 3-component vector of float norm})
+0:26              Constant:
+0:26                0 (const int)
+0:26            Constant:
+0:26              1 (const int)
+0:26          direct index ( temp float)
+0:26            'tesscoord' ( in 3-component vector of float)
+0:26            Constant:
+0:26              1 (const int)
+0:28      direct index ( temp float)
+0:28        'tesscoord' ( in 3-component vector of float)
+0:28        Constant:
+0:28          2 (const int)
+0:30      Branch: Return with expression
+0:30        'o' ( temp structure{ temp 4-component vector of float pos,  temp 3-component vector of float norm})
+0:22  Function Definition: main( ( temp void)
+0:22    Function Parameters: 
+0:?     Sequence
+0:22      move second child to first child ( temp 3-element array of structure{ temp 4-component vector of float pos,  temp 3-component vector of float norm})
+0:?         'i' ( temp 3-element array of structure{ temp 4-component vector of float pos,  temp 3-component vector of float norm})
+0:?         'i' (layout( location=0) in 3-element array of structure{ temp 4-component vector of float pos,  temp 3-component vector of float norm})
+0:22      move second child to first child ( temp 3-component vector of float)
+0:?         'tesscoord' ( temp 3-component vector of float)
+0:?         'tesscoord' ( patch in 3-component vector of float TessCoord)
+0:22      Sequence
+0:22        move second child to first child ( temp float)
+0:22          direct index ( temp float)
+0:22            flTessFactor: direct index for structure ( temp 3-element array of float)
+0:?               'pcf_data' ( temp structure{ temp 3-element array of float flTessFactor,  temp float flInsideTessFactor})
+0:22              Constant:
+0:22                0 (const int)
+0:22            Constant:
+0:22              0 (const int)
+0:22          direct index ( patch in float TessLevelOuter)
+0:?             'pcf_data_flTessFactor' ( patch in 4-element array of float TessLevelOuter)
+0:22            Constant:
+0:22              0 (const int)
+0:22        move second child to first child ( temp float)
+0:22          direct index ( temp float)
+0:22            flTessFactor: direct index for structure ( temp 3-element array of float)
+0:?               'pcf_data' ( temp structure{ temp 3-element array of float flTessFactor,  temp float flInsideTessFactor})
+0:22              Constant:
+0:22                0 (const int)
+0:22            Constant:
+0:22              1 (const int)
+0:22          direct index ( patch in float TessLevelOuter)
+0:?             'pcf_data_flTessFactor' ( patch in 4-element array of float TessLevelOuter)
+0:22            Constant:
+0:22              1 (const int)
+0:22        move second child to first child ( temp float)
+0:22          direct index ( temp float)
+0:22            flTessFactor: direct index for structure ( temp 3-element array of float)
+0:?               'pcf_data' ( temp structure{ temp 3-element array of float flTessFactor,  temp float flInsideTessFactor})
+0:22              Constant:
+0:22                0 (const int)
+0:22            Constant:
+0:22              2 (const int)
+0:22          direct index ( patch in float TessLevelOuter)
+0:?             'pcf_data_flTessFactor' ( patch in 4-element array of float TessLevelOuter)
+0:22            Constant:
+0:22              2 (const int)
+0:22        move second child to first child ( temp float)
+0:22          flInsideTessFactor: direct index for structure ( temp float)
+0:?             'pcf_data' ( temp structure{ temp 3-element array of float flTessFactor,  temp float flInsideTessFactor})
+0:22            Constant:
+0:22              1 (const int)
+0:22          direct index ( patch in float TessLevelInner)
+0:?             'pcf_data_flInsideTessFactor' ( patch in 2-element array of float TessLevelInner)
+0:22            Constant:
+0:22              0 (const int)
+0:22      move second child to first child ( temp structure{ temp 4-component vector of float pos,  temp 3-component vector of float norm})
+0:?         '@entryPointOutput' (layout( location=0) out structure{ temp 4-component vector of float pos,  temp 3-component vector of float norm})
+0:22        Function Call: @main(struct-ds_in_t-vf4-vf31[3];vf3;struct-pcf_in_t-f1[3]-f11; ( temp structure{ temp 4-component vector of float pos,  temp 3-component vector of float norm})
+0:?           'i' ( temp 3-element array of structure{ temp 4-component vector of float pos,  temp 3-component vector of float norm})
+0:?           'tesscoord' ( temp 3-component vector of float)
+0:?           'pcf_data' ( temp structure{ temp 3-element array of float flTessFactor,  temp float flInsideTessFactor})
+0:?   Linker Objects
+0:?     '@entryPointOutput' (layout( location=0) out structure{ temp 4-component vector of float pos,  temp 3-component vector of float norm})
+0:?     'i' (layout( location=0) in 3-element array of structure{ temp 4-component vector of float pos,  temp 3-component vector of float norm})
+0:?     'tesscoord' ( patch in 3-component vector of float TessCoord)
+0:?     'pcf_data' (layout( location=2) patch in structure{})
+0:?     'pcf_data_flTessFactor' ( patch in 4-element array of float TessLevelOuter)
+0:?     'pcf_data_flInsideTessFactor' ( patch in 2-element array of float TessLevelInner)
+
+
+Linked tessellation evaluation stage:
+
+
+Shader version: 450
+input primitive = triangles
+vertex spacing = none
+triangle order = none
+0:? Sequence
+0:22  Function Definition: @main(struct-ds_in_t-vf4-vf31[3];vf3;struct-pcf_in_t-f1[3]-f11; ( temp structure{ temp 4-component vector of float pos,  temp 3-component vector of float norm})
+0:22    Function Parameters: 
+0:22      'i' ( const (read only) 3-element array of structure{ temp 4-component vector of float pos,  temp 3-component vector of float norm})
+0:22      'tesscoord' ( in 3-component vector of float)
+0:22      'pcf_data' ( in structure{ temp 3-element array of float flTessFactor,  temp float flInsideTessFactor})
+0:?     Sequence
+0:25      move second child to first child ( temp 4-component vector of float)
+0:25        pos: direct index for structure ( temp 4-component vector of float)
+0:25          'o' ( temp structure{ temp 4-component vector of float pos,  temp 3-component vector of float norm})
+0:25          Constant:
+0:25            0 (const int)
+0:25        add ( temp 4-component vector of float)
+0:25          pos: direct index for structure ( temp 4-component vector of float)
+0:25            direct index ( temp structure{ temp 4-component vector of float pos,  temp 3-component vector of float norm})
+0:25              'i' ( const (read only) 3-element array of structure{ temp 4-component vector of float pos,  temp 3-component vector of float norm})
+0:25              Constant:
+0:25                0 (const int)
+0:25            Constant:
+0:25              0 (const int)
+0:25          direct index ( temp float)
+0:25            'tesscoord' ( in 3-component vector of float)
+0:25            Constant:
+0:25              0 (const int)
+0:26      move second child to first child ( temp 3-component vector of float)
+0:26        norm: direct index for structure ( temp 3-component vector of float)
+0:26          'o' ( temp structure{ temp 4-component vector of float pos,  temp 3-component vector of float norm})
+0:26          Constant:
+0:26            1 (const int)
+0:26        add ( temp 3-component vector of float)
+0:26          norm: direct index for structure ( temp 3-component vector of float)
+0:26            direct index ( temp structure{ temp 4-component vector of float pos,  temp 3-component vector of float norm})
+0:26              'i' ( const (read only) 3-element array of structure{ temp 4-component vector of float pos,  temp 3-component vector of float norm})
+0:26              Constant:
+0:26                0 (const int)
+0:26            Constant:
+0:26              1 (const int)
+0:26          direct index ( temp float)
+0:26            'tesscoord' ( in 3-component vector of float)
+0:26            Constant:
+0:26              1 (const int)
+0:28      direct index ( temp float)
+0:28        'tesscoord' ( in 3-component vector of float)
+0:28        Constant:
+0:28          2 (const int)
+0:30      Branch: Return with expression
+0:30        'o' ( temp structure{ temp 4-component vector of float pos,  temp 3-component vector of float norm})
+0:22  Function Definition: main( ( temp void)
+0:22    Function Parameters: 
+0:?     Sequence
+0:22      move second child to first child ( temp 3-element array of structure{ temp 4-component vector of float pos,  temp 3-component vector of float norm})
+0:?         'i' ( temp 3-element array of structure{ temp 4-component vector of float pos,  temp 3-component vector of float norm})
+0:?         'i' (layout( location=0) in 3-element array of structure{ temp 4-component vector of float pos,  temp 3-component vector of float norm})
+0:22      move second child to first child ( temp 3-component vector of float)
+0:?         'tesscoord' ( temp 3-component vector of float)
+0:?         'tesscoord' ( patch in 3-component vector of float TessCoord)
+0:22      Sequence
+0:22        move second child to first child ( temp float)
+0:22          direct index ( temp float)
+0:22            flTessFactor: direct index for structure ( temp 3-element array of float)
+0:?               'pcf_data' ( temp structure{ temp 3-element array of float flTessFactor,  temp float flInsideTessFactor})
+0:22              Constant:
+0:22                0 (const int)
+0:22            Constant:
+0:22              0 (const int)
+0:22          direct index ( patch in float TessLevelOuter)
+0:?             'pcf_data_flTessFactor' ( patch in 4-element array of float TessLevelOuter)
+0:22            Constant:
+0:22              0 (const int)
+0:22        move second child to first child ( temp float)
+0:22          direct index ( temp float)
+0:22            flTessFactor: direct index for structure ( temp 3-element array of float)
+0:?               'pcf_data' ( temp structure{ temp 3-element array of float flTessFactor,  temp float flInsideTessFactor})
+0:22              Constant:
+0:22                0 (const int)
+0:22            Constant:
+0:22              1 (const int)
+0:22          direct index ( patch in float TessLevelOuter)
+0:?             'pcf_data_flTessFactor' ( patch in 4-element array of float TessLevelOuter)
+0:22            Constant:
+0:22              1 (const int)
+0:22        move second child to first child ( temp float)
+0:22          direct index ( temp float)
+0:22            flTessFactor: direct index for structure ( temp 3-element array of float)
+0:?               'pcf_data' ( temp structure{ temp 3-element array of float flTessFactor,  temp float flInsideTessFactor})
+0:22              Constant:
+0:22                0 (const int)
+0:22            Constant:
+0:22              2 (const int)
+0:22          direct index ( patch in float TessLevelOuter)
+0:?             'pcf_data_flTessFactor' ( patch in 4-element array of float TessLevelOuter)
+0:22            Constant:
+0:22              2 (const int)
+0:22        move second child to first child ( temp float)
+0:22          flInsideTessFactor: direct index for structure ( temp float)
+0:?             'pcf_data' ( temp structure{ temp 3-element array of float flTessFactor,  temp float flInsideTessFactor})
+0:22            Constant:
+0:22              1 (const int)
+0:22          direct index ( patch in float TessLevelInner)
+0:?             'pcf_data_flInsideTessFactor' ( patch in 2-element array of float TessLevelInner)
+0:22            Constant:
+0:22              0 (const int)
+0:22      move second child to first child ( temp structure{ temp 4-component vector of float pos,  temp 3-component vector of float norm})
+0:?         '@entryPointOutput' (layout( location=0) out structure{ temp 4-component vector of float pos,  temp 3-component vector of float norm})
+0:22        Function Call: @main(struct-ds_in_t-vf4-vf31[3];vf3;struct-pcf_in_t-f1[3]-f11; ( temp structure{ temp 4-component vector of float pos,  temp 3-component vector of float norm})
+0:?           'i' ( temp 3-element array of structure{ temp 4-component vector of float pos,  temp 3-component vector of float norm})
+0:?           'tesscoord' ( temp 3-component vector of float)
+0:?           'pcf_data' ( temp structure{ temp 3-element array of float flTessFactor,  temp float flInsideTessFactor})
+0:?   Linker Objects
+0:?     '@entryPointOutput' (layout( location=0) out structure{ temp 4-component vector of float pos,  temp 3-component vector of float norm})
+0:?     'i' (layout( location=0) in 3-element array of structure{ temp 4-component vector of float pos,  temp 3-component vector of float norm})
+0:?     'tesscoord' ( patch in 3-component vector of float TessCoord)
+0:?     'pcf_data' (layout( location=2) patch in structure{})
+0:?     'pcf_data_flTessFactor' ( patch in 4-element array of float TessLevelOuter)
+0:?     'pcf_data_flInsideTessFactor' ( patch in 2-element array of float TessLevelInner)
+
+// Module Version 10000
+// Generated by (magic number): 80001
+// Id's are bound by 91
+
+                              Capability Tessellation
+               1:             ExtInstImport  "GLSL.std.450"
+                              MemoryModel Logical GLSL450
+                              EntryPoint TessellationEvaluation 4  "main" 51 55 61 76 81 90
+                              ExecutionMode 4 Triangles
+                              Name 4  "main"
+                              Name 9  "ds_in_t"
+                              MemberName 9(ds_in_t) 0  "pos"
+                              MemberName 9(ds_in_t) 1  "norm"
+                              Name 15  "pcf_in_t"
+                              MemberName 15(pcf_in_t) 0  "flTessFactor"
+                              MemberName 15(pcf_in_t) 1  "flInsideTessFactor"
+                              Name 17  "gs_in_t"
+                              MemberName 17(gs_in_t) 0  "pos"
+                              MemberName 17(gs_in_t) 1  "norm"
+                              Name 22  "@main(struct-ds_in_t-vf4-vf31[3];vf3;struct-pcf_in_t-f1[3]-f11;"
+                              Name 19  "i"
+                              Name 20  "tesscoord"
+                              Name 21  "pcf_data"
+                              Name 25  "o"
+                              Name 49  "i"
+                              Name 51  "i"
+                              Name 53  "tesscoord"
+                              Name 55  "tesscoord"
+                              Name 57  "pcf_data"
+                              Name 61  "pcf_data_flTessFactor"
+                              Name 76  "pcf_data_flInsideTessFactor"
+                              Name 81  "@entryPointOutput"
+                              Name 83  "param"
+                              Name 85  "param"
+                              Name 88  "pcf_in_t"
+                              Name 90  "pcf_data"
+                              Decorate 51(i) Location 0
+                              Decorate 55(tesscoord) Patch
+                              Decorate 55(tesscoord) BuiltIn TessCoord
+                              Decorate 61(pcf_data_flTessFactor) Patch
+                              Decorate 61(pcf_data_flTessFactor) BuiltIn TessLevelOuter
+                              Decorate 76(pcf_data_flInsideTessFactor) Patch
+                              Decorate 76(pcf_data_flInsideTessFactor) BuiltIn TessLevelInner
+                              Decorate 81(@entryPointOutput) Location 0
+                              Decorate 90(pcf_data) Patch
+                              Decorate 90(pcf_data) Location 2
+               2:             TypeVoid
+               3:             TypeFunction 2
+               6:             TypeFloat 32
+               7:             TypeVector 6(float) 4
+               8:             TypeVector 6(float) 3
+      9(ds_in_t):             TypeStruct 7(fvec4) 8(fvec3)
+              10:             TypeInt 32 0
+              11:     10(int) Constant 3
+              12:             TypeArray 9(ds_in_t) 11
+              13:             TypePointer Function 8(fvec3)
+              14:             TypeArray 6(float) 11
+    15(pcf_in_t):             TypeStruct 14 6(float)
+              16:             TypePointer Function 15(pcf_in_t)
+     17(gs_in_t):             TypeStruct 7(fvec4) 8(fvec3)
+              18:             TypeFunction 17(gs_in_t) 12 13(ptr) 16(ptr)
+              24:             TypePointer Function 17(gs_in_t)
+              26:             TypeInt 32 1
+              27:     26(int) Constant 0
+              29:     10(int) Constant 0
+              30:             TypePointer Function 6(float)
+              35:             TypePointer Function 7(fvec4)
+              37:     26(int) Constant 1
+              39:     10(int) Constant 1
+              48:             TypePointer Function 12
+              50:             TypePointer Input 12
+           51(i):     50(ptr) Variable Input
+              54:             TypePointer Input 8(fvec3)
+   55(tesscoord):     54(ptr) Variable Input
+              58:     10(int) Constant 4
+              59:             TypeArray 6(float) 58
+              60:             TypePointer Input 59
+61(pcf_data_flTessFactor):     60(ptr) Variable Input
+              62:             TypePointer Input 6(float)
+              69:     26(int) Constant 2
+              73:     10(int) Constant 2
+              74:             TypeArray 6(float) 73
+              75:             TypePointer Input 74
+76(pcf_data_flInsideTessFactor):     75(ptr) Variable Input
+              80:             TypePointer Output 17(gs_in_t)
+81(@entryPointOutput):     80(ptr) Variable Output
+    88(pcf_in_t):             TypeStruct
+              89:             TypePointer Input 88(pcf_in_t)
+    90(pcf_data):     89(ptr) Variable Input
+         4(main):           2 Function None 3
+               5:             Label
+           49(i):     48(ptr) Variable Function
+   53(tesscoord):     13(ptr) Variable Function
+    57(pcf_data):     16(ptr) Variable Function
+       83(param):     13(ptr) Variable Function
+       85(param):     16(ptr) Variable Function
+              52:          12 Load 51(i)
+                              Store 49(i) 52
+              56:    8(fvec3) Load 55(tesscoord)
+                              Store 53(tesscoord) 56
+              63:     62(ptr) AccessChain 61(pcf_data_flTessFactor) 27
+              64:    6(float) Load 63
+              65:     30(ptr) AccessChain 57(pcf_data) 27 27
+                              Store 65 64
+              66:     62(ptr) AccessChain 61(pcf_data_flTessFactor) 37
+              67:    6(float) Load 66
+              68:     30(ptr) AccessChain 57(pcf_data) 27 37
+                              Store 68 67
+              70:     62(ptr) AccessChain 61(pcf_data_flTessFactor) 69
+              71:    6(float) Load 70
+              72:     30(ptr) AccessChain 57(pcf_data) 27 69
+                              Store 72 71
+              77:     62(ptr) AccessChain 76(pcf_data_flInsideTessFactor) 27
+              78:    6(float) Load 77
+              79:     30(ptr) AccessChain 57(pcf_data) 37
+                              Store 79 78
+              82:          12 Load 49(i)
+              84:    8(fvec3) Load 53(tesscoord)
+                              Store 83(param) 84
+              86:15(pcf_in_t) Load 57(pcf_data)
+                              Store 85(param) 86
+              87: 17(gs_in_t) FunctionCall 22(@main(struct-ds_in_t-vf4-vf31[3];vf3;struct-pcf_in_t-f1[3]-f11;) 82 83(param) 85(param)
+                              Store 81(@entryPointOutput) 87
+                              Return
+                              FunctionEnd
+22(@main(struct-ds_in_t-vf4-vf31[3];vf3;struct-pcf_in_t-f1[3]-f11;): 17(gs_in_t) Function None 18
+           19(i):          12 FunctionParameter
+   20(tesscoord):     13(ptr) FunctionParameter
+    21(pcf_data):     16(ptr) FunctionParameter
+              23:             Label
+           25(o):     24(ptr) Variable Function
+              28:    7(fvec4) CompositeExtract 19(i) 0 0
+              31:     30(ptr) AccessChain 20(tesscoord) 29
+              32:    6(float) Load 31
+              33:    7(fvec4) CompositeConstruct 32 32 32 32
+              34:    7(fvec4) FAdd 28 33
+              36:     35(ptr) AccessChain 25(o) 27
+                              Store 36 34
+              38:    8(fvec3) CompositeExtract 19(i) 0 1
+              40:     30(ptr) AccessChain 20(tesscoord) 39
+              41:    6(float) Load 40
+              42:    8(fvec3) CompositeConstruct 41 41 41
+              43:    8(fvec3) FAdd 38 42
+              44:     13(ptr) AccessChain 25(o) 37
+                              Store 44 43
+              45: 17(gs_in_t) Load 25(o)
+                              ReturnValue 45
+                              FunctionEnd

+ 98 - 75
3rdparty/glslang/Test/baseResults/hlsl.hull.1.tesc.out

@@ -1,6 +1,7 @@
 hlsl.hull.1.tesc
 hlsl.hull.1.tesc
 Shader version: 450
 Shader version: 450
 vertices = 4
 vertices = 4
+vertex spacing = equal_spacing
 0:? Sequence
 0:? Sequence
 0:26  Function Definition: @main(struct-VS_OUT-vf31[4];u1; ( temp structure{ temp 3-component vector of float cpoint})
 0:26  Function Definition: @main(struct-VS_OUT-vf31[4];u1; ( temp structure{ temp 3-component vector of float cpoint})
 0:26    Function Parameters: 
 0:26    Function Parameters: 
@@ -31,7 +32,9 @@ vertices = 4
 0:?         'm_cpid' ( temp uint)
 0:?         'm_cpid' ( temp uint)
 0:?         'm_cpid' ( in uint InvocationID)
 0:?         'm_cpid' ( in uint InvocationID)
 0:26      move second child to first child ( temp structure{ temp 3-component vector of float cpoint})
 0:26      move second child to first child ( temp structure{ temp 3-component vector of float cpoint})
-0:?         '@entryPointOutput' (layout( location=0) out structure{ temp 3-component vector of float cpoint})
+0:26        indirect index ( temp structure{ temp 3-component vector of float cpoint})
+0:?           '@entryPointOutput' (layout( location=0) out 4-element array of structure{ temp 3-component vector of float cpoint})
+0:?           'm_cpid' ( in uint InvocationID)
 0:26        Function Call: @main(struct-VS_OUT-vf31[4];u1; ( temp structure{ temp 3-component vector of float cpoint})
 0:26        Function Call: @main(struct-VS_OUT-vf31[4];u1; ( temp structure{ temp 3-component vector of float cpoint})
 0:?           'ip' ( temp 4-element array of structure{ temp 3-component vector of float cpoint})
 0:?           'ip' ( temp 4-element array of structure{ temp 3-component vector of float cpoint})
 0:?           'm_cpid' ( temp uint)
 0:?           'm_cpid' ( temp uint)
@@ -50,8 +53,8 @@ vertices = 4
 0:?               'pid' ( in uint PrimitiveID)
 0:?               'pid' ( in uint PrimitiveID)
 0:?           Sequence
 0:?           Sequence
 0:?             move second child to first child ( temp float)
 0:?             move second child to first child ( temp float)
-0:?               direct index ( out float TessLevelOuter)
-0:?                 '@patchConstantOutput_edges' ( out 2-element array of float TessLevelOuter)
+0:?               direct index ( patch out float TessLevelOuter)
+0:?                 '@patchConstantOutput_edges' ( patch out 4-element array of float TessLevelOuter)
 0:?                 Constant:
 0:?                 Constant:
 0:?                   0 (const int)
 0:?                   0 (const int)
 0:?               direct index ( temp float)
 0:?               direct index ( temp float)
@@ -62,8 +65,8 @@ vertices = 4
 0:?                 Constant:
 0:?                 Constant:
 0:?                   0 (const int)
 0:?                   0 (const int)
 0:?             move second child to first child ( temp float)
 0:?             move second child to first child ( temp float)
-0:?               direct index ( out float TessLevelOuter)
-0:?                 '@patchConstantOutput_edges' ( out 2-element array of float TessLevelOuter)
+0:?               direct index ( patch out float TessLevelOuter)
+0:?                 '@patchConstantOutput_edges' ( patch out 4-element array of float TessLevelOuter)
 0:?                 Constant:
 0:?                 Constant:
 0:?                   1 (const int)
 0:?                   1 (const int)
 0:?               direct index ( temp float)
 0:?               direct index ( temp float)
@@ -100,11 +103,12 @@ vertices = 4
 0:38      Branch: Return with expression
 0:38      Branch: Return with expression
 0:38        'output' ( temp structure{ temp 2-element array of float edges})
 0:38        'output' ( temp structure{ temp 2-element array of float edges})
 0:?   Linker Objects
 0:?   Linker Objects
-0:?     '@entryPointOutput' (layout( location=0) out structure{ temp 3-component vector of float cpoint})
+0:?     '@entryPointOutput' (layout( location=0) out 4-element array of structure{ temp 3-component vector of float cpoint})
 0:?     'ip' (layout( location=0) in 4-element array of structure{ temp 3-component vector of float cpoint})
 0:?     'ip' (layout( location=0) in 4-element array of structure{ temp 3-component vector of float cpoint})
 0:?     'm_cpid' ( in uint InvocationID)
 0:?     'm_cpid' ( in uint InvocationID)
 0:?     'pid' ( in uint PrimitiveID)
 0:?     'pid' ( in uint PrimitiveID)
-0:?     '@patchConstantOutput_edges' ( out 2-element array of float TessLevelOuter)
+0:?     '@patchConstantOutput' (layout( location=1) patch out structure{})
+0:?     '@patchConstantOutput_edges' ( patch out 4-element array of float TessLevelOuter)
 
 
 
 
 Linked tessellation control stage:
 Linked tessellation control stage:
@@ -112,6 +116,7 @@ Linked tessellation control stage:
 
 
 Shader version: 450
 Shader version: 450
 vertices = 4
 vertices = 4
+vertex spacing = equal_spacing
 0:? Sequence
 0:? Sequence
 0:26  Function Definition: @main(struct-VS_OUT-vf31[4];u1; ( temp structure{ temp 3-component vector of float cpoint})
 0:26  Function Definition: @main(struct-VS_OUT-vf31[4];u1; ( temp structure{ temp 3-component vector of float cpoint})
 0:26    Function Parameters: 
 0:26    Function Parameters: 
@@ -142,7 +147,9 @@ vertices = 4
 0:?         'm_cpid' ( temp uint)
 0:?         'm_cpid' ( temp uint)
 0:?         'm_cpid' ( in uint InvocationID)
 0:?         'm_cpid' ( in uint InvocationID)
 0:26      move second child to first child ( temp structure{ temp 3-component vector of float cpoint})
 0:26      move second child to first child ( temp structure{ temp 3-component vector of float cpoint})
-0:?         '@entryPointOutput' (layout( location=0) out structure{ temp 3-component vector of float cpoint})
+0:26        indirect index ( temp structure{ temp 3-component vector of float cpoint})
+0:?           '@entryPointOutput' (layout( location=0) out 4-element array of structure{ temp 3-component vector of float cpoint})
+0:?           'm_cpid' ( in uint InvocationID)
 0:26        Function Call: @main(struct-VS_OUT-vf31[4];u1; ( temp structure{ temp 3-component vector of float cpoint})
 0:26        Function Call: @main(struct-VS_OUT-vf31[4];u1; ( temp structure{ temp 3-component vector of float cpoint})
 0:?           'ip' ( temp 4-element array of structure{ temp 3-component vector of float cpoint})
 0:?           'ip' ( temp 4-element array of structure{ temp 3-component vector of float cpoint})
 0:?           'm_cpid' ( temp uint)
 0:?           'm_cpid' ( temp uint)
@@ -161,8 +168,8 @@ vertices = 4
 0:?               'pid' ( in uint PrimitiveID)
 0:?               'pid' ( in uint PrimitiveID)
 0:?           Sequence
 0:?           Sequence
 0:?             move second child to first child ( temp float)
 0:?             move second child to first child ( temp float)
-0:?               direct index ( out float TessLevelOuter)
-0:?                 '@patchConstantOutput_edges' ( out 2-element array of float TessLevelOuter)
+0:?               direct index ( patch out float TessLevelOuter)
+0:?                 '@patchConstantOutput_edges' ( patch out 4-element array of float TessLevelOuter)
 0:?                 Constant:
 0:?                 Constant:
 0:?                   0 (const int)
 0:?                   0 (const int)
 0:?               direct index ( temp float)
 0:?               direct index ( temp float)
@@ -173,8 +180,8 @@ vertices = 4
 0:?                 Constant:
 0:?                 Constant:
 0:?                   0 (const int)
 0:?                   0 (const int)
 0:?             move second child to first child ( temp float)
 0:?             move second child to first child ( temp float)
-0:?               direct index ( out float TessLevelOuter)
-0:?                 '@patchConstantOutput_edges' ( out 2-element array of float TessLevelOuter)
+0:?               direct index ( patch out float TessLevelOuter)
+0:?                 '@patchConstantOutput_edges' ( patch out 4-element array of float TessLevelOuter)
 0:?                 Constant:
 0:?                 Constant:
 0:?                   1 (const int)
 0:?                   1 (const int)
 0:?               direct index ( temp float)
 0:?               direct index ( temp float)
@@ -211,21 +218,24 @@ vertices = 4
 0:38      Branch: Return with expression
 0:38      Branch: Return with expression
 0:38        'output' ( temp structure{ temp 2-element array of float edges})
 0:38        'output' ( temp structure{ temp 2-element array of float edges})
 0:?   Linker Objects
 0:?   Linker Objects
-0:?     '@entryPointOutput' (layout( location=0) out structure{ temp 3-component vector of float cpoint})
+0:?     '@entryPointOutput' (layout( location=0) out 4-element array of structure{ temp 3-component vector of float cpoint})
 0:?     'ip' (layout( location=0) in 4-element array of structure{ temp 3-component vector of float cpoint})
 0:?     'ip' (layout( location=0) in 4-element array of structure{ temp 3-component vector of float cpoint})
 0:?     'm_cpid' ( in uint InvocationID)
 0:?     'm_cpid' ( in uint InvocationID)
 0:?     'pid' ( in uint PrimitiveID)
 0:?     'pid' ( in uint PrimitiveID)
-0:?     '@patchConstantOutput_edges' ( out 2-element array of float TessLevelOuter)
+0:?     '@patchConstantOutput' (layout( location=1) patch out structure{})
+0:?     '@patchConstantOutput_edges' ( patch out 4-element array of float TessLevelOuter)
 
 
 // Module Version 10000
 // Module Version 10000
 // Generated by (magic number): 80001
 // Generated by (magic number): 80001
-// Id's are bound by 85
+// Id's are bound by 93
 
 
                               Capability Tessellation
                               Capability Tessellation
                1:             ExtInstImport  "GLSL.std.450"
                1:             ExtInstImport  "GLSL.std.450"
                               MemoryModel Logical GLSL450
                               MemoryModel Logical GLSL450
-                              EntryPoint TessellationControl 4  "main" 40 44 47 62 67
+                              EntryPoint TessellationControl 4  "main" 40 44 48 66 72 92
                               ExecutionMode 4 OutputVertices 4
                               ExecutionMode 4 OutputVertices 4
+                              ExecutionMode 4 Isolines
+                              ExecutionMode 4 SpacingEqual
                               Name 4  "main"
                               Name 4  "main"
                               Name 8  "VS_OUT"
                               Name 8  "VS_OUT"
                               MemberName 8(VS_OUT) 0  "cpoint"
                               MemberName 8(VS_OUT) 0  "cpoint"
@@ -243,19 +253,24 @@ vertices = 4
                               Name 40  "ip"
                               Name 40  "ip"
                               Name 42  "m_cpid"
                               Name 42  "m_cpid"
                               Name 44  "m_cpid"
                               Name 44  "m_cpid"
-                              Name 47  "@entryPointOutput"
-                              Name 48  "param"
+                              Name 48  "@entryPointOutput"
                               Name 50  "param"
                               Name 50  "param"
-                              Name 61  "@patchConstantResult"
-                              Name 62  "pid"
-                              Name 63  "param"
-                              Name 67  "@patchConstantOutput_edges"
-                              Name 77  "output"
+                              Name 52  "param"
+                              Name 65  "@patchConstantResult"
+                              Name 66  "pid"
+                              Name 67  "param"
+                              Name 72  "@patchConstantOutput_edges"
+                              Name 82  "output"
+                              Name 90  "HS_CONSTANT_OUT"
+                              Name 92  "@patchConstantOutput"
                               Decorate 40(ip) Location 0
                               Decorate 40(ip) Location 0
                               Decorate 44(m_cpid) BuiltIn InvocationId
                               Decorate 44(m_cpid) BuiltIn InvocationId
-                              Decorate 47(@entryPointOutput) Location 0
-                              Decorate 62(pid) BuiltIn PrimitiveId
-                              Decorate 67(@patchConstantOutput_edges) BuiltIn TessLevelOuter
+                              Decorate 48(@entryPointOutput) Location 0
+                              Decorate 66(pid) BuiltIn PrimitiveId
+                              Decorate 72(@patchConstantOutput_edges) Patch
+                              Decorate 72(@patchConstantOutput_edges) BuiltIn TessLevelOuter
+                              Decorate 92(@patchConstantOutput) Patch
+                              Decorate 92(@patchConstantOutput) Location 1
                2:             TypeVoid
                2:             TypeVoid
                3:             TypeFunction 2
                3:             TypeFunction 2
                6:             TypeFloat 32
                6:             TypeFloat 32
@@ -280,58 +295,66 @@ vertices = 4
           40(ip):     39(ptr) Variable Input
           40(ip):     39(ptr) Variable Input
               43:             TypePointer Input 9(int)
               43:             TypePointer Input 9(int)
       44(m_cpid):     43(ptr) Variable Input
       44(m_cpid):     43(ptr) Variable Input
-              46:             TypePointer Output 14(HS_OUT)
-47(@entryPointOutput):     46(ptr) Variable Output
-              53:      9(int) Constant 1
-              54:      9(int) Constant 0
-              56:             TypeBool
-              60:             TypePointer Function 22(HS_CONSTANT_OUT)
-         62(pid):     43(ptr) Variable Input
-              66:             TypePointer Output 21
-67(@patchConstantOutput_edges):     66(ptr) Variable Output
-              68:             TypePointer Function 6(float)
-              71:             TypePointer Output 6(float)
-              73:     29(int) Constant 1
-              78:    6(float) Constant 1073741824
-              80:    6(float) Constant 1090519040
+              46:             TypeArray 14(HS_OUT) 10
+              47:             TypePointer Output 46
+48(@entryPointOutput):     47(ptr) Variable Output
+              55:             TypePointer Output 14(HS_OUT)
+              57:      9(int) Constant 1
+              58:      9(int) Constant 0
+              60:             TypeBool
+              64:             TypePointer Function 22(HS_CONSTANT_OUT)
+         66(pid):     43(ptr) Variable Input
+              70:             TypeArray 6(float) 10
+              71:             TypePointer Output 70
+72(@patchConstantOutput_edges):     71(ptr) Variable Output
+              73:             TypePointer Function 6(float)
+              76:             TypePointer Output 6(float)
+              78:     29(int) Constant 1
+              83:    6(float) Constant 1073741824
+              85:    6(float) Constant 1090519040
+90(HS_CONSTANT_OUT):             TypeStruct
+              91:             TypePointer Output 90(HS_CONSTANT_OUT)
+92(@patchConstantOutput):     91(ptr) Variable Output
          4(main):           2 Function None 3
          4(main):           2 Function None 3
                5:             Label
                5:             Label
           38(ip):     12(ptr) Variable Function
           38(ip):     12(ptr) Variable Function
       42(m_cpid):     13(ptr) Variable Function
       42(m_cpid):     13(ptr) Variable Function
-       48(param):     12(ptr) Variable Function
-       50(param):     13(ptr) Variable Function
-61(@patchConstantResult):     60(ptr) Variable Function
-       63(param):     13(ptr) Variable Function
+       50(param):     12(ptr) Variable Function
+       52(param):     13(ptr) Variable Function
+65(@patchConstantResult):     64(ptr) Variable Function
+       67(param):     13(ptr) Variable Function
               41:          11 Load 40(ip)
               41:          11 Load 40(ip)
                               Store 38(ip) 41
                               Store 38(ip) 41
               45:      9(int) Load 44(m_cpid)
               45:      9(int) Load 44(m_cpid)
                               Store 42(m_cpid) 45
                               Store 42(m_cpid) 45
-              49:          11 Load 38(ip)
-                              Store 48(param) 49
-              51:      9(int) Load 42(m_cpid)
+              49:      9(int) Load 44(m_cpid)
+              51:          11 Load 38(ip)
                               Store 50(param) 51
                               Store 50(param) 51
-              52:  14(HS_OUT) FunctionCall 18(@main(struct-VS_OUT-vf31[4];u1;) 48(param) 50(param)
-                              Store 47(@entryPointOutput) 52
-                              ControlBarrier 20 53 54
-              55:      9(int) Load 44(m_cpid)
-              57:    56(bool) IEqual 55 30
-                              SelectionMerge 59 None
-                              BranchConditional 57 58 59
-              58:               Label
-              64:      9(int)   Load 62(pid)
-                                Store 63(param) 64
-              65:22(HS_CONSTANT_OUT)   FunctionCall 25(PCF(u1;) 63(param)
-                                Store 61(@patchConstantResult) 65
-              69:     68(ptr)   AccessChain 61(@patchConstantResult) 30 30
-              70:    6(float)   Load 69
-              72:     71(ptr)   AccessChain 67(@patchConstantOutput_edges) 30
-                                Store 72 70
-              74:     68(ptr)   AccessChain 61(@patchConstantResult) 30 73
+              53:      9(int) Load 42(m_cpid)
+                              Store 52(param) 53
+              54:  14(HS_OUT) FunctionCall 18(@main(struct-VS_OUT-vf31[4];u1;) 50(param) 52(param)
+              56:     55(ptr) AccessChain 48(@entryPointOutput) 49
+                              Store 56 54
+                              ControlBarrier 20 57 58
+              59:      9(int) Load 44(m_cpid)
+              61:    60(bool) IEqual 59 30
+                              SelectionMerge 63 None
+                              BranchConditional 61 62 63
+              62:               Label
+              68:      9(int)   Load 66(pid)
+                                Store 67(param) 68
+              69:22(HS_CONSTANT_OUT)   FunctionCall 25(PCF(u1;) 67(param)
+                                Store 65(@patchConstantResult) 69
+              74:     73(ptr)   AccessChain 65(@patchConstantResult) 30 30
               75:    6(float)   Load 74
               75:    6(float)   Load 74
-              76:     71(ptr)   AccessChain 67(@patchConstantOutput_edges) 73
-                                Store 76 75
-                                Branch 59
-              59:             Label
+              77:     76(ptr)   AccessChain 72(@patchConstantOutput_edges) 30
+                                Store 77 75
+              79:     73(ptr)   AccessChain 65(@patchConstantResult) 30 78
+              80:    6(float)   Load 79
+              81:     76(ptr)   AccessChain 72(@patchConstantOutput_edges) 78
+                                Store 81 80
+                                Branch 63
+              63:             Label
                               Return
                               Return
                               FunctionEnd
                               FunctionEnd
 18(@main(struct-VS_OUT-vf31[4];u1;):  14(HS_OUT) Function None 15
 18(@main(struct-VS_OUT-vf31[4];u1;):  14(HS_OUT) Function None 15
@@ -349,11 +372,11 @@ vertices = 4
      25(PCF(u1;):22(HS_CONSTANT_OUT) Function None 23
      25(PCF(u1;):22(HS_CONSTANT_OUT) Function None 23
          24(pid):     13(ptr) FunctionParameter
          24(pid):     13(ptr) FunctionParameter
               26:             Label
               26:             Label
-      77(output):     60(ptr) Variable Function
-              79:     68(ptr) AccessChain 77(output) 30 30
-                              Store 79 78
-              81:     68(ptr) AccessChain 77(output) 30 73
-                              Store 81 80
-              82:22(HS_CONSTANT_OUT) Load 77(output)
-                              ReturnValue 82
+      82(output):     64(ptr) Variable Function
+              84:     73(ptr) AccessChain 82(output) 30 30
+                              Store 84 83
+              86:     73(ptr) AccessChain 82(output) 30 78
+                              Store 86 85
+              87:22(HS_CONSTANT_OUT) Load 82(output)
+                              ReturnValue 87
                               FunctionEnd
                               FunctionEnd

+ 110 - 87
3rdparty/glslang/Test/baseResults/hlsl.hull.2.tesc.out

@@ -1,6 +1,7 @@
 hlsl.hull.2.tesc
 hlsl.hull.2.tesc
 Shader version: 450
 Shader version: 450
 vertices = 4
 vertices = 4
+vertex spacing = equal_spacing
 0:? Sequence
 0:? Sequence
 0:26  Function Definition: @main(struct-VS_OUT-vf31[4]; ( temp structure{ temp 3-component vector of float cpoint})
 0:26  Function Definition: @main(struct-VS_OUT-vf31[4]; ( temp structure{ temp 3-component vector of float cpoint})
 0:26    Function Parameters: 
 0:26    Function Parameters: 
@@ -27,7 +28,9 @@ vertices = 4
 0:?         'ip' ( temp 4-element array of structure{ temp 3-component vector of float cpoint})
 0:?         'ip' ( temp 4-element array of structure{ temp 3-component vector of float cpoint})
 0:?         'ip' (layout( location=0) in 4-element array of structure{ temp 3-component vector of float cpoint})
 0:?         'ip' (layout( location=0) in 4-element array of structure{ temp 3-component vector of float cpoint})
 0:26      move second child to first child ( temp structure{ temp 3-component vector of float cpoint})
 0:26      move second child to first child ( temp structure{ temp 3-component vector of float cpoint})
-0:?         '@entryPointOutput' (layout( location=0) out structure{ temp 3-component vector of float cpoint})
+0:26        indirect index ( temp structure{ temp 3-component vector of float cpoint})
+0:?           '@entryPointOutput' (layout( location=0) out 4-element array of structure{ temp 3-component vector of float cpoint})
+0:?           'InvocationId' ( in uint InvocationID)
 0:26        Function Call: @main(struct-VS_OUT-vf31[4]; ( temp structure{ temp 3-component vector of float cpoint})
 0:26        Function Call: @main(struct-VS_OUT-vf31[4]; ( temp structure{ temp 3-component vector of float cpoint})
 0:?           'ip' ( temp 4-element array of structure{ temp 3-component vector of float cpoint})
 0:?           'ip' ( temp 4-element array of structure{ temp 3-component vector of float cpoint})
 0:?       Barrier ( temp void)
 0:?       Barrier ( temp void)
@@ -46,8 +49,8 @@ vertices = 4
 0:?               'pos' ( in 4-component vector of float Position)
 0:?               'pos' ( in 4-component vector of float Position)
 0:?           Sequence
 0:?           Sequence
 0:?             move second child to first child ( temp float)
 0:?             move second child to first child ( temp float)
-0:?               direct index ( out float TessLevelOuter)
-0:?                 '@patchConstantOutput_edges' ( out 2-element array of float TessLevelOuter)
+0:?               direct index ( patch out float TessLevelOuter)
+0:?                 '@patchConstantOutput_edges' ( patch out 4-element array of float TessLevelOuter)
 0:?                 Constant:
 0:?                 Constant:
 0:?                   0 (const int)
 0:?                   0 (const int)
 0:?               direct index ( temp float)
 0:?               direct index ( temp float)
@@ -58,8 +61,8 @@ vertices = 4
 0:?                 Constant:
 0:?                 Constant:
 0:?                   0 (const int)
 0:?                   0 (const int)
 0:?             move second child to first child ( temp float)
 0:?             move second child to first child ( temp float)
-0:?               direct index ( out float TessLevelOuter)
-0:?                 '@patchConstantOutput_edges' ( out 2-element array of float TessLevelOuter)
+0:?               direct index ( patch out float TessLevelOuter)
+0:?                 '@patchConstantOutput_edges' ( patch out 4-element array of float TessLevelOuter)
 0:?                 Constant:
 0:?                 Constant:
 0:?                   1 (const int)
 0:?                   1 (const int)
 0:?               direct index ( temp float)
 0:?               direct index ( temp float)
@@ -97,12 +100,13 @@ vertices = 4
 0:38      Branch: Return with expression
 0:38      Branch: Return with expression
 0:38        'output' ( temp structure{ temp 2-element array of float edges})
 0:38        'output' ( temp structure{ temp 2-element array of float edges})
 0:?   Linker Objects
 0:?   Linker Objects
-0:?     '@entryPointOutput' (layout( location=0) out structure{ temp 3-component vector of float cpoint})
+0:?     '@entryPointOutput' (layout( location=0) out 4-element array of structure{ temp 3-component vector of float cpoint})
 0:?     'ip' (layout( location=0) in 4-element array of structure{ temp 3-component vector of float cpoint})
 0:?     'ip' (layout( location=0) in 4-element array of structure{ temp 3-component vector of float cpoint})
+0:?     'InvocationId' ( in uint InvocationID)
 0:?     'pid' ( in uint PrimitiveID)
 0:?     'pid' ( in uint PrimitiveID)
 0:?     'pos' ( in 4-component vector of float Position)
 0:?     'pos' ( in 4-component vector of float Position)
-0:?     'InvocationId' ( in uint InvocationID)
-0:?     '@patchConstantOutput_edges' ( out 2-element array of float TessLevelOuter)
+0:?     '@patchConstantOutput' (layout( location=1) patch out structure{})
+0:?     '@patchConstantOutput_edges' ( patch out 4-element array of float TessLevelOuter)
 
 
 
 
 Linked tessellation control stage:
 Linked tessellation control stage:
@@ -110,6 +114,7 @@ Linked tessellation control stage:
 
 
 Shader version: 450
 Shader version: 450
 vertices = 4
 vertices = 4
+vertex spacing = equal_spacing
 0:? Sequence
 0:? Sequence
 0:26  Function Definition: @main(struct-VS_OUT-vf31[4]; ( temp structure{ temp 3-component vector of float cpoint})
 0:26  Function Definition: @main(struct-VS_OUT-vf31[4]; ( temp structure{ temp 3-component vector of float cpoint})
 0:26    Function Parameters: 
 0:26    Function Parameters: 
@@ -136,7 +141,9 @@ vertices = 4
 0:?         'ip' ( temp 4-element array of structure{ temp 3-component vector of float cpoint})
 0:?         'ip' ( temp 4-element array of structure{ temp 3-component vector of float cpoint})
 0:?         'ip' (layout( location=0) in 4-element array of structure{ temp 3-component vector of float cpoint})
 0:?         'ip' (layout( location=0) in 4-element array of structure{ temp 3-component vector of float cpoint})
 0:26      move second child to first child ( temp structure{ temp 3-component vector of float cpoint})
 0:26      move second child to first child ( temp structure{ temp 3-component vector of float cpoint})
-0:?         '@entryPointOutput' (layout( location=0) out structure{ temp 3-component vector of float cpoint})
+0:26        indirect index ( temp structure{ temp 3-component vector of float cpoint})
+0:?           '@entryPointOutput' (layout( location=0) out 4-element array of structure{ temp 3-component vector of float cpoint})
+0:?           'InvocationId' ( in uint InvocationID)
 0:26        Function Call: @main(struct-VS_OUT-vf31[4]; ( temp structure{ temp 3-component vector of float cpoint})
 0:26        Function Call: @main(struct-VS_OUT-vf31[4]; ( temp structure{ temp 3-component vector of float cpoint})
 0:?           'ip' ( temp 4-element array of structure{ temp 3-component vector of float cpoint})
 0:?           'ip' ( temp 4-element array of structure{ temp 3-component vector of float cpoint})
 0:?       Barrier ( temp void)
 0:?       Barrier ( temp void)
@@ -155,8 +162,8 @@ vertices = 4
 0:?               'pos' ( in 4-component vector of float Position)
 0:?               'pos' ( in 4-component vector of float Position)
 0:?           Sequence
 0:?           Sequence
 0:?             move second child to first child ( temp float)
 0:?             move second child to first child ( temp float)
-0:?               direct index ( out float TessLevelOuter)
-0:?                 '@patchConstantOutput_edges' ( out 2-element array of float TessLevelOuter)
+0:?               direct index ( patch out float TessLevelOuter)
+0:?                 '@patchConstantOutput_edges' ( patch out 4-element array of float TessLevelOuter)
 0:?                 Constant:
 0:?                 Constant:
 0:?                   0 (const int)
 0:?                   0 (const int)
 0:?               direct index ( temp float)
 0:?               direct index ( temp float)
@@ -167,8 +174,8 @@ vertices = 4
 0:?                 Constant:
 0:?                 Constant:
 0:?                   0 (const int)
 0:?                   0 (const int)
 0:?             move second child to first child ( temp float)
 0:?             move second child to first child ( temp float)
-0:?               direct index ( out float TessLevelOuter)
-0:?                 '@patchConstantOutput_edges' ( out 2-element array of float TessLevelOuter)
+0:?               direct index ( patch out float TessLevelOuter)
+0:?                 '@patchConstantOutput_edges' ( patch out 4-element array of float TessLevelOuter)
 0:?                 Constant:
 0:?                 Constant:
 0:?                   1 (const int)
 0:?                   1 (const int)
 0:?               direct index ( temp float)
 0:?               direct index ( temp float)
@@ -206,22 +213,25 @@ vertices = 4
 0:38      Branch: Return with expression
 0:38      Branch: Return with expression
 0:38        'output' ( temp structure{ temp 2-element array of float edges})
 0:38        'output' ( temp structure{ temp 2-element array of float edges})
 0:?   Linker Objects
 0:?   Linker Objects
-0:?     '@entryPointOutput' (layout( location=0) out structure{ temp 3-component vector of float cpoint})
+0:?     '@entryPointOutput' (layout( location=0) out 4-element array of structure{ temp 3-component vector of float cpoint})
 0:?     'ip' (layout( location=0) in 4-element array of structure{ temp 3-component vector of float cpoint})
 0:?     'ip' (layout( location=0) in 4-element array of structure{ temp 3-component vector of float cpoint})
+0:?     'InvocationId' ( in uint InvocationID)
 0:?     'pid' ( in uint PrimitiveID)
 0:?     'pid' ( in uint PrimitiveID)
 0:?     'pos' ( in 4-component vector of float Position)
 0:?     'pos' ( in 4-component vector of float Position)
-0:?     'InvocationId' ( in uint InvocationID)
-0:?     '@patchConstantOutput_edges' ( out 2-element array of float TessLevelOuter)
+0:?     '@patchConstantOutput' (layout( location=1) patch out structure{})
+0:?     '@patchConstantOutput_edges' ( patch out 4-element array of float TessLevelOuter)
 
 
 // Module Version 10000
 // Module Version 10000
 // Generated by (magic number): 80001
 // Generated by (magic number): 80001
-// Id's are bound by 87
+// Id's are bound by 95
 
 
                               Capability Tessellation
                               Capability Tessellation
                1:             ExtInstImport  "GLSL.std.450"
                1:             ExtInstImport  "GLSL.std.450"
                               MemoryModel Logical GLSL450
                               MemoryModel Logical GLSL450
-                              EntryPoint TessellationControl 4  "main" 42 45 52 60 62 69
+                              EntryPoint TessellationControl 4  "main" 42 46 48 64 66 74 94
                               ExecutionMode 4 OutputVertices 4
                               ExecutionMode 4 OutputVertices 4
+                              ExecutionMode 4 Isolines
+                              ExecutionMode 4 SpacingEqual
                               Name 4  "main"
                               Name 4  "main"
                               Name 8  "VS_OUT"
                               Name 8  "VS_OUT"
                               MemberName 8(VS_OUT) 0  "cpoint"
                               MemberName 8(VS_OUT) 0  "cpoint"
@@ -237,22 +247,27 @@ vertices = 4
                               Name 30  "output"
                               Name 30  "output"
                               Name 40  "ip"
                               Name 40  "ip"
                               Name 42  "ip"
                               Name 42  "ip"
-                              Name 45  "@entryPointOutput"
-                              Name 46  "param"
-                              Name 52  "InvocationId"
-                              Name 59  "@patchConstantResult"
-                              Name 60  "pid"
-                              Name 62  "pos"
-                              Name 63  "param"
-                              Name 65  "param"
-                              Name 69  "@patchConstantOutput_edges"
-                              Name 79  "output"
+                              Name 46  "@entryPointOutput"
+                              Name 48  "InvocationId"
+                              Name 50  "param"
+                              Name 63  "@patchConstantResult"
+                              Name 64  "pid"
+                              Name 66  "pos"
+                              Name 67  "param"
+                              Name 69  "param"
+                              Name 74  "@patchConstantOutput_edges"
+                              Name 84  "output"
+                              Name 92  "HS_CONSTANT_OUT"
+                              Name 94  "@patchConstantOutput"
                               Decorate 42(ip) Location 0
                               Decorate 42(ip) Location 0
-                              Decorate 45(@entryPointOutput) Location 0
-                              Decorate 52(InvocationId) BuiltIn InvocationId
-                              Decorate 60(pid) BuiltIn PrimitiveId
-                              Decorate 62(pos) BuiltIn Position
-                              Decorate 69(@patchConstantOutput_edges) BuiltIn TessLevelOuter
+                              Decorate 46(@entryPointOutput) Location 0
+                              Decorate 48(InvocationId) BuiltIn InvocationId
+                              Decorate 64(pid) BuiltIn PrimitiveId
+                              Decorate 66(pos) BuiltIn Position
+                              Decorate 74(@patchConstantOutput_edges) Patch
+                              Decorate 74(@patchConstantOutput_edges) BuiltIn TessLevelOuter
+                              Decorate 94(@patchConstantOutput) Patch
+                              Decorate 94(@patchConstantOutput) Location 1
                2:             TypeVoid
                2:             TypeVoid
                3:             TypeFunction 2
                3:             TypeFunction 2
                6:             TypeFloat 32
                6:             TypeFloat 32
@@ -277,59 +292,67 @@ vertices = 4
               33:             TypePointer Function 7(fvec3)
               33:             TypePointer Function 7(fvec3)
               41:             TypePointer Input 11
               41:             TypePointer Input 11
           42(ip):     41(ptr) Variable Input
           42(ip):     41(ptr) Variable Input
-              44:             TypePointer Output 13(HS_OUT)
-45(@entryPointOutput):     44(ptr) Variable Output
-              49:      9(int) Constant 1
-              50:      9(int) Constant 0
-              51:             TypePointer Input 9(int)
-52(InvocationId):     51(ptr) Variable Input
-              54:             TypeBool
-              58:             TypePointer Function 23(HS_CONSTANT_OUT)
-         60(pid):     51(ptr) Variable Input
-              61:             TypePointer Input 19(fvec4)
-         62(pos):     61(ptr) Variable Input
-              68:             TypePointer Output 22
-69(@patchConstantOutput_edges):     68(ptr) Variable Output
-              70:             TypePointer Function 6(float)
-              73:             TypePointer Output 6(float)
-              75:     31(int) Constant 1
-              80:    6(float) Constant 1073741824
-              82:    6(float) Constant 1090519040
+              44:             TypeArray 13(HS_OUT) 10
+              45:             TypePointer Output 44
+46(@entryPointOutput):     45(ptr) Variable Output
+              47:             TypePointer Input 9(int)
+48(InvocationId):     47(ptr) Variable Input
+              53:             TypePointer Output 13(HS_OUT)
+              55:      9(int) Constant 1
+              56:      9(int) Constant 0
+              58:             TypeBool
+              62:             TypePointer Function 23(HS_CONSTANT_OUT)
+         64(pid):     47(ptr) Variable Input
+              65:             TypePointer Input 19(fvec4)
+         66(pos):     65(ptr) Variable Input
+              72:             TypeArray 6(float) 10
+              73:             TypePointer Output 72
+74(@patchConstantOutput_edges):     73(ptr) Variable Output
+              75:             TypePointer Function 6(float)
+              78:             TypePointer Output 6(float)
+              80:     31(int) Constant 1
+              85:    6(float) Constant 1073741824
+              87:    6(float) Constant 1090519040
+92(HS_CONSTANT_OUT):             TypeStruct
+              93:             TypePointer Output 92(HS_CONSTANT_OUT)
+94(@patchConstantOutput):     93(ptr) Variable Output
          4(main):           2 Function None 3
          4(main):           2 Function None 3
                5:             Label
                5:             Label
           40(ip):     12(ptr) Variable Function
           40(ip):     12(ptr) Variable Function
-       46(param):     12(ptr) Variable Function
-59(@patchConstantResult):     58(ptr) Variable Function
-       63(param):     18(ptr) Variable Function
-       65(param):     20(ptr) Variable Function
+       50(param):     12(ptr) Variable Function
+63(@patchConstantResult):     62(ptr) Variable Function
+       67(param):     18(ptr) Variable Function
+       69(param):     20(ptr) Variable Function
               43:          11 Load 42(ip)
               43:          11 Load 42(ip)
                               Store 40(ip) 43
                               Store 40(ip) 43
-              47:          11 Load 40(ip)
-                              Store 46(param) 47
-              48:  13(HS_OUT) FunctionCall 16(@main(struct-VS_OUT-vf31[4];) 46(param)
-                              Store 45(@entryPointOutput) 48
-                              ControlBarrier 21 49 50
-              53:      9(int) Load 52(InvocationId)
-              55:    54(bool) IEqual 53 32
-                              SelectionMerge 57 None
-                              BranchConditional 55 56 57
-              56:               Label
-              64:      9(int)   Load 60(pid)
-                                Store 63(param) 64
-              66:   19(fvec4)   Load 62(pos)
-                                Store 65(param) 66
-              67:23(HS_CONSTANT_OUT)   FunctionCall 27(PCF(u1;vf4;) 63(param) 65(param)
-                                Store 59(@patchConstantResult) 67
-              71:     70(ptr)   AccessChain 59(@patchConstantResult) 32 32
-              72:    6(float)   Load 71
-              74:     73(ptr)   AccessChain 69(@patchConstantOutput_edges) 32
-                                Store 74 72
-              76:     70(ptr)   AccessChain 59(@patchConstantResult) 32 75
+              49:      9(int) Load 48(InvocationId)
+              51:          11 Load 40(ip)
+                              Store 50(param) 51
+              52:  13(HS_OUT) FunctionCall 16(@main(struct-VS_OUT-vf31[4];) 50(param)
+              54:     53(ptr) AccessChain 46(@entryPointOutput) 49
+                              Store 54 52
+                              ControlBarrier 21 55 56
+              57:      9(int) Load 48(InvocationId)
+              59:    58(bool) IEqual 57 32
+                              SelectionMerge 61 None
+                              BranchConditional 59 60 61
+              60:               Label
+              68:      9(int)   Load 64(pid)
+                                Store 67(param) 68
+              70:   19(fvec4)   Load 66(pos)
+                                Store 69(param) 70
+              71:23(HS_CONSTANT_OUT)   FunctionCall 27(PCF(u1;vf4;) 67(param) 69(param)
+                                Store 63(@patchConstantResult) 71
+              76:     75(ptr)   AccessChain 63(@patchConstantResult) 32 32
               77:    6(float)   Load 76
               77:    6(float)   Load 76
-              78:     73(ptr)   AccessChain 69(@patchConstantOutput_edges) 75
-                                Store 78 77
-                                Branch 57
-              57:             Label
+              79:     78(ptr)   AccessChain 74(@patchConstantOutput_edges) 32
+                                Store 79 77
+              81:     75(ptr)   AccessChain 63(@patchConstantResult) 32 80
+              82:    6(float)   Load 81
+              83:     78(ptr)   AccessChain 74(@patchConstantOutput_edges) 80
+                                Store 83 82
+                                Branch 61
+              61:             Label
                               Return
                               Return
                               FunctionEnd
                               FunctionEnd
 16(@main(struct-VS_OUT-vf31[4];):  13(HS_OUT) Function None 14
 16(@main(struct-VS_OUT-vf31[4];):  13(HS_OUT) Function None 14
@@ -347,11 +370,11 @@ vertices = 4
          25(pid):     18(ptr) FunctionParameter
          25(pid):     18(ptr) FunctionParameter
          26(pos):     20(ptr) FunctionParameter
          26(pos):     20(ptr) FunctionParameter
               28:             Label
               28:             Label
-      79(output):     58(ptr) Variable Function
-              81:     70(ptr) AccessChain 79(output) 32 32
-                              Store 81 80
-              83:     70(ptr) AccessChain 79(output) 32 75
-                              Store 83 82
-              84:23(HS_CONSTANT_OUT) Load 79(output)
-                              ReturnValue 84
+      84(output):     62(ptr) Variable Function
+              86:     75(ptr) AccessChain 84(output) 32 32
+                              Store 86 85
+              88:     75(ptr) AccessChain 84(output) 32 80
+                              Store 88 87
+              89:23(HS_CONSTANT_OUT) Load 84(output)
+                              ReturnValue 89
                               FunctionEnd
                               FunctionEnd

+ 612 - 0
3rdparty/glslang/Test/baseResults/hlsl.hull.ctrlpt-1.tesc.out

@@ -0,0 +1,612 @@
+hlsl.hull.ctrlpt-1.tesc
+Shader version: 450
+vertices = 3
+vertex spacing = fractional_odd_spacing
+triangle order = cw
+0:? Sequence
+0:27  Function Definition: @main(struct-hs_in_t-vf31[3];u1; ( temp structure{ temp 3-component vector of float val})
+0:27    Function Parameters: 
+0:27      'i' ( in 3-element array of structure{ temp 3-component vector of float val})
+0:27      'cpid' ( in uint)
+0:?     Sequence
+0:29      move second child to first child ( temp 3-component vector of float)
+0:29        val: direct index for structure ( temp 3-component vector of float)
+0:29          'o' ( temp structure{ temp 3-component vector of float val})
+0:29          Constant:
+0:29            0 (const int)
+0:29        Construct vec3 ( temp 3-component vector of float)
+0:29          Convert uint to float ( temp float)
+0:29            'cpid' ( in uint)
+0:30      Branch: Return with expression
+0:30        'o' ( temp structure{ temp 3-component vector of float val})
+0:27  Function Definition: main( ( temp void)
+0:27    Function Parameters: 
+0:?     Sequence
+0:27      move second child to first child ( temp 3-element array of structure{ temp 3-component vector of float val})
+0:?         'i' ( temp 3-element array of structure{ temp 3-component vector of float val})
+0:?         'i' (layout( location=0) in 3-element array of structure{ temp 3-component vector of float val})
+0:27      move second child to first child ( temp uint)
+0:?         'cpid' ( temp uint)
+0:?         'cpid' ( in uint InvocationID)
+0:27      move second child to first child ( temp structure{ temp 3-component vector of float val})
+0:27        indirect index ( temp structure{ temp 3-component vector of float val})
+0:?           '@entryPointOutput' (layout( location=0) out 3-element array of structure{ temp 3-component vector of float val})
+0:?           'cpid' ( in uint InvocationID)
+0:27        Function Call: @main(struct-hs_in_t-vf31[3];u1; ( temp structure{ temp 3-component vector of float val})
+0:?           'i' ( temp 3-element array of structure{ temp 3-component vector of float val})
+0:?           'cpid' ( temp uint)
+0:?       Barrier ( temp void)
+0:?       Test condition and select ( temp void)
+0:?         Condition
+0:?         Compare Equal ( temp bool)
+0:?           'cpid' ( in uint InvocationID)
+0:?           Constant:
+0:?             0 (const int)
+0:?         true case
+0:?         Sequence
+0:?           move second child to first child ( temp structure{ temp 3-component vector of float val})
+0:?             direct index ( temp structure{ temp 3-component vector of float val})
+0:?               'pcf_out' ( temp 3-element array of structure{ temp 3-component vector of float val})
+0:?               Constant:
+0:?                 0 (const int)
+0:?             Function Call: @main(struct-hs_in_t-vf31[3];u1; ( temp structure{ temp 3-component vector of float val})
+0:?               'i' ( temp 3-element array of structure{ temp 3-component vector of float val})
+0:?               Constant:
+0:?                 0 (const uint)
+0:?           move second child to first child ( temp structure{ temp 3-component vector of float val})
+0:?             direct index ( temp structure{ temp 3-component vector of float val})
+0:?               'pcf_out' ( temp 3-element array of structure{ temp 3-component vector of float val})
+0:?               Constant:
+0:?                 1 (const int)
+0:?             Function Call: @main(struct-hs_in_t-vf31[3];u1; ( temp structure{ temp 3-component vector of float val})
+0:?               'i' ( temp 3-element array of structure{ temp 3-component vector of float val})
+0:?               Constant:
+0:?                 1 (const uint)
+0:?           move second child to first child ( temp structure{ temp 3-component vector of float val})
+0:?             direct index ( temp structure{ temp 3-component vector of float val})
+0:?               'pcf_out' ( temp 3-element array of structure{ temp 3-component vector of float val})
+0:?               Constant:
+0:?                 2 (const int)
+0:?             Function Call: @main(struct-hs_in_t-vf31[3];u1; ( temp structure{ temp 3-component vector of float val})
+0:?               'i' ( temp 3-element array of structure{ temp 3-component vector of float val})
+0:?               Constant:
+0:?                 2 (const uint)
+0:?           move second child to first child ( temp structure{ temp 3-element array of float tfactor,  temp float flInFactor})
+0:?             '@patchConstantResult' ( temp structure{ temp 3-element array of float tfactor,  temp float flInFactor})
+0:?             Function Call: PCF(struct-hs_out_t-vf31[3]; ( temp structure{ temp 3-element array of float tfactor,  temp float flInFactor})
+0:?               'pcf_out' ( temp 3-element array of structure{ temp 3-component vector of float val})
+0:?           Sequence
+0:?             move second child to first child ( temp float)
+0:?               direct index ( patch out float TessLevelOuter)
+0:?                 '@patchConstantOutput_tfactor' ( patch out 4-element array of float TessLevelOuter)
+0:?                 Constant:
+0:?                   0 (const int)
+0:?               direct index ( temp float)
+0:?                 tfactor: direct index for structure ( temp 3-element array of float)
+0:?                   '@patchConstantResult' ( temp structure{ temp 3-element array of float tfactor,  temp float flInFactor})
+0:?                   Constant:
+0:?                     0 (const int)
+0:?                 Constant:
+0:?                   0 (const int)
+0:?             move second child to first child ( temp float)
+0:?               direct index ( patch out float TessLevelOuter)
+0:?                 '@patchConstantOutput_tfactor' ( patch out 4-element array of float TessLevelOuter)
+0:?                 Constant:
+0:?                   1 (const int)
+0:?               direct index ( temp float)
+0:?                 tfactor: direct index for structure ( temp 3-element array of float)
+0:?                   '@patchConstantResult' ( temp structure{ temp 3-element array of float tfactor,  temp float flInFactor})
+0:?                   Constant:
+0:?                     0 (const int)
+0:?                 Constant:
+0:?                   1 (const int)
+0:?             move second child to first child ( temp float)
+0:?               direct index ( patch out float TessLevelOuter)
+0:?                 '@patchConstantOutput_tfactor' ( patch out 4-element array of float TessLevelOuter)
+0:?                 Constant:
+0:?                   2 (const int)
+0:?               direct index ( temp float)
+0:?                 tfactor: direct index for structure ( temp 3-element array of float)
+0:?                   '@patchConstantResult' ( temp structure{ temp 3-element array of float tfactor,  temp float flInFactor})
+0:?                   Constant:
+0:?                     0 (const int)
+0:?                 Constant:
+0:?                   2 (const int)
+0:?             move second child to first child ( temp float)
+0:?               direct index ( patch out float TessLevelInner)
+0:?                 '@patchConstantOutput_flInFactor' ( patch out 2-element array of float TessLevelInner)
+0:?                 Constant:
+0:?                   0 (const int)
+0:?               flInFactor: direct index for structure ( temp float)
+0:?                 '@patchConstantResult' ( temp structure{ temp 3-element array of float tfactor,  temp float flInFactor})
+0:?                 Constant:
+0:?                   1 (const int)
+0:34  Function Definition: PCF(struct-hs_out_t-vf31[3]; ( temp structure{ temp 3-element array of float tfactor,  temp float flInFactor})
+0:34    Function Parameters: 
+0:34      'pcf_out' ( const (read only) 3-element array of structure{ temp 3-component vector of float val})
+0:?     Sequence
+0:37      move second child to first child ( temp float)
+0:37        direct index ( temp float)
+0:37          tfactor: direct index for structure ( temp 3-element array of float)
+0:37            'o' ( temp structure{ temp 3-element array of float tfactor,  temp float flInFactor})
+0:37            Constant:
+0:37              0 (const int)
+0:37          Constant:
+0:37            0 (const int)
+0:37        direct index ( temp float)
+0:37          val: direct index for structure ( temp 3-component vector of float)
+0:37            direct index ( temp structure{ temp 3-component vector of float val})
+0:37              'pcf_out' ( const (read only) 3-element array of structure{ temp 3-component vector of float val})
+0:37              Constant:
+0:37                0 (const int)
+0:37            Constant:
+0:37              0 (const int)
+0:37          Constant:
+0:37            0 (const int)
+0:38      move second child to first child ( temp float)
+0:38        direct index ( temp float)
+0:38          tfactor: direct index for structure ( temp 3-element array of float)
+0:38            'o' ( temp structure{ temp 3-element array of float tfactor,  temp float flInFactor})
+0:38            Constant:
+0:38              0 (const int)
+0:38          Constant:
+0:38            1 (const int)
+0:38        direct index ( temp float)
+0:38          val: direct index for structure ( temp 3-component vector of float)
+0:38            direct index ( temp structure{ temp 3-component vector of float val})
+0:38              'pcf_out' ( const (read only) 3-element array of structure{ temp 3-component vector of float val})
+0:38              Constant:
+0:38                1 (const int)
+0:38            Constant:
+0:38              0 (const int)
+0:38          Constant:
+0:38            0 (const int)
+0:39      move second child to first child ( temp float)
+0:39        direct index ( temp float)
+0:39          tfactor: direct index for structure ( temp 3-element array of float)
+0:39            'o' ( temp structure{ temp 3-element array of float tfactor,  temp float flInFactor})
+0:39            Constant:
+0:39              0 (const int)
+0:39          Constant:
+0:39            2 (const int)
+0:39        direct index ( temp float)
+0:39          val: direct index for structure ( temp 3-component vector of float)
+0:39            direct index ( temp structure{ temp 3-component vector of float val})
+0:39              'pcf_out' ( const (read only) 3-element array of structure{ temp 3-component vector of float val})
+0:39              Constant:
+0:39                2 (const int)
+0:39            Constant:
+0:39              0 (const int)
+0:39          Constant:
+0:39            0 (const int)
+0:40      move second child to first child ( temp float)
+0:40        flInFactor: direct index for structure ( temp float)
+0:40          'o' ( temp structure{ temp 3-element array of float tfactor,  temp float flInFactor})
+0:40          Constant:
+0:40            1 (const int)
+0:40        Constant:
+0:40          4.000000
+0:42      Branch: Return with expression
+0:42        'o' ( temp structure{ temp 3-element array of float tfactor,  temp float flInFactor})
+0:?   Linker Objects
+0:?     '@entryPointOutput' (layout( location=0) out 3-element array of structure{ temp 3-component vector of float val})
+0:?     'i' (layout( location=0) in 3-element array of structure{ temp 3-component vector of float val})
+0:?     'cpid' ( in uint InvocationID)
+0:?     '@patchConstantOutput' (layout( location=1) patch out structure{})
+0:?     '@patchConstantOutput_tfactor' ( patch out 4-element array of float TessLevelOuter)
+0:?     '@patchConstantOutput_flInFactor' ( patch out 2-element array of float TessLevelInner)
+
+
+Linked tessellation control stage:
+
+
+Shader version: 450
+vertices = 3
+vertex spacing = fractional_odd_spacing
+triangle order = cw
+0:? Sequence
+0:27  Function Definition: @main(struct-hs_in_t-vf31[3];u1; ( temp structure{ temp 3-component vector of float val})
+0:27    Function Parameters: 
+0:27      'i' ( in 3-element array of structure{ temp 3-component vector of float val})
+0:27      'cpid' ( in uint)
+0:?     Sequence
+0:29      move second child to first child ( temp 3-component vector of float)
+0:29        val: direct index for structure ( temp 3-component vector of float)
+0:29          'o' ( temp structure{ temp 3-component vector of float val})
+0:29          Constant:
+0:29            0 (const int)
+0:29        Construct vec3 ( temp 3-component vector of float)
+0:29          Convert uint to float ( temp float)
+0:29            'cpid' ( in uint)
+0:30      Branch: Return with expression
+0:30        'o' ( temp structure{ temp 3-component vector of float val})
+0:27  Function Definition: main( ( temp void)
+0:27    Function Parameters: 
+0:?     Sequence
+0:27      move second child to first child ( temp 3-element array of structure{ temp 3-component vector of float val})
+0:?         'i' ( temp 3-element array of structure{ temp 3-component vector of float val})
+0:?         'i' (layout( location=0) in 3-element array of structure{ temp 3-component vector of float val})
+0:27      move second child to first child ( temp uint)
+0:?         'cpid' ( temp uint)
+0:?         'cpid' ( in uint InvocationID)
+0:27      move second child to first child ( temp structure{ temp 3-component vector of float val})
+0:27        indirect index ( temp structure{ temp 3-component vector of float val})
+0:?           '@entryPointOutput' (layout( location=0) out 3-element array of structure{ temp 3-component vector of float val})
+0:?           'cpid' ( in uint InvocationID)
+0:27        Function Call: @main(struct-hs_in_t-vf31[3];u1; ( temp structure{ temp 3-component vector of float val})
+0:?           'i' ( temp 3-element array of structure{ temp 3-component vector of float val})
+0:?           'cpid' ( temp uint)
+0:?       Barrier ( temp void)
+0:?       Test condition and select ( temp void)
+0:?         Condition
+0:?         Compare Equal ( temp bool)
+0:?           'cpid' ( in uint InvocationID)
+0:?           Constant:
+0:?             0 (const int)
+0:?         true case
+0:?         Sequence
+0:?           move second child to first child ( temp structure{ temp 3-component vector of float val})
+0:?             direct index ( temp structure{ temp 3-component vector of float val})
+0:?               'pcf_out' ( temp 3-element array of structure{ temp 3-component vector of float val})
+0:?               Constant:
+0:?                 0 (const int)
+0:?             Function Call: @main(struct-hs_in_t-vf31[3];u1; ( temp structure{ temp 3-component vector of float val})
+0:?               'i' ( temp 3-element array of structure{ temp 3-component vector of float val})
+0:?               Constant:
+0:?                 0 (const uint)
+0:?           move second child to first child ( temp structure{ temp 3-component vector of float val})
+0:?             direct index ( temp structure{ temp 3-component vector of float val})
+0:?               'pcf_out' ( temp 3-element array of structure{ temp 3-component vector of float val})
+0:?               Constant:
+0:?                 1 (const int)
+0:?             Function Call: @main(struct-hs_in_t-vf31[3];u1; ( temp structure{ temp 3-component vector of float val})
+0:?               'i' ( temp 3-element array of structure{ temp 3-component vector of float val})
+0:?               Constant:
+0:?                 1 (const uint)
+0:?           move second child to first child ( temp structure{ temp 3-component vector of float val})
+0:?             direct index ( temp structure{ temp 3-component vector of float val})
+0:?               'pcf_out' ( temp 3-element array of structure{ temp 3-component vector of float val})
+0:?               Constant:
+0:?                 2 (const int)
+0:?             Function Call: @main(struct-hs_in_t-vf31[3];u1; ( temp structure{ temp 3-component vector of float val})
+0:?               'i' ( temp 3-element array of structure{ temp 3-component vector of float val})
+0:?               Constant:
+0:?                 2 (const uint)
+0:?           move second child to first child ( temp structure{ temp 3-element array of float tfactor,  temp float flInFactor})
+0:?             '@patchConstantResult' ( temp structure{ temp 3-element array of float tfactor,  temp float flInFactor})
+0:?             Function Call: PCF(struct-hs_out_t-vf31[3]; ( temp structure{ temp 3-element array of float tfactor,  temp float flInFactor})
+0:?               'pcf_out' ( temp 3-element array of structure{ temp 3-component vector of float val})
+0:?           Sequence
+0:?             move second child to first child ( temp float)
+0:?               direct index ( patch out float TessLevelOuter)
+0:?                 '@patchConstantOutput_tfactor' ( patch out 4-element array of float TessLevelOuter)
+0:?                 Constant:
+0:?                   0 (const int)
+0:?               direct index ( temp float)
+0:?                 tfactor: direct index for structure ( temp 3-element array of float)
+0:?                   '@patchConstantResult' ( temp structure{ temp 3-element array of float tfactor,  temp float flInFactor})
+0:?                   Constant:
+0:?                     0 (const int)
+0:?                 Constant:
+0:?                   0 (const int)
+0:?             move second child to first child ( temp float)
+0:?               direct index ( patch out float TessLevelOuter)
+0:?                 '@patchConstantOutput_tfactor' ( patch out 4-element array of float TessLevelOuter)
+0:?                 Constant:
+0:?                   1 (const int)
+0:?               direct index ( temp float)
+0:?                 tfactor: direct index for structure ( temp 3-element array of float)
+0:?                   '@patchConstantResult' ( temp structure{ temp 3-element array of float tfactor,  temp float flInFactor})
+0:?                   Constant:
+0:?                     0 (const int)
+0:?                 Constant:
+0:?                   1 (const int)
+0:?             move second child to first child ( temp float)
+0:?               direct index ( patch out float TessLevelOuter)
+0:?                 '@patchConstantOutput_tfactor' ( patch out 4-element array of float TessLevelOuter)
+0:?                 Constant:
+0:?                   2 (const int)
+0:?               direct index ( temp float)
+0:?                 tfactor: direct index for structure ( temp 3-element array of float)
+0:?                   '@patchConstantResult' ( temp structure{ temp 3-element array of float tfactor,  temp float flInFactor})
+0:?                   Constant:
+0:?                     0 (const int)
+0:?                 Constant:
+0:?                   2 (const int)
+0:?             move second child to first child ( temp float)
+0:?               direct index ( patch out float TessLevelInner)
+0:?                 '@patchConstantOutput_flInFactor' ( patch out 2-element array of float TessLevelInner)
+0:?                 Constant:
+0:?                   0 (const int)
+0:?               flInFactor: direct index for structure ( temp float)
+0:?                 '@patchConstantResult' ( temp structure{ temp 3-element array of float tfactor,  temp float flInFactor})
+0:?                 Constant:
+0:?                   1 (const int)
+0:34  Function Definition: PCF(struct-hs_out_t-vf31[3]; ( temp structure{ temp 3-element array of float tfactor,  temp float flInFactor})
+0:34    Function Parameters: 
+0:34      'pcf_out' ( const (read only) 3-element array of structure{ temp 3-component vector of float val})
+0:?     Sequence
+0:37      move second child to first child ( temp float)
+0:37        direct index ( temp float)
+0:37          tfactor: direct index for structure ( temp 3-element array of float)
+0:37            'o' ( temp structure{ temp 3-element array of float tfactor,  temp float flInFactor})
+0:37            Constant:
+0:37              0 (const int)
+0:37          Constant:
+0:37            0 (const int)
+0:37        direct index ( temp float)
+0:37          val: direct index for structure ( temp 3-component vector of float)
+0:37            direct index ( temp structure{ temp 3-component vector of float val})
+0:37              'pcf_out' ( const (read only) 3-element array of structure{ temp 3-component vector of float val})
+0:37              Constant:
+0:37                0 (const int)
+0:37            Constant:
+0:37              0 (const int)
+0:37          Constant:
+0:37            0 (const int)
+0:38      move second child to first child ( temp float)
+0:38        direct index ( temp float)
+0:38          tfactor: direct index for structure ( temp 3-element array of float)
+0:38            'o' ( temp structure{ temp 3-element array of float tfactor,  temp float flInFactor})
+0:38            Constant:
+0:38              0 (const int)
+0:38          Constant:
+0:38            1 (const int)
+0:38        direct index ( temp float)
+0:38          val: direct index for structure ( temp 3-component vector of float)
+0:38            direct index ( temp structure{ temp 3-component vector of float val})
+0:38              'pcf_out' ( const (read only) 3-element array of structure{ temp 3-component vector of float val})
+0:38              Constant:
+0:38                1 (const int)
+0:38            Constant:
+0:38              0 (const int)
+0:38          Constant:
+0:38            0 (const int)
+0:39      move second child to first child ( temp float)
+0:39        direct index ( temp float)
+0:39          tfactor: direct index for structure ( temp 3-element array of float)
+0:39            'o' ( temp structure{ temp 3-element array of float tfactor,  temp float flInFactor})
+0:39            Constant:
+0:39              0 (const int)
+0:39          Constant:
+0:39            2 (const int)
+0:39        direct index ( temp float)
+0:39          val: direct index for structure ( temp 3-component vector of float)
+0:39            direct index ( temp structure{ temp 3-component vector of float val})
+0:39              'pcf_out' ( const (read only) 3-element array of structure{ temp 3-component vector of float val})
+0:39              Constant:
+0:39                2 (const int)
+0:39            Constant:
+0:39              0 (const int)
+0:39          Constant:
+0:39            0 (const int)
+0:40      move second child to first child ( temp float)
+0:40        flInFactor: direct index for structure ( temp float)
+0:40          'o' ( temp structure{ temp 3-element array of float tfactor,  temp float flInFactor})
+0:40          Constant:
+0:40            1 (const int)
+0:40        Constant:
+0:40          4.000000
+0:42      Branch: Return with expression
+0:42        'o' ( temp structure{ temp 3-element array of float tfactor,  temp float flInFactor})
+0:?   Linker Objects
+0:?     '@entryPointOutput' (layout( location=0) out 3-element array of structure{ temp 3-component vector of float val})
+0:?     'i' (layout( location=0) in 3-element array of structure{ temp 3-component vector of float val})
+0:?     'cpid' ( in uint InvocationID)
+0:?     '@patchConstantOutput' (layout( location=1) patch out structure{})
+0:?     '@patchConstantOutput_tfactor' ( patch out 4-element array of float TessLevelOuter)
+0:?     '@patchConstantOutput_flInFactor' ( patch out 2-element array of float TessLevelInner)
+
+// Module Version 10000
+// Generated by (magic number): 80001
+// Id's are bound by 127
+
+                              Capability Tessellation
+               1:             ExtInstImport  "GLSL.std.450"
+                              MemoryModel Logical GLSL450
+                              EntryPoint TessellationControl 4  "main" 41 45 48 94 108 126
+                              ExecutionMode 4 OutputVertices 3
+                              ExecutionMode 4 Triangles
+                              ExecutionMode 4 SpacingFractionalOdd
+                              ExecutionMode 4 VertexOrderCw
+                              Name 4  "main"
+                              Name 8  "hs_in_t"
+                              MemberName 8(hs_in_t) 0  "val"
+                              Name 14  "hs_out_t"
+                              MemberName 14(hs_out_t) 0  "val"
+                              Name 18  "@main(struct-hs_in_t-vf31[3];u1;"
+                              Name 16  "i"
+                              Name 17  "cpid"
+                              Name 22  "hs_pcf_t"
+                              MemberName 22(hs_pcf_t) 0  "tfactor"
+                              MemberName 22(hs_pcf_t) 1  "flInFactor"
+                              Name 25  "PCF(struct-hs_out_t-vf31[3];"
+                              Name 24  "pcf_out"
+                              Name 28  "o"
+                              Name 39  "i"
+                              Name 41  "i"
+                              Name 43  "cpid"
+                              Name 45  "cpid"
+                              Name 48  "@entryPointOutput"
+                              Name 50  "param"
+                              Name 52  "param"
+                              Name 66  "pcf_out"
+                              Name 67  "i"
+                              Name 68  "param"
+                              Name 70  "param"
+                              Name 74  "i"
+                              Name 75  "param"
+                              Name 77  "param"
+                              Name 81  "i"
+                              Name 82  "param"
+                              Name 84  "param"
+                              Name 88  "@patchConstantResult"
+                              Name 94  "@patchConstantOutput_tfactor"
+                              Name 108  "@patchConstantOutput_flInFactor"
+                              Name 112  "o"
+                              Name 124  "hs_pcf_t"
+                              Name 126  "@patchConstantOutput"
+                              Decorate 41(i) Location 0
+                              Decorate 45(cpid) BuiltIn InvocationId
+                              Decorate 48(@entryPointOutput) Location 0
+                              Decorate 94(@patchConstantOutput_tfactor) Patch
+                              Decorate 94(@patchConstantOutput_tfactor) BuiltIn TessLevelOuter
+                              Decorate 108(@patchConstantOutput_flInFactor) Patch
+                              Decorate 108(@patchConstantOutput_flInFactor) BuiltIn TessLevelInner
+                              Decorate 126(@patchConstantOutput) Patch
+                              Decorate 126(@patchConstantOutput) Location 1
+               2:             TypeVoid
+               3:             TypeFunction 2
+               6:             TypeFloat 32
+               7:             TypeVector 6(float) 3
+      8(hs_in_t):             TypeStruct 7(fvec3)
+               9:             TypeInt 32 0
+              10:      9(int) Constant 3
+              11:             TypeArray 8(hs_in_t) 10
+              12:             TypePointer Function 11
+              13:             TypePointer Function 9(int)
+    14(hs_out_t):             TypeStruct 7(fvec3)
+              15:             TypeFunction 14(hs_out_t) 12(ptr) 13(ptr)
+              20:             TypeArray 14(hs_out_t) 10
+              21:             TypeArray 6(float) 10
+    22(hs_pcf_t):             TypeStruct 21 6(float)
+              23:             TypeFunction 22(hs_pcf_t) 20
+              27:             TypePointer Function 14(hs_out_t)
+              29:             TypeInt 32 1
+              30:     29(int) Constant 0
+              34:             TypePointer Function 7(fvec3)
+              40:             TypePointer Input 11
+           41(i):     40(ptr) Variable Input
+              44:             TypePointer Input 9(int)
+        45(cpid):     44(ptr) Variable Input
+              47:             TypePointer Output 20
+48(@entryPointOutput):     47(ptr) Variable Output
+              55:             TypePointer Output 14(hs_out_t)
+              57:      9(int) Constant 2
+              58:      9(int) Constant 1
+              59:      9(int) Constant 0
+              61:             TypeBool
+              65:             TypePointer Function 20
+              73:     29(int) Constant 1
+              80:     29(int) Constant 2
+              87:             TypePointer Function 22(hs_pcf_t)
+              91:      9(int) Constant 4
+              92:             TypeArray 6(float) 91
+              93:             TypePointer Output 92
+94(@patchConstantOutput_tfactor):     93(ptr) Variable Output
+              95:             TypePointer Function 6(float)
+              98:             TypePointer Output 6(float)
+             106:             TypeArray 6(float) 57
+             107:             TypePointer Output 106
+108(@patchConstantOutput_flInFactor):    107(ptr) Variable Output
+             119:    6(float) Constant 1082130432
+   124(hs_pcf_t):             TypeStruct
+             125:             TypePointer Output 124(hs_pcf_t)
+126(@patchConstantOutput):    125(ptr) Variable Output
+         4(main):           2 Function None 3
+               5:             Label
+           39(i):     12(ptr) Variable Function
+        43(cpid):     13(ptr) Variable Function
+       50(param):     12(ptr) Variable Function
+       52(param):     13(ptr) Variable Function
+     66(pcf_out):     65(ptr) Variable Function
+           67(i):     12(ptr) Variable Function
+       68(param):     12(ptr) Variable Function
+       70(param):     13(ptr) Variable Function
+           74(i):     12(ptr) Variable Function
+       75(param):     12(ptr) Variable Function
+       77(param):     13(ptr) Variable Function
+           81(i):     12(ptr) Variable Function
+       82(param):     12(ptr) Variable Function
+       84(param):     13(ptr) Variable Function
+88(@patchConstantResult):     87(ptr) Variable Function
+              42:          11 Load 41(i)
+                              Store 39(i) 42
+              46:      9(int) Load 45(cpid)
+                              Store 43(cpid) 46
+              49:      9(int) Load 45(cpid)
+              51:          11 Load 39(i)
+                              Store 50(param) 51
+              53:      9(int) Load 43(cpid)
+                              Store 52(param) 53
+              54:14(hs_out_t) FunctionCall 18(@main(struct-hs_in_t-vf31[3];u1;) 50(param) 52(param)
+              56:     55(ptr) AccessChain 48(@entryPointOutput) 49
+                              Store 56 54
+                              ControlBarrier 57 58 59
+              60:      9(int) Load 45(cpid)
+              62:    61(bool) IEqual 60 30
+                              SelectionMerge 64 None
+                              BranchConditional 62 63 64
+              63:               Label
+              69:          11   Load 67(i)
+                                Store 68(param) 69
+                                Store 70(param) 59
+              71:14(hs_out_t)   FunctionCall 18(@main(struct-hs_in_t-vf31[3];u1;) 68(param) 70(param)
+              72:     27(ptr)   AccessChain 66(pcf_out) 30
+                                Store 72 71
+              76:          11   Load 74(i)
+                                Store 75(param) 76
+                                Store 77(param) 58
+              78:14(hs_out_t)   FunctionCall 18(@main(struct-hs_in_t-vf31[3];u1;) 75(param) 77(param)
+              79:     27(ptr)   AccessChain 66(pcf_out) 73
+                                Store 79 78
+              83:          11   Load 81(i)
+                                Store 82(param) 83
+                                Store 84(param) 57
+              85:14(hs_out_t)   FunctionCall 18(@main(struct-hs_in_t-vf31[3];u1;) 82(param) 84(param)
+              86:     27(ptr)   AccessChain 66(pcf_out) 80
+                                Store 86 85
+              89:          20   Load 66(pcf_out)
+              90:22(hs_pcf_t)   FunctionCall 25(PCF(struct-hs_out_t-vf31[3];) 89
+                                Store 88(@patchConstantResult) 90
+              96:     95(ptr)   AccessChain 88(@patchConstantResult) 30 30
+              97:    6(float)   Load 96
+              99:     98(ptr)   AccessChain 94(@patchConstantOutput_tfactor) 30
+                                Store 99 97
+             100:     95(ptr)   AccessChain 88(@patchConstantResult) 30 73
+             101:    6(float)   Load 100
+             102:     98(ptr)   AccessChain 94(@patchConstantOutput_tfactor) 73
+                                Store 102 101
+             103:     95(ptr)   AccessChain 88(@patchConstantResult) 30 80
+             104:    6(float)   Load 103
+             105:     98(ptr)   AccessChain 94(@patchConstantOutput_tfactor) 80
+                                Store 105 104
+             109:     95(ptr)   AccessChain 88(@patchConstantResult) 73
+             110:    6(float)   Load 109
+             111:     98(ptr)   AccessChain 108(@patchConstantOutput_flInFactor) 30
+                                Store 111 110
+                                Branch 64
+              64:             Label
+                              Return
+                              FunctionEnd
+18(@main(struct-hs_in_t-vf31[3];u1;):14(hs_out_t) Function None 15
+           16(i):     12(ptr) FunctionParameter
+        17(cpid):     13(ptr) FunctionParameter
+              19:             Label
+           28(o):     27(ptr) Variable Function
+              31:      9(int) Load 17(cpid)
+              32:    6(float) ConvertUToF 31
+              33:    7(fvec3) CompositeConstruct 32 32 32
+              35:     34(ptr) AccessChain 28(o) 30
+                              Store 35 33
+              36:14(hs_out_t) Load 28(o)
+                              ReturnValue 36
+                              FunctionEnd
+25(PCF(struct-hs_out_t-vf31[3];):22(hs_pcf_t) Function None 23
+     24(pcf_out):          20 FunctionParameter
+              26:             Label
+          112(o):     87(ptr) Variable Function
+             113:    6(float) CompositeExtract 24(pcf_out) 0 0 0
+             114:     95(ptr) AccessChain 112(o) 30 30
+                              Store 114 113
+             115:    6(float) CompositeExtract 24(pcf_out) 1 0 0
+             116:     95(ptr) AccessChain 112(o) 30 73
+                              Store 116 115
+             117:    6(float) CompositeExtract 24(pcf_out) 2 0 0
+             118:     95(ptr) AccessChain 112(o) 30 80
+                              Store 118 117
+             120:     95(ptr) AccessChain 112(o) 73
+                              Store 120 119
+             121:22(hs_pcf_t) Load 112(o)
+                              ReturnValue 121
+                              FunctionEnd

+ 49 - 35
3rdparty/glslang/Test/baseResults/hlsl.hull.void.tesc.out

@@ -1,6 +1,7 @@
 hlsl.hull.void.tesc
 hlsl.hull.void.tesc
 Shader version: 450
 Shader version: 450
 vertices = 3
 vertices = 3
+vertex spacing = fractional_even_spacing
 0:? Sequence
 0:? Sequence
 0:26  Function Definition: @main(struct-VS_OUT-vf31[3]; ( temp structure{ temp 3-component vector of float cpoint})
 0:26  Function Definition: @main(struct-VS_OUT-vf31[3]; ( temp structure{ temp 3-component vector of float cpoint})
 0:26    Function Parameters: 
 0:26    Function Parameters: 
@@ -27,7 +28,9 @@ vertices = 3
 0:?         'ip' ( temp 3-element array of structure{ temp 3-component vector of float cpoint})
 0:?         'ip' ( temp 3-element array of structure{ temp 3-component vector of float cpoint})
 0:?         'ip' (layout( location=0) in 3-element array of structure{ temp 3-component vector of float cpoint})
 0:?         'ip' (layout( location=0) in 3-element array of structure{ temp 3-component vector of float cpoint})
 0:26      move second child to first child ( temp structure{ temp 3-component vector of float cpoint})
 0:26      move second child to first child ( temp structure{ temp 3-component vector of float cpoint})
-0:?         '@entryPointOutput' (layout( location=0) out structure{ temp 3-component vector of float cpoint})
+0:26        indirect index ( temp structure{ temp 3-component vector of float cpoint})
+0:?           '@entryPointOutput' (layout( location=0) out 3-element array of structure{ temp 3-component vector of float cpoint})
+0:?           'InvocationId' ( in uint InvocationID)
 0:26        Function Call: @main(struct-VS_OUT-vf31[3]; ( temp structure{ temp 3-component vector of float cpoint})
 0:26        Function Call: @main(struct-VS_OUT-vf31[3]; ( temp structure{ temp 3-component vector of float cpoint})
 0:?           'ip' ( temp 3-element array of structure{ temp 3-component vector of float cpoint})
 0:?           'ip' ( temp 3-element array of structure{ temp 3-component vector of float cpoint})
 0:?       Barrier ( temp void)
 0:?       Barrier ( temp void)
@@ -38,11 +41,12 @@ vertices = 3
 0:?           Constant:
 0:?           Constant:
 0:?             0 (const int)
 0:?             0 (const int)
 0:?         true case
 0:?         true case
-0:?         Function Call: PCF( ( temp void)
+0:?         Sequence
+0:?           Function Call: PCF( ( temp void)
 0:33  Function Definition: PCF( ( temp void)
 0:33  Function Definition: PCF( ( temp void)
 0:33    Function Parameters: 
 0:33    Function Parameters: 
 0:?   Linker Objects
 0:?   Linker Objects
-0:?     '@entryPointOutput' (layout( location=0) out structure{ temp 3-component vector of float cpoint})
+0:?     '@entryPointOutput' (layout( location=0) out 3-element array of structure{ temp 3-component vector of float cpoint})
 0:?     'ip' (layout( location=0) in 3-element array of structure{ temp 3-component vector of float cpoint})
 0:?     'ip' (layout( location=0) in 3-element array of structure{ temp 3-component vector of float cpoint})
 0:?     'InvocationId' ( in uint InvocationID)
 0:?     'InvocationId' ( in uint InvocationID)
 
 
@@ -52,6 +56,7 @@ Linked tessellation control stage:
 
 
 Shader version: 450
 Shader version: 450
 vertices = 3
 vertices = 3
+vertex spacing = fractional_even_spacing
 0:? Sequence
 0:? Sequence
 0:26  Function Definition: @main(struct-VS_OUT-vf31[3]; ( temp structure{ temp 3-component vector of float cpoint})
 0:26  Function Definition: @main(struct-VS_OUT-vf31[3]; ( temp structure{ temp 3-component vector of float cpoint})
 0:26    Function Parameters: 
 0:26    Function Parameters: 
@@ -78,7 +83,9 @@ vertices = 3
 0:?         'ip' ( temp 3-element array of structure{ temp 3-component vector of float cpoint})
 0:?         'ip' ( temp 3-element array of structure{ temp 3-component vector of float cpoint})
 0:?         'ip' (layout( location=0) in 3-element array of structure{ temp 3-component vector of float cpoint})
 0:?         'ip' (layout( location=0) in 3-element array of structure{ temp 3-component vector of float cpoint})
 0:26      move second child to first child ( temp structure{ temp 3-component vector of float cpoint})
 0:26      move second child to first child ( temp structure{ temp 3-component vector of float cpoint})
-0:?         '@entryPointOutput' (layout( location=0) out structure{ temp 3-component vector of float cpoint})
+0:26        indirect index ( temp structure{ temp 3-component vector of float cpoint})
+0:?           '@entryPointOutput' (layout( location=0) out 3-element array of structure{ temp 3-component vector of float cpoint})
+0:?           'InvocationId' ( in uint InvocationID)
 0:26        Function Call: @main(struct-VS_OUT-vf31[3]; ( temp structure{ temp 3-component vector of float cpoint})
 0:26        Function Call: @main(struct-VS_OUT-vf31[3]; ( temp structure{ temp 3-component vector of float cpoint})
 0:?           'ip' ( temp 3-element array of structure{ temp 3-component vector of float cpoint})
 0:?           'ip' ( temp 3-element array of structure{ temp 3-component vector of float cpoint})
 0:?       Barrier ( temp void)
 0:?       Barrier ( temp void)
@@ -89,23 +96,26 @@ vertices = 3
 0:?           Constant:
 0:?           Constant:
 0:?             0 (const int)
 0:?             0 (const int)
 0:?         true case
 0:?         true case
-0:?         Function Call: PCF( ( temp void)
+0:?         Sequence
+0:?           Function Call: PCF( ( temp void)
 0:33  Function Definition: PCF( ( temp void)
 0:33  Function Definition: PCF( ( temp void)
 0:33    Function Parameters: 
 0:33    Function Parameters: 
 0:?   Linker Objects
 0:?   Linker Objects
-0:?     '@entryPointOutput' (layout( location=0) out structure{ temp 3-component vector of float cpoint})
+0:?     '@entryPointOutput' (layout( location=0) out 3-element array of structure{ temp 3-component vector of float cpoint})
 0:?     'ip' (layout( location=0) in 3-element array of structure{ temp 3-component vector of float cpoint})
 0:?     'ip' (layout( location=0) in 3-element array of structure{ temp 3-component vector of float cpoint})
 0:?     'InvocationId' ( in uint InvocationID)
 0:?     'InvocationId' ( in uint InvocationID)
 
 
 // Module Version 10000
 // Module Version 10000
 // Generated by (magic number): 80001
 // Generated by (magic number): 80001
-// Id's are bound by 51
+// Id's are bound by 55
 
 
                               Capability Tessellation
                               Capability Tessellation
                1:             ExtInstImport  "GLSL.std.450"
                1:             ExtInstImport  "GLSL.std.450"
                               MemoryModel Logical GLSL450
                               MemoryModel Logical GLSL450
-                              EntryPoint TessellationControl 4  "main" 33 36 44
+                              EntryPoint TessellationControl 4  "main" 33 37 39
                               ExecutionMode 4 OutputVertices 3
                               ExecutionMode 4 OutputVertices 3
+                              ExecutionMode 4 Triangles
+                              ExecutionMode 4 SpacingFractionalEven
                               Name 4  "main"
                               Name 4  "main"
                               Name 8  "VS_OUT"
                               Name 8  "VS_OUT"
                               MemberName 8(VS_OUT) 0  "cpoint"
                               MemberName 8(VS_OUT) 0  "cpoint"
@@ -117,12 +127,12 @@ vertices = 3
                               Name 21  "output"
                               Name 21  "output"
                               Name 31  "ip"
                               Name 31  "ip"
                               Name 33  "ip"
                               Name 33  "ip"
-                              Name 36  "@entryPointOutput"
-                              Name 37  "param"
-                              Name 44  "InvocationId"
+                              Name 37  "@entryPointOutput"
+                              Name 39  "InvocationId"
+                              Name 41  "param"
                               Decorate 33(ip) Location 0
                               Decorate 33(ip) Location 0
-                              Decorate 36(@entryPointOutput) Location 0
-                              Decorate 44(InvocationId) BuiltIn InvocationId
+                              Decorate 37(@entryPointOutput) Location 0
+                              Decorate 39(InvocationId) BuiltIn InvocationId
                2:             TypeVoid
                2:             TypeVoid
                3:             TypeFunction 2
                3:             TypeFunction 2
                6:             TypeFloat 32
                6:             TypeFloat 32
@@ -140,33 +150,37 @@ vertices = 3
               24:             TypePointer Function 7(fvec3)
               24:             TypePointer Function 7(fvec3)
               32:             TypePointer Input 11
               32:             TypePointer Input 11
           33(ip):     32(ptr) Variable Input
           33(ip):     32(ptr) Variable Input
-              35:             TypePointer Output 13(HS_OUT)
-36(@entryPointOutput):     35(ptr) Variable Output
-              40:      9(int) Constant 2
-              41:      9(int) Constant 1
-              42:      9(int) Constant 0
-              43:             TypePointer Input 9(int)
-44(InvocationId):     43(ptr) Variable Input
-              46:             TypeBool
+              35:             TypeArray 13(HS_OUT) 10
+              36:             TypePointer Output 35
+37(@entryPointOutput):     36(ptr) Variable Output
+              38:             TypePointer Input 9(int)
+39(InvocationId):     38(ptr) Variable Input
+              44:             TypePointer Output 13(HS_OUT)
+              46:      9(int) Constant 2
+              47:      9(int) Constant 1
+              48:      9(int) Constant 0
+              50:             TypeBool
          4(main):           2 Function None 3
          4(main):           2 Function None 3
                5:             Label
                5:             Label
           31(ip):     12(ptr) Variable Function
           31(ip):     12(ptr) Variable Function
-       37(param):     12(ptr) Variable Function
+       41(param):     12(ptr) Variable Function
               34:          11 Load 33(ip)
               34:          11 Load 33(ip)
                               Store 31(ip) 34
                               Store 31(ip) 34
-              38:          11 Load 31(ip)
-                              Store 37(param) 38
-              39:  13(HS_OUT) FunctionCall 16(@main(struct-VS_OUT-vf31[3];) 37(param)
-                              Store 36(@entryPointOutput) 39
-                              ControlBarrier 40 41 42
-              45:      9(int) Load 44(InvocationId)
-              47:    46(bool) IEqual 45 23
-                              SelectionMerge 49 None
-                              BranchConditional 47 48 49
-              48:               Label
-              50:           2   FunctionCall 18(PCF()
-                                Branch 49
-              49:             Label
+              40:      9(int) Load 39(InvocationId)
+              42:          11 Load 31(ip)
+                              Store 41(param) 42
+              43:  13(HS_OUT) FunctionCall 16(@main(struct-VS_OUT-vf31[3];) 41(param)
+              45:     44(ptr) AccessChain 37(@entryPointOutput) 40
+                              Store 45 43
+                              ControlBarrier 46 47 48
+              49:      9(int) Load 39(InvocationId)
+              51:    50(bool) IEqual 49 23
+                              SelectionMerge 53 None
+                              BranchConditional 51 52 53
+              52:               Label
+              54:           2   FunctionCall 18(PCF()
+                                Branch 53
+              53:             Label
                               Return
                               Return
                               FunctionEnd
                               FunctionEnd
 16(@main(struct-VS_OUT-vf31[3];):  13(HS_OUT) Function None 14
 16(@main(struct-VS_OUT-vf31[3];):  13(HS_OUT) Function None 14

+ 65 - 61
3rdparty/glslang/Test/baseResults/hlsl.if.frag.out

@@ -69,12 +69,13 @@ gl_FragCoord origin is upper left
 0:26              'input' ( in 4-component vector of float)
 0:26              'input' ( in 4-component vector of float)
 0:30      Test condition and select ( temp void)
 0:30      Test condition and select ( temp void)
 0:30        Condition
 0:30        Condition
-0:30        move second child to first child ( temp float)
-0:30          'ii' ( temp float)
-0:30          direct index ( temp float)
-0:30            'input' ( in 4-component vector of float)
-0:30            Constant:
-0:30              2 (const int)
+0:30        Convert float to bool ( temp bool)
+0:30          move second child to first child ( temp float)
+0:30            'ii' ( temp float)
+0:30            direct index ( temp float)
+0:30              'input' ( in 4-component vector of float)
+0:30              Constant:
+0:30                2 (const int)
 0:30        true case
 0:30        true case
 0:31        Pre-Increment ( temp float)
 0:31        Pre-Increment ( temp float)
 0:31          'ii' ( temp float)
 0:31          'ii' ( temp float)
@@ -178,12 +179,13 @@ gl_FragCoord origin is upper left
 0:26              'input' ( in 4-component vector of float)
 0:26              'input' ( in 4-component vector of float)
 0:30      Test condition and select ( temp void)
 0:30      Test condition and select ( temp void)
 0:30        Condition
 0:30        Condition
-0:30        move second child to first child ( temp float)
-0:30          'ii' ( temp float)
-0:30          direct index ( temp float)
-0:30            'input' ( in 4-component vector of float)
-0:30            Constant:
-0:30              2 (const int)
+0:30        Convert float to bool ( temp bool)
+0:30          move second child to first child ( temp float)
+0:30            'ii' ( temp float)
+0:30            direct index ( temp float)
+0:30              'input' ( in 4-component vector of float)
+0:30              Constant:
+0:30                2 (const int)
 0:30        true case
 0:30        true case
 0:31        Pre-Increment ( temp float)
 0:31        Pre-Increment ( temp float)
 0:31          'ii' ( temp float)
 0:31          'ii' ( temp float)
@@ -215,24 +217,24 @@ gl_FragCoord origin is upper left
 
 
 // Module Version 10000
 // Module Version 10000
 // Generated by (magic number): 80001
 // Generated by (magic number): 80001
-// Id's are bound by 101
+// Id's are bound by 103
 
 
                               Capability Shader
                               Capability Shader
                1:             ExtInstImport  "GLSL.std.450"
                1:             ExtInstImport  "GLSL.std.450"
                               MemoryModel Logical GLSL450
                               MemoryModel Logical GLSL450
-                              EntryPoint Fragment 4  "PixelShaderFunction" 94 97
+                              EntryPoint Fragment 4  "PixelShaderFunction" 96 99
                               ExecutionMode 4 OriginUpperLeft
                               ExecutionMode 4 OriginUpperLeft
                               Name 4  "PixelShaderFunction"
                               Name 4  "PixelShaderFunction"
                               Name 11  "@PixelShaderFunction(vf4;"
                               Name 11  "@PixelShaderFunction(vf4;"
                               Name 10  "input"
                               Name 10  "input"
                               Name 68  "ii"
                               Name 68  "ii"
-                              Name 80  "ii"
-                              Name 92  "input"
+                              Name 82  "ii"
                               Name 94  "input"
                               Name 94  "input"
-                              Name 97  "@entryPointOutput"
-                              Name 98  "param"
-                              Decorate 94(input) Location 0
-                              Decorate 97(@entryPointOutput) Location 0
+                              Name 96  "input"
+                              Name 99  "@entryPointOutput"
+                              Name 100  "param"
+                              Decorate 96(input) Location 0
+                              Decorate 99(@entryPointOutput) Location 0
                2:             TypeVoid
                2:             TypeVoid
                3:             TypeFunction 2
                3:             TypeFunction 2
                6:             TypeFloat 32
                6:             TypeFloat 32
@@ -244,31 +246,32 @@ gl_FragCoord origin is upper left
               67:             TypePointer Function 6(float)
               67:             TypePointer Function 6(float)
               69:             TypeInt 32 0
               69:             TypeInt 32 0
               70:     69(int) Constant 2
               70:     69(int) Constant 2
-              76:    6(float) Constant 1065353216
-              78:             TypeInt 32 1
-              79:             TypePointer Function 78(int)
-              82:     78(int) Constant 1
-              93:             TypePointer Input 7(fvec4)
-       94(input):     93(ptr) Variable Input
-              96:             TypePointer Output 7(fvec4)
-97(@entryPointOutput):     96(ptr) Variable Output
+              73:    6(float) Constant 0
+              78:    6(float) Constant 1065353216
+              80:             TypeInt 32 1
+              81:             TypePointer Function 80(int)
+              84:     80(int) Constant 1
+              95:             TypePointer Input 7(fvec4)
+       96(input):     95(ptr) Variable Input
+              98:             TypePointer Output 7(fvec4)
+99(@entryPointOutput):     98(ptr) Variable Output
 4(PixelShaderFunction):           2 Function None 3
 4(PixelShaderFunction):           2 Function None 3
                5:             Label
                5:             Label
-       92(input):      8(ptr) Variable Function
-       98(param):      8(ptr) Variable Function
-              95:    7(fvec4) Load 94(input)
-                              Store 92(input) 95
-              99:    7(fvec4) Load 92(input)
-                              Store 98(param) 99
-             100:    7(fvec4) FunctionCall 11(@PixelShaderFunction(vf4;) 98(param)
-                              Store 97(@entryPointOutput) 100
+       94(input):      8(ptr) Variable Function
+      100(param):      8(ptr) Variable Function
+              97:    7(fvec4) Load 96(input)
+                              Store 94(input) 97
+             101:    7(fvec4) Load 94(input)
+                              Store 100(param) 101
+             102:    7(fvec4) FunctionCall 11(@PixelShaderFunction(vf4;) 100(param)
+                              Store 99(@entryPointOutput) 102
                               Return
                               Return
                               FunctionEnd
                               FunctionEnd
 11(@PixelShaderFunction(vf4;):    7(fvec4) Function None 9
 11(@PixelShaderFunction(vf4;):    7(fvec4) Function None 9
        10(input):      8(ptr) FunctionParameter
        10(input):      8(ptr) FunctionParameter
               12:             Label
               12:             Label
           68(ii):     67(ptr) Variable Function
           68(ii):     67(ptr) Variable Function
-          80(ii):     79(ptr) Variable Function
+          82(ii):     81(ptr) Variable Function
               13:    7(fvec4) Load 10(input)
               13:    7(fvec4) Load 10(input)
               14:    7(fvec4) Load 10(input)
               14:    7(fvec4) Load 10(input)
               17:   16(bvec4) FOrdEqual 13 14
               17:   16(bvec4) FOrdEqual 13 14
@@ -338,28 +341,29 @@ gl_FragCoord origin is upper left
               71:     67(ptr) AccessChain 10(input) 70
               71:     67(ptr) AccessChain 10(input) 70
               72:    6(float) Load 71
               72:    6(float) Load 71
                               Store 68(ii) 72
                               Store 68(ii) 72
-                              SelectionMerge 74 None
-                              BranchConditional 72 73 74
-              73:               Label
-              75:    6(float)   Load 68(ii)
-              77:    6(float)   FAdd 75 76
-                                Store 68(ii) 77
-                                Branch 74
-              74:             Label
-              81:     78(int) Load 80(ii)
-              83:     78(int) IAdd 81 82
-                              Store 80(ii) 83
-              84:     78(int) Load 80(ii)
-              85:    6(float) ConvertSToF 84
-              86:    15(bool) FOrdEqual 85 76
-                              SelectionMerge 88 None
-                              BranchConditional 86 87 88
-              87:               Label
-              89:     78(int)   Load 80(ii)
-              90:     78(int)   IAdd 89 82
-                                Store 80(ii) 90
-                                Branch 88
-              88:             Label
-              91:    7(fvec4) Undef
-                              ReturnValue 91
+              74:    15(bool) FOrdNotEqual 72 73
+                              SelectionMerge 76 None
+                              BranchConditional 74 75 76
+              75:               Label
+              77:    6(float)   Load 68(ii)
+              79:    6(float)   FAdd 77 78
+                                Store 68(ii) 79
+                                Branch 76
+              76:             Label
+              83:     80(int) Load 82(ii)
+              85:     80(int) IAdd 83 84
+                              Store 82(ii) 85
+              86:     80(int) Load 82(ii)
+              87:    6(float) ConvertSToF 86
+              88:    15(bool) FOrdEqual 87 78
+                              SelectionMerge 90 None
+                              BranchConditional 88 89 90
+              89:               Label
+              91:     80(int)   Load 82(ii)
+              92:     80(int)   IAdd 91 84
+                                Store 82(ii) 92
+                                Branch 90
+              90:             Label
+              93:    7(fvec4) Undef
+                              ReturnValue 93
                               FunctionEnd
                               FunctionEnd

+ 549 - 0
3rdparty/glslang/Test/baseResults/hlsl.implicitBool.frag.out

@@ -0,0 +1,549 @@
+hlsl.implicitBool.frag
+Shader version: 450
+gl_FragCoord origin is upper left
+0:? Sequence
+0:7  Function Definition: @main( ( temp 4-component vector of float)
+0:7    Function Parameters: 
+0:?     Sequence
+0:8      Sequence
+0:8        move second child to first child ( temp 4-component vector of float)
+0:8          'a' ( temp 4-component vector of float)
+0:?           Constant:
+0:?             2.000000
+0:?             2.000000
+0:?             2.000000
+0:?             2.000000
+0:9      Test condition and select ( temp void)
+0:9        Condition
+0:9        Convert int to bool ( temp bool)
+0:9          condi: direct index for structure ( uniform int)
+0:9            'anon@0' (layout( row_major std140) uniform block{ uniform float condf,  uniform int condi,  uniform 1-component vector of float condf1,  uniform 1-component vector of int condi1})
+0:9            Constant:
+0:9              1 (const uint)
+0:9        true case
+0:10        Branch: Return with expression
+0:10          add ( temp 4-component vector of float)
+0:10            'a' ( temp 4-component vector of float)
+0:10            Constant:
+0:10              1.000000
+0:11      Test condition and select ( temp void)
+0:11        Condition
+0:11        Convert float to bool ( temp bool)
+0:11          condf: direct index for structure ( uniform float)
+0:11            'anon@0' (layout( row_major std140) uniform block{ uniform float condf,  uniform int condi,  uniform 1-component vector of float condf1,  uniform 1-component vector of int condi1})
+0:11            Constant:
+0:11              0 (const uint)
+0:11        true case
+0:12        Branch: Return with expression
+0:12          add ( temp 4-component vector of float)
+0:12            'a' ( temp 4-component vector of float)
+0:12            Constant:
+0:12              2.000000
+0:13      Test condition and select ( temp void)
+0:13        Condition
+0:13        Convert float to bool ( temp bool)
+0:13          condf1: direct index for structure ( uniform 1-component vector of float)
+0:13            'anon@0' (layout( row_major std140) uniform block{ uniform float condf,  uniform int condi,  uniform 1-component vector of float condf1,  uniform 1-component vector of int condi1})
+0:13            Constant:
+0:13              2 (const uint)
+0:13        true case
+0:14        Branch: Return with expression
+0:14          add ( temp 4-component vector of float)
+0:14            'a' ( temp 4-component vector of float)
+0:14            Constant:
+0:14              3.000000
+0:15      Test condition and select ( temp void)
+0:15        Condition
+0:15        Convert int to bool ( temp bool)
+0:15          condi1: direct index for structure ( uniform 1-component vector of int)
+0:15            'anon@0' (layout( row_major std140) uniform block{ uniform float condf,  uniform int condi,  uniform 1-component vector of float condf1,  uniform 1-component vector of int condi1})
+0:15            Constant:
+0:15              3 (const uint)
+0:15        true case
+0:16        Branch: Return with expression
+0:16          add ( temp 4-component vector of float)
+0:16            'a' ( temp 4-component vector of float)
+0:16            Constant:
+0:16              4.000000
+0:17      Test condition and select ( temp void)
+0:17        Condition
+0:17        logical-or ( temp bool)
+0:17          logical-and ( temp bool)
+0:17            Convert int to bool ( temp bool)
+0:17              condi: direct index for structure ( uniform int)
+0:17                'anon@0' (layout( row_major std140) uniform block{ uniform float condf,  uniform int condi,  uniform 1-component vector of float condf1,  uniform 1-component vector of int condi1})
+0:17                Constant:
+0:17                  1 (const uint)
+0:17            Convert int to bool ( temp bool)
+0:17              Convert float to int ( temp int)
+0:17                condf: direct index for structure ( uniform float)
+0:17                  'anon@0' (layout( row_major std140) uniform block{ uniform float condf,  uniform int condi,  uniform 1-component vector of float condf1,  uniform 1-component vector of int condi1})
+0:17                  Constant:
+0:17                    0 (const uint)
+0:17          Convert float to bool ( temp bool)
+0:17            condf1: direct index for structure ( uniform 1-component vector of float)
+0:17              'anon@0' (layout( row_major std140) uniform block{ uniform float condf,  uniform int condi,  uniform 1-component vector of float condf1,  uniform 1-component vector of int condi1})
+0:17              Constant:
+0:17                2 (const uint)
+0:17        true case
+0:18        Branch: Return with expression
+0:18          add ( temp 4-component vector of float)
+0:18            'a' ( temp 4-component vector of float)
+0:18            Constant:
+0:18              5.000000
+0:20      Sequence
+0:20        move second child to first child ( temp float)
+0:20          'f' ( temp float)
+0:20          condf: direct index for structure ( uniform float)
+0:20            'anon@0' (layout( row_major std140) uniform block{ uniform float condf,  uniform int condi,  uniform 1-component vector of float condf1,  uniform 1-component vector of int condi1})
+0:20            Constant:
+0:20              0 (const uint)
+0:21      Loop with condition tested first
+0:21        Loop Condition
+0:21        Convert float to bool ( temp bool)
+0:21          'f' ( temp float)
+0:21        Loop Body
+0:?         Sequence
+0:21          Pre-Decrement ( temp float)
+0:21            'f' ( temp float)
+0:23      Sequence
+0:23        move second child to first child ( temp int)
+0:23          'i' ( temp int)
+0:23          condi: direct index for structure ( uniform int)
+0:23            'anon@0' (layout( row_major std140) uniform block{ uniform float condf,  uniform int condi,  uniform 1-component vector of float condf1,  uniform 1-component vector of int condi1})
+0:23            Constant:
+0:23              1 (const uint)
+0:24      Loop with condition not tested first
+0:24        Loop Condition
+0:24        Convert int to bool ( temp bool)
+0:24          'i' ( temp int)
+0:24        Loop Body
+0:24        Pre-Decrement ( temp int)
+0:24          'i' ( temp int)
+0:?       Sequence
+0:26        Loop with condition tested first
+0:26          Loop Condition
+0:26          Convert int to bool ( temp bool)
+0:26            'i' ( temp int)
+0:26          Loop Body
+0:?           Sequence
+0:26            Pre-Decrement ( temp int)
+0:26              'i' ( temp int)
+0:28      Sequence
+0:28        move second child to first child ( temp float)
+0:28          'g' ( temp float)
+0:28          Test condition and select ( temp float)
+0:28            Condition
+0:28            Convert float to bool ( temp bool)
+0:28              condf: direct index for structure ( uniform float)
+0:28                'anon@0' (layout( row_major std140) uniform block{ uniform float condf,  uniform int condi,  uniform 1-component vector of float condf1,  uniform 1-component vector of int condi1})
+0:28                Constant:
+0:28                  0 (const uint)
+0:28            true case
+0:28            Constant:
+0:28              7.000000
+0:28            false case
+0:28            Constant:
+0:28              8.000000
+0:29      add second child into first child ( temp 4-component vector of float)
+0:29        'a' ( temp 4-component vector of float)
+0:29        'g' ( temp float)
+0:31      Branch: Return with expression
+0:31        subtract ( temp 4-component vector of float)
+0:31          'a' ( temp 4-component vector of float)
+0:31          Constant:
+0:31            1.000000
+0:7  Function Definition: main( ( temp void)
+0:7    Function Parameters: 
+0:?     Sequence
+0:7      move second child to first child ( temp 4-component vector of float)
+0:?         '@entryPointOutput' (layout( location=0) out 4-component vector of float)
+0:7        Function Call: @main( ( temp 4-component vector of float)
+0:?   Linker Objects
+0:?     'anon@0' (layout( row_major std140) uniform block{ uniform float condf,  uniform int condi,  uniform 1-component vector of float condf1,  uniform 1-component vector of int condi1})
+0:?     '@entryPointOutput' (layout( location=0) out 4-component vector of float)
+
+
+Linked fragment stage:
+
+
+Shader version: 450
+gl_FragCoord origin is upper left
+0:? Sequence
+0:7  Function Definition: @main( ( temp 4-component vector of float)
+0:7    Function Parameters: 
+0:?     Sequence
+0:8      Sequence
+0:8        move second child to first child ( temp 4-component vector of float)
+0:8          'a' ( temp 4-component vector of float)
+0:?           Constant:
+0:?             2.000000
+0:?             2.000000
+0:?             2.000000
+0:?             2.000000
+0:9      Test condition and select ( temp void)
+0:9        Condition
+0:9        Convert int to bool ( temp bool)
+0:9          condi: direct index for structure ( uniform int)
+0:9            'anon@0' (layout( row_major std140) uniform block{ uniform float condf,  uniform int condi,  uniform 1-component vector of float condf1,  uniform 1-component vector of int condi1})
+0:9            Constant:
+0:9              1 (const uint)
+0:9        true case
+0:10        Branch: Return with expression
+0:10          add ( temp 4-component vector of float)
+0:10            'a' ( temp 4-component vector of float)
+0:10            Constant:
+0:10              1.000000
+0:11      Test condition and select ( temp void)
+0:11        Condition
+0:11        Convert float to bool ( temp bool)
+0:11          condf: direct index for structure ( uniform float)
+0:11            'anon@0' (layout( row_major std140) uniform block{ uniform float condf,  uniform int condi,  uniform 1-component vector of float condf1,  uniform 1-component vector of int condi1})
+0:11            Constant:
+0:11              0 (const uint)
+0:11        true case
+0:12        Branch: Return with expression
+0:12          add ( temp 4-component vector of float)
+0:12            'a' ( temp 4-component vector of float)
+0:12            Constant:
+0:12              2.000000
+0:13      Test condition and select ( temp void)
+0:13        Condition
+0:13        Convert float to bool ( temp bool)
+0:13          condf1: direct index for structure ( uniform 1-component vector of float)
+0:13            'anon@0' (layout( row_major std140) uniform block{ uniform float condf,  uniform int condi,  uniform 1-component vector of float condf1,  uniform 1-component vector of int condi1})
+0:13            Constant:
+0:13              2 (const uint)
+0:13        true case
+0:14        Branch: Return with expression
+0:14          add ( temp 4-component vector of float)
+0:14            'a' ( temp 4-component vector of float)
+0:14            Constant:
+0:14              3.000000
+0:15      Test condition and select ( temp void)
+0:15        Condition
+0:15        Convert int to bool ( temp bool)
+0:15          condi1: direct index for structure ( uniform 1-component vector of int)
+0:15            'anon@0' (layout( row_major std140) uniform block{ uniform float condf,  uniform int condi,  uniform 1-component vector of float condf1,  uniform 1-component vector of int condi1})
+0:15            Constant:
+0:15              3 (const uint)
+0:15        true case
+0:16        Branch: Return with expression
+0:16          add ( temp 4-component vector of float)
+0:16            'a' ( temp 4-component vector of float)
+0:16            Constant:
+0:16              4.000000
+0:17      Test condition and select ( temp void)
+0:17        Condition
+0:17        logical-or ( temp bool)
+0:17          logical-and ( temp bool)
+0:17            Convert int to bool ( temp bool)
+0:17              condi: direct index for structure ( uniform int)
+0:17                'anon@0' (layout( row_major std140) uniform block{ uniform float condf,  uniform int condi,  uniform 1-component vector of float condf1,  uniform 1-component vector of int condi1})
+0:17                Constant:
+0:17                  1 (const uint)
+0:17            Convert int to bool ( temp bool)
+0:17              Convert float to int ( temp int)
+0:17                condf: direct index for structure ( uniform float)
+0:17                  'anon@0' (layout( row_major std140) uniform block{ uniform float condf,  uniform int condi,  uniform 1-component vector of float condf1,  uniform 1-component vector of int condi1})
+0:17                  Constant:
+0:17                    0 (const uint)
+0:17          Convert float to bool ( temp bool)
+0:17            condf1: direct index for structure ( uniform 1-component vector of float)
+0:17              'anon@0' (layout( row_major std140) uniform block{ uniform float condf,  uniform int condi,  uniform 1-component vector of float condf1,  uniform 1-component vector of int condi1})
+0:17              Constant:
+0:17                2 (const uint)
+0:17        true case
+0:18        Branch: Return with expression
+0:18          add ( temp 4-component vector of float)
+0:18            'a' ( temp 4-component vector of float)
+0:18            Constant:
+0:18              5.000000
+0:20      Sequence
+0:20        move second child to first child ( temp float)
+0:20          'f' ( temp float)
+0:20          condf: direct index for structure ( uniform float)
+0:20            'anon@0' (layout( row_major std140) uniform block{ uniform float condf,  uniform int condi,  uniform 1-component vector of float condf1,  uniform 1-component vector of int condi1})
+0:20            Constant:
+0:20              0 (const uint)
+0:21      Loop with condition tested first
+0:21        Loop Condition
+0:21        Convert float to bool ( temp bool)
+0:21          'f' ( temp float)
+0:21        Loop Body
+0:?         Sequence
+0:21          Pre-Decrement ( temp float)
+0:21            'f' ( temp float)
+0:23      Sequence
+0:23        move second child to first child ( temp int)
+0:23          'i' ( temp int)
+0:23          condi: direct index for structure ( uniform int)
+0:23            'anon@0' (layout( row_major std140) uniform block{ uniform float condf,  uniform int condi,  uniform 1-component vector of float condf1,  uniform 1-component vector of int condi1})
+0:23            Constant:
+0:23              1 (const uint)
+0:24      Loop with condition not tested first
+0:24        Loop Condition
+0:24        Convert int to bool ( temp bool)
+0:24          'i' ( temp int)
+0:24        Loop Body
+0:24        Pre-Decrement ( temp int)
+0:24          'i' ( temp int)
+0:?       Sequence
+0:26        Loop with condition tested first
+0:26          Loop Condition
+0:26          Convert int to bool ( temp bool)
+0:26            'i' ( temp int)
+0:26          Loop Body
+0:?           Sequence
+0:26            Pre-Decrement ( temp int)
+0:26              'i' ( temp int)
+0:28      Sequence
+0:28        move second child to first child ( temp float)
+0:28          'g' ( temp float)
+0:28          Test condition and select ( temp float)
+0:28            Condition
+0:28            Convert float to bool ( temp bool)
+0:28              condf: direct index for structure ( uniform float)
+0:28                'anon@0' (layout( row_major std140) uniform block{ uniform float condf,  uniform int condi,  uniform 1-component vector of float condf1,  uniform 1-component vector of int condi1})
+0:28                Constant:
+0:28                  0 (const uint)
+0:28            true case
+0:28            Constant:
+0:28              7.000000
+0:28            false case
+0:28            Constant:
+0:28              8.000000
+0:29      add second child into first child ( temp 4-component vector of float)
+0:29        'a' ( temp 4-component vector of float)
+0:29        'g' ( temp float)
+0:31      Branch: Return with expression
+0:31        subtract ( temp 4-component vector of float)
+0:31          'a' ( temp 4-component vector of float)
+0:31          Constant:
+0:31            1.000000
+0:7  Function Definition: main( ( temp void)
+0:7    Function Parameters: 
+0:?     Sequence
+0:7      move second child to first child ( temp 4-component vector of float)
+0:?         '@entryPointOutput' (layout( location=0) out 4-component vector of float)
+0:7        Function Call: @main( ( temp 4-component vector of float)
+0:?   Linker Objects
+0:?     'anon@0' (layout( row_major std140) uniform block{ uniform float condf,  uniform int condi,  uniform 1-component vector of float condf1,  uniform 1-component vector of int condi1})
+0:?     '@entryPointOutput' (layout( location=0) out 4-component vector of float)
+
+// Module Version 10000
+// Generated by (magic number): 80001
+// Id's are bound by 145
+
+                              Capability Shader
+               1:             ExtInstImport  "GLSL.std.450"
+                              MemoryModel Logical GLSL450
+                              EntryPoint Fragment 4  "main" 143
+                              ExecutionMode 4 OriginUpperLeft
+                              Name 4  "main"
+                              Name 9  "@main("
+                              Name 12  "a"
+                              Name 16  "$Global"
+                              MemberName 16($Global) 0  "condf"
+                              MemberName 16($Global) 1  "condi"
+                              MemberName 16($Global) 2  "condf1"
+                              MemberName 16($Global) 3  "condi1"
+                              Name 18  ""
+                              Name 93  "f"
+                              Name 106  "i"
+                              Name 126  "g"
+                              Name 143  "@entryPointOutput"
+                              MemberDecorate 16($Global) 0 Offset 0
+                              MemberDecorate 16($Global) 1 Offset 4
+                              MemberDecorate 16($Global) 2 Offset 16
+                              MemberDecorate 16($Global) 3 Offset 32
+                              Decorate 16($Global) Block
+                              Decorate 18 DescriptorSet 0
+                              Decorate 143(@entryPointOutput) Location 0
+               2:             TypeVoid
+               3:             TypeFunction 2
+               6:             TypeFloat 32
+               7:             TypeVector 6(float) 4
+               8:             TypeFunction 7(fvec4)
+              11:             TypePointer Function 7(fvec4)
+              13:    6(float) Constant 1073741824
+              14:    7(fvec4) ConstantComposite 13 13 13 13
+              15:             TypeInt 32 1
+     16($Global):             TypeStruct 6(float) 15(int) 6(float) 15(int)
+              17:             TypePointer Uniform 16($Global)
+              18:     17(ptr) Variable Uniform
+              19:     15(int) Constant 1
+              20:             TypePointer Uniform 15(int)
+              23:             TypeBool
+              24:             TypeInt 32 0
+              25:     24(int) Constant 0
+              30:    6(float) Constant 1065353216
+              34:     15(int) Constant 0
+              35:             TypePointer Uniform 6(float)
+              38:    6(float) Constant 0
+              46:     15(int) Constant 2
+              53:    6(float) Constant 1077936128
+              57:     15(int) Constant 3
+              64:    6(float) Constant 1082130432
+              88:    6(float) Constant 1084227584
+              92:             TypePointer Function 6(float)
+             105:             TypePointer Function 15(int)
+             130:    6(float) Constant 1088421888
+             131:    6(float) Constant 1090519040
+             142:             TypePointer Output 7(fvec4)
+143(@entryPointOutput):    142(ptr) Variable Output
+         4(main):           2 Function None 3
+               5:             Label
+             144:    7(fvec4) FunctionCall 9(@main()
+                              Store 143(@entryPointOutput) 144
+                              Return
+                              FunctionEnd
+       9(@main():    7(fvec4) Function None 8
+              10:             Label
+           12(a):     11(ptr) Variable Function
+           93(f):     92(ptr) Variable Function
+          106(i):    105(ptr) Variable Function
+          126(g):     92(ptr) Variable Function
+                              Store 12(a) 14
+              21:     20(ptr) AccessChain 18 19
+              22:     15(int) Load 21
+              26:    23(bool) INotEqual 22 25
+                              SelectionMerge 28 None
+                              BranchConditional 26 27 28
+              27:               Label
+              29:    7(fvec4)   Load 12(a)
+              31:    7(fvec4)   CompositeConstruct 30 30 30 30
+              32:    7(fvec4)   FAdd 29 31
+                                ReturnValue 32
+              28:             Label
+              36:     35(ptr) AccessChain 18 34
+              37:    6(float) Load 36
+              39:    23(bool) FOrdNotEqual 37 38
+                              SelectionMerge 41 None
+                              BranchConditional 39 40 41
+              40:               Label
+              42:    7(fvec4)   Load 12(a)
+              43:    7(fvec4)   CompositeConstruct 13 13 13 13
+              44:    7(fvec4)   FAdd 42 43
+                                ReturnValue 44
+              41:             Label
+              47:     35(ptr) AccessChain 18 46
+              48:    6(float) Load 47
+              49:    23(bool) FOrdNotEqual 48 38
+                              SelectionMerge 51 None
+                              BranchConditional 49 50 51
+              50:               Label
+              52:    7(fvec4)   Load 12(a)
+              54:    7(fvec4)   CompositeConstruct 53 53 53 53
+              55:    7(fvec4)   FAdd 52 54
+                                ReturnValue 55
+              51:             Label
+              58:     20(ptr) AccessChain 18 57
+              59:     15(int) Load 58
+              60:    23(bool) INotEqual 59 25
+                              SelectionMerge 62 None
+                              BranchConditional 60 61 62
+              61:               Label
+              63:    7(fvec4)   Load 12(a)
+              65:    7(fvec4)   CompositeConstruct 64 64 64 64
+              66:    7(fvec4)   FAdd 63 65
+                                ReturnValue 66
+              62:             Label
+              68:     20(ptr) AccessChain 18 19
+              69:     15(int) Load 68
+              70:    23(bool) INotEqual 69 25
+                              SelectionMerge 72 None
+                              BranchConditional 70 71 72
+              71:               Label
+              73:     35(ptr)   AccessChain 18 34
+              74:    6(float)   Load 73
+              75:     15(int)   ConvertFToS 74
+              76:    23(bool)   INotEqual 75 25
+                                Branch 72
+              72:             Label
+              77:    23(bool) Phi 70 62 76 71
+              78:    23(bool) LogicalNot 77
+                              SelectionMerge 80 None
+                              BranchConditional 78 79 80
+              79:               Label
+              81:     35(ptr)   AccessChain 18 46
+              82:    6(float)   Load 81
+              83:    23(bool)   FOrdNotEqual 82 38
+                                Branch 80
+              80:             Label
+              84:    23(bool) Phi 77 72 83 79
+                              SelectionMerge 86 None
+                              BranchConditional 84 85 86
+              85:               Label
+              87:    7(fvec4)   Load 12(a)
+              89:    7(fvec4)   CompositeConstruct 88 88 88 88
+              90:    7(fvec4)   FAdd 87 89
+                                ReturnValue 90
+              86:             Label
+              94:     35(ptr) AccessChain 18 34
+              95:    6(float) Load 94
+                              Store 93(f) 95
+                              Branch 96
+              96:             Label
+                              LoopMerge 98 99 None
+                              Branch 100
+             100:             Label
+             101:    6(float) Load 93(f)
+             102:    23(bool) FOrdNotEqual 101 38
+                              BranchConditional 102 97 98
+              97:               Label
+             103:    6(float)   Load 93(f)
+             104:    6(float)   FSub 103 30
+                                Store 93(f) 104
+                                Branch 99
+              99:               Label
+                                Branch 96
+              98:             Label
+             107:     20(ptr) AccessChain 18 19
+             108:     15(int) Load 107
+                              Store 106(i) 108
+                              Branch 109
+             109:             Label
+                              LoopMerge 111 112 None
+                              Branch 110
+             110:             Label
+             113:     15(int) Load 106(i)
+             114:     15(int) ISub 113 19
+                              Store 106(i) 114
+                              Branch 112
+             112:             Label
+             115:     15(int) Load 106(i)
+             116:    23(bool) INotEqual 115 25
+                              BranchConditional 116 109 111
+             111:             Label
+                              Branch 117
+             117:             Label
+                              LoopMerge 119 120 None
+                              Branch 121
+             121:             Label
+             122:     15(int) Load 106(i)
+             123:    23(bool) INotEqual 122 25
+                              BranchConditional 123 118 119
+             118:               Label
+             124:     15(int)   Load 106(i)
+             125:     15(int)   ISub 124 19
+                                Store 106(i) 125
+                                Branch 120
+             120:               Label
+                                Branch 117
+             119:             Label
+             127:     35(ptr) AccessChain 18 34
+             128:    6(float) Load 127
+             129:    23(bool) FOrdNotEqual 128 38
+             132:    6(float) Select 129 130 131
+                              Store 126(g) 132
+             133:    6(float) Load 126(g)
+             134:    7(fvec4) Load 12(a)
+             135:    7(fvec4) CompositeConstruct 133 133 133 133
+             136:    7(fvec4) FAdd 134 135
+                              Store 12(a) 136
+             137:    7(fvec4) Load 12(a)
+             138:    7(fvec4) CompositeConstruct 30 30 30 30
+             139:    7(fvec4) FSub 137 138
+                              ReturnValue 139
+                              FunctionEnd

+ 335 - 0
3rdparty/glslang/Test/baseResults/hlsl.intrinsic.frexp.frag.out

@@ -0,0 +1,335 @@
+hlsl.intrinsic.frexp.frag
+Shader version: 450
+gl_FragCoord origin is upper left
+0:? Sequence
+0:3  Function Definition: PixelShaderFunctionS(f1;f1; ( temp float)
+0:3    Function Parameters: 
+0:3      'inF0' ( in float)
+0:3      'inF1' ( in float)
+0:?     Sequence
+0:4      Sequence
+0:4        move second child to first child ( temp float)
+0:4          'r000' ( temp float)
+0:4          frexp ( temp float)
+0:4            'inF0' ( in float)
+0:4            'inF1' ( in float)
+0:5      Branch: Return with expression
+0:5        Constant:
+0:5          0.000000
+0:9  Function Definition: PixelShaderFunction2(vf2;vf2; ( temp 2-component vector of float)
+0:9    Function Parameters: 
+0:9      'inF0' ( in 2-component vector of float)
+0:9      'inF1' ( in 2-component vector of float)
+0:?     Sequence
+0:10      Sequence
+0:10        move second child to first child ( temp 2-component vector of float)
+0:10          'r000' ( temp 2-component vector of float)
+0:10          frexp ( temp 2-component vector of float)
+0:10            'inF0' ( in 2-component vector of float)
+0:10            'inF1' ( in 2-component vector of float)
+0:11      Branch: Return with expression
+0:?         Constant:
+0:?           1.000000
+0:?           2.000000
+0:15  Function Definition: PixelShaderFunction3(vf3;vf3; ( temp 3-component vector of float)
+0:15    Function Parameters: 
+0:15      'inF0' ( in 3-component vector of float)
+0:15      'inF1' ( in 3-component vector of float)
+0:?     Sequence
+0:16      Sequence
+0:16        move second child to first child ( temp 3-component vector of float)
+0:16          'r000' ( temp 3-component vector of float)
+0:16          frexp ( temp 3-component vector of float)
+0:16            'inF0' ( in 3-component vector of float)
+0:16            'inF1' ( in 3-component vector of float)
+0:17      Branch: Return with expression
+0:?         Constant:
+0:?           1.000000
+0:?           2.000000
+0:?           3.000000
+0:21  Function Definition: PixelShaderFunction(vf4;vf4; ( temp 4-component vector of float)
+0:21    Function Parameters: 
+0:21      'inF0' ( in 4-component vector of float)
+0:21      'inF1' ( in 4-component vector of float)
+0:?     Sequence
+0:22      Sequence
+0:22        move second child to first child ( temp 4-component vector of float)
+0:22          'r000' ( temp 4-component vector of float)
+0:22          frexp ( temp 4-component vector of float)
+0:22            'inF0' ( in 4-component vector of float)
+0:22            'inF1' ( in 4-component vector of float)
+0:23      Branch: Return with expression
+0:?         Constant:
+0:?           1.000000
+0:?           2.000000
+0:?           3.000000
+0:?           4.000000
+0:33  Function Definition: @main( ( temp structure{ temp 4-component vector of float color})
+0:33    Function Parameters: 
+0:?     Sequence
+0:35      move second child to first child ( temp 4-component vector of float)
+0:35        color: direct index for structure ( temp 4-component vector of float)
+0:35          'ps_output' ( temp structure{ temp 4-component vector of float color})
+0:35          Constant:
+0:35            0 (const int)
+0:35        Constant:
+0:35          1.000000
+0:35          1.000000
+0:35          1.000000
+0:35          1.000000
+0:36      Branch: Return with expression
+0:36        'ps_output' ( temp structure{ temp 4-component vector of float color})
+0:33  Function Definition: main( ( temp void)
+0:33    Function Parameters: 
+0:?     Sequence
+0:33      Sequence
+0:33        move second child to first child ( temp 4-component vector of float)
+0:?           'color' (layout( location=0) out 4-component vector of float)
+0:33          color: direct index for structure ( temp 4-component vector of float)
+0:33            Function Call: @main( ( temp structure{ temp 4-component vector of float color})
+0:33            Constant:
+0:33              0 (const int)
+0:?   Linker Objects
+0:?     'color' (layout( location=0) out 4-component vector of float)
+
+
+Linked fragment stage:
+
+
+Shader version: 450
+gl_FragCoord origin is upper left
+0:? Sequence
+0:3  Function Definition: PixelShaderFunctionS(f1;f1; ( temp float)
+0:3    Function Parameters: 
+0:3      'inF0' ( in float)
+0:3      'inF1' ( in float)
+0:?     Sequence
+0:4      Sequence
+0:4        move second child to first child ( temp float)
+0:4          'r000' ( temp float)
+0:4          frexp ( temp float)
+0:4            'inF0' ( in float)
+0:4            'inF1' ( in float)
+0:5      Branch: Return with expression
+0:5        Constant:
+0:5          0.000000
+0:9  Function Definition: PixelShaderFunction2(vf2;vf2; ( temp 2-component vector of float)
+0:9    Function Parameters: 
+0:9      'inF0' ( in 2-component vector of float)
+0:9      'inF1' ( in 2-component vector of float)
+0:?     Sequence
+0:10      Sequence
+0:10        move second child to first child ( temp 2-component vector of float)
+0:10          'r000' ( temp 2-component vector of float)
+0:10          frexp ( temp 2-component vector of float)
+0:10            'inF0' ( in 2-component vector of float)
+0:10            'inF1' ( in 2-component vector of float)
+0:11      Branch: Return with expression
+0:?         Constant:
+0:?           1.000000
+0:?           2.000000
+0:15  Function Definition: PixelShaderFunction3(vf3;vf3; ( temp 3-component vector of float)
+0:15    Function Parameters: 
+0:15      'inF0' ( in 3-component vector of float)
+0:15      'inF1' ( in 3-component vector of float)
+0:?     Sequence
+0:16      Sequence
+0:16        move second child to first child ( temp 3-component vector of float)
+0:16          'r000' ( temp 3-component vector of float)
+0:16          frexp ( temp 3-component vector of float)
+0:16            'inF0' ( in 3-component vector of float)
+0:16            'inF1' ( in 3-component vector of float)
+0:17      Branch: Return with expression
+0:?         Constant:
+0:?           1.000000
+0:?           2.000000
+0:?           3.000000
+0:21  Function Definition: PixelShaderFunction(vf4;vf4; ( temp 4-component vector of float)
+0:21    Function Parameters: 
+0:21      'inF0' ( in 4-component vector of float)
+0:21      'inF1' ( in 4-component vector of float)
+0:?     Sequence
+0:22      Sequence
+0:22        move second child to first child ( temp 4-component vector of float)
+0:22          'r000' ( temp 4-component vector of float)
+0:22          frexp ( temp 4-component vector of float)
+0:22            'inF0' ( in 4-component vector of float)
+0:22            'inF1' ( in 4-component vector of float)
+0:23      Branch: Return with expression
+0:?         Constant:
+0:?           1.000000
+0:?           2.000000
+0:?           3.000000
+0:?           4.000000
+0:33  Function Definition: @main( ( temp structure{ temp 4-component vector of float color})
+0:33    Function Parameters: 
+0:?     Sequence
+0:35      move second child to first child ( temp 4-component vector of float)
+0:35        color: direct index for structure ( temp 4-component vector of float)
+0:35          'ps_output' ( temp structure{ temp 4-component vector of float color})
+0:35          Constant:
+0:35            0 (const int)
+0:35        Constant:
+0:35          1.000000
+0:35          1.000000
+0:35          1.000000
+0:35          1.000000
+0:36      Branch: Return with expression
+0:36        'ps_output' ( temp structure{ temp 4-component vector of float color})
+0:33  Function Definition: main( ( temp void)
+0:33    Function Parameters: 
+0:?     Sequence
+0:33      Sequence
+0:33        move second child to first child ( temp 4-component vector of float)
+0:?           'color' (layout( location=0) out 4-component vector of float)
+0:33          color: direct index for structure ( temp 4-component vector of float)
+0:33            Function Call: @main( ( temp structure{ temp 4-component vector of float color})
+0:33            Constant:
+0:33              0 (const int)
+0:?   Linker Objects
+0:?     'color' (layout( location=0) out 4-component vector of float)
+
+// Module Version 10000
+// Generated by (magic number): 80001
+// Id's are bound by 98
+
+                              Capability Shader
+               1:             ExtInstImport  "GLSL.std.450"
+                              MemoryModel Logical GLSL450
+                              EntryPoint Fragment 4  "main" 95
+                              ExecutionMode 4 OriginUpperLeft
+                              Name 4  "main"
+                              Name 11  "PixelShaderFunctionS(f1;f1;"
+                              Name 9  "inF0"
+                              Name 10  "inF1"
+                              Name 18  "PixelShaderFunction2(vf2;vf2;"
+                              Name 16  "inF0"
+                              Name 17  "inF1"
+                              Name 25  "PixelShaderFunction3(vf3;vf3;"
+                              Name 23  "inF0"
+                              Name 24  "inF1"
+                              Name 32  "PixelShaderFunction(vf4;vf4;"
+                              Name 30  "inF0"
+                              Name 31  "inF1"
+                              Name 34  "PS_OUTPUT"
+                              MemberName 34(PS_OUTPUT) 0  "color"
+                              Name 36  "@main("
+                              Name 38  "r000"
+                              Name 41  "ResType"
+                              Name 49  "r000"
+                              Name 52  "ResType"
+                              Name 62  "r000"
+                              Name 65  "ResType"
+                              Name 74  "r000"
+                              Name 77  "ResType"
+                              Name 87  "ps_output"
+                              Name 95  "color"
+                              Decorate 95(color) Location 0
+               2:             TypeVoid
+               3:             TypeFunction 2
+               6:             TypeFloat 32
+               7:             TypePointer Function 6(float)
+               8:             TypeFunction 6(float) 7(ptr) 7(ptr)
+              13:             TypeVector 6(float) 2
+              14:             TypePointer Function 13(fvec2)
+              15:             TypeFunction 13(fvec2) 14(ptr) 14(ptr)
+              20:             TypeVector 6(float) 3
+              21:             TypePointer Function 20(fvec3)
+              22:             TypeFunction 20(fvec3) 21(ptr) 21(ptr)
+              27:             TypeVector 6(float) 4
+              28:             TypePointer Function 27(fvec4)
+              29:             TypeFunction 27(fvec4) 28(ptr) 28(ptr)
+   34(PS_OUTPUT):             TypeStruct 27(fvec4)
+              35:             TypeFunction 34(PS_OUTPUT)
+              40:             TypeInt 32 1
+     41(ResType):             TypeStruct 6(float) 40(int)
+              46:    6(float) Constant 0
+              51:             TypeVector 40(int) 2
+     52(ResType):             TypeStruct 13(fvec2) 51(ivec2)
+              57:    6(float) Constant 1065353216
+              58:    6(float) Constant 1073741824
+              59:   13(fvec2) ConstantComposite 57 58
+              64:             TypeVector 40(int) 3
+     65(ResType):             TypeStruct 20(fvec3) 64(ivec3)
+              70:    6(float) Constant 1077936128
+              71:   20(fvec3) ConstantComposite 57 58 70
+              76:             TypeVector 40(int) 4
+     77(ResType):             TypeStruct 27(fvec4) 76(ivec4)
+              82:    6(float) Constant 1082130432
+              83:   27(fvec4) ConstantComposite 57 58 70 82
+              86:             TypePointer Function 34(PS_OUTPUT)
+              88:     40(int) Constant 0
+              89:   27(fvec4) ConstantComposite 57 57 57 57
+              94:             TypePointer Output 27(fvec4)
+       95(color):     94(ptr) Variable Output
+         4(main):           2 Function None 3
+               5:             Label
+              96:34(PS_OUTPUT) FunctionCall 36(@main()
+              97:   27(fvec4) CompositeExtract 96 0
+                              Store 95(color) 97
+                              Return
+                              FunctionEnd
+11(PixelShaderFunctionS(f1;f1;):    6(float) Function None 8
+         9(inF0):      7(ptr) FunctionParameter
+        10(inF1):      7(ptr) FunctionParameter
+              12:             Label
+        38(r000):      7(ptr) Variable Function
+              39:    6(float) Load 9(inF0)
+              42: 41(ResType) ExtInst 1(GLSL.std.450) 52(FrexpStruct) 39
+              43:     40(int) CompositeExtract 42 1
+              44:    6(float) ConvertSToF 43
+                              Store 10(inF1) 44
+              45:    6(float) CompositeExtract 42 0
+                              Store 38(r000) 45
+                              ReturnValue 46
+                              FunctionEnd
+18(PixelShaderFunction2(vf2;vf2;):   13(fvec2) Function None 15
+        16(inF0):     14(ptr) FunctionParameter
+        17(inF1):     14(ptr) FunctionParameter
+              19:             Label
+        49(r000):     14(ptr) Variable Function
+              50:   13(fvec2) Load 16(inF0)
+              53: 52(ResType) ExtInst 1(GLSL.std.450) 52(FrexpStruct) 50
+              54:   51(ivec2) CompositeExtract 53 1
+              55:   13(fvec2) ConvertSToF 54
+                              Store 17(inF1) 55
+              56:   13(fvec2) CompositeExtract 53 0
+                              Store 49(r000) 56
+                              ReturnValue 59
+                              FunctionEnd
+25(PixelShaderFunction3(vf3;vf3;):   20(fvec3) Function None 22
+        23(inF0):     21(ptr) FunctionParameter
+        24(inF1):     21(ptr) FunctionParameter
+              26:             Label
+        62(r000):     21(ptr) Variable Function
+              63:   20(fvec3) Load 23(inF0)
+              66: 65(ResType) ExtInst 1(GLSL.std.450) 52(FrexpStruct) 63
+              67:   64(ivec3) CompositeExtract 66 1
+              68:   20(fvec3) ConvertSToF 67
+                              Store 24(inF1) 68
+              69:   20(fvec3) CompositeExtract 66 0
+                              Store 62(r000) 69
+                              ReturnValue 71
+                              FunctionEnd
+32(PixelShaderFunction(vf4;vf4;):   27(fvec4) Function None 29
+        30(inF0):     28(ptr) FunctionParameter
+        31(inF1):     28(ptr) FunctionParameter
+              33:             Label
+        74(r000):     28(ptr) Variable Function
+              75:   27(fvec4) Load 30(inF0)
+              78: 77(ResType) ExtInst 1(GLSL.std.450) 52(FrexpStruct) 75
+              79:   76(ivec4) CompositeExtract 78 1
+              80:   27(fvec4) ConvertSToF 79
+                              Store 31(inF1) 80
+              81:   27(fvec4) CompositeExtract 78 0
+                              Store 74(r000) 81
+                              ReturnValue 83
+                              FunctionEnd
+      36(@main():34(PS_OUTPUT) Function None 35
+              37:             Label
+   87(ps_output):     86(ptr) Variable Function
+              90:     28(ptr) AccessChain 87(ps_output) 88
+                              Store 90 89
+              91:34(PS_OUTPUT) Load 87(ps_output)
+                              ReturnValue 91
+                              FunctionEnd

+ 221 - 0
3rdparty/glslang/Test/baseResults/hlsl.intrinsic.frexp.vert.out

@@ -0,0 +1,221 @@
+hlsl.intrinsic.frexp.vert
+Shader version: 450
+0:? Sequence
+0:2  Function Definition: VertexShaderFunctionS(f1;f1; ( temp float)
+0:2    Function Parameters: 
+0:2      'inF0' ( in float)
+0:2      'inF1' ( in float)
+0:?     Sequence
+0:3      frexp ( temp float)
+0:3        'inF0' ( in float)
+0:3        'inF1' ( in float)
+0:4      Branch: Return with expression
+0:4        Constant:
+0:4          0.000000
+0:8  Function Definition: VertexShaderFunction2(vf2;vf2; ( temp 2-component vector of float)
+0:8    Function Parameters: 
+0:8      'inF0' ( in 2-component vector of float)
+0:8      'inF1' ( in 2-component vector of float)
+0:?     Sequence
+0:9      frexp ( temp 2-component vector of float)
+0:9        'inF0' ( in 2-component vector of float)
+0:9        'inF1' ( in 2-component vector of float)
+0:10      Branch: Return with expression
+0:?         Constant:
+0:?           1.000000
+0:?           2.000000
+0:14  Function Definition: VertexShaderFunction3(vf3;vf3; ( temp 3-component vector of float)
+0:14    Function Parameters: 
+0:14      'inF0' ( in 3-component vector of float)
+0:14      'inF1' ( in 3-component vector of float)
+0:?     Sequence
+0:15      frexp ( temp 3-component vector of float)
+0:15        'inF0' ( in 3-component vector of float)
+0:15        'inF1' ( in 3-component vector of float)
+0:16      Branch: Return with expression
+0:?         Constant:
+0:?           1.000000
+0:?           2.000000
+0:?           3.000000
+0:20  Function Definition: VertexShaderFunction4(vf4;vf4; ( temp 4-component vector of float)
+0:20    Function Parameters: 
+0:20      'inF0' ( in 4-component vector of float)
+0:20      'inF1' ( in 4-component vector of float)
+0:?     Sequence
+0:21      frexp ( temp 4-component vector of float)
+0:21        'inF0' ( in 4-component vector of float)
+0:21        'inF1' ( in 4-component vector of float)
+0:22      Branch: Return with expression
+0:?         Constant:
+0:?           1.000000
+0:?           2.000000
+0:?           3.000000
+0:?           4.000000
+0:?   Linker Objects
+
+
+Linked vertex stage:
+
+WARNING: Linking vertex stage: Entry point not found
+
+Shader version: 450
+0:? Sequence
+0:2  Function Definition: VertexShaderFunctionS(f1;f1; ( temp float)
+0:2    Function Parameters: 
+0:2      'inF0' ( in float)
+0:2      'inF1' ( in float)
+0:?     Sequence
+0:3      frexp ( temp float)
+0:3        'inF0' ( in float)
+0:3        'inF1' ( in float)
+0:4      Branch: Return with expression
+0:4        Constant:
+0:4          0.000000
+0:8  Function Definition: VertexShaderFunction2(vf2;vf2; ( temp 2-component vector of float)
+0:8    Function Parameters: 
+0:8      'inF0' ( in 2-component vector of float)
+0:8      'inF1' ( in 2-component vector of float)
+0:?     Sequence
+0:9      frexp ( temp 2-component vector of float)
+0:9        'inF0' ( in 2-component vector of float)
+0:9        'inF1' ( in 2-component vector of float)
+0:10      Branch: Return with expression
+0:?         Constant:
+0:?           1.000000
+0:?           2.000000
+0:14  Function Definition: VertexShaderFunction3(vf3;vf3; ( temp 3-component vector of float)
+0:14    Function Parameters: 
+0:14      'inF0' ( in 3-component vector of float)
+0:14      'inF1' ( in 3-component vector of float)
+0:?     Sequence
+0:15      frexp ( temp 3-component vector of float)
+0:15        'inF0' ( in 3-component vector of float)
+0:15        'inF1' ( in 3-component vector of float)
+0:16      Branch: Return with expression
+0:?         Constant:
+0:?           1.000000
+0:?           2.000000
+0:?           3.000000
+0:20  Function Definition: VertexShaderFunction4(vf4;vf4; ( temp 4-component vector of float)
+0:20    Function Parameters: 
+0:20      'inF0' ( in 4-component vector of float)
+0:20      'inF1' ( in 4-component vector of float)
+0:?     Sequence
+0:21      frexp ( temp 4-component vector of float)
+0:21        'inF0' ( in 4-component vector of float)
+0:21        'inF1' ( in 4-component vector of float)
+0:22      Branch: Return with expression
+0:?         Constant:
+0:?           1.000000
+0:?           2.000000
+0:?           3.000000
+0:?           4.000000
+0:?   Linker Objects
+
+// Module Version 10000
+// Generated by (magic number): 80001
+// Id's are bound by 78
+
+                              Capability Shader
+               1:             ExtInstImport  "GLSL.std.450"
+                              MemoryModel Logical GLSL450
+                              EntryPoint Vertex 4  "VertexShaderFunction"
+                              Name 4  "VertexShaderFunction"
+                              Name 11  "VertexShaderFunctionS(f1;f1;"
+                              Name 9  "inF0"
+                              Name 10  "inF1"
+                              Name 18  "VertexShaderFunction2(vf2;vf2;"
+                              Name 16  "inF0"
+                              Name 17  "inF1"
+                              Name 25  "VertexShaderFunction3(vf3;vf3;"
+                              Name 23  "inF0"
+                              Name 24  "inF1"
+                              Name 32  "VertexShaderFunction4(vf4;vf4;"
+                              Name 30  "inF0"
+                              Name 31  "inF1"
+                              Name 36  "ResType"
+                              Name 46  "ResType"
+                              Name 58  "ResType"
+                              Name 69  "ResType"
+               2:             TypeVoid
+               3:             TypeFunction 2
+               6:             TypeFloat 32
+               7:             TypePointer Function 6(float)
+               8:             TypeFunction 6(float) 7(ptr) 7(ptr)
+              13:             TypeVector 6(float) 2
+              14:             TypePointer Function 13(fvec2)
+              15:             TypeFunction 13(fvec2) 14(ptr) 14(ptr)
+              20:             TypeVector 6(float) 3
+              21:             TypePointer Function 20(fvec3)
+              22:             TypeFunction 20(fvec3) 21(ptr) 21(ptr)
+              27:             TypeVector 6(float) 4
+              28:             TypePointer Function 27(fvec4)
+              29:             TypeFunction 27(fvec4) 28(ptr) 28(ptr)
+              35:             TypeInt 32 1
+     36(ResType):             TypeStruct 6(float) 35(int)
+              41:    6(float) Constant 0
+              45:             TypeVector 35(int) 2
+     46(ResType):             TypeStruct 13(fvec2) 45(ivec2)
+              51:    6(float) Constant 1065353216
+              52:    6(float) Constant 1073741824
+              53:   13(fvec2) ConstantComposite 51 52
+              57:             TypeVector 35(int) 3
+     58(ResType):             TypeStruct 20(fvec3) 57(ivec3)
+              63:    6(float) Constant 1077936128
+              64:   20(fvec3) ConstantComposite 51 52 63
+              68:             TypeVector 35(int) 4
+     69(ResType):             TypeStruct 27(fvec4) 68(ivec4)
+              74:    6(float) Constant 1082130432
+              75:   27(fvec4) ConstantComposite 51 52 63 74
+4(VertexShaderFunction):           2 Function None 3
+               5:             Label
+                              Return
+                              FunctionEnd
+11(VertexShaderFunctionS(f1;f1;):    6(float) Function None 8
+         9(inF0):      7(ptr) FunctionParameter
+        10(inF1):      7(ptr) FunctionParameter
+              12:             Label
+              34:    6(float) Load 9(inF0)
+              37: 36(ResType) ExtInst 1(GLSL.std.450) 52(FrexpStruct) 34
+              38:     35(int) CompositeExtract 37 1
+              39:    6(float) ConvertSToF 38
+                              Store 10(inF1) 39
+              40:    6(float) CompositeExtract 37 0
+                              ReturnValue 41
+                              FunctionEnd
+18(VertexShaderFunction2(vf2;vf2;):   13(fvec2) Function None 15
+        16(inF0):     14(ptr) FunctionParameter
+        17(inF1):     14(ptr) FunctionParameter
+              19:             Label
+              44:   13(fvec2) Load 16(inF0)
+              47: 46(ResType) ExtInst 1(GLSL.std.450) 52(FrexpStruct) 44
+              48:   45(ivec2) CompositeExtract 47 1
+              49:   13(fvec2) ConvertSToF 48
+                              Store 17(inF1) 49
+              50:   13(fvec2) CompositeExtract 47 0
+                              ReturnValue 53
+                              FunctionEnd
+25(VertexShaderFunction3(vf3;vf3;):   20(fvec3) Function None 22
+        23(inF0):     21(ptr) FunctionParameter
+        24(inF1):     21(ptr) FunctionParameter
+              26:             Label
+              56:   20(fvec3) Load 23(inF0)
+              59: 58(ResType) ExtInst 1(GLSL.std.450) 52(FrexpStruct) 56
+              60:   57(ivec3) CompositeExtract 59 1
+              61:   20(fvec3) ConvertSToF 60
+                              Store 24(inF1) 61
+              62:   20(fvec3) CompositeExtract 59 0
+                              ReturnValue 64
+                              FunctionEnd
+32(VertexShaderFunction4(vf4;vf4;):   27(fvec4) Function None 29
+        30(inF0):     28(ptr) FunctionParameter
+        31(inF1):     28(ptr) FunctionParameter
+              33:             Label
+              67:   27(fvec4) Load 30(inF0)
+              70: 69(ResType) ExtInst 1(GLSL.std.450) 52(FrexpStruct) 67
+              71:   68(ivec4) CompositeExtract 70 1
+              72:   27(fvec4) ConvertSToF 71
+                              Store 31(inF1) 72
+              73:   27(fvec4) CompositeExtract 70 0
+                              ReturnValue 75
+                              FunctionEnd

File diff suppressed because it is too large
+ 1366 - 1402
3rdparty/glslang/Test/baseResults/hlsl.intrinsics.frag.out


+ 3 - 6
3rdparty/glslang/Test/baseResults/hlsl.intrinsics.negative.frag.out

@@ -1,6 +1,5 @@
 hlsl.intrinsics.negative.frag
 hlsl.intrinsics.negative.frag
 ERROR: 0:10: 'determinant' : no matching overloaded function found 
 ERROR: 0:10: 'determinant' : no matching overloaded function found 
-ERROR: 0:23: 'length' : ambiguous best function under implicit type conversion 
 ERROR: 0:25: 'normalize' : ambiguous best function under implicit type conversion 
 ERROR: 0:25: 'normalize' : ambiguous best function under implicit type conversion 
 ERROR: 0:26: 'reflect' : ambiguous best function under implicit type conversion 
 ERROR: 0:26: 'reflect' : ambiguous best function under implicit type conversion 
 ERROR: 0:27: 'refract' : ambiguous best function under implicit type conversion 
 ERROR: 0:27: 'refract' : ambiguous best function under implicit type conversion 
@@ -59,7 +58,7 @@ ERROR: 0:133: 'normalize' : no matching overloaded function found
 ERROR: 0:133: 'reflect' : no matching overloaded function found 
 ERROR: 0:133: 'reflect' : no matching overloaded function found 
 ERROR: 0:133: 'refract' : no matching overloaded function found 
 ERROR: 0:133: 'refract' : no matching overloaded function found 
 ERROR: 0:133: 'reversebits' : no matching overloaded function found 
 ERROR: 0:133: 'reversebits' : no matching overloaded function found 
-ERROR: 60 compilation errors.  No code generated.
+ERROR: 59 compilation errors.  No code generated.
 
 
 
 
 Shader version: 450
 Shader version: 450
@@ -120,8 +119,7 @@ ERROR: node is still EOpNull!
 0:14        Convert float to uint ( temp uint)
 0:14        Convert float to uint ( temp uint)
 0:14          'inF0' ( in float)
 0:14          'inF0' ( in float)
 0:23      length ( temp float)
 0:23      length ( temp float)
-0:23        Construct vec2 ( in 2-component vector of float)
-0:23          'inF0' ( in float)
+0:23        'inF0' ( in float)
 0:24      Function Call: msad4(u1;vu2;vu4; ( temp 4-component vector of uint)
 0:24      Function Call: msad4(u1;vu2;vu4; ( temp 4-component vector of uint)
 0:24        Convert float to uint ( temp uint)
 0:24        Convert float to uint ( temp uint)
 0:24          'inF0' ( in float)
 0:24          'inF0' ( in float)
@@ -582,8 +580,7 @@ ERROR: node is still EOpNull!
 0:14        Convert float to uint ( temp uint)
 0:14        Convert float to uint ( temp uint)
 0:14          'inF0' ( in float)
 0:14          'inF0' ( in float)
 0:23      length ( temp float)
 0:23      length ( temp float)
-0:23        Construct vec2 ( in 2-component vector of float)
-0:23          'inF0' ( in float)
+0:23        'inF0' ( in float)
 0:24      Function Call: msad4(u1;vu2;vu4; ( temp 4-component vector of uint)
 0:24      Function Call: msad4(u1;vu2;vu4; ( temp 4-component vector of uint)
 0:24        Convert float to uint ( temp uint)
 0:24        Convert float to uint ( temp uint)
 0:24          'inF0' ( in float)
 0:24          'inF0' ( in float)

+ 110 - 108
3rdparty/glslang/Test/baseResults/hlsl.intrinsics.promote.frag.out

@@ -341,8 +341,8 @@ gl_FragCoord origin is upper left
 0:51        move second child to first child ( temp float)
 0:51        move second child to first child ( temp float)
 0:51          'r50' ( temp float)
 0:51          'r50' ( temp float)
 0:51          Construct float ( temp float)
 0:51          Construct float ( temp float)
-0:?             imageLoad ( temp 4-component vector of float)
-0:51              'g_tTexbfs' (layout( r32f) readonly uniform imageBuffer)
+0:?             textureFetch ( temp 4-component vector of float)
+0:51              'g_tTexbfs' (layout( r32f) uniform samplerBuffer)
 0:51              Convert uint to int ( temp int)
 0:51              Convert uint to int ( temp int)
 0:51                upos: direct index for structure ( uniform uint)
 0:51                upos: direct index for structure ( uniform uint)
 0:51                  'anon@0' (layout( row_major std140) uniform block{ uniform int i,  uniform uint u,  uniform float f,  uniform bool b,  uniform 2-component vector of int i2,  uniform 2-component vector of uint u2,  uniform 2-component vector of float f2,  uniform 2-component vector of bool b2,  uniform uint upos,  uniform float fpos})
 0:51                  'anon@0' (layout( row_major std140) uniform block{ uniform int i,  uniform uint u,  uniform float f,  uniform bool b,  uniform 2-component vector of int i2,  uniform 2-component vector of uint u2,  uniform 2-component vector of float f2,  uniform 2-component vector of bool b2,  uniform uint upos,  uniform float fpos})
@@ -352,8 +352,8 @@ gl_FragCoord origin is upper left
 0:52        move second child to first child ( temp float)
 0:52        move second child to first child ( temp float)
 0:52          'r51' ( temp float)
 0:52          'r51' ( temp float)
 0:52          Construct float ( temp float)
 0:52          Construct float ( temp float)
-0:?             imageLoad ( temp 4-component vector of float)
-0:52              'g_tTexbfs' (layout( r32f) readonly uniform imageBuffer)
+0:?             textureFetch ( temp 4-component vector of float)
+0:52              'g_tTexbfs' (layout( r32f) uniform samplerBuffer)
 0:52              Convert float to int ( temp int)
 0:52              Convert float to int ( temp int)
 0:52                fpos: direct index for structure ( uniform float)
 0:52                fpos: direct index for structure ( uniform float)
 0:52                  'anon@0' (layout( row_major std140) uniform block{ uniform int i,  uniform uint u,  uniform float f,  uniform bool b,  uniform 2-component vector of int i2,  uniform 2-component vector of uint u2,  uniform 2-component vector of float f2,  uniform 2-component vector of bool b2,  uniform uint upos,  uniform float fpos})
 0:52                  'anon@0' (layout( row_major std140) uniform block{ uniform int i,  uniform uint u,  uniform float f,  uniform bool b,  uniform 2-component vector of int i2,  uniform 2-component vector of uint u2,  uniform 2-component vector of float f2,  uniform 2-component vector of bool b2,  uniform uint upos,  uniform float fpos})
@@ -437,7 +437,7 @@ gl_FragCoord origin is upper left
 0:20              0 (const int)
 0:20              0 (const int)
 0:?   Linker Objects
 0:?   Linker Objects
 0:?     'anon@0' (layout( row_major std140) uniform block{ uniform int i,  uniform uint u,  uniform float f,  uniform bool b,  uniform 2-component vector of int i2,  uniform 2-component vector of uint u2,  uniform 2-component vector of float f2,  uniform 2-component vector of bool b2,  uniform uint upos,  uniform float fpos})
 0:?     'anon@0' (layout( row_major std140) uniform block{ uniform int i,  uniform uint u,  uniform float f,  uniform bool b,  uniform 2-component vector of int i2,  uniform 2-component vector of uint u2,  uniform 2-component vector of float f2,  uniform 2-component vector of bool b2,  uniform uint upos,  uniform float fpos})
-0:?     'g_tTexbfs' (layout( r32f) readonly uniform imageBuffer)
+0:?     'g_tTexbfs' (layout( r32f) uniform samplerBuffer)
 0:?     'g_tTex1df4' ( uniform texture1D)
 0:?     'g_tTex1df4' ( uniform texture1D)
 0:?     'color' (layout( location=0) out 4-component vector of float)
 0:?     'color' (layout( location=0) out 4-component vector of float)
 
 
@@ -787,8 +787,8 @@ gl_FragCoord origin is upper left
 0:51        move second child to first child ( temp float)
 0:51        move second child to first child ( temp float)
 0:51          'r50' ( temp float)
 0:51          'r50' ( temp float)
 0:51          Construct float ( temp float)
 0:51          Construct float ( temp float)
-0:?             imageLoad ( temp 4-component vector of float)
-0:51              'g_tTexbfs' (layout( r32f) readonly uniform imageBuffer)
+0:?             textureFetch ( temp 4-component vector of float)
+0:51              'g_tTexbfs' (layout( r32f) uniform samplerBuffer)
 0:51              Convert uint to int ( temp int)
 0:51              Convert uint to int ( temp int)
 0:51                upos: direct index for structure ( uniform uint)
 0:51                upos: direct index for structure ( uniform uint)
 0:51                  'anon@0' (layout( row_major std140) uniform block{ uniform int i,  uniform uint u,  uniform float f,  uniform bool b,  uniform 2-component vector of int i2,  uniform 2-component vector of uint u2,  uniform 2-component vector of float f2,  uniform 2-component vector of bool b2,  uniform uint upos,  uniform float fpos})
 0:51                  'anon@0' (layout( row_major std140) uniform block{ uniform int i,  uniform uint u,  uniform float f,  uniform bool b,  uniform 2-component vector of int i2,  uniform 2-component vector of uint u2,  uniform 2-component vector of float f2,  uniform 2-component vector of bool b2,  uniform uint upos,  uniform float fpos})
@@ -798,8 +798,8 @@ gl_FragCoord origin is upper left
 0:52        move second child to first child ( temp float)
 0:52        move second child to first child ( temp float)
 0:52          'r51' ( temp float)
 0:52          'r51' ( temp float)
 0:52          Construct float ( temp float)
 0:52          Construct float ( temp float)
-0:?             imageLoad ( temp 4-component vector of float)
-0:52              'g_tTexbfs' (layout( r32f) readonly uniform imageBuffer)
+0:?             textureFetch ( temp 4-component vector of float)
+0:52              'g_tTexbfs' (layout( r32f) uniform samplerBuffer)
 0:52              Convert float to int ( temp int)
 0:52              Convert float to int ( temp int)
 0:52                fpos: direct index for structure ( uniform float)
 0:52                fpos: direct index for structure ( uniform float)
 0:52                  'anon@0' (layout( row_major std140) uniform block{ uniform int i,  uniform uint u,  uniform float f,  uniform bool b,  uniform 2-component vector of int i2,  uniform 2-component vector of uint u2,  uniform 2-component vector of float f2,  uniform 2-component vector of bool b2,  uniform uint upos,  uniform float fpos})
 0:52                  'anon@0' (layout( row_major std140) uniform block{ uniform int i,  uniform uint u,  uniform float f,  uniform bool b,  uniform 2-component vector of int i2,  uniform 2-component vector of uint u2,  uniform 2-component vector of float f2,  uniform 2-component vector of bool b2,  uniform uint upos,  uniform float fpos})
@@ -883,13 +883,13 @@ gl_FragCoord origin is upper left
 0:20              0 (const int)
 0:20              0 (const int)
 0:?   Linker Objects
 0:?   Linker Objects
 0:?     'anon@0' (layout( row_major std140) uniform block{ uniform int i,  uniform uint u,  uniform float f,  uniform bool b,  uniform 2-component vector of int i2,  uniform 2-component vector of uint u2,  uniform 2-component vector of float f2,  uniform 2-component vector of bool b2,  uniform uint upos,  uniform float fpos})
 0:?     'anon@0' (layout( row_major std140) uniform block{ uniform int i,  uniform uint u,  uniform float f,  uniform bool b,  uniform 2-component vector of int i2,  uniform 2-component vector of uint u2,  uniform 2-component vector of float f2,  uniform 2-component vector of bool b2,  uniform uint upos,  uniform float fpos})
-0:?     'g_tTexbfs' (layout( r32f) readonly uniform imageBuffer)
+0:?     'g_tTexbfs' (layout( r32f) uniform samplerBuffer)
 0:?     'g_tTex1df4' ( uniform texture1D)
 0:?     'g_tTex1df4' ( uniform texture1D)
 0:?     'color' (layout( location=0) out 4-component vector of float)
 0:?     'color' (layout( location=0) out 4-component vector of float)
 
 
 // Module Version 10000
 // Module Version 10000
 // Generated by (magic number): 80001
 // Generated by (magic number): 80001
-// Id's are bound by 322
+// Id's are bound by 325
 
 
                               Capability Shader
                               Capability Shader
                               Capability Sampled1D
                               Capability Sampled1D
@@ -897,7 +897,7 @@ gl_FragCoord origin is upper left
                               Capability ImageQuery
                               Capability ImageQuery
                1:             ExtInstImport  "GLSL.std.450"
                1:             ExtInstImport  "GLSL.std.450"
                               MemoryModel Logical GLSL450
                               MemoryModel Logical GLSL450
-                              EntryPoint Fragment 4  "main" 319
+                              EntryPoint Fragment 4  "main" 322
                               ExecutionMode 4 OriginUpperLeft
                               ExecutionMode 4 OriginUpperLeft
                               Name 4  "main"
                               Name 4  "main"
                               Name 8  "PS_OUTPUT"
                               Name 8  "PS_OUTPUT"
@@ -938,19 +938,19 @@ gl_FragCoord origin is upper left
                               Name 229  "r42"
                               Name 229  "r42"
                               Name 243  "r43"
                               Name 243  "r43"
                               Name 255  "r50"
                               Name 255  "r50"
-                              Name 258  "g_tTexbfs"
-                              Name 266  "r51"
-                              Name 274  "sizeQueryTemp"
-                              Name 277  "g_tTex1df4"
-                              Name 280  "WidthI"
-                              Name 283  "sizeQueryTemp"
-                              Name 289  "NumberOfLevelsU"
-                              Name 292  "sizeQueryTemp"
-                              Name 295  "WidthU"
-                              Name 297  "NumberOfLevelsI"
-                              Name 301  "sizeQueryTemp"
-                              Name 310  "ps_output"
-                              Name 319  "color"
+                              Name 259  "g_tTexbfs"
+                              Name 268  "r51"
+                              Name 277  "sizeQueryTemp"
+                              Name 280  "g_tTex1df4"
+                              Name 283  "WidthI"
+                              Name 286  "sizeQueryTemp"
+                              Name 292  "NumberOfLevelsU"
+                              Name 295  "sizeQueryTemp"
+                              Name 298  "WidthU"
+                              Name 300  "NumberOfLevelsI"
+                              Name 304  "sizeQueryTemp"
+                              Name 313  "ps_output"
+                              Name 322  "color"
                               MemberDecorate 19($Global) 0 Offset 0
                               MemberDecorate 19($Global) 0 Offset 0
                               MemberDecorate 19($Global) 1 Offset 4
                               MemberDecorate 19($Global) 1 Offset 4
                               MemberDecorate 19($Global) 2 Offset 8
                               MemberDecorate 19($Global) 2 Offset 8
@@ -963,10 +963,9 @@ gl_FragCoord origin is upper left
                               MemberDecorate 19($Global) 9 Offset 52
                               MemberDecorate 19($Global) 9 Offset 52
                               Decorate 19($Global) Block
                               Decorate 19($Global) Block
                               Decorate 21 DescriptorSet 0
                               Decorate 21 DescriptorSet 0
-                              Decorate 258(g_tTexbfs) DescriptorSet 0
-                              Decorate 258(g_tTexbfs) NonWritable
-                              Decorate 277(g_tTex1df4) DescriptorSet 0
-                              Decorate 319(color) Location 0
+                              Decorate 259(g_tTexbfs) DescriptorSet 0
+                              Decorate 280(g_tTex1df4) DescriptorSet 0
+                              Decorate 322(color) Location 0
                2:             TypeVoid
                2:             TypeVoid
                3:             TypeFunction 2
                3:             TypeFunction 2
                6:             TypeFloat 32
                6:             TypeFloat 32
@@ -1013,24 +1012,25 @@ gl_FragCoord origin is upper left
              107:   16(ivec2) ConstantComposite 44 44
              107:   16(ivec2) ConstantComposite 44 44
              109:     14(int) Constant 4
              109:     14(int) Constant 4
              110:             TypePointer Uniform 16(ivec2)
              110:             TypePointer Uniform 16(ivec2)
-             256:             TypeImage 6(float) Buffer nonsampled format:R32f
-             257:             TypePointer UniformConstant 256
-  258(g_tTexbfs):    257(ptr) Variable UniformConstant
-             260:     14(int) Constant 8
-             268:     14(int) Constant 9
-             275:             TypeImage 6(float) 1D sampled format:Unknown
-             276:             TypePointer UniformConstant 275
- 277(g_tTex1df4):    276(ptr) Variable UniformConstant
-             285:     15(int) Constant 6
-             309:             TypePointer Function 8(PS_OUTPUT)
-             313:             TypePointer Function 7(fvec4)
-             318:             TypePointer Output 7(fvec4)
-      319(color):    318(ptr) Variable Output
+             256:             TypeImage 6(float) Buffer sampled format:R32f
+             257:             TypeSampledImage 256
+             258:             TypePointer UniformConstant 257
+  259(g_tTexbfs):    258(ptr) Variable UniformConstant
+             261:     14(int) Constant 8
+             270:     14(int) Constant 9
+             278:             TypeImage 6(float) 1D sampled format:Unknown
+             279:             TypePointer UniformConstant 278
+ 280(g_tTex1df4):    279(ptr) Variable UniformConstant
+             288:     15(int) Constant 6
+             312:             TypePointer Function 8(PS_OUTPUT)
+             316:             TypePointer Function 7(fvec4)
+             321:             TypePointer Output 7(fvec4)
+      322(color):    321(ptr) Variable Output
          4(main):           2 Function None 3
          4(main):           2 Function None 3
                5:             Label
                5:             Label
-             320:8(PS_OUTPUT) FunctionCall 10(@main()
-             321:    7(fvec4) CompositeExtract 320 0
-                              Store 319(color) 321
+             323:8(PS_OUTPUT) FunctionCall 10(@main()
+             324:    7(fvec4) CompositeExtract 323 0
+                              Store 322(color) 324
                               Return
                               Return
                               FunctionEnd
                               FunctionEnd
       10(@main():8(PS_OUTPUT) Function None 9
       10(@main():8(PS_OUTPUT) Function None 9
@@ -1058,16 +1058,16 @@ gl_FragCoord origin is upper left
         229(r42):     73(ptr) Variable Function
         229(r42):     73(ptr) Variable Function
         243(r43):    101(ptr) Variable Function
         243(r43):    101(ptr) Variable Function
         255(r50):     12(ptr) Variable Function
         255(r50):     12(ptr) Variable Function
-        266(r51):     12(ptr) Variable Function
-274(sizeQueryTemp):     37(ptr) Variable Function
-     280(WidthI):     48(ptr) Variable Function
-283(sizeQueryTemp):     37(ptr) Variable Function
-289(NumberOfLevelsU):     37(ptr) Variable Function
-292(sizeQueryTemp):     37(ptr) Variable Function
-     295(WidthU):     37(ptr) Variable Function
-297(NumberOfLevelsI):     48(ptr) Variable Function
-301(sizeQueryTemp):     37(ptr) Variable Function
-  310(ps_output):    309(ptr) Variable Function
+        268(r51):     12(ptr) Variable Function
+277(sizeQueryTemp):     37(ptr) Variable Function
+     283(WidthI):     48(ptr) Variable Function
+286(sizeQueryTemp):     37(ptr) Variable Function
+292(NumberOfLevelsU):     37(ptr) Variable Function
+295(sizeQueryTemp):     37(ptr) Variable Function
+     298(WidthU):     37(ptr) Variable Function
+300(NumberOfLevelsI):     48(ptr) Variable Function
+304(sizeQueryTemp):     37(ptr) Variable Function
+  313(ps_output):    312(ptr) Variable Function
               24:     23(ptr) AccessChain 21 22
               24:     23(ptr) AccessChain 21 22
               25:     15(int) Load 24
               25:     15(int) Load 24
               28:    26(bool) INotEqual 25 27
               28:    26(bool) INotEqual 25 27
@@ -1271,58 +1271,60 @@ gl_FragCoord origin is upper left
              253:   17(ivec2) ExtInst 1(GLSL.std.450) 44(UClamp) 247 250 252
              253:   17(ivec2) ExtInst 1(GLSL.std.450) 44(UClamp) 247 250 252
              254:   16(ivec2) Bitcast 253
              254:   16(ivec2) Bitcast 253
                               Store 243(r43) 254
                               Store 243(r43) 254
-             259:         256 Load 258(g_tTexbfs)
-             261:     23(ptr) AccessChain 21 260
-             262:     15(int) Load 261
-             263:     14(int) Bitcast 262
-             264:    7(fvec4) ImageRead 259 263
-             265:    6(float) CompositeExtract 264 0
-                              Store 255(r50) 265
-             267:         256 Load 258(g_tTexbfs)
-             269:     33(ptr) AccessChain 21 268
-             270:    6(float) Load 269
-             271:     14(int) ConvertFToS 270
-             272:    7(fvec4) ImageRead 267 271
-             273:    6(float) CompositeExtract 272 0
-                              Store 266(r51) 273
-             278:         275 Load 277(g_tTex1df4)
-             279:     15(int) ImageQuerySizeLod 278 53
-                              Store 274(sizeQueryTemp) 279
-             281:     15(int) Load 274(sizeQueryTemp)
-             282:     14(int) Bitcast 281
-                              Store 280(WidthI) 282
-             284:         275 Load 277(g_tTex1df4)
-             286:     15(int) ImageQuerySizeLod 284 285
-                              Store 283(sizeQueryTemp) 286
-             287:     15(int) Load 283(sizeQueryTemp)
-             288:     14(int) Bitcast 287
-                              Store 280(WidthI) 288
-             290:         275 Load 277(g_tTex1df4)
-             291:     15(int) ImageQueryLevels 290
-                              Store 289(NumberOfLevelsU) 291
-             293:         275 Load 277(g_tTex1df4)
-             294:     15(int) ImageQuerySizeLod 293 285
-                              Store 292(sizeQueryTemp) 294
-             296:     15(int) Load 292(sizeQueryTemp)
-                              Store 295(WidthU) 296
-             298:         275 Load 277(g_tTex1df4)
-             299:     15(int) ImageQueryLevels 298
-             300:     14(int) Bitcast 299
-                              Store 297(NumberOfLevelsI) 300
-             302:         275 Load 277(g_tTex1df4)
-             303:     15(int) ImageQuerySizeLod 302 285
-                              Store 301(sizeQueryTemp) 303
-             304:     15(int) Load 301(sizeQueryTemp)
-             305:     14(int) Bitcast 304
-                              Store 280(WidthI) 305
-             306:         275 Load 277(g_tTex1df4)
-             307:     15(int) ImageQueryLevels 306
+             260:         257 Load 259(g_tTexbfs)
+             262:     23(ptr) AccessChain 21 261
+             263:     15(int) Load 262
+             264:     14(int) Bitcast 263
+             265:         256 Image 260
+             266:    7(fvec4) ImageFetch 265 264
+             267:    6(float) CompositeExtract 266 0
+                              Store 255(r50) 267
+             269:         257 Load 259(g_tTexbfs)
+             271:     33(ptr) AccessChain 21 270
+             272:    6(float) Load 271
+             273:     14(int) ConvertFToS 272
+             274:         256 Image 269
+             275:    7(fvec4) ImageFetch 274 273
+             276:    6(float) CompositeExtract 275 0
+                              Store 268(r51) 276
+             281:         278 Load 280(g_tTex1df4)
+             282:     15(int) ImageQuerySizeLod 281 53
+                              Store 277(sizeQueryTemp) 282
+             284:     15(int) Load 277(sizeQueryTemp)
+             285:     14(int) Bitcast 284
+                              Store 283(WidthI) 285
+             287:         278 Load 280(g_tTex1df4)
+             289:     15(int) ImageQuerySizeLod 287 288
+                              Store 286(sizeQueryTemp) 289
+             290:     15(int) Load 286(sizeQueryTemp)
+             291:     14(int) Bitcast 290
+                              Store 283(WidthI) 291
+             293:         278 Load 280(g_tTex1df4)
+             294:     15(int) ImageQueryLevels 293
+                              Store 292(NumberOfLevelsU) 294
+             296:         278 Load 280(g_tTex1df4)
+             297:     15(int) ImageQuerySizeLod 296 288
+                              Store 295(sizeQueryTemp) 297
+             299:     15(int) Load 295(sizeQueryTemp)
+                              Store 298(WidthU) 299
+             301:         278 Load 280(g_tTex1df4)
+             302:     15(int) ImageQueryLevels 301
+             303:     14(int) Bitcast 302
+                              Store 300(NumberOfLevelsI) 303
+             305:         278 Load 280(g_tTex1df4)
+             306:     15(int) ImageQuerySizeLod 305 288
+                              Store 304(sizeQueryTemp) 306
+             307:     15(int) Load 304(sizeQueryTemp)
              308:     14(int) Bitcast 307
              308:     14(int) Bitcast 307
-                              Store 297(NumberOfLevelsI) 308
-             311:    6(float) Load 13(r00)
-             312:    7(fvec4) CompositeConstruct 311 311 311 311
-             314:    313(ptr) AccessChain 310(ps_output) 53
-                              Store 314 312
-             315:8(PS_OUTPUT) Load 310(ps_output)
-                              ReturnValue 315
+                              Store 283(WidthI) 308
+             309:         278 Load 280(g_tTex1df4)
+             310:     15(int) ImageQueryLevels 309
+             311:     14(int) Bitcast 310
+                              Store 300(NumberOfLevelsI) 311
+             314:    6(float) Load 13(r00)
+             315:    7(fvec4) CompositeConstruct 314 314 314 314
+             317:    316(ptr) AccessChain 313(ps_output) 53
+                              Store 317 315
+             318:8(PS_OUTPUT) Load 313(ps_output)
+                              ReturnValue 318
                               FunctionEnd
                               FunctionEnd

+ 9 - 9
3rdparty/glslang/Test/baseResults/hlsl.intrinsics.promote.outputs.frag.out

@@ -95,7 +95,7 @@ gl_FragCoord origin is upper left
 0:20              0 (const int)
 0:20              0 (const int)
 0:?   Linker Objects
 0:?   Linker Objects
 0:?     'anon@0' (layout( row_major std140) uniform block{ uniform int i,  uniform uint u,  uniform float f,  uniform bool b,  uniform 2-component vector of int i2,  uniform 2-component vector of uint u2,  uniform 2-component vector of float f2,  uniform 2-component vector of bool b2,  uniform uint upos,  uniform float fpos})
 0:?     'anon@0' (layout( row_major std140) uniform block{ uniform int i,  uniform uint u,  uniform float f,  uniform bool b,  uniform 2-component vector of int i2,  uniform 2-component vector of uint u2,  uniform 2-component vector of float f2,  uniform 2-component vector of bool b2,  uniform uint upos,  uniform float fpos})
-0:?     'g_tTexbfs' (layout( r32f) readonly uniform imageBuffer)
+0:?     'g_tTexbfs' (layout( r32f) uniform samplerBuffer)
 0:?     'g_tTex1df4' ( uniform texture1D)
 0:?     'g_tTex1df4' ( uniform texture1D)
 0:?     'color' (layout( location=0) out 4-component vector of float)
 0:?     'color' (layout( location=0) out 4-component vector of float)
 
 
@@ -199,13 +199,13 @@ gl_FragCoord origin is upper left
 0:20              0 (const int)
 0:20              0 (const int)
 0:?   Linker Objects
 0:?   Linker Objects
 0:?     'anon@0' (layout( row_major std140) uniform block{ uniform int i,  uniform uint u,  uniform float f,  uniform bool b,  uniform 2-component vector of int i2,  uniform 2-component vector of uint u2,  uniform 2-component vector of float f2,  uniform 2-component vector of bool b2,  uniform uint upos,  uniform float fpos})
 0:?     'anon@0' (layout( row_major std140) uniform block{ uniform int i,  uniform uint u,  uniform float f,  uniform bool b,  uniform 2-component vector of int i2,  uniform 2-component vector of uint u2,  uniform 2-component vector of float f2,  uniform 2-component vector of bool b2,  uniform uint upos,  uniform float fpos})
-0:?     'g_tTexbfs' (layout( r32f) readonly uniform imageBuffer)
+0:?     'g_tTexbfs' (layout( r32f) uniform samplerBuffer)
 0:?     'g_tTex1df4' ( uniform texture1D)
 0:?     'g_tTex1df4' ( uniform texture1D)
 0:?     'color' (layout( location=0) out 4-component vector of float)
 0:?     'color' (layout( location=0) out 4-component vector of float)
 
 
 // Module Version 10000
 // Module Version 10000
 // Generated by (magic number): 80001
 // Generated by (magic number): 80001
-// Id's are bound by 80
+// Id's are bound by 81
 
 
                               Capability Shader
                               Capability Shader
                               Capability Sampled1D
                               Capability Sampled1D
@@ -242,7 +242,7 @@ gl_FragCoord origin is upper left
                               Name 57  "sizeQueryTemp"
                               Name 57  "sizeQueryTemp"
                               Name 66  "ps_output"
                               Name 66  "ps_output"
                               Name 74  "color"
                               Name 74  "color"
-                              Name 79  "g_tTexbfs"
+                              Name 80  "g_tTexbfs"
                               MemberDecorate 17($Global) 0 Offset 0
                               MemberDecorate 17($Global) 0 Offset 0
                               MemberDecorate 17($Global) 1 Offset 4
                               MemberDecorate 17($Global) 1 Offset 4
                               MemberDecorate 17($Global) 2 Offset 8
                               MemberDecorate 17($Global) 2 Offset 8
@@ -257,8 +257,7 @@ gl_FragCoord origin is upper left
                               Decorate 19 DescriptorSet 0
                               Decorate 19 DescriptorSet 0
                               Decorate 31(g_tTex1df4) DescriptorSet 0
                               Decorate 31(g_tTex1df4) DescriptorSet 0
                               Decorate 74(color) Location 0
                               Decorate 74(color) Location 0
-                              Decorate 79(g_tTexbfs) DescriptorSet 0
-                              Decorate 79(g_tTexbfs) NonWritable
+                              Decorate 80(g_tTexbfs) DescriptorSet 0
                2:             TypeVoid
                2:             TypeVoid
                3:             TypeFunction 2
                3:             TypeFunction 2
                6:             TypeFloat 32
                6:             TypeFloat 32
@@ -289,9 +288,10 @@ gl_FragCoord origin is upper left
               68:             TypePointer Function 7(fvec4)
               68:             TypePointer Function 7(fvec4)
               73:             TypePointer Output 7(fvec4)
               73:             TypePointer Output 7(fvec4)
        74(color):     73(ptr) Variable Output
        74(color):     73(ptr) Variable Output
-              77:             TypeImage 6(float) Buffer nonsampled format:R32f
-              78:             TypePointer UniformConstant 77
-   79(g_tTexbfs):     78(ptr) Variable UniformConstant
+              77:             TypeImage 6(float) Buffer sampled format:R32f
+              78:             TypeSampledImage 77
+              79:             TypePointer UniformConstant 78
+   80(g_tTexbfs):     79(ptr) Variable UniformConstant
          4(main):           2 Function None 3
          4(main):           2 Function None 3
                5:             Label
                5:             Label
               75:8(PS_OUTPUT) FunctionCall 10(@main()
               75:8(PS_OUTPUT) FunctionCall 10(@main()

File diff suppressed because it is too large
+ 672 - 690
3rdparty/glslang/Test/baseResults/hlsl.intrinsics.vert.out


+ 130 - 128
3rdparty/glslang/Test/baseResults/hlsl.load.buffer.dx10.frag.out

@@ -8,8 +8,8 @@ gl_FragCoord origin is upper left
 0:28      Sequence
 0:28      Sequence
 0:28        move second child to first child ( temp 4-component vector of float)
 0:28        move second child to first child ( temp 4-component vector of float)
 0:28          'r00' ( temp 4-component vector of float)
 0:28          'r00' ( temp 4-component vector of float)
-0:28          imageLoad ( temp 4-component vector of float)
-0:28            'g_tTexbf4' (layout( rgba32f) readonly uniform imageBuffer)
+0:28          textureFetch ( temp 4-component vector of float)
+0:28            'g_tTexbf4' (layout( rgba32f) uniform samplerBuffer)
 0:28            c1: direct index for structure ( uniform int)
 0:28            c1: direct index for structure ( uniform int)
 0:28              'anon@0' (layout( row_major std140) uniform block{ uniform int c1,  uniform 2-component vector of int c2,  uniform 3-component vector of int c3,  uniform 4-component vector of int c4,  uniform int o1,  uniform 2-component vector of int o2,  uniform 3-component vector of int o3,  uniform 4-component vector of int o4})
 0:28              'anon@0' (layout( row_major std140) uniform block{ uniform int c1,  uniform 2-component vector of int c2,  uniform 3-component vector of int c3,  uniform 4-component vector of int c4,  uniform int o1,  uniform 2-component vector of int o2,  uniform 3-component vector of int o3,  uniform 4-component vector of int o4})
 0:28              Constant:
 0:28              Constant:
@@ -17,8 +17,8 @@ gl_FragCoord origin is upper left
 0:29      Sequence
 0:29      Sequence
 0:29        move second child to first child ( temp 4-component vector of int)
 0:29        move second child to first child ( temp 4-component vector of int)
 0:29          'r01' ( temp 4-component vector of int)
 0:29          'r01' ( temp 4-component vector of int)
-0:29          imageLoad ( temp 4-component vector of int)
-0:29            'g_tTexbi4' (layout( rgba32i) readonly uniform iimageBuffer)
+0:29          textureFetch ( temp 4-component vector of int)
+0:29            'g_tTexbi4' (layout( rgba32i) uniform isamplerBuffer)
 0:29            c1: direct index for structure ( uniform int)
 0:29            c1: direct index for structure ( uniform int)
 0:29              'anon@0' (layout( row_major std140) uniform block{ uniform int c1,  uniform 2-component vector of int c2,  uniform 3-component vector of int c3,  uniform 4-component vector of int c4,  uniform int o1,  uniform 2-component vector of int o2,  uniform 3-component vector of int o3,  uniform 4-component vector of int o4})
 0:29              'anon@0' (layout( row_major std140) uniform block{ uniform int c1,  uniform 2-component vector of int c2,  uniform 3-component vector of int c3,  uniform 4-component vector of int c4,  uniform int o1,  uniform 2-component vector of int o2,  uniform 3-component vector of int o3,  uniform 4-component vector of int o4})
 0:29              Constant:
 0:29              Constant:
@@ -26,8 +26,8 @@ gl_FragCoord origin is upper left
 0:30      Sequence
 0:30      Sequence
 0:30        move second child to first child ( temp 4-component vector of uint)
 0:30        move second child to first child ( temp 4-component vector of uint)
 0:30          'r02' ( temp 4-component vector of uint)
 0:30          'r02' ( temp 4-component vector of uint)
-0:30          imageLoad ( temp 4-component vector of uint)
-0:30            'g_tTexbu4' (layout( rgba32ui) readonly uniform uimageBuffer)
+0:30          textureFetch ( temp 4-component vector of uint)
+0:30            'g_tTexbu4' (layout( rgba32ui) uniform usamplerBuffer)
 0:30            c1: direct index for structure ( uniform int)
 0:30            c1: direct index for structure ( uniform int)
 0:30              'anon@0' (layout( row_major std140) uniform block{ uniform int c1,  uniform 2-component vector of int c2,  uniform 3-component vector of int c3,  uniform 4-component vector of int c4,  uniform int o1,  uniform 2-component vector of int o2,  uniform 3-component vector of int o3,  uniform 4-component vector of int o4})
 0:30              'anon@0' (layout( row_major std140) uniform block{ uniform int c1,  uniform 2-component vector of int c2,  uniform 3-component vector of int c3,  uniform 4-component vector of int c4,  uniform int o1,  uniform 2-component vector of int o2,  uniform 3-component vector of int o3,  uniform 4-component vector of int o4})
 0:30              Constant:
 0:30              Constant:
@@ -71,10 +71,10 @@ gl_FragCoord origin is upper left
 0:24            Constant:
 0:24            Constant:
 0:24              1 (const int)
 0:24              1 (const int)
 0:?   Linker Objects
 0:?   Linker Objects
-0:?     'g_tTexbf4_test' (layout( binding=0 rgba32f) readonly uniform imageBuffer)
-0:?     'g_tTexbf4' (layout( rgba32f) readonly uniform imageBuffer)
-0:?     'g_tTexbi4' (layout( rgba32i) readonly uniform iimageBuffer)
-0:?     'g_tTexbu4' (layout( rgba32ui) readonly uniform uimageBuffer)
+0:?     'g_tTexbf4_test' (layout( binding=0 rgba32f) uniform samplerBuffer)
+0:?     'g_tTexbf4' (layout( rgba32f) uniform samplerBuffer)
+0:?     'g_tTexbi4' (layout( rgba32i) uniform isamplerBuffer)
+0:?     'g_tTexbu4' (layout( rgba32ui) uniform usamplerBuffer)
 0:?     'anon@0' (layout( row_major std140) uniform block{ uniform int c1,  uniform 2-component vector of int c2,  uniform 3-component vector of int c3,  uniform 4-component vector of int c4,  uniform int o1,  uniform 2-component vector of int o2,  uniform 3-component vector of int o3,  uniform 4-component vector of int o4})
 0:?     'anon@0' (layout( row_major std140) uniform block{ uniform int c1,  uniform 2-component vector of int c2,  uniform 3-component vector of int c3,  uniform 4-component vector of int c4,  uniform int o1,  uniform 2-component vector of int o2,  uniform 3-component vector of int o3,  uniform 4-component vector of int o4})
 0:?     'Color' (layout( location=0) out 4-component vector of float)
 0:?     'Color' (layout( location=0) out 4-component vector of float)
 0:?     'Depth' ( out float FragDepth)
 0:?     'Depth' ( out float FragDepth)
@@ -92,8 +92,8 @@ gl_FragCoord origin is upper left
 0:28      Sequence
 0:28      Sequence
 0:28        move second child to first child ( temp 4-component vector of float)
 0:28        move second child to first child ( temp 4-component vector of float)
 0:28          'r00' ( temp 4-component vector of float)
 0:28          'r00' ( temp 4-component vector of float)
-0:28          imageLoad ( temp 4-component vector of float)
-0:28            'g_tTexbf4' (layout( rgba32f) readonly uniform imageBuffer)
+0:28          textureFetch ( temp 4-component vector of float)
+0:28            'g_tTexbf4' (layout( rgba32f) uniform samplerBuffer)
 0:28            c1: direct index for structure ( uniform int)
 0:28            c1: direct index for structure ( uniform int)
 0:28              'anon@0' (layout( row_major std140) uniform block{ uniform int c1,  uniform 2-component vector of int c2,  uniform 3-component vector of int c3,  uniform 4-component vector of int c4,  uniform int o1,  uniform 2-component vector of int o2,  uniform 3-component vector of int o3,  uniform 4-component vector of int o4})
 0:28              'anon@0' (layout( row_major std140) uniform block{ uniform int c1,  uniform 2-component vector of int c2,  uniform 3-component vector of int c3,  uniform 4-component vector of int c4,  uniform int o1,  uniform 2-component vector of int o2,  uniform 3-component vector of int o3,  uniform 4-component vector of int o4})
 0:28              Constant:
 0:28              Constant:
@@ -101,8 +101,8 @@ gl_FragCoord origin is upper left
 0:29      Sequence
 0:29      Sequence
 0:29        move second child to first child ( temp 4-component vector of int)
 0:29        move second child to first child ( temp 4-component vector of int)
 0:29          'r01' ( temp 4-component vector of int)
 0:29          'r01' ( temp 4-component vector of int)
-0:29          imageLoad ( temp 4-component vector of int)
-0:29            'g_tTexbi4' (layout( rgba32i) readonly uniform iimageBuffer)
+0:29          textureFetch ( temp 4-component vector of int)
+0:29            'g_tTexbi4' (layout( rgba32i) uniform isamplerBuffer)
 0:29            c1: direct index for structure ( uniform int)
 0:29            c1: direct index for structure ( uniform int)
 0:29              'anon@0' (layout( row_major std140) uniform block{ uniform int c1,  uniform 2-component vector of int c2,  uniform 3-component vector of int c3,  uniform 4-component vector of int c4,  uniform int o1,  uniform 2-component vector of int o2,  uniform 3-component vector of int o3,  uniform 4-component vector of int o4})
 0:29              'anon@0' (layout( row_major std140) uniform block{ uniform int c1,  uniform 2-component vector of int c2,  uniform 3-component vector of int c3,  uniform 4-component vector of int c4,  uniform int o1,  uniform 2-component vector of int o2,  uniform 3-component vector of int o3,  uniform 4-component vector of int o4})
 0:29              Constant:
 0:29              Constant:
@@ -110,8 +110,8 @@ gl_FragCoord origin is upper left
 0:30      Sequence
 0:30      Sequence
 0:30        move second child to first child ( temp 4-component vector of uint)
 0:30        move second child to first child ( temp 4-component vector of uint)
 0:30          'r02' ( temp 4-component vector of uint)
 0:30          'r02' ( temp 4-component vector of uint)
-0:30          imageLoad ( temp 4-component vector of uint)
-0:30            'g_tTexbu4' (layout( rgba32ui) readonly uniform uimageBuffer)
+0:30          textureFetch ( temp 4-component vector of uint)
+0:30            'g_tTexbu4' (layout( rgba32ui) uniform usamplerBuffer)
 0:30            c1: direct index for structure ( uniform int)
 0:30            c1: direct index for structure ( uniform int)
 0:30              'anon@0' (layout( row_major std140) uniform block{ uniform int c1,  uniform 2-component vector of int c2,  uniform 3-component vector of int c3,  uniform 4-component vector of int c4,  uniform int o1,  uniform 2-component vector of int o2,  uniform 3-component vector of int o3,  uniform 4-component vector of int o4})
 0:30              'anon@0' (layout( row_major std140) uniform block{ uniform int c1,  uniform 2-component vector of int c2,  uniform 3-component vector of int c3,  uniform 4-component vector of int c4,  uniform int o1,  uniform 2-component vector of int o2,  uniform 3-component vector of int o3,  uniform 4-component vector of int o4})
 0:30              Constant:
 0:30              Constant:
@@ -155,23 +155,23 @@ gl_FragCoord origin is upper left
 0:24            Constant:
 0:24            Constant:
 0:24              1 (const int)
 0:24              1 (const int)
 0:?   Linker Objects
 0:?   Linker Objects
-0:?     'g_tTexbf4_test' (layout( binding=0 rgba32f) readonly uniform imageBuffer)
-0:?     'g_tTexbf4' (layout( rgba32f) readonly uniform imageBuffer)
-0:?     'g_tTexbi4' (layout( rgba32i) readonly uniform iimageBuffer)
-0:?     'g_tTexbu4' (layout( rgba32ui) readonly uniform uimageBuffer)
+0:?     'g_tTexbf4_test' (layout( binding=0 rgba32f) uniform samplerBuffer)
+0:?     'g_tTexbf4' (layout( rgba32f) uniform samplerBuffer)
+0:?     'g_tTexbi4' (layout( rgba32i) uniform isamplerBuffer)
+0:?     'g_tTexbu4' (layout( rgba32ui) uniform usamplerBuffer)
 0:?     'anon@0' (layout( row_major std140) uniform block{ uniform int c1,  uniform 2-component vector of int c2,  uniform 3-component vector of int c3,  uniform 4-component vector of int c4,  uniform int o1,  uniform 2-component vector of int o2,  uniform 3-component vector of int o3,  uniform 4-component vector of int o4})
 0:?     'anon@0' (layout( row_major std140) uniform block{ uniform int c1,  uniform 2-component vector of int c2,  uniform 3-component vector of int c3,  uniform 4-component vector of int c4,  uniform int o1,  uniform 2-component vector of int o2,  uniform 3-component vector of int o3,  uniform 4-component vector of int o4})
 0:?     'Color' (layout( location=0) out 4-component vector of float)
 0:?     'Color' (layout( location=0) out 4-component vector of float)
 0:?     'Depth' ( out float FragDepth)
 0:?     'Depth' ( out float FragDepth)
 
 
 // Module Version 10000
 // Module Version 10000
 // Generated by (magic number): 80001
 // Generated by (magic number): 80001
-// Id's are bound by 72
+// Id's are bound by 78
 
 
                               Capability Shader
                               Capability Shader
                               Capability SampledBuffer
                               Capability SampledBuffer
                1:             ExtInstImport  "GLSL.std.450"
                1:             ExtInstImport  "GLSL.std.450"
                               MemoryModel Logical GLSL450
                               MemoryModel Logical GLSL450
-                              EntryPoint Fragment 4  "main" 64 68
+                              EntryPoint Fragment 4  "main" 70 74
                               ExecutionMode 4 OriginUpperLeft
                               ExecutionMode 4 OriginUpperLeft
                               Name 4  "main"
                               Name 4  "main"
                               Name 8  "PS_OUTPUT"
                               Name 8  "PS_OUTPUT"
@@ -179,47 +179,43 @@ gl_FragCoord origin is upper left
                               MemberName 8(PS_OUTPUT) 1  "Depth"
                               MemberName 8(PS_OUTPUT) 1  "Depth"
                               Name 10  "@main("
                               Name 10  "@main("
                               Name 13  "r00"
                               Name 13  "r00"
-                              Name 16  "g_tTexbf4"
-                              Name 22  "$Global"
-                              MemberName 22($Global) 0  "c1"
-                              MemberName 22($Global) 1  "c2"
-                              MemberName 22($Global) 2  "c3"
-                              MemberName 22($Global) 3  "c4"
-                              MemberName 22($Global) 4  "o1"
-                              MemberName 22($Global) 5  "o2"
-                              MemberName 22($Global) 6  "o3"
-                              MemberName 22($Global) 7  "o4"
-                              Name 24  ""
-                              Name 31  "r01"
-                              Name 34  "g_tTexbi4"
-                              Name 42  "r02"
-                              Name 45  "g_tTexbu4"
-                              Name 51  "psout"
-                              Name 61  "flattenTemp"
-                              Name 64  "Color"
-                              Name 68  "Depth"
-                              Name 71  "g_tTexbf4_test"
-                              Decorate 16(g_tTexbf4) DescriptorSet 0
-                              Decorate 16(g_tTexbf4) NonWritable
-                              MemberDecorate 22($Global) 0 Offset 0
-                              MemberDecorate 22($Global) 1 Offset 8
-                              MemberDecorate 22($Global) 2 Offset 16
-                              MemberDecorate 22($Global) 3 Offset 32
-                              MemberDecorate 22($Global) 4 Offset 48
-                              MemberDecorate 22($Global) 5 Offset 56
-                              MemberDecorate 22($Global) 6 Offset 64
-                              MemberDecorate 22($Global) 7 Offset 80
-                              Decorate 22($Global) Block
-                              Decorate 24 DescriptorSet 0
-                              Decorate 34(g_tTexbi4) DescriptorSet 0
-                              Decorate 34(g_tTexbi4) NonWritable
-                              Decorate 45(g_tTexbu4) DescriptorSet 0
-                              Decorate 45(g_tTexbu4) NonWritable
-                              Decorate 64(Color) Location 0
-                              Decorate 68(Depth) BuiltIn FragDepth
-                              Decorate 71(g_tTexbf4_test) DescriptorSet 0
-                              Decorate 71(g_tTexbf4_test) Binding 0
-                              Decorate 71(g_tTexbf4_test) NonWritable
+                              Name 17  "g_tTexbf4"
+                              Name 23  "$Global"
+                              MemberName 23($Global) 0  "c1"
+                              MemberName 23($Global) 1  "c2"
+                              MemberName 23($Global) 2  "c3"
+                              MemberName 23($Global) 3  "c4"
+                              MemberName 23($Global) 4  "o1"
+                              MemberName 23($Global) 5  "o2"
+                              MemberName 23($Global) 6  "o3"
+                              MemberName 23($Global) 7  "o4"
+                              Name 25  ""
+                              Name 33  "r01"
+                              Name 37  "g_tTexbi4"
+                              Name 46  "r02"
+                              Name 50  "g_tTexbu4"
+                              Name 57  "psout"
+                              Name 67  "flattenTemp"
+                              Name 70  "Color"
+                              Name 74  "Depth"
+                              Name 77  "g_tTexbf4_test"
+                              Decorate 17(g_tTexbf4) DescriptorSet 0
+                              MemberDecorate 23($Global) 0 Offset 0
+                              MemberDecorate 23($Global) 1 Offset 8
+                              MemberDecorate 23($Global) 2 Offset 16
+                              MemberDecorate 23($Global) 3 Offset 32
+                              MemberDecorate 23($Global) 4 Offset 48
+                              MemberDecorate 23($Global) 5 Offset 56
+                              MemberDecorate 23($Global) 6 Offset 64
+                              MemberDecorate 23($Global) 7 Offset 80
+                              Decorate 23($Global) Block
+                              Decorate 25 DescriptorSet 0
+                              Decorate 37(g_tTexbi4) DescriptorSet 0
+                              Decorate 50(g_tTexbu4) DescriptorSet 0
+                              Decorate 70(Color) Location 0
+                              Decorate 74(Depth) BuiltIn FragDepth
+                              Decorate 77(g_tTexbf4_test) DescriptorSet 0
+                              Decorate 77(g_tTexbf4_test) Binding 0
                2:             TypeVoid
                2:             TypeVoid
                3:             TypeFunction 2
                3:             TypeFunction 2
                6:             TypeFloat 32
                6:             TypeFloat 32
@@ -227,76 +223,82 @@ gl_FragCoord origin is upper left
     8(PS_OUTPUT):             TypeStruct 7(fvec4) 6(float)
     8(PS_OUTPUT):             TypeStruct 7(fvec4) 6(float)
                9:             TypeFunction 8(PS_OUTPUT)
                9:             TypeFunction 8(PS_OUTPUT)
               12:             TypePointer Function 7(fvec4)
               12:             TypePointer Function 7(fvec4)
-              14:             TypeImage 6(float) Buffer nonsampled format:Rgba32f
-              15:             TypePointer UniformConstant 14
-   16(g_tTexbf4):     15(ptr) Variable UniformConstant
-              18:             TypeInt 32 1
-              19:             TypeVector 18(int) 2
-              20:             TypeVector 18(int) 3
-              21:             TypeVector 18(int) 4
-     22($Global):             TypeStruct 18(int) 19(ivec2) 20(ivec3) 21(ivec4) 18(int) 19(ivec2) 20(ivec3) 21(ivec4)
-              23:             TypePointer Uniform 22($Global)
-              24:     23(ptr) Variable Uniform
-              25:     18(int) Constant 0
-              26:             TypePointer Uniform 18(int)
-              30:             TypePointer Function 21(ivec4)
-              32:             TypeImage 18(int) Buffer nonsampled format:Rgba32i
-              33:             TypePointer UniformConstant 32
-   34(g_tTexbi4):     33(ptr) Variable UniformConstant
-              39:             TypeInt 32 0
-              40:             TypeVector 39(int) 4
-              41:             TypePointer Function 40(ivec4)
-              43:             TypeImage 39(int) Buffer nonsampled format:Rgba32ui
-              44:             TypePointer UniformConstant 43
-   45(g_tTexbu4):     44(ptr) Variable UniformConstant
-              50:             TypePointer Function 8(PS_OUTPUT)
-              52:    6(float) Constant 1065353216
-              53:    7(fvec4) ConstantComposite 52 52 52 52
-              55:     18(int) Constant 1
-              56:             TypePointer Function 6(float)
-              63:             TypePointer Output 7(fvec4)
-       64(Color):     63(ptr) Variable Output
-              67:             TypePointer Output 6(float)
-       68(Depth):     67(ptr) Variable Output
-71(g_tTexbf4_test):     15(ptr) Variable UniformConstant
+              14:             TypeImage 6(float) Buffer sampled format:Rgba32f
+              15:             TypeSampledImage 14
+              16:             TypePointer UniformConstant 15
+   17(g_tTexbf4):     16(ptr) Variable UniformConstant
+              19:             TypeInt 32 1
+              20:             TypeVector 19(int) 2
+              21:             TypeVector 19(int) 3
+              22:             TypeVector 19(int) 4
+     23($Global):             TypeStruct 19(int) 20(ivec2) 21(ivec3) 22(ivec4) 19(int) 20(ivec2) 21(ivec3) 22(ivec4)
+              24:             TypePointer Uniform 23($Global)
+              25:     24(ptr) Variable Uniform
+              26:     19(int) Constant 0
+              27:             TypePointer Uniform 19(int)
+              32:             TypePointer Function 22(ivec4)
+              34:             TypeImage 19(int) Buffer sampled format:Rgba32i
+              35:             TypeSampledImage 34
+              36:             TypePointer UniformConstant 35
+   37(g_tTexbi4):     36(ptr) Variable UniformConstant
+              43:             TypeInt 32 0
+              44:             TypeVector 43(int) 4
+              45:             TypePointer Function 44(ivec4)
+              47:             TypeImage 43(int) Buffer sampled format:Rgba32ui
+              48:             TypeSampledImage 47
+              49:             TypePointer UniformConstant 48
+   50(g_tTexbu4):     49(ptr) Variable UniformConstant
+              56:             TypePointer Function 8(PS_OUTPUT)
+              58:    6(float) Constant 1065353216
+              59:    7(fvec4) ConstantComposite 58 58 58 58
+              61:     19(int) Constant 1
+              62:             TypePointer Function 6(float)
+              69:             TypePointer Output 7(fvec4)
+       70(Color):     69(ptr) Variable Output
+              73:             TypePointer Output 6(float)
+       74(Depth):     73(ptr) Variable Output
+77(g_tTexbf4_test):     16(ptr) Variable UniformConstant
          4(main):           2 Function None 3
          4(main):           2 Function None 3
                5:             Label
                5:             Label
- 61(flattenTemp):     50(ptr) Variable Function
-              62:8(PS_OUTPUT) FunctionCall 10(@main()
-                              Store 61(flattenTemp) 62
-              65:     12(ptr) AccessChain 61(flattenTemp) 25
-              66:    7(fvec4) Load 65
-                              Store 64(Color) 66
-              69:     56(ptr) AccessChain 61(flattenTemp) 55
-              70:    6(float) Load 69
-                              Store 68(Depth) 70
+ 67(flattenTemp):     56(ptr) Variable Function
+              68:8(PS_OUTPUT) FunctionCall 10(@main()
+                              Store 67(flattenTemp) 68
+              71:     12(ptr) AccessChain 67(flattenTemp) 26
+              72:    7(fvec4) Load 71
+                              Store 70(Color) 72
+              75:     62(ptr) AccessChain 67(flattenTemp) 61
+              76:    6(float) Load 75
+                              Store 74(Depth) 76
                               Return
                               Return
                               FunctionEnd
                               FunctionEnd
       10(@main():8(PS_OUTPUT) Function None 9
       10(@main():8(PS_OUTPUT) Function None 9
               11:             Label
               11:             Label
          13(r00):     12(ptr) Variable Function
          13(r00):     12(ptr) Variable Function
-         31(r01):     30(ptr) Variable Function
-         42(r02):     41(ptr) Variable Function
-       51(psout):     50(ptr) Variable Function
-              17:          14 Load 16(g_tTexbf4)
-              27:     26(ptr) AccessChain 24 25
-              28:     18(int) Load 27
-              29:    7(fvec4) ImageRead 17 28
-                              Store 13(r00) 29
-              35:          32 Load 34(g_tTexbi4)
-              36:     26(ptr) AccessChain 24 25
-              37:     18(int) Load 36
-              38:   21(ivec4) ImageRead 35 37
-                              Store 31(r01) 38
-              46:          43 Load 45(g_tTexbu4)
-              47:     26(ptr) AccessChain 24 25
-              48:     18(int) Load 47
-              49:   40(ivec4) ImageRead 46 48
-                              Store 42(r02) 49
-              54:     12(ptr) AccessChain 51(psout) 25
-                              Store 54 53
-              57:     56(ptr) AccessChain 51(psout) 55
-                              Store 57 52
-              58:8(PS_OUTPUT) Load 51(psout)
-                              ReturnValue 58
+         33(r01):     32(ptr) Variable Function
+         46(r02):     45(ptr) Variable Function
+       57(psout):     56(ptr) Variable Function
+              18:          15 Load 17(g_tTexbf4)
+              28:     27(ptr) AccessChain 25 26
+              29:     19(int) Load 28
+              30:          14 Image 18
+              31:    7(fvec4) ImageFetch 30 29
+                              Store 13(r00) 31
+              38:          35 Load 37(g_tTexbi4)
+              39:     27(ptr) AccessChain 25 26
+              40:     19(int) Load 39
+              41:          34 Image 38
+              42:   22(ivec4) ImageFetch 41 40
+                              Store 33(r01) 42
+              51:          48 Load 50(g_tTexbu4)
+              52:     27(ptr) AccessChain 25 26
+              53:     19(int) Load 52
+              54:          47 Image 51
+              55:   44(ivec4) ImageFetch 54 53
+                              Store 46(r02) 55
+              60:     12(ptr) AccessChain 57(psout) 26
+                              Store 60 59
+              63:     62(ptr) AccessChain 57(psout) 61
+                              Store 63 58
+              64:8(PS_OUTPUT) Load 57(psout)
+                              ReturnValue 64
                               FunctionEnd
                               FunctionEnd

+ 133 - 131
3rdparty/glslang/Test/baseResults/hlsl.load.buffer.float.dx10.frag.out

@@ -9,8 +9,8 @@ gl_FragCoord origin is upper left
 0:28        move second child to first child ( temp float)
 0:28        move second child to first child ( temp float)
 0:28          'r00' ( temp float)
 0:28          'r00' ( temp float)
 0:28          Construct float ( temp float)
 0:28          Construct float ( temp float)
-0:?             imageLoad ( temp 4-component vector of float)
-0:28              'g_tTexbfs' (layout( r32f) readonly uniform imageBuffer)
+0:?             textureFetch ( temp 4-component vector of float)
+0:28              'g_tTexbfs' (layout( r32f) uniform samplerBuffer)
 0:28              c1: direct index for structure ( uniform int)
 0:28              c1: direct index for structure ( uniform int)
 0:28                'anon@0' (layout( row_major std140) uniform block{ uniform int c1,  uniform 2-component vector of int c2,  uniform 3-component vector of int c3,  uniform 4-component vector of int c4,  uniform int o1,  uniform 2-component vector of int o2,  uniform 3-component vector of int o3,  uniform 4-component vector of int o4})
 0:28                'anon@0' (layout( row_major std140) uniform block{ uniform int c1,  uniform 2-component vector of int c2,  uniform 3-component vector of int c3,  uniform 4-component vector of int c4,  uniform int o1,  uniform 2-component vector of int o2,  uniform 3-component vector of int o3,  uniform 4-component vector of int o4})
 0:28                Constant:
 0:28                Constant:
@@ -19,8 +19,8 @@ gl_FragCoord origin is upper left
 0:29        move second child to first child ( temp int)
 0:29        move second child to first child ( temp int)
 0:29          'r01' ( temp int)
 0:29          'r01' ( temp int)
 0:29          Construct int ( temp int)
 0:29          Construct int ( temp int)
-0:?             imageLoad ( temp 4-component vector of int)
-0:29              'g_tTexbis' (layout( r32i) readonly uniform iimageBuffer)
+0:?             textureFetch ( temp 4-component vector of int)
+0:29              'g_tTexbis' (layout( r32i) uniform isamplerBuffer)
 0:29              c1: direct index for structure ( uniform int)
 0:29              c1: direct index for structure ( uniform int)
 0:29                'anon@0' (layout( row_major std140) uniform block{ uniform int c1,  uniform 2-component vector of int c2,  uniform 3-component vector of int c3,  uniform 4-component vector of int c4,  uniform int o1,  uniform 2-component vector of int o2,  uniform 3-component vector of int o3,  uniform 4-component vector of int o4})
 0:29                'anon@0' (layout( row_major std140) uniform block{ uniform int c1,  uniform 2-component vector of int c2,  uniform 3-component vector of int c3,  uniform 4-component vector of int c4,  uniform int o1,  uniform 2-component vector of int o2,  uniform 3-component vector of int o3,  uniform 4-component vector of int o4})
 0:29                Constant:
 0:29                Constant:
@@ -29,8 +29,8 @@ gl_FragCoord origin is upper left
 0:30        move second child to first child ( temp uint)
 0:30        move second child to first child ( temp uint)
 0:30          'r02' ( temp uint)
 0:30          'r02' ( temp uint)
 0:30          Construct uint ( temp uint)
 0:30          Construct uint ( temp uint)
-0:?             imageLoad ( temp 4-component vector of uint)
-0:30              'g_tTexbus' (layout( r32ui) readonly uniform uimageBuffer)
+0:?             textureFetch ( temp 4-component vector of uint)
+0:30              'g_tTexbus' (layout( r32ui) uniform usamplerBuffer)
 0:30              c1: direct index for structure ( uniform int)
 0:30              c1: direct index for structure ( uniform int)
 0:30                'anon@0' (layout( row_major std140) uniform block{ uniform int c1,  uniform 2-component vector of int c2,  uniform 3-component vector of int c3,  uniform 4-component vector of int c4,  uniform int o1,  uniform 2-component vector of int o2,  uniform 3-component vector of int o3,  uniform 4-component vector of int o4})
 0:30                'anon@0' (layout( row_major std140) uniform block{ uniform int c1,  uniform 2-component vector of int c2,  uniform 3-component vector of int c3,  uniform 4-component vector of int c4,  uniform int o1,  uniform 2-component vector of int o2,  uniform 3-component vector of int o3,  uniform 4-component vector of int o4})
 0:30                Constant:
 0:30                Constant:
@@ -74,10 +74,10 @@ gl_FragCoord origin is upper left
 0:24            Constant:
 0:24            Constant:
 0:24              1 (const int)
 0:24              1 (const int)
 0:?   Linker Objects
 0:?   Linker Objects
-0:?     'g_tTexbfs_test' (layout( binding=0 r32f) readonly uniform imageBuffer)
-0:?     'g_tTexbfs' (layout( r32f) readonly uniform imageBuffer)
-0:?     'g_tTexbis' (layout( r32i) readonly uniform iimageBuffer)
-0:?     'g_tTexbus' (layout( r32ui) readonly uniform uimageBuffer)
+0:?     'g_tTexbfs_test' (layout( binding=0 r32f) uniform samplerBuffer)
+0:?     'g_tTexbfs' (layout( r32f) uniform samplerBuffer)
+0:?     'g_tTexbis' (layout( r32i) uniform isamplerBuffer)
+0:?     'g_tTexbus' (layout( r32ui) uniform usamplerBuffer)
 0:?     'anon@0' (layout( row_major std140) uniform block{ uniform int c1,  uniform 2-component vector of int c2,  uniform 3-component vector of int c3,  uniform 4-component vector of int c4,  uniform int o1,  uniform 2-component vector of int o2,  uniform 3-component vector of int o3,  uniform 4-component vector of int o4})
 0:?     'anon@0' (layout( row_major std140) uniform block{ uniform int c1,  uniform 2-component vector of int c2,  uniform 3-component vector of int c3,  uniform 4-component vector of int c4,  uniform int o1,  uniform 2-component vector of int o2,  uniform 3-component vector of int o3,  uniform 4-component vector of int o4})
 0:?     'Color' (layout( location=0) out 4-component vector of float)
 0:?     'Color' (layout( location=0) out 4-component vector of float)
 0:?     'Depth' ( out float FragDepth)
 0:?     'Depth' ( out float FragDepth)
@@ -96,8 +96,8 @@ gl_FragCoord origin is upper left
 0:28        move second child to first child ( temp float)
 0:28        move second child to first child ( temp float)
 0:28          'r00' ( temp float)
 0:28          'r00' ( temp float)
 0:28          Construct float ( temp float)
 0:28          Construct float ( temp float)
-0:?             imageLoad ( temp 4-component vector of float)
-0:28              'g_tTexbfs' (layout( r32f) readonly uniform imageBuffer)
+0:?             textureFetch ( temp 4-component vector of float)
+0:28              'g_tTexbfs' (layout( r32f) uniform samplerBuffer)
 0:28              c1: direct index for structure ( uniform int)
 0:28              c1: direct index for structure ( uniform int)
 0:28                'anon@0' (layout( row_major std140) uniform block{ uniform int c1,  uniform 2-component vector of int c2,  uniform 3-component vector of int c3,  uniform 4-component vector of int c4,  uniform int o1,  uniform 2-component vector of int o2,  uniform 3-component vector of int o3,  uniform 4-component vector of int o4})
 0:28                'anon@0' (layout( row_major std140) uniform block{ uniform int c1,  uniform 2-component vector of int c2,  uniform 3-component vector of int c3,  uniform 4-component vector of int c4,  uniform int o1,  uniform 2-component vector of int o2,  uniform 3-component vector of int o3,  uniform 4-component vector of int o4})
 0:28                Constant:
 0:28                Constant:
@@ -106,8 +106,8 @@ gl_FragCoord origin is upper left
 0:29        move second child to first child ( temp int)
 0:29        move second child to first child ( temp int)
 0:29          'r01' ( temp int)
 0:29          'r01' ( temp int)
 0:29          Construct int ( temp int)
 0:29          Construct int ( temp int)
-0:?             imageLoad ( temp 4-component vector of int)
-0:29              'g_tTexbis' (layout( r32i) readonly uniform iimageBuffer)
+0:?             textureFetch ( temp 4-component vector of int)
+0:29              'g_tTexbis' (layout( r32i) uniform isamplerBuffer)
 0:29              c1: direct index for structure ( uniform int)
 0:29              c1: direct index for structure ( uniform int)
 0:29                'anon@0' (layout( row_major std140) uniform block{ uniform int c1,  uniform 2-component vector of int c2,  uniform 3-component vector of int c3,  uniform 4-component vector of int c4,  uniform int o1,  uniform 2-component vector of int o2,  uniform 3-component vector of int o3,  uniform 4-component vector of int o4})
 0:29                'anon@0' (layout( row_major std140) uniform block{ uniform int c1,  uniform 2-component vector of int c2,  uniform 3-component vector of int c3,  uniform 4-component vector of int c4,  uniform int o1,  uniform 2-component vector of int o2,  uniform 3-component vector of int o3,  uniform 4-component vector of int o4})
 0:29                Constant:
 0:29                Constant:
@@ -116,8 +116,8 @@ gl_FragCoord origin is upper left
 0:30        move second child to first child ( temp uint)
 0:30        move second child to first child ( temp uint)
 0:30          'r02' ( temp uint)
 0:30          'r02' ( temp uint)
 0:30          Construct uint ( temp uint)
 0:30          Construct uint ( temp uint)
-0:?             imageLoad ( temp 4-component vector of uint)
-0:30              'g_tTexbus' (layout( r32ui) readonly uniform uimageBuffer)
+0:?             textureFetch ( temp 4-component vector of uint)
+0:30              'g_tTexbus' (layout( r32ui) uniform usamplerBuffer)
 0:30              c1: direct index for structure ( uniform int)
 0:30              c1: direct index for structure ( uniform int)
 0:30                'anon@0' (layout( row_major std140) uniform block{ uniform int c1,  uniform 2-component vector of int c2,  uniform 3-component vector of int c3,  uniform 4-component vector of int c4,  uniform int o1,  uniform 2-component vector of int o2,  uniform 3-component vector of int o3,  uniform 4-component vector of int o4})
 0:30                'anon@0' (layout( row_major std140) uniform block{ uniform int c1,  uniform 2-component vector of int c2,  uniform 3-component vector of int c3,  uniform 4-component vector of int c4,  uniform int o1,  uniform 2-component vector of int o2,  uniform 3-component vector of int o3,  uniform 4-component vector of int o4})
 0:30                Constant:
 0:30                Constant:
@@ -161,23 +161,23 @@ gl_FragCoord origin is upper left
 0:24            Constant:
 0:24            Constant:
 0:24              1 (const int)
 0:24              1 (const int)
 0:?   Linker Objects
 0:?   Linker Objects
-0:?     'g_tTexbfs_test' (layout( binding=0 r32f) readonly uniform imageBuffer)
-0:?     'g_tTexbfs' (layout( r32f) readonly uniform imageBuffer)
-0:?     'g_tTexbis' (layout( r32i) readonly uniform iimageBuffer)
-0:?     'g_tTexbus' (layout( r32ui) readonly uniform uimageBuffer)
+0:?     'g_tTexbfs_test' (layout( binding=0 r32f) uniform samplerBuffer)
+0:?     'g_tTexbfs' (layout( r32f) uniform samplerBuffer)
+0:?     'g_tTexbis' (layout( r32i) uniform isamplerBuffer)
+0:?     'g_tTexbus' (layout( r32ui) uniform usamplerBuffer)
 0:?     'anon@0' (layout( row_major std140) uniform block{ uniform int c1,  uniform 2-component vector of int c2,  uniform 3-component vector of int c3,  uniform 4-component vector of int c4,  uniform int o1,  uniform 2-component vector of int o2,  uniform 3-component vector of int o3,  uniform 4-component vector of int o4})
 0:?     'anon@0' (layout( row_major std140) uniform block{ uniform int c1,  uniform 2-component vector of int c2,  uniform 3-component vector of int c3,  uniform 4-component vector of int c4,  uniform int o1,  uniform 2-component vector of int o2,  uniform 3-component vector of int o3,  uniform 4-component vector of int o4})
 0:?     'Color' (layout( location=0) out 4-component vector of float)
 0:?     'Color' (layout( location=0) out 4-component vector of float)
 0:?     'Depth' ( out float FragDepth)
 0:?     'Depth' ( out float FragDepth)
 
 
 // Module Version 10000
 // Module Version 10000
 // Generated by (magic number): 80001
 // Generated by (magic number): 80001
-// Id's are bound by 75
+// Id's are bound by 81
 
 
                               Capability Shader
                               Capability Shader
                               Capability SampledBuffer
                               Capability SampledBuffer
                1:             ExtInstImport  "GLSL.std.450"
                1:             ExtInstImport  "GLSL.std.450"
                               MemoryModel Logical GLSL450
                               MemoryModel Logical GLSL450
-                              EntryPoint Fragment 4  "main" 67 71
+                              EntryPoint Fragment 4  "main" 73 77
                               ExecutionMode 4 OriginUpperLeft
                               ExecutionMode 4 OriginUpperLeft
                               Name 4  "main"
                               Name 4  "main"
                               Name 8  "PS_OUTPUT"
                               Name 8  "PS_OUTPUT"
@@ -185,47 +185,43 @@ gl_FragCoord origin is upper left
                               MemberName 8(PS_OUTPUT) 1  "Depth"
                               MemberName 8(PS_OUTPUT) 1  "Depth"
                               Name 10  "@main("
                               Name 10  "@main("
                               Name 13  "r00"
                               Name 13  "r00"
-                              Name 16  "g_tTexbfs"
-                              Name 22  "$Global"
-                              MemberName 22($Global) 0  "c1"
-                              MemberName 22($Global) 1  "c2"
-                              MemberName 22($Global) 2  "c3"
-                              MemberName 22($Global) 3  "c4"
-                              MemberName 22($Global) 4  "o1"
-                              MemberName 22($Global) 5  "o2"
-                              MemberName 22($Global) 6  "o3"
-                              MemberName 22($Global) 7  "o4"
-                              Name 24  ""
-                              Name 32  "r01"
-                              Name 35  "g_tTexbis"
-                              Name 43  "r02"
-                              Name 46  "g_tTexbus"
-                              Name 54  "psout"
-                              Name 64  "flattenTemp"
-                              Name 67  "Color"
-                              Name 71  "Depth"
-                              Name 74  "g_tTexbfs_test"
-                              Decorate 16(g_tTexbfs) DescriptorSet 0
-                              Decorate 16(g_tTexbfs) NonWritable
-                              MemberDecorate 22($Global) 0 Offset 0
-                              MemberDecorate 22($Global) 1 Offset 8
-                              MemberDecorate 22($Global) 2 Offset 16
-                              MemberDecorate 22($Global) 3 Offset 32
-                              MemberDecorate 22($Global) 4 Offset 48
-                              MemberDecorate 22($Global) 5 Offset 56
-                              MemberDecorate 22($Global) 6 Offset 64
-                              MemberDecorate 22($Global) 7 Offset 80
-                              Decorate 22($Global) Block
-                              Decorate 24 DescriptorSet 0
-                              Decorate 35(g_tTexbis) DescriptorSet 0
-                              Decorate 35(g_tTexbis) NonWritable
-                              Decorate 46(g_tTexbus) DescriptorSet 0
-                              Decorate 46(g_tTexbus) NonWritable
-                              Decorate 67(Color) Location 0
-                              Decorate 71(Depth) BuiltIn FragDepth
-                              Decorate 74(g_tTexbfs_test) DescriptorSet 0
-                              Decorate 74(g_tTexbfs_test) Binding 0
-                              Decorate 74(g_tTexbfs_test) NonWritable
+                              Name 17  "g_tTexbfs"
+                              Name 23  "$Global"
+                              MemberName 23($Global) 0  "c1"
+                              MemberName 23($Global) 1  "c2"
+                              MemberName 23($Global) 2  "c3"
+                              MemberName 23($Global) 3  "c4"
+                              MemberName 23($Global) 4  "o1"
+                              MemberName 23($Global) 5  "o2"
+                              MemberName 23($Global) 6  "o3"
+                              MemberName 23($Global) 7  "o4"
+                              Name 25  ""
+                              Name 34  "r01"
+                              Name 38  "g_tTexbis"
+                              Name 47  "r02"
+                              Name 51  "g_tTexbus"
+                              Name 60  "psout"
+                              Name 70  "flattenTemp"
+                              Name 73  "Color"
+                              Name 77  "Depth"
+                              Name 80  "g_tTexbfs_test"
+                              Decorate 17(g_tTexbfs) DescriptorSet 0
+                              MemberDecorate 23($Global) 0 Offset 0
+                              MemberDecorate 23($Global) 1 Offset 8
+                              MemberDecorate 23($Global) 2 Offset 16
+                              MemberDecorate 23($Global) 3 Offset 32
+                              MemberDecorate 23($Global) 4 Offset 48
+                              MemberDecorate 23($Global) 5 Offset 56
+                              MemberDecorate 23($Global) 6 Offset 64
+                              MemberDecorate 23($Global) 7 Offset 80
+                              Decorate 23($Global) Block
+                              Decorate 25 DescriptorSet 0
+                              Decorate 38(g_tTexbis) DescriptorSet 0
+                              Decorate 51(g_tTexbus) DescriptorSet 0
+                              Decorate 73(Color) Location 0
+                              Decorate 77(Depth) BuiltIn FragDepth
+                              Decorate 80(g_tTexbfs_test) DescriptorSet 0
+                              Decorate 80(g_tTexbfs_test) Binding 0
                2:             TypeVoid
                2:             TypeVoid
                3:             TypeFunction 2
                3:             TypeFunction 2
                6:             TypeFloat 32
                6:             TypeFloat 32
@@ -233,79 +229,85 @@ gl_FragCoord origin is upper left
     8(PS_OUTPUT):             TypeStruct 7(fvec4) 6(float)
     8(PS_OUTPUT):             TypeStruct 7(fvec4) 6(float)
                9:             TypeFunction 8(PS_OUTPUT)
                9:             TypeFunction 8(PS_OUTPUT)
               12:             TypePointer Function 6(float)
               12:             TypePointer Function 6(float)
-              14:             TypeImage 6(float) Buffer nonsampled format:R32f
-              15:             TypePointer UniformConstant 14
-   16(g_tTexbfs):     15(ptr) Variable UniformConstant
-              18:             TypeInt 32 1
-              19:             TypeVector 18(int) 2
-              20:             TypeVector 18(int) 3
-              21:             TypeVector 18(int) 4
-     22($Global):             TypeStruct 18(int) 19(ivec2) 20(ivec3) 21(ivec4) 18(int) 19(ivec2) 20(ivec3) 21(ivec4)
-              23:             TypePointer Uniform 22($Global)
-              24:     23(ptr) Variable Uniform
-              25:     18(int) Constant 0
-              26:             TypePointer Uniform 18(int)
-              31:             TypePointer Function 18(int)
-              33:             TypeImage 18(int) Buffer nonsampled format:R32i
-              34:             TypePointer UniformConstant 33
-   35(g_tTexbis):     34(ptr) Variable UniformConstant
-              41:             TypeInt 32 0
-              42:             TypePointer Function 41(int)
-              44:             TypeImage 41(int) Buffer nonsampled format:R32ui
-              45:             TypePointer UniformConstant 44
-   46(g_tTexbus):     45(ptr) Variable UniformConstant
-              50:             TypeVector 41(int) 4
-              53:             TypePointer Function 8(PS_OUTPUT)
-              55:    6(float) Constant 1065353216
-              56:    7(fvec4) ConstantComposite 55 55 55 55
-              57:             TypePointer Function 7(fvec4)
-              59:     18(int) Constant 1
-              66:             TypePointer Output 7(fvec4)
-       67(Color):     66(ptr) Variable Output
-              70:             TypePointer Output 6(float)
-       71(Depth):     70(ptr) Variable Output
-74(g_tTexbfs_test):     15(ptr) Variable UniformConstant
+              14:             TypeImage 6(float) Buffer sampled format:R32f
+              15:             TypeSampledImage 14
+              16:             TypePointer UniformConstant 15
+   17(g_tTexbfs):     16(ptr) Variable UniformConstant
+              19:             TypeInt 32 1
+              20:             TypeVector 19(int) 2
+              21:             TypeVector 19(int) 3
+              22:             TypeVector 19(int) 4
+     23($Global):             TypeStruct 19(int) 20(ivec2) 21(ivec3) 22(ivec4) 19(int) 20(ivec2) 21(ivec3) 22(ivec4)
+              24:             TypePointer Uniform 23($Global)
+              25:     24(ptr) Variable Uniform
+              26:     19(int) Constant 0
+              27:             TypePointer Uniform 19(int)
+              33:             TypePointer Function 19(int)
+              35:             TypeImage 19(int) Buffer sampled format:R32i
+              36:             TypeSampledImage 35
+              37:             TypePointer UniformConstant 36
+   38(g_tTexbis):     37(ptr) Variable UniformConstant
+              45:             TypeInt 32 0
+              46:             TypePointer Function 45(int)
+              48:             TypeImage 45(int) Buffer sampled format:R32ui
+              49:             TypeSampledImage 48
+              50:             TypePointer UniformConstant 49
+   51(g_tTexbus):     50(ptr) Variable UniformConstant
+              56:             TypeVector 45(int) 4
+              59:             TypePointer Function 8(PS_OUTPUT)
+              61:    6(float) Constant 1065353216
+              62:    7(fvec4) ConstantComposite 61 61 61 61
+              63:             TypePointer Function 7(fvec4)
+              65:     19(int) Constant 1
+              72:             TypePointer Output 7(fvec4)
+       73(Color):     72(ptr) Variable Output
+              76:             TypePointer Output 6(float)
+       77(Depth):     76(ptr) Variable Output
+80(g_tTexbfs_test):     16(ptr) Variable UniformConstant
          4(main):           2 Function None 3
          4(main):           2 Function None 3
                5:             Label
                5:             Label
- 64(flattenTemp):     53(ptr) Variable Function
-              65:8(PS_OUTPUT) FunctionCall 10(@main()
-                              Store 64(flattenTemp) 65
-              68:     57(ptr) AccessChain 64(flattenTemp) 25
-              69:    7(fvec4) Load 68
-                              Store 67(Color) 69
-              72:     12(ptr) AccessChain 64(flattenTemp) 59
-              73:    6(float) Load 72
-                              Store 71(Depth) 73
+ 70(flattenTemp):     59(ptr) Variable Function
+              71:8(PS_OUTPUT) FunctionCall 10(@main()
+                              Store 70(flattenTemp) 71
+              74:     63(ptr) AccessChain 70(flattenTemp) 26
+              75:    7(fvec4) Load 74
+                              Store 73(Color) 75
+              78:     12(ptr) AccessChain 70(flattenTemp) 65
+              79:    6(float) Load 78
+                              Store 77(Depth) 79
                               Return
                               Return
                               FunctionEnd
                               FunctionEnd
       10(@main():8(PS_OUTPUT) Function None 9
       10(@main():8(PS_OUTPUT) Function None 9
               11:             Label
               11:             Label
          13(r00):     12(ptr) Variable Function
          13(r00):     12(ptr) Variable Function
-         32(r01):     31(ptr) Variable Function
-         43(r02):     42(ptr) Variable Function
-       54(psout):     53(ptr) Variable Function
-              17:          14 Load 16(g_tTexbfs)
-              27:     26(ptr) AccessChain 24 25
-              28:     18(int) Load 27
-              29:    7(fvec4) ImageRead 17 28
-              30:    6(float) CompositeExtract 29 0
-                              Store 13(r00) 30
-              36:          33 Load 35(g_tTexbis)
-              37:     26(ptr) AccessChain 24 25
-              38:     18(int) Load 37
-              39:   21(ivec4) ImageRead 36 38
-              40:     18(int) CompositeExtract 39 0
-                              Store 32(r01) 40
-              47:          44 Load 46(g_tTexbus)
-              48:     26(ptr) AccessChain 24 25
-              49:     18(int) Load 48
-              51:   50(ivec4) ImageRead 47 49
-              52:     41(int) CompositeExtract 51 0
-                              Store 43(r02) 52
-              58:     57(ptr) AccessChain 54(psout) 25
-                              Store 58 56
-              60:     12(ptr) AccessChain 54(psout) 59
-                              Store 60 55
-              61:8(PS_OUTPUT) Load 54(psout)
-                              ReturnValue 61
+         34(r01):     33(ptr) Variable Function
+         47(r02):     46(ptr) Variable Function
+       60(psout):     59(ptr) Variable Function
+              18:          15 Load 17(g_tTexbfs)
+              28:     27(ptr) AccessChain 25 26
+              29:     19(int) Load 28
+              30:          14 Image 18
+              31:    7(fvec4) ImageFetch 30 29
+              32:    6(float) CompositeExtract 31 0
+                              Store 13(r00) 32
+              39:          36 Load 38(g_tTexbis)
+              40:     27(ptr) AccessChain 25 26
+              41:     19(int) Load 40
+              42:          35 Image 39
+              43:   22(ivec4) ImageFetch 42 41
+              44:     19(int) CompositeExtract 43 0
+                              Store 34(r01) 44
+              52:          49 Load 51(g_tTexbus)
+              53:     27(ptr) AccessChain 25 26
+              54:     19(int) Load 53
+              55:          48 Image 52
+              57:   56(ivec4) ImageFetch 55 54
+              58:     45(int) CompositeExtract 57 0
+                              Store 47(r02) 58
+              64:     63(ptr) AccessChain 60(psout) 26
+                              Store 64 62
+              66:     12(ptr) AccessChain 60(psout) 65
+                              Store 66 61
+              67:8(PS_OUTPUT) Load 60(psout)
+                              ReturnValue 67
                               FunctionEnd
                               FunctionEnd

+ 71 - 65
3rdparty/glslang/Test/baseResults/hlsl.logical.unary.frag.out

@@ -31,17 +31,19 @@ gl_FragCoord origin is upper left
 0:17              3 (const uint)
 0:17              3 (const uint)
 0:19      Test condition and select ( temp void)
 0:19      Test condition and select ( temp void)
 0:19        Condition
 0:19        Condition
-0:19        ival: direct index for structure ( uniform int)
-0:19          'anon@0' (layout( row_major std140) uniform block{ uniform int ival,  uniform 4-component vector of int ival4,  uniform float fval,  uniform 4-component vector of float fval4})
-0:19          Constant:
-0:19            0 (const uint)
+0:19        Convert int to bool ( temp bool)
+0:19          ival: direct index for structure ( uniform int)
+0:19            'anon@0' (layout( row_major std140) uniform block{ uniform int ival,  uniform 4-component vector of int ival4,  uniform float fval,  uniform 4-component vector of float fval4})
+0:19            Constant:
+0:19              0 (const uint)
 0:19        true case is null
 0:19        true case is null
 0:20      Test condition and select ( temp void)
 0:20      Test condition and select ( temp void)
 0:20        Condition
 0:20        Condition
-0:20        fval: direct index for structure ( uniform float)
-0:20          'anon@0' (layout( row_major std140) uniform block{ uniform int ival,  uniform 4-component vector of int ival4,  uniform float fval,  uniform 4-component vector of float fval4})
-0:20          Constant:
-0:20            2 (const uint)
+0:20        Convert float to bool ( temp bool)
+0:20          fval: direct index for structure ( uniform float)
+0:20            'anon@0' (layout( row_major std140) uniform block{ uniform int ival,  uniform 4-component vector of int ival4,  uniform float fval,  uniform 4-component vector of float fval4})
+0:20            Constant:
+0:20              2 (const uint)
 0:20        true case is null
 0:20        true case is null
 0:21      Test condition and select ( temp void)
 0:21      Test condition and select ( temp void)
 0:21        Condition
 0:21        Condition
@@ -123,17 +125,19 @@ gl_FragCoord origin is upper left
 0:17              3 (const uint)
 0:17              3 (const uint)
 0:19      Test condition and select ( temp void)
 0:19      Test condition and select ( temp void)
 0:19        Condition
 0:19        Condition
-0:19        ival: direct index for structure ( uniform int)
-0:19          'anon@0' (layout( row_major std140) uniform block{ uniform int ival,  uniform 4-component vector of int ival4,  uniform float fval,  uniform 4-component vector of float fval4})
-0:19          Constant:
-0:19            0 (const uint)
+0:19        Convert int to bool ( temp bool)
+0:19          ival: direct index for structure ( uniform int)
+0:19            'anon@0' (layout( row_major std140) uniform block{ uniform int ival,  uniform 4-component vector of int ival4,  uniform float fval,  uniform 4-component vector of float fval4})
+0:19            Constant:
+0:19              0 (const uint)
 0:19        true case is null
 0:19        true case is null
 0:20      Test condition and select ( temp void)
 0:20      Test condition and select ( temp void)
 0:20        Condition
 0:20        Condition
-0:20        fval: direct index for structure ( uniform float)
-0:20          'anon@0' (layout( row_major std140) uniform block{ uniform int ival,  uniform 4-component vector of int ival4,  uniform float fval,  uniform 4-component vector of float fval4})
-0:20          Constant:
-0:20            2 (const uint)
+0:20        Convert float to bool ( temp bool)
+0:20          fval: direct index for structure ( uniform float)
+0:20            'anon@0' (layout( row_major std140) uniform block{ uniform int ival,  uniform 4-component vector of int ival4,  uniform float fval,  uniform 4-component vector of float fval4})
+0:20            Constant:
+0:20              2 (const uint)
 0:20        true case is null
 0:20        true case is null
 0:21      Test condition and select ( temp void)
 0:21      Test condition and select ( temp void)
 0:21        Condition
 0:21        Condition
@@ -181,12 +185,12 @@ gl_FragCoord origin is upper left
 
 
 // Module Version 10000
 // Module Version 10000
 // Generated by (magic number): 80001
 // Generated by (magic number): 80001
-// Id's are bound by 82
+// Id's are bound by 84
 
 
                               Capability Shader
                               Capability Shader
                1:             ExtInstImport  "GLSL.std.450"
                1:             ExtInstImport  "GLSL.std.450"
                               MemoryModel Logical GLSL450
                               MemoryModel Logical GLSL450
-                              EntryPoint Fragment 4  "main" 79
+                              EntryPoint Fragment 4  "main" 81
                               ExecutionMode 4 OriginUpperLeft
                               ExecutionMode 4 OriginUpperLeft
                               Name 4  "main"
                               Name 4  "main"
                               Name 8  "PS_OUTPUT"
                               Name 8  "PS_OUTPUT"
@@ -198,15 +202,15 @@ gl_FragCoord origin is upper left
                               MemberName 14($Global) 2  "fval"
                               MemberName 14($Global) 2  "fval"
                               MemberName 14($Global) 3  "fval4"
                               MemberName 14($Global) 3  "fval4"
                               Name 16  ""
                               Name 16  ""
-                              Name 70  "psout"
-                              Name 79  "Color"
+                              Name 72  "psout"
+                              Name 81  "Color"
                               MemberDecorate 14($Global) 0 Offset 0
                               MemberDecorate 14($Global) 0 Offset 0
                               MemberDecorate 14($Global) 1 Offset 16
                               MemberDecorate 14($Global) 1 Offset 16
                               MemberDecorate 14($Global) 2 Offset 32
                               MemberDecorate 14($Global) 2 Offset 32
                               MemberDecorate 14($Global) 3 Offset 48
                               MemberDecorate 14($Global) 3 Offset 48
                               Decorate 14($Global) Block
                               Decorate 14($Global) Block
                               Decorate 16 DescriptorSet 0
                               Decorate 16 DescriptorSet 0
-                              Decorate 79(Color) Location 0
+                              Decorate 81(Color) Location 0
                2:             TypeVoid
                2:             TypeVoid
                3:             TypeFunction 2
                3:             TypeFunction 2
                6:             TypeFloat 32
                6:             TypeFloat 32
@@ -234,22 +238,22 @@ gl_FragCoord origin is upper left
               42:     12(int) Constant 3
               42:     12(int) Constant 3
               43:             TypePointer Uniform 7(fvec4)
               43:             TypePointer Uniform 7(fvec4)
               46:    7(fvec4) ConstantComposite 39 39 39 39
               46:    7(fvec4) ConstantComposite 39 39 39 39
-              69:             TypePointer Function 8(PS_OUTPUT)
-              71:    6(float) Constant 1065353216
-              72:    7(fvec4) ConstantComposite 71 71 71 71
-              73:             TypePointer Function 7(fvec4)
-              78:             TypePointer Output 7(fvec4)
-       79(Color):     78(ptr) Variable Output
+              71:             TypePointer Function 8(PS_OUTPUT)
+              73:    6(float) Constant 1065353216
+              74:    7(fvec4) ConstantComposite 73 73 73 73
+              75:             TypePointer Function 7(fvec4)
+              80:             TypePointer Output 7(fvec4)
+       81(Color):     80(ptr) Variable Output
          4(main):           2 Function None 3
          4(main):           2 Function None 3
                5:             Label
                5:             Label
-              80:8(PS_OUTPUT) FunctionCall 10(@main()
-              81:    7(fvec4) CompositeExtract 80 0
-                              Store 79(Color) 81
+              82:8(PS_OUTPUT) FunctionCall 10(@main()
+              83:    7(fvec4) CompositeExtract 82 0
+                              Store 81(Color) 83
                               Return
                               Return
                               FunctionEnd
                               FunctionEnd
       10(@main():8(PS_OUTPUT) Function None 9
       10(@main():8(PS_OUTPUT) Function None 9
               11:             Label
               11:             Label
-       70(psout):     69(ptr) Variable Function
+       72(psout):     71(ptr) Variable Function
               19:     18(ptr) AccessChain 16 17
               19:     18(ptr) AccessChain 16 17
               20:     12(int) Load 19
               20:     12(int) Load 19
               24:    21(bool) INotEqual 20 23
               24:    21(bool) INotEqual 20 23
@@ -268,38 +272,40 @@ gl_FragCoord origin is upper left
               48:   30(bvec4) LogicalNot 47
               48:   30(bvec4) LogicalNot 47
               49:     18(ptr) AccessChain 16 17
               49:     18(ptr) AccessChain 16 17
               50:     12(int) Load 49
               50:     12(int) Load 49
-                              SelectionMerge 52 None
-                              BranchConditional 50 51 52
-              51:               Label
-                                Branch 52
-              52:             Label
-              53:     36(ptr) AccessChain 16 35
-              54:    6(float) Load 53
-                              SelectionMerge 56 None
-                              BranchConditional 54 55 56
-              55:               Label
-                                Branch 56
-              56:             Label
-              57:     18(ptr) AccessChain 16 17
-              58:     12(int) Load 57
-              59:    21(bool) INotEqual 58 23
-              60:    21(bool) LogicalNot 59
-                              SelectionMerge 62 None
-                              BranchConditional 60 61 62
-              61:               Label
-                                Branch 62
-              62:             Label
-              63:     36(ptr) AccessChain 16 35
-              64:    6(float) Load 63
-              65:    21(bool) FOrdNotEqual 64 39
-              66:    21(bool) LogicalNot 65
-                              SelectionMerge 68 None
-                              BranchConditional 66 67 68
-              67:               Label
-                                Branch 68
-              68:             Label
-              74:     73(ptr) AccessChain 70(psout) 17
-                              Store 74 72
-              75:8(PS_OUTPUT) Load 70(psout)
-                              ReturnValue 75
+              51:    21(bool) INotEqual 50 23
+                              SelectionMerge 53 None
+                              BranchConditional 51 52 53
+              52:               Label
+                                Branch 53
+              53:             Label
+              54:     36(ptr) AccessChain 16 35
+              55:    6(float) Load 54
+              56:    21(bool) FOrdNotEqual 55 39
+                              SelectionMerge 58 None
+                              BranchConditional 56 57 58
+              57:               Label
+                                Branch 58
+              58:             Label
+              59:     18(ptr) AccessChain 16 17
+              60:     12(int) Load 59
+              61:    21(bool) INotEqual 60 23
+              62:    21(bool) LogicalNot 61
+                              SelectionMerge 64 None
+                              BranchConditional 62 63 64
+              63:               Label
+                                Branch 64
+              64:             Label
+              65:     36(ptr) AccessChain 16 35
+              66:    6(float) Load 65
+              67:    21(bool) FOrdNotEqual 66 39
+              68:    21(bool) LogicalNot 67
+                              SelectionMerge 70 None
+                              BranchConditional 68 69 70
+              69:               Label
+                                Branch 70
+              70:             Label
+              76:     75(ptr) AccessChain 72(psout) 17
+                              Store 76 74
+              77:8(PS_OUTPUT) Load 72(psout)
+                              ReturnValue 77
                               FunctionEnd
                               FunctionEnd

+ 233 - 0
3rdparty/glslang/Test/baseResults/hlsl.logicalConvert.frag.out

@@ -0,0 +1,233 @@
+hlsl.logicalConvert.frag
+Shader version: 450
+gl_FragCoord origin is upper left
+0:? Sequence
+0:2  Function Definition: @main( ( temp 4-component vector of float)
+0:2    Function Parameters: 
+0:?     Sequence
+0:3      Test condition and select ( temp void)
+0:3        Condition
+0:3        Constant:
+0:3          false (const bool)
+0:3        true case
+0:4        Branch: Return with expression
+0:4          Constant:
+0:4            0.000000
+0:4            0.000000
+0:4            0.000000
+0:4            0.000000
+0:5      Test condition and select ( temp void)
+0:5        Condition
+0:5        Constant:
+0:5          false (const bool)
+0:5        true case
+0:6        Branch: Return with expression
+0:6          Constant:
+0:6            0.000000
+0:6            0.000000
+0:6            0.000000
+0:6            0.000000
+0:7      Test condition and select ( temp void)
+0:7        Condition
+0:7        Constant:
+0:7          true (const bool)
+0:7        true case
+0:8        Branch: Return with expression
+0:8          Constant:
+0:8            0.000000
+0:8            0.000000
+0:8            0.000000
+0:8            0.000000
+0:9      Test condition and select ( temp void)
+0:9        Condition
+0:9        Constant:
+0:9          true (const bool)
+0:9        true case
+0:10        Branch: Return with expression
+0:10          Constant:
+0:10            0.000000
+0:10            0.000000
+0:10            0.000000
+0:10            0.000000
+0:11      Test condition and select ( temp void)
+0:11        Condition
+0:11        Constant:
+0:11          false (const bool)
+0:11        true case
+0:12        Branch: Return with expression
+0:12          Constant:
+0:12            0.000000
+0:12            0.000000
+0:12            0.000000
+0:12            0.000000
+0:13      Test condition and select ( temp void)
+0:13        Condition
+0:13        Constant:
+0:13          false (const bool)
+0:13        true case
+0:14        Branch: Return with expression
+0:14          Constant:
+0:14            0.000000
+0:14            0.000000
+0:14            0.000000
+0:14            0.000000
+0:2  Function Definition: main( ( temp void)
+0:2    Function Parameters: 
+0:?     Sequence
+0:2      move second child to first child ( temp 4-component vector of float)
+0:?         '@entryPointOutput' (layout( location=0) out 4-component vector of float)
+0:2        Function Call: @main( ( temp 4-component vector of float)
+0:?   Linker Objects
+0:?     '@entryPointOutput' (layout( location=0) out 4-component vector of float)
+
+
+Linked fragment stage:
+
+
+Shader version: 450
+gl_FragCoord origin is upper left
+0:? Sequence
+0:2  Function Definition: @main( ( temp 4-component vector of float)
+0:2    Function Parameters: 
+0:?     Sequence
+0:3      Test condition and select ( temp void)
+0:3        Condition
+0:3        Constant:
+0:3          false (const bool)
+0:3        true case
+0:4        Branch: Return with expression
+0:4          Constant:
+0:4            0.000000
+0:4            0.000000
+0:4            0.000000
+0:4            0.000000
+0:5      Test condition and select ( temp void)
+0:5        Condition
+0:5        Constant:
+0:5          false (const bool)
+0:5        true case
+0:6        Branch: Return with expression
+0:6          Constant:
+0:6            0.000000
+0:6            0.000000
+0:6            0.000000
+0:6            0.000000
+0:7      Test condition and select ( temp void)
+0:7        Condition
+0:7        Constant:
+0:7          true (const bool)
+0:7        true case
+0:8        Branch: Return with expression
+0:8          Constant:
+0:8            0.000000
+0:8            0.000000
+0:8            0.000000
+0:8            0.000000
+0:9      Test condition and select ( temp void)
+0:9        Condition
+0:9        Constant:
+0:9          true (const bool)
+0:9        true case
+0:10        Branch: Return with expression
+0:10          Constant:
+0:10            0.000000
+0:10            0.000000
+0:10            0.000000
+0:10            0.000000
+0:11      Test condition and select ( temp void)
+0:11        Condition
+0:11        Constant:
+0:11          false (const bool)
+0:11        true case
+0:12        Branch: Return with expression
+0:12          Constant:
+0:12            0.000000
+0:12            0.000000
+0:12            0.000000
+0:12            0.000000
+0:13      Test condition and select ( temp void)
+0:13        Condition
+0:13        Constant:
+0:13          false (const bool)
+0:13        true case
+0:14        Branch: Return with expression
+0:14          Constant:
+0:14            0.000000
+0:14            0.000000
+0:14            0.000000
+0:14            0.000000
+0:2  Function Definition: main( ( temp void)
+0:2    Function Parameters: 
+0:?     Sequence
+0:2      move second child to first child ( temp 4-component vector of float)
+0:?         '@entryPointOutput' (layout( location=0) out 4-component vector of float)
+0:2        Function Call: @main( ( temp 4-component vector of float)
+0:?   Linker Objects
+0:?     '@entryPointOutput' (layout( location=0) out 4-component vector of float)
+
+// Module Version 10000
+// Generated by (magic number): 80001
+// Id's are bound by 38
+
+                              Capability Shader
+               1:             ExtInstImport  "GLSL.std.450"
+                              MemoryModel Logical GLSL450
+                              EntryPoint Fragment 4  "main" 36
+                              ExecutionMode 4 OriginUpperLeft
+                              Name 4  "main"
+                              Name 9  "@main("
+                              Name 36  "@entryPointOutput"
+                              Decorate 36(@entryPointOutput) Location 0
+               2:             TypeVoid
+               3:             TypeFunction 2
+               6:             TypeFloat 32
+               7:             TypeVector 6(float) 4
+               8:             TypeFunction 7(fvec4)
+              11:             TypeBool
+              12:    11(bool) ConstantFalse
+              15:    6(float) Constant 0
+              16:    7(fvec4) ConstantComposite 15 15 15 15
+              21:    11(bool) ConstantTrue
+              35:             TypePointer Output 7(fvec4)
+36(@entryPointOutput):     35(ptr) Variable Output
+         4(main):           2 Function None 3
+               5:             Label
+              37:    7(fvec4) FunctionCall 9(@main()
+                              Store 36(@entryPointOutput) 37
+                              Return
+                              FunctionEnd
+       9(@main():    7(fvec4) Function None 8
+              10:             Label
+                              SelectionMerge 14 None
+                              BranchConditional 12 13 14
+              13:               Label
+                                ReturnValue 16
+              14:             Label
+                              SelectionMerge 19 None
+                              BranchConditional 12 18 19
+              18:               Label
+                                ReturnValue 16
+              19:             Label
+                              SelectionMerge 23 None
+                              BranchConditional 21 22 23
+              22:               Label
+                                ReturnValue 16
+              23:             Label
+                              SelectionMerge 26 None
+                              BranchConditional 21 25 26
+              25:               Label
+                                ReturnValue 16
+              26:             Label
+                              SelectionMerge 29 None
+                              BranchConditional 12 28 29
+              28:               Label
+                                ReturnValue 16
+              29:             Label
+                              SelectionMerge 32 None
+                              BranchConditional 12 31 32
+              31:               Label
+                                ReturnValue 16
+              32:             Label
+              34:    7(fvec4) Undef
+                              ReturnValue 34
+                              FunctionEnd

+ 44 - 43
3rdparty/glslang/Test/baseResults/hlsl.multiEntry.vert.out

@@ -6,8 +6,8 @@ Shader version: 450
 0:4      'Index' ( in uint)
 0:4      'Index' ( in uint)
 0:?     Sequence
 0:?     Sequence
 0:5      Branch: Return with expression
 0:5      Branch: Return with expression
-0:5        imageLoad ( temp 4-component vector of float)
-0:5          'Position' (layout( rgba32f) readonly uniform imageBuffer)
+0:5        textureFetch ( temp 4-component vector of float)
+0:5          'Position' (layout( rgba32f) uniform samplerBuffer)
 0:5          Convert uint to int ( temp int)
 0:5          Convert uint to int ( temp int)
 0:5            'Index' ( in uint)
 0:5            'Index' ( in uint)
 0:9  Function Definition: @RealEntrypoint(u1; ( temp 4-component vector of float)
 0:9  Function Definition: @RealEntrypoint(u1; ( temp 4-component vector of float)
@@ -28,7 +28,7 @@ Shader version: 450
 0:9        Function Call: @RealEntrypoint(u1; ( temp 4-component vector of float)
 0:9        Function Call: @RealEntrypoint(u1; ( temp 4-component vector of float)
 0:?           'Index' ( temp uint)
 0:?           'Index' ( temp uint)
 0:?   Linker Objects
 0:?   Linker Objects
-0:?     'Position' (layout( rgba32f) readonly uniform imageBuffer)
+0:?     'Position' (layout( rgba32f) uniform samplerBuffer)
 0:?     '@entryPointOutput' ( out 4-component vector of float Position)
 0:?     '@entryPointOutput' ( out 4-component vector of float Position)
 0:?     'Index' ( in uint VertexIndex)
 0:?     'Index' ( in uint VertexIndex)
 
 
@@ -43,8 +43,8 @@ Shader version: 450
 0:4      'Index' ( in uint)
 0:4      'Index' ( in uint)
 0:?     Sequence
 0:?     Sequence
 0:5      Branch: Return with expression
 0:5      Branch: Return with expression
-0:5        imageLoad ( temp 4-component vector of float)
-0:5          'Position' (layout( rgba32f) readonly uniform imageBuffer)
+0:5        textureFetch ( temp 4-component vector of float)
+0:5          'Position' (layout( rgba32f) uniform samplerBuffer)
 0:5          Convert uint to int ( temp int)
 0:5          Convert uint to int ( temp int)
 0:5            'Index' ( in uint)
 0:5            'Index' ( in uint)
 0:9  Function Definition: @RealEntrypoint(u1; ( temp 4-component vector of float)
 0:9  Function Definition: @RealEntrypoint(u1; ( temp 4-component vector of float)
@@ -65,34 +65,33 @@ Shader version: 450
 0:9        Function Call: @RealEntrypoint(u1; ( temp 4-component vector of float)
 0:9        Function Call: @RealEntrypoint(u1; ( temp 4-component vector of float)
 0:?           'Index' ( temp uint)
 0:?           'Index' ( temp uint)
 0:?   Linker Objects
 0:?   Linker Objects
-0:?     'Position' (layout( rgba32f) readonly uniform imageBuffer)
+0:?     'Position' (layout( rgba32f) uniform samplerBuffer)
 0:?     '@entryPointOutput' ( out 4-component vector of float Position)
 0:?     '@entryPointOutput' ( out 4-component vector of float Position)
 0:?     'Index' ( in uint VertexIndex)
 0:?     'Index' ( in uint VertexIndex)
 
 
 // Module Version 10000
 // Module Version 10000
 // Generated by (magic number): 80001
 // Generated by (magic number): 80001
-// Id's are bound by 41
+// Id's are bound by 43
 
 
                               Capability Shader
                               Capability Shader
                               Capability SampledBuffer
                               Capability SampledBuffer
                1:             ExtInstImport  "GLSL.std.450"
                1:             ExtInstImport  "GLSL.std.450"
                               MemoryModel Logical GLSL450
                               MemoryModel Logical GLSL450
-                              EntryPoint Vertex 4  "RealEntrypoint" 34 37
+                              EntryPoint Vertex 4  "RealEntrypoint" 36 39
                               Name 4  "RealEntrypoint"
                               Name 4  "RealEntrypoint"
                               Name 12  "FakeEntrypoint(u1;"
                               Name 12  "FakeEntrypoint(u1;"
                               Name 11  "Index"
                               Name 11  "Index"
                               Name 15  "@RealEntrypoint(u1;"
                               Name 15  "@RealEntrypoint(u1;"
                               Name 14  "Index"
                               Name 14  "Index"
-                              Name 19  "Position"
-                              Name 27  "param"
-                              Name 32  "Index"
+                              Name 20  "Position"
+                              Name 29  "param"
                               Name 34  "Index"
                               Name 34  "Index"
-                              Name 37  "@entryPointOutput"
-                              Name 38  "param"
-                              Decorate 19(Position) DescriptorSet 0
-                              Decorate 19(Position) NonWritable
-                              Decorate 34(Index) BuiltIn VertexIndex
-                              Decorate 37(@entryPointOutput) BuiltIn Position
+                              Name 36  "Index"
+                              Name 39  "@entryPointOutput"
+                              Name 40  "param"
+                              Decorate 20(Position) DescriptorSet 0
+                              Decorate 36(Index) BuiltIn VertexIndex
+                              Decorate 39(@entryPointOutput) BuiltIn Position
                2:             TypeVoid
                2:             TypeVoid
                3:             TypeFunction 2
                3:             TypeFunction 2
                6:             TypeInt 32 0
                6:             TypeInt 32 0
@@ -100,41 +99,43 @@ Shader version: 450
                8:             TypeFloat 32
                8:             TypeFloat 32
                9:             TypeVector 8(float) 4
                9:             TypeVector 8(float) 4
               10:             TypeFunction 9(fvec4) 7(ptr)
               10:             TypeFunction 9(fvec4) 7(ptr)
-              17:             TypeImage 8(float) Buffer nonsampled format:Rgba32f
-              18:             TypePointer UniformConstant 17
-    19(Position):     18(ptr) Variable UniformConstant
-              22:             TypeInt 32 1
-              33:             TypePointer Input 6(int)
-       34(Index):     33(ptr) Variable Input
-              36:             TypePointer Output 9(fvec4)
-37(@entryPointOutput):     36(ptr) Variable Output
+              17:             TypeImage 8(float) Buffer sampled format:Rgba32f
+              18:             TypeSampledImage 17
+              19:             TypePointer UniformConstant 18
+    20(Position):     19(ptr) Variable UniformConstant
+              23:             TypeInt 32 1
+              35:             TypePointer Input 6(int)
+       36(Index):     35(ptr) Variable Input
+              38:             TypePointer Output 9(fvec4)
+39(@entryPointOutput):     38(ptr) Variable Output
 4(RealEntrypoint):           2 Function None 3
 4(RealEntrypoint):           2 Function None 3
                5:             Label
                5:             Label
-       32(Index):      7(ptr) Variable Function
-       38(param):      7(ptr) Variable Function
-              35:      6(int) Load 34(Index)
-                              Store 32(Index) 35
-              39:      6(int) Load 32(Index)
-                              Store 38(param) 39
-              40:    9(fvec4) FunctionCall 15(@RealEntrypoint(u1;) 38(param)
-                              Store 37(@entryPointOutput) 40
+       34(Index):      7(ptr) Variable Function
+       40(param):      7(ptr) Variable Function
+              37:      6(int) Load 36(Index)
+                              Store 34(Index) 37
+              41:      6(int) Load 34(Index)
+                              Store 40(param) 41
+              42:    9(fvec4) FunctionCall 15(@RealEntrypoint(u1;) 40(param)
+                              Store 39(@entryPointOutput) 42
                               Return
                               Return
                               FunctionEnd
                               FunctionEnd
 12(FakeEntrypoint(u1;):    9(fvec4) Function None 10
 12(FakeEntrypoint(u1;):    9(fvec4) Function None 10
        11(Index):      7(ptr) FunctionParameter
        11(Index):      7(ptr) FunctionParameter
               13:             Label
               13:             Label
-              20:          17 Load 19(Position)
-              21:      6(int) Load 11(Index)
-              23:     22(int) Bitcast 21
-              24:    9(fvec4) ImageRead 20 23
-                              ReturnValue 24
+              21:          18 Load 20(Position)
+              22:      6(int) Load 11(Index)
+              24:     23(int) Bitcast 22
+              25:          17 Image 21
+              26:    9(fvec4) ImageFetch 25 24
+                              ReturnValue 26
                               FunctionEnd
                               FunctionEnd
 15(@RealEntrypoint(u1;):    9(fvec4) Function None 10
 15(@RealEntrypoint(u1;):    9(fvec4) Function None 10
        14(Index):      7(ptr) FunctionParameter
        14(Index):      7(ptr) FunctionParameter
               16:             Label
               16:             Label
-       27(param):      7(ptr) Variable Function
-              28:      6(int) Load 14(Index)
-                              Store 27(param) 28
-              29:    9(fvec4) FunctionCall 12(FakeEntrypoint(u1;) 27(param)
-                              ReturnValue 29
+       29(param):      7(ptr) Variable Function
+              30:      6(int) Load 14(Index)
+                              Store 29(param) 30
+              31:    9(fvec4) FunctionCall 12(FakeEntrypoint(u1;) 29(param)
+                              ReturnValue 31
                               FunctionEnd
                               FunctionEnd

+ 180 - 0
3rdparty/glslang/Test/baseResults/hlsl.namespace.frag.out

@@ -0,0 +1,180 @@
+hlsl.namespace.frag
+Shader version: 450
+gl_FragCoord origin is upper left
+0:? Sequence
+0:5  Function Definition: N1::getVec( ( temp 4-component vector of float)
+0:5    Function Parameters: 
+0:?     Sequence
+0:5      Branch: Return with expression
+0:5        'v1' ( global 4-component vector of float)
+0:10  Function Definition: N2::getVec( ( temp 4-component vector of float)
+0:10    Function Parameters: 
+0:?     Sequence
+0:10      Branch: Return with expression
+0:10        'v2' ( global 4-component vector of float)
+0:12  Function Definition: N2::N3::getVec( ( temp 4-component vector of float)
+0:12    Function Parameters: 
+0:?     Sequence
+0:12      Branch: Return with expression
+0:12        'v2' ( global 4-component vector of float)
+0:15  Function Definition: N2::N3::C1::getVec( ( temp 4-component vector of float)
+0:15    Function Parameters: 
+0:15      '@this' ( temp structure{})
+0:?     Sequence
+0:15      Branch: Return with expression
+0:15        'v2' ( global 4-component vector of float)
+0:21  Function Definition: @main( ( temp 4-component vector of float)
+0:21    Function Parameters: 
+0:?     Sequence
+0:22      Branch: Return with expression
+0:22        add ( temp 4-component vector of float)
+0:22          add ( temp 4-component vector of float)
+0:22            add ( temp 4-component vector of float)
+0:22              Function Call: N1::getVec( ( temp 4-component vector of float)
+0:22              Function Call: N2::getVec( ( temp 4-component vector of float)
+0:22            Function Call: N2::N3::getVec( ( temp 4-component vector of float)
+0:22          vector-scale ( temp 4-component vector of float)
+0:22            Function Call: N2::N3::C1::getVec( ( temp 4-component vector of float)
+0:22            'N2::gf' ( global float)
+0:21  Function Definition: main( ( temp void)
+0:21    Function Parameters: 
+0:?     Sequence
+0:21      move second child to first child ( temp 4-component vector of float)
+0:?         '@entryPointOutput' (layout( location=0) out 4-component vector of float)
+0:21        Function Call: @main( ( temp 4-component vector of float)
+0:?   Linker Objects
+0:?     'v1' ( global 4-component vector of float)
+0:?     'v2' ( global 4-component vector of float)
+0:?     'N2::gf' ( global float)
+0:?     '@entryPointOutput' (layout( location=0) out 4-component vector of float)
+
+
+Linked fragment stage:
+
+
+Shader version: 450
+gl_FragCoord origin is upper left
+0:? Sequence
+0:5  Function Definition: N1::getVec( ( temp 4-component vector of float)
+0:5    Function Parameters: 
+0:?     Sequence
+0:5      Branch: Return with expression
+0:5        'v1' ( global 4-component vector of float)
+0:10  Function Definition: N2::getVec( ( temp 4-component vector of float)
+0:10    Function Parameters: 
+0:?     Sequence
+0:10      Branch: Return with expression
+0:10        'v2' ( global 4-component vector of float)
+0:12  Function Definition: N2::N3::getVec( ( temp 4-component vector of float)
+0:12    Function Parameters: 
+0:?     Sequence
+0:12      Branch: Return with expression
+0:12        'v2' ( global 4-component vector of float)
+0:15  Function Definition: N2::N3::C1::getVec( ( temp 4-component vector of float)
+0:15    Function Parameters: 
+0:15      '@this' ( temp structure{})
+0:?     Sequence
+0:15      Branch: Return with expression
+0:15        'v2' ( global 4-component vector of float)
+0:21  Function Definition: @main( ( temp 4-component vector of float)
+0:21    Function Parameters: 
+0:?     Sequence
+0:22      Branch: Return with expression
+0:22        add ( temp 4-component vector of float)
+0:22          add ( temp 4-component vector of float)
+0:22            add ( temp 4-component vector of float)
+0:22              Function Call: N1::getVec( ( temp 4-component vector of float)
+0:22              Function Call: N2::getVec( ( temp 4-component vector of float)
+0:22            Function Call: N2::N3::getVec( ( temp 4-component vector of float)
+0:22          vector-scale ( temp 4-component vector of float)
+0:22            Function Call: N2::N3::C1::getVec( ( temp 4-component vector of float)
+0:22            'N2::gf' ( global float)
+0:21  Function Definition: main( ( temp void)
+0:21    Function Parameters: 
+0:?     Sequence
+0:21      move second child to first child ( temp 4-component vector of float)
+0:?         '@entryPointOutput' (layout( location=0) out 4-component vector of float)
+0:21        Function Call: @main( ( temp 4-component vector of float)
+0:?   Linker Objects
+0:?     'v1' ( global 4-component vector of float)
+0:?     'v2' ( global 4-component vector of float)
+0:?     'N2::gf' ( global float)
+0:?     '@entryPointOutput' (layout( location=0) out 4-component vector of float)
+
+// Module Version 10000
+// Generated by (magic number): 80001
+// Id's are bound by 54
+
+                              Capability Shader
+               1:             ExtInstImport  "GLSL.std.450"
+                              MemoryModel Logical GLSL450
+                              EntryPoint Fragment 4  "main" 52
+                              ExecutionMode 4 OriginUpperLeft
+                              Name 4  "main"
+                              Name 9  "N1::getVec("
+                              Name 11  "N2::getVec("
+                              Name 13  "N2::N3::getVec("
+                              Name 15  "C1"
+                              Name 19  "N2::N3::C1::getVec("
+                              Name 18  "@this"
+                              Name 21  "@main("
+                              Name 24  "v1"
+                              Name 28  "v2"
+                              Name 45  "N2::gf"
+                              Name 52  "@entryPointOutput"
+                              Decorate 52(@entryPointOutput) Location 0
+               2:             TypeVoid
+               3:             TypeFunction 2
+               6:             TypeFloat 32
+               7:             TypeVector 6(float) 4
+               8:             TypeFunction 7(fvec4)
+          15(C1):             TypeStruct
+              16:             TypePointer Function 15(C1)
+              17:             TypeFunction 7(fvec4) 16(ptr)
+              23:             TypePointer Private 7(fvec4)
+          24(v1):     23(ptr) Variable Private
+          28(v2):     23(ptr) Variable Private
+              44:             TypePointer Private 6(float)
+      45(N2::gf):     44(ptr) Variable Private
+              51:             TypePointer Output 7(fvec4)
+52(@entryPointOutput):     51(ptr) Variable Output
+         4(main):           2 Function None 3
+               5:             Label
+              53:    7(fvec4) FunctionCall 21(@main()
+                              Store 52(@entryPointOutput) 53
+                              Return
+                              FunctionEnd
+  9(N1::getVec():    7(fvec4) Function None 8
+              10:             Label
+              25:    7(fvec4) Load 24(v1)
+                              ReturnValue 25
+                              FunctionEnd
+ 11(N2::getVec():    7(fvec4) Function None 8
+              12:             Label
+              29:    7(fvec4) Load 28(v2)
+                              ReturnValue 29
+                              FunctionEnd
+13(N2::N3::getVec():    7(fvec4) Function None 8
+              14:             Label
+              32:    7(fvec4) Load 28(v2)
+                              ReturnValue 32
+                              FunctionEnd
+19(N2::N3::C1::getVec():    7(fvec4) Function None 17
+       18(@this):     16(ptr) FunctionParameter
+              20:             Label
+              35:    7(fvec4) Load 28(v2)
+                              ReturnValue 35
+                              FunctionEnd
+      21(@main():    7(fvec4) Function None 8
+              22:             Label
+              38:    7(fvec4) FunctionCall 9(N1::getVec()
+              39:    7(fvec4) FunctionCall 11(N2::getVec()
+              40:    7(fvec4) FAdd 38 39
+              41:    7(fvec4) FunctionCall 13(N2::N3::getVec()
+              42:    7(fvec4) FAdd 40 41
+              43:    7(fvec4) FunctionCall 19(N2::N3::C1::getVec()
+              46:    6(float) Load 45(N2::gf)
+              47:    7(fvec4) VectorTimesScalar 43 46
+              48:    7(fvec4) FAdd 42 47
+                              ReturnValue 48
+                              FunctionEnd

+ 111 - 0
3rdparty/glslang/Test/baseResults/hlsl.scalar-length.frag.out

@@ -0,0 +1,111 @@
+hlsl.scalar-length.frag
+Shader version: 450
+gl_FragCoord origin is upper left
+0:? Sequence
+0:2  Function Definition: @main( ( temp 4-component vector of float)
+0:2    Function Parameters: 
+0:?     Sequence
+0:3      Sequence
+0:3        move second child to first child ( temp 4-component vector of float)
+0:3          'test' ( temp 4-component vector of float)
+0:3          Constant:
+0:3            0.000000
+0:3            1.000000
+0:3            2.000000
+0:3            3.000000
+0:5      Branch: Return with expression
+0:5        Construct vec4 ( temp 4-component vector of float)
+0:5          length ( temp float)
+0:5            direct index ( temp float)
+0:5              'test' ( temp 4-component vector of float)
+0:5              Constant:
+0:5                3 (const int)
+0:2  Function Definition: main( ( temp void)
+0:2    Function Parameters: 
+0:?     Sequence
+0:2      move second child to first child ( temp 4-component vector of float)
+0:?         '@entryPointOutput' (layout( location=0) out 4-component vector of float)
+0:2        Function Call: @main( ( temp 4-component vector of float)
+0:?   Linker Objects
+0:?     '@entryPointOutput' (layout( location=0) out 4-component vector of float)
+
+
+Linked fragment stage:
+
+
+Shader version: 450
+gl_FragCoord origin is upper left
+0:? Sequence
+0:2  Function Definition: @main( ( temp 4-component vector of float)
+0:2    Function Parameters: 
+0:?     Sequence
+0:3      Sequence
+0:3        move second child to first child ( temp 4-component vector of float)
+0:3          'test' ( temp 4-component vector of float)
+0:3          Constant:
+0:3            0.000000
+0:3            1.000000
+0:3            2.000000
+0:3            3.000000
+0:5      Branch: Return with expression
+0:5        Construct vec4 ( temp 4-component vector of float)
+0:5          length ( temp float)
+0:5            direct index ( temp float)
+0:5              'test' ( temp 4-component vector of float)
+0:5              Constant:
+0:5                3 (const int)
+0:2  Function Definition: main( ( temp void)
+0:2    Function Parameters: 
+0:?     Sequence
+0:2      move second child to first child ( temp 4-component vector of float)
+0:?         '@entryPointOutput' (layout( location=0) out 4-component vector of float)
+0:2        Function Call: @main( ( temp 4-component vector of float)
+0:?   Linker Objects
+0:?     '@entryPointOutput' (layout( location=0) out 4-component vector of float)
+
+// Module Version 10000
+// Generated by (magic number): 80001
+// Id's are bound by 30
+
+                              Capability Shader
+               1:             ExtInstImport  "GLSL.std.450"
+                              MemoryModel Logical GLSL450
+                              EntryPoint Fragment 4  "main" 28
+                              ExecutionMode 4 OriginUpperLeft
+                              Name 4  "main"
+                              Name 9  "@main("
+                              Name 12  "test"
+                              Name 28  "@entryPointOutput"
+                              Decorate 28(@entryPointOutput) Location 0
+               2:             TypeVoid
+               3:             TypeFunction 2
+               6:             TypeFloat 32
+               7:             TypeVector 6(float) 4
+               8:             TypeFunction 7(fvec4)
+              11:             TypePointer Function 7(fvec4)
+              13:    6(float) Constant 0
+              14:    6(float) Constant 1065353216
+              15:    6(float) Constant 1073741824
+              16:    6(float) Constant 1077936128
+              17:    7(fvec4) ConstantComposite 13 14 15 16
+              18:             TypeInt 32 0
+              19:     18(int) Constant 3
+              20:             TypePointer Function 6(float)
+              27:             TypePointer Output 7(fvec4)
+28(@entryPointOutput):     27(ptr) Variable Output
+         4(main):           2 Function None 3
+               5:             Label
+              29:    7(fvec4) FunctionCall 9(@main()
+                              Store 28(@entryPointOutput) 29
+                              Return
+                              FunctionEnd
+       9(@main():    7(fvec4) Function None 8
+              10:             Label
+        12(test):     11(ptr) Variable Function
+                              Store 12(test) 17
+              21:     20(ptr) AccessChain 12(test) 19
+              22:    6(float) Load 21
+              23:    6(float) ExtInst 1(GLSL.std.450) 66(Length) 22
+              24:    7(fvec4) CompositeConstruct 23 23 23 23
+                              ReturnValue 24
+                              FunctionEnd

+ 7 - 5
3rdparty/glslang/Test/baseResults/spv.bool.vert.out

@@ -3,7 +3,7 @@ Warning, version 450 is not yet complete; most version-specific features are pre
 
 
 // Module Version 10000
 // Module Version 10000
 // Generated by (magic number): 80001
 // Generated by (magic number): 80001
-// Id's are bound by 44
+// Id's are bound by 46
 
 
                               Capability Shader
                               Capability Shader
                1:             ExtInstImport  "GLSL.std.450"
                1:             ExtInstImport  "GLSL.std.450"
@@ -56,7 +56,8 @@ Warning, version 450 is not yet complete; most version-specific features are pre
               38:   18(fvec4) ConstantComposite 37 37 37 37
               38:   18(fvec4) ConstantComposite 37 37 37 37
               39:   17(float) Constant 1065353216
               39:   17(float) Constant 1065353216
               40:   18(fvec4) ConstantComposite 39 39 39 39
               40:   18(fvec4) ConstantComposite 39 39 39 39
-              42:             TypePointer Output 18(fvec4)
+              41:             TypeVector 6(bool) 4
+              44:             TypePointer Output 18(fvec4)
          4(main):           2 Function None 3
          4(main):           2 Function None 3
                5:             Label
                5:             Label
        30(param):      7(ptr) Variable Function
        30(param):      7(ptr) Variable Function
@@ -65,9 +66,10 @@ Warning, version 450 is not yet complete; most version-specific features are pre
               35:     6(bool) INotEqual 33 34
               35:     6(bool) INotEqual 33 34
                               Store 30(param) 35
                               Store 30(param) 35
               36:     6(bool) FunctionCall 10(foo(b1;) 30(param)
               36:     6(bool) FunctionCall 10(foo(b1;) 30(param)
-              41:   18(fvec4) Select 36 38 40
-              43:     42(ptr) AccessChain 24 26
-                              Store 43 41
+              42:   41(bvec4) CompositeConstruct 36 36 36 36
+              43:   18(fvec4) Select 42 38 40
+              45:     44(ptr) AccessChain 24 26
+                              Store 45 43
                               Return
                               Return
                               FunctionEnd
                               FunctionEnd
      10(foo(b1;):     6(bool) Function None 8
      10(foo(b1;):     6(bool) Function None 8

+ 40 - 38
3rdparty/glslang/Test/baseResults/spv.deepRvalue.frag.out

@@ -1,12 +1,12 @@
 spv.deepRvalue.frag
 spv.deepRvalue.frag
 // Module Version 10000
 // Module Version 10000
 // Generated by (magic number): 80001
 // Generated by (magic number): 80001
-// Id's are bound by 150
+// Id's are bound by 152
 
 
                               Capability Shader
                               Capability Shader
                1:             ExtInstImport  "GLSL.std.450"
                1:             ExtInstImport  "GLSL.std.450"
                               MemoryModel Logical GLSL450
                               MemoryModel Logical GLSL450
-                              EntryPoint Fragment 4  "main" 144
+                              EntryPoint Fragment 4  "main" 146
                               ExecutionMode 4 OriginUpperLeft
                               ExecutionMode 4 OriginUpperLeft
                               Source GLSL 330
                               Source GLSL 330
                               Name 4  "main"
                               Name 4  "main"
@@ -21,12 +21,12 @@ spv.deepRvalue.frag
                               Name 106  "h"
                               Name 106  "h"
                               Name 107  "i"
                               Name 107  "i"
                               Name 111  "samp2D"
                               Name 111  "samp2D"
-                              Name 129  "str"
-                              MemberName 129(str) 0  "a"
-                              MemberName 129(str) 1  "b"
-                              MemberName 129(str) 2  "c"
-                              Name 131  "t"
-                              Name 144  "gl_FragColor"
+                              Name 131  "str"
+                              MemberName 131(str) 0  "a"
+                              MemberName 131(str) 1  "b"
+                              MemberName 131(str) 2  "c"
+                              Name 133  "t"
+                              Name 146  "gl_FragColor"
                               Decorate 111(samp2D) DescriptorSet 0
                               Decorate 111(samp2D) DescriptorSet 0
                2:             TypeVoid
                2:             TypeVoid
                3:             TypeFunction 2
                3:             TypeFunction 2
@@ -77,19 +77,20 @@ spv.deepRvalue.frag
              115:  113(fvec2) ConstantComposite 114 114
              115:  113(fvec2) ConstantComposite 114 114
              119:    6(float) Constant 1036831949
              119:    6(float) Constant 1036831949
              120:             TypeBool
              120:             TypeBool
-             128:             TypeArray 113(fvec2) 84
-        129(str):             TypeStruct 81(int) 128 120(bool)
-             130:             TypePointer Function 129(str)
-             132:  113(fvec2) ConstantComposite 10 11
-             133:    6(float) Constant 1082130432
-             134:  113(fvec2) ConstantComposite 133 12
-             135:    6(float) Constant 1086324736
-             136:  113(fvec2) ConstantComposite 135 13
-             137:         128 ConstantComposite 132 134 136
-             138:   120(bool) ConstantTrue
-             139:    129(str) ConstantComposite 82 137 138
-             143:             TypePointer Output 7(fvec4)
-144(gl_FragColor):    143(ptr) Variable Output
+             124:             TypeVector 120(bool) 4
+             130:             TypeArray 113(fvec2) 84
+        131(str):             TypeStruct 81(int) 130 120(bool)
+             132:             TypePointer Function 131(str)
+             134:  113(fvec2) ConstantComposite 10 11
+             135:    6(float) Constant 1082130432
+             136:  113(fvec2) ConstantComposite 135 12
+             137:    6(float) Constant 1086324736
+             138:  113(fvec2) ConstantComposite 137 13
+             139:         130 ConstantComposite 134 136 138
+             140:   120(bool) ConstantTrue
+             141:    131(str) ConstantComposite 82 139 140
+             145:             TypePointer Output 7(fvec4)
+146(gl_FragColor):    145(ptr) Variable Output
          4(main):           2 Function None 3
          4(main):           2 Function None 3
                5:             Label
                5:             Label
            35(m):     34(ptr) Variable Function
            35(m):     34(ptr) Variable Function
@@ -98,7 +99,7 @@ spv.deepRvalue.frag
            87(g):     79(ptr) Variable Function
            87(g):     79(ptr) Variable Function
           106(h):     79(ptr) Variable Function
           106(h):     79(ptr) Variable Function
           107(i):     79(ptr) Variable Function
           107(i):     79(ptr) Variable Function
-          131(t):    130(ptr) Variable Function
+          133(t):    132(ptr) Variable Function
                               Store 9(v1) 14
                               Store 9(v1) 14
                               Store 15(v2) 20
                               Store 15(v2) 20
                               Store 21(v3) 26
                               Store 21(v3) 26
@@ -174,21 +175,22 @@ spv.deepRvalue.frag
              121:   120(bool) FOrdGreaterThan 118 119
              121:   120(bool) FOrdGreaterThan 118 119
              122:    7(fvec4) Load 9(v1)
              122:    7(fvec4) Load 9(v1)
              123:    7(fvec4) Load 15(v2)
              123:    7(fvec4) Load 15(v2)
-             124:    7(fvec4) Select 121 122 123
-             125:    6(float) CompositeExtract 124 3
-             126:    6(float) Load 107(i)
-             127:    6(float) FAdd 126 125
-                              Store 107(i) 127
-                              Store 131(t) 139
-             140:    6(float) CompositeExtract 139 1 2 1
-             141:    6(float) Load 107(i)
-             142:    6(float) FAdd 141 140
-                              Store 107(i) 142
-             145:    6(float) Load 80(f)
-             146:    6(float) Load 87(g)
-             147:    6(float) Load 106(h)
-             148:    6(float) Load 107(i)
-             149:    7(fvec4) CompositeConstruct 145 146 147 148
-                              Store 144(gl_FragColor) 149
+             125:  124(bvec4) CompositeConstruct 121 121 121 121
+             126:    7(fvec4) Select 125 122 123
+             127:    6(float) CompositeExtract 126 3
+             128:    6(float) Load 107(i)
+             129:    6(float) FAdd 128 127
+                              Store 107(i) 129
+                              Store 133(t) 141
+             142:    6(float) CompositeExtract 141 1 2 1
+             143:    6(float) Load 107(i)
+             144:    6(float) FAdd 143 142
+                              Store 107(i) 144
+             147:    6(float) Load 80(f)
+             148:    6(float) Load 87(g)
+             149:    6(float) Load 106(h)
+             150:    6(float) Load 107(i)
+             151:    7(fvec4) CompositeConstruct 147 148 149 150
+                              Store 146(gl_FragColor) 151
                               Return
                               Return
                               FunctionEnd
                               FunctionEnd

+ 11 - 9
3rdparty/glslang/Test/baseResults/spv.image.frag.out

@@ -3,7 +3,7 @@ Warning, version 450 is not yet complete; most version-specific features are pre
 
 
 // Module Version 10000
 // Module Version 10000
 // Generated by (magic number): 80001
 // Generated by (magic number): 80001
-// Id's are bound by 374
+// Id's are bound by 376
 
 
                               Capability Shader
                               Capability Shader
                               Capability SampledRect
                               Capability SampledRect
@@ -16,7 +16,7 @@ Warning, version 450 is not yet complete; most version-specific features are pre
                               Capability StorageImageWriteWithoutFormat
                               Capability StorageImageWriteWithoutFormat
                1:             ExtInstImport  "GLSL.std.450"
                1:             ExtInstImport  "GLSL.std.450"
                               MemoryModel Logical GLSL450
                               MemoryModel Logical GLSL450
-                              EntryPoint Fragment 4  "main" 132 142 152 248 362 373
+                              EntryPoint Fragment 4  "main" 132 142 152 248 362 375
                               ExecutionMode 4 OriginUpperLeft
                               ExecutionMode 4 OriginUpperLeft
                               Source GLSL 450
                               Source GLSL 450
                               Name 4  "main"
                               Name 4  "main"
@@ -42,7 +42,7 @@ Warning, version 450 is not yet complete; most version-specific features are pre
                               Name 248  "value"
                               Name 248  "value"
                               Name 357  "wo2D"
                               Name 357  "wo2D"
                               Name 362  "fragData"
                               Name 362  "fragData"
-                              Name 373  "ic4D"
+                              Name 375  "ic4D"
                               Decorate 15(i1D) DescriptorSet 0
                               Decorate 15(i1D) DescriptorSet 0
                               Decorate 15(i1D) Binding 0
                               Decorate 15(i1D) Binding 0
                               Decorate 27(i2D) DescriptorSet 0
                               Decorate 27(i2D) DescriptorSet 0
@@ -76,7 +76,7 @@ Warning, version 450 is not yet complete; most version-specific features are pre
                               Decorate 357(wo2D) DescriptorSet 0
                               Decorate 357(wo2D) DescriptorSet 0
                               Decorate 357(wo2D) Binding 1
                               Decorate 357(wo2D) Binding 1
                               Decorate 357(wo2D) NonReadable
                               Decorate 357(wo2D) NonReadable
-                              Decorate 373(ic4D) Flat
+                              Decorate 375(ic4D) Flat
                2:             TypeVoid
                2:             TypeVoid
                3:             TypeFunction 2
                3:             TypeFunction 2
                6:             TypeInt 32 1
                6:             TypeInt 32 1
@@ -164,9 +164,10 @@ Warning, version 450 is not yet complete; most version-specific features are pre
              361:             TypePointer Output 125(fvec4)
              361:             TypePointer Output 125(fvec4)
    362(fragData):    361(ptr) Variable Output
    362(fragData):    361(ptr) Variable Output
              367:             TypeBool
              367:             TypeBool
-             371:             TypeVector 6(int) 4
-             372:             TypePointer Input 371(ivec4)
-       373(ic4D):    372(ptr) Variable Input
+             370:             TypeVector 367(bool) 4
+             373:             TypeVector 6(int) 4
+             374:             TypePointer Input 373(ivec4)
+       375(ic4D):    374(ptr) Variable Input
          4(main):           2 Function None 3
          4(main):           2 Function None 3
                5:             Label
                5:             Label
            9(iv):      8(ptr) Variable Function
            9(iv):      8(ptr) Variable Function
@@ -503,7 +504,8 @@ Warning, version 450 is not yet complete; most version-specific features are pre
              366:     18(int) Bitcast 365
              366:     18(int) Bitcast 365
              368:   367(bool) INotEqual 363 366
              368:   367(bool) INotEqual 363 366
              369:  125(fvec4) Load 127(v)
              369:  125(fvec4) Load 127(v)
-             370:  125(fvec4) Select 368 369 129
-                              Store 362(fragData) 370
+             371:  370(bvec4) CompositeConstruct 368 368 368 368
+             372:  125(fvec4) Select 371 369 129
+                              Store 362(fragData) 372
                               Return
                               Return
                               FunctionEnd
                               FunctionEnd

+ 4 - 2
3rdparty/glslang/Test/baseResults/spv.specConstantOperations.vert.out

@@ -3,7 +3,7 @@ Warning, version 450 is not yet complete; most version-specific features are pre
 
 
 // Module Version 10000
 // Module Version 10000
 // Generated by (magic number): 80001
 // Generated by (magic number): 80001
-// Id's are bound by 160
+// Id's are bound by 162
 
 
                               Capability Shader
                               Capability Shader
                               Capability Float64
                               Capability Float64
@@ -168,7 +168,9 @@ Warning, version 450 is not yet complete; most version-specific features are pre
              156:  154(fvec2) ConstantComposite 155 155
              156:  154(fvec2) ConstantComposite 155 155
              157:   39(float) Constant 1073741824
              157:   39(float) Constant 1073741824
              158:  154(fvec2) ConstantComposite 157 157
              158:  154(fvec2) ConstantComposite 157 157
-             159:  154(fvec2) SpecConstantOp 169 153 156 158
+             159:             TypeVector 22(bool) 2
+             160:  159(bvec2) SpecConstantComposite 153 153
+             161:  154(fvec2) SpecConstantOp 169 160 156 158
          4(main):           2 Function None 3
          4(main):           2 Function None 3
                5:             Label
                5:             Label
                               Return
                               Return

+ 12 - 0
3rdparty/glslang/Test/hlsl.clip.frag

@@ -0,0 +1,12 @@
+
+float GetEntitySelectClip()
+{
+    return 1.0f;
+}
+
+float4 main() : SV_TARGET
+{
+    clip(GetEntitySelectClip());
+
+    return 0;
+}

+ 32 - 0
3rdparty/glslang/Test/hlsl.domain.1.tese

@@ -0,0 +1,32 @@
+
+struct ds_in_t 
+{ 
+    float4 pos  : POSITION; 
+    float3 norm : TEXCOORD0; 
+}; 
+
+struct pcf_in_t 
+{ 
+    float flTessFactor [3]   : SV_TessFactor; 
+    float flInsideTessFactor : SV_InsideTessFactor; 
+}; 
+
+struct gs_in_t 
+{ 
+    float4 pos  : POSITION; 
+    float3 norm : TEXCOORD0; 
+}; 
+
+[domain ( "tri" )] 
+gs_in_t main (const OutputPatch <ds_in_t, 3> i, float3 tesscoord : SV_DomainLocation, pcf_in_t pcf_data ) 
+{ 
+    gs_in_t o; 
+
+    o.pos  = i[0].pos + tesscoord.x;
+    o.norm = i[0].norm + tesscoord.y;
+
+    tesscoord.z;
+    
+    return o; 
+}
+

+ 43 - 0
3rdparty/glslang/Test/hlsl.hull.ctrlpt-1.tesc

@@ -0,0 +1,43 @@
+// *** 
+// per-control-point invocation of PCF from entry point return value
+// ***
+
+struct hs_in_t
+{
+    float3 val : TEXCOORD0;
+};
+
+struct hs_pcf_t
+{
+    float tfactor[3] : SV_TessFactor; // must turn into a size 4 array in SPIR-V
+    float flInFactor : SV_InsideTessFactor; // must turn into a size 2 array in SPIR-V
+}; 
+
+struct hs_out_t
+{
+    float3 val : TEXCOORD0; 
+};
+
+[ domain ("tri") ]
+[ partitioning ("fractional_odd") ]
+[ outputtopology ("triangle_cw") ]
+[ outputcontrolpoints (3) ]
+[ patchconstantfunc ( "PCF" ) ]
+hs_out_t main (InputPatch <hs_in_t, 3> i , uint cpid : SV_OutputControlPointID)
+{
+    hs_out_t o;
+    o.val = cpid;
+    return o;
+}
+
+hs_pcf_t PCF( const OutputPatch <hs_out_t, 3> pcf_out)
+{
+    hs_pcf_t o;
+
+    o.tfactor[0] = pcf_out[0].val.x;
+    o.tfactor[1] = pcf_out[1].val.x;
+    o.tfactor[2] = pcf_out[2].val.x;
+    o.flInFactor = 4;
+
+    return o;
+}

+ 32 - 0
3rdparty/glslang/Test/hlsl.implicitBool.frag

@@ -0,0 +1,32 @@
+float condf;
+int condi;
+float1 condf1;
+int1 condi1;
+
+float4 main() : SV_Target0
+{
+    float4 a = float4(2.0, 2.0, 2.0, 2.0);
+    if (condi)
+        return a + 1.0;
+    if (condf)
+        return a + 2.0;
+    if (condf1)
+        return a + 3.0;
+    if (condi1)
+        return a + 4.0;
+    if (condi && condf || condf1)
+        return a + 5.0;
+
+    float f = condf;
+    while (f) { --f; }
+
+    int i = condi;
+    do { --i; } while (i);
+
+    for (; i; ) { --i; }
+
+    float g = condf ? 7.0 : 8.0;
+    a += g;
+
+    return a - 1.0;
+}

+ 37 - 0
3rdparty/glslang/Test/hlsl.intrinsic.frexp.frag

@@ -0,0 +1,37 @@
+
+float PixelShaderFunctionS(float inF0, float inF1)
+{
+    float r000 = frexp(inF0, inF1);
+    return 0.0;
+}
+
+float2 PixelShaderFunction2(float2 inF0, float2 inF1)
+{
+    float2 r000 = frexp(inF0, inF1);
+    return float2(1,2);
+}
+
+float3 PixelShaderFunction3(float3 inF0, float3 inF1)
+{
+    float3 r000 = frexp(inF0, inF1);
+    return float3(1,2,3);
+}
+
+float4 PixelShaderFunction(float4 inF0, float4 inF1)
+{
+    float4 r000 = frexp(inF0, inF1);
+    return float4(1,2,3,4);
+}
+
+// TODO: FXC doesn't accept this with (), but glslang doesn't accept it without.
+#define MATFNS(MT)                          \
+    MT r000 = frexp(inF0, inF1);
+
+struct PS_OUTPUT { float4 color : SV_Target0; };
+
+PS_OUTPUT main()
+{
+    PS_OUTPUT ps_output;
+    ps_output.color = 1.0;
+    return ps_output;
+};

+ 28 - 0
3rdparty/glslang/Test/hlsl.intrinsic.frexp.vert

@@ -0,0 +1,28 @@
+float VertexShaderFunctionS(float inF0, float inF1)
+{
+    frexp(inF0, inF1);
+    return 0.0;
+}
+
+float2 VertexShaderFunction2(float2 inF0, float2 inF1)
+{
+    frexp(inF0, inF1);
+    return float2(1,2);
+}
+
+float3 VertexShaderFunction3(float3 inF0, float3 inF1)
+{
+    frexp(inF0, inF1);
+    return float3(1,2,3);
+}
+
+float4 VertexShaderFunction4(float4 inF0, float4 inF1)
+{
+    frexp(inF0, inF1);
+    return float4(1,2,3,4);
+}
+
+// TODO: FXC doesn't accept this with (), but glslang doesn't accept it without.
+#define MATFNS() \
+    frexp(inF0, inF1);
+

+ 0 - 5
3rdparty/glslang/Test/hlsl.intrinsics.frag

@@ -52,7 +52,6 @@ float PixelShaderFunctionS(float inF0, float inF1, float inF2, uint inU0, uint i
     // TODO: fma(inD0, inD1, inD2);
     // TODO: fma(inD0, inD1, inD2);
     float r033 = fmod(inF0, inF1);
     float r033 = fmod(inF0, inF1);
     float r034 = frac(inF0);
     float r034 = frac(inF0);
-    float r035 = frexp(inF0, inF1);
     float r036 = fwidth(inF0);
     float r036 = fwidth(inF0);
     bool r037 = isinf(inF0);
     bool r037 = isinf(inF0);
     bool r038 = isnan(inF0);
     bool r038 = isnan(inF0);
@@ -136,7 +135,6 @@ float2 PixelShaderFunction2(float2 inF0, float2 inF1, float2 inF2, uint2 inU0, u
     // TODO: fma(inD0, inD1, inD2);
     // TODO: fma(inD0, inD1, inD2);
     float2 r035 = fmod(inF0, inF1);
     float2 r035 = fmod(inF0, inF1);
     float2 r036 = frac(inF0);
     float2 r036 = frac(inF0);
-    float2 r037 = frexp(inF0, inF1);
     float2 r038 = fwidth(inF0);
     float2 r038 = fwidth(inF0);
     bool2 r039 = isinf(inF0);
     bool2 r039 = isinf(inF0);
     bool2 r040 = isnan(inF0);
     bool2 r040 = isnan(inF0);
@@ -217,7 +215,6 @@ float3 PixelShaderFunction3(float3 inF0, float3 inF1, float3 inF2, uint3 inU0, u
     // TODO: fma(inD0, inD1, inD2);
     // TODO: fma(inD0, inD1, inD2);
     float3 r036 = fmod(inF0, inF1);
     float3 r036 = fmod(inF0, inF1);
     float3 r037 = frac(inF0);
     float3 r037 = frac(inF0);
-    float3 r038 = frexp(inF0, inF1);
     float3 r039 = fwidth(inF0);
     float3 r039 = fwidth(inF0);
     bool3 r040 = isinf(inF0);
     bool3 r040 = isinf(inF0);
     bool3 r041 = isnan(inF0);
     bool3 r041 = isnan(inF0);
@@ -299,7 +296,6 @@ float4 PixelShaderFunction(float4 inF0, float4 inF1, float4 inF2, uint4 inU0, ui
     // TODO: fma(inD0, inD1, inD2);
     // TODO: fma(inD0, inD1, inD2);
     float4 r036 = fmod(inF0, inF1);
     float4 r036 = fmod(inF0, inF1);
     float4 r037 = frac(inF0);
     float4 r037 = frac(inF0);
-    float4 r038 = frexp(inF0, inF1);
     float4 r039 = fwidth(inF0);
     float4 r039 = fwidth(inF0);
     bool4 r040 = isinf(inF0);
     bool4 r040 = isinf(inF0);
     bool4 r041 = isnan(inF0);
     bool4 r041 = isnan(inF0);
@@ -369,7 +365,6 @@ float4 PixelShaderFunction(float4 inF0, float4 inF1, float4 inF2, uint4 inU0, ui
     MT r021 = floor(inF0);                  \
     MT r021 = floor(inF0);                  \
     MT r022 = fmod(inF0, inF1);             \
     MT r022 = fmod(inF0, inF1);             \
     MT r023 = frac(inF0);                   \
     MT r023 = frac(inF0);                   \
-    MT r024 = frexp(inF0, inF1);            \
     MT r025 = fwidth(inF0);                 \
     MT r025 = fwidth(inF0);                 \
     MT r026 = ldexp(inF0, inF1);            \
     MT r026 = ldexp(inF0, inF1);            \
     MT r026a = lerp(inF0, inF1, inF2);      \
     MT r026a = lerp(inF0, inF1, inF2);      \

+ 0 - 5
3rdparty/glslang/Test/hlsl.intrinsics.vert

@@ -28,7 +28,6 @@ float VertexShaderFunctionS(float inF0, float inF1, float inF2, uint inU0, uint
     // TODO: fma(inD0, inD1, inD2);
     // TODO: fma(inD0, inD1, inD2);
     fmod(inF0, inF1);
     fmod(inF0, inF1);
     frac(inF0);
     frac(inF0);
-    frexp(inF0, inF1);
     isinf(inF0);
     isinf(inF0);
     isnan(inF0);
     isnan(inF0);
     ldexp(inF0, inF1);
     ldexp(inF0, inF1);
@@ -99,7 +98,6 @@ float2 VertexShaderFunction2(float2 inF0, float2 inF1, float2 inF2, uint2 inU0,
     // TODO: fma(inD0, inD1, inD2);
     // TODO: fma(inD0, inD1, inD2);
     fmod(inF0, inF1);
     fmod(inF0, inF1);
     frac(inF0);
     frac(inF0);
-    frexp(inF0, inF1);
     isinf(inF0);
     isinf(inF0);
     isnan(inF0);
     isnan(inF0);
     ldexp(inF0, inF1);
     ldexp(inF0, inF1);
@@ -170,7 +168,6 @@ float3 VertexShaderFunction3(float3 inF0, float3 inF1, float3 inF2, uint3 inU0,
     // TODO: fma(inD0, inD1, inD2);
     // TODO: fma(inD0, inD1, inD2);
     fmod(inF0, inF1);
     fmod(inF0, inF1);
     frac(inF0);
     frac(inF0);
-    frexp(inF0, inF1);
     isinf(inF0);
     isinf(inF0);
     isnan(inF0);
     isnan(inF0);
     ldexp(inF0, inF1);
     ldexp(inF0, inF1);
@@ -241,7 +238,6 @@ float4 VertexShaderFunction4(float4 inF0, float4 inF1, float4 inF2, uint4 inU0,
     // TODO: fma(inD0, inD1, inD2);
     // TODO: fma(inD0, inD1, inD2);
     fmod(inF0, inF1);
     fmod(inF0, inF1);
     frac(inF0);
     frac(inF0);
-    frexp(inF0, inF1);
     isinf(inF0);
     isinf(inF0);
     isnan(inF0);
     isnan(inF0);
     ldexp(inF0, inF1);
     ldexp(inF0, inF1);
@@ -305,7 +301,6 @@ float4 VertexShaderFunction4(float4 inF0, float4 inF1, float4 inF2, uint4 inU0,
     floor(inF0); \
     floor(inF0); \
     fmod(inF0, inF1); \
     fmod(inF0, inF1); \
     frac(inF0); \
     frac(inF0); \
-    frexp(inF0, inF1); \
     ldexp(inF0, inF1); \
     ldexp(inF0, inF1); \
     lerp(inF0, inF1, inF2); \
     lerp(inF0, inF1, inF2); \
     log(inF0); \
     log(inF0); \

+ 15 - 0
3rdparty/glslang/Test/hlsl.logicalConvert.frag

@@ -0,0 +1,15 @@
+float4 main() : SV_TARGET
+{
+	if (!(0) && (0) || (!1))
+	    return 0.0.xxxx; 
+	if (0)
+	    return 0.0.xxxx; 
+	if (!(bool)0)
+		return 0.0.xxxx;
+	if (!0)
+		return 0.0.xxxx;
+	if (!(bool)1)
+		return 0.0.xxxx;
+	if (!1)
+		return 0.0.xxxx;
+}

+ 23 - 0
3rdparty/glslang/Test/hlsl.namespace.frag

@@ -0,0 +1,23 @@
+static float4 v1;
+static float4 v2;
+
+namespace N1 {
+    float4 getVec() { return v1; }
+}
+
+namespace N2 {
+    static float gf;
+    float4 getVec() { return v2; }
+    namespace N3 {
+        float4 getVec() { return v2; }
+        
+        class C1 {
+            float4 getVec() { return v2; }
+        };
+    }
+}
+
+float4 main() : SV_Target0
+{
+    return N1::getVec() + N2::getVec() + N2::N3::getVec() + N2::N3::C1::getVec() * N2::gf;
+}

+ 6 - 0
3rdparty/glslang/Test/hlsl.scalar-length.frag

@@ -0,0 +1,6 @@
+float4 main() : SV_Target0
+{
+    float4 test = { 0, 1, 2, 3 };
+
+    return length(test.a);
+}

+ 2 - 2
3rdparty/glslang/glslang/Include/revision.h

@@ -2,5 +2,5 @@
 // For the version, it uses the latest git tag followed by the number of commits.
 // For the version, it uses the latest git tag followed by the number of commits.
 // For the date, it uses the current date (when then script is run).
 // For the date, it uses the current date (when then script is run).
 
 
-#define GLSLANG_REVISION "Overload400-PrecQual.1937"
-#define GLSLANG_DATE "24-Mar-2017"
+#define GLSLANG_REVISION "Overload400-PrecQual.1958"
+#define GLSLANG_DATE "31-Mar-2017"

+ 3 - 3
3rdparty/glslang/glslang/MachineIndependent/Intermediate.cpp

@@ -356,12 +356,12 @@ TIntermTyped* TIntermediate::addUnaryMath(TOperator op, TIntermTyped* child, TSo
     node->updatePrecision();
     node->updatePrecision();
 
 
     // If it's a (non-specialization) constant, it must be folded.
     // If it's a (non-specialization) constant, it must be folded.
-    if (child->getAsConstantUnion())
-        return child->getAsConstantUnion()->fold(op, node->getType());
+    if (node->getOperand()->getAsConstantUnion())
+        return node->getOperand()->getAsConstantUnion()->fold(op, node->getType());
 
 
     // If it's a specialization constant, the result is too,
     // If it's a specialization constant, the result is too,
     // if the operation is allowed for specialization constants.
     // if the operation is allowed for specialization constants.
-    if (child->getType().getQualifier().isSpecConstant() && isSpecializationOperation(*node))
+    if (node->getOperand()->getType().getQualifier().isSpecConstant() && isSpecializationOperation(*node))
         node->getWritableType().getQualifier().makeSpecConstant();
         node->getWritableType().getQualifier().makeSpecConstant();
 
 
     return node;
     return node;

+ 1 - 1
3rdparty/glslang/glslang/MachineIndependent/ParseContextBase.cpp

@@ -531,7 +531,7 @@ void TParseContextBase::parseSwizzleSelector(const TSourceLoc& loc, const TStrin
 // Make the passed-in variable information become a member of the
 // Make the passed-in variable information become a member of the
 // global uniform block.  If this doesn't exist yet, make it.
 // global uniform block.  If this doesn't exist yet, make it.
 //
 //
-void TParseContextBase::growGlobalUniformBlock(TSourceLoc& loc, TType& memberType, TString& memberName, TTypeList* typeList)
+void TParseContextBase::growGlobalUniformBlock(const TSourceLoc& loc, TType& memberType, const TString& memberName, TTypeList* typeList)
 {
 {
     // Make the global block, if not yet made.
     // Make the global block, if not yet made.
     if (globalUniformBlock == nullptr) {
     if (globalUniformBlock == nullptr) {

+ 3 - 3
3rdparty/glslang/glslang/MachineIndependent/ParseHelper.cpp

@@ -2990,7 +2990,7 @@ void TParseContext::arrayDimMerge(TType& type, const TArraySizes* sizes)
 // Do all the semantic checking for declaring or redeclaring an array, with and
 // Do all the semantic checking for declaring or redeclaring an array, with and
 // without a size, and make the right changes to the symbol table.
 // without a size, and make the right changes to the symbol table.
 //
 //
-void TParseContext::declareArray(const TSourceLoc& loc, TString& identifier, const TType& type, TSymbol*& symbol)
+void TParseContext::declareArray(const TSourceLoc& loc, const TString& identifier, const TType& type, TSymbol*& symbol)
 {
 {
     if (symbol == nullptr) {
     if (symbol == nullptr) {
         bool currentScope;
         bool currentScope;
@@ -5053,7 +5053,7 @@ TVariable* TParseContext::makeInternalVariable(const char* name, const TType& ty
 //
 //
 // Return the successfully declared variable.
 // Return the successfully declared variable.
 //
 //
-TVariable* TParseContext::declareNonArray(const TSourceLoc& loc, TString& identifier, TType& type)
+TVariable* TParseContext::declareNonArray(const TSourceLoc& loc, const TString& identifier, const TType& type)
 {
 {
     // make a new variable
     // make a new variable
     TVariable* variable = new TVariable(&identifier, type);
     TVariable* variable = new TVariable(&identifier, type);
@@ -5770,7 +5770,7 @@ void TParseContext::blockStageIoCheck(const TSourceLoc& loc, const TQualifier& q
 }
 }
 
 
 // Do all block-declaration checking regarding its qualifiers.
 // Do all block-declaration checking regarding its qualifiers.
-void TParseContext::blockQualifierCheck(const TSourceLoc& loc, const TQualifier& qualifier, bool instanceName)
+void TParseContext::blockQualifierCheck(const TSourceLoc& loc, const TQualifier& qualifier, bool /*instanceName*/)
 {
 {
     // The 4.5 specification says:
     // The 4.5 specification says:
     //
     //

+ 4 - 4
3rdparty/glslang/glslang/MachineIndependent/ParseHelper.h

@@ -136,7 +136,7 @@ public:
     TSymbolTable& symbolTable;   // symbol table that goes with the current language, version, and profile
     TSymbolTable& symbolTable;   // symbol table that goes with the current language, version, and profile
 
 
     // Manage the global uniform block (default uniforms in GLSL, $Global in HLSL)
     // Manage the global uniform block (default uniforms in GLSL, $Global in HLSL)
-    virtual void growGlobalUniformBlock(TSourceLoc&, TType&, TString& memberName, TTypeList* typeList = nullptr);
+    virtual void growGlobalUniformBlock(const TSourceLoc&, TType&, const TString& memberName, TTypeList* typeList = nullptr);
 
 
     virtual bool lValueErrorCheck(const TSourceLoc&, const char* op, TIntermTyped*);
     virtual bool lValueErrorCheck(const TSourceLoc&, const char* op, TIntermTyped*);
     virtual void rValueErrorCheck(const TSourceLoc&, const char* op, TIntermTyped*);
     virtual void rValueErrorCheck(const TSourceLoc&, const char* op, TIntermTyped*);
@@ -174,7 +174,7 @@ protected:
     int firstNewMember;              // the index of the first member not yet inserted into the symbol table
     int firstNewMember;              // the index of the first member not yet inserted into the symbol table
     // override this to set the language-specific name
     // override this to set the language-specific name
     virtual const char* getGlobalUniformBlockName() const { return ""; }
     virtual const char* getGlobalUniformBlockName() const { return ""; }
-    virtual void setUniformBlockDefaults(TType& block) const { }
+    virtual void setUniformBlockDefaults(TType&) const { }
     virtual void finalizeGlobalUniformBlockLayout(TVariable&) { }
     virtual void finalizeGlobalUniformBlockLayout(TVariable&) { }
     virtual void outputMessage(const TSourceLoc&, const char* szReason, const char* szToken,
     virtual void outputMessage(const TSourceLoc&, const char* szReason, const char* szToken,
                                const char* szExtraInfoFormat, TPrefixType prefix,
                                const char* szExtraInfoFormat, TPrefixType prefix,
@@ -371,8 +371,8 @@ protected:
     void nonInitConstCheck(const TSourceLoc&, TString& identifier, TType& type);
     void nonInitConstCheck(const TSourceLoc&, TString& identifier, TType& type);
     void inheritGlobalDefaults(TQualifier& dst) const;
     void inheritGlobalDefaults(TQualifier& dst) const;
     TVariable* makeInternalVariable(const char* name, const TType&) const;
     TVariable* makeInternalVariable(const char* name, const TType&) const;
-    TVariable* declareNonArray(const TSourceLoc&, TString& identifier, TType&);
-    void declareArray(const TSourceLoc&, TString& identifier, const TType&, TSymbol*&);
+    TVariable* declareNonArray(const TSourceLoc&, const TString& identifier, const TType&);
+    void declareArray(const TSourceLoc&, const TString& identifier, const TType&, TSymbol*&);
     TIntermNode* executeInitializer(const TSourceLoc&, TIntermTyped* initializer, TVariable* variable);
     TIntermNode* executeInitializer(const TSourceLoc&, TIntermTyped* initializer, TVariable* variable);
     TIntermTyped* convertInitializerList(const TSourceLoc&, const TType&, TIntermTyped* initializer);
     TIntermTyped* convertInitializerList(const TSourceLoc&, const TType&, TIntermTyped* initializer);
     void finish() override;
     void finish() override;

+ 7 - 0
3rdparty/glslang/glslang/MachineIndependent/intermOut.cpp

@@ -884,6 +884,13 @@ void TIntermediate::output(TInfoSink& infoSink, bool tree)
 
 
     case EShLangTessControl:
     case EShLangTessControl:
         infoSink.debug << "vertices = " << vertices << "\n";
         infoSink.debug << "vertices = " << vertices << "\n";
+
+        if (inputPrimitive != ElgNone)
+            infoSink.debug << "input primitive = " << TQualifier::getGeometryString(inputPrimitive) << "\n";
+        if (vertexSpacing != EvsNone)
+            infoSink.debug << "vertex spacing = " << TQualifier::getVertexSpacingString(vertexSpacing) << "\n";
+        if (vertexOrder != EvoNone)
+            infoSink.debug << "triangle order = " << TQualifier::getVertexOrderString(vertexOrder) << "\n";
         break;
         break;
 
 
     case EShLangTessEvaluation:
     case EShLangTessEvaluation:

+ 4 - 4
3rdparty/glslang/glslang/MachineIndependent/iomapper.cpp

@@ -445,19 +445,19 @@ struct TDefaultIoResolver : public glslang::TIoMapResolver
         return 0;
         return 0;
     }
     }
 
 
-    bool validateInOut(EShLanguage stage, const char* name, const TType& type, bool is_live) override
+    bool validateInOut(EShLanguage /*stage*/, const char* /*name*/, const TType& /*type*/, bool /*is_live*/) override
     {
     {
         return true;
         return true;
     }
     }
-    int resolveInOutLocation(EShLanguage stage, const char* name, const TType& type, bool is_live) override
+    int resolveInOutLocation(EShLanguage /*stage*/, const char* /*name*/, const TType& /*type*/, bool /*is_live*/) override
     {
     {
         return -1;
         return -1;
     }
     }
-    int resolveInOutComponent(EShLanguage stage, const char* name, const TType& type, bool is_live) override
+    int resolveInOutComponent(EShLanguage /*stage*/, const char* /*name*/, const TType& /*type*/, bool /*is_live*/) override
     {
     {
         return -1;
         return -1;
     }
     }
-    int resolveInOutIndex(EShLanguage stage, const char* name, const TType& type, bool is_live) override
+    int resolveInOutIndex(EShLanguage /*stage*/, const char* /*name*/, const TType& /*type*/, bool /*is_live*/) override
     {
     {
         return -1;
         return -1;
     }
     }

+ 6 - 4
3rdparty/glslang/glslang/MachineIndependent/linkValidate.cpp

@@ -461,10 +461,12 @@ void TIntermediate::finalCheck(TInfoSink& infoSink, bool keepUncalled)
     case EShLangTessEvaluation:
     case EShLangTessEvaluation:
         if (inputPrimitive == ElgNone)
         if (inputPrimitive == ElgNone)
             error(infoSink, "At least one shader must specify an input layout primitive");
             error(infoSink, "At least one shader must specify an input layout primitive");
-        if (vertexSpacing == EvsNone)
-            vertexSpacing = EvsEqual;
-        if (vertexOrder == EvoNone)
-            vertexOrder = EvoCcw;
+        if (source == EShSourceGlsl) {
+            if (vertexSpacing == EvsNone)
+                vertexSpacing = EvsEqual;
+            if (vertexOrder == EvoNone)
+                vertexOrder = EvoCcw;
+        }
         break;
         break;
     case EShLangGeometry:
     case EShLangGeometry:
         if (inputPrimitive == ElgNone)
         if (inputPrimitive == ElgNone)

+ 10 - 1
3rdparty/glslang/gtests/Hlsl.FromFile.cpp

@@ -93,6 +93,7 @@ INSTANTIATE_TEST_CASE_P(
         {"hlsl.calculatelod.dx10.frag", "main"},
         {"hlsl.calculatelod.dx10.frag", "main"},
         {"hlsl.calculatelodunclamped.dx10.frag", "main"},
         {"hlsl.calculatelodunclamped.dx10.frag", "main"},
         {"hlsl.cast.frag", "PixelShaderFunction"},
         {"hlsl.cast.frag", "PixelShaderFunction"},
+        {"hlsl.clip.frag", "main"},
         {"hlsl.comparison.vec.frag", "main"},
         {"hlsl.comparison.vec.frag", "main"},
         {"hlsl.conditional.frag", "PixelShaderFunction"},
         {"hlsl.conditional.frag", "PixelShaderFunction"},
         {"hlsl.constructexpr.frag", "main"},
         {"hlsl.constructexpr.frag", "main"},
@@ -122,11 +123,14 @@ INSTANTIATE_TEST_CASE_P(
         {"hlsl.getdimensions.rw.dx10.frag", "main"},
         {"hlsl.getdimensions.rw.dx10.frag", "main"},
         {"hlsl.getdimensions.dx10.vert", "main"},
         {"hlsl.getdimensions.dx10.vert", "main"},
         {"hlsl.getsampleposition.dx10.frag", "main"},
         {"hlsl.getsampleposition.dx10.frag", "main"},
+        {"hlsl.domain.1.tese", "main"},
         {"hlsl.hull.1.tesc", "main"},
         {"hlsl.hull.1.tesc", "main"},
         {"hlsl.hull.2.tesc", "main"},
         {"hlsl.hull.2.tesc", "main"},
         {"hlsl.hull.void.tesc", "main"},
         {"hlsl.hull.void.tesc", "main"},
+        {"hlsl.hull.ctrlpt-1.tesc", "main"},
         {"hlsl.identifier.sample.frag", "main"},
         {"hlsl.identifier.sample.frag", "main"},
         {"hlsl.if.frag", "PixelShaderFunction"},
         {"hlsl.if.frag", "PixelShaderFunction"},
+        {"hlsl.implicitBool.frag", "main"},
         {"hlsl.inoutquals.frag", "main"},
         {"hlsl.inoutquals.frag", "main"},
         {"hlsl.init.frag", "ShaderFunction"},
         {"hlsl.init.frag", "ShaderFunction"},
         {"hlsl.init2.frag", "main"},
         {"hlsl.init2.frag", "main"},
@@ -138,6 +142,7 @@ INSTANTIATE_TEST_CASE_P(
         {"hlsl.intrinsics.f1632.frag", "main"},
         {"hlsl.intrinsics.f1632.frag", "main"},
         {"hlsl.intrinsics.f3216.frag", "main"},
         {"hlsl.intrinsics.f3216.frag", "main"},
         {"hlsl.intrinsics.frag", "main"},
         {"hlsl.intrinsics.frag", "main"},
+        {"hlsl.intrinsic.frexp.frag", "main"},
         {"hlsl.intrinsics.lit.frag", "PixelShaderFunction"},
         {"hlsl.intrinsics.lit.frag", "PixelShaderFunction"},
         {"hlsl.intrinsics.negative.comp", "ComputeShaderFunction"},
         {"hlsl.intrinsics.negative.comp", "ComputeShaderFunction"},
         {"hlsl.intrinsics.negative.frag", "PixelShaderFunction"},
         {"hlsl.intrinsics.negative.frag", "PixelShaderFunction"},
@@ -157,9 +162,11 @@ INSTANTIATE_TEST_CASE_P(
         {"hlsl.load.rwtexture.array.dx10.frag", "main"},
         {"hlsl.load.rwtexture.array.dx10.frag", "main"},
         {"hlsl.load.offset.dx10.frag", "main"},
         {"hlsl.load.offset.dx10.frag", "main"},
         {"hlsl.load.offsetarray.dx10.frag", "main"},
         {"hlsl.load.offsetarray.dx10.frag", "main"},
-        {"hlsl.logical.unary.frag", "main"},
         {"hlsl.logical.binary.frag", "main"},
         {"hlsl.logical.binary.frag", "main"},
         {"hlsl.logical.binary.vec.frag", "main"},
         {"hlsl.logical.binary.vec.frag", "main"},
+        {"hlsl.logicalConvert.frag", "main"},
+        {"hlsl.logical.unary.frag", "main"},
+        {"hlsl.namespace.frag", "main"},
         {"hlsl.matNx1.frag", "main"},
         {"hlsl.matNx1.frag", "main"},
         {"hlsl.matrixSwizzle.vert", "ShaderFunction"},
         {"hlsl.matrixSwizzle.vert", "ShaderFunction"},
         {"hlsl.mintypes.frag", "main"},
         {"hlsl.mintypes.frag", "main"},
@@ -212,6 +219,7 @@ INSTANTIATE_TEST_CASE_P(
         {"hlsl.samplelevel.offset.dx10.frag", "main"},
         {"hlsl.samplelevel.offset.dx10.frag", "main"},
         {"hlsl.samplelevel.offsetarray.dx10.frag", "main"},
         {"hlsl.samplelevel.offsetarray.dx10.frag", "main"},
         {"hlsl.sample.sub-vec4.dx10.frag", "main"},
         {"hlsl.sample.sub-vec4.dx10.frag", "main"},
+        {"hlsl.scalar-length.frag", "main"},
         {"hlsl.semicolons.frag", "main"},
         {"hlsl.semicolons.frag", "main"},
         {"hlsl.shapeConv.frag", "main"},
         {"hlsl.shapeConv.frag", "main"},
         {"hlsl.shapeConvRet.frag", "main"},
         {"hlsl.shapeConvRet.frag", "main"},
@@ -239,6 +247,7 @@ INSTANTIATE_TEST_CASE_P(
         {"hlsl.structStructName.frag", "main"},
         {"hlsl.structStructName.frag", "main"},
         {"hlsl.this.frag", "main"},
         {"hlsl.this.frag", "main"},
         {"hlsl.intrinsics.vert", "VertexShaderFunction"},
         {"hlsl.intrinsics.vert", "VertexShaderFunction"},
+        {"hlsl.intrinsic.frexp.vert", "VertexShaderFunction"},
         {"hlsl.matType.frag", "PixelShaderFunction"},
         {"hlsl.matType.frag", "PixelShaderFunction"},
         {"hlsl.matType.bool.frag", "main"},
         {"hlsl.matType.bool.frag", "main"},
         {"hlsl.matType.int.frag", "main"},
         {"hlsl.matType.int.frag", "main"},

+ 136 - 72
3rdparty/glslang/hlsl/hlslGrammar.cpp

@@ -134,22 +134,17 @@ bool HlslGrammar::acceptIdentifier(HlslToken& idToken)
 }
 }
 
 
 // compilationUnit
 // compilationUnit
-//      : list of externalDeclaration
-//      |   SEMICOLONS
+//      : declaration_list EOF
 //
 //
 bool HlslGrammar::acceptCompilationUnit()
 bool HlslGrammar::acceptCompilationUnit()
 {
 {
     TIntermNode* unitNode = nullptr;
     TIntermNode* unitNode = nullptr;
 
 
-    while (! peekTokenClass(EHTokNone)) {
-        // HLSL allows semicolons between global declarations, e.g, between functions.
-        if (acceptTokenClass(EHTokSemicolon))
-            continue;
+    if (! acceptDeclarationList(unitNode))
+        return false;
 
 
-        // externalDeclaration
-        if (! acceptDeclaration(unitNode))
-            return false;
-    }
+    if (! peekTokenClass(EHTokNone))
+        return false;
 
 
     // set root of AST
     // set root of AST
     if (unitNode && !unitNode->getAsAggregate())
     if (unitNode && !unitNode->getAsAggregate())
@@ -159,6 +154,34 @@ bool HlslGrammar::acceptCompilationUnit()
     return true;
     return true;
 }
 }
 
 
+// Recognize the following, but with the extra condition that it can be
+// successfully terminated by EOF or '}'.
+//
+// declaration_list
+//      : list of declaration_or_semicolon followed by EOF or RIGHT_BRACE
+//
+// declaration_or_semicolon
+//      : declaration
+//      : SEMICOLON
+//
+bool HlslGrammar::acceptDeclarationList(TIntermNode*& nodeList)
+{
+    do {
+        // HLSL allows extra semicolons between global declarations
+        do { } while (acceptTokenClass(EHTokSemicolon));
+
+        // EOF or RIGHT_BRACE
+        if (peekTokenClass(EHTokNone) || peekTokenClass(EHTokRightBrace))
+            return true;
+
+        // declaration
+        if (! acceptDeclaration(nodeList))
+            return false;
+    } while (true);
+
+    return true;
+}
+
 // sampler_state
 // sampler_state
 //      : LEFT_BRACE [sampler_state_assignment ... ] RIGHT_BRACE
 //      : LEFT_BRACE [sampler_state_assignment ... ] RIGHT_BRACE
 //
 //
@@ -289,6 +312,7 @@ bool HlslGrammar::acceptSamplerDeclarationDX9(TType& /*type*/)
 //      | fully_specified_type identifier function_parameters post_decls compound_statement  // function definition
 //      | fully_specified_type identifier function_parameters post_decls compound_statement  // function definition
 //      | fully_specified_type identifier sampler_state post_decls compound_statement        // sampler definition
 //      | fully_specified_type identifier sampler_state post_decls compound_statement        // sampler definition
 //      | typedef declaration
 //      | typedef declaration
+//      | NAMESPACE IDENTIFIER LEFT_BRACE declaration_list RIGHT_BRACE
 //
 //
 // declarator_list
 // declarator_list
 //      : declarator COMMA declarator COMMA declarator...  // zero or more declarators
 //      : declarator COMMA declarator COMMA declarator...  // zero or more declarators
@@ -314,6 +338,30 @@ bool HlslGrammar::acceptSamplerDeclarationDX9(TType& /*type*/)
 //
 //
 bool HlslGrammar::acceptDeclaration(TIntermNode*& nodeList)
 bool HlslGrammar::acceptDeclaration(TIntermNode*& nodeList)
 {
 {
+    // NAMESPACE IDENTIFIER LEFT_BRACE declaration_list RIGHT_BRACE
+    if (acceptTokenClass(EHTokNamespace)) {
+        HlslToken namespaceToken;
+        if (!acceptIdentifier(namespaceToken)) {
+            expected("namespace name");
+            return false;
+        }
+        parseContext.pushNamespace(*namespaceToken.string);
+        if (!acceptTokenClass(EHTokLeftBrace)) {
+            expected("{");
+            return false;
+        }
+        if (!acceptDeclarationList(nodeList)) {
+            expected("declaration list");
+            return false;
+        }
+        if (!acceptTokenClass(EHTokRightBrace)) {
+            expected("}");
+            return false;
+        }
+        parseContext.popNamespace();
+        return true;
+    }
+
     bool declarator_list = false; // true when processing comma separation
     bool declarator_list = false; // true when processing comma separation
 
 
     // attributes
     // attributes
@@ -342,15 +390,17 @@ bool HlslGrammar::acceptDeclaration(TIntermNode*& nodeList)
     HlslToken idToken;
     HlslToken idToken;
     TIntermAggregate* initializers = nullptr;
     TIntermAggregate* initializers = nullptr;
     while (acceptIdentifier(idToken)) {
     while (acceptIdentifier(idToken)) {
+        const TString *fullName = idToken.string;
+        if (parseContext.symbolTable.atGlobalLevel())
+            parseContext.getFullNamespaceName(fullName);
         if (peekTokenClass(EHTokLeftParen)) {
         if (peekTokenClass(EHTokLeftParen)) {
             // looks like function parameters
             // looks like function parameters
-            TString* fnName = idToken.string;
 
 
             // Potentially rename shader entry point function.  No-op most of the time.
             // Potentially rename shader entry point function.  No-op most of the time.
-            parseContext.renameShaderFunction(fnName);
+            parseContext.renameShaderFunction(fullName);
 
 
             // function_parameters
             // function_parameters
-            declarator.function = new TFunction(fnName, declaredType);
+            declarator.function = new TFunction(fullName, declaredType);
             if (!acceptFunctionParameters(*declarator.function)) {
             if (!acceptFunctionParameters(*declarator.function)) {
                 expected("function parameter list");
                 expected("function parameter list");
                 return false;
                 return false;
@@ -424,19 +474,19 @@ bool HlslGrammar::acceptDeclaration(TIntermNode*& nodeList)
             // TODO: strings are not yet handled.
             // TODO: strings are not yet handled.
             if (variableType.getBasicType() != EbtString && parseContext.getAnnotationNestingLevel() == 0) {
             if (variableType.getBasicType() != EbtString && parseContext.getAnnotationNestingLevel() == 0) {
                 if (typedefDecl)
                 if (typedefDecl)
-                    parseContext.declareTypedef(idToken.loc, *idToken.string, variableType);
+                    parseContext.declareTypedef(idToken.loc, *fullName, variableType);
                 else if (variableType.getBasicType() == EbtBlock)
                 else if (variableType.getBasicType() == EbtBlock)
-                    parseContext.declareBlock(idToken.loc, variableType, idToken.string);
+                    parseContext.declareBlock(idToken.loc, variableType, fullName);
                 else {
                 else {
                     if (variableType.getQualifier().storage == EvqUniform && ! variableType.containsOpaque()) {
                     if (variableType.getQualifier().storage == EvqUniform && ! variableType.containsOpaque()) {
                         // this isn't really an individual variable, but a member of the $Global buffer
                         // this isn't really an individual variable, but a member of the $Global buffer
-                        parseContext.growGlobalUniformBlock(idToken.loc, variableType, *idToken.string);
+                        parseContext.growGlobalUniformBlock(idToken.loc, variableType, *fullName);
                     } else {
                     } else {
                         // Declare the variable and add any initializer code to the AST.
                         // Declare the variable and add any initializer code to the AST.
                         // The top-level node is always made into an aggregate, as that's
                         // The top-level node is always made into an aggregate, as that's
                         // historically how the AST has been.
                         // historically how the AST has been.
                         initializers = intermediate.growAggregate(initializers,
                         initializers = intermediate.growAggregate(initializers,
-                            parseContext.declareVariable(idToken.loc, *idToken.string, variableType, expressionNode),
+                            parseContext.declareVariable(idToken.loc, *fullName, variableType, expressionNode),
                             idToken.loc);
                             idToken.loc);
                     }
                     }
                 }
                 }
@@ -561,10 +611,6 @@ bool HlslGrammar::acceptFullySpecifiedType(TType& type, TIntermNode*& nodeList)
         qualifier.layoutFormat = type.getQualifier().layoutFormat;
         qualifier.layoutFormat = type.getQualifier().layoutFormat;
         qualifier.precision    = type.getQualifier().precision;
         qualifier.precision    = type.getQualifier().precision;
 
 
-        // Propagate sampler readonly qualifier for buffers
-        if (type.getBasicType() == EbtSampler)
-            qualifier.readonly = type.getQualifier().readonly;
-
         if (type.getQualifier().storage == EvqVaryingOut ||
         if (type.getQualifier().storage == EvqVaryingOut ||
             type.getQualifier().storage == EvqBuffer) {
             type.getQualifier().storage == EvqBuffer) {
             qualifier.storage      = type.getQualifier().storage;
             qualifier.storage      = type.getQualifier().storage;
@@ -1099,25 +1145,24 @@ bool HlslGrammar::acceptTextureType(TType& type)
     bool array = false;
     bool array = false;
     bool ms    = false;
     bool ms    = false;
     bool image = false;
     bool image = false;
-    bool readonly = false;
 
 
     switch (textureType) {
     switch (textureType) {
-    case EHTokTexture1d:         dim = Esd1D;                                break;
-    case EHTokTexture1darray:    dim = Esd1D; array = true;                  break;
-    case EHTokTexture2d:         dim = Esd2D;                                break;
-    case EHTokTexture2darray:    dim = Esd2D; array = true;                  break;
-    case EHTokTexture3d:         dim = Esd3D;                                break;
-    case EHTokTextureCube:       dim = EsdCube;                              break;
-    case EHTokTextureCubearray:  dim = EsdCube; array = true;                break;
-    case EHTokTexture2DMS:       dim = Esd2D; ms = true;                     break;
-    case EHTokTexture2DMSarray:  dim = Esd2D; array = true; ms = true;       break;
-    case EHTokBuffer:            dim = EsdBuffer; readonly=true; image=true; break;
-    case EHTokRWBuffer:          dim = EsdBuffer; image=true;                break;
-    case EHTokRWTexture1d:       dim = Esd1D; array=false; image=true;       break;
-    case EHTokRWTexture1darray:  dim = Esd1D; array=true;  image=true;       break;
-    case EHTokRWTexture2d:       dim = Esd2D; array=false; image=true;       break;
-    case EHTokRWTexture2darray:  dim = Esd2D; array=true;  image=true;       break;
-    case EHTokRWTexture3d:       dim = Esd3D; array=false; image=true;       break;
+    case EHTokBuffer:            dim = EsdBuffer;                      break;
+    case EHTokTexture1d:         dim = Esd1D;                          break;
+    case EHTokTexture1darray:    dim = Esd1D; array = true;            break;
+    case EHTokTexture2d:         dim = Esd2D;                          break;
+    case EHTokTexture2darray:    dim = Esd2D; array = true;            break;
+    case EHTokTexture3d:         dim = Esd3D;                          break;
+    case EHTokTextureCube:       dim = EsdCube;                        break;
+    case EHTokTextureCubearray:  dim = EsdCube; array = true;          break;
+    case EHTokTexture2DMS:       dim = Esd2D; ms = true;               break;
+    case EHTokTexture2DMSarray:  dim = Esd2D; array = true; ms = true; break;
+    case EHTokRWBuffer:          dim = EsdBuffer; image=true;          break;
+    case EHTokRWTexture1d:       dim = Esd1D; array=false; image=true; break;
+    case EHTokRWTexture1darray:  dim = Esd1D; array=true;  image=true; break;
+    case EHTokRWTexture2d:       dim = Esd2D; array=false; image=true; break;
+    case EHTokRWTexture2darray:  dim = Esd2D; array=true;  image=true; break;
+    case EHTokRWTexture3d:       dim = Esd3D; array=false; image=true; break;
     default:
     default:
         return false;  // not a texture declaration
         return false;  // not a texture declaration
     }
     }
@@ -1177,7 +1222,7 @@ bool HlslGrammar::acceptTextureType(TType& type)
     } else if (ms) {
     } else if (ms) {
         expected("texture type for multisample");
         expected("texture type for multisample");
         return false;
         return false;
-    } else if (image && !readonly) {
+    } else if (image) {
         expected("type for RWTexture/RWBuffer");
         expected("type for RWTexture/RWBuffer");
         return false;
         return false;
     }
     }
@@ -1208,9 +1253,7 @@ bool HlslGrammar::acceptTextureType(TType& type)
     sampler.vectorSize = txType.getVectorSize();
     sampler.vectorSize = txType.getVectorSize();
 
 
     type.shallowCopy(TType(sampler, EvqUniform, arraySizes));
     type.shallowCopy(TType(sampler, EvqUniform, arraySizes));
-
     type.getQualifier().layoutFormat = format;
     type.getQualifier().layoutFormat = format;
-    type.getQualifier().readonly = readonly;
 
 
     return true;
     return true;
 }
 }
@@ -1829,7 +1872,7 @@ bool HlslGrammar::acceptStruct(TType& type, TIntermNode*& nodeList)
     TVector<TFunctionDeclarator> functionDeclarators;
     TVector<TFunctionDeclarator> functionDeclarators;
 
 
     parseContext.pushNamespace(structName);
     parseContext.pushNamespace(structName);
-    bool acceptedList = acceptStructDeclarationList(typeList, nodeList, structName, functionDeclarators);
+    bool acceptedList = acceptStructDeclarationList(typeList, nodeList, functionDeclarators);
     parseContext.popNamespace();
     parseContext.popNamespace();
 
 
     if (! acceptedList) {
     if (! acceptedList) {
@@ -1988,7 +2031,7 @@ bool HlslGrammar::acceptStructBufferType(TType& type)
 //      | IDENTIFIER array_specifier post_decls
 //      | IDENTIFIER array_specifier post_decls
 //      | IDENTIFIER function_parameters post_decls                                         // member-function prototype
 //      | IDENTIFIER function_parameters post_decls                                         // member-function prototype
 //
 //
-bool HlslGrammar::acceptStructDeclarationList(TTypeList*& typeList, TIntermNode*& nodeList, const TString& typeName,
+bool HlslGrammar::acceptStructDeclarationList(TTypeList*& typeList, TIntermNode*& nodeList,
                                               TVector<TFunctionDeclarator>& declarators)
                                               TVector<TFunctionDeclarator>& declarators)
 {
 {
     typeList = new TTypeList();
     typeList = new TTypeList();
@@ -2090,7 +2133,8 @@ bool HlslGrammar::acceptMemberFunctionDefinition(TIntermNode*& nodeList, const T
 {
 {
     bool accepted = false;
     bool accepted = false;
 
 
-    TString* functionName = parseContext.getFullNamespaceName(memberName);
+    const TString* functionName = &memberName;
+    parseContext.getFullNamespaceName(functionName);
     declarator.function = new TFunction(functionName, type);
     declarator.function = new TFunction(functionName, type);
     if (type.getQualifier().storage == EvqTemporary)
     if (type.getQualifier().storage == EvqTemporary)
         declarator.function->setImplicitThis();
         declarator.function->setImplicitThis();
@@ -2476,6 +2520,10 @@ bool HlslGrammar::acceptConditionalExpression(TIntermTyped*& node)
     if (! acceptTokenClass(EHTokQuestion))
     if (! acceptTokenClass(EHTokQuestion))
         return true;
         return true;
 
 
+    node = parseContext.convertConditionalExpression(token.loc, node);
+    if (node == nullptr)
+        return false;
+
     TIntermTyped* trueNode = nullptr;
     TIntermTyped* trueNode = nullptr;
     if (! acceptExpression(trueNode)) {
     if (! acceptExpression(trueNode)) {
         expected("expression after ?");
         expected("expression after ?");
@@ -2623,12 +2671,12 @@ bool HlslGrammar::acceptUnaryExpression(TIntermTyped*& node)
 //      : LEFT_PAREN expression RIGHT_PAREN
 //      : LEFT_PAREN expression RIGHT_PAREN
 //      | literal
 //      | literal
 //      | constructor
 //      | constructor
-//      | identifier
+//      | IDENTIFIER [ COLONCOLON IDENTIFIER [ COLONCOLON IDENTIFIER ... ] ]
 //      | function_call
 //      | function_call
 //      | postfix_expression LEFT_BRACKET integer_expression RIGHT_BRACKET
 //      | postfix_expression LEFT_BRACKET integer_expression RIGHT_BRACKET
 //      | postfix_expression DOT IDENTIFIER
 //      | postfix_expression DOT IDENTIFIER
 //      | postfix_expression DOT IDENTIFIER arguments
 //      | postfix_expression DOT IDENTIFIER arguments
-//      | postfix_expression COLONCOLON IDENTIFIER arguments
+//      | postfix_expression arguments
 //      | postfix_expression INC_OP
 //      | postfix_expression INC_OP
 //      | postfix_expression DEC_OP
 //      | postfix_expression DEC_OP
 //
 //
@@ -2640,9 +2688,6 @@ bool HlslGrammar::acceptPostfixExpression(TIntermTyped*& node)
     // idToken will pick up either a variable or a function name in a function call
     // idToken will pick up either a variable or a function name in a function call
     HlslToken idToken;
     HlslToken idToken;
 
 
-    // scopeBase will pick up the type symbol on the left of '::'
-    TSymbol* scope = nullptr;
-
     // Find something before the postfix operations, as they can't operate
     // Find something before the postfix operations, as they can't operate
     // on nothing.  So, no "return true", they fall through, only "return false".
     // on nothing.  So, no "return true", they fall through, only "return false".
     if (acceptTokenClass(EHTokLeftParen)) {
     if (acceptTokenClass(EHTokLeftParen)) {
@@ -2656,21 +2701,26 @@ bool HlslGrammar::acceptPostfixExpression(TIntermTyped*& node)
             return false;
             return false;
         }
         }
     } else if (acceptLiteral(node)) {
     } else if (acceptLiteral(node)) {
-        // literal (nothing else to do yet), go on to the
+        // literal (nothing else to do yet)
     } else if (acceptConstructor(node)) {
     } else if (acceptConstructor(node)) {
         // constructor (nothing else to do yet)
         // constructor (nothing else to do yet)
     } else if (acceptIdentifier(idToken)) {
     } else if (acceptIdentifier(idToken)) {
-        // user-type, identifier, or function name
-        if (peekTokenClass(EHTokColonColon)) {
-            TType type;
-            scope = parseContext.lookupUserType(*idToken.string, type);
-            if (scope == nullptr) {
-                expected("type left of ::");
+        // user-type, namespace name, variable, or function name
+        TString* fullName = idToken.string;
+        while (acceptTokenClass(EHTokColonColon)) {
+            // user-type or namespace name
+            fullName = NewPoolTString(fullName->c_str());
+            fullName->append(parseContext.scopeMangler);
+            if (acceptIdentifier(idToken))
+                fullName->append(*idToken.string);
+            else {
+                expected("identifier after ::");
                 return false;
                 return false;
             }
             }
-        } else if (! peekTokenClass(EHTokLeftParen)) {
-            node = parseContext.handleVariable(idToken.loc, idToken.string);
-        } else if (acceptFunctionCall(idToken, node)) {
+        }
+        if (! peekTokenClass(EHTokLeftParen)) {
+            node = parseContext.handleVariable(idToken.loc, fullName);
+        } else if (acceptFunctionCall(idToken.loc, *fullName, node, nullptr)) {
             // function_call (nothing else to do yet)
             // function_call (nothing else to do yet)
         } else {
         } else {
             expected("function call arguments");
             expected("function call arguments");
@@ -2734,7 +2784,7 @@ bool HlslGrammar::acceptPostfixExpression(TIntermTyped*& node)
                 TIntermTyped* thisNode = node;
                 TIntermTyped* thisNode = node;
 
 
                 // arguments
                 // arguments
-                if (! acceptFunctionCall(field, node, thisNode, scope)) {
+                if (! acceptFunctionCall(field.loc, *field.string, node, thisNode)) {
                     expected("function parameters");
                     expected("function parameters");
                     return false;
                     return false;
                 }
                 }
@@ -2806,26 +2856,26 @@ bool HlslGrammar::acceptConstructor(TIntermTyped*& node)
 // function_call
 // function_call
 //      : [idToken] arguments
 //      : [idToken] arguments
 //
 //
-bool HlslGrammar::acceptFunctionCall(HlslToken callToken, TIntermTyped*& node, TIntermTyped* baseObject,
-                                     const TSymbol* scope)
+bool HlslGrammar::acceptFunctionCall(const TSourceLoc& loc, TString& name, TIntermTyped*& node, TIntermTyped* baseObject)
 {
 {
     // name
     // name
     TString* functionName = nullptr;
     TString* functionName = nullptr;
-    if ((baseObject == nullptr && scope == nullptr)) {
-        functionName = callToken.string;
-    } else if (parseContext.isBuiltInMethod(callToken.loc, baseObject, *callToken.string)) {
+    if (baseObject == nullptr) {
+        functionName = &name;
+    } else if (parseContext.isBuiltInMethod(loc, baseObject, name)) {
         // Built-in methods are not in the symbol table as methods, but as global functions
         // Built-in methods are not in the symbol table as methods, but as global functions
         // taking an explicit 'this' as the first argument.
         // taking an explicit 'this' as the first argument.
         functionName = NewPoolTString(BUILTIN_PREFIX);
         functionName = NewPoolTString(BUILTIN_PREFIX);
-        functionName->append(*callToken.string);
+        functionName->append(name);
     } else {
     } else {
+        if (! baseObject->getType().isStruct()) {
+            expected("structure");
+            return false;
+        }
         functionName = NewPoolTString("");
         functionName = NewPoolTString("");
-        if (baseObject != nullptr)
-            functionName->append(baseObject->getType().getTypeName());
-        else if (scope != nullptr)
-            functionName->append(scope->getType().getTypeName());
+        functionName->append(baseObject->getType().getTypeName());
         parseContext.addScopeMangler(*functionName);
         parseContext.addScopeMangler(*functionName);
-        functionName->append(*callToken.string);
+        functionName->append(name);
     }
     }
 
 
     // function
     // function
@@ -2841,7 +2891,7 @@ bool HlslGrammar::acceptFunctionCall(HlslToken callToken, TIntermTyped*& node, T
         return false;
         return false;
 
 
     // call
     // call
-    node = parseContext.handleFunctionCall(callToken.loc, function, arguments);
+    node = parseContext.handleFunctionCall(loc, function, arguments);
 
 
     return true;
     return true;
 }
 }
@@ -3144,6 +3194,9 @@ bool HlslGrammar::acceptSelectionStatement(TIntermNode*& statement)
     TIntermTyped* condition;
     TIntermTyped* condition;
     if (! acceptParenExpression(condition))
     if (! acceptParenExpression(condition))
         return false;
         return false;
+    condition = parseContext.convertConditionalExpression(loc, condition);
+    if (condition == nullptr)
+        return false;
 
 
     // create the child statements
     // create the child statements
     TIntermNodePair thenElse = { nullptr, nullptr };
     TIntermNodePair thenElse = { nullptr, nullptr };
@@ -3227,6 +3280,9 @@ bool HlslGrammar::acceptIterationStatement(TIntermNode*& statement)
         // LEFT_PAREN condition RIGHT_PAREN
         // LEFT_PAREN condition RIGHT_PAREN
         if (! acceptParenExpression(condition))
         if (! acceptParenExpression(condition))
             return false;
             return false;
+        condition = parseContext.convertConditionalExpression(loc, condition);
+        if (condition == nullptr)
+            return false;
 
 
         // statement
         // statement
         if (! acceptScopedStatement(statement)) {
         if (! acceptScopedStatement(statement)) {
@@ -3266,6 +3322,9 @@ bool HlslGrammar::acceptIterationStatement(TIntermNode*& statement)
         TIntermTyped* condition;
         TIntermTyped* condition;
         if (! acceptParenExpression(condition))
         if (! acceptParenExpression(condition))
             return false;
             return false;
+        condition = parseContext.convertConditionalExpression(loc, condition);
+        if (condition == nullptr)
+            return false;
 
 
         if (! acceptTokenClass(EHTokSemicolon))
         if (! acceptTokenClass(EHTokSemicolon))
             expected(";");
             expected(";");
@@ -3303,6 +3362,11 @@ bool HlslGrammar::acceptIterationStatement(TIntermNode*& statement)
         acceptExpression(condition);
         acceptExpression(condition);
         if (! acceptTokenClass(EHTokSemicolon))
         if (! acceptTokenClass(EHTokSemicolon))
             expected(";");
             expected(";");
+        if (condition != nullptr) {
+            condition = parseContext.convertConditionalExpression(loc, condition);
+            if (condition == nullptr)
+                return false;
+        }
 
 
         // iterator SEMI_COLON
         // iterator SEMI_COLON
         TIntermTyped* iterator = nullptr;
         TIntermTyped* iterator = nullptr;

+ 3 - 4
3rdparty/glslang/hlsl/hlslGrammar.h

@@ -65,6 +65,7 @@ namespace glslang {
         void unimplemented(const char*);
         void unimplemented(const char*);
         bool acceptIdentifier(HlslToken&);
         bool acceptIdentifier(HlslToken&);
         bool acceptCompilationUnit();
         bool acceptCompilationUnit();
+        bool acceptDeclarationList(TIntermNode*&);
         bool acceptDeclaration(TIntermNode*&);
         bool acceptDeclaration(TIntermNode*&);
         bool acceptControlDeclaration(TIntermNode*& node);
         bool acceptControlDeclaration(TIntermNode*& node);
         bool acceptSamplerDeclarationDX9(TType&);
         bool acceptSamplerDeclarationDX9(TType&);
@@ -87,8 +88,7 @@ namespace glslang {
         bool acceptTextureType(TType&);
         bool acceptTextureType(TType&);
         bool acceptStructBufferType(TType&);
         bool acceptStructBufferType(TType&);
         bool acceptStruct(TType&, TIntermNode*& nodeList);
         bool acceptStruct(TType&, TIntermNode*& nodeList);
-        bool acceptStructDeclarationList(TTypeList*&, TIntermNode*& nodeList, const TString& typeName,
-                                         TVector<TFunctionDeclarator>&);
+        bool acceptStructDeclarationList(TTypeList*&, TIntermNode*& nodeList, TVector<TFunctionDeclarator>&);
         bool acceptMemberFunctionDefinition(TIntermNode*& nodeList, const TType&, const TString& memberName,
         bool acceptMemberFunctionDefinition(TIntermNode*& nodeList, const TType&, const TString& memberName,
                                             TFunctionDeclarator&);
                                             TFunctionDeclarator&);
         bool acceptFunctionParameters(TFunction&);
         bool acceptFunctionParameters(TFunction&);
@@ -104,8 +104,7 @@ namespace glslang {
         bool acceptUnaryExpression(TIntermTyped*&);
         bool acceptUnaryExpression(TIntermTyped*&);
         bool acceptPostfixExpression(TIntermTyped*&);
         bool acceptPostfixExpression(TIntermTyped*&);
         bool acceptConstructor(TIntermTyped*&);
         bool acceptConstructor(TIntermTyped*&);
-        bool acceptFunctionCall(HlslToken, TIntermTyped*&, TIntermTyped* objectBase = nullptr,
-                                const TSymbol* scope = nullptr);
+        bool acceptFunctionCall(const TSourceLoc&, TString& name, TIntermTyped*&, TIntermTyped* objectBase);
         bool acceptArguments(TFunction*, TIntermTyped*&);
         bool acceptArguments(TFunction*, TIntermTyped*&);
         bool acceptLiteral(TIntermTyped*&);
         bool acceptLiteral(TIntermTyped*&);
         bool acceptCompoundStatement(TIntermNode*&);
         bool acceptCompoundStatement(TIntermNode*&);

+ 366 - 141
3rdparty/glslang/hlsl/hlslParseHelper.cpp

@@ -162,7 +162,7 @@ bool HlslParseContext::shouldConvertLValue(const TIntermNode* node) const
     return false;
     return false;
 }
 }
 
 
-void HlslParseContext::growGlobalUniformBlock(TSourceLoc& loc, TType& memberType, TString& memberName, TTypeList* newTypeList)
+void HlslParseContext::growGlobalUniformBlock(const TSourceLoc& loc, TType& memberType, const TString& memberName, TTypeList* newTypeList)
 {
 {
     newTypeList = nullptr;
     newTypeList = nullptr;
     correctUniform(memberType.getQualifier());
     correctUniform(memberType.getQualifier());
@@ -1047,6 +1047,8 @@ TType& HlslParseContext::split(TType& type, TString name, const TType* outerStru
             if (arraySizes)
             if (arraySizes)
                 ioVar->getWritableType().newArraySizes(*arraySizes);
                 ioVar->getWritableType().newArraySizes(*arraySizes);
 
 
+            fixBuiltInArrayType(ioVar->getWritableType());
+
             interstageBuiltInIo[tInterstageIoData(memberType, *outerStructType)] = ioVar;
             interstageBuiltInIo[tInterstageIoData(memberType, *outerStructType)] = ioVar;
 
 
             // Merge qualifier from the user structure
             // Merge qualifier from the user structure
@@ -1381,6 +1383,34 @@ void HlslParseContext::trackLinkage(TSymbol& symbol)
 }
 }
 
 
 
 
+// Some types require fixed array sizes in SPIR-V, but can be scalars or
+// arrays of sizes SPIR-V doesn't allow.  For example, tessellation factors.
+// This creates the right size.  A conversion is performed when the internal
+// type is copied to or from the external type.
+void HlslParseContext::fixBuiltInArrayType(TType& type)
+{
+    int requiredSize = 0;
+
+    switch (type.getQualifier().builtIn) {
+    case EbvTessLevelOuter: requiredSize = 4; break;
+    case EbvTessLevelInner: requiredSize = 2; break;
+    case EbvClipDistance:   // TODO: ...
+    case EbvCullDistance:   // TODO: ...
+    default:
+        return;
+    }
+
+    if (type.isArray()) {
+        // Already an array.  Fix the size.
+        type.changeOuterArraySize(requiredSize);
+    } else {
+        // it wasn't an array, but needs to be.
+        TArraySizes arraySizes;
+        arraySizes.addInnerSize(requiredSize);
+        type.newArraySizes(arraySizes);
+    }
+}
+
 // Variables that correspond to the user-interface in and out of a stage
 // Variables that correspond to the user-interface in and out of a stage
 // (not the built-in interface) are assigned locations and
 // (not the built-in interface) are assigned locations and
 // registered as a linkage node (part of the stage's external interface).
 // registered as a linkage node (part of the stage's external interface).
@@ -1389,15 +1419,24 @@ void HlslParseContext::trackLinkage(TSymbol& symbol)
 void HlslParseContext::assignLocations(TVariable& variable)
 void HlslParseContext::assignLocations(TVariable& variable)
 {
 {
     const auto assignLocation = [&](TVariable& variable) {
     const auto assignLocation = [&](TVariable& variable) {
-        const TQualifier& qualifier = variable.getType().getQualifier();
+        const TType& type = variable.getType();
+        const TQualifier& qualifier = type.getQualifier();
         if (qualifier.storage == EvqVaryingIn || qualifier.storage == EvqVaryingOut) {
         if (qualifier.storage == EvqVaryingIn || qualifier.storage == EvqVaryingOut) {
             if (qualifier.builtIn == EbvNone) {
             if (qualifier.builtIn == EbvNone) {
+                // Strip off the outer array dimension for those having an extra one.
+                int size;
+                if (type.isArray() && qualifier.isArrayedIo(language)) {
+                    TType elementType(type, 0);
+                    size = intermediate.computeTypeLocationSize(elementType);
+                } else
+                    size = intermediate.computeTypeLocationSize(type);
+
                 if (qualifier.storage == EvqVaryingIn) {
                 if (qualifier.storage == EvqVaryingIn) {
                     variable.getWritableType().getQualifier().layoutLocation = nextInLocation;
                     variable.getWritableType().getQualifier().layoutLocation = nextInLocation;
-                    nextInLocation += intermediate.computeTypeLocationSize(variable.getType());
+                    nextInLocation += size;
                 } else {
                 } else {
                     variable.getWritableType().getQualifier().layoutLocation = nextOutLocation;
                     variable.getWritableType().getQualifier().layoutLocation = nextOutLocation;
-                    nextOutLocation += intermediate.computeTypeLocationSize(variable.getType());
+                    nextOutLocation += size;
                 }
                 }
             }
             }
 
 
@@ -1559,48 +1598,10 @@ TIntermAggregate* HlslParseContext::handleFunctionDefinition(const TSourceLoc& l
     return paramNodes;
     return paramNodes;
 }
 }
 
 
-//
-// Do all special handling for the entry point, including wrapping
-// the shader's entry point with the official entry point that will call it.
-//
-// The following:
-//
-//    retType shaderEntryPoint(args...) // shader declared entry point
-//    { body }
-//
-// Becomes
-//
-//    out retType ret;
-//    in iargs<that are input>...;
-//    out oargs<that are output> ...;
-//
-//    void shaderEntryPoint()    // synthesized, but official, entry point
-//    {
-//        args<that are input> = iargs...;
-//        ret = @shaderEntryPoint(args...);
-//        oargs = args<that are output>...;
-//    }
-//
-// The symbol table will still map the original entry point name to the
-// the modified function and it's new name:
-//
-//    symbol table:  shaderEntryPoint  ->   @shaderEntryPoint
-//
-// Returns nullptr if no entry-point tree was built, otherwise, returns
-// a subtree that creates the entry point.
-//
-TIntermNode* HlslParseContext::transformEntryPoint(const TSourceLoc& loc, TFunction& userFunction, const TAttributeMap& attributes)
-{
-    // if we aren't in the entry point, fix the IO as such and exit
-    if (userFunction.getName().compare(intermediate.getEntryPointName().c_str()) != 0) {
-        remapNonEntryPointIO(userFunction);
-        return nullptr;
-    }
-
-    entryPointFunction = &userFunction; // needed in finish()
-
-    // entry point logic...
 
 
+// Handle all [attrib] attribute for the shader entry point
+void HlslParseContext::handleEntryPointAttributes(const TSourceLoc& loc, const TAttributeMap& attributes)
+{
     // Handle entry-point function attributes
     // Handle entry-point function attributes
     const TIntermAggregate* numThreads = attributes[EatNumThreads];
     const TIntermAggregate* numThreads = attributes[EatNumThreads];
     if (numThreads != nullptr) {
     if (numThreads != nullptr) {
@@ -1652,8 +1653,12 @@ TIntermNode* HlslParseContext::transformEntryPoint(const TSourceLoc& loc, TFunct
                 error(loc, "unsupported domain type", domainStr.c_str(), "");
                 error(loc, "unsupported domain type", domainStr.c_str(), "");
             }
             }
 
 
-            if (! intermediate.setInputPrimitive(domain)) {
-                error(loc, "cannot change previously set domain", TQualifier::getGeometryString(domain), "");
+            if (language == EShLangTessEvaluation) {
+                if (! intermediate.setInputPrimitive(domain))
+                    error(loc, "cannot change previously set domain", TQualifier::getGeometryString(domain), "");
+            } else {
+                if (! intermediate.setOutputPrimitive(domain))
+                    error(loc, "cannot change previously set domain", TQualifier::getGeometryString(domain), "");
             }
             }
         }
         }
     }
     }
@@ -1731,6 +1736,52 @@ TIntermNode* HlslParseContext::transformEntryPoint(const TSourceLoc& loc, TFunct
             }
             }
         }
         }
     }
     }
+}
+
+//
+// Do all special handling for the entry point, including wrapping
+// the shader's entry point with the official entry point that will call it.
+//
+// The following:
+//
+//    retType shaderEntryPoint(args...) // shader declared entry point
+//    { body }
+//
+// Becomes
+//
+//    out retType ret;
+//    in iargs<that are input>...;
+//    out oargs<that are output> ...;
+//
+//    void shaderEntryPoint()    // synthesized, but official, entry point
+//    {
+//        args<that are input> = iargs...;
+//        ret = @shaderEntryPoint(args...);
+//        oargs = args<that are output>...;
+//    }
+//
+// The symbol table will still map the original entry point name to the
+// the modified function and it's new name:
+//
+//    symbol table:  shaderEntryPoint  ->   @shaderEntryPoint
+//
+// Returns nullptr if no entry-point tree was built, otherwise, returns
+// a subtree that creates the entry point.
+//
+TIntermNode* HlslParseContext::transformEntryPoint(const TSourceLoc& loc, TFunction& userFunction, const TAttributeMap& attributes)
+{
+    // if we aren't in the entry point, fix the IO as such and exit
+    if (userFunction.getName().compare(intermediate.getEntryPointName().c_str()) != 0) {
+        remapNonEntryPointIO(userFunction);
+        return nullptr;
+    }
+
+    entryPointFunction = &userFunction; // needed in finish()
+
+    // Handle entry point attributes
+    handleEntryPointAttributes(loc, attributes);
+
+    // entry point logic...
 
 
     // Move parameters and return value to shader in/out
     // Move parameters and return value to shader in/out
     TVariable* entryPointOutput; // gets created in remapEntryPointIO
     TVariable* entryPointOutput; // gets created in remapEntryPointIO
@@ -1799,10 +1850,40 @@ TIntermNode* HlslParseContext::transformEntryPoint(const TSourceLoc& loc, TFunct
     currentCaller = userFunction.getMangledName();
     currentCaller = userFunction.getMangledName();
 
 
     // Return value
     // Return value
-    if (entryPointOutput)
-        intermediate.growAggregate(synthBody, handleAssign(loc, EOpAssign,
-                                                           intermediate.addSymbol(*entryPointOutput), callReturn));
-    else
+    if (entryPointOutput) {
+        TIntermTyped* returnAssign;
+
+        // For hull shaders, the wrapped entry point return value is written to
+        // an array element as indexed by invocation ID, which we might have to make up.
+        // This is required to match SPIR-V semantics.
+        if (language == EShLangTessControl) {
+            TIntermSymbol* invocationIdSym = findLinkageSymbol(EbvInvocationId);
+
+            // If there is no user declared invocation ID, we must make one.
+            if (invocationIdSym == nullptr) {
+                TType invocationIdType(EbtUint, EvqIn, 1);
+                TString* invocationIdName = NewPoolTString("InvocationId");
+                invocationIdType.getQualifier().builtIn = EbvInvocationId;
+
+                TVariable* variable = makeInternalVariable(*invocationIdName, invocationIdType);
+
+                globalQualifierFix(loc, variable->getWritableType().getQualifier());
+                trackLinkage(*variable);
+
+                invocationIdSym = intermediate.addSymbol(*variable);
+            }
+
+            TIntermTyped* element = intermediate.addIndex(EOpIndexIndirect, intermediate.addSymbol(*entryPointOutput),
+                                                          invocationIdSym, loc);
+            element->setType(callReturn->getType());
+
+            returnAssign = handleAssign(loc, EOpAssign, element, callReturn);
+        } else {
+            returnAssign = handleAssign(loc, EOpAssign, intermediate.addSymbol(*entryPointOutput), callReturn);
+        }
+        
+        intermediate.growAggregate(synthBody, returnAssign);
+    } else
         intermediate.growAggregate(synthBody, callReturn);
         intermediate.growAggregate(synthBody, callReturn);
 
 
     // Output copies
     // Output copies
@@ -1862,19 +1943,42 @@ void HlslParseContext::remapEntryPointIO(TFunction& function, TVariable*& return
                     ioVariable->getWritableType().setStruct(newLists->second.output);
                     ioVariable->getWritableType().setStruct(newLists->second.output);
             }
             }
         }
         }
-        if (storage == EvqVaryingIn)
+        if (storage == EvqVaryingIn) {
             correctInput(ioVariable->getWritableType().getQualifier());
             correctInput(ioVariable->getWritableType().getQualifier());
-        else
+            if (language == EShLangTessEvaluation)
+                if (!ioVariable->getType().isArray())
+                    ioVariable->getWritableType().getQualifier().patch = true;
+        } else {
             correctOutput(ioVariable->getWritableType().getQualifier());
             correctOutput(ioVariable->getWritableType().getQualifier());
+        }
         ioVariable->getWritableType().getQualifier().storage = storage;
         ioVariable->getWritableType().getQualifier().storage = storage;
         return ioVariable;
         return ioVariable;
     };
     };
 
 
     // return value is actually a shader-scoped output (out)
     // return value is actually a shader-scoped output (out)
-    if (function.getType().getBasicType() == EbtVoid)
+    if (function.getType().getBasicType() == EbtVoid) {
         returnValue = nullptr;
         returnValue = nullptr;
-    else
-        returnValue = makeIoVariable("@entryPointOutput", function.getWritableType(), EvqVaryingOut);
+    } else {
+        if (language == EShLangTessControl) {
+            // tessellation evaluation in HLSL writes a per-ctrl-pt value, but it needs to be an
+            // array in SPIR-V semantics.  We'll write to it indexed by invocation ID.
+
+            returnValue = makeIoVariable("@entryPointOutput", function.getWritableType(), EvqVaryingOut);
+
+            TType outputType;
+            outputType.shallowCopy(function.getType());
+
+            // vertices has necessarily already been set when handling entry point attributes.
+            TArraySizes arraySizes;
+            arraySizes.addInnerSize(intermediate.getVertices());
+            outputType.newArraySizes(arraySizes);
+
+            clearUniformInputOutput(function.getWritableType().getQualifier());
+            returnValue = makeIoVariable("@entryPointOutput", outputType, EvqVaryingOut);
+        } else {
+            returnValue = makeIoVariable("@entryPointOutput", function.getWritableType(), EvqVaryingOut);
+        }
+    }
 
 
     // parameters are actually shader-scoped inputs and outputs (in or out)
     // parameters are actually shader-scoped inputs and outputs (in or out)
     for (int i = 0; i < function.getParamCount(); i++) {
     for (int i = 0; i < function.getParamCount(); i++) {
@@ -2031,7 +2135,11 @@ TIntermTyped* HlslParseContext::handleAssign(const TSourceLoc& loc, TOperator op
         const bool split          = isLeft ? isSplitLeft : isSplitRight;
         const bool split          = isLeft ? isSplitLeft : isSplitRight;
         const TIntermTyped* outer = isLeft ? outerLeft   : outerRight;
         const TIntermTyped* outer = isLeft ? outerLeft   : outerRight;
         const TVector<TVariable*>& flatVariables      = isLeft ? *leftVariables : *rightVariables;
         const TVector<TVariable*>& flatVariables      = isLeft ? *leftVariables : *rightVariables;
-        const TOperator op = node->getType().isArray() ? EOpIndexDirect : EOpIndexDirectStruct;
+
+        // Index operator if it's an aggregate, else EOpNull
+        const TOperator op = node->getType().isArray()  ? EOpIndexDirect : 
+                             node->getType().isStruct() ? EOpIndexDirectStruct : EOpNull;
+
         const TType derefType(node->getType(), member);
         const TType derefType(node->getType(), member);
 
 
         if (split && derefType.isBuiltInInterstageIO(language)) {
         if (split && derefType.isBuiltInInterstageIO(language)) {
@@ -2047,10 +2155,14 @@ TIntermTyped* HlslParseContext::handleAssign(const TSourceLoc& loc, TOperator op
         } else if (flattened && isFinalFlattening(derefType)) {
         } else if (flattened && isFinalFlattening(derefType)) {
             subTree = intermediate.addSymbol(*flatVariables[memberIdx++]);
             subTree = intermediate.addSymbol(*flatVariables[memberIdx++]);
         } else {
         } else {
-            const TType splitDerefType(splitNode->getType(), splitMember);
+            if (op == EOpNull) {
+                subTree = splitNode;
+            } else {
+                const TType splitDerefType(splitNode->getType(), splitMember);
 
 
-            subTree = intermediate.addIndex(op, splitNode, intermediate.addConstantUnion(splitMember, loc), loc);
-            subTree->setType(splitDerefType);
+                subTree = intermediate.addIndex(op, splitNode, intermediate.addConstantUnion(splitMember, loc), loc);
+                subTree->setType(splitDerefType);
+            }
         }
         }
 
 
         return subTree;
         return subTree;
@@ -2069,11 +2181,15 @@ TIntermTyped* HlslParseContext::handleAssign(const TSourceLoc& loc, TOperator op
         // If we get here, we are assigning to or from a whole array or struct that must be
         // If we get here, we are assigning to or from a whole array or struct that must be
         // flattened, so have to do member-by-member assignment:
         // flattened, so have to do member-by-member assignment:
 
 
-        if (left->getType().isArray()) {
-            const TType dereferencedType(left->getType(), 0);
+        if (left->getType().isArray() || right->getType().isArray()) {
+            const int elementsL = left->getType().isArray() ? left->getType().getOuterArraySize() : 1;
+            const int elementsR = right->getType().isArray() ? right->getType().getOuterArraySize() : 1;
+
+            // The arrays may not be the same size, e.g, if the size has been forced for EbvTessLevelInner or Outer.
+            const int elementsToCopy = std::min(elementsL, elementsR);
 
 
             // array case
             // array case
-            for (int element=0; element < left->getType().getOuterArraySize(); ++element) {
+            for (int element=0; element < elementsToCopy; ++element) {
                 arrayElement.push_back(element);
                 arrayElement.push_back(element);
 
 
                 // Add a new AST symbol node if we have a temp variable holding a complex RHS.
                 // Add a new AST symbol node if we have a temp variable holding a complex RHS.
@@ -2083,10 +2199,7 @@ TIntermTyped* HlslParseContext::handleAssign(const TSourceLoc& loc, TOperator op
                 TIntermTyped* subSplitLeft =  isSplitLeft  ? getMember(true,  left,  element, splitLeft, element) : subLeft;
                 TIntermTyped* subSplitLeft =  isSplitLeft  ? getMember(true,  left,  element, splitLeft, element) : subLeft;
                 TIntermTyped* subSplitRight = isSplitRight ? getMember(false, right, element, splitRight, element) : subRight; 
                 TIntermTyped* subSplitRight = isSplitRight ? getMember(false, right, element, splitRight, element) : subRight; 
 
 
-                if (isFinalFlattening(dereferencedType))
-                    assignList = intermediate.growAggregate(assignList, intermediate.addAssign(op, subLeft, subRight, loc), loc);
-                else
-                    traverse(subLeft, subRight, subSplitLeft, subSplitRight);
+                traverse(subLeft, subRight, subSplitLeft, subSplitRight);
 
 
                 arrayElement.pop_back();
                 arrayElement.pop_back();
             }
             }
@@ -2120,8 +2233,8 @@ TIntermTyped* HlslParseContext::handleAssign(const TSourceLoc& loc, TOperator op
                 // subtree here IFF it does not itself contain any interstage built-in IO variables, so we only have to
                 // subtree here IFF it does not itself contain any interstage built-in IO variables, so we only have to
                 // recurse into it if there's something for splitting to do.  That can save a lot of AST verbosity for
                 // recurse into it if there's something for splitting to do.  That can save a lot of AST verbosity for
                 // a bunch of memberwise copies.
                 // a bunch of memberwise copies.
-                if (isFinalFlattening(typeL) || (!isFlattenLeft && !isFlattenRight &&
-                                                 !typeL.containsBuiltInInterstageIO(language) && !typeR.containsBuiltInInterstageIO(language))) {
+                if ((!isFlattenLeft && !isFlattenRight &&
+                     !typeL.containsBuiltInInterstageIO(language) && !typeR.containsBuiltInInterstageIO(language))) {
                     assignList = intermediate.growAggregate(assignList, intermediate.addAssign(op, subSplitLeft, subSplitRight, loc), loc);
                     assignList = intermediate.growAggregate(assignList, intermediate.addAssign(op, subSplitLeft, subSplitRight, loc), loc);
                 } else {
                 } else {
                     traverse(subLeft, subRight, subSplitLeft, subSplitRight);
                     traverse(subLeft, subRight, subSplitLeft, subSplitRight);
@@ -2131,8 +2244,8 @@ TIntermTyped* HlslParseContext::handleAssign(const TSourceLoc& loc, TOperator op
                 memberR += (typeR.isBuiltInInterstageIO(language) ? 0 : 1);
                 memberR += (typeR.isBuiltInInterstageIO(language) ? 0 : 1);
             }
             }
         } else {
         } else {
-            assert(0);  // we should never be called on a non-flattenable thing, because
-                        // that case bails out above to a simple copy.
+            // Member copy
+            assignList = intermediate.growAggregate(assignList, intermediate.addAssign(op, left, right, loc), loc);
         }
         }
 
 
     };
     };
@@ -2272,6 +2385,9 @@ void HlslParseContext::decomposeStructBufferMethods(const TSourceLoc& loc, TInte
     if (argAggregate == nullptr)
     if (argAggregate == nullptr)
         return;
         return;
 
 
+    if (argAggregate->getSequence().empty())
+        return;
+
     // Buffer is the object upon which method is called, so always arg 0
     // Buffer is the object upon which method is called, so always arg 0
     TIntermTyped* bufferObj = argAggregate->getSequence()[0]->getAsTyped();
     TIntermTyped* bufferObj = argAggregate->getSequence()[0]->getAsTyped();
 
 
@@ -3747,7 +3863,9 @@ TIntermTyped* HlslParseContext::handleFunctionCall(const TSourceLoc& loc, TFunct
         // the symbol table for an arbitrary type.  This is a temporary hack until that ability exists.
         // the symbol table for an arbitrary type.  This is a temporary hack until that ability exists.
         // It will have false positives, since it doesn't check arg counts or types.
         // It will have false positives, since it doesn't check arg counts or types.
         if (arguments && arguments->getAsAggregate()) {
         if (arguments && arguments->getAsAggregate()) {
-            if (isStructBufferType(arguments->getAsAggregate()->getSequence()[0]->getAsTyped()->getType())) {
+            const TIntermSequence& sequence = arguments->getAsAggregate()->getSequence();
+
+            if (!sequence.empty() && isStructBufferType(sequence[0]->getAsTyped()->getType())) {
                 static const int methodPrefixSize = sizeof(BUILTIN_PREFIX)-1;
                 static const int methodPrefixSize = sizeof(BUILTIN_PREFIX)-1;
 
 
                 if (function->getName().length() > methodPrefixSize &&
                 if (function->getName().length() > methodPrefixSize &&
@@ -4173,6 +4291,10 @@ void HlslParseContext::handleSemantic(TSourceLoc loc, TQualifier& qualifier, TBu
     case EbvStencilRef:
     case EbvStencilRef:
         error(loc, "unimplemented; need ARB_shader_stencil_export", "SV_STENCILREF", "");
         error(loc, "unimplemented; need ARB_shader_stencil_export", "SV_STENCILREF", "");
         break;
         break;
+    case EbvTessLevelInner:
+    case EbvTessLevelOuter:
+        qualifier.patch = true;
+        break;
     default:
     default:
         break;
         break;
     }
     }
@@ -4285,6 +4407,18 @@ void HlslParseContext::handleRegister(const TSourceLoc& loc, TQualifier& qualifi
     }
     }
 }
 }
 
 
+// Convert to a scalar boolean, or if not allowed by HLSL semantics,
+// report an error and return nullptr.
+TIntermTyped* HlslParseContext::convertConditionalExpression(const TSourceLoc& loc, TIntermTyped* condition)
+{
+    if (!condition->getType().isScalarOrVec1()) {
+        error(loc, "requires a scalar", "conditional expression", "");
+        return nullptr;
+    }
+
+    return intermediate.addConversion(EOpConstructBool, TType(EbtBool), condition);
+}
+
 //
 //
 // Same error message for all places assignments don't work.
 // Same error message for all places assignments don't work.
 //
 //
@@ -4607,13 +4741,6 @@ bool HlslParseContext::voidErrorCheck(const TSourceLoc& loc, const TString& iden
     return false;
     return false;
 }
 }
 
 
-// Checks to see if the node (for the expression) contains a scalar boolean expression or not
-void HlslParseContext::boolCheck(const TSourceLoc& loc, const TIntermTyped* type)
-{
-    if (type->getBasicType() != EbtBool || type->isArray() || type->isMatrix() || type->isVector())
-        error(loc, "boolean expression expected", "", "");
-}
-
 //
 //
 // Fix just a full qualifier (no variables or types yet, but qualifier is complete) at global level.
 // Fix just a full qualifier (no variables or types yet, but qualifier is complete) at global level.
 //
 //
@@ -4759,7 +4886,7 @@ void HlslParseContext::arrayDimMerge(TType& type, const TArraySizes* sizes)
 // Do all the semantic checking for declaring or redeclaring an array, with and
 // Do all the semantic checking for declaring or redeclaring an array, with and
 // without a size, and make the right changes to the symbol table.
 // without a size, and make the right changes to the symbol table.
 //
 //
-void HlslParseContext::declareArray(const TSourceLoc& loc, TString& identifier, const TType& type, TSymbol*& symbol, bool track)
+void HlslParseContext::declareArray(const TSourceLoc& loc, const TString& identifier, const TType& type, TSymbol*& symbol, bool track)
 {
 {
     if (! symbol) {
     if (! symbol) {
         bool currentScope;
         bool currentScope;
@@ -4857,7 +4984,7 @@ void HlslParseContext::updateImplicitArraySize(const TSourceLoc& loc, TIntermNod
 //
 //
 // Enforce non-initializer type/qualifier rules.
 // Enforce non-initializer type/qualifier rules.
 //
 //
-void HlslParseContext::fixConstInit(const TSourceLoc& loc, TString& identifier, TType& type, TIntermTyped*& initializer)
+void HlslParseContext::fixConstInit(const TSourceLoc& loc, const TString& identifier, TType& type, TIntermTyped*& initializer)
 {
 {
     //
     //
     // Make the qualifier make sense, given that there is an initializer.
     // Make the qualifier make sense, given that there is an initializer.
@@ -5846,7 +5973,7 @@ const TFunction* HlslParseContext::findFunction(const TSourceLoc& loc, TFunction
 // 'parseType' is the type part of the declaration (to the left)
 // 'parseType' is the type part of the declaration (to the left)
 // 'arraySizes' is the arrayness tagged on the identifier (to the right)
 // 'arraySizes' is the arrayness tagged on the identifier (to the right)
 //
 //
-void HlslParseContext::declareTypedef(const TSourceLoc& loc, TString& identifier, const TType& parseType)
+void HlslParseContext::declareTypedef(const TSourceLoc& loc, const TString& identifier, const TType& parseType)
 {
 {
     TVariable* typeSymbol = new TVariable(&identifier, parseType, true);
     TVariable* typeSymbol = new TVariable(&identifier, parseType, true);
     if (! symbolTable.insert(*typeSymbol))
     if (! symbolTable.insert(*typeSymbol))
@@ -5977,7 +6104,7 @@ TSymbol* HlslParseContext::lookupUserType(const TString& typeName, TType& type)
 // 'parseType' is the type part of the declaration (to the left)
 // 'parseType' is the type part of the declaration (to the left)
 // 'arraySizes' is the arrayness tagged on the identifier (to the right)
 // 'arraySizes' is the arrayness tagged on the identifier (to the right)
 //
 //
-TIntermNode* HlslParseContext::declareVariable(const TSourceLoc& loc, TString& identifier, TType& type, TIntermTyped* initializer)
+TIntermNode* HlslParseContext::declareVariable(const TSourceLoc& loc, const TString& identifier, TType& type, TIntermTyped* initializer)
 {
 {
     if (voidErrorCheck(loc, identifier, type.getBasicType()))
     if (voidErrorCheck(loc, identifier, type.getBasicType()))
         return nullptr;
         return nullptr;
@@ -6079,7 +6206,7 @@ TVariable* HlslParseContext::makeInternalVariable(const char* name, const TType&
 //
 //
 // Return the successfully declared variable.
 // Return the successfully declared variable.
 //
 //
-TVariable* HlslParseContext::declareNonArray(const TSourceLoc& loc, TString& identifier, TType& type, bool track)
+TVariable* HlslParseContext::declareNonArray(const TSourceLoc& loc, const TString& identifier, const TType& type, bool track)
 {
 {
     // make a new variable
     // make a new variable
     TVariable* variable = new TVariable(&identifier, type);
     TVariable* variable = new TVariable(&identifier, type);
@@ -7132,15 +7259,15 @@ void HlslParseContext::popNamespace()
 
 
 // Use the class/struct nesting string to create a global name for
 // Use the class/struct nesting string to create a global name for
 // a member of a class/struct.
 // a member of a class/struct.
-TString* HlslParseContext::getFullNamespaceName(const TString& localName) const
+void HlslParseContext::getFullNamespaceName(const TString*& name) const
 {
 {
-    TString* name = NewPoolTString("");
-    if (currentTypePrefix.size() > 0)
-        name->append(currentTypePrefix.back());
-    name->append(scopeMangler);
-    name->append(localName);
+    if (currentTypePrefix.size() == 0)
+        return;
 
 
-    return name;
+    TString* fullName = NewPoolTString(currentTypePrefix.back().c_str());
+    fullName->append(scopeMangler);
+    fullName->append(*name);
+    name = fullName;
 }
 }
 
 
 // Helper function to add the namespace scope mangling syntax to a string.
 // Helper function to add the namespace scope mangling syntax to a string.
@@ -7150,7 +7277,7 @@ void HlslParseContext::addScopeMangler(TString& name)
 }
 }
 
 
 // Potentially rename shader entry point function
 // Potentially rename shader entry point function
-void HlslParseContext::renameShaderFunction(TString*& name) const
+void HlslParseContext::renameShaderFunction(const TString*& name) const
 {
 {
     // Replace the entry point name given in the shader with the real entry point name,
     // Replace the entry point name given in the shader with the real entry point name,
     // if there is a substitution.
     // if there is a substitution.
@@ -7215,6 +7342,8 @@ bool HlslParseContext::isInputBuiltIn(const TQualifier& qualifier) const
     case EbvTessLevelInner:
     case EbvTessLevelInner:
     case EbvTessLevelOuter:
     case EbvTessLevelOuter:
         return language == EShLangTessEvaluation;
         return language == EShLangTessEvaluation;
+    case EbvTessCoord:
+        return language == EShLangTessEvaluation;
     default:
     default:
         return false;
         return false;
     }
     }
@@ -7352,6 +7481,17 @@ void HlslParseContext::clearUniformInputOutput(TQualifier& qualifier)
     correctUniform(qualifier);
     correctUniform(qualifier);
 }
 }
 
 
+
+// Return a symbol for the linkage variable of the given TBuiltInVariable type
+TIntermSymbol* HlslParseContext::findLinkageSymbol(TBuiltInVariable biType) const
+{
+    const auto it = builtInLinkageSymbols.find(biType);
+    if (it == builtInLinkageSymbols.end())  // if it wasn't declared by the user, return nullptr
+        return nullptr;
+
+    return intermediate.addSymbol(*it->second->getAsVariable());
+}
+
 // Add patch constant function invocation
 // Add patch constant function invocation
 void HlslParseContext::addPatchConstantInvocation()
 void HlslParseContext::addPatchConstantInvocation()
 {
 {
@@ -7423,13 +7563,9 @@ void HlslParseContext::addPatchConstantInvocation()
         }
         }
     };
     };
 
 
-    // Return a symbol for the linkage variable of the given TBuiltInVariable type
-    const auto findLinkageSymbol = [this](TBuiltInVariable biType) -> TIntermSymbol* {
-        const auto it = builtInLinkageSymbols.find(biType);
-        if (it == builtInLinkageSymbols.end())  // if it wasn't declared by the user, return nullptr
-            return nullptr;
-
-        return intermediate.addSymbol(*it->second->getAsVariable());
+    const auto isPerCtrlPt = [this](const TType& type) {
+        // TODO: this is not sufficient to reject all such cases in malformed shaders.
+        return type.isArray() && !type.isRuntimeSizedArray();
     };
     };
     
     
     // We will perform these steps.  Each is in a scoped block for separation: they could
     // We will perform these steps.  Each is in a scoped block for separation: they could
@@ -7441,21 +7577,25 @@ void HlslParseContext::addPatchConstantInvocation()
     // 2. Synthesizes a call to the patchconstfunction using builtin variables from either main,
     // 2. Synthesizes a call to the patchconstfunction using builtin variables from either main,
     //    or the ones we created.  Matching is based on builtin type.  We may use synthesized
     //    or the ones we created.  Matching is based on builtin type.  We may use synthesized
     //    variables from (1) above.
     //    variables from (1) above.
+    // 
+    // 2B: Synthesize per control point invocations of wrapped entry point if the PCF requires them.
     //
     //
     // 3. Create a return sequence: copy the return value (if any) from the PCF to a
     // 3. Create a return sequence: copy the return value (if any) from the PCF to a
     //    (non-sanitized) output variable.  In case this may involve multiple copies, such as for
     //    (non-sanitized) output variable.  In case this may involve multiple copies, such as for
     //    an arrayed variable, a temporary copy of the PCF output is created to avoid multiple
     //    an arrayed variable, a temporary copy of the PCF output is created to avoid multiple
     //    indirections into a complex R-value coming from the call to the PCF.
     //    indirections into a complex R-value coming from the call to the PCF.
-    //
-    // 4. Add a barrier to the end of the entry point body
-    //
-    // 5. Call the PCF inside an if test for (invocation id == 0).
+    // 
+    // 4. Create a barrier.
+    // 
+    // 5/5B. Call the PCF inside an if test for (invocation id == 0).
 
 
     TFunction& patchConstantFunction = const_cast<TFunction&>(*candidateList[0]);
     TFunction& patchConstantFunction = const_cast<TFunction&>(*candidateList[0]);
     const int pcfParamCount = patchConstantFunction.getParamCount();
     const int pcfParamCount = patchConstantFunction.getParamCount();
     TIntermSymbol* invocationIdSym = findLinkageSymbol(EbvInvocationId);
     TIntermSymbol* invocationIdSym = findLinkageSymbol(EbvInvocationId);
     TIntermSequence& epBodySeq = entryPointFunctionBody->getAsAggregate()->getSequence();
     TIntermSequence& epBodySeq = entryPointFunctionBody->getAsAggregate()->getSequence();
 
 
+    int perCtrlPtParam = -1; // -1 means there isn't one.
+
     // ================ Step 1A: Union Interfaces ================
     // ================ Step 1A: Union Interfaces ================
     // Our patch constant function.
     // Our patch constant function.
     {
     {
@@ -7468,16 +7608,6 @@ void HlslParseContext::addPatchConstantInvocation()
         findBuiltIns(patchConstantFunction, pcfBuiltIns);
         findBuiltIns(patchConstantFunction, pcfBuiltIns);
         findBuiltIns(*entryPointFunction,   epfBuiltIns);
         findBuiltIns(*entryPointFunction,   epfBuiltIns);
 
 
-        // Patchconstantfunction can contain only builtin qualified variables.  (Technically, only HS inputs,
-        // but this test is less assertive than that).
-
-        for (auto bi = pcfBuiltIns.begin(); bi != pcfBuiltIns.end(); ++bi) {
-            if (bi->builtIn == EbvNone) {
-                error(loc, "patch constant function invalid parameter", "", "");
-                return;
-            }
-        }
-
         // Find the set of builtins in the PCF that are not present in the entry point.
         // Find the set of builtins in the PCF that are not present in the entry point.
         std::set<tInterstageIoData> notInEntryPoint;
         std::set<tInterstageIoData> notInEntryPoint;
 
 
@@ -7489,15 +7619,27 @@ void HlslParseContext::addPatchConstantInvocation()
 
 
         // Now we'll add those to the entry and to the linkage.
         // Now we'll add those to the entry and to the linkage.
         for (int p=0; p<pcfParamCount; ++p) {
         for (int p=0; p<pcfParamCount; ++p) {
-            TType* paramType = patchConstantFunction[p].type->clone();
             const TBuiltInVariable biType   = patchConstantFunction[p].declaredBuiltIn;
             const TBuiltInVariable biType   = patchConstantFunction[p].declaredBuiltIn;
             const TStorageQualifier storage = patchConstantFunction[p].type->getQualifier().storage;
             const TStorageQualifier storage = patchConstantFunction[p].type->getQualifier().storage;
 
 
-            // Use the original declaration type for the linkage
-            paramType->getQualifier().builtIn = biType;
+            // Track whether there is any per control point input
+            if (isPerCtrlPt(*patchConstantFunction[p].type)) {
+                if (perCtrlPtParam >= 0) {
+                    // Presently we only support one per ctrl pt input. TODO: does HLSL even allow multiple?
+                    error(loc, "unimplemented: multiple per control point inputs to patch constant function", "", "");
+                    return;
+                }
+                perCtrlPtParam = p;
+            }
+
+            if (biType != EbvNone) {
+                TType* paramType = patchConstantFunction[p].type->clone();
+                // Use the original declaration type for the linkage
+                paramType->getQualifier().builtIn = biType;
 
 
-            if (notInEntryPoint.count(tInterstageIoData(biType, storage)) == 1)
-                addToLinkage(*paramType, patchConstantFunction[p].name, nullptr);
+                if (notInEntryPoint.count(tInterstageIoData(biType, storage)) == 1)
+                    addToLinkage(*paramType, patchConstantFunction[p].name, nullptr);
+            }
         }
         }
 
 
         // If we didn't find it because the shader made one, add our own.
         // If we didn't find it because the shader made one, add our own.
@@ -7512,36 +7654,50 @@ void HlslParseContext::addPatchConstantInvocation()
     }
     }
 
 
     TIntermTyped* pcfArguments = nullptr;
     TIntermTyped* pcfArguments = nullptr;
+    TVariable* perCtrlPtVar = nullptr;
 
 
     // ================ Step 1B: Argument synthesis ================
     // ================ Step 1B: Argument synthesis ================
     // Create pcfArguments for synthesis of patchconstantfunction invocation
     // Create pcfArguments for synthesis of patchconstantfunction invocation
     // TODO: handle struct or array inputs
     // TODO: handle struct or array inputs
     {
     {
         for (int p=0; p<pcfParamCount; ++p) {
         for (int p=0; p<pcfParamCount; ++p) {
-            if (patchConstantFunction[p].type->isArray() ||
-                patchConstantFunction[p].type->isStruct()) {
+            if ((patchConstantFunction[p].type->isArray() && !isPerCtrlPt(*patchConstantFunction[p].type)) ||
+                (!patchConstantFunction[p].type->isArray() && patchConstantFunction[p].type->isStruct())) {
                 error(loc, "unimplemented array or variable in patch constant function signature", "", "");
                 error(loc, "unimplemented array or variable in patch constant function signature", "", "");
                 return;
                 return;
             }
             }
         
         
-            // find which builtin it is
-            const TBuiltInVariable biType = patchConstantFunction[p].declaredBuiltIn;
+            TIntermSymbol* inputArg = nullptr;
 
 
-            TIntermSymbol* builtIn = findLinkageSymbol(biType);
+            if (p == perCtrlPtParam) {
+                if (perCtrlPtVar == nullptr) {
+                    perCtrlPtVar = makeInternalVariable(*patchConstantFunction[perCtrlPtParam].name,
+                                                        *patchConstantFunction[perCtrlPtParam].type);
+
+                    perCtrlPtVar->getWritableType().getQualifier().makeTemporary();
+                }
+                inputArg = intermediate.addSymbol(*perCtrlPtVar, loc);
+            } else {
+                // find which builtin it is
+                const TBuiltInVariable biType = patchConstantFunction[p].declaredBuiltIn;
+                
+                inputArg = findLinkageSymbol(biType);
         
         
-            if (builtIn == nullptr) {
-                error(loc, "unable to find patch constant function builtin variable", "", "");
-                return;
+                if (inputArg == nullptr) {
+                    error(loc, "unable to find patch constant function builtin variable", "", "");
+                    return;
+                }
             }
             }
 
 
             if (pcfParamCount == 1)
             if (pcfParamCount == 1)
-                pcfArguments = builtIn;
+                pcfArguments = inputArg;
             else
             else
-                pcfArguments = intermediate.growAggregate(pcfArguments, builtIn);
+                pcfArguments = intermediate.growAggregate(pcfArguments, inputArg);
         }
         }
     }
     }
 
 
     // ================ Step 2: Synthesize call to PCF ================
     // ================ Step 2: Synthesize call to PCF ================
+    TIntermAggregate* pcfCallSequence = nullptr;
     TIntermTyped* pcfCall = nullptr;
     TIntermTyped* pcfCall = nullptr;
 
 
     {
     {
@@ -7553,7 +7709,8 @@ void HlslParseContext::addPatchConstantInvocation()
         pcfCall = intermediate.setAggregateOperator(pcfArguments, EOpFunctionCall, patchConstantFunction.getType(), loc);
         pcfCall = intermediate.setAggregateOperator(pcfArguments, EOpFunctionCall, patchConstantFunction.getType(), loc);
         pcfCall->getAsAggregate()->setUserDefined();
         pcfCall->getAsAggregate()->setUserDefined();
         pcfCall->getAsAggregate()->setName(patchConstantFunction.getMangledName());
         pcfCall->getAsAggregate()->setName(patchConstantFunction.getMangledName());
-        intermediate.addToCallGraph(infoSink, entryPointFunction->getMangledName(), patchConstantFunction.getMangledName());
+        intermediate.addToCallGraph(infoSink, intermediate.getEntryPointMangledName().c_str(),
+                                    patchConstantFunction.getMangledName());
 
 
         if (pcfCall->getAsAggregate()) {
         if (pcfCall->getAsAggregate()) {
             TQualifierList& qualifierList = pcfCall->getAsAggregate()->getQualifierList();
             TQualifierList& qualifierList = pcfCall->getAsAggregate()->getQualifierList();
@@ -7565,6 +7722,71 @@ void HlslParseContext::addPatchConstantInvocation()
         }
         }
     }
     }
 
 
+    // ================ Step 2B: Per Control Point synthesis ================
+    // If there is per control point data, we must either emulate that with multiple
+    // invocations of the entry point to build up an array, or (TODO:) use a yet
+    // unavailable extension to look across the SIMD lanes.  This is the former
+    // as a placeholder for the latter.
+    if (perCtrlPtParam >= 0) {
+        // We must introduce a local temp variable of the type wanted by the PCF input.
+        const int arraySize = patchConstantFunction[perCtrlPtParam].type->getOuterArraySize();
+
+        if (entryPointFunction->getType().getBasicType() == EbtVoid) {
+            error(loc, "entry point must return a value for use with patch constant function", "", "");
+            return;
+        }
+
+        // Create calls to wrapped main to fill in the array.  We will substitute fixed values
+        // of invocation ID when calling the wrapped main.
+
+        // This is the type of the each member of the per ctrl point array.
+        const TType derefType(perCtrlPtVar->getType(), 0);
+
+        for (int cpt = 0; cpt < arraySize; ++cpt) {
+            // TODO: improve.  substr(1) here is to avoid the '@' that was grafted on but isn't in the symtab
+            // for this function.
+            const TString origName = entryPointFunction->getName().substr(1);
+            TFunction callee(&origName, TType(EbtVoid));
+            TIntermTyped* callingArgs = nullptr;
+
+            for (int i = 0; i < entryPointFunction->getParamCount(); i++) {
+                TParameter& param = (*entryPointFunction)[i];
+                TType& paramType = *param.type;
+
+                if (paramType.getQualifier().isParamOutput()) {
+                    error(loc, "unimplemented: entry point outputs in patch constant function invocation", "", "");
+                    return;
+                }
+
+                if (paramType.getQualifier().isParamInput())  {
+                    TIntermTyped* arg = nullptr;
+                    if ((*entryPointFunction)[i].declaredBuiltIn == EbvInvocationId) {
+                        // substitute invocation ID with the array element ID
+                        arg = intermediate.addConstantUnion(cpt, loc);
+                    } else {
+                        TVariable* argVar = makeInternalVariable(*param.name, *param.type);
+                        argVar->getWritableType().getQualifier().makeTemporary();
+                        arg = intermediate.addSymbol(*argVar);
+                    }
+
+                    handleFunctionArgument(&callee, callingArgs, arg);
+                }
+            }
+
+            // Call and assign to per ctrl point variable
+            currentCaller = intermediate.getEntryPointMangledName().c_str();
+            TIntermTyped* callReturn = handleFunctionCall(loc, &callee, callingArgs);
+            TIntermTyped* index = intermediate.addConstantUnion(cpt, loc);
+            TIntermSymbol* perCtrlPtSym = intermediate.addSymbol(*perCtrlPtVar, loc);
+            TIntermTyped* element = intermediate.addIndex(EOpIndexDirect, perCtrlPtSym, index, loc);
+            element->setType(derefType);
+            element->setLoc(loc);
+
+            pcfCallSequence = intermediate.growAggregate(pcfCallSequence, 
+                                                         handleAssign(loc, EOpAssign, element, callReturn));
+        }
+    }
+
     // ================ Step 3: Create return Sequence ================
     // ================ Step 3: Create return Sequence ================
     // Return sequence: copy PCF result to a temporary, then to shader output variable.
     // Return sequence: copy PCF result to a temporary, then to shader output variable.
     if (pcfCall->getBasicType() != EbtVoid) {
     if (pcfCall->getBasicType() != EbtVoid) {
@@ -7581,30 +7803,31 @@ void HlslParseContext::addPatchConstantInvocation()
         if (patchConstantFunction.getDeclaredBuiltInType() != EbvNone)
         if (patchConstantFunction.getDeclaredBuiltInType() != EbvNone)
             outType.getQualifier().builtIn = patchConstantFunction.getDeclaredBuiltInType();
             outType.getQualifier().builtIn = patchConstantFunction.getDeclaredBuiltInType();
 
 
+        outType.getQualifier().patch = true; // make it a per-patch variable
+
         TVariable* pcfOutput = makeInternalVariable("@patchConstantOutput", outType);
         TVariable* pcfOutput = makeInternalVariable("@patchConstantOutput", outType);
         pcfOutput->getWritableType().getQualifier().storage = EvqVaryingOut;
         pcfOutput->getWritableType().getQualifier().storage = EvqVaryingOut;
 
 
         if (pcfOutput->getType().containsBuiltInInterstageIO(language))
         if (pcfOutput->getType().containsBuiltInInterstageIO(language))
             split(*pcfOutput);
             split(*pcfOutput);
 
 
+        assignLocations(*pcfOutput);
+
         TIntermSymbol* pcfOutputSym = intermediate.addSymbol(*pcfOutput, loc);
         TIntermSymbol* pcfOutputSym = intermediate.addSymbol(*pcfOutput, loc);
 
 
         // The call to the PCF is a complex R-value: we want to store it in a temp to avoid
         // The call to the PCF is a complex R-value: we want to store it in a temp to avoid
         // repeated calls to the PCF:
         // repeated calls to the PCF:
         TVariable* pcfCallResult = makeInternalVariable("@patchConstantResult", *retType);
         TVariable* pcfCallResult = makeInternalVariable("@patchConstantResult", *retType);
         pcfCallResult->getWritableType().getQualifier().makeTemporary();
         pcfCallResult->getWritableType().getQualifier().makeTemporary();
-        TIntermSymbol* pcfResultVar = intermediate.addSymbol(*pcfCallResult, loc);
-        // sanitizeType(&pcfCall->getWritableType());
-        TIntermNode* pcfResultAssign = intermediate.addAssign(EOpAssign, pcfResultVar, pcfCall, loc);
 
 
+        TIntermSymbol* pcfResultVar = intermediate.addSymbol(*pcfCallResult, loc);
+        TIntermNode* pcfResultAssign = handleAssign(loc, EOpAssign, pcfResultVar, pcfCall);
         TIntermNode* pcfResultToOut = handleAssign(loc, EOpAssign, pcfOutputSym, intermediate.addSymbol(*pcfCallResult, loc));
         TIntermNode* pcfResultToOut = handleAssign(loc, EOpAssign, pcfOutputSym, intermediate.addSymbol(*pcfCallResult, loc));
 
 
-        TIntermTyped* pcfAggregate = nullptr;
-        pcfAggregate = intermediate.growAggregate(pcfAggregate, pcfResultAssign);
-        pcfAggregate = intermediate.growAggregate(pcfAggregate, pcfResultToOut);
-        pcfAggregate = intermediate.setAggregateOperator(pcfAggregate, EOpSequence, *retType, loc);
-
-        pcfCall = pcfAggregate;
+        pcfCallSequence = intermediate.growAggregate(pcfCallSequence, pcfResultAssign);
+        pcfCallSequence = intermediate.growAggregate(pcfCallSequence, pcfResultToOut);
+    } else {
+        pcfCallSequence = intermediate.growAggregate(pcfCallSequence, pcfCall);
     }
     }
 
 
     // ================ Step 4: Barrier ================    
     // ================ Step 4: Barrier ================    
@@ -7613,12 +7836,14 @@ void HlslParseContext::addPatchConstantInvocation()
     barrier->setType(TType(EbtVoid));
     barrier->setType(TType(EbtVoid));
     epBodySeq.insert(epBodySeq.end(), barrier);
     epBodySeq.insert(epBodySeq.end(), barrier);
 
 
-    // ================ Step 5: Test on invocation ID ================    
+    // ================ Step 5: Test on invocation ID ================
     TIntermTyped* zero = intermediate.addConstantUnion(0, loc, true);
     TIntermTyped* zero = intermediate.addConstantUnion(0, loc, true);
     TIntermTyped* cmp =  intermediate.addBinaryNode(EOpEqual, invocationIdSym, zero, loc, TType(EbtBool));
     TIntermTyped* cmp =  intermediate.addBinaryNode(EOpEqual, invocationIdSym, zero, loc, TType(EbtBool));
 
 
-    // Create if statement
-    TIntermTyped* invocationIdTest = new TIntermSelection(cmp, pcfCall, nullptr);
+
+    // ================ Step 5B: Create if statement on Invocation ID == 0 ================
+    intermediate.setAggregateOperator(pcfCallSequence, EOpSequence, TType(EbtVoid), loc);
+    TIntermTyped* invocationIdTest = new TIntermSelection(cmp, pcfCallSequence, nullptr);
     invocationIdTest->setLoc(loc);
     invocationIdTest->setLoc(loc);
 
 
     // add our test sequence before the return.
     // add our test sequence before the return.

+ 15 - 10
3rdparty/glslang/hlsl/hlslParseHelper.h

@@ -80,6 +80,7 @@ public:
     void handleFunctionDeclarator(const TSourceLoc&, TFunction& function, bool prototype);
     void handleFunctionDeclarator(const TSourceLoc&, TFunction& function, bool prototype);
     TIntermAggregate* handleFunctionDefinition(const TSourceLoc&, TFunction&, const TAttributeMap&, TIntermNode*& entryPointTree);
     TIntermAggregate* handleFunctionDefinition(const TSourceLoc&, TFunction&, const TAttributeMap&, TIntermNode*& entryPointTree);
     TIntermNode* transformEntryPoint(const TSourceLoc&, TFunction&, const TAttributeMap&);
     TIntermNode* transformEntryPoint(const TSourceLoc&, TFunction&, const TAttributeMap&);
+    void handleEntryPointAttributes(const TSourceLoc&, const TAttributeMap&);
     void handleFunctionBody(const TSourceLoc&, TFunction&, TIntermNode* functionBody, TIntermNode*& node);
     void handleFunctionBody(const TSourceLoc&, TFunction&, TIntermNode* functionBody, TIntermNode*& node);
     void remapEntryPointIO(TFunction& function, TVariable*& returnValue, TVector<TVariable*>& inputs, TVector<TVariable*>& outputs);
     void remapEntryPointIO(TFunction& function, TVariable*& returnValue, TVector<TVariable*>& inputs, TVector<TVariable*>& outputs);
     void remapNonEntryPointIO(TFunction& function);
     void remapNonEntryPointIO(TFunction& function);
@@ -101,7 +102,7 @@ public:
                           const glslang::TString* component);
                           const glslang::TString* component);
     void handleRegister(const TSourceLoc&, TQualifier&, const glslang::TString* profile, const glslang::TString& desc,
     void handleRegister(const TSourceLoc&, TQualifier&, const glslang::TString* profile, const glslang::TString& desc,
                         int subComponent, const glslang::TString*);
                         int subComponent, const glslang::TString*);
-
+    TIntermTyped* convertConditionalExpression(const TSourceLoc&, TIntermTyped*);
     TIntermAggregate* handleSamplerTextureCombine(const TSourceLoc& loc, TIntermTyped* argTex, TIntermTyped* argSampler);
     TIntermAggregate* handleSamplerTextureCombine(const TSourceLoc& loc, TIntermTyped* argTex, TIntermTyped* argSampler);
 
 
     bool parseMatrixSwizzleSelector(const TSourceLoc&, const TString&, int cols, int rows, TSwizzleSelectors<TMatrixSelector>&);
     bool parseMatrixSwizzleSelector(const TSourceLoc&, const TString&, int cols, int rows, TSwizzleSelectors<TMatrixSelector>&);
@@ -120,7 +121,6 @@ public:
     void structArrayCheck(const TSourceLoc&, const TType& structure);
     void structArrayCheck(const TSourceLoc&, const TType& structure);
     void arrayDimMerge(TType& type, const TArraySizes* sizes);
     void arrayDimMerge(TType& type, const TArraySizes* sizes);
     bool voidErrorCheck(const TSourceLoc&, const TString&, TBasicType);
     bool voidErrorCheck(const TSourceLoc&, const TString&, TBasicType);
-    void boolCheck(const TSourceLoc&, const TIntermTyped*);
     void globalQualifierFix(const TSourceLoc&, TQualifier&);
     void globalQualifierFix(const TSourceLoc&, TQualifier&);
     bool structQualifierErrorCheck(const TSourceLoc&, const TPublicType& pType);
     bool structQualifierErrorCheck(const TSourceLoc&, const TPublicType& pType);
     void mergeQualifiers(TQualifier& dst, const TQualifier& src);
     void mergeQualifiers(TQualifier& dst, const TQualifier& src);
@@ -136,10 +136,10 @@ public:
     void checkNoShaderLayouts(const TSourceLoc&, const TShaderQualifiers&);
     void checkNoShaderLayouts(const TSourceLoc&, const TShaderQualifiers&);
 
 
     const TFunction* findFunction(const TSourceLoc& loc, TFunction& call, bool& builtIn, TIntermTyped*& args);
     const TFunction* findFunction(const TSourceLoc& loc, TFunction& call, bool& builtIn, TIntermTyped*& args);
-    void declareTypedef(const TSourceLoc&, TString& identifier, const TType&);
+    void declareTypedef(const TSourceLoc&, const TString& identifier, const TType&);
     void declareStruct(const TSourceLoc&, TString& structName, TType&);
     void declareStruct(const TSourceLoc&, TString& structName, TType&);
     TSymbol* lookupUserType(const TString&, TType&);
     TSymbol* lookupUserType(const TString&, TType&);
-    TIntermNode* declareVariable(const TSourceLoc&, TString& identifier, TType&, TIntermTyped* initializer = 0);
+    TIntermNode* declareVariable(const TSourceLoc&, const TString& identifier, TType&, TIntermTyped* initializer = 0);
     void lengthenList(const TSourceLoc&, TIntermSequence& list, int size);
     void lengthenList(const TSourceLoc&, TIntermSequence& list, int size);
     TIntermTyped* addConstructor(const TSourceLoc&, TIntermNode*, const TType&);
     TIntermTyped* addConstructor(const TSourceLoc&, TIntermNode*, const TType&);
     TIntermTyped* constructAggregate(TIntermNode*, const TType&, int, const TSourceLoc&);
     TIntermTyped* constructAggregate(TIntermNode*, const TType&, int, const TSourceLoc&);
@@ -173,13 +173,13 @@ public:
 
 
     void pushNamespace(const TString& name);
     void pushNamespace(const TString& name);
     void popNamespace();
     void popNamespace();
-    TString* getFullNamespaceName(const TString& localName) const;
+    void getFullNamespaceName(const TString*&) const;
     void addScopeMangler(TString&);
     void addScopeMangler(TString&);
 
 
     void pushSwitchSequence(TIntermSequence* sequence) { switchSequenceStack.push_back(sequence); }
     void pushSwitchSequence(TIntermSequence* sequence) { switchSequenceStack.push_back(sequence); }
     void popSwitchSequence() { switchSequenceStack.pop_back(); }
     void popSwitchSequence() { switchSequenceStack.pop_back(); }
 
 
-    virtual void growGlobalUniformBlock(TSourceLoc&, TType&, TString& memberName, TTypeList* typeList = nullptr) override;
+    virtual void growGlobalUniformBlock(const TSourceLoc&, TType&, const TString& memberName, TTypeList* typeList = nullptr) override;
 
 
     // Apply L-value conversions.  E.g, turning a write to a RWTexture into an ImageStore.
     // Apply L-value conversions.  E.g, turning a write to a RWTexture into an ImageStore.
     TIntermTyped* handleLvalue(const TSourceLoc&, const char* op, TIntermTyped* node);
     TIntermTyped* handleLvalue(const TSourceLoc&, const char* op, TIntermTyped* node);
@@ -191,7 +191,7 @@ public:
     bool handleInputGeometry(const TSourceLoc&, const TLayoutGeometry& geometry);
     bool handleInputGeometry(const TSourceLoc&, const TLayoutGeometry& geometry);
 
 
     // Potentially rename shader entry point function
     // Potentially rename shader entry point function
-    void renameShaderFunction(TString*& name) const;
+    void renameShaderFunction(const TString*& name) const;
 
 
     // Reset data for incrementally built referencing of flattened composite structures
     // Reset data for incrementally built referencing of flattened composite structures
     void initFlattening() { flattenLevel.push_back(0); flattenOffset.push_back(0); }
     void initFlattening() { flattenLevel.push_back(0); flattenOffset.push_back(0); }
@@ -210,14 +210,14 @@ protected:
         int                 nextBinding; // next binding to use.
         int                 nextBinding; // next binding to use.
     };
     };
 
 
-    void fixConstInit(const TSourceLoc&, TString& identifier, TType& type, TIntermTyped*& initializer);
+    void fixConstInit(const TSourceLoc&, const TString& identifier, TType& type, TIntermTyped*& initializer);
     void inheritGlobalDefaults(TQualifier& dst) const;
     void inheritGlobalDefaults(TQualifier& dst) const;
     TVariable* makeInternalVariable(const char* name, const TType&) const;
     TVariable* makeInternalVariable(const char* name, const TType&) const;
     TVariable* makeInternalVariable(const TString& name, const TType& type) const {
     TVariable* makeInternalVariable(const TString& name, const TType& type) const {
         return makeInternalVariable(name.c_str(), type);
         return makeInternalVariable(name.c_str(), type);
     }
     }
-    TVariable* declareNonArray(const TSourceLoc&, TString& identifier, TType&, bool track);
-    void declareArray(const TSourceLoc&, TString& identifier, const TType&, TSymbol*&, bool track);
+    TVariable* declareNonArray(const TSourceLoc&, const TString& identifier, const TType&, bool track);
+    void declareArray(const TSourceLoc&, const TString& identifier, const TType&, TSymbol*&, bool track);
     TIntermNode* executeInitializer(const TSourceLoc&, TIntermTyped* initializer, TVariable* variable);
     TIntermNode* executeInitializer(const TSourceLoc&, TIntermTyped* initializer, TVariable* variable);
     TIntermTyped* convertInitializerList(const TSourceLoc&, const TType&, TIntermTyped* initializer);
     TIntermTyped* convertInitializerList(const TSourceLoc&, const TType&, TIntermTyped* initializer);
     bool isZeroConstructor(const TIntermNode*);
     bool isZeroConstructor(const TIntermNode*);
@@ -248,6 +248,8 @@ protected:
     void addInterstageIoToLinkage();
     void addInterstageIoToLinkage();
     void addPatchConstantInvocation();
     void addPatchConstantInvocation();
 
 
+    void fixBuiltInArrayType(TType&);
+
     void flatten(const TSourceLoc& loc, const TVariable& variable);
     void flatten(const TSourceLoc& loc, const TVariable& variable);
     int flatten(const TSourceLoc& loc, const TVariable& variable, const TType&, TFlattenData&, TString name);
     int flatten(const TSourceLoc& loc, const TVariable& variable, const TType&, TFlattenData&, TString name);
     int flattenStruct(const TSourceLoc& loc, const TVariable& variable, const TType&, TFlattenData&, TString name);
     int flattenStruct(const TSourceLoc& loc, const TVariable& variable, const TType&, TFlattenData&, TString name);
@@ -281,6 +283,9 @@ protected:
 
 
     void finish() override; // post-processing
     void finish() override; // post-processing
 
 
+    // Linkage symbol helpers
+    TIntermSymbol* findLinkageSymbol(TBuiltInVariable biType) const;
+
     // Current state of parsing
     // Current state of parsing
     struct TPragma contextPragma;
     struct TPragma contextPragma;
     int loopNestingLevel;        // 0 if outside all loops
     int loopNestingLevel;        // 0 if outside all loops

+ 2 - 2
3rdparty/glslang/hlsl/hlslParseables.cpp

@@ -359,7 +359,7 @@ inline bool IsValid(const char* cname, char retOrder, char retType, char argOrde
     const std::string name(cname);
     const std::string name(cname);
 
 
     // these do not have vec1 versions
     // these do not have vec1 versions
-    if (dim0 == 1 && (name == "length" || name == "normalize" || name == "reflect" || name == "refract"))
+    if (dim0 == 1 && (name == "normalize" || name == "reflect" || name == "refract"))
         return false;
         return false;
 
 
     if (!IsTextureType(argOrder) && (isVec && dim0 == 1)) // avoid vec1
     if (!IsTextureType(argOrder) && (isVec && dim0 == 1)) // avoid vec1
@@ -625,7 +625,7 @@ void TBuiltInParseablesHlsl::initialize(int /*version*/, EProfile /*profile*/, c
         { "isinf",                            nullptr, "B" ,      "SVM",            "F",             EShLangAll,    false },
         { "isinf",                            nullptr, "B" ,      "SVM",            "F",             EShLangAll,    false },
         { "isnan",                            nullptr, "B" ,      "SVM",            "F",             EShLangAll,    false },
         { "isnan",                            nullptr, "B" ,      "SVM",            "F",             EShLangAll,    false },
         { "ldexp",                            nullptr, nullptr,   "SVM,",           "F,",            EShLangAll,    false },
         { "ldexp",                            nullptr, nullptr,   "SVM,",           "F,",            EShLangAll,    false },
-        { "length",                           "S",     "F",       "V",              "F",             EShLangAll,    false },
+        { "length",                           "S",     "F",       "SV",             "F",             EShLangAll,    false },
         { "lerp",                             nullptr, nullptr,   "VM,,",           "F,,",           EShLangAll,    false },
         { "lerp",                             nullptr, nullptr,   "VM,,",           "F,,",           EShLangAll,    false },
         { "lerp",                             nullptr, nullptr,   "SVM,,S",         "F,,",           EShLangAll,    false },
         { "lerp",                             nullptr, nullptr,   "SVM,,S",         "F,,",           EShLangAll,    false },
         { "lit",                              "V4",    "F",       "S,,",            "F,,",           EShLangAll,    false },
         { "lit",                              "V4",    "F",       "S,,",            "F,,",           EShLangAll,    false },

+ 2 - 0
3rdparty/glslang/hlsl/hlslScanContext.cpp

@@ -334,6 +334,7 @@ void HlslScanContext::fillInKeywordMap()
     (*KeywordMap)["tbuffer"] =                 EHTokTBuffer;
     (*KeywordMap)["tbuffer"] =                 EHTokTBuffer;
     (*KeywordMap)["typedef"] =                 EHTokTypedef;
     (*KeywordMap)["typedef"] =                 EHTokTypedef;
     (*KeywordMap)["this"] =                    EHTokThis;
     (*KeywordMap)["this"] =                    EHTokThis;
+    (*KeywordMap)["namespace"] =               EHTokNamespace;
 
 
     (*KeywordMap)["true"] =                    EHTokBoolConstant;
     (*KeywordMap)["true"] =                    EHTokBoolConstant;
     (*KeywordMap)["false"] =                   EHTokBoolConstant;
     (*KeywordMap)["false"] =                   EHTokBoolConstant;
@@ -828,6 +829,7 @@ EHlslTokenClass HlslScanContext::tokenizeIdentifier()
     case EHTokCBuffer:
     case EHTokCBuffer:
     case EHTokTBuffer:
     case EHTokTBuffer:
     case EHTokThis:
     case EHTokThis:
+    case EHTokNamespace:
         return keyword;
         return keyword;
 
 
     case EHTokBoolConstant:
     case EHTokBoolConstant:

+ 1 - 0
3rdparty/glslang/hlsl/hlslTokens.h

@@ -274,6 +274,7 @@ enum EHlslTokenClass {
     EHTokTBuffer,
     EHTokTBuffer,
     EHTokTypedef,
     EHTokTypedef,
     EHTokThis,
     EHTokThis,
+    EHTokNamespace,
 
 
     // constant
     // constant
     EHTokFloatConstant,
     EHTokFloatConstant,

Some files were not shown because too many files changed in this diff