From 71cc56e1f79268a7d524a947f5cf25059af21cd9 Mon Sep 17 00:00:00 2001 From: Erik Faye-Lund Date: Thu, 6 Jun 2024 22:15:44 +0200 Subject: [PATCH] mesa/main: validate half-float types Half-float textures got a bit strange in GLES2; they were added by the OES_texture_float extension, but that added a *different* enum with a *different* value than what ended up in ARB_half_float_pixel and GLES3. So, we need to check separately for these. The former one is only supported on GLES. Reviewed-by: Adam Jackson Part-of: --- src/mesa/main/glformats.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/mesa/main/glformats.c b/src/mesa/main/glformats.c index 3148e32aca3..39d6a870504 100644 --- a/src/mesa/main/glformats.c +++ b/src/mesa/main/glformats.c @@ -1820,6 +1820,15 @@ valid_texture_type_enum(const struct gl_context *ctx, GLenum type) case GL_FLOAT: return _mesa_is_desktop_gl(ctx) || _mesa_has_OES_texture_float(ctx); + case GL_HALF_FLOAT: + return _mesa_has_ARB_half_float_pixel(ctx) || _mesa_is_gles3(ctx); + + case GL_HALF_FLOAT_OES: + /* This is a different enum than the above, that only applies to this + * extension + */ + return _mesa_has_OES_texture_half_float(ctx); + case GL_BITMAP: return _mesa_is_desktop_gl_compat(ctx);