summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/virgl/virgl_streamout.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/gallium/drivers/virgl/virgl_streamout.c')
-rw-r--r--src/gallium/drivers/virgl/virgl_streamout.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/gallium/drivers/virgl/virgl_streamout.c b/src/gallium/drivers/virgl/virgl_streamout.c
index b6a65fff29e..0fc3af67959 100644
--- a/src/gallium/drivers/virgl/virgl_streamout.c
+++ b/src/gallium/drivers/virgl/virgl_streamout.c
@@ -72,7 +72,10 @@ static void virgl_set_so_targets(struct pipe_context *ctx,
struct virgl_context *vctx = virgl_context(ctx);
int i;
for (i = 0; i < num_targets; i++) {
- pipe_resource_reference(&vctx->so_targets[i].base.buffer, targets[i]->buffer);
+ if (targets[i])
+ pipe_resource_reference(&vctx->so_targets[i].base.buffer, targets[i]->buffer);
+ else
+ pipe_resource_reference(&vctx->so_targets[i].base.buffer, NULL);
}
for (i = num_targets; i < vctx->num_so_targets; i++)
pipe_resource_reference(&vctx->so_targets[i].base.buffer, NULL);