aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2019-12-05 20:46:30 -0500
committerMarek Olšák <[email protected]>2020-01-20 16:16:11 -0500
commitcf9f8d1ea2044effc35e15e1ee91a528b8d9e487 (patch)
tree7e09b5f19a24a485d865a677f721a853820b20d5 /src
parentb2326a7549b237669d4aeb8a733eb13d15467093 (diff)
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 <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/gallium/drivers/radeonsi/gfx10_shader_ngg.c25
1 files 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;