[Mesa-dev] [PATCH] radeonsi: implement TGSI_SEMANTIC_HELPER_INVOCATION

Nicolai Hähnle nhaehnle at gmail.com
Sat Apr 16 18:06:37 UTC 2016


From: Nicolai Hähnle <nicolai.haehnle at amd.com>

---
We will soon claim GLES 3.1 support, which requires gl_HelperInvocation,
so now is the time to do this.

This depends on LLVM support: http://reviews.llvm.org/D19191

 docs/GL3.txt                             |  2 +-
 src/gallium/drivers/radeonsi/si_shader.c | 11 +++++++++++
 2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/docs/GL3.txt b/docs/GL3.txt
index 6b5e016..d36c187 100644
--- a/docs/GL3.txt
+++ b/docs/GL3.txt
@@ -248,7 +248,7 @@ GLES3.1, GLSL ES 3.1
       glMemoryBarrierByRegion                           DONE
       glGetTexLevelParameter[fi]v - needs updates       DONE
       glGetBooleani_v - restrict to GLES enums
-      gl_HelperInvocation support                       DONE (i965, nvc0, r600)
+      gl_HelperInvocation support                       DONE (i965, nvc0, r600, radeonsi)
 
 GLES3.2, GLSL ES 3.2
   GL_EXT_color_buffer_float                             DONE (all drivers)
diff --git a/src/gallium/drivers/radeonsi/si_shader.c b/src/gallium/drivers/radeonsi/si_shader.c
index de4c45c..dcbdde3 100644
--- a/src/gallium/drivers/radeonsi/si_shader.c
+++ b/src/gallium/drivers/radeonsi/si_shader.c
@@ -1314,6 +1314,17 @@ static void declare_system_value(
 		value = LLVMGetParam(radeon_bld->main_fn, SI_PARAM_THREAD_ID);
 		break;
 
+#if HAVE_LLVM >= 0x0309
+	case TGSI_SEMANTIC_HELPER_INVOCATION:
+		value = lp_build_intrinsic(gallivm->builder,
+					   "llvm.amdgcn.ps.live",
+					   ctx->i1, NULL, 0,
+					   LLVMReadNoneAttribute | LLVMNoUnwindAttribute);
+		value = LLVMBuildNot(gallivm->builder, value, "");
+		value = LLVMBuildSExt(gallivm->builder, value, ctx->i32, "");
+		break;
+#endif
+
 	default:
 		assert(!"unknown system value");
 		return;
-- 
2.5.0



More information about the mesa-dev mailing list