On Thu,  3 Nov 2011 15:29:29 -0700, "Ian Romanick" <i...@freedesktop.org> wrote:
> From: Ian Romanick <ian.d.roman...@intel.com>
> 
> The spec says "Only ClearBufferiv should be used to clear
> stencil buffers." and "Only ClearBufferfv should be used to clear
> depth buffers."  However, on the following page it also says:
> 
>     "The result of ClearBuffer is undefined if no conversion between
>     the type of the specified value and the type of the buffer being
>     cleared is defined (for example, if ClearBufferiv is called for a
>     fixed- or floating-point buffer, or if ClearBufferfv is called
>     for a signed or unsigned integer buffer). *This is not an error.*"
> 
> Emphasis mine.
> 
> Fixes problems with piglit's clearbuffer-invalid-drawbuffer test.
> 
> Signed-off-by: Ian Romanick <ian.d.roman...@intel.com>
> ---
>  src/mesa/main/clear.c |   56 
> +++++++++++++++++++++++++++++++++++++++++++++++++
>  1 files changed, 56 insertions(+), 0 deletions(-)
> 
> diff --git a/src/mesa/main/clear.c b/src/mesa/main/clear.c
> index c35675f..c4e87e1 100644
> --- a/src/mesa/main/clear.c
> +++ b/src/mesa/main/clear.c
> @@ -373,6 +373,23 @@ _mesa_ClearBufferiv(GLenum buffer, GLint drawbuffer, 
> const GLint *value)
>           }
>        }
>        break;
> +   case GL_DEPTH:
> +      /* Page 264 (page 280 of the PDF) of the OpenGL 3.0 spec says:
> +       *
> +       *     "The result of ClearBuffer is undefined if no conversion between
> +       *     the type of the specified value and the type of the buffer being
> +       *     cleared is defined (for example, if ClearBufferiv is called for 
> a
> +       *     fixed- or floating-point buffer, or if ClearBufferfv is called
> +       *     for a signed or unsigned integer buffer). This is not an error."
> +       *
> +       * In this case we take "undefined" and "not an error" to mean 
> "ignore."
> +       */
> +      if (drawbuffer != 0) {
> +         _mesa_error(ctx, GL_INVALID_VALUE, "glClearBufferiv(drawbuffer=%d)",
> +                     drawbuffer);
> +         return;
> +      }
> +      return;

Quoting spec about not generating an error for some condition right
above code for generating an error for an unrelated condition is rather
confusing.

I think quoting the bits about the required value for drawbuffer as well
would clear that up to me.

Attachment: pgp2OUuMHtL9S.pgp
Description: PGP signature

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to