gallium: Add defines for FXT1 texture compression.
authorEric Anholt <eric@anholt.net>
Mon, 1 Jul 2019 19:39:55 +0000 (12:39 -0700)
committerEric Anholt <eric@anholt.net>
Thu, 7 Nov 2019 19:43:41 +0000 (19:43 +0000)
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@amd.com>
src/gallium/auxiliary/util/u_format.csv
src/gallium/auxiliary/util/u_format.h
src/gallium/auxiliary/util/u_format_table.py
src/gallium/drivers/llvmpipe/lp_test_format.c
src/gallium/include/pipe/p_format.h
src/mesa/state_tracker/st_format.c

index 089dda933d712f6370f619736dcd7fe025eb3c7c..4bfc2a07fdad35a9047a722eadea7c5df6d3d4fd 100644 (file)
@@ -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
index d9e232925f24066c2d4c759f3cb55c11d341ac4d..f1aa116fe3a118ac756fee9ede276b6257ec92f6 100644 (file)
@@ -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.
     */
index 991b3c4545bc89245e00087872d3c0ed79a80149..2bc82c36f42256a9751861e478ec11b03ae28026 100644 (file)
@@ -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
index 31d965de59725089064203996ec307d43e0992a7..a88272cdb3aebd624551dd5cd28c74a9a8177b6f 100644 (file)
@@ -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;
          }
 
index 910b158cecf3c14d33a463eeee69fe2f529eb02b..1c116c0ef3c4889b717ad3f27adabbab9091e75b 100644 (file)
@@ -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,
index cdfeac25df13053aa84acaf39dc866c9d3277d29..dd3e1b2880433239deae2a081b98d097e030059f 100644 (file)
@@ -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;
    }