summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Pitoiset <samuel.pitoiset@gmail.com>2020-11-11 09:17:32 +0100
committerMarge Bot <eric+marge@anholt.net>2020-12-10 23:10:11 +0000
commit7bf1fbea73348a16badbcc14094ac654947d176e (patch)
tree441dc18e2c40e08485ab5a38c37c4ad9b532f3ba
parent317526ec2f485807261ef2249b1b5a165740ee31 (diff)
radv: fix applying the NGG minimum vertex count requirement
Ported from RadeonSI. The restriction was applied too late. Cc: 20.2 Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com> Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl> (cherry picked from commit c5e8f6700bf4c50cd273ed2f6c476c66557ccc37) Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8014>
-rw-r--r--src/amd/vulkan/radv_pipeline.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/amd/vulkan/radv_pipeline.c b/src/amd/vulkan/radv_pipeline.c
index 525307f3d50..ee4dbbad8cc 100644
--- a/src/amd/vulkan/radv_pipeline.c
+++ b/src/amd/vulkan/radv_pipeline.c
@@ -2081,6 +2081,8 @@ gfx10_get_ngg_info(const struct radv_pipeline_key *key,
(max_lds_size - max_gsprims * gsprim_lds_size) /
esvert_lds_size);
max_esverts = MIN2(max_esverts, max_gsprims * max_verts_per_prim);
+ /* Hardware restriction: minimum value of max_esverts */
+ max_esverts = MAX2(max_esverts, min_esverts - 1 + max_verts_per_prim);
max_gsprims = align(max_gsprims, wavesize);
max_gsprims = MIN2(max_gsprims, max_gsprims_base);
@@ -2099,10 +2101,13 @@ gfx10_get_ngg_info(const struct radv_pipeline_key *key,
min_verts_per_prim, uses_adjacency);
assert(max_esverts >= max_verts_per_prim && max_gsprims >= 1);
} while (orig_max_esverts != max_esverts || orig_max_gsprims != max_gsprims);
- }
- /* Hardware restriction: minimum value of max_esverts */
- max_esverts = MAX2(max_esverts, min_esverts - 1 + max_verts_per_prim);
+ /* Verify the restriction. */
+ assert(max_esverts >= min_esverts - 1 + max_verts_per_prim);
+ } else {
+ /* Hardware restriction: minimum value of max_esverts */
+ max_esverts = MAX2(max_esverts, min_esverts - 1 + max_verts_per_prim);
+ }
unsigned max_out_vertices =
max_vert_out_per_gs_instance ? gs_info->gs.vertices_out :