From 758c15720d4f36a899e7641d4bb0811ea90a26bf Mon Sep 17 00:00:00 2001 From: John Kessenich Date: Mon, 6 Oct 2014 16:38:53 +0000 Subject: [PATCH] Remove lod argument from texture2DRect built-ins. (Submission from matt.helsley) git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@28440 e7fa87d3-cd2b-0410-9028-fcbf551c1848 --- Test/140.vert | 20 +++ Test/baseResults/140.vert.out | 146 +++++++++++++++++++++- glslang/MachineIndependent/Initialize.cpp | 2 +- 3 files changed, 166 insertions(+), 2 deletions(-) diff --git a/Test/140.vert b/Test/140.vert index 5dfa71e5..380d30e7 100644 --- a/Test/140.vert +++ b/Test/140.vert @@ -37,3 +37,23 @@ out vec3 gl_Position; // ERROR out float gl_PointSize; out vec4 gl_ClipVertex; out float gl_FogFragCoord; + +uniform sampler2DRect s2dr; +uniform sampler2DRectShadow s2drs; +in ivec2 itloc2; +in vec2 tloc2; +in vec3 tloc3; +in vec4 tloc4; + +void foo() +{ + vec4 v = texelFetch(s2dr, itloc2); + v += texelFetch(s2dr, itloc2, 0.2); // ERROR, no lod + v += texture(s2dr, tloc2); + v += texture(s2dr, tloc2, 0.3); // ERROR, no bias + v += texture(s2drs, tloc3); + v += textureProj(s2dr, tloc3); + v += textureProj(s2dr, tloc4); + v += textureProjGradOffset(s2dr, tloc4, ivec2(0.0), ivec2(0.0), ivec2(1,2)); + v += textureProjGradOffset(s2drs, tloc4, ivec2(0.0), ivec2(0.0), ivec2(1,2)); +} diff --git a/Test/baseResults/140.vert.out b/Test/baseResults/140.vert.out index 0b0799fc..8c935227 100644 --- a/Test/baseResults/140.vert.out +++ b/Test/baseResults/140.vert.out @@ -7,7 +7,9 @@ ERROR: 0:34: 'redeclaration' : cannot change interpolation qualification of gl_P ERROR: 0:35: 'redeclaration' : cannot change the type of gl_Position ERROR: 0:38: 'gl_ClipVertex' : cannot redeclare after use ERROR: 0:39: 'gl_FogFragCoord' : cannot redeclare after use -ERROR: 8 compilation errors. No code generated. +ERROR: 0:51: 'texelFetch' : no matching overloaded function found +ERROR: 0:53: 'texture' : no matching overloaded function found +ERROR: 10 compilation errors. No code generated. Shader version: 140 @@ -49,6 +51,71 @@ ERROR: node is still EOpNull! 0:18 'gl_TexCoord' (smooth out implicitly-sized array of 4-component vector of float) 0:19 'gl_FogFragCoord' (smooth out float) 0:20 'gl_FrontColor' (smooth out 4-component vector of float) +0:48 Function Definition: foo( (void) +0:48 Function Parameters: +0:50 Sequence +0:50 Sequence +0:50 move second child to first child (4-component vector of float) +0:50 'v' (4-component vector of float) +0:50 Function Call: texelFetch(sR21;vi2; (4-component vector of float) +0:50 's2dr' (uniform sampler2DRect) +0:50 'itloc2' (in 2-component vector of int) +0:51 add second child into first child (4-component vector of float) +0:51 'v' (4-component vector of float) +0:51 Constant: +0:51 0.000000 +0:52 add second child into first child (4-component vector of float) +0:52 'v' (4-component vector of float) +0:52 Function Call: texture(sR21;vf2; (4-component vector of float) +0:52 's2dr' (uniform sampler2DRect) +0:52 'tloc2' (in 2-component vector of float) +0:53 add second child into first child (4-component vector of float) +0:53 'v' (4-component vector of float) +0:53 Constant: +0:53 0.000000 +0:54 add second child into first child (4-component vector of float) +0:54 'v' (4-component vector of float) +0:54 Function Call: texture(sSR21;vf3; (float) +0:54 's2drs' (uniform sampler2DRectShadow) +0:54 'tloc3' (in 3-component vector of float) +0:55 add second child into first child (4-component vector of float) +0:55 'v' (4-component vector of float) +0:55 Function Call: textureProj(sR21;vf3; (4-component vector of float) +0:55 's2dr' (uniform sampler2DRect) +0:55 'tloc3' (in 3-component vector of float) +0:56 add second child into first child (4-component vector of float) +0:56 'v' (4-component vector of float) +0:56 Function Call: textureProj(sR21;vf4; (4-component vector of float) +0:56 's2dr' (uniform sampler2DRect) +0:56 'tloc4' (in 4-component vector of float) +0:57 add second child into first child (4-component vector of float) +0:57 'v' (4-component vector of float) +0:57 Function Call: textureProjGradOffset(sR21;vf4;vf2;vf2;vi2; (4-component vector of float) +0:57 's2dr' (uniform sampler2DRect) +0:57 'tloc4' (in 4-component vector of float) +0:57 Constant: +0:57 0.000000 +0:57 0.000000 +0:57 Constant: +0:57 0.000000 +0:57 0.000000 +0:57 Constant: +0:57 1 (const int) +0:57 2 (const int) +0:58 add second child into first child (4-component vector of float) +0:58 'v' (4-component vector of float) +0:58 Function Call: textureProjGradOffset(sSR21;vf4;vf2;vf2;vi2; (float) +0:58 's2drs' (uniform sampler2DRectShadow) +0:58 'tloc4' (in 4-component vector of float) +0:58 Constant: +0:58 0.000000 +0:58 0.000000 +0:58 Constant: +0:58 0.000000 +0:58 0.000000 +0:58 Constant: +0:58 1 (const int) +0:58 2 (const int) 0:? Linker Objects 0:? 'sbuf' (uniform isamplerBuffer) 0:? 'anon@0' (layout(column_major std140 ) uniform block{layout(column_major std140 offset=0 ) uniform int anonMem}) @@ -62,6 +129,12 @@ ERROR: node is still EOpNull! 0:? 'gl_ClipVertex' (gl_ClipVertex 4-component vector of float) 0:? 'gl_FogFragCoord' (smooth out float) 0:? 'gl_FogFragCoord' (smooth out float) +0:? 's2dr' (uniform sampler2DRect) +0:? 's2drs' (uniform sampler2DRectShadow) +0:? 'itloc2' (in 2-component vector of int) +0:? 'tloc2' (in 2-component vector of float) +0:? 'tloc3' (in 3-component vector of float) +0:? 'tloc4' (in 4-component vector of float) 0:? 'gl_VertexID' (gl_VertexId int) 0:? 'gl_InstanceID' (gl_InstanceId int) @@ -108,6 +181,71 @@ ERROR: node is still EOpNull! 0:18 'gl_TexCoord' (smooth out 1-element array of 4-component vector of float) 0:19 'gl_FogFragCoord' (smooth out float) 0:20 'gl_FrontColor' (smooth out 4-component vector of float) +0:48 Function Definition: foo( (void) +0:48 Function Parameters: +0:50 Sequence +0:50 Sequence +0:50 move second child to first child (4-component vector of float) +0:50 'v' (4-component vector of float) +0:50 Function Call: texelFetch(sR21;vi2; (4-component vector of float) +0:50 's2dr' (uniform sampler2DRect) +0:50 'itloc2' (in 2-component vector of int) +0:51 add second child into first child (4-component vector of float) +0:51 'v' (4-component vector of float) +0:51 Constant: +0:51 0.000000 +0:52 add second child into first child (4-component vector of float) +0:52 'v' (4-component vector of float) +0:52 Function Call: texture(sR21;vf2; (4-component vector of float) +0:52 's2dr' (uniform sampler2DRect) +0:52 'tloc2' (in 2-component vector of float) +0:53 add second child into first child (4-component vector of float) +0:53 'v' (4-component vector of float) +0:53 Constant: +0:53 0.000000 +0:54 add second child into first child (4-component vector of float) +0:54 'v' (4-component vector of float) +0:54 Function Call: texture(sSR21;vf3; (float) +0:54 's2drs' (uniform sampler2DRectShadow) +0:54 'tloc3' (in 3-component vector of float) +0:55 add second child into first child (4-component vector of float) +0:55 'v' (4-component vector of float) +0:55 Function Call: textureProj(sR21;vf3; (4-component vector of float) +0:55 's2dr' (uniform sampler2DRect) +0:55 'tloc3' (in 3-component vector of float) +0:56 add second child into first child (4-component vector of float) +0:56 'v' (4-component vector of float) +0:56 Function Call: textureProj(sR21;vf4; (4-component vector of float) +0:56 's2dr' (uniform sampler2DRect) +0:56 'tloc4' (in 4-component vector of float) +0:57 add second child into first child (4-component vector of float) +0:57 'v' (4-component vector of float) +0:57 Function Call: textureProjGradOffset(sR21;vf4;vf2;vf2;vi2; (4-component vector of float) +0:57 's2dr' (uniform sampler2DRect) +0:57 'tloc4' (in 4-component vector of float) +0:57 Constant: +0:57 0.000000 +0:57 0.000000 +0:57 Constant: +0:57 0.000000 +0:57 0.000000 +0:57 Constant: +0:57 1 (const int) +0:57 2 (const int) +0:58 add second child into first child (4-component vector of float) +0:58 'v' (4-component vector of float) +0:58 Function Call: textureProjGradOffset(sSR21;vf4;vf2;vf2;vi2; (float) +0:58 's2drs' (uniform sampler2DRectShadow) +0:58 'tloc4' (in 4-component vector of float) +0:58 Constant: +0:58 0.000000 +0:58 0.000000 +0:58 Constant: +0:58 0.000000 +0:58 0.000000 +0:58 Constant: +0:58 1 (const int) +0:58 2 (const int) 0:? Linker Objects 0:? 'sbuf' (uniform isamplerBuffer) 0:? 'anon@0' (layout(column_major std140 ) uniform block{layout(column_major std140 offset=0 ) uniform int anonMem}) @@ -121,6 +259,12 @@ ERROR: node is still EOpNull! 0:? 'gl_ClipVertex' (gl_ClipVertex 4-component vector of float) 0:? 'gl_FogFragCoord' (smooth out float) 0:? 'gl_FogFragCoord' (smooth out float) +0:? 's2dr' (uniform sampler2DRect) +0:? 's2drs' (uniform sampler2DRectShadow) +0:? 'itloc2' (in 2-component vector of int) +0:? 'tloc2' (in 2-component vector of float) +0:? 'tloc3' (in 3-component vector of float) +0:? 'tloc4' (in 4-component vector of float) 0:? 'gl_VertexID' (gl_VertexId int) 0:? 'gl_InstanceID' (gl_InstanceId int) diff --git a/glslang/MachineIndependent/Initialize.cpp b/glslang/MachineIndependent/Initialize.cpp index d45b8a5d..b9c13446 100644 --- a/glslang/MachineIndependent/Initialize.cpp +++ b/glslang/MachineIndependent/Initialize.cpp @@ -2074,7 +2074,7 @@ void TBuiltIns::addSamplingFunctions(TSampler sampler, TString& typeName, int ve continue; // non-optional lod argument (lod that's not driven by lod loop) - if (fetch && sampler.dim != EsdBuffer && !sampler.ms) + if (fetch && sampler.dim != EsdBuffer && sampler.dim != EsdRect && !sampler.ms) s.append(",int"); // non-optional lod