i965: Resolve color and flush for all active shader images in intel_update_state().
authorFrancisco Jerez <currojerez@riseup.net>
Fri, 4 Sep 2015 12:30:41 +0000 (15:30 +0300)
committerFrancisco Jerez <currojerez@riseup.net>
Wed, 9 Dec 2015 13:12:59 +0000 (15:12 +0200)
Fixes arb_shader_image_load_store/execution/load-from-cleared-image.shader_test.

Couldn't reproduce any significant FPS regression in CPU-bound
benchmarks from the Finnish benchmarking system on neither VLV nor BSW
after 30 runs with 95% confidence level.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=92849
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Jason Ekstrand <jason.ekstrand@intel.com>
Cc: "11.0 11.1" <mesa-stable@lists.freedesktop.org>
Tested-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
src/mesa/drivers/dri/i965/brw_context.c

index 7d7643ca66b10d1e7cc0cf67fd63a3f7d68ee3ed..88be907620a7c32da7fb9fe639d5aafe458f2b9d 100644 (file)
@@ -197,6 +197,24 @@ intel_update_state(struct gl_context * ctx, GLuint new_state)
       brw_render_cache_set_check_flush(brw, tex_obj->mt->bo);
    }
 
+   /* Resolve color for each active shader image. */
+   for (unsigned i = 0; i < MESA_SHADER_STAGES; i++) {
+      const struct gl_shader *shader = ctx->_Shader->CurrentProgram[i] ?
+         ctx->_Shader->CurrentProgram[i]->_LinkedShaders[i] : NULL;
+
+      if (unlikely(shader && shader->NumImages)) {
+         for (unsigned j = 0; j < shader->NumImages; j++) {
+            struct gl_image_unit *u = &ctx->ImageUnits[shader->ImageUnits[j]];
+            tex_obj = intel_texture_object(u->TexObj);
+
+            if (tex_obj && tex_obj->mt) {
+               intel_miptree_resolve_color(brw, tex_obj->mt);
+               brw_render_cache_set_check_flush(brw, tex_obj->mt->bo);
+            }
+         }
+      }
+   }
+
    _mesa_lock_context_textures(ctx);
 }