[Mesa-dev] [PATCH 2/5] gallium: add ATC format support

Ilia Mirkin imirkin at alum.mit.edu
Sun Mar 1 19:08:11 PST 2015


Signed-off-by: Ilia Mirkin <imirkin at alum.mit.edu>
---
 src/gallium/auxiliary/util/u_format.csv     | 4 ++++
 src/gallium/auxiliary/util/u_format.h       | 8 +++++++-
 src/gallium/auxiliary/util/u_format_fake.c  | 4 ++++
 src/gallium/auxiliary/util/u_format_fake.h  | 4 ++++
 src/gallium/auxiliary/util/u_format_pack.py | 2 +-
 src/gallium/include/pipe/p_format.h         | 4 ++++
 6 files changed, 24 insertions(+), 2 deletions(-)

diff --git a/src/gallium/auxiliary/util/u_format.csv b/src/gallium/auxiliary/util/u_format.csv
index d3b77e6..aae7200 100644
--- a/src/gallium/auxiliary/util/u_format.csv
+++ b/src/gallium/auxiliary/util/u_format.csv
@@ -202,6 +202,10 @@ PIPE_FORMAT_BPTC_SRGBA            , bptc, 4, 4, x128,     ,     ,     , xyzw, sr
 PIPE_FORMAT_BPTC_RGB_FLOAT        , bptc, 4, 4, x128,     ,     ,     , xyz1, rgb
 PIPE_FORMAT_BPTC_RGB_UFLOAT       , bptc, 4, 4, x128,     ,     ,     , xyz1, rgb
 
+PIPE_FORMAT_ATC_RGB               ,  atc, 4, 4, x64,      ,     ,     , xyz1, rgb
+PIPE_FORMAT_ATC_RGBA_EXPLICIT     ,  atc, 4, 4, x128,     ,     ,     , xyzw, rgb
+PIPE_FORMAT_ATC_RGBA_INTERPOLATED ,  atc, 4, 4, x128,     ,     ,     , xyzw, rgb
+
 # Straightforward D3D10-like formats (also used for 
 # vertex buffer element description)
 # 
diff --git a/src/gallium/auxiliary/util/u_format.h b/src/gallium/auxiliary/util/u_format.h
index 621574c..0645870 100644
--- a/src/gallium/auxiliary/util/u_format.h
+++ b/src/gallium/auxiliary/util/u_format.h
@@ -84,9 +84,14 @@ enum util_format_layout {
    UTIL_FORMAT_LAYOUT_BPTC = 7,
 
    /**
+    * ATI Texture Compression
+    */
+   UTIL_FORMAT_LAYOUT_ATC = 8,
+
+   /**
     * Everything else that doesn't fit in any of the above layouts.
     */
-   UTIL_FORMAT_LAYOUT_OTHER = 8
+   UTIL_FORMAT_LAYOUT_OTHER = 9
 };
 
 
@@ -481,6 +486,7 @@ util_format_is_compressed(enum pipe_format format)
    case UTIL_FORMAT_LAYOUT_RGTC:
    case UTIL_FORMAT_LAYOUT_ETC:
    case UTIL_FORMAT_LAYOUT_BPTC:
+   case UTIL_FORMAT_LAYOUT_ATC:
       /* XXX add other formats in the future */
       return TRUE;
    default:
diff --git a/src/gallium/auxiliary/util/u_format_fake.c b/src/gallium/auxiliary/util/u_format_fake.c
index 77e896d..0c9aeb6 100644
--- a/src/gallium/auxiliary/util/u_format_fake.c
+++ b/src/gallium/auxiliary/util/u_format_fake.c
@@ -35,3 +35,7 @@ fake(etc2_r11_unorm)
 fake(etc2_r11_snorm)
 fake(etc2_rg11_unorm)
 fake(etc2_rg11_snorm)
+
+fake(atc_rgb)
+fake(atc_rgba_explicit)
+fake(atc_rgba_interpolated)
diff --git a/src/gallium/auxiliary/util/u_format_fake.h b/src/gallium/auxiliary/util/u_format_fake.h
index e6bfd4e..ac816db 100644
--- a/src/gallium/auxiliary/util/u_format_fake.h
+++ b/src/gallium/auxiliary/util/u_format_fake.h
@@ -63,4 +63,8 @@ __format_fake(etc2_r11_snorm)
 __format_fake(etc2_rg11_unorm)
 __format_fake(etc2_rg11_snorm)
 
+__format_fake(atc_rgb)
+__format_fake(atc_rgba_explicit)
+__format_fake(atc_rgba_interpolated)
+
 #endif
diff --git a/src/gallium/auxiliary/util/u_format_pack.py b/src/gallium/auxiliary/util/u_format_pack.py
index d5138cc..eaa010b 100644
--- a/src/gallium/auxiliary/util/u_format_pack.py
+++ b/src/gallium/auxiliary/util/u_format_pack.py
@@ -686,7 +686,7 @@ def generate_format_fetch(format, dst_channel, dst_native_type, dst_suffix):
 
 
 def is_format_hand_written(format):
-    return format.layout in ('s3tc', 'rgtc', 'etc', 'bptc', 'subsampled', 'other') or format.colorspace == ZS
+    return format.layout in ('s3tc', 'rgtc', 'etc', 'bptc', 'atc', 'subsampled', 'other') or format.colorspace == ZS
 
 
 def generate(formats):
diff --git a/src/gallium/include/pipe/p_format.h b/src/gallium/include/pipe/p_format.h
index b2646d4..bcfebd4 100644
--- a/src/gallium/include/pipe/p_format.h
+++ b/src/gallium/include/pipe/p_format.h
@@ -359,6 +359,10 @@ enum pipe_format {
    PIPE_FORMAT_ETC2_RG11_UNORM         = 277,
    PIPE_FORMAT_ETC2_RG11_SNORM         = 278,
 
+   PIPE_FORMAT_ATC_RGB                 = 279,
+   PIPE_FORMAT_ATC_RGBA_EXPLICIT       = 280,
+   PIPE_FORMAT_ATC_RGBA_INTERPOLATED   = 281,
+
    PIPE_FORMAT_COUNT
 };
 
-- 
2.0.5



More information about the mesa-dev mailing list