[Piglit] [Patch 1/1] texelFetch, textureSize: replace deprecated gl_FragColor

Olender, Sebastian D sebastian.d.olender at intel.com
Thu Nov 10 09:26:42 UTC 2016


Ken,

In forward compatible context deprecated features are disallowed.


-----Original Message-----
From: Kenneth Graunke [mailto:kenneth at whitecape.org] 
Sent: Wednesday, November 9, 2016 10:04 PM
To: Olender, Sebastian D <sebastian.d.olender at intel.com>
Cc: piglit at lists.freedesktop.org; Graunke, Kenneth W <kenneth.w.graunke at intel.com>
Subject: Re: [Piglit] [Patch 1/1] texelFetch, textureSize: replace deprecated gl_FragColor

On Wednesday, November 9, 2016 3:18:36 PM PST Sebastian Olender wrote:
> According to GLSLLangSpec: Use of gl_FragData and gl_FragColor is 
> deprecated in version 1.3, using user-defined out instead.
> ---
>  tests/texturing/shaders/texelFetch.c  | 9 ++++++---  
> tests/texturing/shaders/textureSize.c | 9 ++++++---
>  2 files changed, 12 insertions(+), 6 deletions(-)
> 
> diff --git a/tests/texturing/shaders/texelFetch.c 
> b/tests/texturing/shaders/texelFetch.c
> index 0291a12..2e1d223 100644
> --- a/tests/texturing/shaders/texelFetch.c
> +++ b/tests/texturing/shaders/texelFetch.c
> @@ -627,9 +627,10 @@ generate_GLSL(enum shader_target test_stage)
>  			 "#version %d\n"
>  			 "flat in %s color;\n"
>  			 "uniform vec4 divisor;\n"
> +			 "out vec4 fragColor;\n"
>  			 "void main()\n"
>  			 "{\n"
> -			 "    gl_FragColor = vec4(color)/divisor;\n"
> +			 "    fragColor = vec4(color)/divisor;\n"
>  			 "}\n",
>  			 shader_version,
>  			 sampler.return_type);
> @@ -676,9 +677,10 @@ generate_GLSL(enum shader_target test_stage)
>  			 "#version %d\n"
>  			 "flat in %s color;\n"
>  			 "uniform vec4 divisor;\n"
> +			 "out vec4 fragColor;\n"
>  			 "void main()\n"
>  			 "{\n"
> -			 "    gl_FragColor = vec4(color)/divisor;\n"
> +			 "    fragColor = vec4(color)/divisor;\n"
>  			 "}\n",
>  			 shader_version,
>  			 sampler.return_type);
> @@ -703,10 +705,11 @@ generate_GLSL(enum shader_target test_stage)
>  			 "flat in ivec4 tc;\n"
>  			 "uniform vec4 divisor;\n"
>  			 "uniform %s tex;\n"
> +			 "out vec4 fragColor;\n"
>  			 "void main()\n"
>  			 "{\n"
>  			 "    vec4 color = texelFetch%s(tex, ivec%d(tc)%s%s);\n"
> -			 "    gl_FragColor = color/divisor;\n"
> +			 "    fragColor = color/divisor;\n"
>  			 "}\n",
>  			 shader_version,
>  			 has_samples() ? "#extension GL_ARB_texture_multisample: require" 
> : "", diff --git a/tests/texturing/shaders/textureSize.c 
> b/tests/texturing/shaders/textureSize.c
> index c02c566..ac3df04 100644
> --- a/tests/texturing/shaders/textureSize.c
> +++ b/tests/texturing/shaders/textureSize.c
> @@ -284,9 +284,10 @@ generate_GLSL(enum shader_target test_stage)
>  			 "#define ivec1 int\n"
>  			 "#define vec1 float\n"
>  			 "flat in ivec%d size;\n"
> +			 "out vec4 fragColor;\n"
>  			 "void main()\n"
>  			 "{\n"
> -			 "    gl_FragColor = vec4(0.01 * size,%s 1);\n"
> +			 "    fragColor = vec4(0.01 * size,%s 1);\n"
>  			 "}\n",
>  			 shader_version, size, zeroes[3 - size]);
>  		break;
> @@ -325,9 +326,10 @@ generate_GLSL(enum shader_target test_stage)
>  			 "#define ivec1 int\n"
>  			 "#define vec1 float\n"
>  			 "flat in ivec%d size;\n"
> +			 "out vec4 fragColor;\n"
>  			 "void main()\n"
>  			 "{\n"
> -			 "    gl_FragColor = vec4(0.01 * size,%s 1);\n"
> +			 "    fragColor = vec4(0.01 * size,%s 1);\n"
>  			 "}\n",
>  			 shader_version, size, zeroes[3 - size]);
>  		break;
> @@ -345,10 +347,11 @@ generate_GLSL(enum shader_target test_stage)
>  			 "#define ivec1 int\n"
>  			 "uniform int lod;\n"
>  			 "uniform %s tex;\n"
> +			 "out vec4 fragColor;\n"
>  			 "void main()\n"
>  			 "{\n"
>  			 "    ivec%d size = textureSize(tex%s);\n"
> -			 "    gl_FragColor = vec4(0.01 * size,%s 1);\n"
> +			 "    fragColor = vec4(0.01 * size,%s 1);\n"
>  			 "}\n",
>  			 shader_version, extension, sampler.name, size, lod_arg,
>  			 zeroes[3 - size]);
> 

I don't have a problem with this patch, but out of curiosity, is there some reason you need to make this change?  gl_FragColor may be deprecated in 1.30 but it didn't actually go away until 4.20.

--Ken


More information about the Piglit mailing list