diff options
author | Nanley Chery <[email protected]> | 2015-05-19 10:35:39 -0700 |
---|---|---|
committer | Nanley Chery <[email protected]> | 2015-08-26 14:36:42 -0700 |
commit | 8ae37365f30594498184fe5428f961a9c310fd8c (patch) | |
tree | f6cb1eb1e21003099973db5cea81e073498d1bf8 /src | |
parent | c4cbaca327174135e28353c3438241b08bf96755 (diff) |
mesa/formats: define the 2D ASTC formats
Define the mesa formats and make changes necessary for compilation
without errors. Also add support for _mesa_get_srgb_format_linear().
v2. conform the ASTC MESA_FORMAT enums to the existing naming convention.
v3. remove ASTC cases for _mesa_get_uncompressed_format(). This function is
only used for generating mipmaps - something ASTC formats do not support
due to lack of online compression.
Reviewed-by: Anuj Phogat <[email protected]>
Signed-off-by: Nanley Chery <[email protected]>
Diffstat (limited to 'src')
-rw-r--r-- | src/mesa/main/format_info.py | 3 | ||||
-rw-r--r-- | src/mesa/main/formats.c | 43 | ||||
-rw-r--r-- | src/mesa/main/formats.csv | 31 | ||||
-rw-r--r-- | src/mesa/main/formats.h | 31 | ||||
-rw-r--r-- | src/mesa/swrast/s_texfetch.c | 32 |
5 files changed, 139 insertions, 1 deletions
diff --git a/src/mesa/main/format_info.py b/src/mesa/main/format_info.py index 839d4073c61..22eb5a734a6 100644 --- a/src/mesa/main/format_info.py +++ b/src/mesa/main/format_info.py @@ -122,6 +122,9 @@ def get_channel_bits(fmat, chan_name): elif fmat.layout == 'bptc': bits = 16 if fmat.name.endswith('_FLOAT') else 8 return bits if fmat.has_channel(chan_name) else 0 + elif fmat.layout == 'astc': + bits = 16 if 'RGBA' in fmat.name else 8 + return bits if fmat.has_channel(chan_name) else 0 else: assert False else: diff --git a/src/mesa/main/formats.c b/src/mesa/main/formats.c index 34a4434c3ba..587221ca5a0 100644 --- a/src/mesa/main/formats.c +++ b/src/mesa/main/formats.c @@ -197,6 +197,7 @@ _mesa_get_format_max_bits(mesa_format format) * MESA_FORMAT_LAYOUT_ETC1 * MESA_FORMAT_LAYOUT_ETC2 * MESA_FORMAT_LAYOUT_BPTC + * MESA_FORMAT_LAYOUT_ASTC * MESA_FORMAT_LAYOUT_OTHER */ extern enum mesa_format_layout @@ -663,6 +664,48 @@ _mesa_get_srgb_format_linear(mesa_format format) case MESA_FORMAT_BPTC_SRGB_ALPHA_UNORM: format = MESA_FORMAT_BPTC_RGBA_UNORM; break; + case MESA_FORMAT_SRGB8_ALPHA8_ASTC_4x4: + format = MESA_FORMAT_RGBA_ASTC_4x4; + break; + case MESA_FORMAT_SRGB8_ALPHA8_ASTC_5x4: + format = MESA_FORMAT_RGBA_ASTC_5x4; + break; + case MESA_FORMAT_SRGB8_ALPHA8_ASTC_5x5: + format = MESA_FORMAT_RGBA_ASTC_5x5; + break; + case MESA_FORMAT_SRGB8_ALPHA8_ASTC_6x5: + format = MESA_FORMAT_RGBA_ASTC_6x5; + break; + case MESA_FORMAT_SRGB8_ALPHA8_ASTC_6x6: + format = MESA_FORMAT_RGBA_ASTC_6x6; + break; + case MESA_FORMAT_SRGB8_ALPHA8_ASTC_8x5: + format = MESA_FORMAT_RGBA_ASTC_8x5; + break; + case MESA_FORMAT_SRGB8_ALPHA8_ASTC_8x6: + format = MESA_FORMAT_RGBA_ASTC_8x6; + break; + case MESA_FORMAT_SRGB8_ALPHA8_ASTC_8x8: + format = MESA_FORMAT_RGBA_ASTC_8x8; + break; + case MESA_FORMAT_SRGB8_ALPHA8_ASTC_10x5: + format = MESA_FORMAT_RGBA_ASTC_10x5; + break; + case MESA_FORMAT_SRGB8_ALPHA8_ASTC_10x6: + format = MESA_FORMAT_RGBA_ASTC_10x6; + break; + case MESA_FORMAT_SRGB8_ALPHA8_ASTC_10x8: + format = MESA_FORMAT_RGBA_ASTC_10x8; + break; + case MESA_FORMAT_SRGB8_ALPHA8_ASTC_10x10: + format = MESA_FORMAT_RGBA_ASTC_10x10; + break; + case MESA_FORMAT_SRGB8_ALPHA8_ASTC_12x10: + format = MESA_FORMAT_RGBA_ASTC_12x10; + break; + case MESA_FORMAT_SRGB8_ALPHA8_ASTC_12x12: + format = MESA_FORMAT_RGBA_ASTC_12x12; + break; case MESA_FORMAT_B8G8R8X8_SRGB: format = MESA_FORMAT_B8G8R8X8_UNORM; break; diff --git a/src/mesa/main/formats.csv b/src/mesa/main/formats.csv index e159e7dd6aa..80729d98787 100644 --- a/src/mesa/main/formats.csv +++ b/src/mesa/main/formats.csv @@ -301,3 +301,34 @@ MESA_FORMAT_BPTC_RGBA_UNORM , bptc , 4, 4, x128, , , MESA_FORMAT_BPTC_SRGB_ALPHA_UNORM , bptc , 4, 4, x128, , , , xyzw, srgb MESA_FORMAT_BPTC_RGB_SIGNED_FLOAT , bptc , 4, 4, x128, , , , xyz1, rgb MESA_FORMAT_BPTC_RGB_UNSIGNED_FLOAT , bptc , 4, 4, x128, , , , xyz1, rgb + +# ASTC compressed formats +MESA_FORMAT_RGBA_ASTC_4x4 , astc , 4, 4, x128, , , , xyzw, rgb +MESA_FORMAT_RGBA_ASTC_5x4 , astc , 5, 4, x128, , , , xyzw, rgb +MESA_FORMAT_RGBA_ASTC_5x5 , astc , 5, 5, x128, , , , xyzw, rgb +MESA_FORMAT_RGBA_ASTC_6x5 , astc , 6, 5, x128, , , , xyzw, rgb +MESA_FORMAT_RGBA_ASTC_6x6 , astc , 6, 6, x128, , , , xyzw, rgb +MESA_FORMAT_RGBA_ASTC_8x5 , astc , 8, 5, x128, , , , xyzw, rgb +MESA_FORMAT_RGBA_ASTC_8x6 , astc , 8, 6, x128, , , , xyzw, rgb +MESA_FORMAT_RGBA_ASTC_8x8 , astc , 8, 8, x128, , , , xyzw, rgb +MESA_FORMAT_RGBA_ASTC_10x5 , astc ,10, 5, x128, , , , xyzw, rgb +MESA_FORMAT_RGBA_ASTC_10x6 , astc ,10, 6, x128, , , , xyzw, rgb +MESA_FORMAT_RGBA_ASTC_10x8 , astc ,10, 8, x128, , , , xyzw, rgb +MESA_FORMAT_RGBA_ASTC_10x10 , astc ,10,10, x128, , , , xyzw, rgb +MESA_FORMAT_RGBA_ASTC_12x10 , astc ,12,10, x128, , , , xyzw, rgb +MESA_FORMAT_RGBA_ASTC_12x12 , astc ,12,12, x128, , , , xyzw, rgb + +MESA_FORMAT_SRGB8_ALPHA8_ASTC_4x4 , astc , 4, 4, x128, , , , xyzw, srgb +MESA_FORMAT_SRGB8_ALPHA8_ASTC_5x4 , astc , 5, 4, x128, , , , xyzw, srgb +MESA_FORMAT_SRGB8_ALPHA8_ASTC_5x5 , astc , 5, 5, x128, , , , xyzw, srgb +MESA_FORMAT_SRGB8_ALPHA8_ASTC_6x5 , astc , 6, 5, x128, , , , xyzw, srgb +MESA_FORMAT_SRGB8_ALPHA8_ASTC_6x6 , astc , 6, 6, x128, , , , xyzw, srgb +MESA_FORMAT_SRGB8_ALPHA8_ASTC_8x5 , astc , 8, 5, x128, , , , xyzw, srgb +MESA_FORMAT_SRGB8_ALPHA8_ASTC_8x6 , astc , 8, 6, x128, , , , xyzw, srgb +MESA_FORMAT_SRGB8_ALPHA8_ASTC_8x8 , astc , 8, 8, x128, , , , xyzw, srgb +MESA_FORMAT_SRGB8_ALPHA8_ASTC_10x5 , astc ,10, 5, x128, , , , xyzw, srgb +MESA_FORMAT_SRGB8_ALPHA8_ASTC_10x6 , astc ,10, 6, x128, , , , xyzw, srgb +MESA_FORMAT_SRGB8_ALPHA8_ASTC_10x8 , astc ,10, 8, x128, , , , xyzw, srgb +MESA_FORMAT_SRGB8_ALPHA8_ASTC_10x10 , astc ,10,10, x128, , , , xyzw, srgb +MESA_FORMAT_SRGB8_ALPHA8_ASTC_12x10 , astc ,12,10, x128, , , , xyzw, srgb +MESA_FORMAT_SRGB8_ALPHA8_ASTC_12x12 , astc ,12,12, x128, , , , xyzw, srgb diff --git a/src/mesa/main/formats.h b/src/mesa/main/formats.h index 4936fa0d482..ccb09b263ff 100644 --- a/src/mesa/main/formats.h +++ b/src/mesa/main/formats.h @@ -70,6 +70,7 @@ enum mesa_format_layout { MESA_FORMAT_LAYOUT_ETC1, MESA_FORMAT_LAYOUT_ETC2, MESA_FORMAT_LAYOUT_BPTC, + MESA_FORMAT_LAYOUT_ASTC, MESA_FORMAT_LAYOUT_OTHER, }; @@ -586,6 +587,36 @@ typedef enum MESA_FORMAT_BPTC_RGB_SIGNED_FLOAT, MESA_FORMAT_BPTC_RGB_UNSIGNED_FLOAT, + /* ASTC compressed formats */ + MESA_FORMAT_RGBA_ASTC_4x4, + MESA_FORMAT_RGBA_ASTC_5x4, + MESA_FORMAT_RGBA_ASTC_5x5, + MESA_FORMAT_RGBA_ASTC_6x5, + MESA_FORMAT_RGBA_ASTC_6x6, + MESA_FORMAT_RGBA_ASTC_8x5, + MESA_FORMAT_RGBA_ASTC_8x6, + MESA_FORMAT_RGBA_ASTC_8x8, + MESA_FORMAT_RGBA_ASTC_10x5, + MESA_FORMAT_RGBA_ASTC_10x6, + MESA_FORMAT_RGBA_ASTC_10x8, + MESA_FORMAT_RGBA_ASTC_10x10, + MESA_FORMAT_RGBA_ASTC_12x10, + MESA_FORMAT_RGBA_ASTC_12x12, + + MESA_FORMAT_SRGB8_ALPHA8_ASTC_4x4, + MESA_FORMAT_SRGB8_ALPHA8_ASTC_5x4, + MESA_FORMAT_SRGB8_ALPHA8_ASTC_5x5, + MESA_FORMAT_SRGB8_ALPHA8_ASTC_6x5, + MESA_FORMAT_SRGB8_ALPHA8_ASTC_6x6, + MESA_FORMAT_SRGB8_ALPHA8_ASTC_8x5, + MESA_FORMAT_SRGB8_ALPHA8_ASTC_8x6, + MESA_FORMAT_SRGB8_ALPHA8_ASTC_8x8, + MESA_FORMAT_SRGB8_ALPHA8_ASTC_10x5, + MESA_FORMAT_SRGB8_ALPHA8_ASTC_10x6, + MESA_FORMAT_SRGB8_ALPHA8_ASTC_10x8, + MESA_FORMAT_SRGB8_ALPHA8_ASTC_10x10, + MESA_FORMAT_SRGB8_ALPHA8_ASTC_12x10, + MESA_FORMAT_SRGB8_ALPHA8_ASTC_12x12, MESA_FORMAT_COUNT } mesa_format; diff --git a/src/mesa/swrast/s_texfetch.c b/src/mesa/swrast/s_texfetch.c index 1fe21c0b469..754d982bcd5 100644 --- a/src/mesa/swrast/s_texfetch.c +++ b/src/mesa/swrast/s_texfetch.c @@ -551,7 +551,37 @@ texfetch_funcs[] = fetch_compressed, fetch_compressed, fetch_compressed - } + }, + + /* ASTC compressed formats */ + FETCH_NULL(RGBA_ASTC_4x4), + FETCH_NULL(RGBA_ASTC_5x4), + FETCH_NULL(RGBA_ASTC_5x5), + FETCH_NULL(RGBA_ASTC_6x5), + FETCH_NULL(RGBA_ASTC_6x6), + FETCH_NULL(RGBA_ASTC_8x5), + FETCH_NULL(RGBA_ASTC_8x6), + FETCH_NULL(RGBA_ASTC_8x8), + FETCH_NULL(RGBA_ASTC_10x5), + FETCH_NULL(RGBA_ASTC_10x6), + FETCH_NULL(RGBA_ASTC_10x8), + FETCH_NULL(RGBA_ASTC_10x10), + FETCH_NULL(RGBA_ASTC_12x10), + FETCH_NULL(RGBA_ASTC_12x12), + FETCH_NULL(SRGB8_ALPHA8_ASTC_4x4), + FETCH_NULL(SRGB8_ALPHA8_ASTC_5x4), + FETCH_NULL(SRGB8_ALPHA8_ASTC_5x5), + FETCH_NULL(SRGB8_ALPHA8_ASTC_6x5), + FETCH_NULL(SRGB8_ALPHA8_ASTC_6x6), + FETCH_NULL(SRGB8_ALPHA8_ASTC_8x5), + FETCH_NULL(SRGB8_ALPHA8_ASTC_8x6), + FETCH_NULL(SRGB8_ALPHA8_ASTC_8x8), + FETCH_NULL(SRGB8_ALPHA8_ASTC_10x5), + FETCH_NULL(SRGB8_ALPHA8_ASTC_10x6), + FETCH_NULL(SRGB8_ALPHA8_ASTC_10x8), + FETCH_NULL(SRGB8_ALPHA8_ASTC_10x10), + FETCH_NULL(SRGB8_ALPHA8_ASTC_12x10), + FETCH_NULL(SRGB8_ALPHA8_ASTC_12x12) }; |