radeonsi/gfx10: move s_sendmsg gs_alloc_req to the beginning of shaders

This will allow us to merge some IF blocks in shaders.

Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
This commit is contained in:
Marek Olšák
2020-01-03 16:20:40 -05:00
parent cf9f8d1ea2
commit 5a0fcf11f0
3 changed files with 13 additions and 3 deletions

View File

@@ -123,6 +123,13 @@ static LLVMValueRef ngg_get_vertices_per_prim(struct si_shader_context *ctx,
}
}
void gfx10_ngg_build_sendmsg_gs_alloc_req(struct si_shader_context *ctx)
{
ac_build_sendmsg_gs_alloc_req(&ctx->ac, get_wave_id_in_tg(ctx),
ngg_get_vtx_cnt(ctx),
ngg_get_prim_cnt(ctx));
}
static void build_streamout_vertex(struct si_shader_context *ctx,
LLVMValueRef *so_buffer, LLVMValueRef *wg_offset_dw,
unsigned stream, LLVMValueRef offset_vtx,
@@ -646,9 +653,6 @@ void gfx10_emit_ngg_epilogue(struct ac_shader_abi *abi,
ac_build_endif(&ctx->ac, 5400);
}
ac_build_sendmsg_gs_alloc_req(&ctx->ac, get_wave_id_in_tg(ctx),
ngg_get_vtx_cnt(ctx), ngg_get_prim_cnt(ctx));
/* Update query buffer */
if (ctx->screen->use_ngg_streamout &&
!info->properties[TGSI_PROPERTY_VS_BLIT_SGPRS_AMD]) {

View File

@@ -2421,6 +2421,11 @@ static bool si_build_main_function(struct si_shader_context *ctx,
(shader->key.as_ngg && !shader->key.as_es)))
ac_init_exec_full_mask(&ctx->ac);
if ((ctx->type == PIPE_SHADER_VERTEX ||
ctx->type == PIPE_SHADER_TESS_EVAL) &&
shader->key.as_ngg && !shader->key.as_es)
gfx10_ngg_build_sendmsg_gs_alloc_req(ctx);
if (ctx->type == PIPE_SHADER_TESS_CTRL ||
ctx->type == PIPE_SHADER_GEOMETRY) {
if (ctx->type == PIPE_SHADER_GEOMETRY && shader->key.as_ngg) {

View File

@@ -299,6 +299,7 @@ void si_llvm_emit_streamout(struct si_shader_context *ctx,
unsigned noutput, unsigned stream);
void si_create_function(struct si_shader_context *ctx);
void gfx10_ngg_build_sendmsg_gs_alloc_req(struct si_shader_context *ctx);
void gfx10_emit_ngg_epilogue(struct ac_shader_abi *abi,
unsigned max_outputs,
LLVMValueRef *addrs);