radeonsi: implement nir_intrinsic_load_streamout_buffer_amd

Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Signed-off-by: Qiang Yu <yuq825@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17456>
This commit is contained in:
Qiang Yu
2022-06-30 17:50:47 +08:00
committed by Marge Bot
parent 8049edb653
commit 4d15a06dee
3 changed files with 15 additions and 0 deletions
+3
View File
@@ -3617,6 +3617,9 @@ static bool visit_intrinsic(struct ac_nir_context *ctx, nir_intrinsic_instr *ins
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;
case nir_intrinsic_load_ordered_id_amd:
result = ac_unpack_param(&ctx->ac, ac_get_arg(&ctx->ac, ctx->args->gs_tg_info), 0, 12);
break;
+2
View File
@@ -111,6 +111,8 @@ struct ac_shader_abi {
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);
LLVMValueRef (*intrinsic_load)(struct ac_shader_abi *abi, nir_intrinsic_op op);
@@ -902,6 +902,15 @@ static LLVMValueRef si_llvm_load_user_clip_plane(struct ac_shader_abi *abi, unsi
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);
LLVMValueRef buf_ptr = ac_get_arg(&ctx->ac, ctx->internal_bindings);
return ac_build_load_to_sgpr(
&ctx->ac, buf_ptr, LLVMConstInt(ctx->ac.i32, SI_VS_STREAMOUT_BUF0 + buffer, false));
}
bool si_llvm_translate_nir(struct si_shader_context *ctx, struct si_shader *shader,
struct nir_shader *nir, bool free_nir, bool ngg_cull_shader)
{
@@ -919,6 +928,7 @@ bool si_llvm_translate_nir(struct si_shader_context *ctx, struct si_shader *shad
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;
si_llvm_init_resource_callbacks(ctx);
si_llvm_create_main_func(ctx, ngg_cull_shader);