From 17cde55c538009764207bd29b78a909d2c5d14b4 Mon Sep 17 00:00:00 2001 From: Neil Roberts Date: Thu, 17 Jul 2014 14:33:10 +0100 Subject: mesa: Add texstore functions for BPTC-compressed textures This adds compressors for all four of the BPTC compressed-texture formats. The compressor is written from scratch and takes a very simple approach. It always uses a single mode of the BPTC format (4 for unorm and 3 for half-floats) and picks the two endpoints by dividing the texels into those which have more or less than the average luminance of the block and then calculating an average color of the texels within each division. It's probably not really sensible to try to use BPTC compression at runtime because for example with the Nvidia offline compression tool it can take in the order of an hour to compress a full-screen image. With that in mind I don't think it's worth having a proper compressor in Mesa and this approach gives reasonable results for a usage that is basically a corner case. v2: Always use the custom compressor, even for the unorm formats. Fix the quantization step for the half-float format compressor. Fixed a typo which was breaking the right-hand edge of half-float textures with a width that isn't a multiple of four. Reviewed-by: Ian Romanick --- src/mesa/main/texcompress_bptc.h | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/mesa/main/texcompress_bptc.h') diff --git a/src/mesa/main/texcompress_bptc.h b/src/mesa/main/texcompress_bptc.h index ad5ff50a649..814548e2bcc 100644 --- a/src/mesa/main/texcompress_bptc.h +++ b/src/mesa/main/texcompress_bptc.h @@ -27,6 +27,16 @@ #include #include "glheader.h" #include "texcompress.h" +#include "texstore.h" + +GLboolean +_mesa_texstore_bptc_rgba_unorm(TEXSTORE_PARAMS); + +GLboolean +_mesa_texstore_bptc_rgb_signed_float(TEXSTORE_PARAMS); + +GLboolean +_mesa_texstore_bptc_rgb_unsigned_float(TEXSTORE_PARAMS); compressed_fetch_func _mesa_get_bptc_fetch_func(mesa_format format); -- cgit v1.2.3