[Mesa-dev] [PATCH] mesa: Assert base format before truncating to unsigned short

Brian Paul brianp at vmware.com
Mon Apr 9 14:31:33 UTC 2018


On 04/06/2018 08:26 AM, Topi Pohjolainen wrote:
> CID: 1433709
> Fixes: ca721b3d8: mesa: use GLenum16 in a few more places
> CC: Marek Olšák <marek.olsak at amd.com>
> CC: Brian Paul <brianp at vmware.com>
> 
> Signed-off-by: Topi Pohjolainen <topi.pohjolainen at intel.com>
> ---
>   src/mesa/main/teximage.c | 5 +++--
>   1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c
> index 8f53510..f560512 100644
> --- a/src/mesa/main/teximage.c
> +++ b/src/mesa/main/teximage.c
> @@ -845,6 +845,7 @@ _mesa_init_teximage_fields_ms(struct gl_context *ctx,
>                           mesa_format format,
>                           GLuint numSamples, GLboolean fixedSampleLocations)
>   {
> +   const GLint base_format =_mesa_base_tex_format(ctx, internalFormat);

space after =

>      GLenum target;
>      assert(img);
>      assert(width >= 0);
> @@ -852,8 +853,8 @@ _mesa_init_teximage_fields_ms(struct gl_context *ctx,
>      assert(depth >= 0);
>   
>      target = img->TexObject->Target;
> -   img->_BaseFormat = _mesa_base_tex_format( ctx, internalFormat );
> -   assert(img->_BaseFormat != -1);
> +   assert(base_format != -1);
> +   img->_BaseFormat = (GLenum16)base_format;
>      img->InternalFormat = internalFormat;
>      img->Border = border;
>      img->Width = width;
> 

Reviewed-by: Brian Paul <brianp at vmware.com>

It would probably be nicer if _mesa_base_tex_format() returned GL_NONE 
for error, instead of -1.  But this is OK for now.

-Brian


More information about the mesa-dev mailing list