From 1954f62fad93d2c5c9cee2d400f37086fb39c191 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pavel=20Ondra=C4=8Dka?= Date: Wed, 7 Feb 2024 16:12:54 +0100 Subject: [PATCH] r300: fix vs output register indexing MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Vertex shaders were writing TEXCOORDs before GENERICS, however fragment shaders were reading it the opposite way, so this caused problems for shaders that used both TEXCOORD and GENERIC varyings. Fixes: d4b8e8a48144f4b899d48c271558f0dc613632cb Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/10489 Signed-off-by: Pavel Ondračka Reviewed-by: Filip Gawin Part-of: (cherry picked from commit 0ac6801970f88402f4f98455652448bc5ca97096) --- .pick_status.json | 2 +- src/gallium/drivers/r300/r300_vs.c | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index 67f0bb164cc..29a7135ea06 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -2844,7 +2844,7 @@ "description": "r300: fix vs output register indexing", "nominated": true, "nomination_type": 1, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": "d4b8e8a48144f4b899d48c271558f0dc613632cb", "notes": null diff --git a/src/gallium/drivers/r300/r300_vs.c b/src/gallium/drivers/r300/r300_vs.c index 6449584bc09..fcfeb9fd52e 100644 --- a/src/gallium/drivers/r300/r300_vs.c +++ b/src/gallium/drivers/r300/r300_vs.c @@ -158,13 +158,6 @@ static void set_vertex_inputs_outputs(struct r300_vertex_program_compiler * c) } } - /* Texture coordinates. */ - for (i = 0; i < ATTR_TEXCOORD_COUNT; i++) { - if (outputs->texcoord[i] != ATTR_UNUSED) { - c->code->outputs[outputs->texcoord[i]] = reg++; - } - } - /* Generics. */ for (i = 0; i < ATTR_GENERIC_COUNT; i++) { if (outputs->generic[i] != ATTR_UNUSED) { @@ -172,6 +165,13 @@ static void set_vertex_inputs_outputs(struct r300_vertex_program_compiler * c) } } + /* Texture coordinates. */ + for (i = 0; i < ATTR_TEXCOORD_COUNT; i++) { + if (outputs->texcoord[i] != ATTR_UNUSED) { + c->code->outputs[outputs->texcoord[i]] = reg++; + } + } + /* Fog coordinates. */ if (outputs->fog != ATTR_UNUSED) { c->code->outputs[outputs->fog] = reg++;