SPV: Minor corrections to previous big merge for images and atomics.
authorJohn Kessenich <cepheus@frii.com>
Wed, 16 Sep 2015 16:54:31 +0000 (10:54 -0600)
committerJohn Kessenich <cepheus@frii.com>
Wed, 16 Sep 2015 17:42:16 +0000 (11:42 -0600)
SPIRV/GlslangToSpv.cpp
SPIRV/doc.cpp
Test/baseResults/spv.do-simple.vert.out
Test/baseResults/spv.do-while-continue-break.vert.out
Test/baseResults/spv.doWhileLoop.frag.out
Test/baseResults/spv.image.frag.out
Test/baseResults/spv.loopsArtificial.frag.out
glslang/Include/revision.h

index 72292e6..0a61a2b 100755 (executable)
@@ -844,9 +844,7 @@ bool TGlslangToSpvTraverser::visitAggregate(glslang::TVisit visit, glslang::TInt
         builder.setAccessChainRValue(result);
 
         return false;
-    }
-    else if (node->getOp() == glslang::EOpImageStore)
-    {
+    } else if (node->getOp() == glslang::EOpImageStore) {
         // "imageStore" is a special case, which has no result
         return false;
     }
@@ -1819,45 +1817,27 @@ spv::Id TGlslangToSpvTraverser::createImageTextureFunctionCall(glslang::TIntermO
 
     // Check for image functions other than queries
     if (node->isImage()) {
-        // Process image load/store
-        if (node->getOp() == glslang::EOpImageLoad ||
-            node->getOp() == glslang::EOpImageStore) {
-            std::vector<spv::Id> operands;
-            auto opIt = arguments.begin();
-            operands.push_back(*(opIt++));
+        std::vector<spv::Id> operands;
+        auto opIt = arguments.begin();
+        operands.push_back(*(opIt++));
+        operands.push_back(*(opIt++));
+        if (node->getOp() == glslang::EOpImageStore)
             operands.push_back(*(opIt++));
-            if (sampler.ms) {
-                // For MS, image operand mask has to be added to indicate the presence of "sample" operand.
-                spv::Id sample = *(opIt++);
-                for (; opIt != arguments.end(); ++opIt)
-                    operands.push_back(*opIt);
-
-                operands.push_back(spv::ImageOperandsSampleMask);
-                operands.push_back(sample);
-            } else {
-                for (; opIt != arguments.end(); ++opIt)
-                    operands.push_back(*opIt);
-            }
-
-            if (node->getOp() == glslang::EOpImageLoad)
-                return builder.createOp(spv::OpImageRead, convertGlslangToSpvType(node->getType()), operands);
-            else {
-                builder.createNoResultOp(spv::OpImageWrite, operands);
-                return spv::NoResult;
-            }
+        // TODO: add 'sample' operand
+        if (node->getOp() == glslang::EOpImageLoad) {
+            return builder.createOp(spv::OpImageRead, convertGlslangToSpvType(node->getType()), operands);
+        } else if (node->getOp() == glslang::EOpImageStore) {
+            builder.createNoResultOp(spv::OpImageWrite, operands);
+            return spv::NoResult;
         } else {
             // Process image atomic operations
 
             // GLSL "IMAGE_PARAMS" will involve in constructing an image texel pointer and this pointer,
             // as the first source operand, is required by SPIR-V atomic operations.
-            std::vector<spv::Id> imageParams;
-            auto opIt = arguments.begin();
-            imageParams.push_back(*(opIt++));
-            imageParams.push_back(*(opIt++));
-            imageParams.push_back(sampler.ms ? *(opIt++) : 0); // For non-MS, the value should be 0
+            operands.push_back(sampler.ms ? *(opIt++) : 0); // For non-MS, the value should be 0
 
             spv::Id resultTypeId = builder.makePointer(spv::StorageClassImage, convertGlslangToSpvType(node->getType()));
-            spv::Id pointer = builder.createOp(spv::OpImageTexelPointer, resultTypeId, imageParams);
+            spv::Id pointer = builder.createOp(spv::OpImageTexelPointer, resultTypeId, operands);
 
             std::vector<spv::Id> operands;
             operands.push_back(pointer);
index ccc163d..ff0d780 100755 (executable)
@@ -1635,12 +1635,10 @@ void Parameterize()
 
     InstructionDesc[OpImageRead].operands.push(OperandId, "'Image'");
     InstructionDesc[OpImageRead].operands.push(OperandId, "'Coordinate'");
-    InstructionDesc[OpImageRead].operands.push(OperandOptionalImage, "");
 
     InstructionDesc[OpImageWrite].operands.push(OperandId, "'Image'");
     InstructionDesc[OpImageWrite].operands.push(OperandId, "'Coordinate'");
     InstructionDesc[OpImageWrite].operands.push(OperandId, "'Texel'");
-    InstructionDesc[OpImageWrite].operands.push(OperandOptionalImage, "");
 
     InstructionDesc[OpImageSampleImplicitLod].operands.push(OperandId, "'Sampled Image'");
     InstructionDesc[OpImageSampleImplicitLod].operands.push(OperandId, "'Coordinate'");
index b33dae8..be11114 100755 (executable)
@@ -25,11 +25,11 @@ Linked vertex stage:
                6:             TypeInt 32 1\r
                7:             TypePointer Function 6(int)\r
                9:      6(int) Constant 0\r
-              13:             TypeBool\r
-              15:    13(bool) ConstantTrue\r
+              14:             TypeBool\r
+              15:    14(bool) ConstantTrue\r
               19:      6(int) Constant 10\r
               23:      6(int) Constant 1\r
-              25:    13(bool) ConstantFalse\r
+              25:    14(bool) ConstantFalse\r
               26:             TypePointer Input 6(int)\r
  27(gl_VertexID):     26(ptr) Variable Input\r
 28(gl_InstanceID):     26(ptr) Variable Input\r
@@ -39,15 +39,15 @@ Linked vertex stage:
                               Store 8(i) 9\r
                               Branch 10\r
               10:             Label\r
-              14:    13(bool) Phi 15 5 25 12\r
+              13:    14(bool) Phi 15 5 25 12\r
                               LoopMerge 11 None\r
                               Branch 16\r
               16:             Label\r
                               SelectionMerge 12 None\r
-                              BranchConditional 14 12 17\r
+                              BranchConditional 13 12 17\r
               17:               Label\r
               18:      6(int)   Load 8(i)\r
-              20:    13(bool)   SLessThan 18 19\r
+              20:    14(bool)   SLessThan 18 19\r
                                 SelectionMerge 21 None\r
                                 BranchConditional 20 21 11\r
               21:               Label\r
index edca3d4..5687acd 100755 (executable)
@@ -32,12 +32,12 @@ Linked vertex stage:
                6:             TypeInt 32 1\r
                7:             TypePointer Function 6(int)\r
                9:      6(int) Constant 0\r
-              13:             TypeBool\r
-              15:    13(bool) ConstantTrue\r
+              14:             TypeBool\r
+              15:    14(bool) ConstantTrue\r
               19:      6(int) Constant 1\r
               21:      6(int) Constant 19\r
               26:      6(int) Constant 2\r
-              31:    13(bool) ConstantFalse\r
+              31:    14(bool) ConstantFalse\r
               35:      6(int) Constant 5\r
               40:      6(int) Constant 3\r
               43:      6(int) Constant 42\r
@@ -59,17 +59,17 @@ Linked vertex stage:
                               Store 8(i) 9\r
                               Branch 10\r
               10:             Label\r
-              14:    13(bool) Phi 15 5 31 28 31 38\r
+              13:    14(bool) Phi 15 5 31 28 31 38\r
                               LoopMerge 11 None\r
                               Branch 16\r
               16:             Label\r
                               SelectionMerge 12 None\r
-                              BranchConditional 14 12 17\r
+                              BranchConditional 13 12 17\r
               17:               Label\r
               18:      6(int)   Load 8(i)\r
               20:      6(int)   IAdd 18 19\r
                                 Store 8(i) 20\r
-              22:    13(bool)   SLessThan 20 21\r
+              22:    14(bool)   SLessThan 20 21\r
                                 SelectionMerge 23 None\r
                                 BranchConditional 22 23 11\r
               23:               Label\r
@@ -77,7 +77,7 @@ Linked vertex stage:
               12:             Label\r
                               Store 24(A) 9\r
               25:      6(int) Load 8(i)\r
-              27:    13(bool) IEqual 25 26\r
+              27:    14(bool) IEqual 25 26\r
                               SelectionMerge 29 None\r
                               BranchConditional 27 28 29\r
               28:               Label\r
@@ -88,7 +88,7 @@ Linked vertex stage:
                                 Branch 29\r
               29:             Label\r
               34:      6(int) Load 8(i)\r
-              36:    13(bool) IEqual 34 35\r
+              36:    14(bool) IEqual 34 35\r
                               SelectionMerge 38 None\r
                               BranchConditional 36 37 38\r
               37:               Label\r
index b895177..1a204b0 100755 (executable)
@@ -28,13 +28,13 @@ Linked fragment stage:
                8:             TypePointer Function 7(fvec4)\r
               10:             TypePointer Input 7(fvec4)\r
    11(BaseColor):     10(ptr) Variable Input\r
-              16:             TypeBool\r
-              18:    16(bool) ConstantTrue\r
+              17:             TypeBool\r
+              18:    17(bool) ConstantTrue\r
               23:             TypePointer UniformConstant 6(float)\r
            24(d):     23(ptr) Variable UniformConstant\r
               28:             TypePointer UniformConstant 7(fvec4)\r
     29(bigColor):     28(ptr) Variable UniformConstant\r
-              33:    16(bool) ConstantFalse\r
+              33:    17(bool) ConstantFalse\r
               34:             TypePointer Output 7(fvec4)\r
 35(gl_FragColor):     34(ptr) Variable Output\r
          4(main):           2 Function None 3\r
@@ -44,17 +44,17 @@ Linked fragment stage:
                               Store 9(color) 12\r
                               Branch 13\r
               13:             Label\r
-              17:    16(bool) Phi 18 5 33 15\r
+              16:    17(bool) Phi 18 5 33 15\r
                               LoopMerge 14 None\r
                               Branch 19\r
               19:             Label\r
                               SelectionMerge 15 None\r
-                              BranchConditional 17 15 20\r
+                              BranchConditional 16 15 20\r
               20:               Label\r
               21:    7(fvec4)   Load 9(color)\r
               22:    6(float)   CompositeExtract 21 0\r
               25:    6(float)   Load 24(d)\r
-              26:    16(bool)   FOrdLessThan 22 25\r
+              26:    17(bool)   FOrdLessThan 22 25\r
                                 SelectionMerge 27 None\r
                                 BranchConditional 26 27 14\r
               27:               Label\r
index f686ee3..f5874ed 100644 (file)
@@ -329,24 +329,24 @@ Linked fragment stage:
                               ImageWrite 209 210 211\r
              212:          95 Load 97(i2DMS)\r
              213:   27(ivec2) Load 143(ic2D)\r
-             215:  126(fvec4) ImageRead 212 213 214\r
+             215:  126(fvec4) ImageRead 212 213\r
              216:  126(fvec4) Load 128(v)\r
              217:  126(fvec4) FAdd 216 215\r
                               Store 128(v) 217\r
              218:          95 Load 97(i2DMS)\r
              219:   27(ivec2) Load 143(ic2D)\r
              221:  126(fvec4) Load 128(v)\r
-                              ImageWrite 218 219 221 220\r
+                              ImageWrite 218 219 220\r
              222:         105 Load 107(i2DMSArray)\r
              223:    7(ivec3) Load 153(ic3D)\r
-             225:  126(fvec4) ImageRead 222 223 224\r
+             225:  126(fvec4) ImageRead 222 223\r
              226:  126(fvec4) Load 128(v)\r
              227:  126(fvec4) FAdd 226 225\r
                               Store 128(v) 227\r
              228:         105 Load 107(i2DMSArray)\r
              229:    7(ivec3) Load 153(ic3D)\r
              231:  126(fvec4) Load 128(v)\r
-                              ImageWrite 228 229 231 230\r
+                              ImageWrite 228 229 230\r
                               Store 234(ui) 235\r
              239:      6(int) Load 133(ic1D)\r
              242:    241(ptr) ImageTexelPointer 238(ii1D) 239 0\r
index 74cea2d..3871d85 100755 (executable)
@@ -117,15 +117,15 @@ Linked fragment stage:
                8:             TypePointer Function 7(fvec4)\r
               10:             TypePointer Input 7(fvec4)\r
    11(BaseColor):     10(ptr) Variable Input\r
-              16:             TypeBool\r
-              18:    16(bool) ConstantTrue\r
+              17:             TypeBool\r
+              18:    17(bool) ConstantTrue\r
               23:             TypePointer UniformConstant 6(float)\r
           24(d4):     23(ptr) Variable UniformConstant\r
               28:             TypePointer UniformConstant 7(fvec4)\r
    29(bigColor4):     28(ptr) Variable UniformConstant\r
               39:    6(float) Constant 1073741824\r
               53:    6(float) Constant 1065353216\r
-              57:    16(bool) ConstantFalse\r
+              57:    17(bool) ConstantFalse\r
          83(d13):     23(ptr) Variable UniformConstant\r
              147:             TypePointer Output 7(fvec4)\r
 148(gl_FragColor):    147(ptr) Variable Output\r
@@ -181,17 +181,17 @@ Linked fragment stage:
                               Store 9(color) 12\r
                               Branch 13\r
               13:             Label\r
-              17:    16(bool) Phi 18 5 57 49 57 64\r
+              16:    17(bool) Phi 18 5 57 49 57 64\r
                               LoopMerge 14 None\r
                               Branch 19\r
               19:             Label\r
                               SelectionMerge 15 None\r
-                              BranchConditional 17 15 20\r
+                              BranchConditional 16 15 20\r
               20:               Label\r
               21:    7(fvec4)   Load 9(color)\r
               22:    6(float)   CompositeExtract 21 2\r
               25:    6(float)   Load 24(d4)\r
-              26:    16(bool)   FOrdLessThan 22 25\r
+              26:    17(bool)   FOrdLessThan 22 25\r
                                 SelectionMerge 27 None\r
                                 BranchConditional 26 27 14\r
               27:               Label\r
@@ -204,7 +204,7 @@ Linked fragment stage:
               33:    7(fvec4) Load 9(color)\r
               34:    6(float) CompositeExtract 33 0\r
               35:    6(float) Load 24(d4)\r
-              36:    16(bool) FOrdLessThan 34 35\r
+              36:    17(bool) FOrdLessThan 34 35\r
                               SelectionMerge 38 None\r
                               BranchConditional 36 37 38\r
               37:               Label\r
@@ -217,7 +217,7 @@ Linked fragment stage:
               45:    7(fvec4)   Load 9(color)\r
               46:    6(float)   CompositeExtract 45 2\r
               47:    6(float)   Load 24(d4)\r
-              48:    16(bool)   FOrdLessThan 46 47\r
+              48:    17(bool)   FOrdLessThan 46 47\r
                                 SelectionMerge 50 None\r
                                 BranchConditional 48 49 50\r
               49:                 Label\r
@@ -234,7 +234,7 @@ Linked fragment stage:
               59:    7(fvec4) Load 9(color)\r
               60:    6(float) CompositeExtract 59 1\r
               61:    6(float) Load 24(d4)\r
-              62:    16(bool) FOrdLessThan 60 61\r
+              62:    17(bool) FOrdLessThan 60 61\r
                               SelectionMerge 64 None\r
                               BranchConditional 62 63 71\r
               63:               Label\r
@@ -263,14 +263,14 @@ Linked fragment stage:
               81:    7(fvec4) Load 9(color)\r
               82:    6(float) CompositeExtract 81 3\r
               84:    6(float) Load 83(d13)\r
-              85:    16(bool) FOrdLessThan 82 84\r
+              85:    17(bool) FOrdLessThan 82 84\r
                               LoopMerge 79 None\r
                               BranchConditional 85 80 79\r
               80:               Label\r
               86:    7(fvec4)   Load 9(color)\r
               87:    6(float)   CompositeExtract 86 2\r
               88:    6(float)   Load 83(d13)\r
-              89:    16(bool)   FOrdLessThan 87 88\r
+              89:    17(bool)   FOrdLessThan 87 88\r
                                 SelectionMerge 91 None\r
                                 BranchConditional 89 90 95\r
               90:                 Label\r
@@ -293,7 +293,7 @@ Linked fragment stage:
              102:    7(fvec4)   Load 9(color)\r
              103:    6(float)   CompositeExtract 102 0\r
              104:    6(float)   Load 24(d4)\r
-             105:    16(bool)   FOrdLessThan 103 104\r
+             105:    17(bool)   FOrdLessThan 103 104\r
                                 SelectionMerge 107 None\r
                                 BranchConditional 105 106 107\r
              106:                 Label\r
@@ -306,7 +306,7 @@ Linked fragment stage:
              113:    7(fvec4)     Load 9(color)\r
              114:    6(float)     CompositeExtract 113 2\r
              115:    6(float)     Load 24(d4)\r
-             116:    16(bool)     FOrdLessThan 114 115\r
+             116:    17(bool)     FOrdLessThan 114 115\r
                                   SelectionMerge 118 None\r
                                   BranchConditional 116 117 118\r
              117:                   Label\r
@@ -323,7 +323,7 @@ Linked fragment stage:
              125:    7(fvec4)   Load 9(color)\r
              126:    6(float)   CompositeExtract 125 1\r
              127:    6(float)   Load 24(d4)\r
-             128:    16(bool)   FOrdLessThan 126 127\r
+             128:    17(bool)   FOrdLessThan 126 127\r
                                 SelectionMerge 130 None\r
                                 BranchConditional 128 129 137\r
              129:                 Label\r
index aa5dcd9..570012a 100644 (file)
@@ -2,5 +2,5 @@
 // For the version, it uses the latest git tag followed by the number of commits.
 // For the date, it uses the current date (when then script is run).
 
-#define GLSLANG_REVISION "3.0.756"
-#define GLSLANG_DATE "15-Sep-2015"
+#define GLSLANG_REVISION "3.0.769"
+#define GLSLANG_DATE "16-Sep-2015"