From c366f422f0a68e6e440f419c506af24052159b6d Mon Sep 17 00:00:00 2001 From: Neil Roberts Date: Thu, 25 Jan 2018 19:15:43 +0100 Subject: nir: Offset vertex_id by first_vertex instead of base_vertex MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit base_vertex will be zero for non-indexed calls and in that case we need vertex_id to be offset by the ‘first’ parameter instead. That is what we get with first_vertex. This is true for both GL and Vulkan. The freedreno driver is also setting vertex_id_zero_based on nir_options. In order to avoid breakage this patch switches the relevant code to handle SYSTEM_VALUE_FIRST_VERTEX so that it can retain the same behavior. v2: change a3xx/fd3_emit.c and a4xx/fd4_emit.c from SYSTEM_VALUE_BASE_VERTEX to SYSTEM_VALUE_FIRST_VERTEX (Kenneth). Reviewed-by: Ian Romanick Cc: Rob Clark Acked-by: Marek Olšák --- src/compiler/nir/nir_lower_system_values.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/compiler') diff --git a/src/compiler/nir/nir_lower_system_values.c b/src/compiler/nir/nir_lower_system_values.c index 40e0f85deea..47709e9887b 100644 --- a/src/compiler/nir/nir_lower_system_values.c +++ b/src/compiler/nir/nir_lower_system_values.c @@ -115,7 +115,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); } -- cgit v1.2.3