summaryrefslogtreecommitdiffstats
path: root/src/broadcom/compiler/vir.c
diff options
context:
space:
mode:
authorEric Anholt <[email protected]>2017-12-27 15:38:57 -0800
committerEric Anholt <[email protected]>2018-01-03 14:25:23 -0800
commit8e5a0ed95307fed7cb2bbbb86d1c264bbd070ca0 (patch)
treef5a1a0aa5c8062084d60ed09af8dc88bc37b226c /src/broadcom/compiler/vir.c
parent2056e4a777bd0eed88ff2762977955b2f2bf2f1c (diff)
broadcom/vc5: Emit flat shade flags for varying components > 24.
This means that with no flatshading we'll emit the single-byte ZERO_ALL_FLAT_SHADE_FLAGS, and otherwise emit a set of FLAT_SHADE_FLAGS to get all the bits we need set. There's a _SET enum in the packet we could use to possibly set entire ranges of the bitfield without using another packet, but this at least fixes the conformance failure.
Diffstat (limited to 'src/broadcom/compiler/vir.c')
-rw-r--r--src/broadcom/compiler/vir.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/broadcom/compiler/vir.c b/src/broadcom/compiler/vir.c
index 2589c7f554d..4e78a477bd7 100644
--- a/src/broadcom/compiler/vir.c
+++ b/src/broadcom/compiler/vir.c
@@ -714,8 +714,12 @@ v3d_set_fs_prog_data_inputs(struct v3d_compile *c,
memcpy(prog_data->input_slots, c->input_slots,
c->num_inputs * sizeof(*c->input_slots));
- memcpy(prog_data->flat_shade_flags, c->flat_shade_flags,
- sizeof(c->flat_shade_flags));
+ STATIC_ASSERT(ARRAY_SIZE(prog_data->flat_shade_flags) >
+ (V3D_MAX_FS_INPUTS - 1) / 24);
+ for (int i = 0; i < V3D_MAX_FS_INPUTS; i++) {
+ if (BITSET_TEST(c->flat_shade_flags, i))
+ prog_data->flat_shade_flags[i / 24] |= 1 << (i % 24);
+ }
}
uint64_t *v3d_compile_fs(const struct v3d_compiler *compiler,