Mesa (master): r600g: Implement BPTC texture support

Marek Olšák mareko at kemper.freedesktop.org
Thu Aug 14 23:57:35 UTC 2014


Module: Mesa
Branch: master
Commit: f23ee74791853137caabede52204167e938fdeeb
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=f23ee74791853137caabede52204167e938fdeeb

Author: Glenn Kennard <glenn.kennard at gmail.com>
Date:   Wed Aug 13 13:02:53 2014 +0200

r600g: Implement BPTC texture support

Requires Evergreen/Cayman

Signed-off-by: Glenn Kennard <glenn.kennard at gmail.com>
Signed-off-by: Marek Olšák <marek.olsak at amd.com>

---

 docs/GL3.txt                                 |    2 +-
 docs/relnotes/10.3.html                      |    2 +-
 src/gallium/drivers/r600/r600_state_common.c |   24 ++++++++++++++++++++++++
 3 files changed, 26 insertions(+), 2 deletions(-)

diff --git a/docs/GL3.txt b/docs/GL3.txt
index 9eba525..2c3fe28 100644
--- a/docs/GL3.txt
+++ b/docs/GL3.txt
@@ -131,7 +131,7 @@ GL 4.1, GLSL 4.10:
 
 GL 4.2, GLSL 4.20:
 
-  GL_ARB_texture_compression_bptc                      DONE (i965, nvc0)
+  GL_ARB_texture_compression_bptc                      DONE (i965, nvc0, r600)
   GL_ARB_compressed_texture_pixel_storage              DONE (all drivers)
   GL_ARB_shader_atomic_counters                        DONE (i965)
   GL_ARB_texture_storage                               DONE (all drivers)
diff --git a/docs/relnotes/10.3.html b/docs/relnotes/10.3.html
index 86cbabc..8ae1ec8 100644
--- a/docs/relnotes/10.3.html
+++ b/docs/relnotes/10.3.html
@@ -64,7 +64,7 @@ Note: some of the new features are only available with certain drivers.
 <li>GL_ARB_gpu_shader5 on nvc0</li>
 <li>A new software rasterizer driver (kms_swrast_dri.so) that works with
 DRM drivers that don't have a full-fledged GEM (such as qxl or simpledrm)</li>
-<li>GL_ARB_texture_compression_bptc on i965/gen7+, nvc0</li>
+<li>GL_ARB_texture_compression_bptc on i965/gen7+, nvc0, r600/evergreen+</li>
 <li>Distribute the Khronos GL/glcorearb.h header file.
 </ul>
 
diff --git a/src/gallium/drivers/r600/r600_state_common.c b/src/gallium/drivers/r600/r600_state_common.c
index 64a0277..d29e137 100644
--- a/src/gallium/drivers/r600/r600_state_common.c
+++ b/src/gallium/drivers/r600/r600_state_common.c
@@ -1971,6 +1971,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:
+				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:




More information about the mesa-commit mailing list