Mesa (master): radeonsi/gfx10: correct VS PrimitiveID implementation for NGG
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Mon Jan 20 21:33:28 UTC 2020
Module: Mesa
Branch: master
Commit: cf9f8d1ea2044effc35e15e1ee91a528b8d9e487
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=cf9f8d1ea2044effc35e15e1ee91a528b8d9e487
Author: Marek Olšák <marek.olsak at amd.com>
Date: Thu Dec 5 20:46:30 2019 -0500
radeonsi/gfx10: correct VS PrimitiveID implementation for NGG
We didn't use the correct LDS pointer, though it probably doesn't matter,
because I think that nothing else is using LDS here.
This commit makes it consistent with all other esgs_ring use.
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer at amd.com>
---
src/gallium/drivers/radeonsi/gfx10_shader_ngg.c | 25 +++++++++++++------------
1 file changed, 13 insertions(+), 12 deletions(-)
diff --git a/src/gallium/drivers/radeonsi/gfx10_shader_ngg.c b/src/gallium/drivers/radeonsi/gfx10_shader_ngg.c
index 4d19f714e6c..b7b7edc46e7 100644
--- a/src/gallium/drivers/radeonsi/gfx10_shader_ngg.c
+++ b/src/gallium/drivers/radeonsi/gfx10_shader_ngg.c
@@ -486,6 +486,15 @@ static unsigned ngg_nogs_vertex_size(struct si_shader *shader)
if (shader->selector->info.writes_edgeflag)
lds_vertex_size = MAX2(lds_vertex_size, 1);
+ /* LDS size for passing data from GS to ES.
+ * GS stores Primitive IDs into LDS at the address corresponding
+ * to the ES thread of the provoking vertex. All ES threads
+ * load and export PrimitiveID for their thread.
+ */
+ if (shader->selector->type == PIPE_SHADER_VERTEX &&
+ shader->key.mono.u.vs_export_prim_id)
+ lds_vertex_size = MAX2(lds_vertex_size, 1);
+
return lds_vertex_size;
}
@@ -630,9 +639,10 @@ void gfx10_emit_ngg_epilogue(struct ac_shader_abi *abi,
LLVMValueRef indices = ac_build_gather_values(&ctx->ac, vtxindex, 3);
LLVMValueRef provoking_vtx_index =
LLVMBuildExtractElement(builder, indices, provoking_vtx_in_prim, "");
+ LLVMValueRef vertex_ptr = ngg_nogs_vertex_ptr(ctx, provoking_vtx_index);
LLVMBuildStore(builder, ac_get_arg(&ctx->ac, ctx->args.gs_prim_id),
- ac_build_gep0(&ctx->ac, ctx->esgs_ring, provoking_vtx_index));
+ ac_build_gep0(&ctx->ac, vertex_ptr, ctx->i32_0));
ac_build_endif(&ctx->ac, 5400);
}
@@ -724,8 +734,8 @@ void gfx10_emit_ngg_epilogue(struct ac_shader_abi *abi,
/* Wait for GS stores to finish. */
ac_build_s_barrier(&ctx->ac);
- tmp = ac_build_gep0(&ctx->ac, ctx->esgs_ring,
- get_thread_id_in_tg(ctx));
+ tmp = ngg_nogs_vertex_ptr(ctx, get_thread_id_in_tg(ctx));
+ tmp = ac_build_gep0(&ctx->ac, tmp, ctx->i32_0);
outputs[i].values[0] = LLVMBuildLoad(builder, tmp, "");
} else {
assert(ctx->type == PIPE_SHADER_TESS_EVAL);
@@ -1329,15 +1339,6 @@ void gfx10_ngg_calculate_subgroup_info(struct si_shader *shader)
/* VS and TES. */
/* LDS size for passing data from ES to GS. */
esvert_lds_size = ngg_nogs_vertex_size(shader);
-
- /* LDS size for passing data from GS to ES.
- * GS stores Primitive IDs into LDS at the address corresponding
- * to the ES thread of the provoking vertex. All ES threads
- * load and export PrimitiveID for their thread.
- */
- if (gs_sel->type == PIPE_SHADER_VERTEX &&
- shader->key.mono.u.vs_export_prim_id)
- esvert_lds_size = MAX2(esvert_lds_size, 1);
}
unsigned max_gsprims = max_gsprims_base;
More information about the mesa-commit
mailing list