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)
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);
}
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)
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: