[Mesa-dev] [PATCH] radeonsi: implement BPTC texture support

Grigori Goronzy greg at chown.ath.cx
Wed Jul 23 14:00:59 PDT 2014


Passes corrected piglit test and should also handle signed vs unsigned
float correctly.
---
 src/gallium/drivers/radeonsi/si_state.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/src/gallium/drivers/radeonsi/si_state.c b/src/gallium/drivers/radeonsi/si_state.c
index 3dec536..6b64e7c 100644
--- a/src/gallium/drivers/radeonsi/si_state.c
+++ b/src/gallium/drivers/radeonsi/si_state.c
@@ -1102,6 +1102,22 @@ static uint32_t si_translate_texformat(struct pipe_screen *screen,
 		}
 	}
 
+	if (desc->layout == UTIL_FORMAT_LAYOUT_BPTC) {
+		if (!enable_s3tc)
+			goto out_unknown;
+
+		switch (format) {
+		case PIPE_FORMAT_BPTC_RGBA_UNORM:
+		case PIPE_FORMAT_BPTC_SRGBA_UNORM:
+			return V_008F14_IMG_DATA_FORMAT_BC7;
+		case PIPE_FORMAT_BPTC_RGB_FLOAT:
+		case PIPE_FORMAT_BPTC_RGB_UFLOAT:
+			return V_008F14_IMG_DATA_FORMAT_BC6;
+		default:
+			goto out_unknown;
+		}
+	}
+
 	if (desc->layout == UTIL_FORMAT_LAYOUT_SUBSAMPLED) {
 		switch (format) {
 		case PIPE_FORMAT_R8G8_B8G8_UNORM:
@@ -2467,12 +2483,16 @@ static struct pipe_sampler_view *si_create_sampler_view(struct pipe_context *ctx
 				case PIPE_FORMAT_DXT1_SRGBA:
 				case PIPE_FORMAT_DXT3_SRGBA:
 				case PIPE_FORMAT_DXT5_SRGBA:
+				case PIPE_FORMAT_BPTC_SRGBA_UNORM:
 					num_format = V_008F14_IMG_NUM_FORMAT_SRGB;
 					break;
 				case PIPE_FORMAT_RGTC1_SNORM:
 				case PIPE_FORMAT_LATC1_SNORM:
 				case PIPE_FORMAT_RGTC2_SNORM:
 				case PIPE_FORMAT_LATC2_SNORM:
+				/* implies float, so use SNORM/UNORM to determine
+				   whether data is signed or not */
+				case PIPE_FORMAT_BPTC_RGB_FLOAT:
 					num_format = V_008F14_IMG_NUM_FORMAT_SNORM;
 					break;
 				default:
-- 
1.8.3.2



More information about the mesa-dev mailing list