diff --git a/src/compiler/nir/nir_builtin_builder.h b/src/compiler/nir/nir_builtin_builder.h index 14eb5d28ada..ab8a71e2c2f 100644 --- a/src/compiler/nir/nir_builtin_builder.h +++ b/src/compiler/nir/nir_builtin_builder.h @@ -194,7 +194,7 @@ nir_fast_normalize(nir_builder *b, nir_def *vec) } static inline nir_def * -nir_fmad(nir_builder *b, nir_def *x, nir_def *y, nir_def *z) +nir_fmad_old(nir_builder *b, nir_def *x, nir_def *y, nir_def *z) { return nir_fadd(b, nir_fmul(b, x, y), z); } diff --git a/src/compiler/spirv/vtn_opencl.c b/src/compiler/spirv/vtn_opencl.c index 6ebdbf18720..db754eff91b 100644 --- a/src/compiler/spirv/vtn_opencl.c +++ b/src/compiler/spirv/vtn_opencl.c @@ -653,7 +653,7 @@ handle_special(struct vtn_builder *b, uint32_t opcode, nb->fp_math_ctrl |= nir_fp_exact; if (lower) - res = nir_fmad(nb, srcs[0], srcs[1], srcs[2]); + res = nir_fmad_old(nb, srcs[0], srcs[1], srcs[2]); else res = nir_ffma_old(nb, srcs[0], srcs[1], srcs[2]); diff --git a/src/gallium/drivers/d3d12/d3d12_nir_passes.c b/src/gallium/drivers/d3d12/d3d12_nir_passes.c index 486fe18d217..b924148a2c7 100644 --- a/src/gallium/drivers/d3d12/d3d12_nir_passes.c +++ b/src/gallium/drivers/d3d12/d3d12_nir_passes.c @@ -119,7 +119,7 @@ lower_pos_read(nir_builder *b, struct nir_intrinsic_instr *intr, void *_var) "d3d12_DepthTransform", glsl_vec_type(2), depth_transform_var); - depth = nir_fmad(b, depth, nir_channel(b, depth_transform, 0), + depth = nir_fmad_old(b, depth, nir_channel(b, depth_transform, 0), nir_channel(b, depth_transform, 1)); pos = nir_vector_insert_imm(b, pos, depth, 2); diff --git a/src/gallium/drivers/r600/sfn/sfn_nir_lower_tex.cpp b/src/gallium/drivers/r600/sfn/sfn_nir_lower_tex.cpp index b9e0a576e96..bd67f224ddd 100644 --- a/src/gallium/drivers/r600/sfn/sfn_nir_lower_tex.cpp +++ b/src/gallium/drivers/r600/sfn/sfn_nir_lower_tex.cpp @@ -257,7 +257,7 @@ r600_nir_lower_cube_to_2darray_impl(nir_builder *b, nir_instr *instr, void *_opt auto cubed = nir_cube_amd(b, nir_trim_vector(b, tex->src[coord_idx].src.ssa, 3)); - auto xy = nir_fmad(b, + auto xy = nir_fmad_old(b, nir_vec2(b, nir_channel(b, cubed, 1), nir_channel(b, cubed, 0)), nir_frcp(b, nir_fabs(b, nir_channel(b, cubed, 2))), nir_imm_float(b, 1.5)); @@ -266,7 +266,7 @@ r600_nir_lower_cube_to_2darray_impl(nir_builder *b, nir_instr *instr, void *_opt if (tex->is_array && tex->op != nir_texop_lod) { auto slice = nir_fround_even(b, nir_channel(b, tex->src[coord_idx].src.ssa, 3)); z = - nir_fmad(b, nir_fmax(b, slice, nir_imm_float(b, 0.0)), nir_imm_float(b, 8.0), z); + nir_fmad_old(b, nir_fmax(b, slice, nir_imm_float(b, 0.0)), nir_imm_float(b, 8.0), z); } if (tex->op == nir_texop_txd) { diff --git a/src/imagination/vulkan/pvr_usc.c b/src/imagination/vulkan/pvr_usc.c index 5345be24308..f5913c86c01 100644 --- a/src/imagination/vulkan/pvr_usc.c +++ b/src/imagination/vulkan/pvr_usc.c @@ -866,7 +866,7 @@ pvr_uscgen_tq_frag_coords(nir_builder *b, nir_vec2(b, nir_load_preamble(b, 1, 32, .base = *next_sh + base_sh + 1), nir_load_preamble(b, 1, 32, .base = *next_sh + base_sh + 3)); - coords = nir_fmad(b, coords, mult, add); + coords = nir_fmad_old(b, coords, mult, add); *next_sh += 4; } diff --git a/src/mesa/main/ff_fragment_shader.c b/src/mesa/main/ff_fragment_shader.c index 150bfa78300..ed39541b2f2 100644 --- a/src/mesa/main/ff_fragment_shader.c +++ b/src/mesa/main/ff_fragment_shader.c @@ -590,7 +590,7 @@ emit_combine(struct texenv_fragment_program *p, return nir_fdot3(p->b, smear(p->b, tmp0), smear(p->b, tmp1)); case TEXENV_MODE_MODULATE_ADD_ATI: - return nir_fmad(p->b, src[0], src[2], src[1]); + return nir_fmad_old(p->b, src[0], src[2], src[1]); case TEXENV_MODE_MODULATE_SIGNED_ADD_ATI: return nir_fadd_imm(p->b, diff --git a/src/mesa/main/ffvertex_prog.c b/src/mesa/main/ffvertex_prog.c index decf47cba19..1aefcdf929c 100644 --- a/src/mesa/main/ffvertex_prog.c +++ b/src/mesa/main/ffvertex_prog.c @@ -418,9 +418,9 @@ emit_transpose_matrix_transform_vec4(nir_builder *b, { nir_def *result; result = nir_fmul(b, nir_channel(b, src, 0), mat[0]); - result = nir_fmad(b, nir_channel(b, src, 1), mat[1], result); - result = nir_fmad(b, nir_channel(b, src, 2), mat[2], result); - result = nir_fmad(b, nir_channel(b, src, 3), mat[3], result); + result = nir_fmad_old(b, nir_channel(b, src, 1), mat[1], result); + result = nir_fmad_old(b, nir_channel(b, src, 2), mat[2], result); + result = nir_fmad_old(b, nir_channel(b, src, 3), mat[3], result); return result; } @@ -603,7 +603,7 @@ get_scenecolor(struct tnl_program *p, GLuint side) // rgb: material_emission + material_ambient * lm_ambient // alpha: material_diffuse.a - return nir_vector_insert_imm(p->b, nir_fmad(p->b, + return nir_vector_insert_imm(p->b, nir_fmad_old(p->b, lm_ambient, material_ambient, material_emission), @@ -956,7 +956,7 @@ static void build_lighting( struct tnl_program *p ) /* light is attenuated by distance */ lit = emit_lit(p->b, dots); lit = nir_fmul(p->b, lit, att); - _col0 = nir_fmad(p->b, nir_channel(p->b, lit, 0), ambient, _col0); + _col0 = nir_fmad_old(p->b, nir_channel(p->b, lit, 0), ambient, _col0); } else if (!p->state->material_shininess_is_zero) { /* there's a non-zero specular term */ lit = emit_lit(p->b, dots); @@ -967,13 +967,13 @@ static void build_lighting( struct tnl_program *p ) _col0 = nir_fadd(p->b, ambient, _col0); } - _col0 = nir_fmad(p->b, nir_channel(p->b, lit, 1), + _col0 = nir_fmad_old(p->b, nir_channel(p->b, lit, 1), diffuse, _col0); if (separate) - _col1 = nir_fmad(p->b, nir_channel(p->b, lit, 2), + _col1 = nir_fmad_old(p->b, nir_channel(p->b, lit, 2), specular, _col1); else - _col0 = nir_fmad(p->b, nir_channel(p->b, lit, 2), + _col0 = nir_fmad_old(p->b, nir_channel(p->b, lit, 2), specular, _col0); } /* Back face lighting: @@ -1009,7 +1009,7 @@ static void build_lighting( struct tnl_program *p ) /* light is attenuated by distance */ lit = emit_lit(p->b, dots); lit = nir_fmul(p->b, lit, att); - _bfc0 = nir_fmad(p->b, nir_channel(p->b, lit, 0), ambient, _bfc0); + _bfc0 = nir_fmad_old(p->b, nir_channel(p->b, lit, 0), ambient, _bfc0); } else if (!p->state->material_shininess_is_zero) { /* there's a non-zero specular term */ lit = emit_lit(p->b, dots); @@ -1020,13 +1020,13 @@ static void build_lighting( struct tnl_program *p ) _bfc0 = nir_fadd(p->b, ambient, _bfc0); } - _bfc0 = nir_fmad(p->b, nir_channel(p->b, lit, 1), + _bfc0 = nir_fmad_old(p->b, nir_channel(p->b, lit, 1), diffuse, _bfc0); if (separate) - _bfc1 = nir_fmad(p->b, nir_channel(p->b, lit, 2), + _bfc1 = nir_fmad_old(p->b, nir_channel(p->b, lit, 2), specular, _bfc1); else - _bfc0 = nir_fmad(p->b, nir_channel(p->b, lit, 2), + _bfc0 = nir_fmad_old(p->b, nir_channel(p->b, lit, 2), specular, _bfc0); } } @@ -1080,7 +1080,7 @@ build_reflect_texgen(struct tnl_program *p) /* 2n.u */ tmp = nir_fadd(p->b, tmp, tmp); /* (-2n.u)n + u */ - return nir_fmad(p->b, nir_fneg(p->b, tmp), normal, eye_hat); + return nir_fmad_old(p->b, nir_fneg(p->b, tmp), normal, eye_hat); } @@ -1103,7 +1103,7 @@ build_sphere_texgen(struct tnl_program *p) /* 2n.u */ tmp = nir_fadd(p->b, tmp, tmp); /* (-2n.u)n + u */ - nir_def *r = nir_fmad(p->b, nir_fneg(p->b, tmp), normal, eye_hat); + nir_def *r = nir_fmad_old(p->b, nir_fneg(p->b, tmp), normal, eye_hat); /* r + 0,0,1 */ tmp = nir_fadd(p->b, r, nir_imm_vec4(p->b, 0.0f, 0.0f, 1.0f, 0.0f)); /* rx^2 + ry^2 + (rz+1)^2 */ @@ -1113,7 +1113,7 @@ build_sphere_texgen(struct tnl_program *p) /* 1/m */ nir_def *inv_m = nir_fmul_imm(p->b, tmp, 0.5f); /* r/m + 1/2 */ - return nir_fmad(p->b, r, inv_m, nir_imm_float(p->b, 0.5f)); + return nir_fmad_old(p->b, r, inv_m, nir_imm_float(p->b, 0.5f)); } static void build_texture_transform( struct tnl_program *p ) @@ -1235,9 +1235,9 @@ static void build_atten_pointsize( struct tnl_program *p ) nir_def *dist = nir_fabs(p->b, eye); /* p1 + dist * (p2 + dist * p3); */ - nir_def *factor = nir_fmad(p->b, dist, nir_channel(p->b, att, 2), + nir_def *factor = nir_fmad_old(p->b, dist, nir_channel(p->b, att, 2), nir_channel(p->b, att, 1)); - factor = nir_fmad(p->b, dist, factor, nir_channel(p->b, att, 0)); + factor = nir_fmad_old(p->b, dist, factor, nir_channel(p->b, att, 0)); /* 1 / sqrt(factor) */ factor = nir_frsq(p->b, factor); diff --git a/src/mesa/state_tracker/st_draw_hw_select.c b/src/mesa/state_tracker/st_draw_hw_select.c index 25b200e76cf..2a97df6f565 100644 --- a/src/mesa/state_tracker/st_draw_hw_select.c +++ b/src/mesa/state_tracker/st_draw_hw_select.c @@ -186,7 +186,7 @@ get_intersection(nir_builder *b, nir_def *v1, nir_def *v2, nir_def *d1, nir_def *d2) { nir_def *factor = nir_fdiv(b, d1, nir_fsub(b, d1, d2)); - return nir_fmad(b, nir_fsub(b, v2, v1), factor, v1); + return nir_fmad_old(b, nir_fsub(b, v2, v1), factor, v1); } #define begin_for_loop(name, max) \ @@ -382,7 +382,7 @@ get_window_space_depth(nir_builder *b, nir_def *v, nir_def **trans) nir_def *d = nir_bcsel(b, c, nir_imm_float(b, -1), nir_fdiv(b, z, w)); /* map [-1, 1] to [near, far] set by glDepthRange(near, far) */ - return nir_fmad(b, trans[0], d, trans[1]); + return nir_fmad_old(b, trans[0], d, trans[1]); } static void diff --git a/src/mesa/state_tracker/st_nir_lower_fog.c b/src/mesa/state_tracker/st_nir_lower_fog.c index f400048c6b1..e15064218e3 100644 --- a/src/mesa/state_tracker/st_nir_lower_fog.c +++ b/src/mesa/state_tracker/st_nir_lower_fog.c @@ -41,7 +41,7 @@ fog_result(nir_builder *b, nir_def *color, enum gl_fog_mode fog_mode, * gl_MesaFogParamsOptimized gives us (-1 / (end - start)) and * (end / (end - start)) so we can generate a single MAD. */ - f = nir_fmad(b, fogc, + f = nir_fmad_old(b, fogc, nir_channel(b, params, 0), nir_channel(b, params, 1)); break; @@ -74,7 +74,7 @@ fog_result(nir_builder *b, nir_def *color, enum gl_fog_mode fog_mode, /* Not using flrp because we may end up lowering fog after driver lowering * that meant to remove all lrps. */ - return nir_fmad(b, color, f, nir_fmul(b, fog_color, nir_fsub_imm(b, 1.0, f))); + return nir_fmad_old(b, color, f, nir_fmul(b, fog_color, nir_fsub_imm(b, 1.0, f))); } struct lower_fog_state { diff --git a/src/mesa/state_tracker/st_nir_lower_position_invariant.c b/src/mesa/state_tracker/st_nir_lower_position_invariant.c index 1756ded9d58..127de23a7f5 100644 --- a/src/mesa/state_tracker/st_nir_lower_position_invariant.c +++ b/src/mesa/state_tracker/st_nir_lower_position_invariant.c @@ -41,7 +41,7 @@ st_nir_lower_position_invariant(struct nir_shader *s, result = nir_fmul(&b, mvp[0], nir_channel(&b, in_pos, 0)); for (int i = 1; i < 4; i++) - result = nir_fmad(&b, mvp[i], nir_channel(&b, in_pos, i), result); + result = nir_fmad_old(&b, mvp[i], nir_channel(&b, in_pos, i), result); nir_store_output(&b, result, nir_imm_int(&b, 0), .io_semantics.location = VARYING_SLOT_POS);