broadcom/compiler: fix workaround for GFXH-1602

In this scenario drivers are adding a dummy attribute with a size
of 1, so we should account for it here.

Fixes missing window decorations with GTK4+.

Reviewed-by: Juan A. Suarez <jasuarez@igalia.com>
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/10853
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28414>
This commit is contained in:
Iago Toral Quiroga 2024-04-01 11:16:03 +02:00 committed by Marge Bot
parent ad647e2c90
commit 9fad2922fb

View file

@ -2745,8 +2745,21 @@ ntq_emit_load_input(struct v3d_compile *c, nir_intrinsic_instr *instr)
SYSTEM_VALUE_VERTEX_ID)) {
index++;
}
for (int i = 0; i < offset; i++)
index += c->vattr_sizes[i];
for (int i = 0; i < offset; i++) {
/* GFXH-1602: if any builtins (vid, iid, etc) are read then
* attribute 0 must be active (size > 0). When we hit this,
* the driver is expected to program attribute 0 to have a
* size of 1, so here we need to add that.
*/
if (i == 0 && c->vs_key->is_coord &&
c->vattr_sizes[i] == 0 && index > 0) {
index++;
} else {
index += c->vattr_sizes[i];
}
}
index += nir_intrinsic_component(instr);
for (int i = 0; i < instr->num_components; i++) {
struct qreg vpm_offset = vir_uniform_ui(c, index++);