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

Kenneth Graunke kenneth at whitecape.org
Wed Nov 9 21:04:17 UTC 2016


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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: This is a digitally signed message part.
URL: <https://lists.freedesktop.org/archives/piglit/attachments/20161109/fd86e390/attachment-0001.sig>


More information about the Piglit mailing list