ac/llvm,radeonsi: lower nir_load_user_clip_plane in abi
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com> Reviewed-by: Marek Olšák <marek.olsak@amd.com> Signed-off-by: Qiang Yu <yuq825@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18010>
This commit is contained in:
@@ -3625,9 +3625,6 @@ static bool visit_intrinsic(struct ac_nir_context *ctx, nir_intrinsic_instr *ins
|
||||
case nir_intrinsic_load_lds_ngg_gs_out_vertex_base_amd:
|
||||
result = ctx->abi->intrinsic_load(ctx->abi, instr->intrinsic);
|
||||
break;
|
||||
case nir_intrinsic_load_user_clip_plane:
|
||||
result = ctx->abi->load_user_clip_plane(ctx->abi, nir_intrinsic_ucp_id(instr));
|
||||
break;
|
||||
case nir_intrinsic_load_streamout_buffer_amd:
|
||||
result = ctx->abi->load_streamout_buffer(ctx->abi, nir_intrinsic_base(instr));
|
||||
break;
|
||||
|
@@ -116,8 +116,6 @@ struct ac_shader_abi {
|
||||
|
||||
LLVMValueRef (*load_sample_position)(struct ac_shader_abi *abi, LLVMValueRef sample_id);
|
||||
|
||||
LLVMValueRef (*load_user_clip_plane)(struct ac_shader_abi *abi, unsigned ucp_id);
|
||||
|
||||
LLVMValueRef (*load_streamout_buffer)(struct ac_shader_abi *abi, unsigned buffer);
|
||||
|
||||
LLVMValueRef (*emit_fbfetch)(struct ac_shader_abi *abi);
|
||||
|
@@ -222,6 +222,12 @@ static bool lower_abi_instr(nir_builder *b, nir_instr *instr, struct lower_abi_s
|
||||
case nir_intrinsic_load_clamp_vertex_color_amd:
|
||||
replacement = nir_i2b(b, GET_FIELD_NIR(VS_STATE_CLAMP_VERTEX_COLOR));
|
||||
break;
|
||||
case nir_intrinsic_load_user_clip_plane: {
|
||||
nir_ssa_def *buf = load_internal_binding(b, args, SI_VS_CONST_CLIP_PLANES);
|
||||
unsigned offset = nir_intrinsic_ucp_id(intrin) * 16;
|
||||
replacement = nir_load_smem_buffer_amd(b, 4, buf, nir_imm_int(b, offset));
|
||||
break;
|
||||
}
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
@@ -761,17 +761,6 @@ static LLVMValueRef si_llvm_load_intrinsic(struct ac_shader_abi *abi, nir_intrin
|
||||
}
|
||||
}
|
||||
|
||||
static LLVMValueRef si_llvm_load_user_clip_plane(struct ac_shader_abi *abi, unsigned ucp_id)
|
||||
{
|
||||
struct si_shader_context *ctx = si_shader_context_from_abi(abi);
|
||||
struct ac_llvm_pointer ptr = ac_get_ptr_arg(&ctx->ac, &ctx->args->ac, ctx->args->internal_bindings);
|
||||
LLVMValueRef constbuf_index = LLVMConstInt(ctx->ac.i32, SI_VS_CONST_CLIP_PLANES, 0);
|
||||
LLVMValueRef const_resource = ac_build_load_to_sgpr(&ctx->ac, ptr, constbuf_index);
|
||||
LLVMValueRef addr = LLVMConstInt(ctx->ac.i32, ucp_id * 16, 0);
|
||||
return ac_build_buffer_load(&ctx->ac, const_resource, 4, NULL, addr, NULL,
|
||||
ctx->ac.f32, 0, true, true);
|
||||
}
|
||||
|
||||
static LLVMValueRef si_llvm_load_streamout_buffer(struct ac_shader_abi *abi, unsigned buffer)
|
||||
{
|
||||
struct si_shader_context *ctx = si_shader_context_from_abi(abi);
|
||||
@@ -797,7 +786,6 @@ bool si_llvm_translate_nir(struct si_shader_context *ctx, struct si_shader *shad
|
||||
ctx->num_images = info->base.num_images;
|
||||
|
||||
ctx->abi.intrinsic_load = si_llvm_load_intrinsic;
|
||||
ctx->abi.load_user_clip_plane = si_llvm_load_user_clip_plane;
|
||||
ctx->abi.load_streamout_buffer = si_llvm_load_streamout_buffer;
|
||||
ctx->abi.export_vertex = gfx10_ngg_export_vertex;
|
||||
ctx->abi.atomic_add_prim_count = gfx10_ngg_atomic_add_prim_count;
|
||||
|
Reference in New Issue
Block a user