On 02/27/2018 06:07 PM, Ian Romanick wrote:
From: Ian Romanick <[email protected]>
_BaseFormat is GLenum16, but it is compared with an integer -1. Even if
_mesa_base_tex_format returned -1, it becomes 0xffff, and the
comparison, after type promotion, will always fail. Fix this by
explicitly casting both to GLenum16. This should be more future proof
that casting just the -1.
"than"
Series is, Reviewed-by: Brian Paul <[email protected]>
How about we change _mesa_base_tex_format() to return GL_INVALID_ENUM
instead of -1? Or, even 0 like _mesa_base_fbo_format()?
-Brian
CID: 1429517
Fixes: ca721b3 ("mesa: use GLenum16 in a few more places")
Signed-off-by: Ian Romanick <[email protected]>
---
src/mesa/main/teximage.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c
index 35ed875..1d7bff5 100644
--- a/src/mesa/main/teximage.c
+++ b/src/mesa/main/teximage.c
@@ -853,7 +853,7 @@ init_teximage_fields_ms(struct gl_context *ctx,
target = img->TexObject->Target;
img->_BaseFormat = _mesa_base_tex_format( ctx, internalFormat );
- assert(img->_BaseFormat != -1);
+ assert((GLenum16) img->_BaseFormat != (GLenum16) -1);
img->InternalFormat = internalFormat;
img->Border = border;
img->Width = width;
_______________________________________________
mesa-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/mesa-dev