[Mesa-dev] [PATCH v2 5/7] nir: Offset vertex_id by first_vertex instead of base_vertex

Ian Romanick idr at freedesktop.org
Mon Dec 11 19:43:34 UTC 2017


On 12/04/2017 12:12 PM, Antia Puentes wrote:
> From: Neil Roberts <nroberts at igalia.com>
> 
> base_vertex will be zero for non-indexed calls, but we need it to
> include the ‘first’ parameter. This is true for both GL and Vulkan.
> 
> I think this patch will also affect freedreno and radeonsi. I believe

If you think a patch might break someone's driver, you should CC them on
the patch... they're more likely to verify it that way.  Adding Marek
and Rob. :)

> if they are relying on this lowering then they are currently already
> broken because they will have the wrong values for gl_BaseVertex.
> However this patch will also make them break for gl_VertexID and they
> will need to be fixed to use firt_vertex instead.
> ---
>  src/compiler/nir/nir_lower_system_values.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/compiler/nir/nir_lower_system_values.c b/src/compiler/nir/nir_lower_system_values.c
> index 3594f4ae5ce..6f4fb8233ab 100644
> --- a/src/compiler/nir/nir_lower_system_values.c
> +++ b/src/compiler/nir/nir_lower_system_values.c
> @@ -105,7 +105,7 @@ convert_block(nir_block *block, nir_builder *b)
>           if (b->shader->options->vertex_id_zero_based) {
>              sysval = nir_iadd(b,
>                                nir_load_vertex_id_zero_base(b),
> -                              nir_load_base_vertex(b));
> +                              nir_load_first_vertex(b));
>           } else {
>              sysval = nir_load_vertex_id(b);
>           }
> 



More information about the mesa-dev mailing list