[Mesa-dev] [PATCH 03/11] mesa: Return INVALID_ENUM in glClearBufferiv() when buffer is not color or stencil

Ian Romanick idr at freedesktop.org
Tue Feb 10 09:16:55 PST 2015


On 02/10/2015 07:40 AM, Eduardo Lima Mitev wrote:
> Section 4.2.3 Clearing the Buffers, page 190 of the OpenGL ES 3.0.4 spec says:
> "ClearBufferiv generates an INVALID_ENUM error if buffer is not COLOR or STENCIL."
> 
> Fixes 1 dEQP test:
> * dEQP-GLES3.functional.negative_api.buffer.clear_bufferiv
> ---
>  src/mesa/main/clear.c | 13 +++++++++++++
>  1 file changed, 13 insertions(+)
> 
> diff --git a/src/mesa/main/clear.c b/src/mesa/main/clear.c
> index 3c4ced8..46de80b 100644
> --- a/src/mesa/main/clear.c
> +++ b/src/mesa/main/clear.c
> @@ -323,6 +323,19 @@ _mesa_ClearBufferiv(GLenum buffer, GLint drawbuffer, const GLint *value)
>        _mesa_update_state( ctx );
>     }
>  
> +   /* Section 4.2.3 Clearing the Buffers, page 190 of the OpenGL ES 3.0.4
> +    * spec says:

Desktop OpenGL 4.5 (and possibly earlier) has the same error.  See the
bottom of page 488 (page 520 of the PDF).  I believe this is a
clarification of previous specs, so we should always generate the error.

With that changed, this patch is

Reviewed-by: Ian Romanick <ian.d.romanick at intel.com>

> +    *
> +    *    "ClearBufferiv generates an INVALID_ENUM error if buffer is not COLOR or
> +    *     STENCIL."
> +    */
> +   if (_mesa_is_gles3(ctx) &&
> +       (buffer == GL_DEPTH || buffer == GL_DEPTH_STENCIL)) {
> +      _mesa_error(ctx, GL_INVALID_ENUM,
> +                  "glClearBufferiv(buffer=GL_DEPTH || GL_DEPTH_STENCIL)");
> +      return;
> +   }
> +
>     switch (buffer) {
>     case GL_STENCIL:
>        /* Page 264 (page 280 of the PDF) of the OpenGL 3.0 spec says:
> 



More information about the mesa-dev mailing list