Miscellaneous ES 3.1 semantics, and identification of all missing features.
authorJohn Kessenich <cepheus@frii.com>
Thu, 14 Aug 2014 07:07:21 +0000 (07:07 +0000)
committerJohn Kessenich <cepheus@frii.com>
Thu, 14 Aug 2014 07:07:21 +0000 (07:07 +0000)
git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@27732 e7fa87d3-cd2b-0410-9028-fcbf551c1848

Test/300.frag
Test/300layout.frag
Test/310.comp
Test/310.frag
Test/baseResults/300.frag.out
Test/baseResults/300layout.frag.out
Test/baseResults/310.comp.out
Test/baseResults/310.frag.out
Todo.txt
glslang/MachineIndependent/ParseHelper.cpp
glslang/MachineIndependent/Scan.cpp

index 8b67b98..9be2818 100644 (file)
@@ -147,5 +147,8 @@ void foo324(void)
 
 uniform mediump;       // ERROR
 
+layout(early_fragment_tests) in;  // ERROR
+
 float imageBuffer;    // ERROR, reserved
 float uimage2DRect;   // ERROR, reserved
+
index 70cbc9a..32a6b02 100644 (file)
@@ -14,6 +14,6 @@ void main()
     q[1] = pos;
 }
 
-layout(location = 40) out float ca[4];
-layout(location = 41) out float cb[2];  // ERROR, overlap
-layout(location = 39) out float cc[6];  // ERROR, overlap
+layout(location = 40) out float ca[4];  // ERROR, overlap, ERROR too big
+layout(location = 41) out float cb[2];  // ERROR, overlap, ERROR too big
+layout(location = 39) out float cc[6];  // ERROR, overlap, ERROR too big
index 7c010ea..f2cd8c5 100644 (file)
@@ -161,3 +161,14 @@ void atoms()
     origi = atomicExchange(atomi, 4);\r
     origu = atomicCompSwap(atomu, 10u, 8u);\r
 }\r
+\r
+precision highp atomic_uint;\r
+precision lowp atomic_uint;   // ERROR\r
+\r
+precise int pfoo;  // ERROR, reserved\r
+\r
+dmat2x4 dm;                     // ERROR\r
+uniform samplerCubeArray sca;   // ERROR\r
+uniform iimage2DRect i2dr;      // ERROR\r
+uniform image2DMS i2dms;        // ERROR\r
+uniform uimage2DMSArray u2dmsa; // ERROR\r
index 1309fa7..1db4ca6 100644 (file)
@@ -68,3 +68,38 @@ layout(binding = 1) uniform bb {
     int foo;\r
     layout(binding = 2) float f;     // ERROR\r
 } bbi;\r
+\r
+in centroid vec4 centroidIn;\r
+layout(location = 200000) uniform vec4 bigl;  // ERROR, location too big\r
+\r
+layout(early_fragment_tests) in;\r
+\r
+layout(location = 40) out vec4 bigout1;  // ERROR, too big\r
+layout(location = 40) out vec4 bigout2;  // ERROR, overlap\r
+layout(location = -2) out vec4 neg;      // ERROR, negative\r
+\r
+layout(std430) uniform b430 {\r
+    int i;\r
+} b430i;\r
+\r
+layout(shared) uniform bshar {\r
+    int i;\r
+} bshari;\r
+\r
+in smooth vec4 smoothIn;\r
+in flat int flatIn;\r
+\r
+uniform sampler2DMS s2dms;\r
+\r
+void foots()\r
+{\r
+    highp ivec2 v2 = textureSize(s1, 2);\r
+    highp ivec3 v3 = textureSize(isamp2DA, 3);\r
+    v2 = textureSize(s2dms);\r
+    v2 = imageSize(i2D);\r
+}\r
+\r
+out bool bout;          // ERROR\r
+out image2D imageOut;   // ERROR\r
+out mat2x3 mout;        // ERROR\r
+\r
index 43fbe09..be58e28 100644 (file)
@@ -34,12 +34,14 @@ ERROR: 0:123: '==' : can't use with samplers or structs containing samplers
 ERROR: 0:129: 'texel offset' : value is out of range: [gl_MinProgramTexelOffset, gl_MaxProgramTexelOffset]\r
 ERROR: 0:129: 'texel offset' : value is out of range: [gl_MinProgramTexelOffset, gl_MaxProgramTexelOffset]\r
 ERROR: 0:148: 'qualifier' : cannot use auxiliary, memory, interpolation, or precision qualifier in a default qualifier declaration (declaration with no type) \r
-ERROR: 0:150: 'imageBuffer' : Reserved word. \r
-ERROR: 0:150: '' :  syntax error\r
-ERROR: 37 compilation errors.  No code generated.\r
+ERROR: 0:150: 'early_fragment_tests' : not supported for this version or the enabled extensions \r
+ERROR: 0:152: 'imageBuffer' : Reserved word. \r
+ERROR: 0:152: '' :  syntax error\r
+ERROR: 38 compilation errors.  No code generated.\r
 \r
 \r
 Shader version: 300\r
+using early_fragment_tests\r
 ERROR: node is still EOpNull!\r
 0:53  Function Definition: main( (void)\r
 0:53    Function Parameters: \r
@@ -394,6 +396,7 @@ Linked fragment stage:
 ERROR: Linking fragment stage: when more than one fragment shader output, all must have location qualifiers\r
 \r
 Shader version: 300\r
+using early_fragment_tests\r
 ERROR: node is still EOpNull!\r
 0:53  Function Definition: main( (void)\r
 0:53    Function Parameters: \r
index 21f12dd..e16fb45 100644 (file)
@@ -1,9 +1,12 @@
 300layout.frag\r
 ERROR: 0:4: 'location qualifier on input' : not supported in this stage: fragment\r
 ERROR: 0:4: 'location qualifier on input' : not supported for this version or the enabled extensions \r
+ERROR: 0:17: 'location' : too large for fragment output \r
+ERROR: 0:18: 'location' : too large for fragment output \r
 ERROR: 0:18: 'location' : overlapping use of location 41\r
+ERROR: 0:19: 'location' : too large for fragment output \r
 ERROR: 0:19: 'location' : overlapping use of location 40\r
-ERROR: 4 compilation errors.  No code generated.\r
+ERROR: 7 compilation errors.  No code generated.\r
 \r
 \r
 Shader version: 300\r
index 97cca31..e2816ed 100644 (file)
@@ -42,7 +42,21 @@ ERROR: 0:141: 'atomic_uint' : atomic counters can only be highp
 ERROR: 0:141: 'binding' : cannot be greater-than-or-equal to gl_MaxAtomicCounterBindings \r
 ERROR: 0:143: 'binding' : cannot be greater-than-or-equal to gl_MaxAtomicCounterBindings \r
 ERROR: 0:149: '[]' : scalar integer expression required \r
-ERROR: 42 compilation errors.  No code generated.\r
+ERROR: 0:166: 'precision' : can only apply highp to atomic_uint \r
+ERROR: 0:168: 'precise' : Reserved word. \r
+ERROR: 0:170: 'dmat2x4' : Reserved word. \r
+ERROR: 0:170: 'double matrix' : not supported with this profile: es\r
+ERROR: 0:171: 'samplerCubeArray' : Reserved word. \r
+ERROR: 0:171: 'sampler/image' : type requires declaration of default precision qualifier \r
+ERROR: 0:172: 'iimage2DRect' : Reserved word. \r
+ERROR: 0:172: 'sampler/image' : type requires declaration of default precision qualifier \r
+ERROR: 0:172: '' : image variables not declared 'writeonly' must have a format layout qualifier \r
+ERROR: 0:173: 'image2DMS' : Reserved word. \r
+ERROR: 0:173: '' : image variables not declared 'writeonly' must have a format layout qualifier \r
+ERROR: 0:174: 'uimage2DMSArray' : Reserved word. \r
+ERROR: 0:174: 'sampler/image' : type requires declaration of default precision qualifier \r
+ERROR: 0:174: '' : image variables not declared 'writeonly' must have a format layout qualifier \r
+ERROR: 56 compilation errors.  No code generated.\r
 \r
 \r
 Shader version: 310\r
@@ -262,6 +276,12 @@ ERROR: node is still EOpNull!
 0:?     'i' (uniform highp int)\r
 0:?     'atomi' (shared highp int)\r
 0:?     'atomu' (shared highp uint)\r
+0:?     'pfoo' (highp int)\r
+0:?     'dm' (2X4 matrix of double)\r
+0:?     'sca' (uniform mediump samplerCubeArray)\r
+0:?     'i2dr' (uniform mediump iimage2DRect)\r
+0:?     'i2dms' (uniform lowp image2DMS)\r
+0:?     'u2dmsa' (uniform mediump uimage2DMSArray)\r
 \r
 \r
 Linked compute stage:\r
@@ -484,4 +504,10 @@ ERROR: node is still EOpNull!
 0:?     'i' (uniform highp int)\r
 0:?     'atomi' (shared highp int)\r
 0:?     'atomu' (shared highp uint)\r
+0:?     'pfoo' (highp int)\r
+0:?     'dm' (2X4 matrix of double)\r
+0:?     'sca' (uniform mediump samplerCubeArray)\r
+0:?     'i2dr' (uniform mediump iimage2DRect)\r
+0:?     'i2dms' (uniform lowp image2DMS)\r
+0:?     'u2dmsa' (uniform mediump uimage2DMSArray)\r
 \r
index e1e30fc..92682da 100644 (file)
@@ -17,10 +17,25 @@ ERROR: 0:44: 'texel offset' : value is out of range: [gl_MinProgramTexelOffset,
 ERROR: 0:45: 'texel offset' : value is out of range: [gl_MinProgramTexelOffset, gl_MaxProgramTexelOffset]\r
 ERROR: 0:45: 'texel offset' : value is out of range: [gl_MinProgramTexelOffset, gl_MaxProgramTexelOffset]\r
 ERROR: 0:69: 'binding' : requires block, or sampler/image, or atomic-counter type \r
-ERROR: 17 compilation errors.  No code generated.\r
+ERROR: 0:73: 'location' : location is too large \r
+ERROR: 0:77: 'location' : too large for fragment output \r
+ERROR: 0:78: 'location' : too large for fragment output \r
+ERROR: 0:78: 'location' : overlapping use of location 40\r
+ERROR: 0:79: 'non-literal layout-id value' : not supported with this profile: es\r
+ERROR: 0:79: 'layout-id value' : cannot be negative \r
+ERROR: 0:92: 'sampler2DMS' : Reserved word. \r
+ERROR: 0:98: 'textureSize' : no matching overloaded function found \r
+ERROR: 0:98: 'assign' :  cannot convert from 'const float' to 'highp 2-component vector of int'\r
+ERROR: 0:99: 'writeonly' : argument cannot drop memory qualifier when passed to formal parameter \r
+ERROR: 0:102: 'out' : cannot be bool \r
+ERROR: 0:103: 'image2D' : sampler/image types can only be used in uniform variables or function parameters: imageOut\r
+ERROR: 0:103: '' : image variables not declared 'writeonly' must have a format layout qualifier \r
+ERROR: 0:104: 'out' : cannot be a matrix \r
+ERROR: 31 compilation errors.  No code generated.\r
 \r
 \r
 Shader version: 310\r
+using early_fragment_tests\r
 ERROR: node is still EOpNull!\r
 0:21  Function Definition: main( (void)\r
 0:21    Function Parameters: \r
@@ -193,6 +208,28 @@ ERROR: node is still EOpNull!
 0:60              'i' (uniform mediump int)\r
 0:60            Construct bvec4 (4-component vector of bool)\r
 0:60              'b' (bool)\r
+0:94  Function Definition: foots( (void)\r
+0:94    Function Parameters: \r
+0:96    Sequence\r
+0:96      Sequence\r
+0:96        move second child to first child (highp 2-component vector of int)\r
+0:96          'v2' (highp 2-component vector of int)\r
+0:96          Function Call: textureSize(s21;i1; (highp 2-component vector of int)\r
+0:96            's1' (layout(binding=3 ) uniform highp sampler2D)\r
+0:96            Constant:\r
+0:96              2 (const int)\r
+0:97      Sequence\r
+0:97        move second child to first child (highp 3-component vector of int)\r
+0:97          'v3' (highp 3-component vector of int)\r
+0:97          Function Call: textureSize(isA21;i1; (highp 3-component vector of int)\r
+0:97            'isamp2DA' (uniform highp isampler2DArray)\r
+0:97            Constant:\r
+0:97              3 (const int)\r
+0:98      'v2' (highp 2-component vector of int)\r
+0:99      move second child to first child (highp 2-component vector of int)\r
+0:99        'v2' (highp 2-component vector of int)\r
+0:99        Function Call: imageSize(I21; (highp 2-component vector of int)\r
+0:99          'i2D' (layout(binding=2 ) writeonly uniform highp image2D)\r
 0:?   Linker Objects\r
 0:?     'gl_FragCoord' (smooth in mediump 4-component vector of float)\r
 0:?     'v3' (layout(location=2 ) smooth in mediump 3-component vector of float)\r
@@ -208,12 +245,27 @@ ERROR: node is still EOpNull!
 0:?     's2' (layout(binding=3 ) uniform highp sampler2D)\r
 0:?     'i2D' (layout(binding=2 ) writeonly uniform highp image2D)\r
 0:?     'bbi' (layout(binding=1 column_major shared ) uniform block{layout(column_major shared ) uniform mediump int foo, layout(binding=2 column_major shared ) uniform mediump float f})\r
+0:?     'centroidIn' (centroid smooth in mediump 4-component vector of float)\r
+0:?     'bigl' (uniform mediump 4-component vector of float)\r
+0:?     'bigout1' (layout(location=40 ) out mediump 4-component vector of float)\r
+0:?     'bigout2' (layout(location=40 ) out mediump 4-component vector of float)\r
+0:?     'neg' (out mediump 4-component vector of float)\r
+0:?     'b430i' (layout(column_major std430 ) uniform block{layout(column_major std430 offset=0 ) uniform mediump int i})\r
+0:?     'bshari' (layout(column_major shared ) uniform block{layout(column_major shared ) uniform mediump int i})\r
+0:?     'smoothIn' (smooth in mediump 4-component vector of float)\r
+0:?     'flatIn' (flat in mediump int)\r
+0:?     's2dms' (uniform highp sampler2DMS)\r
+0:?     'bout' (out bool)\r
+0:?     'imageOut' (out highp image2D)\r
+0:?     'mout' (out mediump 2X3 matrix of float)\r
 \r
 \r
 Linked fragment stage:\r
 \r
+ERROR: Linking fragment stage: when more than one fragment shader output, all must have location qualifiers\r
 \r
 Shader version: 310\r
+using early_fragment_tests\r
 ERROR: node is still EOpNull!\r
 0:21  Function Definition: main( (void)\r
 0:21    Function Parameters: \r
@@ -386,6 +438,28 @@ ERROR: node is still EOpNull!
 0:60              'i' (uniform mediump int)\r
 0:60            Construct bvec4 (4-component vector of bool)\r
 0:60              'b' (bool)\r
+0:94  Function Definition: foots( (void)\r
+0:94    Function Parameters: \r
+0:96    Sequence\r
+0:96      Sequence\r
+0:96        move second child to first child (highp 2-component vector of int)\r
+0:96          'v2' (highp 2-component vector of int)\r
+0:96          Function Call: textureSize(s21;i1; (highp 2-component vector of int)\r
+0:96            's1' (layout(binding=3 ) uniform highp sampler2D)\r
+0:96            Constant:\r
+0:96              2 (const int)\r
+0:97      Sequence\r
+0:97        move second child to first child (highp 3-component vector of int)\r
+0:97          'v3' (highp 3-component vector of int)\r
+0:97          Function Call: textureSize(isA21;i1; (highp 3-component vector of int)\r
+0:97            'isamp2DA' (uniform highp isampler2DArray)\r
+0:97            Constant:\r
+0:97              3 (const int)\r
+0:98      'v2' (highp 2-component vector of int)\r
+0:99      move second child to first child (highp 2-component vector of int)\r
+0:99        'v2' (highp 2-component vector of int)\r
+0:99        Function Call: imageSize(I21; (highp 2-component vector of int)\r
+0:99          'i2D' (layout(binding=2 ) writeonly uniform highp image2D)\r
 0:?   Linker Objects\r
 0:?     'gl_FragCoord' (smooth in mediump 4-component vector of float)\r
 0:?     'v3' (layout(location=2 ) smooth in mediump 3-component vector of float)\r
@@ -401,4 +475,17 @@ ERROR: node is still EOpNull!
 0:?     's2' (layout(binding=3 ) uniform highp sampler2D)\r
 0:?     'i2D' (layout(binding=2 ) writeonly uniform highp image2D)\r
 0:?     'bbi' (layout(binding=1 column_major shared ) uniform block{layout(column_major shared ) uniform mediump int foo, layout(binding=2 column_major shared ) uniform mediump float f})\r
+0:?     'centroidIn' (centroid smooth in mediump 4-component vector of float)\r
+0:?     'bigl' (uniform mediump 4-component vector of float)\r
+0:?     'bigout1' (layout(location=40 ) out mediump 4-component vector of float)\r
+0:?     'bigout2' (layout(location=40 ) out mediump 4-component vector of float)\r
+0:?     'neg' (out mediump 4-component vector of float)\r
+0:?     'b430i' (layout(column_major std430 ) uniform block{layout(column_major std430 offset=0 ) uniform mediump int i})\r
+0:?     'bshari' (layout(column_major shared ) uniform block{layout(column_major shared ) uniform mediump int i})\r
+0:?     'smoothIn' (smooth in mediump 4-component vector of float)\r
+0:?     'flatIn' (flat in mediump int)\r
+0:?     's2dms' (uniform highp sampler2DMS)\r
+0:?     'bout' (out bool)\r
+0:?     'imageOut' (out highp image2D)\r
+0:?     'mout' (out mediump 2X3 matrix of float)\r
 \r
index 5fcdc37..be174af 100644 (file)
--- a/Todo.txt
+++ b/Todo.txt
@@ -80,6 +80,13 @@ Shader Functionality to Implement/Finish
       + Texture gather
       + Bitfield operations
       + Integer mix function
+      - overlapping bindings
+      - offset post incrementing
+      - overlapping offsets
+      - frexp/ldexp
+      - packUnorm4x8(),packSnorm4x8(), unpackUnorm4x8(), unpackSnorm4x8()
+      - 2DMS samplers and images
+      - inheritance of memory qualifiers in block members
     GLSL 1.2
       + Handle multiple compilation units per stage
       + Allow initializers on uniform declarations
@@ -227,7 +234,7 @@ Shader Functionality to Implement/Finish
                 elements of the array.
       - Arrays of arrays are now supported, as per the GL_ARB_arrays_of_arrays extension.
       + Compute shaders are now supported, as per the GL_ARB_compute_shader extension.
-      - Added imageSize() built-ins to query the dimensions of an image.
+      + Added imageSize() built-ins to query the dimensions of an image.
       - All choice of depth or stencil texturing, for a packed depth-stencil texture, as per the 
         GL_ARB_stencil_texturing extension.
       - Allow explicit locations/indexes to be assigned to uniform variables and subroutines, as per the 
index ad99dba..a1a90b7 100644 (file)
@@ -1960,7 +1960,6 @@ void TParseContext::globalQualifierCheck(TSourceLoc loc, const TQualifier& quali
 
     if (publicType.basicType == EbtBool) {
         error(loc, "cannot be bool", GetStorageQualifierString(qualifier.storage), "");
-
         return;
     }
 
@@ -2043,7 +2042,10 @@ void TParseContext::globalQualifierCheck(TSourceLoc loc, const TQualifier& quali
             profileRequires(loc, EEsProfile, 300, 0, "fragment shader output");
             if (publicType.basicType == EbtStruct) {
                 error(loc, "cannot be a structure", GetStorageQualifierString(qualifier.storage), "");
-
+                return;
+            }
+            if (publicType.matrixRows > 0) {
+                error(loc, "cannot be a matrix", GetStorageQualifierString(qualifier.storage), "");
                 return;
             }
         break;
@@ -2157,6 +2159,13 @@ void TParseContext::setDefaultPrecision(TSourceLoc loc, TPublicType& publicType,
         }
     }
 
+    if (basicType == EbtAtomicUint) {
+        if (qualifier != EpqHigh)
+            error(loc, "can only apply highp to atomic_uint", "precision", "");
+
+        return;
+    }
+
     error(loc, "cannot apply precision statement to this type; use 'float', 'int' or a sampler type", TType::getBasicString(basicType), "");
 }
 
@@ -3091,8 +3100,8 @@ void TParseContext::setLayoutQualifier(TSourceLoc loc, TPublicType& publicType,
             return;
         }
         if (id == "early_fragment_tests") {
-            requireProfile(loc, ENoProfile | ECoreProfile | ECompatibilityProfile, "early_fragment_tests");
             profileRequires(loc, ENoProfile | ECoreProfile | ECompatibilityProfile, 420, GL_ARB_shader_image_load_store, "early_fragment_tests");
+            profileRequires(loc, EEsProfile, 310, 0, "early_fragment_tests");
             publicType.shaderQualifiers.earlyFragmentTests = true;
             return;
         }
@@ -3393,6 +3402,11 @@ void TParseContext::layoutTypeCheck(TSourceLoc loc, const TType& type)
                 error(loc, "cannot apply to a matrix, structure, or block", "component", "");
         }
 
+        if (qualifier.storage == EvqVaryingOut && language == EShLangFragment) {
+            if (qualifier.layoutLocation >= (unsigned int)resources.maxDrawBuffers)
+                error(loc, "too large for fragment output", "location", "");
+        }
+
         switch (qualifier.storage) {
         case EvqVaryingIn:
         case EvqVaryingOut:
index 1a92e3e..e9d3cfb 100644 (file)
@@ -919,7 +919,9 @@ int TScanContext::tokenizeIdentifier()
         return keyword;
 
     case PRECISE:
-        if (parseContext.profile == EEsProfile ||
+        if (parseContext.profile == EEsProfile && parseContext.version >= 310)
+            reservedWord();
+        else if (parseContext.profile == EEsProfile ||
             (parseContext.profile != EEsProfile && parseContext.version < 400))
             return identifierOrType();
         return keyword;
@@ -1104,6 +1106,11 @@ int TScanContext::secondGenerationImage()
 {
     afterType = true;
 
+    if (parseContext.profile == EEsProfile && parseContext.version >= 310) {
+        reservedWord();
+        return keyword;
+    }
+
     if (parseContext.symbolTable.atBuiltInLevel() || parseContext.profile != EEsProfile && (parseContext.version >= 420 || parseContext.extensionsTurnedOn(1, &GL_ARB_shader_image_load_store)))
         return keyword;