[Mesa-dev] [PATCH] radv: compute correct number of input vertices for NGG
Bas Nieuwenhuizen
bas at basnieuwenhuizen.nl
Tue Jul 9 20:16:18 UTC 2019
On Tue, Jul 9, 2019 at 9:19 AM Samuel Pitoiset
<samuel.pitoiset at gmail.com> wrote:
>
> Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
> ---
> src/amd/vulkan/radv_pipeline.c | 25 ++++++++++++++++++++++++-
> 1 file changed, 24 insertions(+), 1 deletion(-)
>
> diff --git a/src/amd/vulkan/radv_pipeline.c b/src/amd/vulkan/radv_pipeline.c
> index 5942e20dafe..96b20c1c730 100644
> --- a/src/amd/vulkan/radv_pipeline.c
> +++ b/src/amd/vulkan/radv_pipeline.c
> @@ -1616,6 +1616,29 @@ static void clamp_gsprims_to_esverts(unsigned *max_gsprims, unsigned max_esverts
> *max_gsprims = MIN2(*max_gsprims, 1 + max_reuse);
> }
>
> +static unsigned
> +radv_get_num_input_vertices(struct radv_pipeline *pipeline)
> +{
> + if (radv_pipeline_has_gs(pipeline)) {
> + struct radv_shader_variant *gs =
> + radv_get_shader(pipeline, MESA_SHADER_GEOMETRY);
> +
> + return gs->info.gs.vertices_in;
> + }
> +
> + if (radv_pipeline_has_tess(pipeline)) {
> + struct radv_shader_variant *tes = radv_get_shader(pipeline, MESA_SHADER_TESS_EVAL);
> +
> + if (tes->info.tes.point_mode)
> + return 1;
> + if (tes->info.tes.primitive_mode == GL_ISOLINES)
> + return 2;
> + return 3;
> + }
> +
> + return 3;
I think this should be based on
pCreateInfo->pInputAssemblyState->topology, instead of assuming 3.
However for consistency with radeonsi for now, this is r-b
> +}
> +
> static struct radv_ngg_state
> calculate_ngg_info(const VkGraphicsPipelineCreateInfo *pCreateInfo,
> struct radv_pipeline *pipeline)
> @@ -1625,7 +1648,7 @@ calculate_ngg_info(const VkGraphicsPipelineCreateInfo *pCreateInfo,
> struct radv_es_output_info *es_info =
> radv_pipeline_has_tess(pipeline) ? &gs_info->tes.es_info : &gs_info->vs.es_info;
> unsigned gs_type = radv_pipeline_has_gs(pipeline) ? MESA_SHADER_GEOMETRY : MESA_SHADER_VERTEX;
> - unsigned max_verts_per_prim = 3; // triangles
> + unsigned max_verts_per_prim = radv_get_num_input_vertices(pipeline);
> unsigned min_verts_per_prim =
> gs_type == MESA_SHADER_GEOMETRY ? max_verts_per_prim : 1;
> unsigned gs_num_invocations = gs_info ? MAX2(gs_info->gs.invocations, 1) : 1;
> --
> 2.22.0
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
More information about the mesa-dev
mailing list