diff options
author | Brian Paul <[email protected]> | 2014-04-15 09:18:46 -0700 |
---|---|---|
committer | Brian Paul <[email protected]> | 2014-04-17 11:29:32 -0700 |
commit | 7c7ab5434aee1a40d1252ca10ac90a70dfd62174 (patch) | |
tree | 364f5e623144aeaf9816d4a5d91fdff79a87831e | |
parent | 8e131576eede26ebfd5e6d18f09642bdccb6be0f (diff) |
svga: use new inst_token_setp() helper function
Reviewed-by: Charmaine Lee <[email protected]>
-rw-r--r-- | src/gallium/drivers/svga/svga_tgsi_emit.h | 17 | ||||
-rw-r--r-- | src/gallium/drivers/svga/svga_tgsi_insn.c | 21 |
2 files changed, 26 insertions, 12 deletions
diff --git a/src/gallium/drivers/svga/svga_tgsi_emit.h b/src/gallium/drivers/svga/svga_tgsi_emit.h index 0141d71568e..1a9731ffde8 100644 --- a/src/gallium/drivers/svga/svga_tgsi_emit.h +++ b/src/gallium/drivers/svga/svga_tgsi_emit.h @@ -206,6 +206,23 @@ inst_token_predicated(unsigned opcode) /** + * Generate a SVGA3dShaderInstToken for a SETP instruction (set predicate) + * using the given comparison operator (one of SVGA3DOPCOMP_xx). + */ +static INLINE SVGA3dShaderInstToken +inst_token_setp(unsigned operator) +{ + SVGA3dShaderInstToken inst; + + inst.value = 0; + inst.op = SVGA3DOP_SETP; + inst.control = operator; + + 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 3ed724020b5..d3570582404 100644 --- a/src/gallium/drivers/svga/svga_tgsi_insn.c +++ b/src/gallium/drivers/svga/svga_tgsi_insn.c @@ -1531,7 +1531,6 @@ emit_conditional(struct svga_shader_emitter *emit, { SVGA3dShaderDestToken pred_reg = dst_register( SVGA3DREG_PREDICATE, 0 ); SVGA3dShaderInstToken setp_token; - setp_token = inst_token( SVGA3DOP_SETP ); switch (compare_func) { case PIPE_FUNC_NEVER: @@ -1539,22 +1538,22 @@ emit_conditional(struct svga_shader_emitter *emit, dst, fail ); break; case PIPE_FUNC_LESS: - setp_token.control = SVGA3DOPCOMP_LT; + setp_token = inst_token_setp(SVGA3DOPCOMP_LT); break; case PIPE_FUNC_EQUAL: - setp_token.control = SVGA3DOPCOMP_EQ; + setp_token = inst_token_setp(SVGA3DOPCOMP_EQ); break; case PIPE_FUNC_LEQUAL: - setp_token.control = SVGA3DOPCOMP_LE; + setp_token = inst_token_setp(SVGA3DOPCOMP_LE); break; case PIPE_FUNC_GREATER: - setp_token.control = SVGA3DOPCOMP_GT; + setp_token = inst_token_setp(SVGA3DOPCOMP_GT); break; case PIPE_FUNC_NOTEQUAL: - setp_token.control = SVGA3DOPCOMPC_NE; + setp_token = inst_token_setp(SVGA3DOPCOMPC_NE); break; case PIPE_FUNC_GEQUAL: - setp_token.control = SVGA3DOPCOMP_GE; + setp_token = inst_token_setp(SVGA3DOPCOMP_GE); break; case PIPE_FUNC_ALWAYS: return submit_op1( emit, inst_token( SVGA3DOP_MOV ), @@ -2557,12 +2556,8 @@ emit_lit(struct svga_shader_emitter *emit, */ { SVGA3dShaderDestToken pred_reg = dst_register( SVGA3DREG_PREDICATE, 0 ); - SVGA3dShaderInstToken setp_token; struct src_register predsrc; - setp_token = inst_token( SVGA3DOP_SETP ); - setp_token.control = SVGA3DOPCOMP_GT; - /* D3D vs GL semantics: */ if (0) @@ -2571,7 +2566,9 @@ emit_lit(struct svga_shader_emitter *emit, predsrc = swizzle(src0, 0, 0, 0, 0); /* GL */ /* SETP src0.xxyy, GT, {0}.x */ - if (!submit_op2( emit, setp_token, pred_reg, + if (!submit_op2( emit, + inst_token_setp(SVGA3DOPCOMP_GT), + pred_reg, predsrc, get_zero_immediate(emit))) return FALSE; |