mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-06 15:20:17 +01:00
i965: Add support for OPCODE_SSG.
The old compiler didn't use SSG, and instead emitted SGT/SGT/SUB. We can do a little better for SSG than we do for the SGT series.
This commit is contained in:
parent
d6ebe9b16b
commit
e558786a3e
5 changed files with 54 additions and 0 deletions
|
|
@ -485,6 +485,23 @@ static void emit_cmp( struct brw_compile *p,
|
|||
brw_set_predicate_control(p, BRW_PREDICATE_NONE);
|
||||
}
|
||||
|
||||
static void emit_sign(struct brw_vs_compile *c,
|
||||
struct brw_reg dst,
|
||||
struct brw_reg arg0)
|
||||
{
|
||||
struct brw_compile *p = &c->func;
|
||||
|
||||
brw_MOV(p, dst, brw_imm_f(0));
|
||||
|
||||
brw_CMP(p, brw_null_reg(), BRW_CONDITIONAL_L, arg0, brw_imm_f(0));
|
||||
brw_MOV(p, dst, brw_imm_f(-1.0));
|
||||
brw_set_predicate_control(p, BRW_PREDICATE_NONE);
|
||||
|
||||
brw_CMP(p, brw_null_reg(), BRW_CONDITIONAL_G, arg0, brw_imm_f(0));
|
||||
brw_MOV(p, dst, brw_imm_f(1.0));
|
||||
brw_set_predicate_control(p, BRW_PREDICATE_NONE);
|
||||
}
|
||||
|
||||
static void emit_max( struct brw_compile *p,
|
||||
struct brw_reg dst,
|
||||
struct brw_reg arg0,
|
||||
|
|
@ -1719,6 +1736,9 @@ void brw_vs_emit(struct brw_vs_compile *c )
|
|||
case OPCODE_SLE:
|
||||
unalias2(c, dst, args[0], args[1], emit_sle);
|
||||
break;
|
||||
case OPCODE_SSG:
|
||||
unalias1(c, dst, args[0], emit_sign);
|
||||
break;
|
||||
case OPCODE_SUB:
|
||||
brw_ADD(p, dst, args[0], negate(args[1]));
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -425,6 +425,10 @@ void emit_sop(struct brw_compile *p,
|
|||
GLuint cond,
|
||||
const struct brw_reg *arg0,
|
||||
const struct brw_reg *arg1);
|
||||
void emit_sign(struct brw_compile *p,
|
||||
const struct brw_reg *dst,
|
||||
GLuint mask,
|
||||
const struct brw_reg *arg0);
|
||||
void emit_tex(struct brw_wm_compile *c,
|
||||
struct brw_reg *dst,
|
||||
GLuint dst_flags,
|
||||
|
|
|
|||
|
|
@ -668,6 +668,28 @@ void emit_cmp(struct brw_compile *p,
|
|||
}
|
||||
}
|
||||
|
||||
void emit_sign(struct brw_compile *p,
|
||||
const struct brw_reg *dst,
|
||||
GLuint mask,
|
||||
const struct brw_reg *arg0)
|
||||
{
|
||||
GLuint i;
|
||||
|
||||
for (i = 0; i < 4; i++) {
|
||||
if (mask & (1<<i)) {
|
||||
brw_MOV(p, dst[i], brw_imm_f(0.0));
|
||||
|
||||
brw_CMP(p, brw_null_reg(), BRW_CONDITIONAL_L, arg0[i], brw_imm_f(0));
|
||||
brw_MOV(p, dst[i], brw_imm_f(-1.0));
|
||||
brw_set_predicate_control(p, BRW_PREDICATE_NONE);
|
||||
|
||||
brw_CMP(p, brw_null_reg(), BRW_CONDITIONAL_G, arg0[i], brw_imm_f(0));
|
||||
brw_MOV(p, dst[i], brw_imm_f(1.0));
|
||||
brw_set_predicate_control(p, BRW_PREDICATE_NONE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void emit_max(struct brw_compile *p,
|
||||
const struct brw_reg *dst,
|
||||
GLuint mask,
|
||||
|
|
@ -1673,6 +1695,10 @@ void brw_wm_emit( struct brw_wm_compile *c )
|
|||
emit_sne(p, dst, dst_flags, args[0], args[1]);
|
||||
break;
|
||||
|
||||
case OPCODE_SSG:
|
||||
emit_sign(p, dst, dst_flags, args[0]);
|
||||
break;
|
||||
|
||||
case OPCODE_LIT:
|
||||
emit_lit(c, dst, dst_flags, args[0]);
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -1971,6 +1971,9 @@ static void brw_wm_emit_glsl(struct brw_context *brw, struct brw_wm_compile *c)
|
|||
emit_sop(p, dst, dst_flags,
|
||||
BRW_CONDITIONAL_NEQ, args[0], args[1]);
|
||||
break;
|
||||
case OPCODE_SSG:
|
||||
emit_sign(p, dst, dst_flags, args[0]);
|
||||
break;
|
||||
case OPCODE_MUL:
|
||||
emit_alu2(p, brw_MUL, dst, dst_flags, args[0], args[1]);
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -158,6 +158,7 @@ void brw_wm_pass1( struct brw_wm_compile *c )
|
|||
case OPCODE_FLR:
|
||||
case OPCODE_FRC:
|
||||
case OPCODE_MOV:
|
||||
case OPCODE_SSG:
|
||||
case OPCODE_SWZ:
|
||||
case OPCODE_TRUNC:
|
||||
read0 = writemask;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue