v3d: Skip emitting per-RT blend state for RTs with blend disabled.
authorEric Anholt <eric@anholt.net>
Tue, 3 Jul 2018 23:27:39 +0000 (16:27 -0700)
committerEric Anholt <eric@anholt.net>
Thu, 5 Jul 2018 19:39:36 +0000 (12:39 -0700)
Cleans up the CL of fbo-drawbuffers2-blend a bit.  We could do better on
more complicated cases by noticing if multiple RTs have the same blend
state and emitting them in a single packet.

src/gallium/drivers/v3d/v3dx_emit.c

index 78edf02..ce5eafe 100644 (file)
@@ -276,10 +276,16 @@ static void
 emit_rt_blend(struct v3d_context *v3d, struct v3d_job *job,
               struct pipe_blend_state *blend, int rt)
 {
-        cl_emit(&job->bcl, BLEND_CONFIG, config) {
-                struct pipe_rt_blend_state *rtblend = &blend->rt[rt];
+        struct pipe_rt_blend_state *rtblend = &blend->rt[rt];
 
 #if V3D_VERSION >= 40
+        /* We don't need to emit blend state for disabled RTs. */
+        if (!rtblend->blend_enable)
+                return;
+#endif
+
+        cl_emit(&job->bcl, BLEND_CONFIG, config) {
+#if V3D_VERSION >= 40
                 config.render_target_mask = 1 << rt;
 #else
                 assert(rt == 0);