iris: Don't reserve new binding table section unless things are dirty

This commit is contained in:
Kenneth Graunke
2018-07-24 22:14:37 -07:00
parent 870f2e8434
commit 8e7b0deee2
3 changed files with 14 additions and 3 deletions
+11 -1
View File
@@ -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];
}
+2 -1
View File
@@ -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
+1 -1
View File
@@ -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;