[Mesa-dev] [PATCH 2/3] gallium: add ASTC formats
Ilia Mirkin
imirkin at alum.mit.edu
Sat Nov 21 12:03:53 PST 2015
Signed-off-by: Ilia Mirkin <imirkin at alum.mit.edu>
---
src/gallium/auxiliary/util/u_format.csv | 30 ++++++++++++++++++++++++++++
src/gallium/auxiliary/util/u_format.h | 7 ++++++-
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 | 30 ++++++++++++++++++++++++++++
5 files changed, 68 insertions(+), 3 deletions(-)
diff --git a/src/gallium/auxiliary/util/u_format.csv b/src/gallium/auxiliary/util/u_format.csv
index d3b77e6..c26d733 100644
--- a/src/gallium/auxiliary/util/u_format.csv
+++ b/src/gallium/auxiliary/util/u_format.csv
@@ -202,6 +202,36 @@ 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_ASTC_4x4 , astc, 4, 4, x128, , , , xyzw, rgb
+PIPE_FORMAT_ASTC_5x4 , astc, 5, 4, x128, , , , xyzw, rgb
+PIPE_FORMAT_ASTC_5x5 , astc, 5, 5, x128, , , , xyzw, rgb
+PIPE_FORMAT_ASTC_6x5 , astc, 6, 5, x128, , , , xyzw, rgb
+PIPE_FORMAT_ASTC_6x6 , astc, 6, 6, x128, , , , xyzw, rgb
+PIPE_FORMAT_ASTC_8x5 , astc, 8, 5, x128, , , , xyzw, rgb
+PIPE_FORMAT_ASTC_8x6 , astc, 8, 6, x128, , , , xyzw, rgb
+PIPE_FORMAT_ASTC_8x8 , astc, 8, 8, x128, , , , xyzw, rgb
+PIPE_FORMAT_ASTC_10x5 , astc,10, 5, x128, , , , xyzw, rgb
+PIPE_FORMAT_ASTC_10x6 , astc,10, 6, x128, , , , xyzw, rgb
+PIPE_FORMAT_ASTC_10x8 , astc,10, 8, x128, , , , xyzw, rgb
+PIPE_FORMAT_ASTC_10x10 , astc,10,10, x128, , , , xyzw, rgb
+PIPE_FORMAT_ASTC_12x10 , astc,12,10, x128, , , , xyzw, rgb
+PIPE_FORMAT_ASTC_12x12 , astc,12,12, x128, , , , xyzw, rgb
+
+PIPE_FORMAT_ASTC_4x4_SRGB , astc, 4, 4, x128, , , , xyzw, srgb
+PIPE_FORMAT_ASTC_5x4_SRGB , astc, 5, 4, x128, , , , xyzw, srgb
+PIPE_FORMAT_ASTC_5x5_SRGB , astc, 5, 5, x128, , , , xyzw, srgb
+PIPE_FORMAT_ASTC_6x5_SRGB , astc, 6, 5, x128, , , , xyzw, srgb
+PIPE_FORMAT_ASTC_6x6_SRGB , astc, 6, 6, x128, , , , xyzw, srgb
+PIPE_FORMAT_ASTC_8x5_SRGB , astc, 8, 5, x128, , , , xyzw, srgb
+PIPE_FORMAT_ASTC_8x6_SRGB , astc, 8, 6, x128, , , , xyzw, srgb
+PIPE_FORMAT_ASTC_8x8_SRGB , astc, 8, 8, x128, , , , xyzw, srgb
+PIPE_FORMAT_ASTC_10x5_SRGB , astc,10, 5, x128, , , , xyzw, srgb
+PIPE_FORMAT_ASTC_10x6_SRGB , astc,10, 6, x128, , , , xyzw, srgb
+PIPE_FORMAT_ASTC_10x8_SRGB , astc,10, 8, x128, , , , xyzw, srgb
+PIPE_FORMAT_ASTC_10x10_SRGB , astc,10,10, x128, , , , xyzw, srgb
+PIPE_FORMAT_ASTC_12x10_SRGB , astc,12,10, x128, , , , xyzw, srgb
+PIPE_FORMAT_ASTC_12x12_SRGB , astc,12,12, x128, , , , xyzw, srgb
+
# 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 a1b1b28..9f7e9c8 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,
/**
+ * ASTC
+ */
+ UTIL_FORMAT_LAYOUT_ASTC = 8,
+
+ /**
* Everything else that doesn't fit in any of the above layouts.
*/
- UTIL_FORMAT_LAYOUT_OTHER = 8
+ UTIL_FORMAT_LAYOUT_OTHER = 9
};
diff --git a/src/gallium/auxiliary/util/u_format_pack.py b/src/gallium/auxiliary/util/u_format_pack.py
index fb42de7..d4bb1de 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', 'astc', '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 1fec0cb..879d10f 100755
--- a/src/gallium/auxiliary/util/u_format_table.py
+++ b/src/gallium/auxiliary/util/u_format_table.py
@@ -139,7 +139,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 == 'bptc':
+ if format.layout in ('bptc', 'astc'):
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 5f0690e..d9c9f9b 100644
--- a/src/gallium/include/pipe/p_format.h
+++ b/src/gallium/include/pipe/p_format.h
@@ -359,6 +359,36 @@ enum pipe_format {
PIPE_FORMAT_ETC2_RG11_UNORM = 277,
PIPE_FORMAT_ETC2_RG11_SNORM = 278,
+ PIPE_FORMAT_ASTC_4x4 = 279,
+ PIPE_FORMAT_ASTC_5x4 = 280,
+ PIPE_FORMAT_ASTC_5x5 = 281,
+ PIPE_FORMAT_ASTC_6x5 = 282,
+ PIPE_FORMAT_ASTC_6x6 = 283,
+ PIPE_FORMAT_ASTC_8x5 = 284,
+ PIPE_FORMAT_ASTC_8x6 = 285,
+ PIPE_FORMAT_ASTC_8x8 = 286,
+ PIPE_FORMAT_ASTC_10x5 = 287,
+ PIPE_FORMAT_ASTC_10x6 = 288,
+ PIPE_FORMAT_ASTC_10x8 = 289,
+ PIPE_FORMAT_ASTC_10x10 = 290,
+ PIPE_FORMAT_ASTC_12x10 = 291,
+ PIPE_FORMAT_ASTC_12x12 = 292,
+
+ PIPE_FORMAT_ASTC_4x4_SRGB = 293,
+ PIPE_FORMAT_ASTC_5x4_SRGB = 294,
+ PIPE_FORMAT_ASTC_5x5_SRGB = 295,
+ PIPE_FORMAT_ASTC_6x5_SRGB = 296,
+ PIPE_FORMAT_ASTC_6x6_SRGB = 297,
+ PIPE_FORMAT_ASTC_8x5_SRGB = 298,
+ PIPE_FORMAT_ASTC_8x6_SRGB = 299,
+ PIPE_FORMAT_ASTC_8x8_SRGB = 300,
+ PIPE_FORMAT_ASTC_10x5_SRGB = 301,
+ PIPE_FORMAT_ASTC_10x6_SRGB = 302,
+ PIPE_FORMAT_ASTC_10x8_SRGB = 303,
+ PIPE_FORMAT_ASTC_10x10_SRGB = 304,
+ PIPE_FORMAT_ASTC_12x10_SRGB = 305,
+ PIPE_FORMAT_ASTC_12x12_SRGB = 306,
+
PIPE_FORMAT_COUNT
};
--
2.4.10
More information about the mesa-dev
mailing list