inst->saturate = instr->dest.saturate;
break;
- case nir_op_fsin: {
- src_reg tmp = src_reg(this, glsl_type::vec4_type);
- inst = emit_math(SHADER_OPCODE_SIN, dst_reg(tmp), op[0]);
- if (instr->dest.saturate) {
- inst->dst = dst;
- inst->saturate = true;
+ case nir_op_fsin:
+ if (!compiler->precise_trig) {
+ inst = emit_math(SHADER_OPCODE_SIN, dst, op[0]);
} else {
- emit(MUL(dst, tmp, brw_imm_f(0.99997)));
+ src_reg tmp = src_reg(this, glsl_type::vec4_type);
+ inst = emit_math(SHADER_OPCODE_SIN, dst_reg(tmp), op[0]);
+ inst = emit(MUL(dst, tmp, brw_imm_f(0.99997)));
}
+ inst->saturate = instr->dest.saturate;
break;
- }
- case nir_op_fcos: {
- src_reg tmp = src_reg(this, glsl_type::vec4_type);
- inst = emit_math(SHADER_OPCODE_COS, dst_reg(tmp), op[0]);
- if (instr->dest.saturate) {
- inst->dst = dst;
- inst->saturate = true;
+ case nir_op_fcos:
+ if (!compiler->precise_trig) {
+ inst = emit_math(SHADER_OPCODE_COS, dst, op[0]);
} else {
- emit(MUL(dst, tmp, brw_imm_f(0.99997)));
+ src_reg tmp = src_reg(this, glsl_type::vec4_type);
+ inst = emit_math(SHADER_OPCODE_COS, dst_reg(tmp), op[0]);
+ inst = emit(MUL(dst, tmp, brw_imm_f(0.99997)));
}
+ inst->saturate = instr->dest.saturate;
break;
- }
case nir_op_idiv:
case nir_op_udiv:
nir_tex_instr_dest_size(instr));
dst_reg dest = get_nir_dest(instr->dest, instr->dest_type);
- /* Our hardware requires a LOD for buffer textures */
+ /* The hardware requires a LOD for buffer textures */
if (instr->sampler_dim == GLSL_SAMPLER_DIM_BUF)
lod = brw_imm_d(0);