summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEric Anholt <[email protected]>2018-06-27 15:25:03 -0700
committerEric Anholt <[email protected]>2018-06-29 13:36:28 -0700
commitb65b61cefe012e8bb2a0c7ab7ee41004b5f45da9 (patch)
treeac82e9bb5bfb7f4165798ac9e6eaf3bb81ec9ba0 /src
parent38172dcba9b2d9f6c51052c5a30ac68a0d3fe755 (diff)
v3d: Rewrite the color write masks to match CLIF format.
The render_target_* fields gave us pretty(ish) printing, but meant we were incompatible with CLIF, and had much more verbose code generating them.
Diffstat (limited to 'src')
-rw-r--r--src/broadcom/cle/v3d_packet_v33.xml6
-rw-r--r--src/gallium/drivers/v3d/v3dx_emit.c24
2 files changed, 7 insertions, 23 deletions
diff --git a/src/broadcom/cle/v3d_packet_v33.xml b/src/broadcom/cle/v3d_packet_v33.xml
index 5fa5ddd530b..9ffc07b9845 100644
--- a/src/broadcom/cle/v3d_packet_v33.xml
+++ b/src/broadcom/cle/v3d_packet_v33.xml
@@ -597,11 +597,7 @@
</packet>
<packet code="87" name="Colour Write Masks">
- <field name="Reserved" size="16" start="16" type="uint"/>
- <field name="Render Target 3 per colour component write masks" size="4" start="12" type="uint"/>
- <field name="Render Target 2 per colour component write masks" size="4" start="8" type="uint"/>
- <field name="Render Target 1 per colour component write masks" size="4" start="4" type="uint"/>
- <field name="Render Target 0 per colour component write masks" size="4" start="0" type="uint"/>
+ <field name="Mask" size="32" start="0" type="uint"/>
</packet>
<packet code="88" name="Zero All Centroid Flags" min_ver="41"/>
diff --git a/src/gallium/drivers/v3d/v3dx_emit.c b/src/gallium/drivers/v3d/v3dx_emit.c
index d5549bb945c..03e47d66156 100644
--- a/src/gallium/drivers/v3d/v3dx_emit.c
+++ b/src/gallium/drivers/v3d/v3dx_emit.c
@@ -496,24 +496,12 @@ v3dX(emit_state)(struct pipe_context *pctx)
struct pipe_blend_state *blend = v3d->blend;
cl_emit(&job->bcl, COLOUR_WRITE_MASKS, mask) {
- if (blend->independent_blend_enable) {
- mask.render_target_0_per_colour_component_write_masks =
- translate_colormask(v3d, blend->rt[0].colormask, 0);
- mask.render_target_1_per_colour_component_write_masks =
- translate_colormask(v3d, blend->rt[1].colormask, 1);
- mask.render_target_2_per_colour_component_write_masks =
- translate_colormask(v3d, blend->rt[2].colormask, 2);
- mask.render_target_3_per_colour_component_write_masks =
- translate_colormask(v3d, blend->rt[3].colormask, 3);
- } else {
- mask.render_target_0_per_colour_component_write_masks =
- translate_colormask(v3d, blend->rt[0].colormask, 0);
- mask.render_target_1_per_colour_component_write_masks =
- translate_colormask(v3d, blend->rt[0].colormask, 1);
- mask.render_target_2_per_colour_component_write_masks =
- translate_colormask(v3d, blend->rt[0].colormask, 2);
- mask.render_target_3_per_colour_component_write_masks =
- translate_colormask(v3d, blend->rt[0].colormask, 3);
+ for (int i = 0; i < 4; i++) {
+ int rt = blend->independent_blend_enable ? i : 0;
+ int rt_mask = blend->rt[rt].colormask;
+
+ mask.mask |= translate_colormask(v3d, rt_mask,
+ i) << (4 * i);
}
}
}