From: Kenneth Graunke Date: Tue, 26 Jun 2018 20:25:22 +0000 (-0700) Subject: iris: don't emit garbage 3DSTATE_VERTEX_BUFFERS when there aren't any X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=4c9067ae1d1d8d1a18a9c0a74e3cc2cafed8c2fb;p=mesa.git iris: don't emit garbage 3DSTATE_VERTEX_BUFFERS when there aren't any --- 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); + } } }