[Mesa-dev] [PATCH v2] r600g: Implement BPTC texture support

Glenn Kennard glenn.kennard at gmail.com
Sat Jul 26 07:36:33 PDT 2014


Signed-off-by: Glenn Kennard <glenn.kennard at gmail.com>
---
This patch depends on Ilia Mirkin's "nvc0: add BPTC format support"
and Neil Robert's core BPTC support patches.

Changes since patch v1:
Remove srgb flag from float formats.
Set RGB sign bits for BPTC_RGB_FLOAT.

This passes piglit, including newly written test for
float variants which will be sent to piglit mailing list
separately.

 src/gallium/drivers/r600/r600_state_common.c | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/src/gallium/drivers/r600/r600_state_common.c b/src/gallium/drivers/r600/r600_state_common.c
index 8c37d0d..98a2382 100644
--- a/src/gallium/drivers/r600/r600_state_common.c
+++ b/src/gallium/drivers/r600/r600_state_common.c
@@ -1967,6 +1967,30 @@ uint32_t r600_translate_texformat(struct pipe_screen *screen,
 		}
 	}
 
+	if (desc->layout == UTIL_FORMAT_LAYOUT_BPTC) {
+		if (!enable_s3tc)
+			goto out_unknown;
+
+		if (rscreen->b.chip_class < EVERGREEN)
+			goto out_unknown;
+
+		switch (format) {
+			case PIPE_FORMAT_BPTC_RGBA_UNORM:
+			case PIPE_FORMAT_BPTC_SRGBA_UNORM:
+				result = FMT_BC7;
+				is_srgb_valid = TRUE;
+				goto out_word4;
+			case PIPE_FORMAT_BPTC_RGB_FLOAT:
+				word4 |= sign_bit[0] | sign_bit[1] | sign_bit[2];
+				/* fall through */
+			case PIPE_FORMAT_BPTC_RGB_UFLOAT:
+				result = FMT_BC6;
+				goto out_word4;
+			default:
+				goto out_unknown;
+		}
+	}
+
 	if (desc->layout == UTIL_FORMAT_LAYOUT_SUBSAMPLED) {
 		switch (format) {
 		case PIPE_FORMAT_R8G8_B8G8_UNORM:
-- 
1.8.3.2



More information about the mesa-dev mailing list