[Mesa-dev] [PATCH] mesa: Returns correct error values from gl(Get)SamplerParameter*() on GL-ES 3.0+

Eduardo Lima Mitev elima at igalia.com
Mon Jan 5 03:24:31 PST 2015


On 12/16/2014 09:15 AM, Eduardo Lima Mitev wrote:
> '3.8.2 Sampler Objects' section of the GL-ES 3.0 specification states:
> 
>     "An INVALID_OPERATION error is generated if sampler is not the name
>     of a sampler object previously returned from a call to GenSamplers."
> 
> In desktop GL, an GL_INVALID_VALUE is returned instead.
> 
> Fixes 6 dEQP failing tests:
> * dEQP-GLES3.functional.negative_api.shader.get_sampler_parameteriv
> * dEQP-GLES3.functional.negative_api.shader.get_sampler_parameterfv
> * dEQP-GLES3.functional.negative_api.shader.sampler_parameteri
> * dEQP-GLES3.functional.negative_api.shader.sampler_parameteriv
> * dEQP-GLES3.functional.negative_api.shader.sampler_parameterf
> * dEQP-GLES3.functional.negative_api.shader.sampler_parameterfv
> ---
>  src/mesa/main/samplerobj.c | 72 ++++++++++++++++++++++++++++++++++++++--------
>  1 file changed, 60 insertions(+), 12 deletions(-)
> 
> diff --git a/src/mesa/main/samplerobj.c b/src/mesa/main/samplerobj.c
> index cadc9cc..d62a06b 100644
> --- a/src/mesa/main/samplerobj.c
> +++ b/src/mesa/main/samplerobj.c
> @@ -732,8 +732,16 @@ _mesa_SamplerParameteri(GLuint sampler, GLenum pname, GLint param)
>  
>     sampObj = _mesa_lookup_samplerobj(ctx, sampler);
>     if (!sampObj) {
> -      _mesa_error(ctx, GL_INVALID_VALUE, "glSamplerParameteri(sampler %u)",
> -                  sampler);
> +      /* '3.8.2 Sampler Objects' section of the GL-ES 3.0 specification states:
> +       *
> +       *     "An INVALID_OPERATION error is generated if sampler is not the name
> +       *     of a sampler object previously returned from a call to GenSamplers."
> +       *
> +       * In desktop GL, an GL_INVALID_VALUE is returned instead.
> +       */
> +      _mesa_error(ctx, (_mesa_is_gles(ctx) ?
> +                        GL_INVALID_OPERATION : GL_INVALID_VALUE),
> +                  "glSamplerParameteri(sampler %u)", sampler);
>        return;
>     }
>  

Anyone to review this? It is a quite simple one.
Thanks,

Eduardo



More information about the mesa-dev mailing list