mesa/st: always use DXT5 when transcoding ASTC format
This fixes artifacts seen in games when using ASTC transcoding,
we need to use DXT5 for proper alpha channel support.
Number of components is a block specific property, there is no easy
way to see if we will require >1bit alpha support or not, so simply
use DXT5 to have support in place.
Fixes: 91cbe8d855 ("gallium: Add a transcode_astc driconf option")
Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Nanley Chery <nanley.g.chery@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15029>
This commit is contained in:
@@ -110,23 +110,12 @@ st_mesa_format_to_pipe_format(const struct st_context *st,
|
||||
}
|
||||
|
||||
if (st_astc_format_fallback(st, mesaFormat)) {
|
||||
const struct util_format_description *desc =
|
||||
util_format_description(mesaFormat);
|
||||
|
||||
if (_mesa_is_format_srgb(mesaFormat)) {
|
||||
if (!st->transcode_astc)
|
||||
return PIPE_FORMAT_R8G8B8A8_SRGB;
|
||||
else if (desc->block.width * desc->block.height < 32)
|
||||
return PIPE_FORMAT_DXT5_SRGBA;
|
||||
else
|
||||
return PIPE_FORMAT_DXT1_SRGBA;
|
||||
return st->transcode_astc ? PIPE_FORMAT_DXT5_SRGBA :
|
||||
PIPE_FORMAT_R8G8B8A8_SRGB;
|
||||
} else {
|
||||
if (!st->transcode_astc)
|
||||
return PIPE_FORMAT_R8G8B8A8_UNORM;
|
||||
else if (desc->block.width * desc->block.height < 32)
|
||||
return PIPE_FORMAT_DXT5_RGBA;
|
||||
else
|
||||
return PIPE_FORMAT_DXT1_RGBA;
|
||||
return st->transcode_astc ? PIPE_FORMAT_DXT5_RGBA :
|
||||
PIPE_FORMAT_R8G8B8A8_UNORM;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user