Pārlūkot izejas kodu

Updated glslang.

Branimir Karadžić 8 gadi atpakaļ
vecāks
revīzija
5c8c145fd8
59 mainītis faili ar 2104 papildinājumiem un 694 dzēšanām
  1. 42 5
      3rdparty/glslang/SPIRV/GlslangToSpv.cpp
  2. 694 0
      3rdparty/glslang/Test/baseResults/hlsl.constructimat.frag.out
  3. 119 0
      3rdparty/glslang/Test/baseResults/hlsl.function.frag.out
  4. 100 111
      3rdparty/glslang/Test/baseResults/hlsl.implicitBool.frag.out
  5. 86 111
      3rdparty/glslang/Test/baseResults/hlsl.isfinite.frag.out
  6. 67 78
      3rdparty/glslang/Test/baseResults/hlsl.logical.binary.frag.out
  7. 53 64
      3rdparty/glslang/Test/baseResults/hlsl.logical.binary.vec.frag.out
  8. 87 85
      3rdparty/glslang/Test/baseResults/hlsl.structbuffer.frag.out
  9. 228 0
      3rdparty/glslang/Test/baseResults/hlsl.tx.overload.frag.out
  10. 1 0
      3rdparty/glslang/Test/baseResults/remap.uniformarray.everything.frag.out
  11. 1 0
      3rdparty/glslang/Test/baseResults/remap.uniformarray.none.frag.out
  12. 1 0
      3rdparty/glslang/Test/baseResults/spv.always-discard.frag.out
  13. 1 0
      3rdparty/glslang/Test/baseResults/spv.always-discard2.frag.out
  14. 13 13
      3rdparty/glslang/Test/baseResults/spv.boolInBlock.frag.out
  15. 1 0
      3rdparty/glslang/Test/baseResults/spv.conditionalDiscard.frag.out
  16. 1 0
      3rdparty/glslang/Test/baseResults/spv.conversion.frag.out
  17. 1 0
      3rdparty/glslang/Test/baseResults/spv.deepRvalue.frag.out
  18. 1 0
      3rdparty/glslang/Test/baseResults/spv.discard-dce.frag.out
  19. 1 0
      3rdparty/glslang/Test/baseResults/spv.doWhileLoop.frag.out
  20. 1 0
      3rdparty/glslang/Test/baseResults/spv.earlyReturnDiscard.frag.out
  21. 1 0
      3rdparty/glslang/Test/baseResults/spv.flowControl.frag.out
  22. 1 0
      3rdparty/glslang/Test/baseResults/spv.forLoop.frag.out
  23. 1 0
      3rdparty/glslang/Test/baseResults/spv.forwardFun.frag.out
  24. 1 0
      3rdparty/glslang/Test/baseResults/spv.functionCall.frag.out
  25. 1 0
      3rdparty/glslang/Test/baseResults/spv.functionSemantics.frag.out
  26. 1 0
      3rdparty/glslang/Test/baseResults/spv.glFragColor.frag.out
  27. 1 0
      3rdparty/glslang/Test/baseResults/spv.length.frag.out
  28. 1 0
      3rdparty/glslang/Test/baseResults/spv.localAggregates.frag.out
  29. 1 0
      3rdparty/glslang/Test/baseResults/spv.loops.frag.out
  30. 1 0
      3rdparty/glslang/Test/baseResults/spv.loopsArtificial.frag.out
  31. 198 194
      3rdparty/glslang/Test/baseResults/spv.multiStruct.comp.out
  32. 4 1
      3rdparty/glslang/Test/baseResults/spv.noLocation.vert.out
  33. 1 0
      3rdparty/glslang/Test/baseResults/spv.prepost.frag.out
  34. 1 0
      3rdparty/glslang/Test/baseResults/spv.simpleFunctionCall.frag.out
  35. 1 0
      3rdparty/glslang/Test/baseResults/spv.structAssignment.frag.out
  36. 1 0
      3rdparty/glslang/Test/baseResults/spv.structDeref.frag.out
  37. 1 0
      3rdparty/glslang/Test/baseResults/spv.structure.frag.out
  38. 1 0
      3rdparty/glslang/Test/baseResults/spv.swizzle.frag.out
  39. 1 0
      3rdparty/glslang/Test/baseResults/spv.test.frag.out
  40. 1 0
      3rdparty/glslang/Test/baseResults/spv.texture.frag.out
  41. 1 0
      3rdparty/glslang/Test/baseResults/spv.types.frag.out
  42. 1 0
      3rdparty/glslang/Test/baseResults/spv.uniformArray.frag.out
  43. 1 0
      3rdparty/glslang/Test/baseResults/spv.variableArrayIndex.frag.out
  44. 1 0
      3rdparty/glslang/Test/baseResults/spv.varyingArray.frag.out
  45. 1 0
      3rdparty/glslang/Test/baseResults/spv.varyingArrayIndirect.frag.out
  46. 1 0
      3rdparty/glslang/Test/baseResults/spv.voidFunction.frag.out
  47. 1 0
      3rdparty/glslang/Test/baseResults/spv.whileLoop.frag.out
  48. 52 0
      3rdparty/glslang/Test/hlsl.constructimat.frag
  49. 25 0
      3rdparty/glslang/Test/hlsl.function.frag
  50. 17 0
      3rdparty/glslang/Test/hlsl.tx.overload.frag
  51. 27 2
      3rdparty/glslang/Test/spv.noLocation.vert
  52. 27 0
      3rdparty/glslang/glslang/Include/intermediate.h
  53. 9 1
      3rdparty/glslang/glslang/MachineIndependent/Initialize.cpp
  54. 105 18
      3rdparty/glslang/glslang/MachineIndependent/Intermediate.cpp
  55. 12 5
      3rdparty/glslang/glslang/MachineIndependent/ParseHelper.cpp
  56. 8 0
      3rdparty/glslang/glslang/MachineIndependent/SymbolTable.cpp
  57. 27 0
      3rdparty/glslang/glslang/MachineIndependent/intermOut.cpp
  58. 3 0
      3rdparty/glslang/gtests/Hlsl.FromFile.cpp
  59. 66 6
      3rdparty/glslang/hlsl/hlslParseHelper.cpp

+ 42 - 5
3rdparty/glslang/SPIRV/GlslangToSpv.cpp

@@ -1528,6 +1528,33 @@ bool TGlslangToSpvTraverser::visitAggregate(glslang::TVisit visit, glslang::TInt
     case glslang::EOpConstructDMat4x2:
     case glslang::EOpConstructDMat4x3:
     case glslang::EOpConstructDMat4x4:
+    case glslang::EOpConstructIMat2x2:
+    case glslang::EOpConstructIMat2x3:
+    case glslang::EOpConstructIMat2x4:
+    case glslang::EOpConstructIMat3x2:
+    case glslang::EOpConstructIMat3x3:
+    case glslang::EOpConstructIMat3x4:
+    case glslang::EOpConstructIMat4x2:
+    case glslang::EOpConstructIMat4x3:
+    case glslang::EOpConstructIMat4x4:
+    case glslang::EOpConstructUMat2x2:
+    case glslang::EOpConstructUMat2x3:
+    case glslang::EOpConstructUMat2x4:
+    case glslang::EOpConstructUMat3x2:
+    case glslang::EOpConstructUMat3x3:
+    case glslang::EOpConstructUMat3x4:
+    case glslang::EOpConstructUMat4x2:
+    case glslang::EOpConstructUMat4x3:
+    case glslang::EOpConstructUMat4x4:
+    case glslang::EOpConstructBMat2x2:
+    case glslang::EOpConstructBMat2x3:
+    case glslang::EOpConstructBMat2x4:
+    case glslang::EOpConstructBMat3x2:
+    case glslang::EOpConstructBMat3x3:
+    case glslang::EOpConstructBMat3x4:
+    case glslang::EOpConstructBMat4x2:
+    case glslang::EOpConstructBMat4x3:
+    case glslang::EOpConstructBMat4x4:
 #ifdef AMD_EXTENSIONS
     case glslang::EOpConstructF16Mat2x2:
     case glslang::EOpConstructF16Mat2x3:
@@ -2591,19 +2618,24 @@ void TGlslangToSpvTraverser::accessChainStore(const glslang::TType& type, spv::I
             // Conversion for bool
             spv::Id boolType = builder.makeBoolType();
             if (nominalTypeId != boolType) {
+                // keep these outside arguments, for determinant order-of-evaluation
+                spv::Id one = builder.makeUintConstant(1);
                 spv::Id zero = builder.makeUintConstant(0);
-                spv::Id one  = builder.makeUintConstant(1);
                 rvalue = builder.createTriOp(spv::OpSelect, nominalTypeId, rvalue, one, zero);
-            }
+            } else if (builder.getTypeId(rvalue) != boolType)
+                rvalue = builder.createBinOp(spv::OpINotEqual, boolType, rvalue, builder.makeUintConstant(0));
         } else if (builder.isVectorType(nominalTypeId)) {
             // Conversion for bvec
             int vecSize = builder.getNumTypeComponents(nominalTypeId);
             spv::Id bvecType = builder.makeVectorType(builder.makeBoolType(), vecSize);
             if (nominalTypeId != bvecType) {
+                // keep these outside arguments, for determinant order-of-evaluation
+                spv::Id one = makeSmearedConstant(builder.makeUintConstant(1), vecSize);
                 spv::Id zero = makeSmearedConstant(builder.makeUintConstant(0), vecSize);
-                spv::Id one  = makeSmearedConstant(builder.makeUintConstant(1), vecSize);
                 rvalue = builder.createTriOp(spv::OpSelect, nominalTypeId, rvalue, one, zero);
-            }
+            } else if (builder.getTypeId(rvalue) != bvecType)
+                rvalue = builder.createBinOp(spv::OpINotEqual, bvecType, rvalue,
+                                             makeSmearedConstant(builder.makeUintConstant(0), vecSize));
         }
     }
 
@@ -5356,13 +5388,18 @@ bool TGlslangToSpvTraverser::isTrivialLeaf(const glslang::TIntermTyped* node)
 }
 
 // A node is trivial if it is a single operation with no side effects.
-// Error on the side of saying non-trivial.
+// HLSL (and/or vectors) are always trivial, as it does not short circuit.
+// Otherwise, error on the side of saying non-trivial.
 // Return true if trivial.
 bool TGlslangToSpvTraverser::isTrivial(const glslang::TIntermTyped* node)
 {
     if (node == nullptr)
         return false;
 
+    // count non scalars as trivial, as well as anything coming from HLSL
+    if (! node->getType().isScalarOrVec1() || glslangIntermediate->getSource() == glslang::EShSourceHlsl)
+        return true;
+
     // symbols and constants are trivial
     if (isTrivialLeaf(node))
         return true;

+ 694 - 0
3rdparty/glslang/Test/baseResults/hlsl.constructimat.frag.out

@@ -0,0 +1,694 @@
+hlsl.constructimat.frag
+Shader version: 500
+gl_FragCoord origin is upper left
+0:? Sequence
+0:2  Function Definition: @main( ( temp int)
+0:2    Function Parameters: 
+0:?     Sequence
+0:6      Sequence
+0:6        move second child to first child ( temp 4X4 matrix of int)
+0:6          'var443' ( temp 4X4 matrix of int)
+0:6          Constant:
+0:6            0 (const int)
+0:6            1 (const int)
+0:6            0 (const int)
+0:6            0 (const int)
+0:6            1 (const int)
+0:6            1 (const int)
+0:6            0 (const int)
+0:6            0 (const int)
+0:6            1 (const int)
+0:6            0 (const int)
+0:6            0 (const int)
+0:6            0 (const int)
+0:6            0 (const int)
+0:6            0 (const int)
+0:6            0 (const int)
+0:6            0 (const int)
+0:7      Sequence
+0:7        move second child to first child ( temp 4X4 matrix of int)
+0:7          'var444' ( temp 4X4 matrix of int)
+0:?           Constant:
+0:?             0 (const int)
+0:?             1 (const int)
+0:?             0 (const int)
+0:?             0 (const int)
+0:?             1 (const int)
+0:?             1 (const int)
+0:?             0 (const int)
+0:?             0 (const int)
+0:?             1 (const int)
+0:?             0 (const int)
+0:?             0 (const int)
+0:?             0 (const int)
+0:?             0 (const int)
+0:?             0 (const int)
+0:?             0 (const int)
+0:?             0 (const int)
+0:11      Sequence
+0:11        move second child to first child ( temp 4X2 matrix of int)
+0:11          'var423' ( temp 4X2 matrix of int)
+0:11          Constant:
+0:11            0 (const int)
+0:11            1 (const int)
+0:11            1 (const int)
+0:11            1 (const int)
+0:11            1 (const int)
+0:11            0 (const int)
+0:11            0 (const int)
+0:11            0 (const int)
+0:12      Sequence
+0:12        move second child to first child ( temp 4X2 matrix of int)
+0:12          'var424' ( temp 4X2 matrix of int)
+0:?           Constant:
+0:?             0 (const int)
+0:?             1 (const int)
+0:?             1 (const int)
+0:?             1 (const int)
+0:?             1 (const int)
+0:?             0 (const int)
+0:?             0 (const int)
+0:?             0 (const int)
+0:16      Sequence
+0:16        move second child to first child ( temp 3X2 matrix of int)
+0:16          'var323' ( temp 3X2 matrix of int)
+0:16          Constant:
+0:16            0 (const int)
+0:16            1 (const int)
+0:16            1 (const int)
+0:16            1 (const int)
+0:16            1 (const int)
+0:16            0 (const int)
+0:17      Sequence
+0:17        move second child to first child ( temp 3X2 matrix of int)
+0:17          'var234' ( temp 3X2 matrix of int)
+0:?           Constant:
+0:?             0 (const int)
+0:?             1 (const int)
+0:?             1 (const int)
+0:?             1 (const int)
+0:?             1 (const int)
+0:?             0 (const int)
+0:22      Sequence
+0:22        move second child to first child ( temp 4X4 matrix of uint)
+0:22          'uvar443' ( temp 4X4 matrix of uint)
+0:22          Constant:
+0:22            0 (const uint)
+0:22            1 (const uint)
+0:22            0 (const uint)
+0:22            0 (const uint)
+0:22            1 (const uint)
+0:22            1 (const uint)
+0:22            0 (const uint)
+0:22            0 (const uint)
+0:22            1 (const uint)
+0:22            0 (const uint)
+0:22            0 (const uint)
+0:22            0 (const uint)
+0:22            0 (const uint)
+0:22            0 (const uint)
+0:22            0 (const uint)
+0:22            0 (const uint)
+0:23      Sequence
+0:23        move second child to first child ( temp 4X4 matrix of uint)
+0:23          'uvar444' ( temp 4X4 matrix of uint)
+0:?           Constant:
+0:?             0 (const uint)
+0:?             1 (const uint)
+0:?             0 (const uint)
+0:?             0 (const uint)
+0:?             1 (const uint)
+0:?             1 (const uint)
+0:?             0 (const uint)
+0:?             0 (const uint)
+0:?             1 (const uint)
+0:?             0 (const uint)
+0:?             0 (const uint)
+0:?             0 (const uint)
+0:?             0 (const uint)
+0:?             0 (const uint)
+0:?             0 (const uint)
+0:?             0 (const uint)
+0:27      Sequence
+0:27        move second child to first child ( temp 4X2 matrix of uint)
+0:27          'uvar423' ( temp 4X2 matrix of uint)
+0:27          Constant:
+0:27            0 (const uint)
+0:27            1 (const uint)
+0:27            1 (const uint)
+0:27            1 (const uint)
+0:27            1 (const uint)
+0:27            0 (const uint)
+0:27            0 (const uint)
+0:27            0 (const uint)
+0:28      Sequence
+0:28        move second child to first child ( temp 4X2 matrix of uint)
+0:28          'uvar424' ( temp 4X2 matrix of uint)
+0:?           Constant:
+0:?             0 (const uint)
+0:?             1 (const uint)
+0:?             1 (const uint)
+0:?             1 (const uint)
+0:?             1 (const uint)
+0:?             0 (const uint)
+0:?             0 (const uint)
+0:?             0 (const uint)
+0:32      Sequence
+0:32        move second child to first child ( temp 3X2 matrix of uint)
+0:32          'uvar323' ( temp 3X2 matrix of uint)
+0:32          Constant:
+0:32            0 (const uint)
+0:32            1 (const uint)
+0:32            1 (const uint)
+0:32            1 (const uint)
+0:32            1 (const uint)
+0:32            0 (const uint)
+0:33      Sequence
+0:33        move second child to first child ( temp 3X2 matrix of uint)
+0:33          'uvar234' ( temp 3X2 matrix of uint)
+0:?           Constant:
+0:?             0 (const uint)
+0:?             1 (const uint)
+0:?             1 (const uint)
+0:?             1 (const uint)
+0:?             1 (const uint)
+0:?             0 (const uint)
+0:38      Sequence
+0:38        move second child to first child ( temp 4X4 matrix of bool)
+0:38          'bvar443' ( temp 4X4 matrix of bool)
+0:38          Constant:
+0:38            false (const bool)
+0:38            true (const bool)
+0:38            false (const bool)
+0:38            false (const bool)
+0:38            true (const bool)
+0:38            true (const bool)
+0:38            false (const bool)
+0:38            false (const bool)
+0:38            true (const bool)
+0:38            false (const bool)
+0:38            false (const bool)
+0:38            false (const bool)
+0:38            false (const bool)
+0:38            false (const bool)
+0:38            false (const bool)
+0:38            false (const bool)
+0:39      Sequence
+0:39        move second child to first child ( temp 4X4 matrix of bool)
+0:39          'bvar444' ( temp 4X4 matrix of bool)
+0:?           Constant:
+0:?             false (const bool)
+0:?             true (const bool)
+0:?             false (const bool)
+0:?             false (const bool)
+0:?             true (const bool)
+0:?             true (const bool)
+0:?             false (const bool)
+0:?             false (const bool)
+0:?             true (const bool)
+0:?             false (const bool)
+0:?             false (const bool)
+0:?             false (const bool)
+0:?             false (const bool)
+0:?             false (const bool)
+0:?             false (const bool)
+0:?             false (const bool)
+0:43      Sequence
+0:43        move second child to first child ( temp 4X2 matrix of bool)
+0:43          'bvar423' ( temp 4X2 matrix of bool)
+0:43          Constant:
+0:43            false (const bool)
+0:43            true (const bool)
+0:43            true (const bool)
+0:43            true (const bool)
+0:43            true (const bool)
+0:43            false (const bool)
+0:43            false (const bool)
+0:43            false (const bool)
+0:44      Sequence
+0:44        move second child to first child ( temp 4X2 matrix of bool)
+0:44          'bvar424' ( temp 4X2 matrix of bool)
+0:?           Constant:
+0:?             false (const bool)
+0:?             true (const bool)
+0:?             true (const bool)
+0:?             true (const bool)
+0:?             true (const bool)
+0:?             false (const bool)
+0:?             false (const bool)
+0:?             false (const bool)
+0:48      Sequence
+0:48        move second child to first child ( temp 3X2 matrix of bool)
+0:48          'bvar323' ( temp 3X2 matrix of bool)
+0:48          Constant:
+0:48            false (const bool)
+0:48            true (const bool)
+0:48            true (const bool)
+0:48            true (const bool)
+0:48            true (const bool)
+0:48            false (const bool)
+0:49      Sequence
+0:49        move second child to first child ( temp 3X2 matrix of bool)
+0:49          'bvar234' ( temp 3X2 matrix of bool)
+0:?           Constant:
+0:?             false (const bool)
+0:?             true (const bool)
+0:?             true (const bool)
+0:?             true (const bool)
+0:?             true (const bool)
+0:?             false (const bool)
+0:51      Branch: Return with expression
+0:51        Constant:
+0:51          0 (const int)
+0:2  Function Definition: main( ( temp void)
+0:2    Function Parameters: 
+0:?     Sequence
+0:2      move second child to first child ( temp int)
+0:?         '@entryPointOutput' (layout( location=0) out int)
+0:2        Function Call: @main( ( temp int)
+0:?   Linker Objects
+0:?     '@entryPointOutput' (layout( location=0) out int)
+
+
+Linked fragment stage:
+
+
+Shader version: 500
+gl_FragCoord origin is upper left
+0:? Sequence
+0:2  Function Definition: @main( ( temp int)
+0:2    Function Parameters: 
+0:?     Sequence
+0:6      Sequence
+0:6        move second child to first child ( temp 4X4 matrix of int)
+0:6          'var443' ( temp 4X4 matrix of int)
+0:6          Constant:
+0:6            0 (const int)
+0:6            1 (const int)
+0:6            0 (const int)
+0:6            0 (const int)
+0:6            1 (const int)
+0:6            1 (const int)
+0:6            0 (const int)
+0:6            0 (const int)
+0:6            1 (const int)
+0:6            0 (const int)
+0:6            0 (const int)
+0:6            0 (const int)
+0:6            0 (const int)
+0:6            0 (const int)
+0:6            0 (const int)
+0:6            0 (const int)
+0:7      Sequence
+0:7        move second child to first child ( temp 4X4 matrix of int)
+0:7          'var444' ( temp 4X4 matrix of int)
+0:?           Constant:
+0:?             0 (const int)
+0:?             1 (const int)
+0:?             0 (const int)
+0:?             0 (const int)
+0:?             1 (const int)
+0:?             1 (const int)
+0:?             0 (const int)
+0:?             0 (const int)
+0:?             1 (const int)
+0:?             0 (const int)
+0:?             0 (const int)
+0:?             0 (const int)
+0:?             0 (const int)
+0:?             0 (const int)
+0:?             0 (const int)
+0:?             0 (const int)
+0:11      Sequence
+0:11        move second child to first child ( temp 4X2 matrix of int)
+0:11          'var423' ( temp 4X2 matrix of int)
+0:11          Constant:
+0:11            0 (const int)
+0:11            1 (const int)
+0:11            1 (const int)
+0:11            1 (const int)
+0:11            1 (const int)
+0:11            0 (const int)
+0:11            0 (const int)
+0:11            0 (const int)
+0:12      Sequence
+0:12        move second child to first child ( temp 4X2 matrix of int)
+0:12          'var424' ( temp 4X2 matrix of int)
+0:?           Constant:
+0:?             0 (const int)
+0:?             1 (const int)
+0:?             1 (const int)
+0:?             1 (const int)
+0:?             1 (const int)
+0:?             0 (const int)
+0:?             0 (const int)
+0:?             0 (const int)
+0:16      Sequence
+0:16        move second child to first child ( temp 3X2 matrix of int)
+0:16          'var323' ( temp 3X2 matrix of int)
+0:16          Constant:
+0:16            0 (const int)
+0:16            1 (const int)
+0:16            1 (const int)
+0:16            1 (const int)
+0:16            1 (const int)
+0:16            0 (const int)
+0:17      Sequence
+0:17        move second child to first child ( temp 3X2 matrix of int)
+0:17          'var234' ( temp 3X2 matrix of int)
+0:?           Constant:
+0:?             0 (const int)
+0:?             1 (const int)
+0:?             1 (const int)
+0:?             1 (const int)
+0:?             1 (const int)
+0:?             0 (const int)
+0:22      Sequence
+0:22        move second child to first child ( temp 4X4 matrix of uint)
+0:22          'uvar443' ( temp 4X4 matrix of uint)
+0:22          Constant:
+0:22            0 (const uint)
+0:22            1 (const uint)
+0:22            0 (const uint)
+0:22            0 (const uint)
+0:22            1 (const uint)
+0:22            1 (const uint)
+0:22            0 (const uint)
+0:22            0 (const uint)
+0:22            1 (const uint)
+0:22            0 (const uint)
+0:22            0 (const uint)
+0:22            0 (const uint)
+0:22            0 (const uint)
+0:22            0 (const uint)
+0:22            0 (const uint)
+0:22            0 (const uint)
+0:23      Sequence
+0:23        move second child to first child ( temp 4X4 matrix of uint)
+0:23          'uvar444' ( temp 4X4 matrix of uint)
+0:?           Constant:
+0:?             0 (const uint)
+0:?             1 (const uint)
+0:?             0 (const uint)
+0:?             0 (const uint)
+0:?             1 (const uint)
+0:?             1 (const uint)
+0:?             0 (const uint)
+0:?             0 (const uint)
+0:?             1 (const uint)
+0:?             0 (const uint)
+0:?             0 (const uint)
+0:?             0 (const uint)
+0:?             0 (const uint)
+0:?             0 (const uint)
+0:?             0 (const uint)
+0:?             0 (const uint)
+0:27      Sequence
+0:27        move second child to first child ( temp 4X2 matrix of uint)
+0:27          'uvar423' ( temp 4X2 matrix of uint)
+0:27          Constant:
+0:27            0 (const uint)
+0:27            1 (const uint)
+0:27            1 (const uint)
+0:27            1 (const uint)
+0:27            1 (const uint)
+0:27            0 (const uint)
+0:27            0 (const uint)
+0:27            0 (const uint)
+0:28      Sequence
+0:28        move second child to first child ( temp 4X2 matrix of uint)
+0:28          'uvar424' ( temp 4X2 matrix of uint)
+0:?           Constant:
+0:?             0 (const uint)
+0:?             1 (const uint)
+0:?             1 (const uint)
+0:?             1 (const uint)
+0:?             1 (const uint)
+0:?             0 (const uint)
+0:?             0 (const uint)
+0:?             0 (const uint)
+0:32      Sequence
+0:32        move second child to first child ( temp 3X2 matrix of uint)
+0:32          'uvar323' ( temp 3X2 matrix of uint)
+0:32          Constant:
+0:32            0 (const uint)
+0:32            1 (const uint)
+0:32            1 (const uint)
+0:32            1 (const uint)
+0:32            1 (const uint)
+0:32            0 (const uint)
+0:33      Sequence
+0:33        move second child to first child ( temp 3X2 matrix of uint)
+0:33          'uvar234' ( temp 3X2 matrix of uint)
+0:?           Constant:
+0:?             0 (const uint)
+0:?             1 (const uint)
+0:?             1 (const uint)
+0:?             1 (const uint)
+0:?             1 (const uint)
+0:?             0 (const uint)
+0:38      Sequence
+0:38        move second child to first child ( temp 4X4 matrix of bool)
+0:38          'bvar443' ( temp 4X4 matrix of bool)
+0:38          Constant:
+0:38            false (const bool)
+0:38            true (const bool)
+0:38            false (const bool)
+0:38            false (const bool)
+0:38            true (const bool)
+0:38            true (const bool)
+0:38            false (const bool)
+0:38            false (const bool)
+0:38            true (const bool)
+0:38            false (const bool)
+0:38            false (const bool)
+0:38            false (const bool)
+0:38            false (const bool)
+0:38            false (const bool)
+0:38            false (const bool)
+0:38            false (const bool)
+0:39      Sequence
+0:39        move second child to first child ( temp 4X4 matrix of bool)
+0:39          'bvar444' ( temp 4X4 matrix of bool)
+0:?           Constant:
+0:?             false (const bool)
+0:?             true (const bool)
+0:?             false (const bool)
+0:?             false (const bool)
+0:?             true (const bool)
+0:?             true (const bool)
+0:?             false (const bool)
+0:?             false (const bool)
+0:?             true (const bool)
+0:?             false (const bool)
+0:?             false (const bool)
+0:?             false (const bool)
+0:?             false (const bool)
+0:?             false (const bool)
+0:?             false (const bool)
+0:?             false (const bool)
+0:43      Sequence
+0:43        move second child to first child ( temp 4X2 matrix of bool)
+0:43          'bvar423' ( temp 4X2 matrix of bool)
+0:43          Constant:
+0:43            false (const bool)
+0:43            true (const bool)
+0:43            true (const bool)
+0:43            true (const bool)
+0:43            true (const bool)
+0:43            false (const bool)
+0:43            false (const bool)
+0:43            false (const bool)
+0:44      Sequence
+0:44        move second child to first child ( temp 4X2 matrix of bool)
+0:44          'bvar424' ( temp 4X2 matrix of bool)
+0:?           Constant:
+0:?             false (const bool)
+0:?             true (const bool)
+0:?             true (const bool)
+0:?             true (const bool)
+0:?             true (const bool)
+0:?             false (const bool)
+0:?             false (const bool)
+0:?             false (const bool)
+0:48      Sequence
+0:48        move second child to first child ( temp 3X2 matrix of bool)
+0:48          'bvar323' ( temp 3X2 matrix of bool)
+0:48          Constant:
+0:48            false (const bool)
+0:48            true (const bool)
+0:48            true (const bool)
+0:48            true (const bool)
+0:48            true (const bool)
+0:48            false (const bool)
+0:49      Sequence
+0:49        move second child to first child ( temp 3X2 matrix of bool)
+0:49          'bvar234' ( temp 3X2 matrix of bool)
+0:?           Constant:
+0:?             false (const bool)
+0:?             true (const bool)
+0:?             true (const bool)
+0:?             true (const bool)
+0:?             true (const bool)
+0:?             false (const bool)
+0:51      Branch: Return with expression
+0:51        Constant:
+0:51          0 (const int)
+0:2  Function Definition: main( ( temp void)
+0:2    Function Parameters: 
+0:?     Sequence
+0:2      move second child to first child ( temp int)
+0:?         '@entryPointOutput' (layout( location=0) out int)
+0:2        Function Call: @main( ( temp int)
+0:?   Linker Objects
+0:?     '@entryPointOutput' (layout( location=0) out int)
+
+// 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" 96
+                              ExecutionMode 4 OriginUpperLeft
+                              Source HLSL 500
+                              Name 4  "main"
+                              Name 8  "@main("
+                              Name 13  "var443"
+                              Name 21  "var444"
+                              Name 25  "var423"
+                              Name 31  "var424"
+                              Name 34  "var323"
+                              Name 36  "var234"
+                              Name 41  "uvar443"
+                              Name 49  "uvar444"
+                              Name 53  "uvar423"
+                              Name 59  "uvar424"
+                              Name 62  "uvar323"
+                              Name 64  "uvar234"
+                              Name 69  "bvar443"
+                              Name 77  "bvar444"
+                              Name 81  "bvar423"
+                              Name 87  "bvar424"
+                              Name 90  "bvar323"
+                              Name 92  "bvar234"
+                              Name 96  "@entryPointOutput"
+                              Decorate 96(@entryPointOutput) Location 0
+               2:             TypeVoid
+               3:             TypeFunction 2
+               6:             TypeInt 32 1
+               7:             TypeFunction 6(int)
+              10:             TypeVector 6(int) 4
+              11:             TypeMatrix 10(ivec4) 4
+              12:             TypePointer Function 11
+              14:      6(int) Constant 0
+              15:      6(int) Constant 1
+              16:   10(ivec4) ConstantComposite 14 15 14 14
+              17:   10(ivec4) ConstantComposite 15 15 14 14
+              18:   10(ivec4) ConstantComposite 15 14 14 14
+              19:   10(ivec4) ConstantComposite 14 14 14 14
+              20:          11 ConstantComposite 16 17 18 19
+              22:             TypeVector 6(int) 2
+              23:             TypeMatrix 22(ivec2) 4
+              24:             TypePointer Function 23
+              26:   22(ivec2) ConstantComposite 14 15
+              27:   22(ivec2) ConstantComposite 15 15
+              28:   22(ivec2) ConstantComposite 15 14
+              29:   22(ivec2) ConstantComposite 14 14
+              30:          23 ConstantComposite 26 27 28 29
+              32:             TypeMatrix 22(ivec2) 3
+              33:             TypePointer Function 32
+              35:          32 ConstantComposite 26 27 28
+              37:             TypeInt 32 0
+              38:             TypeVector 37(int) 4
+              39:             TypeMatrix 38(ivec4) 4
+              40:             TypePointer Function 39
+              42:     37(int) Constant 0
+              43:     37(int) Constant 1
+              44:   38(ivec4) ConstantComposite 42 43 42 42
+              45:   38(ivec4) ConstantComposite 43 43 42 42
+              46:   38(ivec4) ConstantComposite 43 42 42 42
+              47:   38(ivec4) ConstantComposite 42 42 42 42
+              48:          39 ConstantComposite 44 45 46 47
+              50:             TypeVector 37(int) 2
+              51:             TypeMatrix 50(ivec2) 4
+              52:             TypePointer Function 51
+              54:   50(ivec2) ConstantComposite 42 43
+              55:   50(ivec2) ConstantComposite 43 43
+              56:   50(ivec2) ConstantComposite 43 42
+              57:   50(ivec2) ConstantComposite 42 42
+              58:          51 ConstantComposite 54 55 56 57
+              60:             TypeMatrix 50(ivec2) 3
+              61:             TypePointer Function 60
+              63:          60 ConstantComposite 54 55 56
+              65:             TypeBool
+              66:             TypeVector 65(bool) 4
+              67:             TypeMatrix 66(bvec4) 4
+              68:             TypePointer Function 67
+              70:    65(bool) ConstantFalse
+              71:    65(bool) ConstantTrue
+              72:   66(bvec4) ConstantComposite 70 71 70 70
+              73:   66(bvec4) ConstantComposite 71 71 70 70
+              74:   66(bvec4) ConstantComposite 71 70 70 70
+              75:   66(bvec4) ConstantComposite 70 70 70 70
+              76:          67 ConstantComposite 72 73 74 75
+              78:             TypeVector 65(bool) 2
+              79:             TypeMatrix 78(bvec2) 4
+              80:             TypePointer Function 79
+              82:   78(bvec2) ConstantComposite 70 71
+              83:   78(bvec2) ConstantComposite 71 71
+              84:   78(bvec2) ConstantComposite 71 70
+              85:   78(bvec2) ConstantComposite 70 70
+              86:          79 ConstantComposite 82 83 84 85
+              88:             TypeMatrix 78(bvec2) 3
+              89:             TypePointer Function 88
+              91:          88 ConstantComposite 82 83 84
+              95:             TypePointer Output 6(int)
+96(@entryPointOutput):     95(ptr) Variable Output
+         4(main):           2 Function None 3
+               5:             Label
+              97:      6(int) FunctionCall 8(@main()
+                              Store 96(@entryPointOutput) 97
+                              Return
+                              FunctionEnd
+       8(@main():      6(int) Function None 7
+               9:             Label
+      13(var443):     12(ptr) Variable Function
+      21(var444):     12(ptr) Variable Function
+      25(var423):     24(ptr) Variable Function
+      31(var424):     24(ptr) Variable Function
+      34(var323):     33(ptr) Variable Function
+      36(var234):     33(ptr) Variable Function
+     41(uvar443):     40(ptr) Variable Function
+     49(uvar444):     40(ptr) Variable Function
+     53(uvar423):     52(ptr) Variable Function
+     59(uvar424):     52(ptr) Variable Function
+     62(uvar323):     61(ptr) Variable Function
+     64(uvar234):     61(ptr) Variable Function
+     69(bvar443):     68(ptr) Variable Function
+     77(bvar444):     68(ptr) Variable Function
+     81(bvar423):     80(ptr) Variable Function
+     87(bvar424):     80(ptr) Variable Function
+     90(bvar323):     89(ptr) Variable Function
+     92(bvar234):     89(ptr) Variable Function
+                              Store 13(var443) 20
+                              Store 21(var444) 20
+                              Store 25(var423) 30
+                              Store 31(var424) 30
+                              Store 34(var323) 35
+                              Store 36(var234) 35
+                              Store 41(uvar443) 48
+                              Store 49(uvar444) 48
+                              Store 53(uvar423) 58
+                              Store 59(uvar424) 58
+                              Store 62(uvar323) 63
+                              Store 64(uvar234) 63
+                              Store 69(bvar443) 76
+                              Store 77(bvar444) 76
+                              Store 81(bvar423) 86
+                              Store 87(bvar424) 86
+                              Store 90(bvar323) 91
+                              Store 92(bvar234) 91
+                              ReturnValue 14
+                              FunctionEnd

+ 119 - 0
3rdparty/glslang/Test/baseResults/hlsl.function.frag.out

@@ -0,0 +1,119 @@
+hlsl.function.frag
+ERROR: 0:24: 'fun1' : unknown variable 
+ERROR: 0:24: 'return' : type does not match, or is not convertible to, the function's return type 
+ERROR: 2 compilation errors.  No code generated.
+
+
+Shader version: 500
+gl_FragCoord origin is upper left
+ERROR: node is still EOpNull!
+0:2  Function Definition: fun0( ( temp 4-component vector of float)
+0:2    Function Parameters: 
+0:?     Sequence
+0:3      Branch: Return with expression
+0:3        Constant:
+0:3          1.000000
+0:3          1.000000
+0:3          1.000000
+0:3          1.000000
+0:7  Function Definition: fun2(vf4; ( temp uint)
+0:7    Function Parameters: 
+0:7      'col' ( in 4-component vector of float)
+0:?     Sequence
+0:8      Branch: Return with expression
+0:8        Constant:
+0:8          7 (const uint)
+0:12  Function Definition: fun4(u1;u1; ( temp 4-component vector of float)
+0:12    Function Parameters: 
+0:12      'id1' ( in uint)
+0:12      'id2' ( in uint)
+0:?     Sequence
+0:13      Branch: Return with expression
+0:13        Construct vec4 ( temp 4-component vector of float)
+0:13          Convert uint to float ( temp float)
+0:13            component-wise multiply ( temp uint)
+0:13              'id1' ( in uint)
+0:13              'id2' ( in uint)
+0:17  Function Definition: fun1(i1; ( temp 4-component vector of float)
+0:17    Function Parameters: 
+0:17      'index' ( in int)
+0:?     Sequence
+0:18      Sequence
+0:18        move second child to first child ( temp uint)
+0:18          'entityId' ( temp uint)
+0:18          Function Call: fun2(vf4; ( temp uint)
+0:18            Function Call: fun0( ( temp 4-component vector of float)
+0:19      Branch: Return with expression
+0:19        Function Call: fun4(u1;u1; ( temp 4-component vector of float)
+0:19          'entityId' ( temp uint)
+0:19          'entityId' ( temp uint)
+0:23  Function Definition: @main( ( temp int)
+0:23    Function Parameters: 
+0:23  Function Definition: main( ( temp void)
+0:23    Function Parameters: 
+0:?     Sequence
+0:23      move second child to first child ( temp int)
+0:?         '@entryPointOutput' (layout( location=0) out int)
+0:23        Function Call: @main( ( temp int)
+0:?   Linker Objects
+0:?     '@entryPointOutput' (layout( location=0) out int)
+
+
+Linked fragment stage:
+
+
+Shader version: 500
+gl_FragCoord origin is upper left
+ERROR: node is still EOpNull!
+0:2  Function Definition: fun0( ( temp 4-component vector of float)
+0:2    Function Parameters: 
+0:?     Sequence
+0:3      Branch: Return with expression
+0:3        Constant:
+0:3          1.000000
+0:3          1.000000
+0:3          1.000000
+0:3          1.000000
+0:7  Function Definition: fun2(vf4; ( temp uint)
+0:7    Function Parameters: 
+0:7      'col' ( in 4-component vector of float)
+0:?     Sequence
+0:8      Branch: Return with expression
+0:8        Constant:
+0:8          7 (const uint)
+0:12  Function Definition: fun4(u1;u1; ( temp 4-component vector of float)
+0:12    Function Parameters: 
+0:12      'id1' ( in uint)
+0:12      'id2' ( in uint)
+0:?     Sequence
+0:13      Branch: Return with expression
+0:13        Construct vec4 ( temp 4-component vector of float)
+0:13          Convert uint to float ( temp float)
+0:13            component-wise multiply ( temp uint)
+0:13              'id1' ( in uint)
+0:13              'id2' ( in uint)
+0:17  Function Definition: fun1(i1; ( temp 4-component vector of float)
+0:17    Function Parameters: 
+0:17      'index' ( in int)
+0:?     Sequence
+0:18      Sequence
+0:18        move second child to first child ( temp uint)
+0:18          'entityId' ( temp uint)
+0:18          Function Call: fun2(vf4; ( temp uint)
+0:18            Function Call: fun0( ( temp 4-component vector of float)
+0:19      Branch: Return with expression
+0:19        Function Call: fun4(u1;u1; ( temp 4-component vector of float)
+0:19          'entityId' ( temp uint)
+0:19          'entityId' ( temp uint)
+0:23  Function Definition: @main( ( temp int)
+0:23    Function Parameters: 
+0:23  Function Definition: main( ( temp void)
+0:23    Function Parameters: 
+0:?     Sequence
+0:23      move second child to first child ( temp int)
+0:?         '@entryPointOutput' (layout( location=0) out int)
+0:23        Function Call: @main( ( temp int)
+0:?   Linker Objects
+0:?     '@entryPointOutput' (layout( location=0) out int)
+
+SPIR-V is not generated for failed compile or link

+ 100 - 111
3rdparty/glslang/Test/baseResults/hlsl.implicitBool.frag.out

@@ -335,12 +335,12 @@ gl_FragCoord origin is upper left
 
 // Module Version 10000
 // Generated by (magic number): 80001
-// Id's are bound by 145
+// Id's are bound by 140
 
                               Capability Shader
                1:             ExtInstImport  "GLSL.std.450"
                               MemoryModel Logical GLSL450
-                              EntryPoint Fragment 4  "main" 143
+                              EntryPoint Fragment 4  "main" 138
                               ExecutionMode 4 OriginUpperLeft
                               Source HLSL 500
                               Name 4  "main"
@@ -352,17 +352,17 @@ gl_FragCoord origin is upper left
                               MemberName 16($Global) 2  "condf1"
                               MemberName 16($Global) 3  "condi1"
                               Name 18  ""
-                              Name 93  "f"
-                              Name 106  "i"
-                              Name 126  "g"
-                              Name 143  "@entryPointOutput"
+                              Name 88  "f"
+                              Name 101  "i"
+                              Name 121  "g"
+                              Name 138  "@entryPointOutput"
                               MemberDecorate 16($Global) 0 Offset 0
                               MemberDecorate 16($Global) 1 Offset 4
                               MemberDecorate 16($Global) 2 Offset 8
                               MemberDecorate 16($Global) 3 Offset 12
                               Decorate 16($Global) Block
                               Decorate 18 DescriptorSet 0
-                              Decorate 143(@entryPointOutput) Location 0
+                              Decorate 138(@entryPointOutput) Location 0
                2:             TypeVoid
                3:             TypeFunction 2
                6:             TypeFloat 32
@@ -388,25 +388,25 @@ gl_FragCoord origin is upper left
               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
+              83:    6(float) Constant 1084227584
+              87:             TypePointer Function 6(float)
+             100:             TypePointer Function 15(int)
+             125:    6(float) Constant 1088421888
+             126:    6(float) Constant 1090519040
+             137:             TypePointer Output 7(fvec4)
+138(@entryPointOutput):    137(ptr) Variable Output
          4(main):           2 Function None 3
                5:             Label
-             144:    7(fvec4) FunctionCall 9(@main()
-                              Store 143(@entryPointOutput) 144
+             139:    7(fvec4) FunctionCall 9(@main()
+                              Store 138(@entryPointOutput) 139
                               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
+           88(f):     87(ptr) Variable Function
+          101(i):    100(ptr) Variable Function
+          121(g):     87(ptr) Variable Function
                               Store 12(a) 14
               21:     20(ptr) AccessChain 18 19
               22:     15(int) Load 21
@@ -455,98 +455,87 @@ gl_FragCoord origin is upper left
               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
+              71:     35(ptr) AccessChain 18 34
+              72:    6(float) Load 71
+              73:     15(int) ConvertFToS 72
+              74:    23(bool) INotEqual 73 25
+              75:    23(bool) LogicalAnd 70 74
+              76:     35(ptr) AccessChain 18 46
+              77:    6(float) Load 76
+              78:    23(bool) FOrdNotEqual 77 38
+              79:    23(bool) LogicalOr 75 78
+                              SelectionMerge 81 None
+                              BranchConditional 79 80 81
+              80:               Label
+              82:    7(fvec4)   Load 12(a)
+              84:    7(fvec4)   CompositeConstruct 83 83 83 83
+              85:    7(fvec4)   FAdd 82 84
+                                ReturnValue 85
+              81:             Label
+              89:     35(ptr) AccessChain 18 34
+              90:    6(float) Load 89
+                              Store 88(f) 90
+                              Branch 91
+              91:             Label
+                              LoopMerge 93 94 None
+                              Branch 95
+              95:             Label
+              96:    6(float) Load 88(f)
+              97:    23(bool) FOrdNotEqual 96 38
+                              BranchConditional 97 92 93
+              92:               Label
+              98:    6(float)   Load 88(f)
+              99:    6(float)   FSub 98 30
+                                Store 88(f) 99
+                                Branch 94
+              94:               Label
+                                Branch 91
+              93:             Label
+             102:     20(ptr) AccessChain 18 19
+             103:     15(int) Load 102
+                              Store 101(i) 103
+                              Branch 104
+             104:             Label
+                              LoopMerge 106 107 None
+                              Branch 105
+             105:             Label
+             108:     15(int) Load 101(i)
+             109:     15(int) ISub 108 19
+                              Store 101(i) 109
+                              Branch 107
+             107:             Label
+             110:     15(int) Load 101(i)
+             111:    23(bool) INotEqual 110 25
+                              BranchConditional 111 104 106
+             106:             Label
                               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
+                              LoopMerge 114 115 None
+                              Branch 116
+             116:             Label
+             117:     15(int) Load 101(i)
+             118:    23(bool) INotEqual 117 25
+                              BranchConditional 118 113 114
+             113:               Label
+             119:     15(int)   Load 101(i)
+             120:     15(int)   ISub 119 19
+                                Store 101(i) 120
+                                Branch 115
+             115:               Label
+                                Branch 112
+             114:             Label
+             122:     35(ptr) AccessChain 18 34
+             123:    6(float) Load 122
+             124:    23(bool) FOrdNotEqual 123 38
+             127:    6(float) Select 124 125 126
+                              Store 121(g) 127
+             128:    6(float) Load 121(g)
+             129:    7(fvec4) Load 12(a)
+             130:    7(fvec4) CompositeConstruct 128 128 128 128
+             131:    7(fvec4) FAdd 129 130
+                              Store 12(a) 131
+             132:    7(fvec4) Load 12(a)
+             133:    7(fvec4) CompositeConstruct 30 30 30 30
+             134:    7(fvec4) FSub 132 133
+                              ReturnValue 134
                               FunctionEnd

+ 86 - 111
3rdparty/glslang/Test/baseResults/hlsl.isfinite.frag.out

@@ -173,34 +173,34 @@ gl_FragCoord origin is upper left
 
 // Module Version 10000
 // Generated by (magic number): 80001
-// Id's are bound by 95
+// Id's are bound by 85
 
                               Capability Shader
                1:             ExtInstImport  "GLSL.std.450"
                               MemoryModel Logical GLSL450
-                              EntryPoint Fragment 4  "main" 93
+                              EntryPoint Fragment 4  "main" 83
                               ExecutionMode 4 OriginUpperLeft
                               Source HLSL 500
                               Name 4  "main"
                               Name 11  "test1(f1;"
                               Name 10  "v"
                               Name 15  "@main("
-                              Name 22  "@finitetmp"
-                              Name 36  "@finitetmp"
-                              Name 39  "$Global"
-                              MemberName 39($Global) 0  "f"
-                              MemberName 39($Global) 1  "f2"
-                              MemberName 39($Global) 2  "f3"
-                              Name 41  ""
-                              Name 57  "@finitetmp"
-                              Name 73  "@finitetmp"
-                              Name 93  "@entryPointOutput"
-                              MemberDecorate 39($Global) 0 Offset 0
-                              MemberDecorate 39($Global) 1 Offset 4
-                              MemberDecorate 39($Global) 2 Offset 16
-                              Decorate 39($Global) Block
-                              Decorate 41 DescriptorSet 0
-                              Decorate 93(@entryPointOutput) Location 0
+                              Name 20  "@finitetmp"
+                              Name 32  "@finitetmp"
+                              Name 35  "$Global"
+                              MemberName 35($Global) 0  "f"
+                              MemberName 35($Global) 1  "f2"
+                              MemberName 35($Global) 2  "f3"
+                              Name 37  ""
+                              Name 51  "@finitetmp"
+                              Name 65  "@finitetmp"
+                              Name 83  "@entryPointOutput"
+                              MemberDecorate 35($Global) 0 Offset 0
+                              MemberDecorate 35($Global) 1 Offset 4
+                              MemberDecorate 35($Global) 2 Offset 16
+                              Decorate 35($Global) Block
+                              Decorate 37 DescriptorSet 0
+                              Decorate 83(@entryPointOutput) Location 0
                2:             TypeVoid
                3:             TypeFunction 2
                6:             TypeFloat 32
@@ -209,110 +209,85 @@ gl_FragCoord origin is upper left
                9:             TypeFunction 8(bool) 7(ptr)
               13:             TypeVector 6(float) 4
               14:             TypeFunction 13(fvec4)
-              37:             TypeVector 6(float) 2
-              38:             TypeVector 6(float) 3
-     39($Global):             TypeStruct 6(float) 37(fvec2) 38(fvec3)
-              40:             TypePointer Uniform 39($Global)
-              41:     40(ptr) Variable Uniform
-              42:             TypeInt 32 1
-              43:     42(int) Constant 0
-              44:             TypePointer Uniform 6(float)
-              56:             TypePointer Function 37(fvec2)
-              58:     42(int) Constant 1
-              59:             TypePointer Uniform 37(fvec2)
-              63:             TypeVector 8(bool) 2
-              72:             TypePointer Function 38(fvec3)
-              74:     42(int) Constant 2
-              75:             TypePointer Uniform 38(fvec3)
-              79:             TypeVector 8(bool) 3
-              88:    6(float) Constant 0
-              89:   13(fvec4) ConstantComposite 88 88 88 88
-              92:             TypePointer Output 13(fvec4)
-93(@entryPointOutput):     92(ptr) Variable Output
+              33:             TypeVector 6(float) 2
+              34:             TypeVector 6(float) 3
+     35($Global):             TypeStruct 6(float) 33(fvec2) 34(fvec3)
+              36:             TypePointer Uniform 35($Global)
+              37:     36(ptr) Variable Uniform
+              38:             TypeInt 32 1
+              39:     38(int) Constant 0
+              40:             TypePointer Uniform 6(float)
+              50:             TypePointer Function 33(fvec2)
+              52:     38(int) Constant 1
+              53:             TypePointer Uniform 33(fvec2)
+              57:             TypeVector 8(bool) 2
+              64:             TypePointer Function 34(fvec3)
+              66:     38(int) Constant 2
+              67:             TypePointer Uniform 34(fvec3)
+              71:             TypeVector 8(bool) 3
+              78:    6(float) Constant 0
+              79:   13(fvec4) ConstantComposite 78 78 78 78
+              82:             TypePointer Output 13(fvec4)
+83(@entryPointOutput):     82(ptr) Variable Output
          4(main):           2 Function None 3
                5:             Label
-              94:   13(fvec4) FunctionCall 15(@main()
-                              Store 93(@entryPointOutput) 94
+              84:   13(fvec4) FunctionCall 15(@main()
+                              Store 83(@entryPointOutput) 84
                               Return
                               FunctionEnd
    11(test1(f1;):     8(bool) Function None 9
            10(v):      7(ptr) FunctionParameter
               12:             Label
-  22(@finitetmp):      7(ptr) Variable Function
+  20(@finitetmp):      7(ptr) Variable Function
               17:    6(float) Load 10(v)
               18:     8(bool) IsNan 17
               19:     8(bool) LogicalNot 18
-                              SelectionMerge 21 None
-                              BranchConditional 19 20 21
-              20:               Label
-              23:    6(float)   Load 10(v)
-                                Store 22(@finitetmp) 23
-              24:    6(float)   Load 22(@finitetmp)
-              25:     8(bool)   IsNan 24
-              26:     8(bool)   LogicalNot 25
-                                SelectionMerge 28 None
-                                BranchConditional 26 27 28
-              27:                 Label
-              29:    6(float)     Load 22(@finitetmp)
-              30:     8(bool)     IsInf 29
-              31:     8(bool)     LogicalNot 30
-                                  Branch 28
-              28:               Label
-              32:     8(bool)   Phi 26 20 31 27
-                                Branch 21
-              21:             Label
-              33:     8(bool) Phi 19 12 32 28
-                              ReturnValue 33
+              21:    6(float) Load 10(v)
+                              Store 20(@finitetmp) 21
+              22:    6(float) Load 20(@finitetmp)
+              23:     8(bool) IsNan 22
+              24:     8(bool) LogicalNot 23
+              25:    6(float) Load 20(@finitetmp)
+              26:     8(bool) IsInf 25
+              27:     8(bool) LogicalNot 26
+              28:     8(bool) LogicalAnd 24 27
+              29:     8(bool) LogicalAnd 19 28
+                              ReturnValue 29
                               FunctionEnd
       15(@main():   13(fvec4) Function None 14
               16:             Label
-  36(@finitetmp):      7(ptr) Variable Function
-  57(@finitetmp):     56(ptr) Variable Function
-  73(@finitetmp):     72(ptr) Variable Function
-              45:     44(ptr) AccessChain 41 43
-              46:    6(float) Load 45
-                              Store 36(@finitetmp) 46
-              47:    6(float) Load 36(@finitetmp)
-              48:     8(bool) IsNan 47
-              49:     8(bool) LogicalNot 48
-                              SelectionMerge 51 None
-                              BranchConditional 49 50 51
-              50:               Label
-              52:    6(float)   Load 36(@finitetmp)
-              53:     8(bool)   IsInf 52
-              54:     8(bool)   LogicalNot 53
-                                Branch 51
-              51:             Label
-              55:     8(bool) Phi 49 16 54 50
-              60:     59(ptr) AccessChain 41 58
-              61:   37(fvec2) Load 60
-                              Store 57(@finitetmp) 61
-              62:   37(fvec2) Load 57(@finitetmp)
-              64:   63(bvec2) IsNan 62
-              65:   63(bvec2) LogicalNot 64
-                              SelectionMerge 67 None
-                              BranchConditional 65 66 67
-              66:               Label
-              68:   37(fvec2)   Load 57(@finitetmp)
-              69:   63(bvec2)   IsInf 68
-              70:   63(bvec2)   LogicalNot 69
-                                Branch 67
-              67:             Label
-              71:     8(bool) Phi 65 51 70 66
-              76:     75(ptr) AccessChain 41 74
-              77:   38(fvec3) Load 76
-                              Store 73(@finitetmp) 77
-              78:   38(fvec3) Load 73(@finitetmp)
-              80:   79(bvec3) IsNan 78
-              81:   79(bvec3) LogicalNot 80
-                              SelectionMerge 83 None
-                              BranchConditional 81 82 83
-              82:               Label
-              84:   38(fvec3)   Load 73(@finitetmp)
-              85:   79(bvec3)   IsInf 84
-              86:   79(bvec3)   LogicalNot 85
-                                Branch 83
-              83:             Label
-              87:     8(bool) Phi 81 67 86 82
-                              ReturnValue 89
+  32(@finitetmp):      7(ptr) Variable Function
+  51(@finitetmp):     50(ptr) Variable Function
+  65(@finitetmp):     64(ptr) Variable Function
+              41:     40(ptr) AccessChain 37 39
+              42:    6(float) Load 41
+                              Store 32(@finitetmp) 42
+              43:    6(float) Load 32(@finitetmp)
+              44:     8(bool) IsNan 43
+              45:     8(bool) LogicalNot 44
+              46:    6(float) Load 32(@finitetmp)
+              47:     8(bool) IsInf 46
+              48:     8(bool) LogicalNot 47
+              49:     8(bool) LogicalAnd 45 48
+              54:     53(ptr) AccessChain 37 52
+              55:   33(fvec2) Load 54
+                              Store 51(@finitetmp) 55
+              56:   33(fvec2) Load 51(@finitetmp)
+              58:   57(bvec2) IsNan 56
+              59:   57(bvec2) LogicalNot 58
+              60:   33(fvec2) Load 51(@finitetmp)
+              61:   57(bvec2) IsInf 60
+              62:   57(bvec2) LogicalNot 61
+              63:   57(bvec2) LogicalAnd 59 62
+              68:     67(ptr) AccessChain 37 66
+              69:   34(fvec3) Load 68
+                              Store 65(@finitetmp) 69
+              70:   34(fvec3) Load 65(@finitetmp)
+              72:   71(bvec3) IsNan 70
+              73:   71(bvec3) LogicalNot 72
+              74:   34(fvec3) Load 65(@finitetmp)
+              75:   71(bvec3) IsInf 74
+              76:   71(bvec3) LogicalNot 75
+              77:   71(bvec3) LogicalAnd 73 76
+                              ReturnValue 79
                               FunctionEnd

+ 67 - 78
3rdparty/glslang/Test/baseResults/hlsl.logical.binary.frag.out

@@ -129,106 +129,95 @@ gl_FragCoord origin is upper left
 
 // Module Version 10000
 // Generated by (magic number): 80001
-// Id's are bound by 62
+// Id's are bound by 57
 
                               Capability Shader
                1:             ExtInstImport  "GLSL.std.450"
                               MemoryModel Logical GLSL450
-                              EntryPoint Fragment 4  "main" 59
+                              EntryPoint Fragment 4  "main" 54
                               ExecutionMode 4 OriginUpperLeft
                               Source HLSL 500
                               Name 4  "main"
                               Name 8  "PS_OUTPUT"
                               MemberName 8(PS_OUTPUT) 0  "Color"
                               Name 10  "@main("
-                              Name 15  "$Global"
-                              MemberName 15($Global) 0  "ival"
-                              MemberName 15($Global) 1  "ival4"
-                              MemberName 15($Global) 2  "fval"
-                              MemberName 15($Global) 3  "fval4"
-                              Name 17  ""
-                              Name 50  "psout"
-                              Name 59  "Color"
-                              MemberDecorate 15($Global) 0 Offset 0
-                              MemberDecorate 15($Global) 1 Offset 16
-                              MemberDecorate 15($Global) 2 Offset 32
-                              MemberDecorate 15($Global) 3 Offset 48
-                              Decorate 15($Global) Block
-                              Decorate 17 DescriptorSet 0
-                              Decorate 59(Color) Location 0
+                              Name 14  "$Global"
+                              MemberName 14($Global) 0  "ival"
+                              MemberName 14($Global) 1  "ival4"
+                              MemberName 14($Global) 2  "fval"
+                              MemberName 14($Global) 3  "fval4"
+                              Name 16  ""
+                              Name 45  "psout"
+                              Name 54  "Color"
+                              MemberDecorate 14($Global) 0 Offset 0
+                              MemberDecorate 14($Global) 1 Offset 16
+                              MemberDecorate 14($Global) 2 Offset 32
+                              MemberDecorate 14($Global) 3 Offset 48
+                              Decorate 14($Global) Block
+                              Decorate 16 DescriptorSet 0
+                              Decorate 54(Color) Location 0
                2:             TypeVoid
                3:             TypeFunction 2
                6:             TypeFloat 32
                7:             TypeVector 6(float) 4
     8(PS_OUTPUT):             TypeStruct 7(fvec4)
                9:             TypeFunction 8(PS_OUTPUT)
-              12:             TypeBool
-              13:             TypeInt 32 1
-              14:             TypeVector 13(int) 4
-     15($Global):             TypeStruct 13(int) 14(ivec4) 6(float) 7(fvec4)
-              16:             TypePointer Uniform 15($Global)
-              17:     16(ptr) Variable Uniform
-              18:     13(int) Constant 0
-              19:             TypePointer Uniform 13(int)
+              12:             TypeInt 32 1
+              13:             TypeVector 12(int) 4
+     14($Global):             TypeStruct 12(int) 13(ivec4) 6(float) 7(fvec4)
+              15:             TypePointer Uniform 14($Global)
+              16:     15(ptr) Variable Uniform
+              17:     12(int) Constant 0
+              18:             TypePointer Uniform 12(int)
+              21:             TypeBool
               22:             TypeInt 32 0
               23:     22(int) Constant 0
-              27:     13(int) Constant 2
-              28:             TypePointer Uniform 6(float)
-              49:             TypePointer Function 8(PS_OUTPUT)
-              51:    6(float) Constant 1065353216
-              52:    7(fvec4) ConstantComposite 51 51 51 51
-              53:             TypePointer Function 7(fvec4)
-              58:             TypePointer Output 7(fvec4)
-       59(Color):     58(ptr) Variable Output
+              25:     12(int) Constant 2
+              26:             TypePointer Uniform 6(float)
+              44:             TypePointer Function 8(PS_OUTPUT)
+              46:    6(float) Constant 1065353216
+              47:    7(fvec4) ConstantComposite 46 46 46 46
+              48:             TypePointer Function 7(fvec4)
+              53:             TypePointer Output 7(fvec4)
+       54(Color):     53(ptr) Variable Output
          4(main):           2 Function None 3
                5:             Label
-              60:8(PS_OUTPUT) FunctionCall 10(@main()
-              61:    7(fvec4) CompositeExtract 60 0
-                              Store 59(Color) 61
+              55:8(PS_OUTPUT) FunctionCall 10(@main()
+              56:    7(fvec4) CompositeExtract 55 0
+                              Store 54(Color) 56
                               Return
                               FunctionEnd
       10(@main():8(PS_OUTPUT) Function None 9
               11:             Label
-       50(psout):     49(ptr) Variable Function
-              20:     19(ptr) AccessChain 17 18
-              21:     13(int) Load 20
-              24:    12(bool) INotEqual 21 23
-                              SelectionMerge 26 None
-                              BranchConditional 24 25 26
-              25:               Label
-              29:     28(ptr)   AccessChain 17 27
-              30:    6(float)   Load 29
-              31:     13(int)   ConvertFToS 30
-              32:    12(bool)   INotEqual 31 23
-                                Branch 26
-              26:             Label
-              33:    12(bool) Phi 24 11 32 25
-                              SelectionMerge 35 None
-                              BranchConditional 33 34 35
-              34:               Label
-                                Branch 35
-              35:             Label
-              36:     19(ptr) AccessChain 17 18
-              37:     13(int) Load 36
-              38:    12(bool) INotEqual 37 23
-              39:    12(bool) LogicalNot 38
-                              SelectionMerge 41 None
-                              BranchConditional 39 40 41
-              40:               Label
-              42:     28(ptr)   AccessChain 17 27
-              43:    6(float)   Load 42
-              44:     13(int)   ConvertFToS 43
-              45:    12(bool)   INotEqual 44 23
-                                Branch 41
-              41:             Label
-              46:    12(bool) Phi 38 35 45 40
-                              SelectionMerge 48 None
-                              BranchConditional 46 47 48
-              47:               Label
-                                Branch 48
-              48:             Label
-              54:     53(ptr) AccessChain 50(psout) 18
-                              Store 54 52
-              55:8(PS_OUTPUT) Load 50(psout)
-                              ReturnValue 55
+       45(psout):     44(ptr) Variable Function
+              19:     18(ptr) AccessChain 16 17
+              20:     12(int) Load 19
+              24:    21(bool) INotEqual 20 23
+              27:     26(ptr) AccessChain 16 25
+              28:    6(float) Load 27
+              29:     12(int) ConvertFToS 28
+              30:    21(bool) INotEqual 29 23
+              31:    21(bool) LogicalAnd 24 30
+                              SelectionMerge 33 None
+                              BranchConditional 31 32 33
+              32:               Label
+                                Branch 33
+              33:             Label
+              34:     18(ptr) AccessChain 16 17
+              35:     12(int) Load 34
+              36:    21(bool) INotEqual 35 23
+              37:     26(ptr) AccessChain 16 25
+              38:    6(float) Load 37
+              39:     12(int) ConvertFToS 38
+              40:    21(bool) INotEqual 39 23
+              41:    21(bool) LogicalOr 36 40
+                              SelectionMerge 43 None
+                              BranchConditional 41 42 43
+              42:               Label
+                                Branch 43
+              43:             Label
+              49:     48(ptr) AccessChain 45(psout) 17
+                              Store 49 47
+              50:8(PS_OUTPUT) Load 45(psout)
+                              ReturnValue 50
                               FunctionEnd

+ 53 - 64
3rdparty/glslang/Test/baseResults/hlsl.logical.binary.vec.frag.out

@@ -255,12 +255,12 @@ gl_FragCoord origin is upper left
 
 // Module Version 10000
 // Generated by (magic number): 80001
-// Id's are bound by 120
+// Id's are bound by 115
 
                               Capability Shader
                1:             ExtInstImport  "GLSL.std.450"
                               MemoryModel Logical GLSL450
-                              EntryPoint Fragment 4  "main" 117
+                              EntryPoint Fragment 4  "main" 112
                               ExecutionMode 4 OriginUpperLeft
                               Source HLSL 500
                               Name 4  "main"
@@ -279,16 +279,16 @@ gl_FragCoord origin is upper left
                               Name 47  "r10"
                               Name 58  "r11"
                               Name 67  "r20"
-                              Name 79  "r21"
-                              Name 92  "psout"
-                              Name 117  "Color"
+                              Name 77  "r21"
+                              Name 87  "psout"
+                              Name 112  "Color"
                               MemberDecorate 18($Global) 0 Offset 0
                               MemberDecorate 18($Global) 1 Offset 16
                               MemberDecorate 18($Global) 2 Offset 32
                               MemberDecorate 18($Global) 3 Offset 36
                               Decorate 18($Global) Block
                               Decorate 20 DescriptorSet 0
-                              Decorate 117(Color) Location 0
+                              Decorate 112(Color) Location 0
                2:             TypeVoid
                3:             TypeFunction 2
                6:             TypeFloat 32
@@ -311,20 +311,20 @@ gl_FragCoord origin is upper left
               34:     21(int) Constant 1
               48:     21(int) Constant 2
               49:             TypePointer Uniform 16(int)
-              73:     21(int) Constant 3
-              91:             TypePointer Function 8(PS_OUTPUT)
-             106:    6(float) Constant 0
-             107:    6(float) Constant 1065353216
-             108:    7(fvec4) ConstantComposite 106 106 106 106
-             109:    7(fvec4) ConstantComposite 107 107 107 107
-             111:             TypePointer Function 7(fvec4)
-             116:             TypePointer Output 7(fvec4)
-      117(Color):    116(ptr) Variable Output
+              71:     21(int) Constant 3
+              86:             TypePointer Function 8(PS_OUTPUT)
+             101:    6(float) Constant 0
+             102:    6(float) Constant 1065353216
+             103:    7(fvec4) ConstantComposite 101 101 101 101
+             104:    7(fvec4) ConstantComposite 102 102 102 102
+             106:             TypePointer Function 7(fvec4)
+             111:             TypePointer Output 7(fvec4)
+      112(Color):    111(ptr) Variable Output
          4(main):           2 Function None 3
                5:             Label
-             118:8(PS_OUTPUT) FunctionCall 10(@main()
-             119:    7(fvec4) CompositeExtract 118 0
-                              Store 117(Color) 119
+             113:8(PS_OUTPUT) FunctionCall 10(@main()
+             114:    7(fvec4) CompositeExtract 113 0
+                              Store 112(Color) 114
                               Return
                               FunctionEnd
       10(@main():8(PS_OUTPUT) Function None 9
@@ -335,8 +335,8 @@ gl_FragCoord origin is upper left
          47(r10):     14(ptr) Variable Function
          58(r11):     14(ptr) Variable Function
          67(r20):     14(ptr) Variable Function
-         79(r21):     14(ptr) Variable Function
-       92(psout):     91(ptr) Variable Function
+         77(r21):     14(ptr) Variable Function
+       87(psout):     86(ptr) Variable Function
               24:     23(ptr) AccessChain 20 22
               25:   17(ivec4) Load 24
               28:   13(bvec4) INotEqual 25 27
@@ -379,48 +379,37 @@ gl_FragCoord origin is upper left
               68:     23(ptr) AccessChain 20 22
               69:   17(ivec4) Load 68
               70:   13(bvec4) INotEqual 69 27
-                              SelectionMerge 72 None
-                              BranchConditional 70 71 72
-              71:               Label
-              74:     49(ptr)   AccessChain 20 73
-              75:     16(int)   Load 74
-              76:    12(bool)   INotEqual 75 26
-              77:   13(bvec4)   CompositeConstruct 76 76 76 76
-                                Branch 72
-              72:             Label
-              78:    12(bool) Phi 70 11 77 71
-                              Store 67(r20) 78
-              80:     23(ptr) AccessChain 20 22
-              81:   17(ivec4) Load 80
-              82:   13(bvec4) INotEqual 81 27
-              83:    12(bool) LogicalNot 82
-                              SelectionMerge 85 None
-                              BranchConditional 83 84 85
-              84:               Label
-              86:     49(ptr)   AccessChain 20 73
-              87:     16(int)   Load 86
-              88:    12(bool)   INotEqual 87 26
-              89:   13(bvec4)   CompositeConstruct 88 88 88 88
-                                Branch 85
-              85:             Label
-              90:    12(bool) Phi 82 72 89 84
-                              Store 79(r21) 90
-              93:   13(bvec4) Load 15(r00)
-              94:   13(bvec4) Load 30(r01)
-              95:   13(bvec4) LogicalOr 93 94
-              96:   13(bvec4) Load 39(r02)
-              97:   13(bvec4) LogicalOr 95 96
-              98:   13(bvec4) Load 47(r10)
-              99:   13(bvec4) LogicalOr 97 98
-             100:   13(bvec4) Load 58(r11)
-             101:   13(bvec4) LogicalOr 99 100
-             102:   13(bvec4) Load 67(r20)
-             103:   13(bvec4) LogicalOr 101 102
-             104:   13(bvec4) Load 79(r21)
-             105:   13(bvec4) LogicalOr 103 104
-             110:    7(fvec4) Select 105 109 108
-             112:    111(ptr) AccessChain 92(psout) 22
-                              Store 112 110
-             113:8(PS_OUTPUT) Load 92(psout)
-                              ReturnValue 113
+              72:     49(ptr) AccessChain 20 71
+              73:     16(int) Load 72
+              74:    12(bool) INotEqual 73 26
+              75:   13(bvec4) CompositeConstruct 74 74 74 74
+              76:   13(bvec4) LogicalAnd 70 75
+                              Store 67(r20) 76
+              78:     23(ptr) AccessChain 20 22
+              79:   17(ivec4) Load 78
+              80:   13(bvec4) INotEqual 79 27
+              81:     49(ptr) AccessChain 20 71
+              82:     16(int) Load 81
+              83:    12(bool) INotEqual 82 26
+              84:   13(bvec4) CompositeConstruct 83 83 83 83
+              85:   13(bvec4) LogicalOr 80 84
+                              Store 77(r21) 85
+              88:   13(bvec4) Load 15(r00)
+              89:   13(bvec4) Load 30(r01)
+              90:   13(bvec4) LogicalOr 88 89
+              91:   13(bvec4) Load 39(r02)
+              92:   13(bvec4) LogicalOr 90 91
+              93:   13(bvec4) Load 47(r10)
+              94:   13(bvec4) LogicalOr 92 93
+              95:   13(bvec4) Load 58(r11)
+              96:   13(bvec4) LogicalOr 94 95
+              97:   13(bvec4) Load 67(r20)
+              98:   13(bvec4) LogicalOr 96 97
+              99:   13(bvec4) Load 77(r21)
+             100:   13(bvec4) LogicalOr 98 99
+             105:    7(fvec4) Select 100 104 103
+             107:    106(ptr) AccessChain 87(psout) 22
+                              Store 107 105
+             108:8(PS_OUTPUT) Load 87(psout)
+                              ReturnValue 108
                               FunctionEnd

+ 87 - 85
3rdparty/glslang/Test/baseResults/hlsl.structbuffer.frag.out

@@ -189,12 +189,12 @@ gl_FragCoord origin is upper left
 
 // Module Version 10000
 // Generated by (magic number): 80001
-// Id's are bound by 94
+// Id's are bound by 96
 
                               Capability Shader
                1:             ExtInstImport  "GLSL.std.450"
                               MemoryModel Logical GLSL450
-                              EntryPoint Fragment 4  "main" 87 90
+                              EntryPoint Fragment 4  "main" 89 92
                               ExecutionMode 4 OriginUpperLeft
                               Source HLSL 500
                               Name 4  "main"
@@ -212,15 +212,15 @@ gl_FragCoord origin is upper left
                               Name 21  "sbuf"
                               MemberName 21(sbuf) 0  "@data"
                               Name 23  "sbuf"
-                              Name 40  "size"
-                              Name 42  "stride"
-                              Name 57  "sbuf2"
-                              MemberName 57(sbuf2) 0  "@data"
+                              Name 43  "size"
+                              Name 45  "stride"
                               Name 59  "sbuf2"
-                              Name 85  "pos"
+                              MemberName 59(sbuf2) 0  "@data"
+                              Name 61  "sbuf2"
                               Name 87  "pos"
-                              Name 90  "@entryPointOutput"
-                              Name 91  "param"
+                              Name 89  "pos"
+                              Name 92  "@entryPointOutput"
+                              Name 93  "param"
                               MemberDecorate 19(sb_t) 0 NonWritable
                               MemberDecorate 19(sb_t) 0 Offset 0
                               MemberDecorate 19(sb_t) 1 NonWritable
@@ -233,13 +233,13 @@ gl_FragCoord origin is upper left
                               Decorate 21(sbuf) BufferBlock
                               Decorate 23(sbuf) DescriptorSet 0
                               Decorate 23(sbuf) Binding 10
-                              Decorate 56 ArrayStride 4
-                              MemberDecorate 57(sbuf2) 0 NonWritable
-                              MemberDecorate 57(sbuf2) 0 Offset 0
-                              Decorate 57(sbuf2) BufferBlock
-                              Decorate 59(sbuf2) DescriptorSet 0
-                              Decorate 87(pos) Location 0
-                              Decorate 90(@entryPointOutput) Location 0
+                              Decorate 58 ArrayStride 4
+                              MemberDecorate 59(sbuf2) 0 NonWritable
+                              MemberDecorate 59(sbuf2) 0 Offset 0
+                              Decorate 59(sbuf2) BufferBlock
+                              Decorate 61(sbuf2) DescriptorSet 0
+                              Decorate 89(pos) Location 0
+                              Decorate 92(@entryPointOutput) Location 0
                2:             TypeVoid
                3:             TypeFunction 2
                6:             TypeInt 32 0
@@ -261,41 +261,41 @@ gl_FragCoord origin is upper left
               27:             TypePointer Uniform 19(sb_t)
               31:             TypePointer Function 14(fvec3)
               34:     24(int) Constant 1
-              35:             TypePointer Function 15(bool)
-              38:     24(int) Constant 2
-              43:      6(int) Constant 32
-              45:             TypePointer Uniform 6(int)
-              48:      6(int) Constant 0
-              53:             TypePointer Uniform 14(fvec3)
-              56:             TypeRuntimeArray 8(float)
-       57(sbuf2):             TypeStruct 56
-              58:             TypePointer Uniform 57(sbuf2)
-       59(sbuf2):     58(ptr) Variable Uniform
-              61:             TypePointer Uniform 8(float)
-              66:    8(float) Constant 0
-              73:             TypePointer Function 8(float)
-              86:             TypePointer Input 6(int)
-         87(pos):     86(ptr) Variable Input
-              89:             TypePointer Output 9(fvec4)
-90(@entryPointOutput):     89(ptr) Variable Output
+              35:      6(int) Constant 0
+              37:             TypePointer Function 15(bool)
+              40:     24(int) Constant 2
+              46:      6(int) Constant 32
+              48:             TypePointer Uniform 6(int)
+              55:             TypePointer Uniform 14(fvec3)
+              58:             TypeRuntimeArray 8(float)
+       59(sbuf2):             TypeStruct 58
+              60:             TypePointer Uniform 59(sbuf2)
+       61(sbuf2):     60(ptr) Variable Uniform
+              63:             TypePointer Uniform 8(float)
+              68:    8(float) Constant 0
+              75:             TypePointer Function 8(float)
+              88:             TypePointer Input 6(int)
+         89(pos):     88(ptr) Variable Input
+              91:             TypePointer Output 9(fvec4)
+92(@entryPointOutput):     91(ptr) Variable Output
          4(main):           2 Function None 3
                5:             Label
-         85(pos):      7(ptr) Variable Function
-       91(param):      7(ptr) Variable Function
-              88:      6(int) Load 87(pos)
-                              Store 85(pos) 88
-              92:      6(int) Load 85(pos)
-                              Store 91(param) 92
-              93:    9(fvec4) FunctionCall 12(@main(u1;) 91(param)
-                              Store 90(@entryPointOutput) 93
+         87(pos):      7(ptr) Variable Function
+       93(param):      7(ptr) Variable Function
+              90:      6(int) Load 89(pos)
+                              Store 87(pos) 90
+              94:      6(int) Load 87(pos)
+                              Store 93(param) 94
+              95:    9(fvec4) FunctionCall 12(@main(u1;) 93(param)
+                              Store 92(@entryPointOutput) 95
                               Return
                               FunctionEnd
    12(@main(u1;):    9(fvec4) Function None 10
          11(pos):      7(ptr) FunctionParameter
               13:             Label
       18(mydata):     17(ptr) Variable Function
-        40(size):      7(ptr) Variable Function
-      42(stride):      7(ptr) Variable Function
+        43(size):      7(ptr) Variable Function
+      45(stride):      7(ptr) Variable Function
               26:      6(int) Load 11(pos)
               28:     27(ptr) AccessChain 23(sbuf) 25 26
               29:    19(sb_t) Load 28
@@ -303,46 +303,48 @@ gl_FragCoord origin is upper left
               32:     31(ptr) AccessChain 18(mydata) 25
                               Store 32 30
               33:      6(int) CompositeExtract 29 1
-              36:     35(ptr) AccessChain 18(mydata) 34
-                              Store 36 33
-              37:      6(int) CompositeExtract 29 2
-              39:     35(ptr) AccessChain 18(mydata) 38
-                              Store 39 37
-              41:     24(int) ArrayLength 23(sbuf) 0
-                              Store 40(size) 41
-                              Store 42(stride) 43
-              44:      6(int) Load 11(pos)
-              46:     45(ptr) AccessChain 23(sbuf) 25 44 34
-              47:      6(int) Load 46
-              49:    15(bool) INotEqual 47 48
-                              SelectionMerge 51 None
-                              BranchConditional 49 50 72
-              50:               Label
-              52:      6(int)   Load 11(pos)
-              54:     53(ptr)   AccessChain 23(sbuf) 25 52 25
-              55:   14(fvec3)   Load 54
-              60:      6(int)   Load 11(pos)
-              62:     61(ptr)   AccessChain 59(sbuf2) 25 60
-              63:    8(float)   Load 62
-              64:   14(fvec3)   CompositeConstruct 63 63 63
-              65:   14(fvec3)   FAdd 55 64
-              67:    8(float)   CompositeExtract 65 0
-              68:    8(float)   CompositeExtract 65 1
-              69:    8(float)   CompositeExtract 65 2
-              70:    9(fvec4)   CompositeConstruct 67 68 69 66
-                                ReturnValue 70
-              72:               Label
-              74:     73(ptr)   AccessChain 18(mydata) 25 48
-              75:    8(float)   Load 74
-              76:      6(int)   Load 40(size)
-              77:    8(float)   ConvertUToF 76
-              78:    8(float)   FAdd 75 77
-              79:      6(int)   Load 42(stride)
-              80:    8(float)   ConvertUToF 79
-              81:    8(float)   FAdd 78 80
-              82:    9(fvec4)   CompositeConstruct 81 81 81 81
-                                ReturnValue 82
-              51:             Label
-              84:    9(fvec4) Undef
-                              ReturnValue 84
+              36:    15(bool) INotEqual 33 35
+              38:     37(ptr) AccessChain 18(mydata) 34
+                              Store 38 36
+              39:      6(int) CompositeExtract 29 2
+              41:    15(bool) INotEqual 39 35
+              42:     37(ptr) AccessChain 18(mydata) 40
+                              Store 42 41
+              44:     24(int) ArrayLength 23(sbuf) 0
+                              Store 43(size) 44
+                              Store 45(stride) 46
+              47:      6(int) Load 11(pos)
+              49:     48(ptr) AccessChain 23(sbuf) 25 47 34
+              50:      6(int) Load 49
+              51:    15(bool) INotEqual 50 35
+                              SelectionMerge 53 None
+                              BranchConditional 51 52 74
+              52:               Label
+              54:      6(int)   Load 11(pos)
+              56:     55(ptr)   AccessChain 23(sbuf) 25 54 25
+              57:   14(fvec3)   Load 56
+              62:      6(int)   Load 11(pos)
+              64:     63(ptr)   AccessChain 61(sbuf2) 25 62
+              65:    8(float)   Load 64
+              66:   14(fvec3)   CompositeConstruct 65 65 65
+              67:   14(fvec3)   FAdd 57 66
+              69:    8(float)   CompositeExtract 67 0
+              70:    8(float)   CompositeExtract 67 1
+              71:    8(float)   CompositeExtract 67 2
+              72:    9(fvec4)   CompositeConstruct 69 70 71 68
+                                ReturnValue 72
+              74:               Label
+              76:     75(ptr)   AccessChain 18(mydata) 25 35
+              77:    8(float)   Load 76
+              78:      6(int)   Load 43(size)
+              79:    8(float)   ConvertUToF 78
+              80:    8(float)   FAdd 77 79
+              81:      6(int)   Load 45(stride)
+              82:    8(float)   ConvertUToF 81
+              83:    8(float)   FAdd 80 82
+              84:    9(fvec4)   CompositeConstruct 83 83 83 83
+                                ReturnValue 84
+              53:             Label
+              86:    9(fvec4) Undef
+                              ReturnValue 86
                               FunctionEnd

+ 228 - 0
3rdparty/glslang/Test/baseResults/hlsl.tx.overload.frag.out

@@ -0,0 +1,228 @@
+hlsl.tx.overload.frag
+Shader version: 500
+gl_FragCoord origin is upper left
+0:? Sequence
+0:8  Function Definition: Func(t211; ( temp float)
+0:8    Function Parameters: 
+0:8      'DummyTex' ( in texture2D)
+0:?     Sequence
+0:8      Branch: Return with expression
+0:8        Constant:
+0:8          1.000000
+0:9  Function Definition: Func(t21; ( temp 4-component vector of float)
+0:9    Function Parameters: 
+0:9      'DummyTex' ( in texture2D)
+0:?     Sequence
+0:9      Branch: Return with expression
+0:?         Constant:
+0:?           0.000000
+0:?           0.000000
+0:?           0.000000
+0:?           0.000000
+0:11  Function Definition: Func(I211; ( temp float)
+0:11    Function Parameters: 
+0:11      'DummyTex' (layout( r32f) in image2D)
+0:?     Sequence
+0:11      Branch: Return with expression
+0:11        Constant:
+0:11          1.000000
+0:12  Function Definition: Func(I21; ( temp 4-component vector of float)
+0:12    Function Parameters: 
+0:12      'DummyTex' (layout( rgba32f) in image2D)
+0:?     Sequence
+0:12      Branch: Return with expression
+0:?         Constant:
+0:?           0.000000
+0:?           0.000000
+0:?           0.000000
+0:?           0.000000
+0:15  Function Definition: @main( ( temp 4-component vector of float)
+0:15    Function Parameters: 
+0:?     Sequence
+0:16      Branch: Return with expression
+0:16        add ( temp 4-component vector of float)
+0:16          add ( temp 4-component vector of float)
+0:16            add ( temp 4-component vector of float)
+0:16              Function Call: Func(t211; ( temp float)
+0:16                'tf1' ( uniform texture2D)
+0:16              Function Call: Func(t21; ( temp 4-component vector of float)
+0:16                'tf4' ( uniform texture2D)
+0:16            Function Call: Func(I211; ( temp float)
+0:16              'twf1' (layout( r32f) uniform image2D)
+0:16          Function Call: Func(I21; ( temp 4-component vector of float)
+0:16            'twf4' (layout( rgba32f) uniform image2D)
+0:15  Function Definition: main( ( temp void)
+0:15    Function Parameters: 
+0:?     Sequence
+0:15      move second child to first child ( temp 4-component vector of float)
+0:?         '@entryPointOutput' (layout( location=0) out 4-component vector of float)
+0:15        Function Call: @main( ( temp 4-component vector of float)
+0:?   Linker Objects
+0:?     'tf1' ( uniform texture2D)
+0:?     'tf4' ( uniform texture2D)
+0:?     'twf1' (layout( r32f) uniform image2D)
+0:?     'twf4' (layout( rgba32f) uniform image2D)
+0:?     '@entryPointOutput' (layout( location=0) out 4-component vector of float)
+
+
+Linked fragment stage:
+
+
+Shader version: 500
+gl_FragCoord origin is upper left
+0:? Sequence
+0:8  Function Definition: Func(t211; ( temp float)
+0:8    Function Parameters: 
+0:8      'DummyTex' ( in texture2D)
+0:?     Sequence
+0:8      Branch: Return with expression
+0:8        Constant:
+0:8          1.000000
+0:9  Function Definition: Func(t21; ( temp 4-component vector of float)
+0:9    Function Parameters: 
+0:9      'DummyTex' ( in texture2D)
+0:?     Sequence
+0:9      Branch: Return with expression
+0:?         Constant:
+0:?           0.000000
+0:?           0.000000
+0:?           0.000000
+0:?           0.000000
+0:11  Function Definition: Func(I211; ( temp float)
+0:11    Function Parameters: 
+0:11      'DummyTex' (layout( r32f) in image2D)
+0:?     Sequence
+0:11      Branch: Return with expression
+0:11        Constant:
+0:11          1.000000
+0:12  Function Definition: Func(I21; ( temp 4-component vector of float)
+0:12    Function Parameters: 
+0:12      'DummyTex' (layout( rgba32f) in image2D)
+0:?     Sequence
+0:12      Branch: Return with expression
+0:?         Constant:
+0:?           0.000000
+0:?           0.000000
+0:?           0.000000
+0:?           0.000000
+0:15  Function Definition: @main( ( temp 4-component vector of float)
+0:15    Function Parameters: 
+0:?     Sequence
+0:16      Branch: Return with expression
+0:16        add ( temp 4-component vector of float)
+0:16          add ( temp 4-component vector of float)
+0:16            add ( temp 4-component vector of float)
+0:16              Function Call: Func(t211; ( temp float)
+0:16                'tf1' ( uniform texture2D)
+0:16              Function Call: Func(t21; ( temp 4-component vector of float)
+0:16                'tf4' ( uniform texture2D)
+0:16            Function Call: Func(I211; ( temp float)
+0:16              'twf1' (layout( r32f) uniform image2D)
+0:16          Function Call: Func(I21; ( temp 4-component vector of float)
+0:16            'twf4' (layout( rgba32f) uniform image2D)
+0:15  Function Definition: main( ( temp void)
+0:15    Function Parameters: 
+0:?     Sequence
+0:15      move second child to first child ( temp 4-component vector of float)
+0:?         '@entryPointOutput' (layout( location=0) out 4-component vector of float)
+0:15        Function Call: @main( ( temp 4-component vector of float)
+0:?   Linker Objects
+0:?     'tf1' ( uniform texture2D)
+0:?     'tf4' ( uniform texture2D)
+0:?     'twf1' (layout( r32f) uniform image2D)
+0:?     'twf4' (layout( rgba32f) uniform image2D)
+0:?     '@entryPointOutput' (layout( location=0) out 4-component vector of float)
+
+// Module Version 10000
+// Generated by (magic number): 80001
+// Id's are bound by 62
+
+                              Capability Shader
+               1:             ExtInstImport  "GLSL.std.450"
+                              MemoryModel Logical GLSL450
+                              EntryPoint Fragment 4  "main" 60
+                              ExecutionMode 4 OriginUpperLeft
+                              Source HLSL 500
+                              Name 4  "main"
+                              Name 11  "Func(t211;"
+                              Name 10  "DummyTex"
+                              Name 16  "Func(t21;"
+                              Name 15  "DummyTex"
+                              Name 22  "Func(I211;"
+                              Name 21  "DummyTex"
+                              Name 28  "Func(I21;"
+                              Name 27  "DummyTex"
+                              Name 31  "@main("
+                              Name 44  "tf1"
+                              Name 46  "tf4"
+                              Name 50  "twf1"
+                              Name 54  "twf4"
+                              Name 60  "@entryPointOutput"
+                              Decorate 44(tf1) DescriptorSet 0
+                              Decorate 46(tf4) DescriptorSet 0
+                              Decorate 50(twf1) DescriptorSet 0
+                              Decorate 54(twf4) DescriptorSet 0
+                              Decorate 60(@entryPointOutput) Location 0
+               2:             TypeVoid
+               3:             TypeFunction 2
+               6:             TypeFloat 32
+               7:             TypeImage 6(float) 2D sampled format:Unknown
+               8:             TypePointer UniformConstant 7
+               9:             TypeFunction 6(float) 8(ptr)
+              13:             TypeVector 6(float) 4
+              14:             TypeFunction 13(fvec4) 8(ptr)
+              18:             TypeImage 6(float) 2D nonsampled format:R32f
+              19:             TypePointer UniformConstant 18
+              20:             TypeFunction 6(float) 19(ptr)
+              24:             TypeImage 6(float) 2D nonsampled format:Rgba32f
+              25:             TypePointer UniformConstant 24
+              26:             TypeFunction 13(fvec4) 25(ptr)
+              30:             TypeFunction 13(fvec4)
+              33:    6(float) Constant 1065353216
+              36:    6(float) Constant 0
+              37:   13(fvec4) ConstantComposite 36 36 36 36
+         44(tf1):      8(ptr) Variable UniformConstant
+         46(tf4):      8(ptr) Variable UniformConstant
+        50(twf1):     19(ptr) Variable UniformConstant
+        54(twf4):     25(ptr) Variable UniformConstant
+              59:             TypePointer Output 13(fvec4)
+60(@entryPointOutput):     59(ptr) Variable Output
+         4(main):           2 Function None 3
+               5:             Label
+              61:   13(fvec4) FunctionCall 31(@main()
+                              Store 60(@entryPointOutput) 61
+                              Return
+                              FunctionEnd
+  11(Func(t211;):    6(float) Function None 9
+    10(DummyTex):      8(ptr) FunctionParameter
+              12:             Label
+                              ReturnValue 33
+                              FunctionEnd
+   16(Func(t21;):   13(fvec4) Function None 14
+    15(DummyTex):      8(ptr) FunctionParameter
+              17:             Label
+                              ReturnValue 37
+                              FunctionEnd
+  22(Func(I211;):    6(float) Function None 20
+    21(DummyTex):     19(ptr) FunctionParameter
+              23:             Label
+                              ReturnValue 33
+                              FunctionEnd
+   28(Func(I21;):   13(fvec4) Function None 26
+    27(DummyTex):     25(ptr) FunctionParameter
+              29:             Label
+                              ReturnValue 37
+                              FunctionEnd
+      31(@main():   13(fvec4) Function None 30
+              32:             Label
+              45:    6(float) FunctionCall 11(Func(t211;) 44(tf1)
+              47:   13(fvec4) FunctionCall 16(Func(t21;) 46(tf4)
+              48:   13(fvec4) CompositeConstruct 45 45 45 45
+              49:   13(fvec4) FAdd 48 47
+              51:    6(float) FunctionCall 22(Func(I211;) 50(twf1)
+              52:   13(fvec4) CompositeConstruct 51 51 51 51
+              53:   13(fvec4) FAdd 49 52
+              55:   13(fvec4) FunctionCall 28(Func(I21;) 54(twf4)
+              56:   13(fvec4) FAdd 53 55
+                              ReturnValue 56
+                              FunctionEnd

+ 1 - 0
3rdparty/glslang/Test/baseResults/remap.uniformarray.everything.frag.out

@@ -8,6 +8,7 @@ remap.uniformarray.everything.frag
                               MemoryModel Logical GLSL450
                               EntryPoint Fragment 5663  "main" 3608 4957 4339 5139
                               ExecutionMode 5663 OriginUpperLeft
+                              Decorate 5139 Location 0
                8:             TypeVoid
             1282:             TypeFunction 8
               13:             TypeFloat 32

+ 1 - 0
3rdparty/glslang/Test/baseResults/remap.uniformarray.none.frag.out

@@ -16,6 +16,7 @@ remap.uniformarray.none.frag
                               Name 35  "alpha"
                               Name 47  "gl_FragColor"
                               Name 52  "texSampler2D"
+                              Decorate 47(gl_FragColor) Location 0
                               Decorate 52(texSampler2D) DescriptorSet 0
                2:             TypeVoid
                3:             TypeFunction 2

+ 1 - 0
3rdparty/glslang/Test/baseResults/spv.always-discard.frag.out

@@ -18,6 +18,7 @@ spv.always-discard.frag
                               Name 30  "y"
                               Name 36  "radius"
                               Name 59  "gl_FragColor"
+                              Decorate 59(gl_FragColor) Location 0
                2:             TypeVoid
                3:             TypeFunction 2
                6:             TypeFloat 32

+ 1 - 0
3rdparty/glslang/Test/baseResults/spv.always-discard2.frag.out

@@ -17,6 +17,7 @@ spv.always-discard2.frag
                               Name 21  "tex_coord"
                               Name 30  "y"
                               Name 38  "gl_FragColor"
+                              Decorate 38(gl_FragColor) Location 0
                2:             TypeVoid
                3:             TypeFunction 2
                6:             TypeFloat 32

+ 13 - 13
3rdparty/glslang/Test/baseResults/spv.boolInBlock.frag.out

@@ -52,9 +52,9 @@ Warning, version 450 is not yet complete; most version-specific features are pre
               28:     27(int) Constant 0
               29:     6(bool) ConstantFalse
               30:    9(bvec2) ConstantComposite 29 29
-              31:     22(int) Constant 0
+              31:     22(int) Constant 1
               32:   23(ivec2) ConstantComposite 31 31
-              33:     22(int) Constant 1
+              33:     22(int) Constant 0
               34:   23(ivec2) ConstantComposite 33 33
               36:             TypePointer Uniform 23(ivec2)
               38:             TypeVector 22(int) 4
@@ -62,7 +62,7 @@ Warning, version 450 is not yet complete; most version-specific features are pre
               40:             TypePointer Uniform 39(Uniform)
               41:     40(ptr) Variable Uniform
               42:             TypePointer Uniform 38(ivec4)
-              65:   38(ivec4) ConstantComposite 31 31 31 31
+              65:   38(ivec4) ConstantComposite 33 33 33 33
               72:             TypeFloat 32
               73:             TypeVector 72(float) 4
               74:             TypePointer Output 73(fvec4)
@@ -73,22 +73,22 @@ Warning, version 450 is not yet complete; most version-specific features are pre
                5:             Label
        62(param):      8(ptr) Variable Function
        67(param):     10(ptr) Variable Function
-              35:   23(ivec2) Select 30 34 32
+              35:   23(ivec2) Select 30 32 34
               37:     36(ptr) AccessChain 26 28
                               Store 37 35
               43:     42(ptr) AccessChain 41 28
               44:   38(ivec4) Load 43
               45:     22(int) CompositeExtract 44 2
-              46:     6(bool) INotEqual 45 31
+              46:     6(bool) INotEqual 45 33
                               SelectionMerge 48 None
                               BranchConditional 46 47 48
               47:               Label
               49:     42(ptr)   AccessChain 41 28
               50:   38(ivec4)   Load 49
               51:     22(int)   CompositeExtract 50 0
-              52:     6(bool)   INotEqual 51 31
+              52:     6(bool)   INotEqual 51 33
               53:    9(bvec2)   CompositeConstruct 52 52
-              54:   23(ivec2)   Select 53 34 32
+              54:   23(ivec2)   Select 53 32 34
               55:     36(ptr)   AccessChain 26 28
                                 Store 55 54
                                 Branch 48
@@ -96,7 +96,7 @@ Warning, version 450 is not yet complete; most version-specific features are pre
               56:     36(ptr) AccessChain 26 28
               57:   23(ivec2) Load 56
               58:     22(int) CompositeExtract 57 0
-              59:     6(bool) INotEqual 58 31
+              59:     6(bool) INotEqual 58 33
                               SelectionMerge 61 None
                               BranchConditional 59 60 61
               60:               Label
@@ -106,7 +106,7 @@ Warning, version 450 is not yet complete; most version-specific features are pre
                                 Store 62(param) 66
               68:           2   FunctionCall 14(foo(vb4;vb2;) 62(param) 67(param)
               69:    9(bvec2)   Load 67(param)
-              70:   23(ivec2)   Select 69 34 32
+              70:   23(ivec2)   Select 69 32 34
               71:     36(ptr)   AccessChain 26 28
                                 Store 71 70
                                 Branch 61
@@ -114,14 +114,14 @@ Warning, version 450 is not yet complete; most version-specific features are pre
               76:     42(ptr) AccessChain 41 28
               77:   38(ivec4) Load 76
               78:     22(int) CompositeExtract 77 0
-              79:     6(bool) INotEqual 78 31
+              79:     6(bool) INotEqual 78 33
                               SelectionMerge 81 None
                               BranchConditional 79 80 81
               80:               Label
               82:     42(ptr)   AccessChain 41 28
               83:   38(ivec4)   Load 82
               84:     22(int)   CompositeExtract 83 1
-              85:     6(bool)   INotEqual 84 31
+              85:     6(bool)   INotEqual 84 33
                                 Branch 81
               81:             Label
               86:     6(bool) Phi 79 61 85 80
@@ -131,7 +131,7 @@ Warning, version 450 is not yet complete; most version-specific features are pre
               91:     42(ptr) AccessChain 41 28
               92:   38(ivec4) Load 91
               93:     22(int) CompositeExtract 92 0
-              94:     6(bool) INotEqual 93 31
+              94:     6(bool) INotEqual 93 33
               95:     6(bool) LogicalNot 94
                               SelectionMerge 97 None
                               BranchConditional 95 96 97
@@ -139,7 +139,7 @@ Warning, version 450 is not yet complete; most version-specific features are pre
               98:     42(ptr)   AccessChain 41 28
               99:   38(ivec4)   Load 98
              100:     22(int)   CompositeExtract 99 1
-             101:     6(bool)   INotEqual 100 31
+             101:     6(bool)   INotEqual 100 33
                                 Branch 97
               97:             Label
              102:     6(bool) Phi 94 81 101 96

+ 1 - 0
3rdparty/glslang/Test/baseResults/spv.conditionalDiscard.frag.out

@@ -17,6 +17,7 @@ Warning, version 400 is not yet complete; most version-specific features are pre
                               Name 17  "coord"
                               Name 34  "gl_FragColor"
                               Decorate 13(tex) DescriptorSet 0
+                              Decorate 34(gl_FragColor) Location 0
                2:             TypeVoid
                3:             TypeFunction 2
                6:             TypeFloat 32

+ 1 - 0
3rdparty/glslang/Test/baseResults/spv.conversion.frag.out

@@ -51,6 +51,7 @@ spv.conversion.frag
                               Name 454  "i_f4"
                               Decorate 39(i_i) Flat
                               Decorate 157(i_i4) Flat
+                              Decorate 322(gl_FragColor) Location 0
                               Decorate 446(i_i2) Flat
                               Decorate 448(i_i3) Flat
                2:             TypeVoid

+ 1 - 0
3rdparty/glslang/Test/baseResults/spv.deepRvalue.frag.out

@@ -28,6 +28,7 @@ spv.deepRvalue.frag
                               Name 133  "t"
                               Name 146  "gl_FragColor"
                               Decorate 111(samp2D) DescriptorSet 0
+                              Decorate 146(gl_FragColor) Location 0
                2:             TypeVoid
                3:             TypeFunction 2
                6:             TypeFloat 32

+ 1 - 0
3rdparty/glslang/Test/baseResults/spv.discard-dce.frag.out

@@ -18,6 +18,7 @@ spv.discard-dce.frag
                               Name 30  "y"
                               Name 36  "radius"
                               Name 59  "gl_FragColor"
+                              Decorate 59(gl_FragColor) Location 0
                2:             TypeVoid
                3:             TypeFunction 2
                6:             TypeFloat 32

+ 1 - 0
3rdparty/glslang/Test/baseResults/spv.doWhileLoop.frag.out

@@ -15,6 +15,7 @@ spv.doWhileLoop.frag
                               Name 17  "bigColor"
                               Name 27  "d"
                               Name 32  "gl_FragColor"
+                              Decorate 32(gl_FragColor) Location 0
                2:             TypeVoid
                3:             TypeFunction 2
                6:             TypeFloat 32

+ 1 - 0
3rdparty/glslang/Test/baseResults/spv.earlyReturnDiscard.frag.out

@@ -24,6 +24,7 @@ spv.earlyReturnDiscard.frag
                               Name 77  "b"
                               Name 105  "gl_FragColor"
                               Name 109  "threshhold3"
+                              Decorate 105(gl_FragColor) Location 0
                2:             TypeVoid
                3:             TypeFunction 2
                6:             TypeFloat 32

+ 1 - 0
3rdparty/glslang/Test/baseResults/spv.flowControl.frag.out

@@ -19,6 +19,7 @@ spv.flowControl.frag
                               Name 25  "bigColor"
                               Name 30  "smallColor"
                               Name 35  "gl_FragColor"
+                              Decorate 35(gl_FragColor) Location 0
                2:             TypeVoid
                3:             TypeFunction 2
                6:             TypeFloat 32

+ 1 - 0
3rdparty/glslang/Test/baseResults/spv.forLoop.frag.out

@@ -26,6 +26,7 @@ spv.forLoop.frag
                               Name 104  "f"
                               Name 117  "i"
                               Decorate 24(Count) Flat
+                              Decorate 36(gl_FragColor) Location 0
                               Decorate 53(v4) Flat
                2:             TypeVoid
                3:             TypeFunction 2

+ 1 - 0
3rdparty/glslang/Test/baseResults/spv.forwardFun.frag.out

@@ -32,6 +32,7 @@ spv.forwardFun.frag
                               Decorate 27(f) RelaxedPrecision
                               Decorate 28 RelaxedPrecision
                               Decorate 30(gl_FragColor) RelaxedPrecision
+                              Decorate 30(gl_FragColor) Location 0
                               Decorate 31 RelaxedPrecision
                               Decorate 32 RelaxedPrecision
                               Decorate 33 RelaxedPrecision

+ 1 - 0
3rdparty/glslang/Test/baseResults/spv.functionCall.frag.out

@@ -28,6 +28,7 @@ WARNING: 0:5: varying deprecated in version 130; may be removed in future releas
                               Name 66  "g"
                               Name 69  "gl_FragColor"
                               Name 75  "bigColor"
+                              Decorate 69(gl_FragColor) Location 0
                2:             TypeVoid
                3:             TypeFunction 2
                6:             TypeFloat 32

+ 1 - 0
3rdparty/glslang/Test/baseResults/spv.functionSemantics.frag.out

@@ -44,6 +44,7 @@ Warning, version 400 is not yet complete; most version-specific features are pre
                               Name 133  "param"
                               Name 136  "arg"
                               Name 152  "gl_FragColor"
+                              Decorate 152(gl_FragColor) Location 0
                2:             TypeVoid
                3:             TypeFunction 2
                6:             TypeInt 32 1

+ 1 - 0
3rdparty/glslang/Test/baseResults/spv.glFragColor.frag.out

@@ -11,6 +11,7 @@ spv.glFragColor.frag
                               Source GLSL 330
                               Name 4  "main"
                               Name 9  "gl_FragColor"
+                              Decorate 9(gl_FragColor) Location 0
                2:             TypeVoid
                3:             TypeFunction 2
                6:             TypeFloat 32

+ 1 - 0
3rdparty/glslang/Test/baseResults/spv.length.frag.out

@@ -14,6 +14,7 @@ spv.length.frag
                               Name 14  "v"
                               Name 26  "gl_FragColor"
                               Name 32  "u"
+                              Decorate 26(gl_FragColor) Location 0
                2:             TypeVoid
                3:             TypeFunction 2
                6:             TypeFloat 32

+ 1 - 0
3rdparty/glslang/Test/baseResults/spv.localAggregates.frag.out

@@ -42,6 +42,7 @@ Warning, version 400 is not yet complete; most version-specific features are pre
                               Name 135  "foo2"
                               Decorate 15(foo3) Flat
                               Decorate 90(condition) Flat
+                              Decorate 108(gl_FragColor) Location 0
                               Decorate 128(samp2D) DescriptorSet 0
                               Decorate 134(foo) Flat
                               Decorate 135(foo2) Flat

+ 1 - 0
3rdparty/glslang/Test/baseResults/spv.loops.frag.out

@@ -49,6 +49,7 @@ spv.loops.frag
                               Name 687  "d18"
                               Name 698  "d17"
                               Decorate 157(Count) Flat
+                              Decorate 615(gl_FragColor) Location 0
                2:             TypeVoid
                3:             TypeFunction 2
                6:             TypeFloat 32

+ 1 - 0
3rdparty/glslang/Test/baseResults/spv.loopsArtificial.frag.out

@@ -30,6 +30,7 @@ spv.loopsArtificial.frag
                               Name 153  "d2"
                               Name 154  "d3"
                               Name 157  "Count"
+                              Decorate 140(gl_FragColor) Location 0
                               Decorate 157(Count) Flat
                2:             TypeVoid
                3:             TypeFunction 2

+ 198 - 194
3rdparty/glslang/Test/baseResults/spv.multiStruct.comp.out

@@ -3,7 +3,7 @@ Warning, version 450 is not yet complete; most version-specific features are pre
 
 // Module Version 10000
 // Generated by (magic number): 80001
-// Id's are bound by 157
+// Id's are bound by 161
 
                               Capability Shader
                1:             ExtInstImport  "GLSL.std.450"
@@ -22,31 +22,31 @@ Warning, version 450 is not yet complete; most version-specific features are pre
                               Name 17  "SSBO0"
                               MemberName 17(SSBO0) 0  "a"
                               Name 19  "inBuf"
-                              Name 37  "SSBO1"
-                              MemberName 37(SSBO1) 0  "b"
-                              Name 39  "outBuf"
-                              Name 57  "MyStruct"
-                              MemberName 57(MyStruct) 0  "foo"
-                              MemberName 57(MyStruct) 1  "sb"
-                              Name 58  "UBO"
-                              MemberName 58(UBO) 0  "c"
-                              Name 60  "uBuf"
-                              Name 84  "Nested"
-                              MemberName 84(Nested) 0  "f"
-                              MemberName 84(Nested) 1  "S"
-                              Name 86  "n"
-                              Name 88  "Nested"
-                              MemberName 88(Nested) 0  "f"
-                              MemberName 88(Nested) 1  "S"
-                              Name 89  "UBON"
-                              MemberName 89(UBON) 0  "N1"
-                              Name 91  "uBufN"
-                              Name 122  "Nested"
-                              MemberName 122(Nested) 0  "f"
-                              MemberName 122(Nested) 1  "S"
-                              Name 123  "SSBO1N"
-                              MemberName 123(SSBO1N) 0  "N2"
-                              Name 125  "outBufN"
+                              Name 39  "SSBO1"
+                              MemberName 39(SSBO1) 0  "b"
+                              Name 41  "outBuf"
+                              Name 58  "MyStruct"
+                              MemberName 58(MyStruct) 0  "foo"
+                              MemberName 58(MyStruct) 1  "sb"
+                              Name 59  "UBO"
+                              MemberName 59(UBO) 0  "c"
+                              Name 61  "uBuf"
+                              Name 86  "Nested"
+                              MemberName 86(Nested) 0  "f"
+                              MemberName 86(Nested) 1  "S"
+                              Name 88  "n"
+                              Name 90  "Nested"
+                              MemberName 90(Nested) 0  "f"
+                              MemberName 90(Nested) 1  "S"
+                              Name 91  "UBON"
+                              MemberName 91(UBON) 0  "N1"
+                              Name 93  "uBufN"
+                              Name 126  "Nested"
+                              MemberName 126(Nested) 0  "f"
+                              MemberName 126(Nested) 1  "S"
+                              Name 127  "SSBO1N"
+                              MemberName 127(SSBO1N) 0  "N2"
+                              Name 129  "outBufN"
                               Decorate 15 ArrayStride 8
                               MemberDecorate 16(MyStruct) 0 Offset 0
                               MemberDecorate 16(MyStruct) 1 Offset 16
@@ -54,31 +54,31 @@ Warning, version 450 is not yet complete; most version-specific features are pre
                               Decorate 17(SSBO0) BufferBlock
                               Decorate 19(inBuf) DescriptorSet 0
                               Decorate 19(inBuf) Binding 0
-                              MemberDecorate 37(SSBO1) 0 Offset 0
-                              Decorate 37(SSBO1) BufferBlock
-                              Decorate 39(outBuf) DescriptorSet 0
-                              Decorate 39(outBuf) Binding 1
-                              Decorate 56 ArrayStride 16
-                              MemberDecorate 57(MyStruct) 0 Offset 0
-                              MemberDecorate 57(MyStruct) 1 Offset 32
-                              MemberDecorate 58(UBO) 0 Offset 0
-                              Decorate 58(UBO) Block
-                              Decorate 60(uBuf) DescriptorSet 0
-                              Decorate 60(uBuf) Binding 2
-                              Decorate 87 ArrayStride 48
-                              MemberDecorate 88(Nested) 0 Offset 0
-                              MemberDecorate 88(Nested) 1 Offset 16
-                              MemberDecorate 89(UBON) 0 Offset 0
-                              Decorate 89(UBON) Block
-                              Decorate 91(uBufN) DescriptorSet 0
-                              Decorate 91(uBufN) Binding 2
-                              Decorate 121 ArrayStride 24
-                              MemberDecorate 122(Nested) 0 Offset 0
-                              MemberDecorate 122(Nested) 1 Offset 8
-                              MemberDecorate 123(SSBO1N) 0 Offset 0
-                              Decorate 123(SSBO1N) BufferBlock
-                              Decorate 125(outBufN) DescriptorSet 0
-                              Decorate 125(outBufN) Binding 1
+                              MemberDecorate 39(SSBO1) 0 Offset 0
+                              Decorate 39(SSBO1) BufferBlock
+                              Decorate 41(outBuf) DescriptorSet 0
+                              Decorate 41(outBuf) Binding 1
+                              Decorate 57 ArrayStride 16
+                              MemberDecorate 58(MyStruct) 0 Offset 0
+                              MemberDecorate 58(MyStruct) 1 Offset 32
+                              MemberDecorate 59(UBO) 0 Offset 0
+                              Decorate 59(UBO) Block
+                              Decorate 61(uBuf) DescriptorSet 0
+                              Decorate 61(uBuf) Binding 2
+                              Decorate 89 ArrayStride 48
+                              MemberDecorate 90(Nested) 0 Offset 0
+                              MemberDecorate 90(Nested) 1 Offset 16
+                              MemberDecorate 91(UBON) 0 Offset 0
+                              Decorate 91(UBON) Block
+                              Decorate 93(uBufN) DescriptorSet 0
+                              Decorate 93(uBufN) Binding 2
+                              Decorate 125 ArrayStride 24
+                              MemberDecorate 126(Nested) 0 Offset 0
+                              MemberDecorate 126(Nested) 1 Offset 8
+                              MemberDecorate 127(SSBO1N) 0 Offset 0
+                              Decorate 127(SSBO1N) BufferBlock
+                              Decorate 129(outBufN) DescriptorSet 0
+                              Decorate 129(outBufN) Binding 1
                2:             TypeVoid
                3:             TypeFunction 2
                6:             TypeFloat 32
@@ -100,44 +100,44 @@ Warning, version 450 is not yet complete; most version-specific features are pre
               26:             TypePointer Function 10
               29:             TypePointer Function 7(fvec2)
               32:     20(int) Constant 1
-              35:             TypePointer Function 11(bool)
-       37(SSBO1):             TypeStruct 16(MyStruct)
-              38:             TypePointer Uniform 37(SSBO1)
-      39(outBuf):     38(ptr) Variable Uniform
-              43:             TypePointer Uniform 15
-              46:             TypePointer Uniform 7(fvec2)
-              51:      8(int) Constant 0
-              52:      8(int) Constant 1
-              54:             TypePointer Uniform 8(int)
-              56:             TypeArray 7(fvec2) 9
-    57(MyStruct):             TypeStruct 56 8(int)
-         58(UBO):             TypeStruct 57(MyStruct)
-              59:             TypePointer Uniform 58(UBO)
-        60(uBuf):     59(ptr) Variable Uniform
-              61:             TypePointer Uniform 57(MyStruct)
-              83:             TypeArray 12(MyStruct) 9
-      84(Nested):             TypeStruct 6(float) 83
-              85:             TypePointer Function 84(Nested)
-              87:             TypeArray 57(MyStruct) 9
-      88(Nested):             TypeStruct 6(float) 87
-        89(UBON):             TypeStruct 88(Nested)
-              90:             TypePointer Uniform 89(UBON)
-       91(uBufN):     90(ptr) Variable Uniform
-              92:             TypePointer Uniform 88(Nested)
-              96:             TypePointer Function 6(float)
-              99:             TypePointer Function 83
-             121:             TypeArray 16(MyStruct) 9
-     122(Nested):             TypeStruct 6(float) 121
-     123(SSBO1N):             TypeStruct 122(Nested)
-             124:             TypePointer Uniform 123(SSBO1N)
-    125(outBufN):    124(ptr) Variable Uniform
-             127:             TypePointer Uniform 122(Nested)
-             130:             TypePointer Uniform 6(float)
-             133:             TypePointer Uniform 121
+              35:      8(int) Constant 0
+              37:             TypePointer Function 11(bool)
+       39(SSBO1):             TypeStruct 16(MyStruct)
+              40:             TypePointer Uniform 39(SSBO1)
+      41(outBuf):     40(ptr) Variable Uniform
+              45:             TypePointer Uniform 15
+              48:             TypePointer Uniform 7(fvec2)
+              53:      8(int) Constant 1
+              55:             TypePointer Uniform 8(int)
+              57:             TypeArray 7(fvec2) 9
+    58(MyStruct):             TypeStruct 57 8(int)
+         59(UBO):             TypeStruct 58(MyStruct)
+              60:             TypePointer Uniform 59(UBO)
+        61(uBuf):     60(ptr) Variable Uniform
+              62:             TypePointer Uniform 58(MyStruct)
+              85:             TypeArray 12(MyStruct) 9
+      86(Nested):             TypeStruct 6(float) 85
+              87:             TypePointer Function 86(Nested)
+              89:             TypeArray 58(MyStruct) 9
+      90(Nested):             TypeStruct 6(float) 89
+        91(UBON):             TypeStruct 90(Nested)
+              92:             TypePointer Uniform 91(UBON)
+       93(uBufN):     92(ptr) Variable Uniform
+              94:             TypePointer Uniform 90(Nested)
+              98:             TypePointer Function 6(float)
+             101:             TypePointer Function 85
+             125:             TypeArray 16(MyStruct) 9
+     126(Nested):             TypeStruct 6(float) 125
+     127(SSBO1N):             TypeStruct 126(Nested)
+             128:             TypePointer Uniform 127(SSBO1N)
+    129(outBufN):    128(ptr) Variable Uniform
+             131:             TypePointer Uniform 126(Nested)
+             134:             TypePointer Uniform 6(float)
+             137:             TypePointer Uniform 125
          4(main):           2 Function None 3
                5:             Label
            14(t):     13(ptr) Variable Function
-           86(n):     85(ptr) Variable Function
+           88(n):     87(ptr) Variable Function
               23:     22(ptr) AccessChain 19(inBuf) 21
               24:16(MyStruct) Load 23
               25:          15 CompositeExtract 24 0
@@ -149,116 +149,120 @@ Warning, version 450 is not yet complete; most version-specific features are pre
               33:     29(ptr) AccessChain 27 32
                               Store 33 31
               34:      8(int) CompositeExtract 24 1
-              36:     35(ptr) AccessChain 14(t) 32
-                              Store 36 34
-              40:12(MyStruct) Load 14(t)
-              41:     22(ptr) AccessChain 39(outBuf) 21
-              42:          10 CompositeExtract 40 0
-              44:     43(ptr) AccessChain 41 21
-              45:    7(fvec2) CompositeExtract 42 0
-              47:     46(ptr) AccessChain 44 21
-                              Store 47 45
-              48:    7(fvec2) CompositeExtract 42 1
-              49:     46(ptr) AccessChain 44 32
-                              Store 49 48
-              50:    11(bool) CompositeExtract 40 1
-              53:      8(int) Select 50 52 51
-              55:     54(ptr) AccessChain 41 32
-                              Store 55 53
-              62:     61(ptr) AccessChain 60(uBuf) 21
-              63:57(MyStruct) Load 62
-              64:          56 CompositeExtract 63 0
-              65:     26(ptr) AccessChain 14(t) 21
-              66:    7(fvec2) CompositeExtract 64 0
-              67:     29(ptr) AccessChain 65 21
-                              Store 67 66
-              68:    7(fvec2) CompositeExtract 64 1
-              69:     29(ptr) AccessChain 65 32
-                              Store 69 68
-              70:      8(int) CompositeExtract 63 1
-              71:     35(ptr) AccessChain 14(t) 32
-                              Store 71 70
-              72:12(MyStruct) Load 14(t)
-              73:     22(ptr) AccessChain 39(outBuf) 21
-              74:          10 CompositeExtract 72 0
-              75:     43(ptr) AccessChain 73 21
-              76:    7(fvec2) CompositeExtract 74 0
-              77:     46(ptr) AccessChain 75 21
-                              Store 77 76
-              78:    7(fvec2) CompositeExtract 74 1
-              79:     46(ptr) AccessChain 75 32
+              36:    11(bool) INotEqual 34 35
+              38:     37(ptr) AccessChain 14(t) 32
+                              Store 38 36
+              42:12(MyStruct) Load 14(t)
+              43:     22(ptr) AccessChain 41(outBuf) 21
+              44:          10 CompositeExtract 42 0
+              46:     45(ptr) AccessChain 43 21
+              47:    7(fvec2) CompositeExtract 44 0
+              49:     48(ptr) AccessChain 46 21
+                              Store 49 47
+              50:    7(fvec2) CompositeExtract 44 1
+              51:     48(ptr) AccessChain 46 32
+                              Store 51 50
+              52:    11(bool) CompositeExtract 42 1
+              54:      8(int) Select 52 53 35
+              56:     55(ptr) AccessChain 43 32
+                              Store 56 54
+              63:     62(ptr) AccessChain 61(uBuf) 21
+              64:58(MyStruct) Load 63
+              65:          57 CompositeExtract 64 0
+              66:     26(ptr) AccessChain 14(t) 21
+              67:    7(fvec2) CompositeExtract 65 0
+              68:     29(ptr) AccessChain 66 21
+                              Store 68 67
+              69:    7(fvec2) CompositeExtract 65 1
+              70:     29(ptr) AccessChain 66 32
+                              Store 70 69
+              71:      8(int) CompositeExtract 64 1
+              72:    11(bool) INotEqual 71 35
+              73:     37(ptr) AccessChain 14(t) 32
+                              Store 73 72
+              74:12(MyStruct) Load 14(t)
+              75:     22(ptr) AccessChain 41(outBuf) 21
+              76:          10 CompositeExtract 74 0
+              77:     45(ptr) AccessChain 75 21
+              78:    7(fvec2) CompositeExtract 76 0
+              79:     48(ptr) AccessChain 77 21
                               Store 79 78
-              80:    11(bool) CompositeExtract 72 1
-              81:      8(int) Select 80 52 51
-              82:     54(ptr) AccessChain 73 32
-                              Store 82 81
-              93:     92(ptr) AccessChain 91(uBufN) 21
-              94:  88(Nested) Load 93
-              95:    6(float) CompositeExtract 94 0
-              97:     96(ptr) AccessChain 86(n) 21
-                              Store 97 95
-              98:          87 CompositeExtract 94 1
-             100:     99(ptr) AccessChain 86(n) 32
-             101:57(MyStruct) CompositeExtract 98 0
-             102:     13(ptr) AccessChain 100 21
-             103:          56 CompositeExtract 101 0
-             104:     26(ptr) AccessChain 102 21
-             105:    7(fvec2) CompositeExtract 103 0
-             106:     29(ptr) AccessChain 104 21
-                              Store 106 105
-             107:    7(fvec2) CompositeExtract 103 1
-             108:     29(ptr) AccessChain 104 32
+              80:    7(fvec2) CompositeExtract 76 1
+              81:     48(ptr) AccessChain 77 32
+                              Store 81 80
+              82:    11(bool) CompositeExtract 74 1
+              83:      8(int) Select 82 53 35
+              84:     55(ptr) AccessChain 75 32
+                              Store 84 83
+              95:     94(ptr) AccessChain 93(uBufN) 21
+              96:  90(Nested) Load 95
+              97:    6(float) CompositeExtract 96 0
+              99:     98(ptr) AccessChain 88(n) 21
+                              Store 99 97
+             100:          89 CompositeExtract 96 1
+             102:    101(ptr) AccessChain 88(n) 32
+             103:58(MyStruct) CompositeExtract 100 0
+             104:     13(ptr) AccessChain 102 21
+             105:          57 CompositeExtract 103 0
+             106:     26(ptr) AccessChain 104 21
+             107:    7(fvec2) CompositeExtract 105 0
+             108:     29(ptr) AccessChain 106 21
                               Store 108 107
-             109:      8(int) CompositeExtract 101 1
-             110:     35(ptr) AccessChain 102 32
+             109:    7(fvec2) CompositeExtract 105 1
+             110:     29(ptr) AccessChain 106 32
                               Store 110 109
-             111:57(MyStruct) CompositeExtract 98 1
-             112:     13(ptr) AccessChain 100 32
-             113:          56 CompositeExtract 111 0
-             114:     26(ptr) AccessChain 112 21
-             115:    7(fvec2) CompositeExtract 113 0
-             116:     29(ptr) AccessChain 114 21
-                              Store 116 115
-             117:    7(fvec2) CompositeExtract 113 1
-             118:     29(ptr) AccessChain 114 32
-                              Store 118 117
-             119:      8(int) CompositeExtract 111 1
-             120:     35(ptr) AccessChain 112 32
-                              Store 120 119
-             126:  84(Nested) Load 86(n)
-             128:    127(ptr) AccessChain 125(outBufN) 21
-             129:    6(float) CompositeExtract 126 0
-             131:    130(ptr) AccessChain 128 21
-                              Store 131 129
-             132:          83 CompositeExtract 126 1
-             134:    133(ptr) AccessChain 128 32
-             135:12(MyStruct) CompositeExtract 132 0
-             136:     22(ptr) AccessChain 134 21
-             137:          10 CompositeExtract 135 0
-             138:     43(ptr) AccessChain 136 21
-             139:    7(fvec2) CompositeExtract 137 0
-             140:     46(ptr) AccessChain 138 21
-                              Store 140 139
-             141:    7(fvec2) CompositeExtract 137 1
-             142:     46(ptr) AccessChain 138 32
-                              Store 142 141
-             143:    11(bool) CompositeExtract 135 1
-             144:      8(int) Select 143 52 51
-             145:     54(ptr) AccessChain 136 32
-                              Store 145 144
-             146:12(MyStruct) CompositeExtract 132 1
-             147:     22(ptr) AccessChain 134 32
-             148:          10 CompositeExtract 146 0
-             149:     43(ptr) AccessChain 147 21
-             150:    7(fvec2) CompositeExtract 148 0
-             151:     46(ptr) AccessChain 149 21
-                              Store 151 150
-             152:    7(fvec2) CompositeExtract 148 1
-             153:     46(ptr) AccessChain 149 32
-                              Store 153 152
-             154:    11(bool) CompositeExtract 146 1
-             155:      8(int) Select 154 52 51
-             156:     54(ptr) AccessChain 147 32
-                              Store 156 155
+             111:      8(int) CompositeExtract 103 1
+             112:    11(bool) INotEqual 111 35
+             113:     37(ptr) AccessChain 104 32
+                              Store 113 112
+             114:58(MyStruct) CompositeExtract 100 1
+             115:     13(ptr) AccessChain 102 32
+             116:          57 CompositeExtract 114 0
+             117:     26(ptr) AccessChain 115 21
+             118:    7(fvec2) CompositeExtract 116 0
+             119:     29(ptr) AccessChain 117 21
+                              Store 119 118
+             120:    7(fvec2) CompositeExtract 116 1
+             121:     29(ptr) AccessChain 117 32
+                              Store 121 120
+             122:      8(int) CompositeExtract 114 1
+             123:    11(bool) INotEqual 122 35
+             124:     37(ptr) AccessChain 115 32
+                              Store 124 123
+             130:  86(Nested) Load 88(n)
+             132:    131(ptr) AccessChain 129(outBufN) 21
+             133:    6(float) CompositeExtract 130 0
+             135:    134(ptr) AccessChain 132 21
+                              Store 135 133
+             136:          85 CompositeExtract 130 1
+             138:    137(ptr) AccessChain 132 32
+             139:12(MyStruct) CompositeExtract 136 0
+             140:     22(ptr) AccessChain 138 21
+             141:          10 CompositeExtract 139 0
+             142:     45(ptr) AccessChain 140 21
+             143:    7(fvec2) CompositeExtract 141 0
+             144:     48(ptr) AccessChain 142 21
+                              Store 144 143
+             145:    7(fvec2) CompositeExtract 141 1
+             146:     48(ptr) AccessChain 142 32
+                              Store 146 145
+             147:    11(bool) CompositeExtract 139 1
+             148:      8(int) Select 147 53 35
+             149:     55(ptr) AccessChain 140 32
+                              Store 149 148
+             150:12(MyStruct) CompositeExtract 136 1
+             151:     22(ptr) AccessChain 138 32
+             152:          10 CompositeExtract 150 0
+             153:     45(ptr) AccessChain 151 21
+             154:    7(fvec2) CompositeExtract 152 0
+             155:     48(ptr) AccessChain 153 21
+                              Store 155 154
+             156:    7(fvec2) CompositeExtract 152 1
+             157:     48(ptr) AccessChain 153 32
+                              Store 157 156
+             158:    11(bool) CompositeExtract 150 1
+             159:      8(int) Select 158 53 35
+             160:     55(ptr) AccessChain 151 32
+                              Store 160 159
                               Return
                               FunctionEnd

+ 4 - 1
3rdparty/glslang/Test/baseResults/spv.noLocation.vert.out

@@ -2,7 +2,10 @@ spv.noLocation.vert
 Warning, version 450 is not yet complete; most version-specific features are present, but some are missing.
 ERROR: spv.noLocation.vert:4: 'location' : SPIR-V requires location for user input/output 
 ERROR: spv.noLocation.vert:8: 'location' : SPIR-V requires location for user input/output 
-ERROR: 2 compilation errors.  No code generated.
+ERROR: spv.noLocation.vert:19: 'location' : SPIR-V requires location for user input/output 
+ERROR: spv.noLocation.vert:25: 'location' : SPIR-V requires location for user input/output 
+ERROR: spv.noLocation.vert:29: 'location' : SPIR-V requires location for user input/output 
+ERROR: 5 compilation errors.  No code generated.
 
 
 SPIR-V is not generated for failed compile or link

+ 1 - 0
3rdparty/glslang/Test/baseResults/spv.prepost.frag.out

@@ -20,6 +20,7 @@ spv.prepost.frag
                               Name 66  "z"
                               Name 73  "v"
                               Name 90  "gl_FragColor"
+                              Decorate 90(gl_FragColor) Location 0
                2:             TypeVoid
                3:             TypeFunction 2
                6:             TypeInt 32 1

+ 1 - 0
3rdparty/glslang/Test/baseResults/spv.simpleFunctionCall.frag.out

@@ -13,6 +13,7 @@ spv.simpleFunctionCall.frag
                               Name 9  "foo("
                               Name 12  "BaseColor"
                               Name 17  "gl_FragColor"
+                              Decorate 17(gl_FragColor) Location 0
                2:             TypeVoid
                3:             TypeFunction 2
                6:             TypeFloat 32

+ 1 - 0
3rdparty/glslang/Test/baseResults/spv.structAssignment.frag.out

@@ -36,6 +36,7 @@ WARNING: 0:6: '' : all default precisions are highp; use precision statements to
                               MemberDecorate 9(lunarStruct2) 0 RelaxedPrecision
                               MemberDecorate 10(lunarStruct3) 1 RelaxedPrecision
                               Decorate 16 RelaxedPrecision
+                              Decorate 31(gl_FragColor) Location 0
                               Decorate 40(samp2D) DescriptorSet 0
                               Decorate 44(coord) RelaxedPrecision
                               Decorate 45 RelaxedPrecision

+ 1 - 0
3rdparty/glslang/Test/baseResults/spv.structDeref.frag.out

@@ -40,6 +40,7 @@ spv.structDeref.frag
                               Name 99  "gl_FragColor"
                               Name 116  "samp2D"
                               Name 122  "foo2"
+                              Decorate 99(gl_FragColor) Location 0
                               Decorate 116(samp2D) DescriptorSet 0
                2:             TypeVoid
                3:             TypeFunction 2

+ 1 - 0
3rdparty/glslang/Test/baseResults/spv.structure.frag.out

@@ -24,6 +24,7 @@ spv.structure.frag
                               Name 50  "samp2D"
                               Name 54  "coord"
                               Name 59  "foo"
+                              Decorate 45(gl_FragColor) Location 0
                               Decorate 50(samp2D) DescriptorSet 0
                2:             TypeVoid
                3:             TypeFunction 2

+ 1 - 0
3rdparty/glslang/Test/baseResults/spv.swizzle.frag.out

@@ -24,6 +24,7 @@ spv.swizzle.frag
                               Name 81  "c"
                               Name 83  "rep"
                               Name 107  "blend"
+                              Decorate 69(gl_FragColor) Location 0
                2:             TypeVoid
                3:             TypeFunction 2
                6:             TypeFloat 32

+ 1 - 0
3rdparty/glslang/Test/baseResults/spv.test.frag.out

@@ -25,6 +25,7 @@ Warning, version 400 is not yet complete; most version-specific features are pre
                               Name 49  "blend"
                               Decorate 16(texSampler2D) DescriptorSet 0
                               Decorate 33(texSampler3D) DescriptorSet 0
+                              Decorate 43(gl_FragColor) Location 0
                2:             TypeVoid
                3:             TypeFunction 2
                6:             TypeFloat 32

+ 1 - 0
3rdparty/glslang/Test/baseResults/spv.texture.frag.out

@@ -45,6 +45,7 @@ WARNING: 0:12: varying deprecated in version 130; may be removed in future relea
                               Decorate 130(texSamplerCube) DescriptorSet 0
                               Decorate 145(shadowSampler1D) DescriptorSet 0
                               Decorate 164(shadowSampler2D) DescriptorSet 0
+                              Decorate 291(gl_FragColor) Location 0
                2:             TypeVoid
                3:             TypeFunction 2
                6:             TypeFloat 32

+ 1 - 0
3rdparty/glslang/Test/baseResults/spv.types.frag.out

@@ -55,6 +55,7 @@ spv.types.frag
                               Decorate 111(i_i3) Flat
                               Decorate 118(u_i4) Flat
                               Decorate 120(i_i4) Flat
+                              Decorate 160(gl_FragColor) Location 0
                2:             TypeVoid
                3:             TypeFunction 2
                6:             TypeBool

+ 1 - 0
3rdparty/glslang/Test/baseResults/spv.uniformArray.frag.out

@@ -16,6 +16,7 @@ spv.uniformArray.frag
                               Name 35  "alpha"
                               Name 47  "gl_FragColor"
                               Name 52  "texSampler2D"
+                              Decorate 47(gl_FragColor) Location 0
                               Decorate 52(texSampler2D) DescriptorSet 0
                2:             TypeVoid
                3:             TypeFunction 2

+ 1 - 0
3rdparty/glslang/Test/baseResults/spv.variableArrayIndex.frag.out

@@ -38,6 +38,7 @@ Warning, version 400 is not yet complete; most version-specific features are pre
                               Decorate 20(foo3) Flat
                               Decorate 34(foo2) Flat
                               Decorate 36(foo) Flat
+                              Decorate 54(gl_FragColor) Location 0
                               Decorate 59(samp2D) DescriptorSet 0
                2:             TypeVoid
                3:             TypeFunction 2

+ 1 - 0
3rdparty/glslang/Test/baseResults/spv.varyingArray.frag.out

@@ -18,6 +18,7 @@ spv.varyingArray.frag
                               Name 45  "gl_FragColor"
                               Name 48  "foo"
                               Decorate 13(texSampler2D) DescriptorSet 0
+                              Decorate 45(gl_FragColor) Location 0
                2:             TypeVoid
                3:             TypeFunction 2
                6:             TypeFloat 32

+ 1 - 0
3rdparty/glslang/Test/baseResults/spv.varyingArrayIndirect.frag.out

@@ -22,6 +22,7 @@ spv.varyingArrayIndirect.frag
                               Decorate 13(texSampler2D) DescriptorSet 0
                               Decorate 22(b) Flat
                               Decorate 31(a) Flat
+                              Decorate 56(gl_FragColor) Location 0
                2:             TypeVoid
                3:             TypeFunction 2
                6:             TypeFloat 32

+ 1 - 0
3rdparty/glslang/Test/baseResults/spv.voidFunction.frag.out

@@ -20,6 +20,7 @@ Warning, version 400 is not yet complete; most version-specific features are pre
                               Name 37  "gl_FragColor"
                               Name 40  "BaseColor"
                               Name 42  "d"
+                              Decorate 37(gl_FragColor) Location 0
                2:             TypeVoid
                3:             TypeFunction 2
               10:             TypeFloat 32

+ 1 - 0
3rdparty/glslang/Test/baseResults/spv.whileLoop.frag.out

@@ -15,6 +15,7 @@ spv.whileLoop.frag
                               Name 24  "d"
                               Name 28  "bigColor"
                               Name 33  "gl_FragColor"
+                              Decorate 33(gl_FragColor) Location 0
                2:             TypeVoid
                3:             TypeFunction 2
                6:             TypeFloat 32

+ 52 - 0
3rdparty/glslang/Test/hlsl.constructimat.frag

@@ -0,0 +1,52 @@
+int main() : SV_TARGET
+{
+    // integer mat constructors
+    const int4x4 var441 = { 0,1,0,0, 1,1,0,0, 1,0,0,0, 0,0,0,0 };
+    const int4x4 var442 = int4x4( 0,1,0,0, 1,1,0,0, 1,0,0,0, 0,0,0,0 );
+    int4x4 var443 = { 0,1,0,0, 1,1,0,0, 1,0,0,0, 0,0,0,0 };
+    int4x4 var444 = int4x4( 0,1,0,0, 1,1,0,0, 1,0,0,0, 0,0,0,0 );
+
+    const int4x2 var421 = { 0,1, 1,1, 1,0, 0,0 };
+    const int4x2 var422 = int4x2( 0,1, 1,1, 1,0, 0,0 );
+    int4x2 var423 = { 0,1, 1,1, 1,0, 0,0 };
+    int4x2 var424 = int4x2( 0,1, 1,1, 1,0, 0,0 );
+
+    const int3x2 var321 = { 0,1, 1,1, 1,0 };
+    const int3x2 var322 = int3x2( 0,1, 1,1, 1,0 );
+    int3x2 var323 = { 0,1, 1,1, 1,0 };
+    int3x2 var234 = int3x2( 0,1, 1,1, 1,0);
+
+    // unsigned integer mat constructors
+    const uint4x4 uvar441 = { 0,1,0,0, 1,1,0,0, 1,0,0,0, 0,0,0,0 };
+    const uint4x4 uvar442 = uint4x4( 0,1,0,0, 1,1,0,0, 1,0,0,0, 0,0,0,0 );
+    uint4x4 uvar443 = { 0,1,0,0, 1,1,0,0, 1,0,0,0, 0,0,0,0 };
+    uint4x4 uvar444 = uint4x4( 0,1,0,0, 1,1,0,0, 1,0,0,0, 0,0,0,0 );
+
+    const uint4x2 uvar421 = { 0,1, 1,1, 1,0, 0,0 };
+    const uint4x2 uvar422 = uint4x2( 0,1, 1,1, 1,0, 0,0 );
+    uint4x2 uvar423 = { 0,1, 1,1, 1,0, 0,0 };
+    uint4x2 uvar424 = uint4x2( 0,1, 1,1, 1,0, 0,0 );
+
+    const uint3x2 uvar321 = { 0,1, 1,1, 1,0 };
+    const uint3x2 uvar322 = uint3x2( 0,1, 1,1, 1,0 );
+    uint3x2 uvar323 = { 0,1, 1,1, 1,0 };
+    uint3x2 uvar234 = uint3x2( 0,1, 1,1, 1,0);
+
+    // boolean mat constructors
+    const bool4x4 bvar441 = { 0,1,0,0, 1,1,0,0, 1,0,0,0, 0,0,0,0 };
+    const bool4x4 bvar442 = bool4x4( 0,1,0,0, 1,1,0,0, 1,0,0,0, 0,0,0,0 );
+    bool4x4 bvar443 = { 0,1,0,0, 1,1,0,0, 1,0,0,0, 0,0,0,0 };
+    bool4x4 bvar444 = bool4x4( 0,1,0,0, 1,1,0,0, 1,0,0,0, 0,0,0,0 );
+
+    const bool4x2 bvar421 = { 0,1, 1,1, 1,0, 0,0 };
+    const bool4x2 bvar422 = bool4x2( 0,1, 1,1, 1,0, 0,0 );
+    bool4x2 bvar423 = { 0,1, 1,1, 1,0, 0,0 };
+    bool4x2 bvar424 = bool4x2( 0,1, 1,1, 1,0, 0,0 );
+
+    const bool3x2 bvar321 = { 0,1, 1,1, 1,0 };
+    const bool3x2 bvar322 = bool3x2( 0,1, 1,1, 1,0 );
+    bool3x2 bvar323 = { 0,1, 1,1, 1,0 };
+    bool3x2 bvar234 = bool3x2( 0,1, 1,1, 1,0);
+
+    return 0;
+}

+ 25 - 0
3rdparty/glslang/Test/hlsl.function.frag

@@ -0,0 +1,25 @@
+float4 fun0()
+{
+    return 1.0f;
+}
+
+uint fun2(float4 col)
+{
+    return 7;
+}
+
+float4 fun4(uint id1, uint id2)
+{
+    return id1 * id2;
+}
+
+float4 fun1(int index)
+{
+    uint entityId = fun2(fun0());
+    return fun4(entityId, entityId);
+}
+
+int main() : SV_TARGET
+{
+    return fun1;
+}

+ 17 - 0
3rdparty/glslang/Test/hlsl.tx.overload.frag

@@ -0,0 +1,17 @@
+
+Texture2D<float>  tf1;
+Texture2D<float4> tf4;
+
+RWTexture2D<float>  twf1;
+RWTexture2D<float4> twf4;
+
+float Func(Texture2D<float> DummyTex) { return 1.0f; }
+float4 Func(Texture2D<float4> DummyTex) { return float4(0,0,0,0); }
+
+float Func(RWTexture2D<float> DummyTex) { return 1.0f; }
+float4 Func(RWTexture2D<float4> DummyTex) { return float4(0,0,0,0); }
+
+float4 main() : SV_TARGET
+{
+    return Func(tf1) + Func(tf4) + Func(twf1) + Func(twf4);
+}

+ 27 - 2
3rdparty/glslang/Test/spv.noLocation.vert

@@ -1,14 +1,39 @@
 #version 450
 
 layout(location = 1) in vec4 in1;
-in vec4 in2;
+in vec4 in2;                        // ERROR
 layout(location = 3) in vec4 in3;
 
 layout(location = 1) out vec4 out1;
-out vec4 out2;
+out vec4 out2;                      // ERROR
 layout(location = 3) out vec4 out3;
 
+layout(location = 10) out inb1 { 
+    vec4 a;
+    vec4 b;
+} inbi1;
+out inb2 { 
+    layout(location = 12) vec4 a;
+    layout(location = 13) vec4 b;
+} inbi2;
+out inb3 {                          // ERROR
+    vec4 a;
+    vec4 b;
+} inbi3;
+
+layout(location = 14) out struct S1 { vec4 a; } s1;
+out struct S2 { vec4 a; } s2;       // ERROR
+
+struct SS { int a; };
+out layout(location = 15) SS ss1;
+out SS ss2;                         // ERROR
+
+out gl_PerVertex {
+    vec4 gl_Position;
+    float gl_ClipDistance[2];
+};
 
 void main()
 {
+    gl_ClipDistance[0] = 1.0;
 }

+ 27 - 0
3rdparty/glslang/glslang/Include/intermediate.h

@@ -436,6 +436,33 @@ enum TOperator {
     EOpConstructDMat4x2,
     EOpConstructDMat4x3,
     EOpConstructDMat4x4,
+    EOpConstructIMat2x2,
+    EOpConstructIMat2x3,
+    EOpConstructIMat2x4,
+    EOpConstructIMat3x2,
+    EOpConstructIMat3x3,
+    EOpConstructIMat3x4,
+    EOpConstructIMat4x2,
+    EOpConstructIMat4x3,
+    EOpConstructIMat4x4,
+    EOpConstructUMat2x2,
+    EOpConstructUMat2x3,
+    EOpConstructUMat2x4,
+    EOpConstructUMat3x2,
+    EOpConstructUMat3x3,
+    EOpConstructUMat3x4,
+    EOpConstructUMat4x2,
+    EOpConstructUMat4x3,
+    EOpConstructUMat4x4,
+    EOpConstructBMat2x2,
+    EOpConstructBMat2x3,
+    EOpConstructBMat2x4,
+    EOpConstructBMat3x2,
+    EOpConstructBMat3x3,
+    EOpConstructBMat3x4,
+    EOpConstructBMat4x2,
+    EOpConstructBMat4x3,
+    EOpConstructBMat4x4,
 #ifdef AMD_EXTENSIONS
     EOpConstructFloat16,
     EOpConstructF16Vec2,

+ 9 - 1
3rdparty/glslang/glslang/MachineIndependent/Initialize.cpp

@@ -5187,7 +5187,15 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
         SpecialQualifier("gl_FrontFacing",      EvqFace,       EbvFace,             symbolTable);
         SpecialQualifier("gl_FragCoord",        EvqFragCoord,  EbvFragCoord,        symbolTable);
         SpecialQualifier("gl_PointCoord",       EvqPointCoord, EbvPointCoord,       symbolTable);
-        SpecialQualifier("gl_FragColor",        EvqFragColor,  EbvFragColor,        symbolTable);
+        if (spvVersion.spv == 0)
+            SpecialQualifier("gl_FragColor",    EvqFragColor,  EbvFragColor,        symbolTable);
+        else {
+            TSymbol* symbol = symbolTable.find("gl_FragColor");
+            if (symbol) {
+                symbol->getWritableType().getQualifier().storage = EvqVaryingOut;
+                symbol->getWritableType().getQualifier().layoutLocation = 0;
+            }
+        }
         SpecialQualifier("gl_FragDepth",        EvqFragDepth,  EbvFragDepth,        symbolTable);
         SpecialQualifier("gl_FragDepthEXT",     EvqFragDepth,  EbvFragDepth,        symbolTable);
         SpecialQualifier("gl_HelperInvocation", EvqVaryingIn,  EbvHelperInvocation, symbolTable);

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

@@ -1220,21 +1220,79 @@ TOperator TIntermediate::mapTypeToConstructorOp(const TType& type) const
         break;
 #endif
     case EbtInt:
-        switch(type.getVectorSize()) {
-        case 1: op = EOpConstructInt;   break;
-        case 2: op = EOpConstructIVec2; break;
-        case 3: op = EOpConstructIVec3; break;
-        case 4: op = EOpConstructIVec4; break;
-        default: break; // some compilers want this
+        if (type.getMatrixCols()) {
+            switch (type.getMatrixCols()) {
+            case 2:
+                switch (type.getMatrixRows()) {
+                case 2: op = EOpConstructIMat2x2; break;
+                case 3: op = EOpConstructIMat2x3; break;
+                case 4: op = EOpConstructIMat2x4; break;
+                default: break; // some compilers want this
+                }
+                break;
+            case 3:
+                switch (type.getMatrixRows()) {
+                case 2: op = EOpConstructIMat3x2; break;
+                case 3: op = EOpConstructIMat3x3; break;
+                case 4: op = EOpConstructIMat3x4; break;
+                default: break; // some compilers want this
+                }
+                break;
+            case 4:
+                switch (type.getMatrixRows()) {
+                case 2: op = EOpConstructIMat4x2; break;
+                case 3: op = EOpConstructIMat4x3; break;
+                case 4: op = EOpConstructIMat4x4; break;
+                default: break; // some compilers want this
+                }
+                break;
+            }
+        } else {
+            switch(type.getVectorSize()) {
+            case 1: op = EOpConstructInt;   break;
+            case 2: op = EOpConstructIVec2; break;
+            case 3: op = EOpConstructIVec3; break;
+            case 4: op = EOpConstructIVec4; break;
+            default: break; // some compilers want this
+            }
         }
         break;
     case EbtUint:
-        switch(type.getVectorSize()) {
-        case 1: op = EOpConstructUint;  break;
-        case 2: op = EOpConstructUVec2; break;
-        case 3: op = EOpConstructUVec3; break;
-        case 4: op = EOpConstructUVec4; break;
-        default: break; // some compilers want this
+        if (type.getMatrixCols()) {
+            switch (type.getMatrixCols()) {
+            case 2:
+                switch (type.getMatrixRows()) {
+                case 2: op = EOpConstructUMat2x2; break;
+                case 3: op = EOpConstructUMat2x3; break;
+                case 4: op = EOpConstructUMat2x4; break;
+                default: break; // some compilers want this
+                }
+                break;
+            case 3:
+                switch (type.getMatrixRows()) {
+                case 2: op = EOpConstructUMat3x2; break;
+                case 3: op = EOpConstructUMat3x3; break;
+                case 4: op = EOpConstructUMat3x4; break;
+                default: break; // some compilers want this
+                }
+                break;
+            case 4:
+                switch (type.getMatrixRows()) {
+                case 2: op = EOpConstructUMat4x2; break;
+                case 3: op = EOpConstructUMat4x3; break;
+                case 4: op = EOpConstructUMat4x4; break;
+                default: break; // some compilers want this
+                }
+                break;
+            }
+        } else {
+            switch(type.getVectorSize()) {
+            case 1: op = EOpConstructUint;  break;
+            case 2: op = EOpConstructUVec2; break;
+            case 3: op = EOpConstructUVec3; break;
+            case 4: op = EOpConstructUVec4; break;
+            default: break; // some compilers want this
+            }
         }
         break;
     case EbtInt64:
@@ -1256,12 +1314,41 @@ TOperator TIntermediate::mapTypeToConstructorOp(const TType& type) const
         }
         break;
     case EbtBool:
-        switch(type.getVectorSize()) {
-        case 1:  op = EOpConstructBool;  break;
-        case 2:  op = EOpConstructBVec2; break;
-        case 3:  op = EOpConstructBVec3; break;
-        case 4:  op = EOpConstructBVec4; break;
-        default: break; // some compilers want this
+        if (type.getMatrixCols()) {
+            switch (type.getMatrixCols()) {
+            case 2:
+                switch (type.getMatrixRows()) {
+                case 2: op = EOpConstructBMat2x2; break;
+                case 3: op = EOpConstructBMat2x3; break;
+                case 4: op = EOpConstructBMat2x4; break;
+                default: break; // some compilers want this
+                }
+                break;
+            case 3:
+                switch (type.getMatrixRows()) {
+                case 2: op = EOpConstructBMat3x2; break;
+                case 3: op = EOpConstructBMat3x3; break;
+                case 4: op = EOpConstructBMat3x4; break;
+                default: break; // some compilers want this
+                }
+                break;
+            case 4:
+                switch (type.getMatrixRows()) {
+                case 2: op = EOpConstructBMat4x2; break;
+                case 3: op = EOpConstructBMat4x3; break;
+                case 4: op = EOpConstructBMat4x4; break;
+                default: break; // some compilers want this
+                }
+                break;
+            }
+        } else {
+            switch(type.getVectorSize()) {
+            case 1:  op = EOpConstructBool;  break;
+            case 2:  op = EOpConstructBVec2; break;
+            case 3:  op = EOpConstructBVec3; break;
+            case 4:  op = EOpConstructBVec4; break;
+            default: break; // some compilers want this
+            }
         }
         break;
     default:

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

@@ -4332,14 +4332,21 @@ void TParseContext::layoutObjectCheck(const TSourceLoc& loc, const TSymbol& symb
         default:
             break;
         }
-    } else if (spvVersion.spv > 0) {
+    }
+
+    // user-variable location check, which are required for SPIR-V in/out:
+    //  - variables have it directly,
+    //  - blocks have it on each member (already enforced), so check first one
+    if (spvVersion.spv > 0 && !parsingBuiltins && qualifier.builtIn == EbvNone &&
+        !qualifier.hasLocation() && !intermediate.getAutoMapLocations()) {
+
         switch (qualifier.storage) {
         case EvqVaryingIn:
         case EvqVaryingOut:
-            if (! parsingBuiltins && qualifier.builtIn == EbvNone) {
-                if (!intermediate.getAutoMapLocations())
-                    error(loc, "SPIR-V requires location for user input/output", "location", "");
-            }
+            if (type.getBasicType() != EbtBlock || 
+                (!(*type.getStruct())[0].type->getQualifier().hasLocation() && 
+                  (*type.getStruct())[0].type->getQualifier().builtIn == EbvNone))
+                error(loc, "SPIR-V requires location for user input/output", "location", "");
             break;
         default:
             break;

+ 8 - 0
3rdparty/glslang/glslang/MachineIndependent/SymbolTable.cpp

@@ -99,6 +99,14 @@ void TType::buildMangledName(TString& mangledName) const
         case EsdSubpass:  mangledName += "P";  break;
         default: break; // some compilers want this
         }
+
+        switch (sampler.vectorSize) {
+        case 1: mangledName += "1"; break;
+        case 2: mangledName += "2"; break;
+        case 3: mangledName += "3"; break;
+        case 4: break; // default to prior name mangle behavior
+        }
+
         if (sampler.ms)
             mangledName += "M";
         break;

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

@@ -505,6 +505,33 @@ bool TOutputTraverser::visitAggregate(TVisit /* visit */, TIntermAggregate* node
     case EOpConstructDMat4x2: out.debug << "Construct dmat4x2"; break;
     case EOpConstructDMat4x3: out.debug << "Construct dmat4x3"; break;
     case EOpConstructDMat4x4: out.debug << "Construct dmat4";   break;
+    case EOpConstructIMat2x2: out.debug << "Construct imat2";   break;
+    case EOpConstructIMat2x3: out.debug << "Construct imat2x3"; break;
+    case EOpConstructIMat2x4: out.debug << "Construct imat2x4"; break;
+    case EOpConstructIMat3x2: out.debug << "Construct imat3x2"; break;
+    case EOpConstructIMat3x3: out.debug << "Construct imat3";   break;
+    case EOpConstructIMat3x4: out.debug << "Construct imat3x4"; break;
+    case EOpConstructIMat4x2: out.debug << "Construct imat4x2"; break;
+    case EOpConstructIMat4x3: out.debug << "Construct imat4x3"; break;
+    case EOpConstructIMat4x4: out.debug << "Construct imat4";   break;
+    case EOpConstructUMat2x2: out.debug << "Construct umat2";   break;
+    case EOpConstructUMat2x3: out.debug << "Construct umat2x3"; break;
+    case EOpConstructUMat2x4: out.debug << "Construct umat2x4"; break;
+    case EOpConstructUMat3x2: out.debug << "Construct umat3x2"; break;
+    case EOpConstructUMat3x3: out.debug << "Construct umat3";   break;
+    case EOpConstructUMat3x4: out.debug << "Construct umat3x4"; break;
+    case EOpConstructUMat4x2: out.debug << "Construct umat4x2"; break;
+    case EOpConstructUMat4x3: out.debug << "Construct umat4x3"; break;
+    case EOpConstructUMat4x4: out.debug << "Construct umat4";   break;
+    case EOpConstructBMat2x2: out.debug << "Construct bmat2";   break;
+    case EOpConstructBMat2x3: out.debug << "Construct bmat2x3"; break;
+    case EOpConstructBMat2x4: out.debug << "Construct bmat2x4"; break;
+    case EOpConstructBMat3x2: out.debug << "Construct bmat3x2"; break;
+    case EOpConstructBMat3x3: out.debug << "Construct bmat3";   break;
+    case EOpConstructBMat3x4: out.debug << "Construct bmat3x4"; break;
+    case EOpConstructBMat4x2: out.debug << "Construct bmat4x2"; break;
+    case EOpConstructBMat4x3: out.debug << "Construct bmat4x3"; break;
+    case EOpConstructBMat4x4: out.debug << "Construct bmat4";   break;
 #ifdef AMD_EXTENSIONS
     case EOpConstructFloat16:   out.debug << "Construct float16_t"; break;
     case EOpConstructF16Vec2:   out.debug << "Construct f16vec2";   break;

+ 3 - 0
3rdparty/glslang/gtests/Hlsl.FromFile.cpp

@@ -100,6 +100,7 @@ INSTANTIATE_TEST_CASE_P(
         {"hlsl.conditional.frag", "PixelShaderFunction"},
         {"hlsl.constantbuffer.frag", "main"},
         {"hlsl.constructexpr.frag", "main"},
+        {"hlsl.constructimat.frag", "main"},
         {"hlsl.depthGreater.frag", "PixelShaderFunction"},
         {"hlsl.depthLess.frag", "PixelShaderFunction"},
         {"hlsl.discard.frag", "PixelShaderFunction"},
@@ -131,6 +132,7 @@ INSTANTIATE_TEST_CASE_P(
         {"hlsl.domain.1.tese", "main"},
         {"hlsl.domain.2.tese", "main"},
         {"hlsl.domain.3.tese", "main"},
+        {"hlsl.function.frag", "main"},
         {"hlsl.hull.1.tesc", "main"},
         {"hlsl.hull.2.tesc", "main"},
         {"hlsl.hull.void.tesc", "main"},
@@ -287,6 +289,7 @@ INSTANTIATE_TEST_CASE_P(
         {"hlsl.swizzle.frag", "PixelShaderFunction"},
         {"hlsl.templatetypes.frag", "PixelShaderFunction"},
         {"hlsl.tx.bracket.frag", "main"},
+        {"hlsl.tx.overload.frag", "main"},
         {"hlsl.type.half.frag", "main"},
         {"hlsl.type.identifier.frag", "main"},
         {"hlsl.typeGraphCopy.vert", "main"},

+ 66 - 6
3rdparty/glslang/hlsl/hlslParseHelper.cpp

@@ -2988,13 +2988,19 @@ void HlslParseContext::decomposeSampleMethods(const TSourceLoc& loc, TIntermType
     const TOperator op  = node->getAsOperator()->getOp();
     const TIntermAggregate* argAggregate = arguments ? arguments->getAsAggregate() : nullptr;
 
-    // Bail out if not a sampler method
+    // Bail out if not a sampler method.
+    // Note though this is odd to do before checking the op, because the op
+    // could be something that takes the arguments, and the function in question
+    // takes the result of the op.  So, this is not the final word.
     if (arguments != nullptr) {
-        if ((argAggregate != nullptr && argAggregate->getSequence()[0]->getAsTyped()->getBasicType() != EbtSampler))
-            return;
-
-        if (argAggregate == nullptr && arguments->getAsTyped()->getBasicType() != EbtSampler)
-            return;
+        if (argAggregate == nullptr) {
+            if (arguments->getAsTyped()->getBasicType() != EbtSampler)
+                return;
+        } else {
+            if (argAggregate->getSequence().size() == 0 ||
+                argAggregate->getSequence()[0]->getAsTyped()->getBasicType() != EbtSampler)
+                return;
+        }
     }
 
     switch (op) {
@@ -5150,6 +5156,33 @@ bool HlslParseContext::constructorError(const TSourceLoc& loc, TIntermNode* node
     case EOpConstructDMat4x2:
     case EOpConstructDMat4x3:
     case EOpConstructDMat4x4:
+    case EOpConstructIMat2x2:
+    case EOpConstructIMat2x3:
+    case EOpConstructIMat2x4:
+    case EOpConstructIMat3x2:
+    case EOpConstructIMat3x3:
+    case EOpConstructIMat3x4:
+    case EOpConstructIMat4x2:
+    case EOpConstructIMat4x3:
+    case EOpConstructIMat4x4:
+    case EOpConstructUMat2x2:
+    case EOpConstructUMat2x3:
+    case EOpConstructUMat2x4:
+    case EOpConstructUMat3x2:
+    case EOpConstructUMat3x3:
+    case EOpConstructUMat3x4:
+    case EOpConstructUMat4x2:
+    case EOpConstructUMat4x3:
+    case EOpConstructUMat4x4:
+    case EOpConstructBMat2x2:
+    case EOpConstructBMat2x3:
+    case EOpConstructBMat2x4:
+    case EOpConstructBMat3x2:
+    case EOpConstructBMat3x3:
+    case EOpConstructBMat3x4:
+    case EOpConstructBMat4x2:
+    case EOpConstructBMat4x3:
+    case EOpConstructBMat4x4:
         constructingMatrix = true;
         break;
     default:
@@ -7274,6 +7307,15 @@ TIntermTyped* HlslParseContext::constructBuiltIn(const TType& type, TOperator op
     case EOpConstructIVec2:
     case EOpConstructIVec3:
     case EOpConstructIVec4:
+    case EOpConstructIMat2x2:
+    case EOpConstructIMat2x3:
+    case EOpConstructIMat2x4:
+    case EOpConstructIMat3x2:
+    case EOpConstructIMat3x3:
+    case EOpConstructIMat3x4:
+    case EOpConstructIMat4x2:
+    case EOpConstructIMat4x3:
+    case EOpConstructIMat4x4:
     case EOpConstructInt:
         basicOp = EOpConstructInt;
         break;
@@ -7281,6 +7323,15 @@ TIntermTyped* HlslParseContext::constructBuiltIn(const TType& type, TOperator op
     case EOpConstructUVec2:
     case EOpConstructUVec3:
     case EOpConstructUVec4:
+    case EOpConstructUMat2x2:
+    case EOpConstructUMat2x3:
+    case EOpConstructUMat2x4:
+    case EOpConstructUMat3x2:
+    case EOpConstructUMat3x3:
+    case EOpConstructUMat3x4:
+    case EOpConstructUMat4x2:
+    case EOpConstructUMat4x3:
+    case EOpConstructUMat4x4:
     case EOpConstructUint:
         basicOp = EOpConstructUint;
         break;
@@ -7288,6 +7339,15 @@ TIntermTyped* HlslParseContext::constructBuiltIn(const TType& type, TOperator op
     case EOpConstructBVec2:
     case EOpConstructBVec3:
     case EOpConstructBVec4:
+    case EOpConstructBMat2x2:
+    case EOpConstructBMat2x3:
+    case EOpConstructBMat2x4:
+    case EOpConstructBMat3x2:
+    case EOpConstructBMat3x3:
+    case EOpConstructBMat3x4:
+    case EOpConstructBMat4x2:
+    case EOpConstructBMat4x3:
+    case EOpConstructBMat4x4:
     case EOpConstructBool:
         basicOp = EOpConstructBool;
         break;