On Tue, Sep 04, 2012 at 11:08:41AM -0700, Ian Romanick wrote: > On 09/04/2012 04:53 AM, Oliver McFadden wrote: > > From: Oliver McFadden <oliver.mcfad...@intel.com> > > > > http://www.khronos.org/registry/gles/extensions/ANGLE/ANGLE_texture_compression_dxt.txt > > > > Signed-off-by: Oliver McFadden <oliver.mcfad...@intel.com> > > --- > > src/glx/glxextensions.h | 1 + > > src/mapi/glapi/gen/es_EXT.xml | 6 ++++++ > > src/mesa/drivers/dri/intel/intel_extensions.c | 5 +++++ > > src/mesa/main/APIspec.xml | 3 +++ > > src/mesa/main/extensions.c | 12 ++++++++++++ > > src/mesa/main/formats.c | 2 ++ > > src/mesa/main/glformats.c | 11 +++++++++-- > > src/mesa/main/glheader.h | 10 ++++++++++ > > src/mesa/main/mfeatures.h | 1 + > > src/mesa/main/mtypes.h | 1 + > > src/mesa/main/texcompress.c | 6 ++++++ > > src/mesa/main/texcompress_s3tc.c | 4 ++-- > > src/mesa/main/texcompress_s3tc.h | 6 +++--- > > src/mesa/main/texformat.c | 22 > > +++++++++++++++------- > > src/mesa/main/teximage.c | 12 ++++++++++++ > > src/mesa/state_tracker/st_format.c | 4 ++++ > > 16 files changed, 92 insertions(+), 14 deletions(-) > > > > diff --git a/src/glx/glxextensions.h b/src/glx/glxextensions.h > > index 90c27a7..2cbd8d4 100644 > > --- a/src/glx/glxextensions.h > > +++ b/src/glx/glxextensions.h > > @@ -132,6 +132,7 @@ enum > > GL_EXT_texture_bit, > > GL_EXT_texture3D_bit, > > GL_EXT_texture_compression_dxt1_bit, > > + GL_ANGLE_texture_compression_dxt_bit, > > GL_EXT_texture_compression_s3tc_bit, > > GL_EXT_texture_edge_clamp_bit, > > GL_EXT_texture_env_combine_bit, > > diff --git a/src/mapi/glapi/gen/es_EXT.xml b/src/mapi/glapi/gen/es_EXT.xml > > index fc2ec62..2698110 100644 > > --- a/src/mapi/glapi/gen/es_EXT.xml > > +++ b/src/mapi/glapi/gen/es_EXT.xml > > @@ -731,4 +731,10 @@ > > <enum name="RG8_EXT" value="0x822B"/> > > </category> > > > > +<!-- 111. GL_ANGLE_texture_compression_dxt --> > > +<category name="ANGLE_texture_compression_dxt" number="111"> > > + <enum name="COMPRESSED_RGBA_S3TC_DXT3_ANGLE" value="0x83F2"/> > > + <enum name="COMPRESSED_RGBA_S3TC_DXT5_ANGLE" value="0x83F3"/> > > +</category> > > + > > </OpenGLAPI> > > diff --git a/src/mesa/drivers/dri/intel/intel_extensions.c > > b/src/mesa/drivers/dri/intel/intel_extensions.c > > index 885e8a4..b8cf933 100755 > > --- a/src/mesa/drivers/dri/intel/intel_extensions.c > > +++ b/src/mesa/drivers/dri/intel/intel_extensions.c > > @@ -184,6 +184,11 @@ intelInitExtensions(struct gl_context *ctx) > > } > > > > if (intel->ctx.Mesa_DXTn) { > > + /* Does not require compression, but still needs the library for > > + * decompression! */ > > + ctx->Extensions.ANGLE_texture_compression_dxt = true; > > + > > + /* Requires both compression and decompression functions. */ > > ctx->Extensions.EXT_texture_compression_s3tc = true; > > ctx->Extensions.S3_s3tc = true; > > } > > diff --git a/src/mesa/main/APIspec.xml b/src/mesa/main/APIspec.xml > > index a65c5c5..c396952 100644 > > --- a/src/mesa/main/APIspec.xml > > +++ b/src/mesa/main/APIspec.xml > > @@ -2172,6 +2172,9 @@ > > <category name="NV_draw_buffers"/> > > <category name="NV_read_buffer"/> > > > > + <!-- GL_ANGLE_texture_compression_dxt --> > > + <category name="ANGLE_texture_compression_dxt"/> > > + > > <function name="DrawBuffersNV" template="DrawBuffers"/> > > <function name="ReadBufferNV" template="ReadBuffer"/> > > > > diff --git a/src/mesa/main/extensions.c b/src/mesa/main/extensions.c > > index 7e116bd..0469beb 100644 > > --- a/src/mesa/main/extensions.c > > +++ b/src/mesa/main/extensions.c > > @@ -195,6 +195,8 @@ static const struct extension extension_table[] = { > > { "GL_EXT_texture3D", o(EXT_texture3D), > > GLL, 1996 }, > > { "GL_EXT_texture_array", o(EXT_texture_array), > > GL, 2006 }, > > { "GL_EXT_texture_compression_dxt1", > > o(EXT_texture_compression_s3tc), GL | ES1 | ES2, 2004 }, > > + { "GL_ANGLE_texture_compression_dxt3", > > o(ANGLE_texture_compression_dxt), ES2, 2011 }, > > + { "GL_ANGLE_texture_compression_dxt5", > > o(ANGLE_texture_compression_dxt), ES2, 2011 }, > > { "GL_EXT_texture_compression_latc", > > o(EXT_texture_compression_latc), GL, 2006 }, > > { "GL_EXT_texture_compression_rgtc", > > o(ARB_texture_compression_rgtc), GL, 2004 }, > > { "GL_EXT_texture_compression_s3tc", > > o(EXT_texture_compression_s3tc), GL, 2000 }, > > @@ -531,6 +533,16 @@ _mesa_enable_sw_extensions(struct gl_context *ctx) > > if (ctx->Mesa_DXTn) { > > _mesa_enable_extension(ctx, "GL_EXT_texture_compression_s3tc"); > > _mesa_enable_extension(ctx, "GL_S3_s3tc"); > > + > > + /* If we can support S3TC texture compression, then we can also > > support > > + * ANGLE texture compression. However the > > ANGLE_texture_compression_dxt > > + * spec says: > > + * > > + * The extension is written against the OpenGL ES 2.0 specification. > > + */ > > + if (ctx->API == API_OPENGLES2) { > > + ctx->Extensions.ANGLE_texture_compression_dxt = GL_TRUE; > > + } > > This is unnecessary. The extension will only be advertised in GLES2 (or > GLES3). The only other case where we have an API check like this is > where there is a behavior conflict between an extension and an API where > it could be advertised (e.g., GL_ARB_texture_buffer_objects and pre-3.1 > desktop OpenGL).
OK. Will kill it. > > > } > > #endif > > } > > diff --git a/src/mesa/main/formats.c b/src/mesa/main/formats.c > > index 1fa641c..b22672e 100644 > > --- a/src/mesa/main/formats.c > > +++ b/src/mesa/main/formats.c > > @@ -2269,9 +2269,11 @@ _mesa_format_to_type_and_comps(gl_format format, > > case MESA_FORMAT_RGB_FXT1: > > case MESA_FORMAT_RGBA_FXT1: > > #endif > > +#if FEATURE_texture_s3tc || FEATURE_ANGLE_texture_compression_dxt > > #if FEATURE_texture_s3tc > > case MESA_FORMAT_RGB_DXT1: > > case MESA_FORMAT_RGBA_DXT1: > > +#endif > > case MESA_FORMAT_RGBA_DXT3: > > case MESA_FORMAT_RGBA_DXT5: > > #if FEATURE_EXT_texture_sRGB > > diff --git a/src/mesa/main/glformats.c b/src/mesa/main/glformats.c > > index 2d06cb7..01a67d6 100644 > > --- a/src/mesa/main/glformats.c > > +++ b/src/mesa/main/glformats.c > > @@ -793,8 +793,15 @@ _mesa_is_compressed_format(struct gl_context *ctx, > > GLenum format) > > return ctx->Extensions.EXT_texture_compression_s3tc; > > case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT: > > case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT: > > - return _mesa_is_desktop_gl(ctx) > > - && ctx->Extensions.EXT_texture_compression_s3tc; > > + /* case GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE: (duplicate case value) > > */ > > + /* case GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE: (duplicate case value) > > */ > > There's no reason for this clutter. OK, I put it there for grep purposes but can remove it. > > > + return > > +#if FEATURE_ANGLE_texture_compression_dxt > > + (_mesa_is_gles2(ctx) > > OpenGL ES 3.0 is backwards compatible with ES 2.0. Once we get full 3.0 > support, the Intel driver will only have 3.0 (just like in desktop GL we > only have 3.0 instead of 2.1). That will cause this check to fail. You > really want 'ctx->API == API_OPENGLES2' here. OK. > > > + && ctx->Extensions.ANGLE_texture_compression_dxt) || > > +#endif > > + (_mesa_is_desktop_gl(ctx) > > + && ctx->Extensions.EXT_texture_compression_s3tc); > > case GL_RGB_S3TC: > > case GL_RGB4_S3TC: > > case GL_RGBA_S3TC: > > diff --git a/src/mesa/main/glheader.h b/src/mesa/main/glheader.h > > index 3152323..2c2182e 100644 > > --- a/src/mesa/main/glheader.h > > +++ b/src/mesa/main/glheader.h > > @@ -143,6 +143,16 @@ typedef void *GLeglImageOES; > > #define GL_ETC1_RGB8_OES 0x8D64 > > #endif > > > > +/* GL_ANGLE_texture_compression_dxt3 */ > > +#ifndef GL_ANGLE_texture_compression_dxt3 > > +#define GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE 0x83F2 > > +#endif > > + > > +/* GL_ANGLE_texture_compression_dxt5 */ > > +#ifndef GL_ANGLE_texture_compression_dxt5 > > +#define GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE 0x83F3 > > +#endif > > + > > > > /** > > * Internal token to represent a GLSL shader program (a collection of > > diff --git a/src/mesa/main/mfeatures.h b/src/mesa/main/mfeatures.h > > index b67f046..38325e8 100644 > > --- a/src/mesa/main/mfeatures.h > > +++ b/src/mesa/main/mfeatures.h > > @@ -105,6 +105,7 @@ > > #define FEATURE_rastpos FEATURE_GL > > #define FEATURE_texture_fxt1 FEATURE_GL > > #define FEATURE_texture_s3tc FEATURE_GL > > +#define FEATURE_ANGLE_texture_compression_dxt FEATURE_ES2 > > > > #define FEATURE_extra_context_init FEATURE_ES > > #define FEATURE_point_size_array FEATURE_ES > > diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h > > index ba43e57..1cf41da 100644 > > --- a/src/mesa/main/mtypes.h > > +++ b/src/mesa/main/mtypes.h > > @@ -3035,6 +3035,7 @@ struct gl_extensions > > GLboolean EXT_texture_array; > > GLboolean EXT_texture_compression_latc; > > GLboolean EXT_texture_compression_s3tc; > > + GLboolean ANGLE_texture_compression_dxt; > > GLboolean EXT_texture_env_dot3; > > GLboolean EXT_texture_filter_anisotropic; > > GLboolean EXT_texture_integer; > > diff --git a/src/mesa/main/texcompress.c b/src/mesa/main/texcompress.c > > index 846d4bb..3321b15 100644 > > --- a/src/mesa/main/texcompress.c > > +++ b/src/mesa/main/texcompress.c > > @@ -102,7 +102,9 @@ _mesa_gl_compressed_format_base_format(GLenum format) > > case GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_ARB: > > case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT: > > case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT: > > + /* case GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE: (duplicate case value) */ > > case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT: > > + /* case GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE: (duplicate case value) */ > > Again, there's no reason for this clutter. Yes, will remove (and for the rest of them.) > > > case GL_COMPRESSED_RGBA_FXT1_3DFX: > > case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT: > > case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT: > > @@ -318,9 +320,11 @@ _mesa_glenum_to_compressed_format(GLenum format) > > case GL_RGB4_S3TC: > > return MESA_FORMAT_RGBA_DXT1; > > case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT: > > + /* case GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE: (duplicate case value) */ > > case GL_RGBA_S3TC: > > return MESA_FORMAT_RGBA_DXT3; > > case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT: > > + /* case GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE: (duplicate case value) */ > > Ditto. > > > case GL_RGBA4_S3TC: > > return MESA_FORMAT_RGBA_DXT5; > > > > @@ -381,11 +385,13 @@ _mesa_compressed_format_to_glenum(struct gl_context > > *ctx, gl_format mesaFormat) > > case MESA_FORMAT_RGBA_FXT1: > > return GL_COMPRESSED_RGBA_FXT1_3DFX; > > #endif > > +#if FEATURE_texture_s3tc || FEATURE_ANGLE_texture_compression_dxt > > #if FEATURE_texture_s3tc > > case MESA_FORMAT_RGB_DXT1: > > return GL_COMPRESSED_RGB_S3TC_DXT1_EXT; > > case MESA_FORMAT_RGBA_DXT1: > > return GL_COMPRESSED_RGBA_S3TC_DXT1_EXT; > > +#endif > > case MESA_FORMAT_RGBA_DXT3: > > return GL_COMPRESSED_RGBA_S3TC_DXT3_EXT; > > case MESA_FORMAT_RGBA_DXT5: > > diff --git a/src/mesa/main/texcompress_s3tc.c > > b/src/mesa/main/texcompress_s3tc.c > > index 8736e20..e0c8478 100644 > > --- a/src/mesa/main/texcompress_s3tc.c > > +++ b/src/mesa/main/texcompress_s3tc.c > > @@ -47,7 +47,7 @@ > > #include "swrast/s_context.h" > > > > > > -#if FEATURE_texture_s3tc > > +#if FEATURE_texture_s3tc || FEATURE_ANGLE_texture_compression_dxt > > > > > > #if defined(_WIN32) || defined(WIN32) > > @@ -533,4 +533,4 @@ _mesa_fetch_texel_srgba_dxt5(const struct > > swrast_texture_image *texImage, > > #endif /* FEATURE_EXT_texture_sRGB */ > > > > > > -#endif /* FEATURE_texture_s3tc */ > > +#endif /* FEATURE_texture_s3tc || FEATURE_ANGLE_texture_compression_dxt */ > > diff --git a/src/mesa/main/texcompress_s3tc.h > > b/src/mesa/main/texcompress_s3tc.h > > index 2c06e50..f3c42f6 100644 > > --- a/src/mesa/main/texcompress_s3tc.h > > +++ b/src/mesa/main/texcompress_s3tc.h > > @@ -33,7 +33,7 @@ > > struct gl_context; > > struct swrast_texture_image; > > > > -#if FEATURE_texture_s3tc > > +#if FEATURE_texture_s3tc || FEATURE_ANGLE_texture_compression_dxt > > > > extern GLboolean > > _mesa_texstore_rgb_dxt1(TEXSTORE_PARAMS); > > @@ -82,7 +82,7 @@ _mesa_fetch_texel_srgba_dxt5(const struct > > swrast_texture_image *texImage, > > extern void > > _mesa_init_texture_s3tc(struct gl_context *ctx); > > > > -#else /* FEATURE_texture_s3tc */ > > +#else /* FEATURE_texture_s3tc || FEATURE_ANGLE_texture_compression_dxt */ > > > > /* these are used only in texstore_funcs[] */ > > #define _mesa_texstore_rgb_dxt1 NULL > > @@ -105,6 +105,6 @@ _mesa_init_texture_s3tc(struct gl_context *ctx) > > { > > } > > > > -#endif /* FEATURE_texture_s3tc */ > > +#endif /* FEATURE_texture_s3tc || FEATURE_ANGLE_texture_compression_dxt */ > > > > #endif /* TEXCOMPRESS_S3TC_H */ > > diff --git a/src/mesa/main/texformat.c b/src/mesa/main/texformat.c > > index 1a318ab..38584f2 100644 > > --- a/src/mesa/main/texformat.c > > +++ b/src/mesa/main/texformat.c > > @@ -304,19 +304,24 @@ _mesa_choose_tex_format(struct gl_context *ctx, > > GLenum target, > > } > > #endif > > > > -#if FEATURE_texture_s3tc > > - if (ctx->Extensions.EXT_texture_compression_s3tc) { > > +#if FEATURE_texture_s3tc || FEATURE_ANGLE_texture_compression_dxt > > + if (ctx->Extensions.EXT_texture_compression_s3tc || > > + ctx->Extensions.ANGLE_texture_compression_dxt) { > > switch (internalFormat) { > > +#if FEATURE_texture_s3tc > > case GL_COMPRESSED_RGB_S3TC_DXT1_EXT: > > RETURN_IF_SUPPORTED(MESA_FORMAT_RGB_DXT1); > > break; > > case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT: > > RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_DXT1); > > break; > > +#endif > > case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT: > > + /* case GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE: (duplicate case > > value) */ > > RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_DXT3); > > break; > > case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT: > > + /* case GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE: (duplicate case > > value) */ > > Ditto. > > > RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_DXT5); > > break; > > default: > > @@ -595,14 +600,15 @@ _mesa_choose_tex_format(struct gl_context *ctx, > > GLenum target, > > RETURN_IF_SUPPORTED(MESA_FORMAT_SARGB8); > > break; > > case GL_COMPRESSED_SRGB_ALPHA_EXT: > > -#if FEATURE_texture_s3tc > > - if (ctx->Extensions.EXT_texture_compression_s3tc) > > +#if FEATURE_texture_s3tc || FEATURE_ANGLE_texture_compression_dxt > > + if (ctx->Extensions.EXT_texture_compression_s3tc || > > + ctx->Extensions.ANGLE_texture_compression_dxt) > > RETURN_IF_SUPPORTED(MESA_FORMAT_SRGBA_DXT3); /* Not srgba_dxt1, > > see spec */ > > #endif > > RETURN_IF_SUPPORTED(MESA_FORMAT_SRGBA8); > > RETURN_IF_SUPPORTED(MESA_FORMAT_SARGB8); > > break; > > -#if FEATURE_texture_s3tc > > +#if FEATURE_texture_s3tc || FEATURE_ANGLE_texture_compression_dxt > > case GL_COMPRESSED_SRGB_S3TC_DXT1_EXT: > > if (ctx->Extensions.EXT_texture_compression_s3tc) > > RETURN_IF_SUPPORTED(MESA_FORMAT_SRGB_DXT1); > > @@ -614,12 +620,14 @@ _mesa_choose_tex_format(struct gl_context *ctx, > > GLenum target, > > RETURN_IF_SUPPORTED(MESA_FORMAT_SARGB8); > > break; > > case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT: > > - if (ctx->Extensions.EXT_texture_compression_s3tc) > > + if (ctx->Extensions.EXT_texture_compression_s3tc || > > + ctx->Extensions.ANGLE_texture_compression_dxt) > > RETURN_IF_SUPPORTED(MESA_FORMAT_SRGBA_DXT3); > > RETURN_IF_SUPPORTED(MESA_FORMAT_SARGB8); > > break; > > case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT: > > - if (ctx->Extensions.EXT_texture_compression_s3tc) > > + if (ctx->Extensions.EXT_texture_compression_s3tc || > > + ctx->Extensions.ANGLE_texture_compression_dxt) > > RETURN_IF_SUPPORTED(MESA_FORMAT_SRGBA_DXT5); > > RETURN_IF_SUPPORTED(MESA_FORMAT_SARGB8); > > break; > > diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c > > index cdb0905..9f6a08c 100644 > > --- a/src/mesa/main/teximage.c > > +++ b/src/mesa/main/teximage.c > > @@ -209,6 +209,18 @@ _mesa_base_tex_format( struct gl_context *ctx, GLint > > internalFormat ) > > } > > } > > > > +#if FEATURE_ANGLE_texture_compression_dxt > > + if (ctx->Extensions.ANGLE_texture_compression_dxt) { > > + switch (internalFormat) { > > + case GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE: > > + case GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE: > > + return GL_RGBA; > > + default: > > + ; /* fallthrough */ > > + } > > + } > > +#endif > > + > > if (ctx->Extensions.S3_s3tc) { > > switch (internalFormat) { > > case GL_RGB_S3TC: > > diff --git a/src/mesa/state_tracker/st_format.c > > b/src/mesa/state_tracker/st_format.c > > index 302b58c..3dfb98a 100644 > > --- a/src/mesa/state_tracker/st_format.c > > +++ b/src/mesa/state_tracker/st_format.c > > @@ -119,11 +119,13 @@ st_mesa_format_to_pipe_format(gl_format mesaFormat) > > return PIPE_FORMAT_Z32_FLOAT_S8X24_UINT; > > case MESA_FORMAT_YCBCR: > > return PIPE_FORMAT_UYVY; > > +#if FEATURE_texture_s3tc || FEATURE_ANGLE_texture_compression_dxt > > #if FEATURE_texture_s3tc > > case MESA_FORMAT_RGB_DXT1: > > return PIPE_FORMAT_DXT1_RGB; > > case MESA_FORMAT_RGBA_DXT1: > > return PIPE_FORMAT_DXT1_RGBA; > > +#endif > > case MESA_FORMAT_RGBA_DXT3: > > return PIPE_FORMAT_DXT3_RGBA; > > case MESA_FORMAT_RGBA_DXT5: > > @@ -449,11 +451,13 @@ st_pipe_format_to_mesa_format(enum pipe_format format) > > case PIPE_FORMAT_YUYV: > > return MESA_FORMAT_YCBCR_REV; > > > > +#if FEATURE_texture_s3tc || FEATURE_ANGLE_texture_compression_dxt > > #if FEATURE_texture_s3tc > > case PIPE_FORMAT_DXT1_RGB: > > return MESA_FORMAT_RGB_DXT1; > > case PIPE_FORMAT_DXT1_RGBA: > > return MESA_FORMAT_RGBA_DXT1; > > +#endif > > case PIPE_FORMAT_DXT3_RGBA: > > return MESA_FORMAT_RGBA_DXT3; > > case PIPE_FORMAT_DXT5_RGBA: > > > -- Oliver McFadden. _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev