mesa: fall-back to fp16 for bptc-textures

FP16 is way more commonly supported than FP32, and requires half the
memory bandwidth. Because the internal format of BPTC is really FP16,
let's fall back to that instead.

Acked-by: Marek Olšák <marek.olsak@amd.com>
Acked-by: Soroush Kashani <soroush.kashani@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18012>
This commit is contained in:
Erik Faye-Lund
2022-08-24 15:20:42 +02:00
committed by Marge Bot
parent 72ad3787a3
commit 7f7c8e83df
3 changed files with 9 additions and 9 deletions

View File

@@ -253,17 +253,17 @@ _mesa_unpack_bptc(uint8_t *dst_row,
{
switch (format) {
case MESA_FORMAT_BPTC_RGB_SIGNED_FLOAT:
decompress_rgb_float(src_width, src_height,
src_row, src_stride,
(float *)dst_row, dst_stride,
decompress_rgb_fp16(src_width, src_height,
src_row, src_stride,
(uint16_t *)dst_row, dst_stride,
true);
break;
case MESA_FORMAT_BPTC_RGB_UNSIGNED_FLOAT:
decompress_rgb_float(src_width, src_height,
src_row, src_stride,
(float *)dst_row, dst_stride,
false);
decompress_rgb_fp16(src_width, src_height,
src_row, src_stride,
(uint16_t *)dst_row, dst_stride,
false);
break;
default:

View File

@@ -979,7 +979,7 @@ void st_init_extensions(struct pipe_screen *screen,
{ { o(ARB_texture_compression_bptc) },
{ PIPE_FORMAT_R8G8B8A8_UNORM,
PIPE_FORMAT_R8G8B8A8_SRGB,
PIPE_FORMAT_R32G32B32X32_FLOAT } },
PIPE_FORMAT_R16G16B16X16_FLOAT } },
{ { o(TDFX_texture_compression_FXT1) },
{ PIPE_FORMAT_FXT1_RGB,

View File

@@ -123,7 +123,7 @@ st_mesa_format_to_pipe_format(const struct st_context *st,
switch (mesaFormat) {
case MESA_FORMAT_BPTC_RGB_SIGNED_FLOAT:
case MESA_FORMAT_BPTC_RGB_UNSIGNED_FLOAT:
return PIPE_FORMAT_R32G32B32X32_FLOAT;
return PIPE_FORMAT_R16G16B16X16_FLOAT;
default:
return _mesa_is_format_srgb(mesaFormat) ? PIPE_FORMAT_R8G8B8A8_SRGB :
PIPE_FORMAT_R8G8B8A8_UNORM;