Mesa (master): radeonsi: skip generic out/ in indices without a shader IO index

Nicolai Hähnle nh at kemper.freedesktop.org
Fri May 12 08:46:41 UTC 2017


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

Author: Nicolai Hähnle <nicolai.haehnle at amd.com>
Date:   Wed May 10 13:26:39 2017 +0200

radeonsi: skip generic out/in indices without a shader IO index

OpenGL uses at most 32 generic outputs/inputs in any stage, and they always
have a shader IO index and therefore fit into the outputs_written/
inputs_read/kill_outputs fields.

However, Nine uses semantic indices more liberally. We support that
in VS-PS pipelines, except that the optimization of killing outputs
must be skipped.

Tested-by: Dieter Nützel <Dieter at nuetzel-hh.de>
Reviewed-by: Marek Olšák <marek.olsak at amd.com>

---

 src/gallium/drivers/radeonsi/si_shader.c        | 4 ++++
 src/gallium/drivers/radeonsi/si_state_shaders.c | 6 +++++-
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/src/gallium/drivers/radeonsi/si_shader.c b/src/gallium/drivers/radeonsi/si_shader.c
index bdc9cc10fa..98292867c8 100644
--- a/src/gallium/drivers/radeonsi/si_shader.c
+++ b/src/gallium/drivers/radeonsi/si_shader.c
@@ -2293,6 +2293,10 @@ static void si_llvm_export_vs(struct lp_build_tgsi_context *bld_base,
 		case TGSI_SEMANTIC_EDGEFLAG:
 			break;
 		case TGSI_SEMANTIC_GENERIC:
+			/* don't process indices the function can't handle */
+			if (semantic_index >= SI_MAX_IO_GENERIC)
+				break;
+			/* fall through */
 		case TGSI_SEMANTIC_CLIPDIST:
 			if (shader->key.opt.hw_vs.kill_outputs &
 			    (1ull << si_shader_io_get_unique_index(semantic_name, semantic_index)))
diff --git a/src/gallium/drivers/radeonsi/si_state_shaders.c b/src/gallium/drivers/radeonsi/si_state_shaders.c
index 8193fe041d..6020bec9c0 100644
--- a/src/gallium/drivers/radeonsi/si_state_shaders.c
+++ b/src/gallium/drivers/radeonsi/si_state_shaders.c
@@ -2032,8 +2032,12 @@ static void *si_create_shader_selector(struct pipe_context *ctx,
 			unsigned index = sel->info.input_semantic_index[i];
 
 			switch (name) {
-			case TGSI_SEMANTIC_CLIPDIST:
 			case TGSI_SEMANTIC_GENERIC:
+				/* don't process indices the function can't handle */
+				if (index >= SI_MAX_IO_GENERIC)
+					break;
+				/* fall through */
+			case TGSI_SEMANTIC_CLIPDIST:
 				sel->inputs_read |=
 					1llu << si_shader_io_get_unique_index(name, index);
 				break;




More information about the mesa-commit mailing list