summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/svga
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2014-04-15 09:13:04 -0700
committerBrian Paul <[email protected]>2014-04-17 11:29:32 -0700
commit8e131576eede26ebfd5e6d18f09642bdccb6be0f (patch)
treed276cdf2d8cdf97a54b3ddab2d266c05bd29e5f9 /src/gallium/drivers/svga
parent71846a943f9b699d0f234d919dcb8d1934943693 (diff)
svga: use new inst_token_predicated() helper function
Reviewed-by: Charmaine Lee <[email protected]>
Diffstat (limited to 'src/gallium/drivers/svga')
-rw-r--r--src/gallium/drivers/svga/svga_tgsi_emit.h17
-rw-r--r--src/gallium/drivers/svga/svga_tgsi_insn.c21
2 files changed, 25 insertions, 13 deletions
diff --git a/src/gallium/drivers/svga/svga_tgsi_emit.h b/src/gallium/drivers/svga/svga_tgsi_emit.h
index 53f93de28d3..0141d71568e 100644
--- a/src/gallium/drivers/svga/svga_tgsi_emit.h
+++ b/src/gallium/drivers/svga/svga_tgsi_emit.h
@@ -189,6 +189,23 @@ inst_token(unsigned opcode)
/**
+ * Generate a SVGA3dShaderInstToken for the given SVGA3D shader opcode
+ * with the predication flag set.
+ */
+static INLINE SVGA3dShaderInstToken
+inst_token_predicated(unsigned opcode)
+{
+ SVGA3dShaderInstToken inst;
+
+ inst.value = 0;
+ inst.op = opcode;
+ inst.predicated = 1;
+
+ return inst;
+}
+
+
+/**
* Create an instance of a SVGA3dShaderDestToken.
* Note that this function is used to create tokens for output registers,
* temp registers AND constants (see emit_def_const()).
diff --git a/src/gallium/drivers/svga/svga_tgsi_insn.c b/src/gallium/drivers/svga/svga_tgsi_insn.c
index 73303e35222..3ed724020b5 100644
--- a/src/gallium/drivers/svga/svga_tgsi_insn.c
+++ b/src/gallium/drivers/svga/svga_tgsi_insn.c
@@ -1530,7 +1530,7 @@ emit_conditional(struct svga_shader_emitter *emit,
struct src_register fail)
{
SVGA3dShaderDestToken pred_reg = dst_register( SVGA3DREG_PREDICATE, 0 );
- SVGA3dShaderInstToken setp_token, mov_token;
+ SVGA3dShaderInstToken setp_token;
setp_token = inst_token( SVGA3DOP_SETP );
switch (compare_func) {
@@ -1577,11 +1577,8 @@ emit_conditional(struct svga_shader_emitter *emit,
src0, src1 ))
return FALSE;
- mov_token = inst_token( SVGA3DOP_MOV );
-
/* MOV dst, fail */
- if (!submit_op1( emit, mov_token, dst,
- fail ))
+ if (!submit_op1(emit, inst_token(SVGA3DOP_MOV), dst, fail))
return FALSE;
/* MOV dst, pass (predicated)
@@ -1589,9 +1586,9 @@ emit_conditional(struct svga_shader_emitter *emit,
* Note that the predicate reg (and possible modifiers) is passed
* as the first source argument.
*/
- mov_token.predicated = 1;
- if (!submit_op2( emit, mov_token, dst,
- src( pred_reg ), pass ))
+ if (!submit_op2(emit,
+ inst_token_predicated(SVGA3DOP_MOV), dst,
+ src(pred_reg), pass))
return FALSE;
return TRUE;
@@ -2560,12 +2557,10 @@ emit_lit(struct svga_shader_emitter *emit,
*/
{
SVGA3dShaderDestToken pred_reg = dst_register( SVGA3DREG_PREDICATE, 0 );
- SVGA3dShaderInstToken setp_token, mov_token;
+ SVGA3dShaderInstToken setp_token;
struct src_register predsrc;
setp_token = inst_token( SVGA3DOP_SETP );
- mov_token = inst_token( SVGA3DOP_MOV );
-
setp_token.control = SVGA3DOPCOMP_GT;
/* D3D vs GL semantics:
@@ -2592,8 +2587,8 @@ emit_lit(struct svga_shader_emitter *emit,
* as the first source argument.
*/
if (dst.mask & TGSI_WRITEMASK_YZ) {
- mov_token.predicated = 1;
- if (!submit_op2( emit, mov_token,
+ if (!submit_op2( emit,
+ inst_token_predicated(SVGA3DOP_MOV),
writemask(dst, TGSI_WRITEMASK_YZ),
src( pred_reg ), src( tmp ) ))
return FALSE;