From 0309fb82ec410ea5e5da83727d9e3de3176c1df2 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 14 Aug 2019 12:23:46 -0700 Subject: [PATCH] gallium: Add the ASTC 3D formats. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit No driver implements them yet, but this is a long way toward gallium having matching format enums for Mesa formats. Reviewed-by: Marek Olšák --- src/gallium/auxiliary/util/u_format.csv | 21 +++++++ src/gallium/include/pipe/p_format.h | 22 +++++++ src/mesa/state_tracker/st_format.c | 82 +++++++++++++++++++++++++ 3 files changed, 125 insertions(+) diff --git a/src/gallium/auxiliary/util/u_format.csv b/src/gallium/auxiliary/util/u_format.csv index 61b991e1f9e..800f3726cf7 100644 --- a/src/gallium/auxiliary/util/u_format.csv +++ b/src/gallium/auxiliary/util/u_format.csv @@ -249,6 +249,27 @@ PIPE_FORMAT_ASTC_10x10_SRGB , astc,10,10, 1, x128, , , , xyz PIPE_FORMAT_ASTC_12x10_SRGB , astc,12,10, 1, x128, , , , xyzw, srgb PIPE_FORMAT_ASTC_12x12_SRGB , astc,12,12, 1, x128, , , , xyzw, srgb +PIPE_FORMAT_ASTC_3x3x3 , astc, 3, 3, 3, x128, , , , xyzw, rgb +PIPE_FORMAT_ASTC_4x3x3 , astc, 4, 3, 3, x128, , , , xyzw, rgb +PIPE_FORMAT_ASTC_4x4x3 , astc, 4, 4, 3, x128, , , , xyzw, rgb +PIPE_FORMAT_ASTC_4x4x4 , astc, 4, 4, 4, x128, , , , xyzw, rgb +PIPE_FORMAT_ASTC_5x4x4 , astc, 5, 4, 4, x128, , , , xyzw, rgb +PIPE_FORMAT_ASTC_5x5x4 , astc, 5, 5, 4, x128, , , , xyzw, rgb +PIPE_FORMAT_ASTC_5x5x5 , astc, 5, 5, 5, x128, , , , xyzw, rgb +PIPE_FORMAT_ASTC_6x5x5 , astc, 6, 5, 5, x128, , , , xyzw, rgb +PIPE_FORMAT_ASTC_6x6x5 , astc, 6, 6, 5, x128, , , , xyzw, rgb +PIPE_FORMAT_ASTC_6x6x6 , astc, 6, 6, 6, x128, , , , xyzw, rgb +PIPE_FORMAT_ASTC_3x3x3_SRGB , astc, 3, 3, 3, x128, , , , xyzw, srgb +PIPE_FORMAT_ASTC_4x3x3_SRGB , astc, 4, 3, 3, x128, , , , xyzw, srgb +PIPE_FORMAT_ASTC_4x4x3_SRGB , astc, 4, 4, 3, x128, , , , xyzw, srgb +PIPE_FORMAT_ASTC_4x4x4_SRGB , astc, 4, 4, 4, x128, , , , xyzw, srgb +PIPE_FORMAT_ASTC_5x4x4_SRGB , astc, 5, 4, 4, x128, , , , xyzw, srgb +PIPE_FORMAT_ASTC_5x5x4_SRGB , astc, 5, 5, 4, x128, , , , xyzw, srgb +PIPE_FORMAT_ASTC_5x5x5_SRGB , astc, 5, 5, 5, x128, , , , xyzw, srgb +PIPE_FORMAT_ASTC_6x5x5_SRGB , astc, 6, 5, 5, x128, , , , xyzw, srgb +PIPE_FORMAT_ASTC_6x6x5_SRGB , astc, 6, 6, 5, x128, , , , xyzw, srgb +PIPE_FORMAT_ASTC_6x6x6_SRGB , astc, 6, 6, 6, x128, , , , xyzw, srgb + PIPE_FORMAT_ATC_RGB , atc, 4, 4, 1, x64, , , , xyz1, rgb PIPE_FORMAT_ATC_RGBA_EXPLICIT , atc, 4, 4, 1, x128, , , , xyzw, rgb PIPE_FORMAT_ATC_RGBA_INTERPOLATED , atc, 4, 4, 1, x128, , , , xyzw, rgb diff --git a/src/gallium/include/pipe/p_format.h b/src/gallium/include/pipe/p_format.h index f4a17247db7..620e192e20c 100644 --- a/src/gallium/include/pipe/p_format.h +++ b/src/gallium/include/pipe/p_format.h @@ -389,6 +389,28 @@ enum pipe_format { PIPE_FORMAT_ASTC_12x10_SRGB, PIPE_FORMAT_ASTC_12x12_SRGB, + PIPE_FORMAT_ASTC_3x3x3, + PIPE_FORMAT_ASTC_4x3x3, + PIPE_FORMAT_ASTC_4x4x3, + PIPE_FORMAT_ASTC_4x4x4, + PIPE_FORMAT_ASTC_5x4x4, + PIPE_FORMAT_ASTC_5x5x4, + PIPE_FORMAT_ASTC_5x5x5, + PIPE_FORMAT_ASTC_6x5x5, + PIPE_FORMAT_ASTC_6x6x5, + PIPE_FORMAT_ASTC_6x6x6, + + PIPE_FORMAT_ASTC_3x3x3_SRGB, + PIPE_FORMAT_ASTC_4x3x3_SRGB, + PIPE_FORMAT_ASTC_4x4x3_SRGB, + PIPE_FORMAT_ASTC_4x4x4_SRGB, + PIPE_FORMAT_ASTC_5x4x4_SRGB, + PIPE_FORMAT_ASTC_5x5x4_SRGB, + PIPE_FORMAT_ASTC_5x5x5_SRGB, + PIPE_FORMAT_ASTC_6x5x5_SRGB, + PIPE_FORMAT_ASTC_6x6x5_SRGB, + PIPE_FORMAT_ASTC_6x6x6_SRGB, + 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 4edb6782473..5f7997c5c5a 100644 --- a/src/mesa/state_tracker/st_format.c +++ b/src/mesa/state_tracker/st_format.c @@ -602,6 +602,47 @@ st_mesa_format_to_pipe_format(const struct st_context *st, return PIPE_FORMAT_R8G8B8A8_SRGB; return PIPE_FORMAT_ASTC_12x12_SRGB; + case MESA_FORMAT_RGBA_ASTC_3x3x3: + return PIPE_FORMAT_ASTC_3x3x3; + case MESA_FORMAT_RGBA_ASTC_4x3x3: + return PIPE_FORMAT_ASTC_4x3x3; + case MESA_FORMAT_RGBA_ASTC_4x4x3: + return PIPE_FORMAT_ASTC_4x4x3; + case MESA_FORMAT_RGBA_ASTC_4x4x4: + return PIPE_FORMAT_ASTC_4x4x4; + case MESA_FORMAT_RGBA_ASTC_5x4x4: + return PIPE_FORMAT_ASTC_5x4x4; + case MESA_FORMAT_RGBA_ASTC_5x5x4: + return PIPE_FORMAT_ASTC_5x5x4; + case MESA_FORMAT_RGBA_ASTC_5x5x5: + return PIPE_FORMAT_ASTC_5x5x5; + case MESA_FORMAT_RGBA_ASTC_6x5x5: + return PIPE_FORMAT_ASTC_6x5x5; + case MESA_FORMAT_RGBA_ASTC_6x6x5: + return PIPE_FORMAT_ASTC_6x6x5; + case MESA_FORMAT_RGBA_ASTC_6x6x6: + return PIPE_FORMAT_ASTC_6x6x6; + case MESA_FORMAT_SRGB8_ALPHA8_ASTC_3x3x3: + return PIPE_FORMAT_ASTC_3x3x3_SRGB; + case MESA_FORMAT_SRGB8_ALPHA8_ASTC_4x3x3: + return PIPE_FORMAT_ASTC_4x3x3_SRGB; + case MESA_FORMAT_SRGB8_ALPHA8_ASTC_4x4x3: + return PIPE_FORMAT_ASTC_4x4x3_SRGB; + case MESA_FORMAT_SRGB8_ALPHA8_ASTC_4x4x4: + return PIPE_FORMAT_ASTC_4x4x4_SRGB; + case MESA_FORMAT_SRGB8_ALPHA8_ASTC_5x4x4: + return PIPE_FORMAT_ASTC_5x4x4_SRGB; + case MESA_FORMAT_SRGB8_ALPHA8_ASTC_5x5x4: + return PIPE_FORMAT_ASTC_5x5x4_SRGB; + case MESA_FORMAT_SRGB8_ALPHA8_ASTC_5x5x5: + return PIPE_FORMAT_ASTC_5x5x5_SRGB; + case MESA_FORMAT_SRGB8_ALPHA8_ASTC_6x5x5: + return PIPE_FORMAT_ASTC_6x5x5_SRGB; + case MESA_FORMAT_SRGB8_ALPHA8_ASTC_6x6x5: + return PIPE_FORMAT_ASTC_6x6x5_SRGB; + case MESA_FORMAT_SRGB8_ALPHA8_ASTC_6x6x6: + return PIPE_FORMAT_ASTC_6x6x6_SRGB; + case MESA_FORMAT_ATC_RGB: return PIPE_FORMAT_ATC_RGB; case MESA_FORMAT_ATC_RGBA_EXPLICIT: @@ -1095,6 +1136,47 @@ st_pipe_format_to_mesa_format(enum pipe_format format) case PIPE_FORMAT_ASTC_12x12_SRGB: return MESA_FORMAT_SRGB8_ALPHA8_ASTC_12x12; + case PIPE_FORMAT_ASTC_3x3x3: + return MESA_FORMAT_RGBA_ASTC_3x3x3; + case PIPE_FORMAT_ASTC_4x3x3: + return MESA_FORMAT_RGBA_ASTC_4x3x3; + case PIPE_FORMAT_ASTC_4x4x3: + return MESA_FORMAT_RGBA_ASTC_4x4x3; + case PIPE_FORMAT_ASTC_4x4x4: + return MESA_FORMAT_RGBA_ASTC_4x4x4; + case PIPE_FORMAT_ASTC_5x4x4: + return MESA_FORMAT_RGBA_ASTC_5x4x4; + case PIPE_FORMAT_ASTC_5x5x4: + return MESA_FORMAT_RGBA_ASTC_5x5x4; + case PIPE_FORMAT_ASTC_5x5x5: + return MESA_FORMAT_RGBA_ASTC_5x5x5; + case PIPE_FORMAT_ASTC_6x5x5: + return MESA_FORMAT_RGBA_ASTC_6x5x5; + case PIPE_FORMAT_ASTC_6x6x5: + return MESA_FORMAT_RGBA_ASTC_6x6x5; + case PIPE_FORMAT_ASTC_6x6x6: + return MESA_FORMAT_RGBA_ASTC_6x6x6; + case PIPE_FORMAT_ASTC_3x3x3_SRGB: + return MESA_FORMAT_SRGB8_ALPHA8_ASTC_3x3x3; + case PIPE_FORMAT_ASTC_4x3x3_SRGB: + return MESA_FORMAT_SRGB8_ALPHA8_ASTC_4x3x3; + case PIPE_FORMAT_ASTC_4x4x3_SRGB: + return MESA_FORMAT_SRGB8_ALPHA8_ASTC_4x4x3; + case PIPE_FORMAT_ASTC_4x4x4_SRGB: + return MESA_FORMAT_SRGB8_ALPHA8_ASTC_4x4x4; + case PIPE_FORMAT_ASTC_5x4x4_SRGB: + return MESA_FORMAT_SRGB8_ALPHA8_ASTC_5x4x4; + case PIPE_FORMAT_ASTC_5x5x4_SRGB: + return MESA_FORMAT_SRGB8_ALPHA8_ASTC_5x5x4; + case PIPE_FORMAT_ASTC_5x5x5_SRGB: + return MESA_FORMAT_SRGB8_ALPHA8_ASTC_5x5x5; + case PIPE_FORMAT_ASTC_6x5x5_SRGB: + return MESA_FORMAT_SRGB8_ALPHA8_ASTC_6x5x5; + case PIPE_FORMAT_ASTC_6x6x5_SRGB: + return MESA_FORMAT_SRGB8_ALPHA8_ASTC_6x6x5; + case PIPE_FORMAT_ASTC_6x6x6_SRGB: + return MESA_FORMAT_SRGB8_ALPHA8_ASTC_6x6x6; + case PIPE_FORMAT_ATC_RGB: return MESA_FORMAT_ATC_RGB; case PIPE_FORMAT_ATC_RGBA_EXPLICIT: -- 2.30.2