From 4c9067ae1d1d8d1a18a9c0a74e3cc2cafed8c2fb Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Tue, 26 Jun 2018 13:25:22 -0700 Subject: [PATCH] iris: don't emit garbage 3DSTATE_VERTEX_BUFFERS when there aren't any --- src/gallium/drivers/iris/iris_state.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/gallium/drivers/iris/iris_state.c b/src/gallium/drivers/iris/iris_state.c index 8e5818d9f3d..3f25737703d 100644 --- a/src/gallium/drivers/iris/iris_state.c +++ b/src/gallium/drivers/iris/iris_state.c @@ -2784,12 +2784,14 @@ iris_upload_render_state(struct iris_context *ice, struct iris_vertex_buffer_state *cso = ice->state.cso_vertex_buffers; const unsigned vb_dwords = GENX(VERTEX_BUFFER_STATE_length); - iris_batch_emit(batch, cso->vertex_buffers, - sizeof(uint32_t) * (1 + vb_dwords * cso->num_buffers)); + if (cso->num_buffers > 0) { + iris_batch_emit(batch, cso->vertex_buffers, sizeof(uint32_t) * + (1 + vb_dwords * cso->num_buffers)); - for (unsigned i = 0; i < cso->num_buffers; i++) { - struct iris_resource *res = (void *) cso->resources[i]; - iris_use_pinned_bo(batch, res->bo, false); + for (unsigned i = 0; i < cso->num_buffers; i++) { + struct iris_resource *res = (void *) cso->resources[i]; + iris_use_pinned_bo(batch, res->bo, false); + } } } -- 2.30.2