From: Marek Olšák Date: Sun, 22 Jan 2012 19:25:42 +0000 (+0100) Subject: mesa: allow exposing GL3 without EXT_texture_integer X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=3363e87d7d5b3f19294fc770dc7c506c26646010;p=mesa.git mesa: allow exposing GL3 without EXT_texture_integer Strictly speaking, it's not legal to expose EXT_texture_integer without EXT_gpu_shader4. It might be even dangerous (apps can assume EXT_gpu_shader4 is available without checking for it). The check in compute_version is removed as well, because that's already covered by GLSLVersion >= 130. Reviewed-by: Brian Paul --- diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c index eaf2c46b8dc..79a97291fbb 100644 --- a/src/mesa/main/fbobject.c +++ b/src/mesa/main/fbobject.c @@ -1225,7 +1225,8 @@ _mesa_base_fbo_format(struct gl_context *ctx, GLenum internalFormat) case GL_RGBA8I_EXT: case GL_RGBA16I_EXT: case GL_RGBA32I_EXT: - return ctx->Extensions.EXT_texture_integer ? GL_RGBA : 0; + return ctx->VersionMajor >= 3 || + ctx->Extensions.EXT_texture_integer ? GL_RGBA : 0; case GL_RGB8UI_EXT: case GL_RGB16UI_EXT: @@ -1233,7 +1234,8 @@ _mesa_base_fbo_format(struct gl_context *ctx, GLenum internalFormat) case GL_RGB8I_EXT: case GL_RGB16I_EXT: case GL_RGB32I_EXT: - return ctx->Extensions.EXT_texture_integer ? GL_RGB : 0; + return ctx->VersionMajor >= 3 || + ctx->Extensions.EXT_texture_integer ? GL_RGB : 0; case GL_R8UI: case GL_R8I: @@ -1241,8 +1243,9 @@ _mesa_base_fbo_format(struct gl_context *ctx, GLenum internalFormat) case GL_R16I: case GL_R32UI: case GL_R32I: - return ctx->Extensions.ARB_texture_rg && - ctx->Extensions.EXT_texture_integer ? GL_RED : 0; + return ctx->VersionMajor >= 3 || + (ctx->Extensions.ARB_texture_rg && + ctx->Extensions.EXT_texture_integer) ? GL_RED : 0; case GL_RG8UI: case GL_RG8I: @@ -1250,8 +1253,9 @@ _mesa_base_fbo_format(struct gl_context *ctx, GLenum internalFormat) case GL_RG16I: case GL_RG32UI: case GL_RG32I: - return ctx->Extensions.ARB_texture_rg && - ctx->Extensions.EXT_texture_integer ? GL_RG : 0; + return ctx->VersionMajor >= 3 || + (ctx->Extensions.ARB_texture_rg && + ctx->Extensions.EXT_texture_integer) ? GL_RG : 0; case GL_INTENSITY8I_EXT: case GL_INTENSITY8UI_EXT: diff --git a/src/mesa/main/image.c b/src/mesa/main/image.c index 8b65cf0f04b..3491704f8e9 100644 --- a/src/mesa/main/image.c +++ b/src/mesa/main/image.c @@ -536,7 +536,8 @@ _mesa_is_legal_format_and_type(const struct gl_context *ctx, case GL_UNSIGNED_SHORT: case GL_INT: case GL_UNSIGNED_INT: - return ctx->Extensions.EXT_texture_integer; + return ctx->VersionMajor >= 3 || + ctx->Extensions.EXT_texture_integer; default: return GL_FALSE; } @@ -549,7 +550,8 @@ _mesa_is_legal_format_and_type(const struct gl_context *ctx, case GL_UNSIGNED_SHORT: case GL_INT: case GL_UNSIGNED_INT: - return ctx->Extensions.EXT_texture_integer; + return ctx->VersionMajor >= 3 || + ctx->Extensions.EXT_texture_integer; case GL_UNSIGNED_BYTE_3_3_2: case GL_UNSIGNED_BYTE_2_3_3_REV: case GL_UNSIGNED_SHORT_5_6_5: @@ -568,7 +570,8 @@ _mesa_is_legal_format_and_type(const struct gl_context *ctx, case GL_INT: case GL_UNSIGNED_INT: /* NOTE: no packed formats w/ BGR format */ - return ctx->Extensions.EXT_texture_integer; + return ctx->VersionMajor >= 3 || + ctx->Extensions.EXT_texture_integer; default: return GL_FALSE; } @@ -582,7 +585,8 @@ _mesa_is_legal_format_and_type(const struct gl_context *ctx, case GL_UNSIGNED_SHORT: case GL_INT: case GL_UNSIGNED_INT: - return ctx->Extensions.EXT_texture_integer; + return ctx->VersionMajor >= 3 || + ctx->Extensions.EXT_texture_integer; case GL_UNSIGNED_SHORT_4_4_4_4: case GL_UNSIGNED_SHORT_4_4_4_4_REV: case GL_UNSIGNED_SHORT_5_5_5_1: diff --git a/src/mesa/main/texformat.c b/src/mesa/main/texformat.c index 259eb90444d..5fdc2ab1f79 100644 --- a/src/mesa/main/texformat.c +++ b/src/mesa/main/texformat.c @@ -706,6 +706,12 @@ _mesa_choose_tex_format( struct gl_context *ctx, GLint internalFormat, RETURN_IF_SUPPORTED(MESA_FORMAT_INTENSITY_INT32); RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_INT32); break; + } + } + + if (ctx->VersionMajor >= 3 || + ctx->Extensions.EXT_texture_integer) { + switch (internalFormat) { case GL_RGB8UI_EXT: RETURN_IF_SUPPORTED(MESA_FORMAT_RGB_UINT8); RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_UINT8); @@ -822,7 +828,9 @@ _mesa_choose_tex_format( struct gl_context *ctx, GLint internalFormat, } } - if (ctx->Extensions.ARB_texture_rg && ctx->Extensions.EXT_texture_integer) { + if (ctx->VersionMajor >= 3 || + (ctx->Extensions.ARB_texture_rg && + ctx->Extensions.EXT_texture_integer)) { switch (internalFormat) { case GL_R8UI: RETURN_IF_SUPPORTED(MESA_FORMAT_R_UINT8); diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c index c64b10b0446..d11425d5ea9 100644 --- a/src/mesa/main/teximage.c +++ b/src/mesa/main/teximage.c @@ -323,7 +323,8 @@ _mesa_base_tex_format( struct gl_context *ctx, GLint internalFormat ) } #endif /* FEATURE_EXT_texture_sRGB */ - if (ctx->Extensions.EXT_texture_integer) { + if (ctx->VersionMajor >= 3 || + ctx->Extensions.EXT_texture_integer) { switch (internalFormat) { case GL_RGBA8UI_EXT: case GL_RGBA16UI_EXT: @@ -340,6 +341,11 @@ _mesa_base_tex_format( struct gl_context *ctx, GLint internalFormat ) case GL_RGB16I_EXT: case GL_RGB32I_EXT: return GL_RGB; + } + } + + if (ctx->Extensions.EXT_texture_integer) { + switch (internalFormat) { case GL_ALPHA8UI_EXT: case GL_ALPHA16UI_EXT: case GL_ALPHA32UI_EXT: @@ -391,7 +397,7 @@ _mesa_base_tex_format( struct gl_context *ctx, GLint internalFormat ) case GL_R16UI: case GL_R32I: case GL_R32UI: - if (!ctx->Extensions.EXT_texture_integer) + if (ctx->VersionMajor < 3 && !ctx->Extensions.EXT_texture_integer) break; /* FALLTHROUGH */ case GL_R8: @@ -416,7 +422,7 @@ _mesa_base_tex_format( struct gl_context *ctx, GLint internalFormat ) case GL_RG16UI: case GL_RG32I: case GL_RG32UI: - if (!ctx->Extensions.EXT_texture_integer) + if (ctx->VersionMajor < 3 && !ctx->Extensions.EXT_texture_integer) break; /* FALLTHROUGH */ case GL_RG: @@ -1680,7 +1686,7 @@ texture_error_check( struct gl_context *ctx, } /* additional checks for integer textures */ - if (ctx->Extensions.EXT_texture_integer && + if ((ctx->VersionMajor >= 3 || ctx->Extensions.EXT_texture_integer) && (_mesa_is_integer_format(format) != _mesa_is_integer_format(internalFormat))) { if (!isProxy) { diff --git a/src/mesa/main/version.c b/src/mesa/main/version.c index 73ce61f8676..82cc54b44c4 100644 --- a/src/mesa/main/version.c +++ b/src/mesa/main/version.c @@ -139,7 +139,6 @@ compute_version(struct gl_context *ctx) ctx->Extensions.EXT_framebuffer_sRGB && ctx->Extensions.EXT_packed_float && ctx->Extensions.EXT_texture_array && - ctx->Extensions.EXT_texture_integer && ctx->Extensions.EXT_texture_shared_exponent && ctx->Extensions.EXT_transform_feedback && ctx->Extensions.NV_conditional_render);