Patch 1 & 2: Reviewed-by: Marek Olšák <marek.ol...@amd.com>
Marek On Thu, Feb 1, 2018 at 8:20 PM, Eric Anholt <e...@anholt.net> wrote: > The VC5 HW puts A in the low bits and R in the high bits. We can't just > swizzle in the shaders because the blending HW can't pick what channel A > is in, so make a new format to match it. > --- > src/gallium/auxiliary/util/u_format.csv | 1 + > src/gallium/drivers/svga/svga_format.c | 1 + > src/gallium/include/pipe/p_format.h | 1 + > src/mesa/state_tracker/st_format.c | 8 +++++++- > 4 files changed, 10 insertions(+), 1 deletion(-) > > diff --git a/src/gallium/auxiliary/util/u_format.csv > b/src/gallium/auxiliary/util/u_format.csv > index 689895f400c9..f9e4925f27cc 100644 > --- a/src/gallium/auxiliary/util/u_format.csv > +++ b/src/gallium/auxiliary/util/u_format.csv > @@ -78,6 +78,7 @@ PIPE_FORMAT_X1B5G5R5_UNORM , plain, 1, 1, x1 , un5 > , un5 , un5 , wzy1, r > PIPE_FORMAT_A1B5G5R5_UNORM , plain, 1, 1, un1 , un5 , un5 , un5 , > wzyx, rgb, un5 , un5 , un5 , un1 , xyzw > PIPE_FORMAT_B4G4R4A4_UNORM , plain, 1, 1, un4 , un4 , un4 , un4 , > zyxw, rgb, un4 , un4 , un4 , un4 , yzwx > PIPE_FORMAT_B4G4R4X4_UNORM , plain, 1, 1, un4 , un4 , un4 , x4 , > zyx1, rgb, x4 , un4 , un4 , un4 , yzw1 > +PIPE_FORMAT_A4B4G4R4_UNORM , plain, 1, 1, un4 , un4 , un4 , un4 , > wzyx, rgb, un4 , un4 , un4 , un4 , xyzw > PIPE_FORMAT_B5G6R5_UNORM , plain, 1, 1, un5 , un6 , un5 , , > zyx1, rgb, un5 , un6 , un5 , , xyz1 > PIPE_FORMAT_R10G10B10A2_UNORM , plain, 1, 1, un10, un10, un10, un2 , > xyzw, rgb, un2 , un10, un10, un10, wzyx > PIPE_FORMAT_R10G10B10X2_UNORM , plain, 1, 1, un10, un10, un10, x2, > xyz1, rgb, x2 , un10, un10, un10, wzy1 > diff --git a/src/gallium/drivers/svga/svga_format.c > b/src/gallium/drivers/svga/svga_format.c > index 964923f084ea..20a6e6b159f3 100644 > --- a/src/gallium/drivers/svga/svga_format.c > +++ b/src/gallium/drivers/svga/svga_format.c > @@ -368,6 +368,7 @@ static const struct vgpu10_format_entry > format_conversion_table[] = > { PIPE_FORMAT_R10G10B10X2_UNORM, SVGA3D_FORMAT_INVALID, > SVGA3D_FORMAT_INVALID, 0 }, > { PIPE_FORMAT_A1B5G5R5_UNORM, SVGA3D_FORMAT_INVALID, > SVGA3D_FORMAT_INVALID, 0 }, > { PIPE_FORMAT_X1B5G5R5_UNORM, SVGA3D_FORMAT_INVALID, > SVGA3D_FORMAT_INVALID, 0 }, > + { PIPE_FORMAT_A4B4G4R4_UNORM, SVGA3D_FORMAT_INVALID, > SVGA3D_FORMAT_INVALID, 0 }, > }; > > > diff --git a/src/gallium/include/pipe/p_format.h > b/src/gallium/include/pipe/p_format.h > index fedac8a06d7e..57399800fa47 100644 > --- a/src/gallium/include/pipe/p_format.h > +++ b/src/gallium/include/pipe/p_format.h > @@ -394,6 +394,7 @@ enum pipe_format { > PIPE_FORMAT_R10G10B10X2_UNORM = 308, > PIPE_FORMAT_A1B5G5R5_UNORM = 309, > PIPE_FORMAT_X1B5G5R5_UNORM = 310, > + PIPE_FORMAT_A4B4G4R4_UNORM = 311, > > PIPE_FORMAT_COUNT > }; > diff --git a/src/mesa/state_tracker/st_format.c > b/src/mesa/state_tracker/st_format.c > index cc72ba406e6e..c50ce1e14bb1 100644 > --- a/src/mesa/state_tracker/st_format.c > +++ b/src/mesa/state_tracker/st_format.c > @@ -84,6 +84,8 @@ st_mesa_format_to_pipe_format(const struct st_context *st, > return PIPE_FORMAT_A1B5G5R5_UNORM; > case MESA_FORMAT_B4G4R4A4_UNORM: > return PIPE_FORMAT_B4G4R4A4_UNORM; > + case MESA_FORMAT_A4B4G4R4_UNORM: > + return PIPE_FORMAT_A4B4G4R4_UNORM; > case MESA_FORMAT_B5G6R5_UNORM: > return PIPE_FORMAT_B5G6R5_UNORM; > case MESA_FORMAT_B2G3R3_UNORM: > @@ -567,6 +569,8 @@ st_pipe_format_to_mesa_format(enum pipe_format format) > return MESA_FORMAT_A1B5G5R5_UNORM; > case PIPE_FORMAT_B4G4R4A4_UNORM: > return MESA_FORMAT_B4G4R4A4_UNORM; > + case PIPE_FORMAT_A4B4G4R4_UNORM: > + return MESA_FORMAT_A4B4G4R4_UNORM; > case PIPE_FORMAT_B5G6R5_UNORM: > return MESA_FORMAT_B5G6R5_UNORM; > case PIPE_FORMAT_B2G3R3_UNORM: > @@ -1155,7 +1159,8 @@ static const struct format_mapping format_map[] = { > }, > { > { GL_RGBA4, GL_RGBA2, 0 }, > - { PIPE_FORMAT_B4G4R4A4_UNORM, DEFAULT_RGBA_FORMATS } > + { PIPE_FORMAT_B4G4R4A4_UNORM, PIPE_FORMAT_A4B4G4R4_UNORM, > + DEFAULT_RGBA_FORMATS } > }, > { > { GL_RGB5_A1, 0 }, > @@ -1170,6 +1175,7 @@ static const struct format_mapping format_map[] = { > { > { GL_RGB4 }, > { PIPE_FORMAT_B4G4R4X4_UNORM, PIPE_FORMAT_B4G4R4A4_UNORM, > + PIPE_FORMAT_A4B4G4R4_UNORM, > DEFAULT_RGB_FORMATS } > }, > { > -- > 2.15.0 > > _______________________________________________ > mesa-dev mailing list > mesa-dev@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/mesa-dev _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev