mesa/main: do not allow EXT_texture_sRGB_R8 enums before gles3
authorErik Faye-Lund <erik.faye-lund@collabora.com>
Fri, 16 Nov 2018 10:30:34 +0000 (11:30 +0100)
committerErik Faye-Lund <erik.faye-lund@collabora.com>
Mon, 3 Dec 2018 17:16:44 +0000 (18:16 +0100)
ctx->Extensions.EXT_texture_sRGB_R8 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 adding support for this on OpenGL ES before
version 3.0, so let's tighten the check.

Signed-off-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Reviewed-By: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
src/mesa/main/glformats.c

index b8fe32ca52abac98b99e82d0f84c90f1c7ba2a22..4753465e50ceba16237d49a00bef813dce54dfac 100644 (file)
@@ -2473,7 +2473,7 @@ _mesa_base_tex_format(const struct gl_context *ctx, GLint internalFormat)
       }
    }
 
-   if (ctx->Extensions.EXT_texture_sRGB_R8) {
+   if (_mesa_has_EXT_texture_sRGB_R8(ctx)) {
       switch (internalFormat) {
       case GL_SR8_EXT:
          return GL_RED;
@@ -3212,7 +3212,7 @@ _mesa_gles_error_check_format_and_type(const struct gl_context *ctx,
       case GL_UNSIGNED_BYTE:
          if (internalFormat == GL_R8 ||
              ((internalFormat == GL_SR8_EXT) &&
-              ctx->Extensions.EXT_texture_sRGB_R8))
+              _mesa_has_EXT_texture_sRGB_R8(ctx)))
             break;
          return GL_INVALID_OPERATION;