nvc0: allow holes in xfb target lists
authorIlia Mirkin <imirkin@alum.mit.edu>
Sat, 14 Feb 2015 06:43:31 +0000 (01:43 -0500)
committerIlia Mirkin <imirkin@alum.mit.edu>
Sat, 14 Feb 2015 22:15:54 +0000 (17:15 -0500)
Tested with a modified xfb-streams test which outputs to streams 0, 2,
and 3.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: "10.4 10.5" <mesa-stable@lists.freedesktop.org>
src/gallium/drivers/nouveau/nvc0/nvc0_shader_state.c
src/gallium/drivers/nouveau/nvc0/nvc0_state.c

index 1000d8286d779dd4b5f74304d845dd1bdab14913..516b33b76d556504b3e55de05c2f7f1566794fc0 100644 (file)
@@ -252,7 +252,12 @@ nvc0_tfb_validate(struct nvc0_context *nvc0)
 
    for (b = 0; b < nvc0->num_tfbbufs; ++b) {
       struct nvc0_so_target *targ = nvc0_so_target(nvc0->tfbbuf[b]);
-      struct nv04_resource *buf = nv04_resource(targ->pipe.buffer);
+      struct nv04_resource *buf;
+
+      if (!targ) {
+         IMMED_NVC0(push, NVC0_3D(TFB_BUFFER_ENABLE(b)), 0);
+         continue;
+      }
 
       if (tfb)
          targ->stride = tfb->stride[b];
@@ -260,6 +265,8 @@ nvc0_tfb_validate(struct nvc0_context *nvc0)
       if (!(nvc0->tfbbuf_dirty & (1 << b)))
          continue;
 
+      buf = nv04_resource(targ->pipe.buffer);
+
       if (!targ->clean)
          nvc0_query_fifo_wait(push, targ->pq);
       BEGIN_NVC0(push, NVC0_3D(TFB_BUFFER_ENABLE(b)), 5);
index b6666ca58e8d3c3cb35e228c7d24bad5f3b58d81..dca06f4cddb1dbb92fe3263e96705698b0ebd886 100644 (file)
@@ -1089,9 +1089,11 @@ nvc0_set_transform_feedback_targets(struct pipe_context *pipe,
       pipe_so_target_reference(&nvc0->tfbbuf[i], targets[i]);
    }
    for (; i < nvc0->num_tfbbufs; ++i) {
-      nvc0->tfbbuf_dirty |= 1 << i;
-      nvc0_so_target_save_offset(pipe, nvc0->tfbbuf[i], i, &serialize);
-      pipe_so_target_reference(&nvc0->tfbbuf[i], NULL);
+      if (nvc0->tfbbuf[i]) {
+         nvc0->tfbbuf_dirty |= 1 << i;
+         nvc0_so_target_save_offset(pipe, nvc0->tfbbuf[i], i, &serialize);
+         pipe_so_target_reference(&nvc0->tfbbuf[i], NULL);
+      }
    }
    nvc0->num_tfbbufs = num_targets;