mesa: Assert base format before truncating to unsigned short
authorTopi Pohjolainen <topi.pohjolainen@intel.com>
Fri, 6 Apr 2018 07:41:26 +0000 (10:41 +0300)
committerTopi Pohjolainen <topi.pohjolainen@intel.com>
Tue, 10 Apr 2018 22:49:56 +0000 (01:49 +0300)
CID: 1433709
Fixes: ca721b3d8: mesa: use GLenum16 in a few more places
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Signed-off-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
src/mesa/main/teximage.c

index 8f5351085c55cb04aa7e1a756b6494b2c4c1dafe..f560512fb4898dad923928f605ab580124b3934a 100644 (file)
@@ -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);
    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;