From 019a62b0ecf6f92a565d4188f9d6e4cf5d90d3ce Mon Sep 17 00:00:00 2001 From: John Kessenich Date: Tue, 29 Jul 2014 17:18:24 +0000 Subject: [PATCH] Add the original-style texture-rectangle texturing functions, and allow rectangular samplers to be declared under relaxed semantic checks. 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 | 26 ++++++++++ Test/baseResults/120.frag.out | 85 ++++++++++++++++++++++++++++++- glslang/MachineIndependent/Initialize.cpp | 8 ++- glslang/MachineIndependent/Scan.cpp | 8 ++- 4 files changed, 123 insertions(+), 4 deletions(-) diff --git a/Test/120.frag b/Test/120.frag index 9f3759e..18c3cd7 100644 --- a/Test/120.frag +++ b/Test/120.frag @@ -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); +} diff --git a/Test/baseResults/120.frag.out b/Test/baseResults/120.frag.out index 40eaf6b..714fa46 100644 --- a/Test/baseResults/120.frag.out +++ b/Test/baseResults/120.frag.out @@ -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 ERROR: 0:187: 'shadow2DProjLod' : required extension not requested: GL_ARB_shader_texture_lod WARNING: 0:190: '#extension' : extension is only partially supported: GL_ARB_shader_texture_lod -ERROR: 47 compilation errors. No code generated. +ERROR: 0:203: 'sampler2DRect' : Reserved word. +ERROR: 48 compilation errors. No code generated. Shader version: 120 Requested GL_ARB_shader_texture_lod +Requested GL_ARB_texture_rectangle ERROR: node is still EOpNull! 0:21 Function Definition: main( (void) 0:21 Function Parameters: @@ -497,6 +499,43 @@ ERROR: node is still EOpNull! 0:200 's2DS' (uniform sampler2DShadow) 0:200 'v' (4-component vector of float) 0:200 'f' (float) +0:205 Function Definition: foo121111( (void) +0:205 Function Parameters: +0:? Sequence +0:208 Sequence +0:208 move second child to first child (4-component vector of float) +0:208 'v' (4-component vector of float) +0:208 Function Call: texture2DRect(sR21;vf2; (4-component vector of float) +0:208 's2DRbad' (uniform sampler2DRect) +0:208 'v2' (2-component vector of float) +0:216 Function Definition: foo12111( (void) +0:216 Function Parameters: +0:? Sequence +0:222 move second child to first child (4-component vector of float) +0:222 'v' (4-component vector of float) +0:222 Function Call: texture2DRect(sR21;vf2; (4-component vector of float) +0:222 's2DR' (uniform sampler2DRect) +0:222 'v2' (2-component vector of float) +0:223 move second child to first child (4-component vector of float) +0:223 'v' (4-component vector of float) +0:223 Function Call: texture2DRectProj(sR21;vf3; (4-component vector of float) +0:223 's2DR' (uniform sampler2DRect) +0:223 'v3' (3-component vector of float) +0:224 move second child to first child (4-component vector of float) +0:224 'v' (4-component vector of float) +0:224 Function Call: texture2DRectProj(sR21;vf4; (4-component vector of float) +0:224 's2DR' (uniform sampler2DRect) +0:224 'v4' (4-component vector of float) +0:225 move second child to first child (4-component vector of float) +0:225 'v' (4-component vector of float) +0:225 Function Call: shadow2DRect(sSR21;vf3; (4-component vector of float) +0:225 's2DRS' (uniform sampler2DRectShadow) +0:225 'v3' (3-component vector of float) +0:226 move second child to first child (4-component vector of float) +0:226 'v' (4-component vector of float) +0:226 Function Call: shadow2DRectProj(sSR21;vf4; (4-component vector of float) +0:226 's2DRS' (uniform sampler2DRectShadow) +0:226 'v4' (4-component vector of float) 0:? Linker Objects 0:? 'lowp' (float) 0:? 'mediump' (float) @@ -523,6 +562,9 @@ ERROR: node is still EOpNull! 0:? 's3D' (uniform sampler3D) 0:? 's1D' (uniform sampler1D) 0:? 's2DS' (uniform sampler2DShadow) +0:? 's2DRbad' (uniform sampler2DRect) +0:? 's2DR' (uniform sampler2DRect) +0:? 's2DRS' (uniform sampler2DRectShadow) Linked fragment stage: @@ -532,6 +574,7 @@ ERROR: Linking fragment stage: Recursion detected: Shader version: 120 Requested GL_ARB_shader_texture_lod +Requested GL_ARB_texture_rectangle ERROR: node is still EOpNull! 0:21 Function Definition: main( (void) 0:21 Function Parameters: @@ -977,6 +1020,43 @@ ERROR: node is still EOpNull! 0:200 's2DS' (uniform sampler2DShadow) 0:200 'v' (4-component vector of float) 0:200 'f' (float) +0:205 Function Definition: foo121111( (void) +0:205 Function Parameters: +0:? Sequence +0:208 Sequence +0:208 move second child to first child (4-component vector of float) +0:208 'v' (4-component vector of float) +0:208 Function Call: texture2DRect(sR21;vf2; (4-component vector of float) +0:208 's2DRbad' (uniform sampler2DRect) +0:208 'v2' (2-component vector of float) +0:216 Function Definition: foo12111( (void) +0:216 Function Parameters: +0:? Sequence +0:222 move second child to first child (4-component vector of float) +0:222 'v' (4-component vector of float) +0:222 Function Call: texture2DRect(sR21;vf2; (4-component vector of float) +0:222 's2DR' (uniform sampler2DRect) +0:222 'v2' (2-component vector of float) +0:223 move second child to first child (4-component vector of float) +0:223 'v' (4-component vector of float) +0:223 Function Call: texture2DRectProj(sR21;vf3; (4-component vector of float) +0:223 's2DR' (uniform sampler2DRect) +0:223 'v3' (3-component vector of float) +0:224 move second child to first child (4-component vector of float) +0:224 'v' (4-component vector of float) +0:224 Function Call: texture2DRectProj(sR21;vf4; (4-component vector of float) +0:224 's2DR' (uniform sampler2DRect) +0:224 'v4' (4-component vector of float) +0:225 move second child to first child (4-component vector of float) +0:225 'v' (4-component vector of float) +0:225 Function Call: shadow2DRect(sSR21;vf3; (4-component vector of float) +0:225 's2DRS' (uniform sampler2DRectShadow) +0:225 'v3' (3-component vector of float) +0:226 move second child to first child (4-component vector of float) +0:226 'v' (4-component vector of float) +0:226 Function Call: shadow2DRectProj(sSR21;vf4; (4-component vector of float) +0:226 's2DRS' (uniform sampler2DRectShadow) +0:226 'v4' (4-component vector of float) 0:? Linker Objects 0:? 'lowp' (float) 0:? 'mediump' (float) @@ -1003,4 +1083,7 @@ ERROR: node is still EOpNull! 0:? 's3D' (uniform sampler3D) 0:? 's1D' (uniform sampler1D) 0:? 's2DS' (uniform sampler2DShadow) +0:? 's2DRbad' (uniform sampler2DRect) +0:? 's2DR' (uniform sampler2DRect) +0:? 's2DRS' (uniform sampler2DRectShadow) diff --git a/glslang/MachineIndependent/Initialize.cpp b/glslang/MachineIndependent/Initialize.cpp index bb8c61d..c6771d6 100644 --- a/glslang/MachineIndependent/Initialize.cpp +++ b/glslang/MachineIndependent/Initialize.cpp @@ -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"); } diff --git a/glslang/MachineIndependent/Scan.cpp b/glslang/MachineIndependent/Scan.cpp index 5f92ba7..d10369c 100644 --- a/glslang/MachineIndependent/Scan.cpp +++ b/glslang/MachineIndependent/Scan.cpp @@ -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: -- 2.7.4