r600: Use nir_lower_tess_coord_xy
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io> Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24159>
This commit is contained in:
committed by
Marge Bot
parent
4f0f76346e
commit
2c8f884103
@@ -874,9 +874,8 @@ r600_shader_from_nir(struct r600_context *rctx,
|
||||
NIR_PASS_V(sh, r600_append_tcs_TF_emission, (mesa_prim)key->tcs.prim_mode);
|
||||
|
||||
if (sh->info.stage == MESA_SHADER_TESS_EVAL) {
|
||||
NIR_PASS_V(sh,
|
||||
r600_lower_tess_coord,
|
||||
u_tess_prim_from_shader(sh->info.tess._primitive_mode));
|
||||
NIR_PASS_V(sh, nir_lower_tess_coord_z,
|
||||
sh->info.tess._primitive_mode == TESS_PRIMITIVE_TRIANGLES);
|
||||
}
|
||||
|
||||
NIR_PASS_V(sh, nir_lower_alu_to_scalar, r600_lower_to_scalar_instr_filter, NULL);
|
||||
|
||||
@@ -107,8 +107,6 @@ bool
|
||||
r600_lower_tess_io(nir_shader *shader, enum mesa_prim prim_type);
|
||||
bool
|
||||
r600_append_tcs_TF_emission(nir_shader *shader, enum mesa_prim prim_type);
|
||||
bool
|
||||
r600_lower_tess_coord(nir_shader *sh, enum mesa_prim prim_type);
|
||||
|
||||
bool
|
||||
r600_legalize_image_load_store(nir_shader *shader);
|
||||
|
||||
@@ -640,40 +640,3 @@ r600_append_tcs_TF_emission(nir_shader *shader, enum mesa_prim prim_type)
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool
|
||||
r600_lower_tess_coord_filter(const nir_instr *instr, UNUSED const void *_options)
|
||||
{
|
||||
if (instr->type != nir_instr_type_intrinsic)
|
||||
return false;
|
||||
auto intr = nir_instr_as_intrinsic(instr);
|
||||
return intr->intrinsic == nir_intrinsic_load_tess_coord;
|
||||
}
|
||||
|
||||
static nir_ssa_def *
|
||||
r600_lower_tess_coord_impl(nir_builder *b, UNUSED nir_instr *instr, void *_options)
|
||||
{
|
||||
mesa_prim prim_type = *(mesa_prim *)_options;
|
||||
|
||||
auto tc_xy = nir_load_tess_coord_xy(b);
|
||||
|
||||
auto tc_x = nir_channel(b, tc_xy, 0);
|
||||
auto tc_y = nir_channel(b, tc_xy, 1);
|
||||
|
||||
if (prim_type == MESA_PRIM_TRIANGLES)
|
||||
return nir_vec3(b,
|
||||
tc_x,
|
||||
tc_y,
|
||||
nir_fsub_imm(b, 1.0, nir_fadd(b, tc_x, tc_y)));
|
||||
else
|
||||
return nir_vec3(b, tc_x, tc_y, nir_imm_float(b, 0.0));
|
||||
}
|
||||
|
||||
bool
|
||||
r600_lower_tess_coord(nir_shader *sh, enum mesa_prim prim_type)
|
||||
{
|
||||
return nir_shader_lower_instructions(sh,
|
||||
r600_lower_tess_coord_filter,
|
||||
r600_lower_tess_coord_impl,
|
||||
&prim_type);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user