From 93682f9f4d12b04c6567c6fb11582f5f66a1d407 Mon Sep 17 00:00:00 2001 From: Erik Faye-Lund Date: Mon, 15 May 2023 14:48:59 +0200 Subject: [PATCH] zink: clean up tcs_vertices_out_word handling At this point, we already have the index of the declaration itself in the tcs_vertices_out_word variable, so we only need to add the offset from the start of the exec_modes buffer. Part-of: --- .../drivers/zink/nir_to_spirv/spirv_builder.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/gallium/drivers/zink/nir_to_spirv/spirv_builder.c b/src/gallium/drivers/zink/nir_to_spirv/spirv_builder.c index 5d2f504f303..8b3b924ae82 100644 --- a/src/gallium/drivers/zink/nir_to_spirv/spirv_builder.c +++ b/src/gallium/drivers/zink/nir_to_spirv/spirv_builder.c @@ -1726,16 +1726,14 @@ spirv_builder_get_words(struct spirv_builder *b, uint32_t *words, &b->instructions }; - bool find_tcs_vertices_out = *tcs_vertices_out_word > 0; for (int i = 0; i < ARRAY_SIZE(buffers); ++i) { const struct spirv_buffer *buffer = buffers[i]; - for (int j = 0; j < buffer->num_words; ++j) { - if (find_tcs_vertices_out && buffer == &b->exec_modes && *tcs_vertices_out_word == j) { - *tcs_vertices_out_word = written; - find_tcs_vertices_out = false; - } + + if (buffer == &b->exec_modes && *tcs_vertices_out_word > 0) + *tcs_vertices_out_word += written; + + for (int j = 0; j < buffer->num_words; ++j) words[written++] = buffer->words[j]; - } } assert(written == spirv_builder_get_num_words(b));