svga: minor code movement in svga_tgsi_insn.c
Reviewed-by: José Fonseca <jfonseca@vmware.com>
This commit is contained in:
parent
f12954e1cb
commit
a15eb19676
|
@ -728,45 +728,6 @@ alias_src_dst(struct src_register src,
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Translate/emit a LRP (linear interpolation) instruction.
|
||||
*/
|
||||
static boolean
|
||||
submit_lrp(struct svga_shader_emitter *emit,
|
||||
SVGA3dShaderDestToken dst,
|
||||
struct src_register src0,
|
||||
struct src_register src1,
|
||||
struct src_register src2)
|
||||
{
|
||||
SVGA3dShaderDestToken tmp;
|
||||
boolean need_dst_tmp = FALSE;
|
||||
|
||||
/* The dst reg must be a temporary, and not be the same as src0 or src2 */
|
||||
if (SVGA3dShaderGetRegType(dst.value) != SVGA3DREG_TEMP ||
|
||||
alias_src_dst(src0, dst) ||
|
||||
alias_src_dst(src2, dst))
|
||||
need_dst_tmp = TRUE;
|
||||
|
||||
if (need_dst_tmp) {
|
||||
tmp = get_temp( emit );
|
||||
tmp.mask = dst.mask;
|
||||
}
|
||||
else {
|
||||
tmp = dst;
|
||||
}
|
||||
|
||||
if (!submit_op3(emit, inst_token( SVGA3DOP_LRP ), tmp, src0, src1, src2))
|
||||
return FALSE;
|
||||
|
||||
if (need_dst_tmp) {
|
||||
if (!submit_op1(emit, inst_token( SVGA3DOP_MOV ), dst, src( tmp )))
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Helper for emitting SVGA immediate values using the SVGA3DOP_DEF[I]
|
||||
* instructions.
|
||||
|
@ -1091,6 +1052,14 @@ emit_if(struct svga_shader_emitter *emit,
|
|||
}
|
||||
|
||||
|
||||
static boolean
|
||||
emit_else(struct svga_shader_emitter *emit,
|
||||
const struct tgsi_full_instruction *insn)
|
||||
{
|
||||
return emit_instruction(emit, inst_token(SVGA3DOP_ELSE));
|
||||
}
|
||||
|
||||
|
||||
static boolean
|
||||
emit_endif(struct svga_shader_emitter *emit,
|
||||
const struct tgsi_full_instruction *insn)
|
||||
|
@ -1101,14 +1070,6 @@ emit_endif(struct svga_shader_emitter *emit,
|
|||
}
|
||||
|
||||
|
||||
static boolean
|
||||
emit_else(struct svga_shader_emitter *emit,
|
||||
const struct tgsi_full_instruction *insn)
|
||||
{
|
||||
return emit_instruction(emit, inst_token(SVGA3DOP_ELSE));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Translate the following TGSI FLR instruction.
|
||||
* FLR DST, SRC
|
||||
|
@ -2334,6 +2295,45 @@ emit_xpd(struct svga_shader_emitter *emit,
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Emit a LRP (linear interpolation) instruction.
|
||||
*/
|
||||
static boolean
|
||||
submit_lrp(struct svga_shader_emitter *emit,
|
||||
SVGA3dShaderDestToken dst,
|
||||
struct src_register src0,
|
||||
struct src_register src1,
|
||||
struct src_register src2)
|
||||
{
|
||||
SVGA3dShaderDestToken tmp;
|
||||
boolean need_dst_tmp = FALSE;
|
||||
|
||||
/* The dst reg must be a temporary, and not be the same as src0 or src2 */
|
||||
if (SVGA3dShaderGetRegType(dst.value) != SVGA3DREG_TEMP ||
|
||||
alias_src_dst(src0, dst) ||
|
||||
alias_src_dst(src2, dst))
|
||||
need_dst_tmp = TRUE;
|
||||
|
||||
if (need_dst_tmp) {
|
||||
tmp = get_temp( emit );
|
||||
tmp.mask = dst.mask;
|
||||
}
|
||||
else {
|
||||
tmp = dst;
|
||||
}
|
||||
|
||||
if (!submit_op3(emit, inst_token( SVGA3DOP_LRP ), tmp, src0, src1, src2))
|
||||
return FALSE;
|
||||
|
||||
if (need_dst_tmp) {
|
||||
if (!submit_op1(emit, inst_token( SVGA3DOP_MOV ), dst, src( tmp )))
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Translate/emit LRP (Linear Interpolation) instruction.
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue