From: Kevin Rogovin <kevin.rogo...@intel.com>

One of the presteps in each draw (and compute) call is to validate
the textures. This is the perfect place (since all texture units
are looped through) to see if ASTC5x5 and/or textures with an
auxilary surface are accessed by the GPU.

Signed-off-by: Kevin Rogovin <kevin.rogo...@intel.com>
---
 src/mesa/drivers/dri/i965/intel_tex_validate.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/src/mesa/drivers/dri/i965/intel_tex_validate.c 
b/src/mesa/drivers/dri/i965/intel_tex_validate.c
index 2b7798c940..812c0c7793 100644
--- a/src/mesa/drivers/dri/i965/intel_tex_validate.c
+++ b/src/mesa/drivers/dri/i965/intel_tex_validate.c
@@ -188,11 +188,24 @@ brw_validate_textures(struct brw_context *brw)
    struct gl_context *ctx = &brw->ctx;
    const int max_enabled_unit = ctx->Texture._MaxEnabledTexImageUnit;
 
+   brw->astc5x5_wa.texture_astc5x5_present = false;
+   brw->astc5x5_wa.texture_with_auxilary_present = false;
    for (int unit = 0; unit <= max_enabled_unit; unit++) {
       struct gl_texture_unit *tex_unit = &ctx->Texture.Unit[unit];
 
       if (tex_unit->_Current) {
+         struct intel_texture_object *tex =
+            intel_texture_object(tex_unit->_Current);
+         struct intel_mipmap_tree *mt = tex->mt;
+
          intel_finalize_mipmap_tree(brw, unit);
+         if (mt && mt->aux_usage != ISL_AUX_USAGE_NONE) {
+            brw->astc5x5_wa.texture_with_auxilary_present = true;
+         }
+         if (tex->_Format == MESA_FORMAT_RGBA_ASTC_5x5 ||
+             tex->_Format == MESA_FORMAT_SRGB8_ALPHA8_ASTC_5x5) {
+            brw->astc5x5_wa.texture_astc5x5_present = true;
+         }
       }
    }
 }
-- 
2.14.2

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to