mesa: add _mesa_unpack_bptc-function

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-10 11:16:28 +02:00 committed by Marge Bot
parent 529e70271f
commit 2b7dfd8de1
2 changed files with 43 additions and 0 deletions

View file

@ -26,6 +26,8 @@
* GL_ARB_texture_compression_bptc support.
*/
#define BPTC_BLOCK_DECODE
#include <stdbool.h>
#include "texcompress.h"
#include "texcompress_bptc.h"
@ -241,3 +243,35 @@ _mesa_texstore_bptc_rgb_unsigned_float(TEXSTORE_PARAMS)
srcAddr, srcPacking,
false /* unsigned */);
}
void
_mesa_unpack_bptc(uint8_t *dst_row,
unsigned dst_stride,
const uint8_t *src_row,
unsigned src_stride,
unsigned src_width,
unsigned src_height,
mesa_format format)
{
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,
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);
break;
default:
decompress_rgba_unorm(src_width, src_height,
src_row, src_stride,
dst_row, dst_stride);
break;
}
}

View file

@ -41,4 +41,13 @@ _mesa_texstore_bptc_rgb_unsigned_float(TEXSTORE_PARAMS);
compressed_fetch_func
_mesa_get_bptc_fetch_func(mesa_format format);
void
_mesa_unpack_bptc(uint8_t *dst_row,
unsigned dst_stride,
const uint8_t *src_row,
unsigned src_stride,
unsigned src_width,
unsigned src_height,
mesa_format format);
#endif