mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-17 11:20:18 +01:00
zink: clean up opcode-emitting a bit
Acked-by: Jordan Justen <jordan.l.justen@intel.com>
This commit is contained in:
parent
55bcf9b1e0
commit
4e60d4d52a
1 changed files with 13 additions and 15 deletions
|
|
@ -783,16 +783,17 @@ emit_alu(struct ntv_context *ctx, nir_alu_instr *alu)
|
|||
result = emit_unop(ctx, spirv_op, dest_type, src[0]); \
|
||||
break;
|
||||
|
||||
UNOP(nir_op_fneg, SpvOpFNegate)
|
||||
UNOP(nir_op_fddx, SpvOpDPdx)
|
||||
UNOP(nir_op_fddy, SpvOpDPdy)
|
||||
#undef UNOP
|
||||
|
||||
#define BUILTIN_UNOP(nir_op, spirv_op) \
|
||||
case nir_op: \
|
||||
assert(nir_op_infos[alu->op].num_inputs == 1); \
|
||||
result = emit_builtin_unop(ctx, spirv_op, dest_type, src[0]); \
|
||||
break;
|
||||
|
||||
UNOP(nir_op_fneg, SpvOpFNegate)
|
||||
UNOP(nir_op_fddx, SpvOpDPdx)
|
||||
UNOP(nir_op_fddy, SpvOpDPdy)
|
||||
|
||||
BUILTIN_UNOP(nir_op_fabs, GLSLstd450FAbs)
|
||||
BUILTIN_UNOP(nir_op_fsqrt, GLSLstd450Sqrt)
|
||||
BUILTIN_UNOP(nir_op_frsq, GLSLstd450InverseSqrt)
|
||||
|
|
@ -806,6 +807,7 @@ emit_alu(struct ntv_context *ctx, nir_alu_instr *alu)
|
|||
BUILTIN_UNOP(nir_op_fsign, GLSLstd450FSign)
|
||||
BUILTIN_UNOP(nir_op_fsin, GLSLstd450Sin)
|
||||
BUILTIN_UNOP(nir_op_fcos, GLSLstd450Cos)
|
||||
#undef BUILTIN_UNOP
|
||||
|
||||
case nir_op_frcp: {
|
||||
assert(nir_op_infos[alu->op].num_inputs == 1);
|
||||
|
|
@ -816,21 +818,12 @@ emit_alu(struct ntv_context *ctx, nir_alu_instr *alu)
|
|||
}
|
||||
break;
|
||||
|
||||
#undef UNOP
|
||||
#undef BUILTIN_UNOP
|
||||
|
||||
#define BINOP(nir_op, spirv_op) \
|
||||
case nir_op: \
|
||||
assert(nir_op_infos[alu->op].num_inputs == 2); \
|
||||
result = emit_binop(ctx, spirv_op, dest_type, src[0], src[1]); \
|
||||
break;
|
||||
|
||||
#define BUILTIN_BINOP(nir_op, spirv_op) \
|
||||
case nir_op: \
|
||||
assert(nir_op_infos[alu->op].num_inputs == 2); \
|
||||
result = emit_builtin_binop(ctx, spirv_op, dest_type, src[0], src[1]); \
|
||||
break;
|
||||
|
||||
BINOP(nir_op_iadd, SpvOpIAdd)
|
||||
BINOP(nir_op_isub, SpvOpISub)
|
||||
BINOP(nir_op_imul, SpvOpIMul)
|
||||
|
|
@ -840,11 +833,16 @@ emit_alu(struct ntv_context *ctx, nir_alu_instr *alu)
|
|||
BINOP(nir_op_fmod, SpvOpFMod)
|
||||
BINOP(nir_op_flt, SpvOpFUnordLessThan)
|
||||
BINOP(nir_op_fge, SpvOpFUnordGreaterThanEqual)
|
||||
#undef BINOP
|
||||
|
||||
#define BUILTIN_BINOP(nir_op, spirv_op) \
|
||||
case nir_op: \
|
||||
assert(nir_op_infos[alu->op].num_inputs == 2); \
|
||||
result = emit_builtin_binop(ctx, spirv_op, dest_type, src[0], src[1]); \
|
||||
break;
|
||||
|
||||
BUILTIN_BINOP(nir_op_fmin, GLSLstd450FMin)
|
||||
BUILTIN_BINOP(nir_op_fmax, GLSLstd450FMax)
|
||||
|
||||
#undef BINOP
|
||||
#undef BUILTIN_BINOP
|
||||
|
||||
case nir_op_fdot2:
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue