ctx->Extensions.OES_texture_float is set regardless of the API
that's used, so checking for those direcly will always allow the
enums from this extensions when they are supported by the driver.

There's no extension enabling floating-point textures for OpenGL
ES 1.x, so we shouldn't allow those enums there.

Signed-off-by: Erik Faye-Lund <erik.faye-l...@collabora.com>
---
 src/mesa/main/glformats.c | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/src/mesa/main/glformats.c b/src/mesa/main/glformats.c
index 2ac3110187f..453465fb1c8 100644
--- a/src/mesa/main/glformats.c
+++ b/src/mesa/main/glformats.c
@@ -2895,7 +2895,7 @@ _mesa_gles_error_check_format_and_type(const struct 
gl_context *ctx,
                return GL_INVALID_OPERATION;
             break;
          case GL_RGBA:
-            if (ctx->Extensions.OES_texture_float && internalFormat == format)
+            if (_mesa_has_OES_texture_float(ctx) && internalFormat == format)
                break;
          default:
             return GL_INVALID_OPERATION;
@@ -2903,7 +2903,7 @@ _mesa_gles_error_check_format_and_type(const struct 
gl_context *ctx,
          break;
 
       case GL_HALF_FLOAT_OES:
-         if (ctx->Extensions.OES_texture_half_float && internalFormat == 
format)
+         if (_mesa_has_OES_texture_half_float(ctx) && internalFormat == format)
             break;
       default:
          return GL_INVALID_OPERATION;
@@ -3030,7 +3030,7 @@ _mesa_gles_error_check_format_and_type(const struct 
gl_context *ctx,
                return GL_INVALID_OPERATION;
             break;
          case GL_RGB:
-            if (ctx->Extensions.OES_texture_float && internalFormat == format)
+            if (_mesa_has_OES_texture_float(ctx) && internalFormat == format)
                break;
          default:
             return GL_INVALID_OPERATION;
@@ -3038,7 +3038,7 @@ _mesa_gles_error_check_format_and_type(const struct 
gl_context *ctx,
          break;
 
       case GL_HALF_FLOAT_OES:
-         if (!ctx->Extensions.OES_texture_half_float || internalFormat != 
format)
+         if (!_mesa_has_OES_texture_half_float(ctx) || internalFormat != 
format)
             return GL_INVALID_OPERATION;
          break;
 
@@ -3138,7 +3138,7 @@ _mesa_gles_error_check_format_and_type(const struct 
gl_context *ctx,
                break;
             case GL_RG:
                if (_mesa_has_rg_textures(ctx) &&
-                   ctx->Extensions.OES_texture_half_float)
+                   _mesa_has_OES_texture_half_float(ctx))
                   break;
             /* fallthrough */
             default:
@@ -3153,7 +3153,7 @@ _mesa_gles_error_check_format_and_type(const struct 
gl_context *ctx,
             break;
          case GL_RG:
             if (_mesa_has_rg_textures(ctx) &&
-                ctx->Extensions.OES_texture_float)
+                _mesa_has_OES_texture_float(ctx))
                break;
             /* fallthrough */
          default:
@@ -3242,7 +3242,7 @@ _mesa_gles_error_check_format_and_type(const struct 
gl_context *ctx,
          case GL_RG:
          case GL_RED:
             if (_mesa_has_rg_textures(ctx) &&
-                ctx->Extensions.OES_texture_half_float)
+                _mesa_has_OES_texture_half_float(ctx))
                break;
             /* fallthrough */
          default:
@@ -3257,7 +3257,7 @@ _mesa_gles_error_check_format_and_type(const struct 
gl_context *ctx,
             break;
          case GL_RED:
             if (_mesa_has_rg_textures(ctx) &&
-                ctx->Extensions.OES_texture_float)
+                _mesa_has_OES_texture_float(ctx))
                break;
             /* fallthrough */
          default:
@@ -3369,11 +3369,11 @@ _mesa_gles_error_check_format_and_type(const struct 
gl_context *ctx,
    case GL_LUMINANCE_ALPHA:
       switch (type) {
       case GL_FLOAT:
-         if (!ctx->Extensions.OES_texture_float || internalFormat != format)
+         if (!_mesa_has_OES_texture_float(ctx) || internalFormat != format)
             return GL_INVALID_OPERATION;
          break;
       case GL_HALF_FLOAT_OES:
-         if (!ctx->Extensions.OES_texture_half_float || internalFormat != 
format)
+         if (!_mesa_has_OES_texture_half_float(ctx) || internalFormat != 
format)
             return GL_INVALID_OPERATION;
          break;
       case GL_UNSIGNED_BYTE:
-- 
2.19.1

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to