Mesa (master): gallium: Add defines for FXT1 texture compression.
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Thu Nov 7 20:44:16 UTC 2019
Module: Mesa
Branch: master
Commit: 6196259d957cc7c3ea355b74649623ef7e582854
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=6196259d957cc7c3ea355b74649623ef7e582854
Author: Eric Anholt <eric at anholt.net>
Date: Mon Jul 1 12:39:55 2019 -0700
gallium: Add defines for FXT1 texture compression.
This texture compression is exposed by 830 and 915, and to make
MESA_FORMAT match PIPE_FORMAT defines I need a corresponding
PIPE_FORMAT.
v2: Set is_hand_written so we don't try to generate pack/unpack code.
Reviewed-by: Marek Olšák <marek.olsak at amd.com>
---
src/gallium/auxiliary/util/u_format.csv | 4 ++++
src/gallium/auxiliary/util/u_format.h | 2 ++
src/gallium/auxiliary/util/u_format_table.py | 2 +-
src/gallium/drivers/llvmpipe/lp_test_format.c | 3 ++-
src/gallium/include/pipe/p_format.h | 3 +++
src/mesa/state_tracker/st_format.c | 10 ++++++++++
6 files changed, 22 insertions(+), 2 deletions(-)
diff --git a/src/gallium/auxiliary/util/u_format.csv b/src/gallium/auxiliary/util/u_format.csv
index 089dda933d7..4bfc2a07fda 100644
--- a/src/gallium/auxiliary/util/u_format.csv
+++ b/src/gallium/auxiliary/util/u_format.csv
@@ -191,6 +191,10 @@ PIPE_FORMAT_DXT1_SRGBA , s3tc, 4, 4, 1, x64 , , , , xyz
PIPE_FORMAT_DXT3_SRGBA , s3tc, 4, 4, 1, x128, , , , xyzw, srgb
PIPE_FORMAT_DXT5_SRGBA , s3tc, 4, 4, 1, x128, , , , xyzw, srgb
+# FXT1 compressed formats
+PIPE_FORMAT_FXT1_RGB , fxt1, 8, 4, 1, x128, , , , xyz1, rgb
+PIPE_FORMAT_FXT1_RGBA , fxt1, 8, 4, 1, x128, , , , xyzw, rgb
+
PIPE_FORMAT_RGTC1_UNORM , rgtc, 4, 4, 1, x64, , , , x001, rgb
PIPE_FORMAT_RGTC1_SNORM , rgtc, 4, 4, 1, x64, , , , x001, rgb
PIPE_FORMAT_RGTC2_UNORM , rgtc, 4, 4, 1, x128, , , , xy01, rgb
diff --git a/src/gallium/auxiliary/util/u_format.h b/src/gallium/auxiliary/util/u_format.h
index d9e232925f2..f1aa116fe3a 100644
--- a/src/gallium/auxiliary/util/u_format.h
+++ b/src/gallium/auxiliary/util/u_format.h
@@ -92,6 +92,8 @@ enum util_format_layout {
UTIL_FORMAT_LAYOUT_PLANAR2,
UTIL_FORMAT_LAYOUT_PLANAR3,
+ UTIL_FORMAT_LAYOUT_FXT1 = 10,
+
/**
* Everything else that doesn't fit in any of the above layouts.
*/
diff --git a/src/gallium/auxiliary/util/u_format_table.py b/src/gallium/auxiliary/util/u_format_table.py
index 991b3c4545b..2bc82c36f42 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' or format.layout == 'atc':
+ if format.layout in ('astc', 'atc', 'fxt1'):
access = False
if format.layout == 'etc' and format.short_name() != 'etc1_rgb8':
access = False
diff --git a/src/gallium/drivers/llvmpipe/lp_test_format.c b/src/gallium/drivers/llvmpipe/lp_test_format.c
index 31d965de597..a88272cdb3a 100644
--- a/src/gallium/drivers/llvmpipe/lp_test_format.c
+++ b/src/gallium/drivers/llvmpipe/lp_test_format.c
@@ -392,7 +392,8 @@ test_all(unsigned verbose, FILE *fp)
/* missing fetch funcs */
if (format_desc->layout == UTIL_FORMAT_LAYOUT_ASTC ||
- format_desc->layout == UTIL_FORMAT_LAYOUT_ATC) {
+ format_desc->layout == UTIL_FORMAT_LAYOUT_ATC ||
+ format_desc->layout == UTIL_FORMAT_LAYOUT_FXT1) {
continue;
}
diff --git a/src/gallium/include/pipe/p_format.h b/src/gallium/include/pipe/p_format.h
index 910b158cecf..1c116c0ef3c 100644
--- a/src/gallium/include/pipe/p_format.h
+++ b/src/gallium/include/pipe/p_format.h
@@ -406,6 +406,9 @@ enum pipe_format {
PIPE_FORMAT_ASTC_6x6x5_SRGB,
PIPE_FORMAT_ASTC_6x6x6_SRGB,
+ PIPE_FORMAT_FXT1_RGB,
+ PIPE_FORMAT_FXT1_RGBA,
+
PIPE_FORMAT_P016,
PIPE_FORMAT_R10G10B10X2_UNORM,
diff --git a/src/mesa/state_tracker/st_format.c b/src/mesa/state_tracker/st_format.c
index cdfeac25df1..dd3e1b28804 100644
--- a/src/mesa/state_tracker/st_format.c
+++ b/src/mesa/state_tracker/st_format.c
@@ -638,6 +638,11 @@ st_mesa_format_to_pipe_format(const struct st_context *st,
case MESA_FORMAT_ATC_RGBA_INTERPOLATED:
return PIPE_FORMAT_ATC_RGBA_INTERPOLATED;
+ case MESA_FORMAT_RGB_FXT1:
+ return PIPE_FORMAT_FXT1_RGB;
+ case MESA_FORMAT_RGBA_FXT1:
+ return PIPE_FORMAT_FXT1_RGBA;
+
default:
if (0) {
debug_printf("%s(mesa_format=%s) -> NONE\n",
@@ -1164,6 +1169,11 @@ st_pipe_format_to_mesa_format(enum pipe_format format)
case PIPE_FORMAT_ATC_RGBA_INTERPOLATED:
return MESA_FORMAT_ATC_RGBA_INTERPOLATED;
+ case PIPE_FORMAT_FXT1_RGB:
+ return MESA_FORMAT_RGB_FXT1;
+ case PIPE_FORMAT_FXT1_RGBA:
+ return MESA_FORMAT_RGBA_FXT1;
+
default:
return MESA_FORMAT_NONE;
}
More information about the mesa-commit
mailing list