Mesa (master): gallium: add ATC format support

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Apr 23 17:12:12 UTC 2019


Module: Mesa
Branch: master
Commit: ea254fcd3c1050d691b43f0e2c5570e32d0783dd
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=ea254fcd3c1050d691b43f0e2c5570e32d0783dd

Author: Jonathan Marek <jonathan at marek.ca>
Date:   Tue Feb  5 10:59:42 2019 -0500

gallium: add ATC format support

Signed-off-by: Ilia Mirkin <imirkin at alum.mit.edu>
Signed-off-by: Jonathan Marek <jonathan at marek.ca>
Reviewed-by: Roland Scheidegger <sroland at vmware.com>

---

 src/gallium/auxiliary/util/u_format.csv      | 4 ++++
 src/gallium/auxiliary/util/u_format.h        | 8 +++++++-
 src/gallium/auxiliary/util/u_format_pack.py  | 2 +-
 src/gallium/auxiliary/util/u_format_table.py | 2 +-
 src/gallium/include/pipe/p_format.h          | 4 ++++
 5 files changed, 17 insertions(+), 3 deletions(-)

diff --git a/src/gallium/auxiliary/util/u_format.csv b/src/gallium/auxiliary/util/u_format.csv
index 3a2a6331e01..51a08bd6530 100644
--- a/src/gallium/auxiliary/util/u_format.csv
+++ b/src/gallium/auxiliary/util/u_format.csv
@@ -237,6 +237,10 @@ PIPE_FORMAT_ASTC_10x10_SRGB       , astc,10,10, x128,     ,     ,     , xyzw, sr
 PIPE_FORMAT_ASTC_12x10_SRGB       , astc,12,10, x128,     ,     ,     , xyzw, srgb
 PIPE_FORMAT_ASTC_12x12_SRGB       , astc,12,12, x128,     ,     ,     , xyzw, srgb
 
+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 cb1138947aa..cf69460e050 100644
--- a/src/gallium/auxiliary/util/u_format.h
+++ b/src/gallium/auxiliary/util/u_format.h
@@ -89,9 +89,14 @@ enum util_format_layout {
    UTIL_FORMAT_LAYOUT_ASTC = 8,
 
    /**
+    * ATC
+    */
+   UTIL_FORMAT_LAYOUT_ATC = 9,
+
+   /**
     * Everything else that doesn't fit in any of the above layouts.
     */
-   UTIL_FORMAT_LAYOUT_OTHER = 9
+   UTIL_FORMAT_LAYOUT_OTHER = 10
 };
 
 
@@ -485,6 +490,7 @@ util_format_is_compressed(enum pipe_format format)
    case UTIL_FORMAT_LAYOUT_ETC:
    case UTIL_FORMAT_LAYOUT_BPTC:
    case UTIL_FORMAT_LAYOUT_ASTC:
+   case UTIL_FORMAT_LAYOUT_ATC:
       /* XXX add other formats in the future */
       return TRUE;
    default:
diff --git a/src/gallium/auxiliary/util/u_format_pack.py b/src/gallium/auxiliary/util/u_format_pack.py
index 62e531716ca..b43851720ad 100644
--- a/src/gallium/auxiliary/util/u_format_pack.py
+++ b/src/gallium/auxiliary/util/u_format_pack.py
@@ -696,7 +696,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', 'astc', 'subsampled', 'other') or format.colorspace == ZS
+    return format.layout in ('s3tc', 'rgtc', 'etc', 'bptc', 'astc', 'atc', 'subsampled', 'other') or format.colorspace == ZS
 
 
 def generate(formats):
diff --git a/src/gallium/auxiliary/util/u_format_table.py b/src/gallium/auxiliary/util/u_format_table.py
index 97cd0474382..731e2fbae78 100644
--- a/src/gallium/auxiliary/util/u_format_table.py
+++ b/src/gallium/auxiliary/util/u_format_table.py
@@ -142,7 +142,7 @@ def write_format_table(formats):
         u_format_pack.print_channels(format, do_swizzle_array)
         print("   %s," % (colorspace_map(format.colorspace),))
         access = True
-        if format.layout == 'astc':
+        if format.layout == 'astc' or format.layout == 'atc':
             access = False
         if format.layout == 'etc' and format.short_name() != 'etc1_rgb8':
             access = False
diff --git a/src/gallium/include/pipe/p_format.h b/src/gallium/include/pipe/p_format.h
index c81fc67b8e8..a4401658f5f 100644
--- a/src/gallium/include/pipe/p_format.h
+++ b/src/gallium/include/pipe/p_format.h
@@ -403,6 +403,10 @@ enum pipe_format {
    PIPE_FORMAT_A8B8G8R8_SINT           = 315,
    PIPE_FORMAT_X8B8G8R8_SINT           = 316,
 
+   PIPE_FORMAT_ATC_RGB                 = 317,
+   PIPE_FORMAT_ATC_RGBA_EXPLICIT       = 318,
+   PIPE_FORMAT_ATC_RGBA_INTERPOLATED   = 319,
+
    PIPE_FORMAT_COUNT
 };
 




More information about the mesa-commit mailing list