r300: fix reusing of color varying slots for generic ones

This was broken when I added texcoord support, the problem is that we
failed to properly count the number of used fs inputs and thus we failed
to make the proper decision when to reuse the color varying slot
Also fix the error messages, they were incorrect after the rewrite as
well. This fixes a bunch of piglits.

Fixes: d4b8e8a481

Signed-off-by: Pavel Ondračka <pavel.ondracka@gmail.com>
Reviewed-by: Filip Gawin <filip.gawin@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27003>
(cherry picked from commit 53c17d85ab)
This commit is contained in:
Pavel Ondračka
2024-01-09 16:03:38 +01:00
committed by Eric Engestrom
parent 4b10fa974b
commit 5361f9c7bd
3 changed files with 19 additions and 9 deletions

View File

@@ -664,7 +664,7 @@
"description": "r300: fix reusing of color varying slots for generic ones",
"nominated": true,
"nomination_type": 1,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": "d4b8e8a48144f4b899d48c271558f0dc613632cb",
"notes": null

View File

@@ -65,11 +65,13 @@ void r300_shader_read_fs_inputs(struct tgsi_shader_info* info,
case TGSI_SEMANTIC_TEXCOORD:
assert(index < ATTR_TEXCOORD_COUNT);
fs_inputs->texcoord[index] = i;
fs_inputs->num_texcoord++;
break;
case TGSI_SEMANTIC_GENERIC:
assert(index < ATTR_GENERIC_COUNT);
fs_inputs->generic[index] = i;
fs_inputs->num_generic++;
break;
case TGSI_SEMANTIC_FOG:

View File

@@ -541,6 +541,14 @@ static void r300_update_rs_block(struct r300_context *r300)
}
}
for (; i < ATTR_GENERIC_COUNT; i++) {
if (fs_inputs->generic[i] != ATTR_UNUSED) {
fprintf(stderr, "r300: ERROR: FS input generic %i unassigned, "
"not enough hardware slots (it's not a bug, do not "
"report it).\n", i);
}
}
gen_offset = 0;
/* Re-use color varyings for texcoords if possible.
*
@@ -645,6 +653,14 @@ static void r300_update_rs_block(struct r300_context *r300)
}
}
for (; i < ATTR_TEXCOORD_COUNT; i++) {
if (fs_inputs->texcoord[i] != ATTR_UNUSED) {
fprintf(stderr, "r300: ERROR: FS input texcoord %i unassigned, "
"not enough hardware slots (it's not a bug, do not "
"report it).\n", i);
}
}
/* Rasterize pointcoord. */
if (fs_inputs->pcoord != ATTR_UNUSED && tex_count < 8) {
@@ -666,14 +682,6 @@ static void r300_update_rs_block(struct r300_context *r300)
tex_ptr += 2;
}
for (; i < ATTR_GENERIC_COUNT; i++) {
if (fs_inputs->generic[i] != ATTR_UNUSED) {
fprintf(stderr, "r300: ERROR: FS input generic %i unassigned, "
"not enough hardware slots (it's not a bug, do not "
"report it).\n", i);
}
}
/* Rasterize fog coordinates. */
if (vs_outputs->fog != ATTR_UNUSED && tex_count < 8) {
/* Set up the fog coordinates in VAP. */