diff options
author | Kenneth Graunke <[email protected]> | 2018-07-24 22:14:37 -0700 |
---|---|---|
committer | Kenneth Graunke <[email protected]> | 2019-02-21 10:26:07 -0800 |
commit | 8e7b0deee24c51f92dfc5c6577ed50abe1e3690c (patch) | |
tree | bb35da4bea812da73f1b83841ff23725bfaa5e54 | |
parent | 870f2e8434a7045a2c1be5495a2e52b773d1b3f3 (diff) |
iris: Don't reserve new binding table section unless things are dirty
-rw-r--r-- | src/gallium/drivers/iris/iris_binder.c | 12 | ||||
-rw-r--r-- | src/gallium/drivers/iris/iris_binder.h | 3 | ||||
-rw-r--r-- | src/gallium/drivers/iris/iris_draw.c | 2 |
3 files changed, 14 insertions, 3 deletions
diff --git a/src/gallium/drivers/iris/iris_binder.c b/src/gallium/drivers/iris/iris_binder.c index 2f5318ed7fd..07e8fe83ecf 100644 --- a/src/gallium/drivers/iris/iris_binder.c +++ b/src/gallium/drivers/iris/iris_binder.c @@ -61,13 +61,17 @@ iris_binder_reserve(struct iris_batch *batch, unsigned size) */ void iris_binder_reserve_3d(struct iris_batch *batch, - struct iris_compiled_shader **shaders) + struct iris_context *ice) { + struct iris_compiled_shader **shaders = ice->shaders.prog; struct iris_binder *binder = &batch->binder; unsigned total_size = 0; unsigned sizes[MESA_SHADER_STAGES] = {}; for (int stage = 0; stage <= MESA_SHADER_FRAGMENT; stage++) { + if (!(ice->state.dirty & (IRIS_DIRTY_BINDINGS_VS << stage))) + continue; + if (!shaders[stage]) continue; @@ -78,10 +82,16 @@ iris_binder_reserve_3d(struct iris_batch *batch, total_size += sizes[stage]; } + if (total_size == 0) + return; + uint32_t offset = iris_binder_reserve(batch, total_size); /* Assign space and record the current binding table. */ for (int stage = 0; stage <= MESA_SHADER_FRAGMENT; stage++) { + if (!(ice->state.dirty & (IRIS_DIRTY_BINDINGS_VS << stage))) + continue; + binder->bt_offset[stage] = sizes[stage] > 0 ? offset : 0; offset += sizes[stage]; } diff --git a/src/gallium/drivers/iris/iris_binder.h b/src/gallium/drivers/iris/iris_binder.h index dbb010693f5..e198cec415c 100644 --- a/src/gallium/drivers/iris/iris_binder.h +++ b/src/gallium/drivers/iris/iris_binder.h @@ -32,6 +32,7 @@ struct iris_bo; struct iris_batch; struct iris_bufmgr; struct iris_compiled_shader; +struct iris_context; struct iris_binder { @@ -53,6 +54,6 @@ bool iris_binder_is_empty(struct iris_binder *binder); void iris_destroy_binder(struct iris_binder *binder); uint32_t iris_binder_reserve(struct iris_batch *batch, unsigned size); void iris_binder_reserve_3d(struct iris_batch *batch, - struct iris_compiled_shader **shaders); + struct iris_context *ice); #endif diff --git a/src/gallium/drivers/iris/iris_draw.c b/src/gallium/drivers/iris/iris_draw.c index f12e317e016..1a12e4ce0d9 100644 --- a/src/gallium/drivers/iris/iris_draw.c +++ b/src/gallium/drivers/iris/iris_draw.c @@ -67,7 +67,7 @@ iris_draw_vbo(struct pipe_context *ctx, const struct pipe_draw_info *info) } // XXX: don't do this unless things are dirty... - iris_binder_reserve_3d(batch, ice->shaders.prog); + iris_binder_reserve_3d(batch, ice); ice->vtbl.upload_render_state(ice, batch, info); ice->state.dirty = 0ull; |