Mesa (master): r600g: disable I2F conversion for InstanceID if integers are supported

Dave Airlie airlied at kemper.freedesktop.org
Fri Apr 20 16:48:15 UTC 2012


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

Author: Vadim Girlin <vadimgirlin at gmail.com>
Date:   Mon Apr  9 19:35:40 2012 +0400

r600g: disable I2F conversion for InstanceID if integers are supported

Signed-off-by: Vadim Girlin <vadimgirlin at gmail.com>
Reviewed-by: Michel Dänzer <michel at daenzer.net>
Signed-off-by: Dave Airlie <airlied at redhat.com>

---

 src/gallium/drivers/r600/r600_shader.c |   27 ++++++++++++++++-----------
 1 files changed, 16 insertions(+), 11 deletions(-)

diff --git a/src/gallium/drivers/r600/r600_shader.c b/src/gallium/drivers/r600/r600_shader.c
index 4932dcc..9d85de0 100644
--- a/src/gallium/drivers/r600/r600_shader.c
+++ b/src/gallium/drivers/r600/r600_shader.c
@@ -194,6 +194,7 @@ struct r600_shader_ctx {
 	boolean                 clip_vertex_write;
 	unsigned                cv_output;
 	int					fragcoord_input;
+	int					native_integers;
 };
 
 struct r600_shader_tgsi_instruction {
@@ -500,20 +501,22 @@ static int tgsi_declaration(struct r600_shader_ctx *ctx)
 
 	case TGSI_FILE_SYSTEM_VALUE:
 		if (d->Semantic.Name == TGSI_SEMANTIC_INSTANCEID) {
-			struct r600_bytecode_alu alu;
-			memset(&alu, 0, sizeof(struct r600_bytecode_alu));
+			if (!ctx->native_integers) {
+				struct r600_bytecode_alu alu;
+				memset(&alu, 0, sizeof(struct r600_bytecode_alu));
 
-			alu.inst = CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_INT_TO_FLT);
-			alu.src[0].sel = 0;
-			alu.src[0].chan = 3;
+				alu.inst = CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_INT_TO_FLT);
+				alu.src[0].sel = 0;
+				alu.src[0].chan = 3;
 
-			alu.dst.sel = 0;
-			alu.dst.chan = 3;
-			alu.dst.write = 1;
-			alu.last = 1;
+				alu.dst.sel = 0;
+				alu.dst.chan = 3;
+				alu.dst.write = 1;
+				alu.last = 1;
 
-			if ((r = r600_bytecode_add_alu(ctx->bc, &alu)))
-				return r;
+				if ((r = r600_bytecode_add_alu(ctx->bc, &alu)))
+					return r;
+			}
 			break;
 		} else if (d->Semantic.Name == TGSI_SEMANTIC_VERTEXID)
 			break;
@@ -818,6 +821,8 @@ static int r600_shader_from_tgsi(struct r600_context * rctx, struct r600_pipe_sh
 
 	ctx.bc = &shader->bc;
 	ctx.shader = shader;
+	ctx.native_integers = (rctx->screen->glsl_feature_level >= 130);
+
 	r600_bytecode_init(ctx.bc, rctx->chip_class, rctx->family);
 	ctx.tokens = tokens;
 	tgsi_scan_shader(tokens, &ctx.info);




More information about the mesa-commit mailing list