Add the original-style texture-rectangle texturing functions, and allow rectangular...
authorJohn Kessenich <cepheus@frii.com>
Tue, 29 Jul 2014 17:18:24 +0000 (17:18 +0000)
committerJohn Kessenich <cepheus@frii.com>
Tue, 29 Jul 2014 17:18:24 +0000 (17:18 +0000)
git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@27538 e7fa87d3-cd2b-0410-9028-fcbf551c1848

Test/120.frag
Test/baseResults/120.frag.out
glslang/MachineIndependent/Initialize.cpp
glslang/MachineIndependent/Scan.cpp

index 9f3759e..18c3cd7 100644 (file)
@@ -199,3 +199,29 @@ void foo2324()
     v = texture1DProjLod(s1D, v, f);
     v = shadow2DProjLod(s2DS, v, f);
 }
+
+uniform sampler2DRect s2DRbad;
+
+void foo121111()
+{
+    vec2 v2;
+    vec4 v = texture2DRect(s2DRbad, v2);
+}
+
+#extension GL_ARB_texture_rectangle : enable
+
+uniform sampler2DRect s2DR;
+uniform sampler2DRectShadow s2DRS;
+
+void foo12111()
+{
+    vec2 v2;
+    vec3 v3;
+    vec4 v4;
+    vec4 v;
+    v = texture2DRect(s2DR, v2);
+    v = texture2DRectProj(s2DR, v3);
+    v = texture2DRectProj(s2DR, v4);
+    v = shadow2DRect(s2DRS, v3);
+    v = shadow2DRectProj(s2DRS, v4);
+}
index 40eaf6b..714fa46 100644 (file)
@@ -47,11 +47,13 @@ ERROR: 0:185: 'texture3DProjLod' : required extension not requested: GL_ARB_shad
 ERROR: 0:186: 'texture1DProjLod' : required extension not requested: GL_ARB_shader_texture_lod\r
 ERROR: 0:187: 'shadow2DProjLod' : required extension not requested: GL_ARB_shader_texture_lod\r
 WARNING: 0:190: '#extension' : extension is only partially supported: GL_ARB_shader_texture_lod\r
-ERROR: 47 compilation errors.  No code generated.\r
+ERROR: 0:203: 'sampler2DRect' : Reserved word. \r
+ERROR: 48 compilation errors.  No code generated.\r
 \r
 \r
 Shader version: 120\r
 Requested GL_ARB_shader_texture_lod\r
+Requested GL_ARB_texture_rectangle\r
 ERROR: node is still EOpNull!\r
 0:21  Function Definition: main( (void)\r
 0:21    Function Parameters: \r
@@ -497,6 +499,43 @@ ERROR: node is still EOpNull!
 0:200          's2DS' (uniform sampler2DShadow)\r
 0:200          'v' (4-component vector of float)\r
 0:200          'f' (float)\r
+0:205  Function Definition: foo121111( (void)\r
+0:205    Function Parameters: \r
+0:?     Sequence\r
+0:208      Sequence\r
+0:208        move second child to first child (4-component vector of float)\r
+0:208          'v' (4-component vector of float)\r
+0:208          Function Call: texture2DRect(sR21;vf2; (4-component vector of float)\r
+0:208            's2DRbad' (uniform sampler2DRect)\r
+0:208            'v2' (2-component vector of float)\r
+0:216  Function Definition: foo12111( (void)\r
+0:216    Function Parameters: \r
+0:?     Sequence\r
+0:222      move second child to first child (4-component vector of float)\r
+0:222        'v' (4-component vector of float)\r
+0:222        Function Call: texture2DRect(sR21;vf2; (4-component vector of float)\r
+0:222          's2DR' (uniform sampler2DRect)\r
+0:222          'v2' (2-component vector of float)\r
+0:223      move second child to first child (4-component vector of float)\r
+0:223        'v' (4-component vector of float)\r
+0:223        Function Call: texture2DRectProj(sR21;vf3; (4-component vector of float)\r
+0:223          's2DR' (uniform sampler2DRect)\r
+0:223          'v3' (3-component vector of float)\r
+0:224      move second child to first child (4-component vector of float)\r
+0:224        'v' (4-component vector of float)\r
+0:224        Function Call: texture2DRectProj(sR21;vf4; (4-component vector of float)\r
+0:224          's2DR' (uniform sampler2DRect)\r
+0:224          'v4' (4-component vector of float)\r
+0:225      move second child to first child (4-component vector of float)\r
+0:225        'v' (4-component vector of float)\r
+0:225        Function Call: shadow2DRect(sSR21;vf3; (4-component vector of float)\r
+0:225          's2DRS' (uniform sampler2DRectShadow)\r
+0:225          'v3' (3-component vector of float)\r
+0:226      move second child to first child (4-component vector of float)\r
+0:226        'v' (4-component vector of float)\r
+0:226        Function Call: shadow2DRectProj(sSR21;vf4; (4-component vector of float)\r
+0:226          's2DRS' (uniform sampler2DRectShadow)\r
+0:226          'v4' (4-component vector of float)\r
 0:?   Linker Objects\r
 0:?     'lowp' (float)\r
 0:?     'mediump' (float)\r
@@ -523,6 +562,9 @@ ERROR: node is still EOpNull!
 0:?     's3D' (uniform sampler3D)\r
 0:?     's1D' (uniform sampler1D)\r
 0:?     's2DS' (uniform sampler2DShadow)\r
+0:?     's2DRbad' (uniform sampler2DRect)\r
+0:?     's2DR' (uniform sampler2DRect)\r
+0:?     's2DRS' (uniform sampler2DRectShadow)\r
 \r
 \r
 Linked fragment stage:\r
@@ -532,6 +574,7 @@ ERROR: Linking fragment stage: Recursion detected:
 \r
 Shader version: 120\r
 Requested GL_ARB_shader_texture_lod\r
+Requested GL_ARB_texture_rectangle\r
 ERROR: node is still EOpNull!\r
 0:21  Function Definition: main( (void)\r
 0:21    Function Parameters: \r
@@ -977,6 +1020,43 @@ ERROR: node is still EOpNull!
 0:200          's2DS' (uniform sampler2DShadow)\r
 0:200          'v' (4-component vector of float)\r
 0:200          'f' (float)\r
+0:205  Function Definition: foo121111( (void)\r
+0:205    Function Parameters: \r
+0:?     Sequence\r
+0:208      Sequence\r
+0:208        move second child to first child (4-component vector of float)\r
+0:208          'v' (4-component vector of float)\r
+0:208          Function Call: texture2DRect(sR21;vf2; (4-component vector of float)\r
+0:208            's2DRbad' (uniform sampler2DRect)\r
+0:208            'v2' (2-component vector of float)\r
+0:216  Function Definition: foo12111( (void)\r
+0:216    Function Parameters: \r
+0:?     Sequence\r
+0:222      move second child to first child (4-component vector of float)\r
+0:222        'v' (4-component vector of float)\r
+0:222        Function Call: texture2DRect(sR21;vf2; (4-component vector of float)\r
+0:222          's2DR' (uniform sampler2DRect)\r
+0:222          'v2' (2-component vector of float)\r
+0:223      move second child to first child (4-component vector of float)\r
+0:223        'v' (4-component vector of float)\r
+0:223        Function Call: texture2DRectProj(sR21;vf3; (4-component vector of float)\r
+0:223          's2DR' (uniform sampler2DRect)\r
+0:223          'v3' (3-component vector of float)\r
+0:224      move second child to first child (4-component vector of float)\r
+0:224        'v' (4-component vector of float)\r
+0:224        Function Call: texture2DRectProj(sR21;vf4; (4-component vector of float)\r
+0:224          's2DR' (uniform sampler2DRect)\r
+0:224          'v4' (4-component vector of float)\r
+0:225      move second child to first child (4-component vector of float)\r
+0:225        'v' (4-component vector of float)\r
+0:225        Function Call: shadow2DRect(sSR21;vf3; (4-component vector of float)\r
+0:225          's2DRS' (uniform sampler2DRectShadow)\r
+0:225          'v3' (3-component vector of float)\r
+0:226      move second child to first child (4-component vector of float)\r
+0:226        'v' (4-component vector of float)\r
+0:226        Function Call: shadow2DRectProj(sSR21;vf4; (4-component vector of float)\r
+0:226          's2DRS' (uniform sampler2DRectShadow)\r
+0:226          'v4' (4-component vector of float)\r
 0:?   Linker Objects\r
 0:?     'lowp' (float)\r
 0:?     'mediump' (float)\r
@@ -1003,4 +1083,7 @@ ERROR: node is still EOpNull!
 0:?     's3D' (uniform sampler3D)\r
 0:?     's1D' (uniform sampler1D)\r
 0:?     's2DS' (uniform sampler2DShadow)\r
+0:?     's2DRbad' (uniform sampler2DRect)\r
+0:?     's2DR' (uniform sampler2DRect)\r
+0:?     's2DRS' (uniform sampler2DRectShadow)\r
 \r
index bb8c61d..c6771d6 100644 (file)
@@ -689,7 +689,13 @@ void TBuiltIns::initialize(int version, EProfile profile)
             "vec4 shadow2D(sampler2DShadow, vec3);"
             "vec4 shadow1DProj(sampler1DShadow, vec4);"
             "vec4 shadow2DProj(sampler2DShadow, vec4);"
-            
+
+            "vec4 texture2DRect(sampler2DRect, vec2);"          // GL_ARB_texture_rectangle, caught by keyword check
+            "vec4 texture2DRectProj(sampler2DRect, vec3);"      // GL_ARB_texture_rectangle, caught by keyword check
+            "vec4 texture2DRectProj(sampler2DRect, vec4);"      // GL_ARB_texture_rectangle, caught by keyword check
+            "vec4 shadow2DRect(sampler2DRectShadow, vec3);"     // GL_ARB_texture_rectangle, caught by keyword check
+            "vec4 shadow2DRectProj(sampler2DRectShadow, vec4);" // GL_ARB_texture_rectangle, caught by keyword check
+
             "\n");
     }
 
index 5f92ba7..d10369c 100644 (file)
@@ -862,8 +862,12 @@ int TScanContext::tokenizeIdentifier()
         afterType = true;
         if (parseContext.profile == EEsProfile)
             reservedWord();
-        else if (parseContext.version < 140 && ! parseContext.symbolTable.atBuiltInLevel() && ! parseContext.extensionsTurnedOn(1, &GL_ARB_texture_rectangle))
-            reservedWord();
+        else if (parseContext.version < 140 && ! parseContext.symbolTable.atBuiltInLevel() && ! parseContext.extensionsTurnedOn(1, &GL_ARB_texture_rectangle)) {
+            if (parseContext.messages & EShMsgRelaxedErrors)
+                parseContext.requireExtensions(loc, 1, &GL_ARB_texture_rectangle, "texture-rectangle sampler keyword");
+            else
+                reservedWord();
+        }
         return keyword;
 
     case SAMPLER1DARRAY: