Implement GL_OES_texture_buffer.
authorJohn Kessenich <cepheus@frii.com>
Sun, 16 Aug 2015 18:52:19 +0000 (12:52 -0600)
committerJohn Kessenich <cepheus@frii.com>
Sun, 16 Aug 2015 19:11:01 +0000 (13:11 -0600)
Test/310.vert
Test/baseResults/310.vert.out
glslang/Include/revision.h
glslang/MachineIndependent/Initialize.cpp
glslang/MachineIndependent/Scan.cpp
glslang/MachineIndependent/Versions.cpp

index d1bfc48..0c37fe0 100644 (file)
@@ -181,3 +181,53 @@ void pfoo()
     textureGatherOffsets(sArray[0], vec2(0.1), constOffsets);\r
     textureGatherOffsets(sArray[0], vec2(0.1), offsets);   // ERROR, offset not constant\r
 }\r
+\r
+uniform samplerBuffer  badSamp1;             // ERROR, reserved\r
+uniform isamplerBuffer badSamp2;             // ERROR, reserved\r
+uniform usamplerBuffer badSamp3;             // ERROR, reserved\r
+uniform writeonly imageBuffer    badSamp4;   // ERROR, reserved\r
+uniform writeonly iimageBuffer   badSamp5;   // ERROR, reserved\r
+uniform writeonly uimageBuffer   badSamp6;   // ERROR, reserved\r
+\r
+#extension GL_OES_texture_buffer : enable\r
+#extension GL_EXT_texture_buffer : enable\r
+\r
+uniform samplerBuffer  noPreSamp1;            // ERROR, no default precision\r
+uniform isamplerBuffer noPreSamp2;            // ERROR, no default precision\r
+uniform usamplerBuffer noPreSamp3;            // ERROR, no default precision\r
+uniform writeonly imageBuffer    noPreSamp4;  // ERROR, no default precision\r
+uniform writeonly iimageBuffer   noPreSamp5;  // ERROR, no default precision\r
+uniform writeonly uimageBuffer   noPreSamp6;  // ERROR, no default precision\r
+\r
+precision highp samplerBuffer; \r
+precision highp isamplerBuffer;\r
+precision highp usamplerBuffer;\r
+precision highp imageBuffer;   \r
+precision highp iimageBuffer;  \r
+precision highp uimageBuffer;  \r
+\r
+#ifdef GL_OES_texture_buffer\r
+uniform samplerBuffer  bufSamp1;          \r
+uniform isamplerBuffer bufSamp2;          \r
+uniform usamplerBuffer bufSamp3;          \r
+#endif\r
+#ifdef GL_EXT_texture_buffer\r
+uniform writeonly imageBuffer    bufSamp4;\r
+uniform writeonly iimageBuffer   bufSamp5;\r
+uniform writeonly uimageBuffer   bufSamp6;\r
+#endif\r
+\r
+void bufferT()\r
+{\r
+    highp int s1 = textureSize(bufSamp1);\r
+    highp int s2 = textureSize(bufSamp2);\r
+    highp int s3 = textureSize(bufSamp3);\r
+\r
+    highp int s4 = imageSize(bufSamp4);\r
+    highp int s5 = imageSize(bufSamp5);\r
+    highp int s6 = imageSize(bufSamp6);\r
+    \r
+    highp vec4 f1 = texelFetch(bufSamp1, s1);\r
+    highp ivec4 f2 = texelFetch(bufSamp2, s2);\r
+    highp uvec4 f3 = texelFetch(bufSamp3, s3);\r
+}\r
index d6face4..bc1e17e 100644 (file)
@@ -40,12 +40,32 @@ GL_EXT_gpu_shader5
 GL_OES_gpu_shader5\r
 ERROR: 0:177: 'variable indexing buffer block array' : not supported with this profile: es\r
 ERROR: 0:182: 'textureGatherOffsets(...)' : must be a compile-time constant: offsets argument\r
-ERROR: 36 compilation errors.  No code generated.\r
+ERROR: 0:185: 'samplerBuffer' : Reserved word. \r
+ERROR: 0:185: 'sampler/image' : type requires declaration of default precision qualifier \r
+ERROR: 0:186: 'isamplerBuffer' : Reserved word. \r
+ERROR: 0:186: 'sampler/image' : type requires declaration of default precision qualifier \r
+ERROR: 0:187: 'usamplerBuffer' : Reserved word. \r
+ERROR: 0:187: 'sampler/image' : type requires declaration of default precision qualifier \r
+ERROR: 0:188: 'imageBuffer' : Reserved word. \r
+ERROR: 0:188: 'sampler/image' : type requires declaration of default precision qualifier \r
+ERROR: 0:189: 'iimageBuffer' : Reserved word. \r
+ERROR: 0:189: 'sampler/image' : type requires declaration of default precision qualifier \r
+ERROR: 0:190: 'uimageBuffer' : Reserved word. \r
+ERROR: 0:190: 'sampler/image' : type requires declaration of default precision qualifier \r
+ERROR: 0:195: 'sampler/image' : type requires declaration of default precision qualifier \r
+ERROR: 0:196: 'sampler/image' : type requires declaration of default precision qualifier \r
+ERROR: 0:197: 'sampler/image' : type requires declaration of default precision qualifier \r
+ERROR: 0:198: 'sampler/image' : type requires declaration of default precision qualifier \r
+ERROR: 0:199: 'sampler/image' : type requires declaration of default precision qualifier \r
+ERROR: 0:200: 'sampler/image' : type requires declaration of default precision qualifier \r
+ERROR: 54 compilation errors.  No code generated.\r
 \r
 \r
 Shader version: 310\r
+Requested GL_EXT_texture_buffer\r
 Requested GL_OES_gpu_shader5\r
 Requested GL_OES_shader_io_blocks\r
+Requested GL_OES_texture_buffer\r
 ERROR: node is still EOpNull!\r
 0:12  Function Definition: main( (global void)\r
 0:12    Function Parameters: \r
@@ -364,6 +384,57 @@ ERROR: node is still EOpNull!
 0:182          0.100000\r
 0:182          0.100000\r
 0:182        'offsets' (uniform 4-element array of highp 2-component vector of int)\r
+0:220  Function Definition: bufferT( (global void)\r
+0:220    Function Parameters: \r
+0:222    Sequence\r
+0:222      Sequence\r
+0:222        move second child to first child (temp highp int)\r
+0:222          's1' (temp highp int)\r
+0:222          Function Call: textureSize(sB1; (global highp int)\r
+0:222            'bufSamp1' (uniform highp samplerBuffer)\r
+0:223      Sequence\r
+0:223        move second child to first child (temp highp int)\r
+0:223          's2' (temp highp int)\r
+0:223          Function Call: textureSize(isB1; (global highp int)\r
+0:223            'bufSamp2' (uniform highp isamplerBuffer)\r
+0:224      Sequence\r
+0:224        move second child to first child (temp highp int)\r
+0:224          's3' (temp highp int)\r
+0:224          Function Call: textureSize(usB1; (global highp int)\r
+0:224            'bufSamp3' (uniform highp usamplerBuffer)\r
+0:226      Sequence\r
+0:226        move second child to first child (temp highp int)\r
+0:226          's4' (temp highp int)\r
+0:226          Function Call: imageSize(IB1; (global highp int)\r
+0:226            'bufSamp4' (writeonly uniform highp imageBuffer)\r
+0:227      Sequence\r
+0:227        move second child to first child (temp highp int)\r
+0:227          's5' (temp highp int)\r
+0:227          Function Call: imageSize(iIB1; (global highp int)\r
+0:227            'bufSamp5' (writeonly uniform highp iimageBuffer)\r
+0:228      Sequence\r
+0:228        move second child to first child (temp highp int)\r
+0:228          's6' (temp highp int)\r
+0:228          Function Call: imageSize(uIB1; (global highp int)\r
+0:228            'bufSamp6' (writeonly uniform highp uimageBuffer)\r
+0:230      Sequence\r
+0:230        move second child to first child (temp highp 4-component vector of float)\r
+0:230          'f1' (temp highp 4-component vector of float)\r
+0:230          Function Call: texelFetch(sB1;i1; (global highp 4-component vector of float)\r
+0:230            'bufSamp1' (uniform highp samplerBuffer)\r
+0:230            's1' (temp highp int)\r
+0:231      Sequence\r
+0:231        move second child to first child (temp highp 4-component vector of int)\r
+0:231          'f2' (temp highp 4-component vector of int)\r
+0:231          Function Call: texelFetch(isB1;i1; (global highp 4-component vector of int)\r
+0:231            'bufSamp2' (uniform highp isamplerBuffer)\r
+0:231            's2' (temp highp int)\r
+0:232      Sequence\r
+0:232        move second child to first child (temp highp 4-component vector of uint)\r
+0:232          'f3' (temp highp 4-component vector of uint)\r
+0:232          Function Call: texelFetch(usB1;i1; (global highp 4-component vector of uint)\r
+0:232            'bufSamp3' (uniform highp usamplerBuffer)\r
+0:232            's3' (temp highp int)\r
 0:?   Linker Objects\r
 0:?     's' (shared highp 4-component vector of float)\r
 0:?     'v' (buffer highp 4-component vector of float)\r
@@ -413,6 +484,24 @@ ERROR: node is still EOpNull!
 0:?       0 (const int)\r
 0:?       0 (const int)\r
 0:?       0 (const int)\r
+0:?     'badSamp1' (uniform mediump samplerBuffer)\r
+0:?     'badSamp2' (uniform mediump isamplerBuffer)\r
+0:?     'badSamp3' (uniform mediump usamplerBuffer)\r
+0:?     'badSamp4' (writeonly uniform mediump imageBuffer)\r
+0:?     'badSamp5' (writeonly uniform mediump iimageBuffer)\r
+0:?     'badSamp6' (writeonly uniform mediump uimageBuffer)\r
+0:?     'noPreSamp1' (uniform mediump samplerBuffer)\r
+0:?     'noPreSamp2' (uniform mediump isamplerBuffer)\r
+0:?     'noPreSamp3' (uniform mediump usamplerBuffer)\r
+0:?     'noPreSamp4' (writeonly uniform mediump imageBuffer)\r
+0:?     'noPreSamp5' (writeonly uniform mediump iimageBuffer)\r
+0:?     'noPreSamp6' (writeonly uniform mediump uimageBuffer)\r
+0:?     'bufSamp1' (uniform highp samplerBuffer)\r
+0:?     'bufSamp2' (uniform highp isamplerBuffer)\r
+0:?     'bufSamp3' (uniform highp usamplerBuffer)\r
+0:?     'bufSamp4' (writeonly uniform highp imageBuffer)\r
+0:?     'bufSamp5' (writeonly uniform highp iimageBuffer)\r
+0:?     'bufSamp6' (writeonly uniform highp uimageBuffer)\r
 0:?     'gl_VertexID' (gl_VertexId highp int VertexId)\r
 0:?     'gl_InstanceID' (gl_InstanceId highp int InstanceId)\r
 \r
@@ -421,8 +510,10 @@ Linked vertex stage:
 \r
 \r
 Shader version: 310\r
+Requested GL_EXT_texture_buffer\r
 Requested GL_OES_gpu_shader5\r
 Requested GL_OES_shader_io_blocks\r
+Requested GL_OES_texture_buffer\r
 ERROR: node is still EOpNull!\r
 0:12  Function Definition: main( (global void)\r
 0:12    Function Parameters: \r
@@ -741,6 +832,57 @@ ERROR: node is still EOpNull!
 0:182          0.100000\r
 0:182          0.100000\r
 0:182        'offsets' (uniform 4-element array of highp 2-component vector of int)\r
+0:220  Function Definition: bufferT( (global void)\r
+0:220    Function Parameters: \r
+0:222    Sequence\r
+0:222      Sequence\r
+0:222        move second child to first child (temp highp int)\r
+0:222          's1' (temp highp int)\r
+0:222          Function Call: textureSize(sB1; (global highp int)\r
+0:222            'bufSamp1' (uniform highp samplerBuffer)\r
+0:223      Sequence\r
+0:223        move second child to first child (temp highp int)\r
+0:223          's2' (temp highp int)\r
+0:223          Function Call: textureSize(isB1; (global highp int)\r
+0:223            'bufSamp2' (uniform highp isamplerBuffer)\r
+0:224      Sequence\r
+0:224        move second child to first child (temp highp int)\r
+0:224          's3' (temp highp int)\r
+0:224          Function Call: textureSize(usB1; (global highp int)\r
+0:224            'bufSamp3' (uniform highp usamplerBuffer)\r
+0:226      Sequence\r
+0:226        move second child to first child (temp highp int)\r
+0:226          's4' (temp highp int)\r
+0:226          Function Call: imageSize(IB1; (global highp int)\r
+0:226            'bufSamp4' (writeonly uniform highp imageBuffer)\r
+0:227      Sequence\r
+0:227        move second child to first child (temp highp int)\r
+0:227          's5' (temp highp int)\r
+0:227          Function Call: imageSize(iIB1; (global highp int)\r
+0:227            'bufSamp5' (writeonly uniform highp iimageBuffer)\r
+0:228      Sequence\r
+0:228        move second child to first child (temp highp int)\r
+0:228          's6' (temp highp int)\r
+0:228          Function Call: imageSize(uIB1; (global highp int)\r
+0:228            'bufSamp6' (writeonly uniform highp uimageBuffer)\r
+0:230      Sequence\r
+0:230        move second child to first child (temp highp 4-component vector of float)\r
+0:230          'f1' (temp highp 4-component vector of float)\r
+0:230          Function Call: texelFetch(sB1;i1; (global highp 4-component vector of float)\r
+0:230            'bufSamp1' (uniform highp samplerBuffer)\r
+0:230            's1' (temp highp int)\r
+0:231      Sequence\r
+0:231        move second child to first child (temp highp 4-component vector of int)\r
+0:231          'f2' (temp highp 4-component vector of int)\r
+0:231          Function Call: texelFetch(isB1;i1; (global highp 4-component vector of int)\r
+0:231            'bufSamp2' (uniform highp isamplerBuffer)\r
+0:231            's2' (temp highp int)\r
+0:232      Sequence\r
+0:232        move second child to first child (temp highp 4-component vector of uint)\r
+0:232          'f3' (temp highp 4-component vector of uint)\r
+0:232          Function Call: texelFetch(usB1;i1; (global highp 4-component vector of uint)\r
+0:232            'bufSamp3' (uniform highp usamplerBuffer)\r
+0:232            's3' (temp highp int)\r
 0:?   Linker Objects\r
 0:?     's' (shared highp 4-component vector of float)\r
 0:?     'v' (buffer highp 4-component vector of float)\r
@@ -790,6 +932,24 @@ ERROR: node is still EOpNull!
 0:?       0 (const int)\r
 0:?       0 (const int)\r
 0:?       0 (const int)\r
+0:?     'badSamp1' (uniform mediump samplerBuffer)\r
+0:?     'badSamp2' (uniform mediump isamplerBuffer)\r
+0:?     'badSamp3' (uniform mediump usamplerBuffer)\r
+0:?     'badSamp4' (writeonly uniform mediump imageBuffer)\r
+0:?     'badSamp5' (writeonly uniform mediump iimageBuffer)\r
+0:?     'badSamp6' (writeonly uniform mediump uimageBuffer)\r
+0:?     'noPreSamp1' (uniform mediump samplerBuffer)\r
+0:?     'noPreSamp2' (uniform mediump isamplerBuffer)\r
+0:?     'noPreSamp3' (uniform mediump usamplerBuffer)\r
+0:?     'noPreSamp4' (writeonly uniform mediump imageBuffer)\r
+0:?     'noPreSamp5' (writeonly uniform mediump iimageBuffer)\r
+0:?     'noPreSamp6' (writeonly uniform mediump uimageBuffer)\r
+0:?     'bufSamp1' (uniform highp samplerBuffer)\r
+0:?     'bufSamp2' (uniform highp isamplerBuffer)\r
+0:?     'bufSamp3' (uniform highp usamplerBuffer)\r
+0:?     'bufSamp4' (writeonly uniform highp imageBuffer)\r
+0:?     'bufSamp5' (writeonly uniform highp iimageBuffer)\r
+0:?     'bufSamp6' (writeonly uniform highp uimageBuffer)\r
 0:?     'gl_VertexID' (gl_VertexId highp int VertexId)\r
 0:?     'gl_InstanceID' (gl_InstanceId highp int InstanceId)\r
 \r
index b3a3f49..e58e2ce 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 "2.3.715"
+#define GLSLANG_REVISION "2.3.716"
 #define GLSLANG_DATE "16-Aug-2015"
index 5ef336d..42e5217 100644 (file)
@@ -1827,6 +1827,8 @@ void TBuiltIns::add2ndGenerationSamplingImaging(int version, EProfile profile)
     //
 
     TBasicType bTypes[3] = { EbtFloat, EbtInt, EbtUint };
+    bool skipBuffer = (profile == EEsProfile && version < 310) || (profile != EEsProfile && version < 140);
+    bool skipCubeArrayed = (profile == EEsProfile || version < 130);
 
     // enumerate all the types
     for (int image = 0; image <= 1; ++image) { // loop over "bool" image vs sampler
@@ -1854,9 +1856,9 @@ void TBuiltIns::add2ndGenerationSamplingImaging(int version, EProfile profile)
                             continue;
                         if (dim == Esd3D && shadow)
                             continue;
-                        if (dim == EsdCube && arrayed && (profile == EEsProfile || version < 130))
+                        if (dim == EsdCube && arrayed && skipCubeArrayed)
                             continue;
-                        if (dim == EsdBuffer && (profile == EEsProfile || version < 140))
+                        if (dim == EsdBuffer && skipBuffer)
                             continue;
                         if (dim == EsdBuffer && (shadow || arrayed || ms))
                             continue;
index af92915..f47f12e 100644 (file)
@@ -781,9 +781,13 @@ int TScanContext::tokenizeIdentifier()
     case IMAGE2DRECT:
     case IIMAGE2DRECT:
     case UIMAGE2DRECT:
+        return firstGenerationImage(false);
+
     case IMAGEBUFFER:
     case IIMAGEBUFFER:
     case UIMAGEBUFFER:
+        if (parseContext.extensionsTurnedOn(Num_AEP_texture_buffer, AEP_texture_buffer))
+            return keyword;
         return firstGenerationImage(false);
 
     case IMAGE2D:
@@ -834,7 +838,6 @@ int TScanContext::tokenizeIdentifier()
     case SAMPLER1DARRAYSHADOW:
     case USAMPLER1D:
     case USAMPLER1DARRAY:
-    case SAMPLERBUFFER:
         afterType = true;
         return es30ReservedFromGLSL(130);
 
@@ -858,9 +861,20 @@ int TScanContext::tokenizeIdentifier()
         
     case ISAMPLER2DRECT:
     case USAMPLER2DRECT:
+        afterType = true;
+        return es30ReservedFromGLSL(140);
+
+    case SAMPLERBUFFER:
+        afterType = true;
+        if (parseContext.extensionsTurnedOn(Num_AEP_texture_buffer, AEP_texture_buffer))
+            return keyword;
+        return es30ReservedFromGLSL(130);
+
     case ISAMPLERBUFFER:
     case USAMPLERBUFFER:
         afterType = true;
+        if (parseContext.extensionsTurnedOn(Num_AEP_texture_buffer, AEP_texture_buffer))
+            return keyword;
         return es30ReservedFromGLSL(140);
         
     case SAMPLER2DMS:
index 94bf19c..40f0fd7 100644 (file)
@@ -192,7 +192,7 @@ void TParseContext::initializeExtensionBehavior()
     extensionBehavior[E_GL_EXT_shader_io_blocks]                     = EBhDisable;
     extensionBehavior[E_GL_EXT_tessellation_shader]                  = EBhDisable;
     extensionBehavior[E_GL_EXT_tessellation_point_size]              = EBhDisable;
-    extensionBehavior[E_GL_EXT_texture_buffer]                       = EBhDisablePartial;
+    extensionBehavior[E_GL_EXT_texture_buffer]                       = EBhDisable;
     extensionBehavior[E_GL_EXT_texture_cube_map_array]               = EBhDisablePartial;
 
     // OES matching AEP
@@ -203,7 +203,7 @@ void TParseContext::initializeExtensionBehavior()
     extensionBehavior[E_GL_OES_shader_io_blocks]         = EBhDisable;
     extensionBehavior[E_GL_OES_tessellation_shader]      = EBhDisable;
     extensionBehavior[E_GL_OES_tessellation_point_size]  = EBhDisable;
-    extensionBehavior[E_GL_OES_texture_buffer]           = EBhDisablePartial;
+    extensionBehavior[E_GL_OES_texture_buffer]           = EBhDisable;
     extensionBehavior[E_GL_OES_texture_cube_map_array]   = EBhDisablePartial;
 }