[Mesa-dev] [RFC] i965: Resolve color for all active shader images in intel_update_state().

Jordan Justen jordan.l.justen at intel.com
Sat Sep 5 11:30:44 PDT 2015


From: Francisco Jerez <currojerez at riseup.net>

Fixes arb_shader_image_load_store/execution/load-from-cleared-image.shader_test

Cc: Chris Wilson <chris at chris-wilson.co.uk>
Cc: Jason Ekstrand <jason.ekstrand at intel.com>
Tested-by: Jordan Justen <jordan.l.justen at intel.com>
---
 RE: i965: Perform an explicit flush after doing _mesa_meta_pbo_TexSubImage

 curro has some concerns about potential perf impact by this and
 wanted it to be checked on small-core w/CPU bound apps.
 Unfortunately, he is on vacation now.

 src/mesa/drivers/dri/i965/brw_context.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/src/mesa/drivers/dri/i965/brw_context.c b/src/mesa/drivers/dri/i965/brw_context.c
index f0ed891..a274a43 100644
--- a/src/mesa/drivers/dri/i965/brw_context.c
+++ b/src/mesa/drivers/dri/i965/brw_context.c
@@ -189,6 +189,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);
 }
 
-- 
2.5.0



More information about the mesa-dev mailing list