#include "program.h"
#include "compiler/nir/nir_control_flow.h"
#include "compiler/nir/nir_builder.h"
+#include "compiler/nir/nir_builtin_builder.h"
#include "compiler/nir/nir_deref.h"
#include "main/errors.h"
#include "main/imports.h"
return;
}
+ case ir_unop_atan:
+ result = nir_atan(&b, srcs[0]);
+ break;
+
case ir_binop_add:
result = type_is_float(out_type) ? nir_fadd(&b, srcs[0], srcs[1])
: nir_iadd(&b, srcs[0], srcs[1]);
break;
}
+ case ir_binop_atan2:
+ result = nir_atan2(&b, srcs[0], srcs[1]);
+ break;
+
case ir_binop_ldexp: result = nir_ldexp(&b, srcs[0], srcs[1]); break;
case ir_triop_fma:
result = nir_ffma(&b, srcs[0], srcs[1], srcs[2]);
case ir_unop_bitfield_reverse:
case ir_unop_interpolate_at_centroid:
case ir_unop_saturate:
+ case ir_unop_atan:
this->type = op0->type;
break;
case ir_binop_mul:
case ir_binop_div:
case ir_binop_mod:
+ case ir_binop_atan2:
if (op0->type->is_scalar()) {
this->type = op1->type;
} else if (op1->type->is_scalar()) {
# Trigonometric operations.
operation("sin", 1, source_types=(float_type,), c_expression="sinf({src0})"),
operation("cos", 1, source_types=(float_type,), c_expression="cosf({src0})"),
+ operation("atan", 1, source_types=(float_type,), c_expression="atan({src0})"),
# Partial derivatives.
operation("dFdx", 1, source_types=(float_type,), c_expression="0.0f"),
# operand1 is the sample ID
operation("interpolate_at_sample", 2),
+ operation("atan2", 2, source_types=(float_type,), c_expression="atan2({src0}, {src1})"),
+
# Fused floating-point multiply-add, part of ARB_gpu_shader5.
operation("fma", 3, source_types=real_types, c_expression="{src0} * {src1} + {src2}"),
assert(ir->type->base_type == GLSL_TYPE_INT);
break;
+ case ir_unop_atan:
+ assert(ir->operands[0]->type->is_float() ||
+ ir->operands[0]->type->is_double());
+ assert(ir->type == ir->operands[0]->type);
+ break;
+
case ir_binop_add:
case ir_binop_sub:
case ir_binop_mul:
assert(ir->operands[1]->type == glsl_type::int_type);
break;
+ case ir_binop_atan2:
+ assert(ir->operands[0]->type->is_float() ||
+ ir->operands[0]->type->is_double());
+ assert(ir->operands[1]->type == ir->operands[0]->type);
+ assert(ir->type == ir->operands[0]->type);
+ break;
+
case ir_triop_fma:
assert(ir->type->is_float() ||
ir->type->is_double());
case ir_unop_unpack_sampler_2x32:
case ir_unop_pack_image_2x32:
case ir_unop_unpack_image_2x32:
+ case ir_unop_atan:
+ case ir_binop_atan2:
assert(!"not supported");
break;
case ir_binop_carry:
case ir_binop_borrow:
case ir_unop_ssbo_unsized_array_length:
+ case ir_unop_atan:
+ case ir_binop_atan2:
/* This operation is not supported, or should have already been handled.
*/
assert(!"Invalid ir opcode in glsl_to_tgsi_visitor::visit()");