mesa: Return GL_INVALID_ENUM for bogus TEXTURE_SRGB_DECODE_EXT params.
authorKenneth Graunke <kenneth@whitecape.org>
Thu, 13 Jul 2017 02:49:55 +0000 (19:49 -0700)
committerKenneth Graunke <kenneth@whitecape.org>
Thu, 13 Jul 2017 20:00:58 +0000 (13:00 -0700)
Fixes dEQP-GLES31.functional.debug.negative_coverage.get_error.shader.srgb_decode_samplerparameter{f,fv,i,Iiv,Iuiv,iv}.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
src/mesa/main/samplerobj.c

index d78528be2dbfd7096e80354445237ce76b978ddd..26e7725249017fb5ca15e66bb319dc65563c325e 100644 (file)
@@ -780,8 +780,19 @@ set_sampler_srgb_decode(struct gl_context *ctx,
    if (samp->sRGBDecode == param)
       return GL_FALSE;
 
+   /* The EXT_texture_sRGB_decode spec says:
+    *
+    *    "INVALID_ENUM is generated if the <pname> parameter of
+    *     TexParameter[i,f,Ii,Iui][v][EXT],
+    *     MultiTexParameter[i,f,Ii,Iui][v]EXT,
+    *     TextureParameter[i,f,Ii,Iui][v]EXT, SamplerParameter[i,f,Ii,Iui][v]
+    *     is TEXTURE_SRGB_DECODE_EXT when the <param> parameter is not one of
+    *     DECODE_EXT or SKIP_DECODE_EXT.
+    *
+    * Returning INVALID_PARAM makes that happen.
+    */
    if (param != GL_DECODE_EXT && param != GL_SKIP_DECODE_EXT)
-      return INVALID_VALUE;
+      return INVALID_PARAM;
 
    flush(ctx);
    samp->sRGBDecode = param;