iris: Skip input resolve handling if bindings haven't changed
authorKenneth Graunke <kenneth@whitecape.org>
Sat, 9 Mar 2019 09:31:06 +0000 (01:31 -0800)
committerKenneth Graunke <kenneth@whitecape.org>
Fri, 22 Mar 2019 03:28:17 +0000 (20:28 -0700)
This brings the drawoverhead 16 Tex w/ no state change score from
22% of baseline to 97% of baseline.

src/gallium/drivers/iris/iris_context.h
src/gallium/drivers/iris/iris_draw.c
src/gallium/drivers/iris/iris_resolve.c

index f3a5bdb7eb8ee73e9179a4a9a19d7f52258c6d08..3cd03850e1bc62c39400346b46f5e48f2490fe48 100644 (file)
@@ -792,8 +792,8 @@ void iris_resolve_conditional_render(struct iris_context *ice);
 
 void iris_predraw_resolve_inputs(struct iris_context *ice,
                                  struct iris_batch *batch,
-                                 struct iris_shader_state *shs,
                                  bool *draw_aux_buffer_disabled,
+                                 gl_shader_stage stage,
                                  bool consider_framebuffer);
 void iris_predraw_resolve_framebuffer(struct iris_context *ice,
                                       struct iris_batch *batch,
index e30f12974fb2d089f80e965ad158ce615fc04c72..093e11b7435c3d7783f61b858c1538699af0614d 100644 (file)
@@ -135,9 +135,10 @@ iris_draw_vbo(struct pipe_context *ctx, const struct pipe_draw_info *info)
 
    bool draw_aux_buffer_disabled[BRW_MAX_DRAW_BUFFERS] = { };
    for (gl_shader_stage stage = 0; stage < MESA_SHADER_COMPUTE; stage++) {
-      if (ice->shaders.prog[stage])
-         iris_predraw_resolve_inputs(ice,batch, &ice->state.shaders[stage],
-                                     draw_aux_buffer_disabled, true);
+      if (ice->shaders.prog[stage]) {
+         iris_predraw_resolve_inputs(ice, batch, draw_aux_buffer_disabled,
+                                     stage, true);
+      }
    }
    iris_predraw_resolve_framebuffer(ice, batch, draw_aux_buffer_disabled);
 
@@ -214,9 +215,8 @@ iris_launch_grid(struct pipe_context *ctx, const struct pipe_grid_info *grid)
    /* We can't do resolves on the compute engine, so awkwardly, we have to
     * do them on the render batch...
     */
-   iris_predraw_resolve_inputs(ice, &ice->batches[IRIS_BATCH_RENDER],
-                               &ice->state.shaders[MESA_SHADER_COMPUTE],
-                               NULL, false);
+   iris_predraw_resolve_inputs(ice, &ice->batches[IRIS_BATCH_RENDER], NULL,
+                               MESA_SHADER_COMPUTE, false);
 
    iris_batch_maybe_flush(batch, 1500);
 
index 108a6e718d2e18da97d63d07ee503a9b4e3ca330..b7a1e6ec9137df7bd8f015b499c607c715f938f9 100644 (file)
@@ -149,12 +149,21 @@ resolve_image_views(struct iris_context *ice,
 void
 iris_predraw_resolve_inputs(struct iris_context *ice,
                             struct iris_batch *batch,
-                            struct iris_shader_state *shs,
                             bool *draw_aux_buffer_disabled,
+                            gl_shader_stage stage,
                             bool consider_framebuffer)
 {
-   resolve_sampler_views(ice, batch, shs, draw_aux_buffer_disabled, consider_framebuffer);
-   resolve_image_views(ice, batch, shs, draw_aux_buffer_disabled, consider_framebuffer);
+   struct iris_shader_state *shs = &ice->state.shaders[stage];
+
+   uint64_t dirty = (IRIS_DIRTY_BINDINGS_VS << stage) |
+                    (consider_framebuffer ? IRIS_DIRTY_BINDINGS_FS : 0);
+
+   if (ice->state.dirty & dirty) {
+      resolve_sampler_views(ice, batch, shs, draw_aux_buffer_disabled,
+                            consider_framebuffer);
+      resolve_image_views(ice, batch, shs, draw_aux_buffer_disabled,
+                          consider_framebuffer);
+   }
 
    // XXX: ASTC hacks
 }