[Mesa-dev] [PATCH] mesa: INVALID_VALUE for wrong type or format in Clear*Buffer*Data

Tapani Pälli tapani.palli at intel.com
Thu Feb 14 12:31:40 UTC 2019


LGTM

Reviewed-by: Tapani Pälli <tapani.palli at intel.com>

On 2/12/19 2:17 PM, Andres Gomez wrote:
> Instead of generating a GL_INVALID_ENUM error when the type or format
> is incorrect while using glClear{Named}Buffer{Sub}Data, generate
> GL_INVALID_VALUE.
> 
>  From page 72 (page 94 of the PDF) of the OpenGL 4.6 spec:

Not sure what is the PDF referred there but in the PDF I have 
(glspec46.core.pdf) these error values are specified on page 72.

>    " An INVALID_VALUE error is generated if type is not one of the
>      types in table 8.2.
> 
>      An INVALID_VALUE error is generated if format is not one of the
>      formats in table 8.3."
> 
> Fixes the following test:
> KHR-GL45.direct_state_access.buffers_errors
> 
> Cc: Pi Tabred <servuswiegehtz at yahoo.de>
> Cc: Brian Paul <brianp at vmware.com>
> Signed-off-by: Andres Gomez <agomez at igalia.com>
> ---
>   src/mesa/main/bufferobj.c | 8 ++++----
>   1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c
> index 534326858bb..25b47ddab66 100644
> --- a/src/mesa/main/bufferobj.c
> +++ b/src/mesa/main/bufferobj.c
> @@ -346,7 +346,7 @@ buffer_object_subdata_range_good(struct gl_context *ctx,
>   
>   /**
>    * Test the format and type parameters and set the GL error code for
> - * \c glClearBufferData and \c glClearBufferSubData.
> + * \c glClear{Named}Buffer{Sub}Data.
>    *
>    * \param ctx             GL context.
>    * \param internalformat  Format to which the data is to be converted.
> @@ -356,7 +356,7 @@ buffer_object_subdata_range_good(struct gl_context *ctx,
>    * \return   If internalformat, format and type are legal the mesa_format
>    *           corresponding to internalformat, otherwise MESA_FORMAT_NONE.
>    *
> - * \sa glClearBufferData and glClearBufferSubData
> + * \sa glClear{Named}Buffer{Sub}Data
>    */
>   static mesa_format
>   validate_clear_buffer_format(struct gl_context *ctx,
> @@ -386,14 +386,14 @@ validate_clear_buffer_format(struct gl_context *ctx,
>      }
>   
>      if (!_mesa_is_color_format(format)) {
> -      _mesa_error(ctx, GL_INVALID_ENUM,
> +      _mesa_error(ctx, GL_INVALID_VALUE,
>                     "%s(format is not a color format)", caller);
>         return MESA_FORMAT_NONE;
>      }
>   
>      errorFormatType = _mesa_error_check_format_and_type(ctx, format, type);
>      if (errorFormatType != GL_NO_ERROR) {
> -      _mesa_error(ctx, GL_INVALID_ENUM,
> +      _mesa_error(ctx, GL_INVALID_VALUE,
>                     "%s(invalid format or type)", caller);
>         return MESA_FORMAT_NONE;
>      }
> 


More information about the mesa-dev mailing list