Also util_format_is_compressed should be updated. With that done: Reviewed-by: Marek Olšák <marek.ol...@amd.com>
Marek On Sat, Nov 21, 2015 at 9:16 PM, Ilia Mirkin <imir...@alum.mit.edu> wrote: > Signed-off-by: Ilia Mirkin <imir...@alum.mit.edu> > --- > > v1 -> v2: add linear <-> srgb conversions to util_format_linear/srgb > > src/gallium/auxiliary/util/u_format.csv | 30 +++++++++++++ > src/gallium/auxiliary/util/u_format.h | 64 > +++++++++++++++++++++++++++- > 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, 125 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..d0b0ebb 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 > }; > > > @@ -924,6 +929,35 @@ util_format_srgb(enum pipe_format format) > return PIPE_FORMAT_B5G6R5_SRGB; > case PIPE_FORMAT_BPTC_RGBA_UNORM: > return PIPE_FORMAT_BPTC_SRGBA; > + case PIPE_FORMAT_ASTC_4x4: > + return PIPE_FORMAT_ASTC_4x4_SRGB; > + case PIPE_FORMAT_ASTC_5x4: > + return PIPE_FORMAT_ASTC_5x4_SRGB; > + case PIPE_FORMAT_ASTC_5x5: > + return PIPE_FORMAT_ASTC_5x5_SRGB; > + case PIPE_FORMAT_ASTC_6x5: > + return PIPE_FORMAT_ASTC_6x5_SRGB; > + case PIPE_FORMAT_ASTC_6x6: > + return PIPE_FORMAT_ASTC_6x6_SRGB; > + case PIPE_FORMAT_ASTC_8x5: > + return PIPE_FORMAT_ASTC_8x5_SRGB; > + case PIPE_FORMAT_ASTC_8x6: > + return PIPE_FORMAT_ASTC_8x6_SRGB; > + case PIPE_FORMAT_ASTC_8x8: > + return PIPE_FORMAT_ASTC_8x8_SRGB; > + case PIPE_FORMAT_ASTC_10x5: > + return PIPE_FORMAT_ASTC_10x5_SRGB; > + case PIPE_FORMAT_ASTC_10x6: > + return PIPE_FORMAT_ASTC_10x6_SRGB; > + case PIPE_FORMAT_ASTC_10x8: > + return PIPE_FORMAT_ASTC_10x8_SRGB; > + case PIPE_FORMAT_ASTC_10x10: > + return PIPE_FORMAT_ASTC_10x10_SRGB; > + case PIPE_FORMAT_ASTC_12x10: > + return PIPE_FORMAT_ASTC_12x10_SRGB; > + case PIPE_FORMAT_ASTC_12x12: > + return PIPE_FORMAT_ASTC_12x12_SRGB; > + > default: > return PIPE_FORMAT_NONE; > } > @@ -971,6 +1005,34 @@ util_format_linear(enum pipe_format format) > return PIPE_FORMAT_B5G6R5_UNORM; > case PIPE_FORMAT_BPTC_SRGBA: > return PIPE_FORMAT_BPTC_RGBA_UNORM; > + case PIPE_FORMAT_ASTC_4x4_SRGB: > + return PIPE_FORMAT_ASTC_4x4; > + case PIPE_FORMAT_ASTC_5x4_SRGB: > + return PIPE_FORMAT_ASTC_5x4; > + case PIPE_FORMAT_ASTC_5x5_SRGB: > + return PIPE_FORMAT_ASTC_5x5; > + case PIPE_FORMAT_ASTC_6x5_SRGB: > + return PIPE_FORMAT_ASTC_6x5; > + case PIPE_FORMAT_ASTC_6x6_SRGB: > + return PIPE_FORMAT_ASTC_6x6; > + case PIPE_FORMAT_ASTC_8x5_SRGB: > + return PIPE_FORMAT_ASTC_8x5; > + case PIPE_FORMAT_ASTC_8x6_SRGB: > + return PIPE_FORMAT_ASTC_8x6; > + case PIPE_FORMAT_ASTC_8x8_SRGB: > + return PIPE_FORMAT_ASTC_8x8; > + case PIPE_FORMAT_ASTC_10x5_SRGB: > + return PIPE_FORMAT_ASTC_10x5; > + case PIPE_FORMAT_ASTC_10x6_SRGB: > + return PIPE_FORMAT_ASTC_10x6; > + case PIPE_FORMAT_ASTC_10x8_SRGB: > + return PIPE_FORMAT_ASTC_10x8; > + case PIPE_FORMAT_ASTC_10x10_SRGB: > + return PIPE_FORMAT_ASTC_10x10; > + case PIPE_FORMAT_ASTC_12x10_SRGB: > + return PIPE_FORMAT_ASTC_12x10; > + case PIPE_FORMAT_ASTC_12x12_SRGB: > + return PIPE_FORMAT_ASTC_12x12; > default: > return format; > } > 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 > > _______________________________________________ > mesa-dev mailing list > mesa-dev@lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/mesa-dev _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev