broadcom/vc5: Fix reloads of separate stencil buffers.
authorEric Anholt <eric@anholt.net>
Wed, 25 Apr 2018 00:50:50 +0000 (17:50 -0700)
committerEric Anholt <eric@anholt.net>
Wed, 25 Apr 2018 16:21:54 +0000 (09:21 -0700)
Like for stores, we need to emit a separate load_general packet.

src/gallium/drivers/vc5/vc5_rcl.c

index 328922751304ecc704bf02cf811379bfe40239e4..7f804aa27a52316977d72e14f7c9e472e7601e24 100644 (file)
@@ -226,10 +226,22 @@ vc5_rcl_emit_loads(struct vc5_job *job, struct vc5_cl *cl)
         if ((loads_pending & PIPE_CLEAR_DEPTHSTENCIL) &&
             (V3D_VERSION >= 40 ||
              (job->zsbuf && job->zsbuf->texture->nr_samples > 1))) {
-                load_general(cl, job->zsbuf,
-                             zs_buffer_from_pipe_bits(loads_pending),
-                             PIPE_CLEAR_DEPTHSTENCIL,
-                             &loads_pending);
+                struct vc5_resource *rsc = vc5_resource(job->zsbuf->texture);
+
+                if (rsc->separate_stencil &&
+                    (loads_pending & PIPE_CLEAR_STENCIL)) {
+                        load_general(cl, job->zsbuf,
+                                     STENCIL,
+                                     PIPE_CLEAR_STENCIL,
+                                     &loads_pending);
+                }
+
+                if (loads_pending & PIPE_CLEAR_DEPTHSTENCIL) {
+                        load_general(cl, job->zsbuf,
+                                     zs_buffer_from_pipe_bits(loads_pending),
+                                     loads_pending & PIPE_CLEAR_DEPTHSTENCIL,
+                                     &loads_pending);
+                }
         }
 
 #if V3D_VERSION < 40