summaryrefslogtreecommitdiffstats
path: root/src/broadcom
diff options
context:
space:
mode:
Diffstat (limited to 'src/broadcom')
-rw-r--r--src/broadcom/cle/v3d_packet_v33.xml10
-rw-r--r--src/broadcom/compiler/v3d_compiler.h9
-rw-r--r--src/broadcom/compiler/vir.c8
3 files changed, 20 insertions, 7 deletions
diff --git a/src/broadcom/cle/v3d_packet_v33.xml b/src/broadcom/cle/v3d_packet_v33.xml
index 0402484dd71..6ec5332aeb7 100644
--- a/src/broadcom/cle/v3d_packet_v33.xml
+++ b/src/broadcom/cle/v3d_packet_v33.xml
@@ -92,6 +92,12 @@
<value name="ANISOTROPIC_16_1" value="15"/>
</enum>
+ <enum name="Flat Shade Action" prefix="V3D_FLAT_SHADE_ACTION">
+ <value name="unchanged" value="0"/>
+ <value name="zeroed" value="1"/>
+ <value name="set" value="2"/>
+ </enum>
+
<packet code="0" name="Halt"/>
<packet code="1" name="NOP"/>
<packet code="4" name="Flush"/>
@@ -357,8 +363,8 @@
<packet code="98" name="Flat Shade Flags">
<field name="Flat Shade Flags for varyings V0*24" size="24" start="8" type="uint"/>
- <field name="Action for Flat Shade Flags of higher numbered varyings" size="2" start="6" type="uint"/>
- <field name="Action for Flat Shade Flags of lower numbered varyings" size="2" start="4" type="uint"/>
+ <field name="Action for Flat Shade Flags of higher numbered varyings" size="2" start="6" type="Flat Shade Action"/>
+ <field name="Action for Flat Shade Flags of lower numbered varyings" size="2" start="4" type="Flat Shade Action"/>
<field name="Varying offset V0" size="4" start="0" type="uint"/>
</packet>
diff --git a/src/broadcom/compiler/v3d_compiler.h b/src/broadcom/compiler/v3d_compiler.h
index 99d58e73ae8..85def2cb02c 100644
--- a/src/broadcom/compiler/v3d_compiler.h
+++ b/src/broadcom/compiler/v3d_compiler.h
@@ -421,7 +421,7 @@ struct v3d_compile {
* flat-shaded. This includes gl_FragColor flat-shading, which is
* customized based on the shademodel_flat shader key.
*/
- BITSET_WORD flat_shade_flags[BITSET_WORDS(V3D_MAX_FS_INPUTS)];
+ uint32_t flat_shade_flags[BITSET_WORDS(V3D_MAX_FS_INPUTS)];
struct v3d_ubo_range *ubo_ranges;
bool *ubo_range_used;
@@ -569,9 +569,12 @@ struct v3d_fs_prog_data {
struct v3d_varying_slot input_slots[V3D_MAX_FS_INPUTS];
- /* Bitmask for whether the corresponding input is flat-shaded.
+ /* Array of flat shade flags.
+ *
+ * Each entry is only 24 bits (high 8 bits 0), to match the hardware
+ * packet layout.
*/
- BITSET_WORD flat_shade_flags[BITSET_WORDS(V3D_MAX_FS_INPUTS)];
+ uint32_t flat_shade_flags[((V3D_MAX_FS_INPUTS - 1) / 24) + 1];
bool writes_z;
bool discard;
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,