summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/vc5
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/gallium/drivers/vc5
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/gallium/drivers/vc5')
-rw-r--r--src/gallium/drivers/vc5/vc5_emit.c37
1 files changed, 32 insertions, 5 deletions
diff --git a/src/gallium/drivers/vc5/vc5_emit.c b/src/gallium/drivers/vc5/vc5_emit.c
index 3914a346e9d..321f59d14c4 100644
--- a/src/gallium/drivers/vc5/vc5_emit.c
+++ b/src/gallium/drivers/vc5/vc5_emit.c
@@ -501,12 +501,39 @@ vc5_emit_state(struct pipe_context *pctx)
emit_textures(vc5, &vc5->verttex);
if (vc5->dirty & VC5_DIRTY_FLAT_SHADE_FLAGS) {
- /* XXX: Need to handle more than 24 entries. */
- cl_emit(&job->bcl, FLAT_SHADE_FLAGS, flags) {
- flags.varying_offset_v0 = 0;
+ bool emitted_any = false;
+
+ for (int i = 0; i < ARRAY_SIZE(vc5->prog.fs->prog_data.fs->flat_shade_flags); i++) {
+ if (!vc5->prog.fs->prog_data.fs->flat_shade_flags[i])
+ continue;
+
+ cl_emit(&job->bcl, FLAT_SHADE_FLAGS, flags) {
+ flags.varying_offset_v0 = i;
+
+ if (emitted_any) {
+ flags.action_for_flat_shade_flags_of_lower_numbered_varyings =
+ V3D_FLAT_SHADE_ACTION_UNCHANGED;
+ flags.action_for_flat_shade_flags_of_higher_numbered_varyings =
+ V3D_FLAT_SHADE_ACTION_UNCHANGED;
+ } else {
+ flags.action_for_flat_shade_flags_of_lower_numbered_varyings =
+ ((i == 0) ?
+ V3D_FLAT_SHADE_ACTION_UNCHANGED :
+ V3D_FLAT_SHADE_ACTION_ZEROED);
+
+ flags.action_for_flat_shade_flags_of_higher_numbered_varyings =
+ V3D_FLAT_SHADE_ACTION_ZEROED;
+ }
+
+ flags.flat_shade_flags_for_varyings_v024 =
+ vc5->prog.fs->prog_data.fs->flat_shade_flags[i];
+ }
+
+ emitted_any = true;
+ }
- flags.flat_shade_flags_for_varyings_v024 =
- vc5->prog.fs->prog_data.fs->flat_shade_flags[0] & 0xfffff;
+ if (!emitted_any) {
+ cl_emit(&job->bcl, ZERO_ALL_FLAT_SHADE_FLAGS, flags);
}
}