aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2019-07-06 00:11:36 -0400
committerMarek Olšák <[email protected]>2019-07-19 20:16:19 -0400
commitbfaca7259ca898b5aaab0e592b76eb20e593e9f9 (patch)
tree3323835d01a5ed13c483cd5e5a4a3a6a8830445c /src
parenta6722285c2788a1d96d8196e2766b10d5257b805 (diff)
radeonsi/gfx10: deduplicate code for esvert_lds_size
Acked-by: Pierre-Eric Pelloux-Prayer <[email protected]> Reviewed-by: Samuel Pitoiset <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/gallium/drivers/radeonsi/gfx10_shader_ngg.c22
1 files changed, 16 insertions, 6 deletions
diff --git a/src/gallium/drivers/radeonsi/gfx10_shader_ngg.c b/src/gallium/drivers/radeonsi/gfx10_shader_ngg.c
index 59f7f34c8a7..5c410d79ec1 100644
--- a/src/gallium/drivers/radeonsi/gfx10_shader_ngg.c
+++ b/src/gallium/drivers/radeonsi/gfx10_shader_ngg.c
@@ -496,6 +496,16 @@ static void build_streamout(struct si_shader_context *ctx,
}
}
+static unsigned ngg_nogs_vertex_size(struct si_shader *shader)
+{
+ unsigned lds_vertex_size = 0;
+
+ if (shader->selector->so.num_outputs)
+ lds_vertex_size = 4 * shader->selector->info.num_outputs + 1;
+
+ return lds_vertex_size;
+}
+
/**
* Returns an `[N x i32] addrspace(LDS)*` pointing at contiguous LDS storage
* for the vertex outputs.
@@ -504,7 +514,7 @@ static LLVMValueRef ngg_nogs_vertex_ptr(struct si_shader_context *ctx,
LLVMValueRef vtxid)
{
/* The extra dword is used to avoid LDS bank conflicts. */
- unsigned vertex_size = 4 * ctx->shader->selector->info.num_outputs + 1;
+ unsigned vertex_size = ngg_nogs_vertex_size(ctx->shader);
LLVMTypeRef ai32 = LLVMArrayType(ctx->i32, vertex_size);
LLVMTypeRef pai32 = LLVMPointerType(ai32, AC_ADDR_SPACE_LDS);
LLVMValueRef tmp = LLVMBuildBitCast(ctx->ac.builder, ctx->esgs_ring, pai32, "");
@@ -1316,12 +1326,12 @@ void gfx10_ngg_calculate_subgroup_info(struct si_shader *shader)
esvert_lds_size = es_sel->esgs_itemsize / 4;
gsprim_lds_size = (gs_sel->gsvs_vertex_size / 4 + 1) * max_out_verts_per_gsprim;
} else {
- /* TODO: This needs to be adjusted once LDS use for compaction
- * after culling is implemented. */
- if (es_sel->so.num_outputs)
- esvert_lds_size = 4 * es_sel->info.num_outputs + 1;
+ /* VS and TES. */
+ /* LDS size for passing data from ES to GS. */
+ esvert_lds_size = ngg_nogs_vertex_size(shader);
- /* GS stores Primitive IDs into LDS at the address corresponding
+ /* 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.
*/