mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-25 04:20:08 +01:00
freedreno/a6xx: Add support for A/XRGB1555 formats.
This switches the format we use by default for GLES's rgb5_a1, and means that our formats supported more closely matches turnip. Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13046>
This commit is contained in:
parent
ebaeddcbb3
commit
38f23b1108
2 changed files with 28 additions and 1 deletions
|
|
@ -120,6 +120,8 @@ static const struct fd6_format formats[PIPE_FORMAT_COUNT] = {
|
|||
|
||||
_TC(B5G5R5A1_UNORM, 5_5_5_1_UNORM, WXYZ),
|
||||
_TC(B5G5R5X1_UNORM, 5_5_5_1_UNORM, WXYZ),
|
||||
_TC(A1R5G5B5_UNORM, 5_5_5_1_UNORM, ZYXW),
|
||||
_TC(A1B5G5R5_UNORM, 5_5_5_1_UNORM, XYZW),
|
||||
|
||||
_TC(R4G4B4A4_UNORM, 4_4_4_4_UNORM, WZYX),
|
||||
_TC(B4G4R4A4_UNORM, 4_4_4_4_UNORM, WXYZ),
|
||||
|
|
@ -386,12 +388,37 @@ fd6_texture_format(enum pipe_format format, enum a6xx_tile_mode tile_mode)
|
|||
{
|
||||
if (!formats[format].present)
|
||||
return FMT6_NONE;
|
||||
|
||||
/* Linear ARGB/ABGR1555 has a special format for sampling (tiled 1555/5551
|
||||
* formats always have the same swizzle and layout).
|
||||
*/
|
||||
if (!tile_mode) {
|
||||
switch (format) {
|
||||
case PIPE_FORMAT_A1R5G5B5_UNORM:
|
||||
case PIPE_FORMAT_A1B5G5R5_UNORM:
|
||||
return FMT6_1_5_5_5_UNORM;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return formats[format].tex;
|
||||
}
|
||||
|
||||
enum a3xx_color_swap
|
||||
fd6_texture_swap(enum pipe_format format, enum a6xx_tile_mode tile_mode)
|
||||
{
|
||||
if (!tile_mode) {
|
||||
switch (format) {
|
||||
case PIPE_FORMAT_A1R5G5B5_UNORM:
|
||||
return WZYX;
|
||||
case PIPE_FORMAT_A1B5G5R5_UNORM:
|
||||
return WXYZ;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return fd6_pipe2swap(format, tile_mode);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@ fd6_tex_swiz(enum pipe_format format, enum a6xx_tile_mode tile_mode, unsigned ch
|
|||
} else if (format == PIPE_FORMAT_R8G8_R8B8_UNORM || format == PIPE_FORMAT_G8R8_B8R8_UNORM) {
|
||||
unsigned char fswiz[4] = {PIPE_SWIZZLE_Z, PIPE_SWIZZLE_X, PIPE_SWIZZLE_Y, PIPE_SWIZZLE_1};
|
||||
util_format_compose_swizzles(fswiz, uswiz, swiz);
|
||||
} else if (fd6_texture_swap(format, TILE6_LINEAR) != WZYX) {
|
||||
} else if (fd6_texture_swap(format, TILE6_LINEAR) != WZYX || format == PIPE_FORMAT_A1R5G5B5_UNORM) {
|
||||
/* Formats with a non-pass-through swap are permutations of RGBA
|
||||
* formats. We program the permutation using the swap and don't
|
||||
* need to compose the format swizzle with the user swizzle.
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue