<p dir="ltr">I don't know if you got everything but I didn't notice anything missing and what's there looks correct to me.</p>
<p dir="ltr">Reviewed-by: Jason Ekstrand <<a href="mailto:jason.ekstrand@intel.com">jason.ekstrand@intel.com</a>></p>
<div class="gmail_quote">On Mar 1, 2015 7:08 PM, "Ilia Mirkin" <<a href="mailto:imirkin@alum.mit.edu">imirkin@alum.mit.edu</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Signed-off-by: Ilia Mirkin <<a href="mailto:imirkin@alum.mit.edu">imirkin@alum.mit.edu</a>><br>
---<br>
src/mapi/glapi/gen/es_EXT.xml | 6 ++++++<br>
src/mesa/main/extensions.c | 1 +<br>
src/mesa/main/format_info.py | 2 ++<br>
src/mesa/main/formats.c | 11 +++++++++++<br>
src/mesa/main/formats.csv | 5 +++++<br>
src/mesa/main/formats.h | 5 +++++<br>
src/mesa/main/glformats.c | 8 ++++++++<br>
src/mesa/main/glformats.h | 5 +++++<br>
src/mesa/main/mtypes.h | 1 +<br>
src/mesa/main/texcompress.c | 39 ++++++++++++++++++++++++++++++++++++++-<br>
src/mesa/main/teximage.c | 15 +++++++++++++++<br>
src/mesa/swrast/s_texfetch.c | 6 +++++-<br>
12 files changed, 102 insertions(+), 2 deletions(-)<br>
<br>
diff --git a/src/mapi/glapi/gen/es_EXT.xml b/src/mapi/glapi/gen/es_EXT.xml<br>
index 3a2adeb..e691ae1 100644<br>
--- a/src/mapi/glapi/gen/es_EXT.xml<br>
+++ b/src/mapi/glapi/gen/es_EXT.xml<br>
@@ -602,6 +602,12 @@<br>
<enum name="HALF_FLOAT_OES" value="0x8D61"/><br>
</category><br>
<br>
+<category name="GL_AMD_compressed_ATC_texture" number="40"><br>
+ <enum name="ATC_RGB_AMD" value="0x8C92"/><br>
+ <enum name="ATC_RGBA_EXPLICIT_ALPHA_AMD" value="0x8C93"/><br>
+ <enum name="ATC_RGBA_INTERPOLATED_ALPHA_AMD" value="0x87EE"/><br>
+</category><br>
+<br>
<!-- 41. GL_EXT_texture_filter_anisotropic --><br>
<br>
<category name="GL_EXT_texture_type_2_10_10_10_REV" number="42"><br>
diff --git a/src/mesa/main/extensions.c b/src/mesa/main/extensions.c<br>
index f212015..913de1a 100644<br>
--- a/src/mesa/main/extensions.c<br>
+++ b/src/mesa/main/extensions.c<br>
@@ -335,6 +335,7 @@ static const struct extension extension_table[] = {<br>
<br>
/* Vendor extensions */<br>
{ "GL_3DFX_texture_compression_FXT1", o(TDFX_texture_compression_FXT1), GL, 1999 },<br>
+ { "GL_AMD_compressed_ATC_texture", o(AMD_compressed_ATC_texture), ES1 | ES2, 2007 },<br>
{ "GL_AMD_conservative_depth", o(ARB_conservative_depth), GL, 2009 },<br>
{ "GL_AMD_draw_buffers_blend", o(ARB_draw_buffers_blend), GL, 2009 },<br>
{ "GL_AMD_performance_monitor", o(AMD_performance_monitor), GL, 2007 },<br>
diff --git a/src/mesa/main/format_info.py b/src/mesa/main/format_info.py<br>
index 3bae57e..0c6fccf 100644<br>
--- a/src/mesa/main/format_info.py<br>
+++ b/src/mesa/main/format_info.py<br>
@@ -130,6 +130,8 @@ def get_channel_bits(fmat, chan_name):<br>
elif fmat.layout == 'bptc':<br>
bits = 16 if fmat.name.endswith('_FLOAT') else 8<br>
return bits if fmat.has_channel(chan_name) else 0<br>
+ elif fmat.layout == 'atc':<br>
+ return 8 if fmat.has_channel(chan_name) else 0<br>
else:<br>
assert False<br>
else:<br>
diff --git a/src/mesa/main/formats.c b/src/mesa/main/formats.c<br>
index df852f3..cf363b3 100644<br>
--- a/src/mesa/main/formats.c<br>
+++ b/src/mesa/main/formats.c<br>
@@ -712,11 +712,14 @@ _mesa_get_uncompressed_format(mesa_format format)<br>
case MESA_FORMAT_ETC1_RGB8:<br>
case MESA_FORMAT_ETC2_RGB8:<br>
case MESA_FORMAT_ETC2_SRGB8:<br>
+ case MESA_FORMAT_ATC_RGB:<br>
return MESA_FORMAT_BGR_UNORM8;<br>
case MESA_FORMAT_ETC2_RGBA8_EAC:<br>
case MESA_FORMAT_ETC2_SRGB8_ALPHA8_EAC:<br>
case MESA_FORMAT_ETC2_RGB8_PUNCHTHROUGH_ALPHA1:<br>
case MESA_FORMAT_ETC2_SRGB8_PUNCHTHROUGH_ALPHA1:<br>
+ case MESA_FORMAT_ATC_RGBA_EXPLICIT:<br>
+ case MESA_FORMAT_ATC_RGBA_INTERPOLATED:<br>
return MESA_FORMAT_A8B8G8R8_UNORM;<br>
case MESA_FORMAT_ETC2_R11_EAC:<br>
case MESA_FORMAT_ETC2_SIGNED_R11_EAC:<br>
@@ -1242,6 +1245,9 @@ _mesa_format_to_type_and_comps(mesa_format format,<br>
case MESA_FORMAT_BPTC_SRGB_ALPHA_UNORM:<br>
case MESA_FORMAT_BPTC_RGB_SIGNED_FLOAT:<br>
case MESA_FORMAT_BPTC_RGB_UNSIGNED_FLOAT:<br>
+ case MESA_FORMAT_ATC_RGB:<br>
+ case MESA_FORMAT_ATC_RGBA_EXPLICIT:<br>
+ case MESA_FORMAT_ATC_RGBA_INTERPOLATED:<br>
/* XXX generate error instead? */<br>
*datatype = GL_UNSIGNED_BYTE;<br>
*comps = 0;<br>
@@ -2079,6 +2085,11 @@ _mesa_format_matches_format_and_type(mesa_format mesa_format,<br>
case MESA_FORMAT_ETC2_SRGB8_PUNCHTHROUGH_ALPHA1:<br>
return GL_FALSE;<br>
<br>
+ case MESA_FORMAT_ATC_RGB:<br>
+ case MESA_FORMAT_ATC_RGBA_EXPLICIT:<br>
+ case MESA_FORMAT_ATC_RGBA_INTERPOLATED:<br>
+ return GL_FALSE;<br>
+<br>
case MESA_FORMAT_A_SNORM8:<br>
return format == GL_ALPHA && type == GL_BYTE;<br>
case MESA_FORMAT_L_SNORM8:<br>
diff --git a/src/mesa/main/formats.csv b/src/mesa/main/formats.csv<br>
index e159e7d..1d669af 100644<br>
--- a/src/mesa/main/formats.csv<br>
+++ b/src/mesa/main/formats.csv<br>
@@ -301,3 +301,8 @@ MESA_FORMAT_BPTC_RGBA_UNORM , bptc , 4, 4, x128, , ,<br>
MESA_FORMAT_BPTC_SRGB_ALPHA_UNORM , bptc , 4, 4, x128, , , , xyzw, srgb<br>
MESA_FORMAT_BPTC_RGB_SIGNED_FLOAT , bptc , 4, 4, x128, , , , xyz1, rgb<br>
MESA_FORMAT_BPTC_RGB_UNSIGNED_FLOAT , bptc , 4, 4, x128, , , , xyz1, rgb<br>
+<br>
+# ATC compressed formats<br>
+MESA_FORMAT_ATC_RGB , atc , 4, 4, x64 , , , , xyz1, rgb<br>
+MESA_FORMAT_ATC_RGBA_EXPLICIT , atc , 4, 4, x128, , , , xyzw, rgb<br>
+MESA_FORMAT_ATC_RGBA_INTERPOLATED , atc , 4, 4, x128, , , , xyzw, rgb<br>
diff --git a/src/mesa/main/formats.h b/src/mesa/main/formats.h<br>
index 7e451ca..4909cad 100644<br>
--- a/src/mesa/main/formats.h<br>
+++ b/src/mesa/main/formats.h<br>
@@ -575,6 +575,11 @@ typedef enum<br>
MESA_FORMAT_BPTC_RGB_SIGNED_FLOAT,<br>
MESA_FORMAT_BPTC_RGB_UNSIGNED_FLOAT,<br>
<br>
+ /* ATC compressed formats */<br>
+ MESA_FORMAT_ATC_RGB,<br>
+ MESA_FORMAT_ATC_RGBA_EXPLICIT,<br>
+ MESA_FORMAT_ATC_RGBA_INTERPOLATED,<br>
+<br>
MESA_FORMAT_COUNT<br>
} mesa_format;<br>
<br>
diff --git a/src/mesa/main/glformats.c b/src/mesa/main/glformats.c<br>
index 4e05229..e30c427 100644<br>
--- a/src/mesa/main/glformats.c<br>
+++ b/src/mesa/main/glformats.c<br>
@@ -1003,6 +1003,9 @@ _mesa_is_color_format(GLenum format)<br>
case GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM:<br>
case GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT:<br>
case GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT:<br>
+ case GL_ATC_RGB_AMD:<br>
+ case GL_ATC_RGBA_EXPLICIT_ALPHA_AMD:<br>
+ case GL_ATC_RGBA_INTERPOLATED_ALPHA_AMD:<br>
/* generic integer formats */<br>
case GL_RED_INTEGER_EXT:<br>
case GL_GREEN_INTEGER_EXT:<br>
@@ -1262,6 +1265,11 @@ _mesa_is_compressed_format(struct gl_context *ctx, GLenum format)<br>
case GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT:<br>
return _mesa_is_desktop_gl(ctx) &&<br>
ctx->Extensions.ARB_texture_compression_bptc;<br>
+ case GL_ATC_RGB_AMD:<br>
+ case GL_ATC_RGBA_EXPLICIT_ALPHA_AMD:<br>
+ case GL_ATC_RGBA_INTERPOLATED_ALPHA_AMD:<br>
+ return _mesa_is_gles(ctx)<br>
+ && ctx->Extensions.AMD_compressed_ATC_texture;<br>
case GL_PALETTE4_RGB8_OES:<br>
case GL_PALETTE4_RGBA8_OES:<br>
case GL_PALETTE4_R5_G6_B5_OES:<br>
diff --git a/src/mesa/main/glformats.h b/src/mesa/main/glformats.h<br>
index e1ecd64..295fb83 100644<br>
--- a/src/mesa/main/glformats.h<br>
+++ b/src/mesa/main/glformats.h<br>
@@ -30,11 +30,16 @@<br>
<br>
#include <GL/gl.h><br>
<br>
+#define GL_ATC_RGB_AMD 0x8C92<br>
+#define GL_ATC_RGBA_EXPLICIT_ALPHA_AMD 0x8C93<br>
+#define GL_ATC_RGBA_INTERPOLATED_ALPHA_AMD 0x87EE<br>
<br>
#ifdef __cplusplus<br>
extern "C" {<br>
#endif<br>
<br>
+struct gl_context;<br>
+<br>
extern void<br>
_mesa_compute_component_mapping(GLenum inFormat, GLenum outFormat, GLubyte *map);<br>
<br>
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h<br>
index 6e99773..24d98ef 100644<br>
--- a/src/mesa/main/mtypes.h<br>
+++ b/src/mesa/main/mtypes.h<br>
@@ -3855,6 +3855,7 @@ struct gl_extensions<br>
GLboolean EXT_vertex_array_bgra;<br>
GLboolean OES_standard_derivatives;<br>
/* vendor extensions */<br>
+ GLboolean AMD_compressed_ATC_texture;<br>
GLboolean AMD_performance_monitor;<br>
GLboolean AMD_pinned_memory;<br>
GLboolean AMD_seamless_cubemap_per_texture;<br>
diff --git a/src/mesa/main/texcompress.c b/src/mesa/main/texcompress.c<br>
index 00234d4..1c1a4f5 100644<br>
--- a/src/mesa/main/texcompress.c<br>
+++ b/src/mesa/main/texcompress.c<br>
@@ -30,6 +30,7 @@<br>
*/<br>
<br>
<br>
+#include "glformats.h"<br>
#include "glheader.h"<br>
#include "imports.h"<br>
#include "colormac.h"<br>
@@ -44,7 +45,6 @@<br>
#include "texcompress_etc.h"<br>
#include "texcompress_bptc.h"<br>
<br>
-<br>
/**<br>
* Get the GL base format of a specified GL compressed texture format<br>
*<br>
@@ -101,6 +101,7 @@ _mesa_gl_compressed_format_base_format(GLenum format)<br>
case GL_ETC1_RGB8_OES:<br>
case GL_COMPRESSED_RGB8_ETC2:<br>
case GL_COMPRESSED_SRGB8_ETC2:<br>
+ case GL_ATC_RGB_AMD:<br>
return GL_RGB;<br>
<br>
case GL_COMPRESSED_RGBA:<br>
@@ -118,6 +119,8 @@ _mesa_gl_compressed_format_base_format(GLenum format)<br>
case GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:<br>
case GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2:<br>
case GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2:<br>
+ case GL_ATC_RGBA_EXPLICIT_ALPHA_AMD:<br>
+ case GL_ATC_RGBA_INTERPOLATED_ALPHA_AMD:<br>
return GL_RGBA;<br>
<br>
case GL_COMPRESSED_ALPHA:<br>
@@ -326,6 +329,26 @@ _mesa_get_compressed_formats(struct gl_context *ctx, GLint *formats)<br>
}<br>
}<br>
<br>
+ /* The GL_AMD_compressed_ATC_texture spec says:<br>
+ *<br>
+ * "New State<br>
+ *<br>
+ * The queries for NUM_COMPRESSED_TEXTURE_FORMATS and<br>
+ * COMPRESSED_TEXTURE_FORMATS include ATC_RGB_AMD,<br>
+ * ATC_RGBA_EXPLICIT_ALPHA_AMD, and ATC_RGBA_INTERPOLATED_ALPHA_AMD."<br>
+ */<br>
+ if (_mesa_is_gles(ctx)<br>
+ && ctx->Extensions.AMD_compressed_ATC_texture) {<br>
+ if (formats) {<br>
+ formats[n++] = GL_ATC_RGB_AMD;<br>
+ formats[n++] = GL_ATC_RGBA_EXPLICIT_ALPHA_AMD;<br>
+ formats[n++] = GL_ATC_RGBA_INTERPOLATED_ALPHA_AMD;<br>
+ }<br>
+ else {<br>
+ n += 3;<br>
+ }<br>
+ }<br>
+<br>
if (ctx->API == API_OPENGLES) {<br>
if (formats) {<br>
formats[n++] = GL_PALETTE4_RGB8_OES;<br>
@@ -450,6 +473,13 @@ _mesa_glenum_to_compressed_format(GLenum format)<br>
case GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT:<br>
return MESA_FORMAT_BPTC_RGB_UNSIGNED_FLOAT;<br>
<br>
+ case GL_ATC_RGB_AMD:<br>
+ return MESA_FORMAT_ATC_RGB;<br>
+ case GL_ATC_RGBA_EXPLICIT_ALPHA_AMD:<br>
+ return MESA_FORMAT_ATC_RGBA_EXPLICIT;<br>
+ case GL_ATC_RGBA_INTERPOLATED_ALPHA_AMD:<br>
+ return MESA_FORMAT_ATC_RGBA_INTERPOLATED;<br>
+<br>
default:<br>
return MESA_FORMAT_NONE;<br>
}<br>
@@ -540,6 +570,13 @@ _mesa_compressed_format_to_glenum(struct gl_context *ctx, mesa_format mesaFormat<br>
case MESA_FORMAT_BPTC_RGB_UNSIGNED_FLOAT:<br>
return GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT;<br>
<br>
+ case MESA_FORMAT_ATC_RGB:<br>
+ return GL_ATC_RGB_AMD;<br>
+ case MESA_FORMAT_ATC_RGBA_EXPLICIT:<br>
+ return GL_ATC_RGBA_EXPLICIT_ALPHA_AMD;<br>
+ case MESA_FORMAT_ATC_RGBA_INTERPOLATED:<br>
+ return GL_ATC_RGBA_INTERPOLATED_ALPHA_AMD;<br>
+<br>
default:<br>
_mesa_problem(ctx, "Unexpected mesa texture format in"<br>
" _mesa_compressed_format_to_glenum()");<br>
diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c<br>
index 6e45cc9..16f09ec 100644<br>
--- a/src/mesa/main/teximage.c<br>
+++ b/src/mesa/main/teximage.c<br>
@@ -561,6 +561,18 @@ _mesa_base_tex_format( struct gl_context *ctx, GLint internalFormat )<br>
}<br>
}<br>
<br>
+ if (_mesa_is_gles(ctx) && ctx->Extensions.AMD_compressed_ATC_texture) {<br>
+ switch (internalFormat) {<br>
+ case GL_ATC_RGB_AMD:<br>
+ return GL_RGB;<br>
+ case GL_ATC_RGBA_EXPLICIT_ALPHA_AMD:<br>
+ case GL_ATC_RGBA_INTERPOLATED_ALPHA_AMD:<br>
+ return GL_RGBA;<br>
+ default:<br>
+ ; /* fallthrough */<br>
+ }<br>
+ }<br>
+<br>
if (_mesa_is_gles3(ctx) || ctx->Extensions.ARB_ES3_compatibility) {<br>
switch (internalFormat) {<br>
case GL_COMPRESSED_RGB8_ETC2:<br>
@@ -1778,6 +1790,9 @@ compressedteximage_only_format(const struct gl_context *ctx, GLenum format)<br>
case GL_PALETTE8_R5_G6_B5_OES:<br>
case GL_PALETTE8_RGBA4_OES:<br>
case GL_PALETTE8_RGB5_A1_OES:<br>
+ case GL_ATC_RGB_AMD:<br>
+ case GL_ATC_RGBA_EXPLICIT_ALPHA_AMD:<br>
+ case GL_ATC_RGBA_INTERPOLATED_ALPHA_AMD:<br>
return GL_TRUE;<br>
default:<br>
return GL_FALSE;<br>
diff --git a/src/mesa/swrast/s_texfetch.c b/src/mesa/swrast/s_texfetch.c<br>
index 242f8a4..01a8de9 100644<br>
--- a/src/mesa/swrast/s_texfetch.c<br>
+++ b/src/mesa/swrast/s_texfetch.c<br>
@@ -552,7 +552,11 @@ texfetch_funcs[] =<br>
fetch_compressed,<br>
fetch_compressed,<br>
fetch_compressed<br>
- }<br>
+ },<br>
+<br>
+ FETCH_NULL(ATC_RGB),<br>
+ FETCH_NULL(ATC_RGBA_EXPLICIT),<br>
+ FETCH_NULL(ATC_RGBA_INTERPOLATED),<br>
};<br>
<br>
<br>
--<br>
2.0.5<br>
<br>
_______________________________________________<br>
mesa-dev mailing list<br>
<a href="mailto:mesa-dev@lists.freedesktop.org">mesa-dev@lists.freedesktop.org</a><br>
<a href="http://lists.freedesktop.org/mailman/listinfo/mesa-dev" target="_blank">http://lists.freedesktop.org/mailman/listinfo/mesa-dev</a><br>
</blockquote></div>