mesa: Only expose GLES's EXT_texture_type_2_10_10_10_REV if supported in HW.
authorEric Anholt <eric@anholt.net>
Mon, 1 May 2017 16:51:01 +0000 (09:51 -0700)
committerEric Anholt <eric@anholt.net>
Tue, 10 Oct 2017 16:31:29 +0000 (09:31 -0700)
Previously, we were downconverting to 8888 automatically if the hardware
didn't suport it.  However, with the advent of
GL_OES_required_internalformat, we have to actually store the
internalformats we advertise support for.  And, it seems rather
disingenuous to advertise the extension if we don't actually support it.

v2: Throw an error when using the format on ES2 without the extension present.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
src/mesa/drivers/dri/i965/intel_extensions.c
src/mesa/main/extensions_table.h
src/mesa/main/glformats.c
src/mesa/main/mtypes.h
src/mesa/state_tracker/st_extensions.c

index 9487b4ae70f8b135a277eda0c4d4f8318a7e1fe4..519d0a56cbf4d909044116e1159460613d82effe 100644 (file)
@@ -113,6 +113,7 @@ intelInitExtensions(struct gl_context *ctx)
    ctx->Extensions.EXT_texture_sRGB = true;
    ctx->Extensions.EXT_texture_sRGB_decode = true;
    ctx->Extensions.EXT_texture_swizzle = true;
+   ctx->Extensions.EXT_texture_type_2_10_10_10_REV = true;
    ctx->Extensions.EXT_vertex_array_bgra = true;
    ctx->Extensions.KHR_robustness = true;
    ctx->Extensions.AMD_seamless_cubemap_per_texture = true;
index 9475c1b69d9464339525ba0ce4e5f727db780171..7254cac89c67419636d9a9f5b6ace097336a5b77 100644 (file)
@@ -284,7 +284,7 @@ EXT(EXT_texture_sRGB_decode                 , EXT_texture_sRGB_decode
 EXT(EXT_texture_shared_exponent             , EXT_texture_shared_exponent            , GLL, GLC,  x ,  x , 2004)
 EXT(EXT_texture_snorm                       , EXT_texture_snorm                      , GLL, GLC,  x ,  x , 2009)
 EXT(EXT_texture_swizzle                     , EXT_texture_swizzle                    , GLL, GLC,  x ,  x , 2008)
-EXT(EXT_texture_type_2_10_10_10_REV         , dummy_true                             ,  x ,  x ,  x , ES2, 2008)
+EXT(EXT_texture_type_2_10_10_10_REV         , EXT_texture_type_2_10_10_10_REV        ,  x ,  x ,  x , ES2, 2008)
 EXT(EXT_timer_query                         , EXT_timer_query                        , GLL, GLC,  x ,  x , 2006)
 EXT(EXT_transform_feedback                  , EXT_transform_feedback                 , GLL, GLC,  x ,  x , 2011)
 EXT(EXT_unpack_subimage                     , dummy_true                             ,  x ,  x ,  x , ES2, 2011)
index 4f240206ff45d221e94ca867976f8b669c23c1a9..aec41f079935c10cd6a3d6022490c8b77165d5f8 100644 (file)
@@ -2234,7 +2234,8 @@ _mesa_es_error_check_format_and_type(const struct gl_context *ctx,
                     || type == GL_UNSIGNED_SHORT_5_5_5_1
                     || type == GL_FLOAT
                     || type == GL_HALF_FLOAT_OES
-                    || type == GL_UNSIGNED_INT_2_10_10_10_REV);
+                    || (ctx->Extensions.EXT_texture_type_2_10_10_10_REV &&
+                        type == GL_UNSIGNED_INT_2_10_10_10_REV));
       break;
 
    case GL_DEPTH_COMPONENT:
index abda1a36e4605a36d8ba05fcd999410303788398..455e7514ab97dc841fae436d16cf64a244d51242 100644 (file)
@@ -4151,6 +4151,7 @@ struct gl_extensions
    GLboolean EXT_texture_sRGB;
    GLboolean EXT_texture_sRGB_decode;
    GLboolean EXT_texture_swizzle;
+   GLboolean EXT_texture_type_2_10_10_10_REV;
    GLboolean EXT_transform_feedback;
    GLboolean EXT_timer_query;
    GLboolean EXT_vertex_array_bgra;
index c3c7d6f9f8b666a77b4ec7e59500b8ef18bb8a57..1fbae9234e5e1bf494a080cb5a42246bfd2ffaf8 100644 (file)
@@ -774,6 +774,11 @@ void st_init_extensions(struct pipe_screen *screen,
           PIPE_FORMAT_B8G8R8A8_SRGB },
         GL_TRUE }, /* at least one format must be supported */
 
+      { { o(EXT_texture_type_2_10_10_10_REV) },
+        { PIPE_FORMAT_R10G10B10A2_UNORM,
+          PIPE_FORMAT_B10G10R10A2_UNORM },
+         GL_TRUE }, /* at least one format must be supported */
+
       { { o(ATI_texture_compression_3dc) },
         { PIPE_FORMAT_LATC2_UNORM } },