nir: unvendor ac_nir_lower_sin_cos

So we can use it for Nvidia.

Reviewed-by: Georg Lehmann <dadschoorse@gmail.com>
Reviewed-by: Mel Henning <mhenning@darkrefraction.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40541>
This commit is contained in:
Karol Herbst 2026-03-20 15:43:54 +01:00 committed by Karol Herbst
parent 5bb3c9f69c
commit b7ca34db13
7 changed files with 9 additions and 11 deletions

View file

@ -172,7 +172,6 @@ amd_common_files = files(
'nir/ac_nir_lower_ngg_mesh.c',
'nir/ac_nir_lower_ps_early.c',
'nir/ac_nir_lower_ps_late.c',
'nir/ac_nir_lower_sin_cos.c',
'nir/ac_nir_meta.h',
'nir/ac_nir_meta_cs_blit.c',
'nir/ac_nir_meta_cs_clear_copy_buffer.c',

View file

@ -89,8 +89,6 @@ nir_def *
ac_nir_load_smem(nir_builder *b, unsigned num_components, nir_def *addr, nir_def *offset,
unsigned align_mul, enum gl_access_qualifier access);
bool ac_nir_lower_sin_cos(nir_shader *shader);
typedef struct {
enum amd_gfx_level gfx_level;
bool has_ls_vgpr_init_bug;

View file

@ -626,7 +626,7 @@ radv_shader_spirv_to_nir(struct radv_device *device, const struct radv_shader_st
NIR_PASS(_, nir, nir_lower_doubles, NULL, lower_doubles);
NIR_PASS(_, nir, ac_nir_lower_sin_cos);
NIR_PASS(_, nir, nir_normalize_sin_cos);
}
if (nir->info.uses_printf)

View file

@ -252,6 +252,7 @@ else
'nir_move_output_stores_to_end.c',
'nir_move_vec_src_uses_to_dest.c',
'nir_normalize_cubemap_coords.c',
'nir_normalize_sin_cos.c',
'nir_opt_access.c',
'nir_opt_barriers.c',
'nir_opt_barycentric.c',

View file

@ -7082,6 +7082,8 @@ bool nir_unlower_io_to_vars(nir_shader *nir, bool keep_intrinsics);
bool nir_opt_barycentric(nir_shader *shader, bool lower_sample_to_pos);
bool nir_normalize_sin_cos(nir_shader *shader);
#include "nir_inline_helpers.h"
static inline bool

View file

@ -4,13 +4,11 @@
* SPDX-License-Identifier: MIT
*/
#include "ac_nir.h"
#include "ac_nir_helpers.h"
#include "nir.h"
#include "nir_builder.h"
static bool
lower_sin_cos(struct nir_builder *b, nir_alu_instr *sincos, UNUSED void *_)
normalize_sin_cos(struct nir_builder *b, nir_alu_instr *sincos, UNUSED void *_)
{
if (sincos->op != nir_op_fsin && sincos->op != nir_op_fcos)
return false;
@ -26,7 +24,7 @@ lower_sin_cos(struct nir_builder *b, nir_alu_instr *sincos, UNUSED void *_)
}
bool
ac_nir_lower_sin_cos(nir_shader *shader)
nir_normalize_sin_cos(nir_shader *shader)
{
return nir_shader_alu_pass(shader, lower_sin_cos, nir_metadata_control_flow, NULL);
return nir_shader_alu_pass(shader, normalize_sin_cos, nir_metadata_control_flow, NULL);
}

View file

@ -657,7 +657,7 @@ static void si_preprocess_nir(struct si_nir_shader_ctx *ctx)
};
NIR_PASS(progress, nir, nir_lower_image, &lower_image_options);
NIR_PASS(progress, nir, ac_nir_lower_sin_cos);
NIR_PASS(progress, nir, nir_normalize_sin_cos);
NIR_PASS(progress, nir, si_nir_lower_intrinsics_early);
if (nir->info.stage == MESA_SHADER_TASK) {