diff options
author | Erik Faye-Lund <[email protected]> | 2019-07-11 14:22:59 +0200 |
---|---|---|
committer | Erik Faye-Lund <[email protected]> | 2019-10-28 08:51:46 +0000 |
commit | 4e60d4d52af358fc81332c6121d2e556bf302e73 (patch) | |
tree | aa5b613c72b448bb335afc191f319beac0ecd311 /src/gallium/drivers/zink/nir_to_spirv | |
parent | 55bcf9b1e0bc58ef52667db752a53be07343afb8 (diff) |
zink: clean up opcode-emitting a bit
Acked-by: Jordan Justen <[email protected]>
Diffstat (limited to 'src/gallium/drivers/zink/nir_to_spirv')
-rw-r--r-- | src/gallium/drivers/zink/nir_to_spirv/nir_to_spirv.c | 28 |
1 files changed, 13 insertions, 15 deletions
diff --git a/src/gallium/drivers/zink/nir_to_spirv/nir_to_spirv.c b/src/gallium/drivers/zink/nir_to_spirv/nir_to_spirv.c index f7a7024212c..074bc007504 100644 --- a/src/gallium/drivers/zink/nir_to_spirv/nir_to_spirv.c +++ b/src/gallium/drivers/zink/nir_to_spirv/nir_to_spirv.c @@ -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: |