[Mesa-dev] [PATCH 6/7] i965: Only resolve the textures if a _NEW_STATE state change is flagged

Francisco Jerez currojerez at riseup.net
Wed Sep 30 04:31:00 PDT 2015


Chris Wilson <chris at chris-wilson.co.uk> writes:

> Only walk through the set of enabled TextureUnits looking for a texture
> that needs to be resolved if the context state flags a new texture.
>
> Note that this will miss if the client is rendering into a texture that
> it is reading from, though that needs explicit barriers (and futhermore
> no piglits complain).
>

Wouldn't this miss legitimate use-cases like a texture being modified
(e.g. by using glClear() or some other means not leading to a feedback
loop) while already bound to some texture unit during a previous draw
call?

> Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
> Cc: Jordan Justen <jordan.l.justen at intel.com>
> Cc: Jason Ekstrand <jason.ekstrand at intel.com>
> Cc: Kenneth Graunke <kenneth at whitecape.org>
> Cc: Francisco Jerez <currojerez at riseup.net>
> ---
>  src/mesa/drivers/dri/i965/brw_draw.c | 22 ++++++++++++----------
>  1 file changed, 12 insertions(+), 10 deletions(-)
>
> diff --git a/src/mesa/drivers/dri/i965/brw_draw.c b/src/mesa/drivers/dri/i965/brw_draw.c
> index 1269b65..0ffcc24 100644
> --- a/src/mesa/drivers/dri/i965/brw_draw.c
> +++ b/src/mesa/drivers/dri/i965/brw_draw.c
> @@ -355,16 +355,18 @@ brw_draw_resolve(struct gl_context *ctx)
>        intel_renderbuffer_resolve_hiz(brw, depth_irb);
>  
>     /* Resolve depth buffer and render cache of each enabled texture. */
> -   int maxEnabledUnit = brw->ctx.Texture._MaxEnabledTexImageUnit;
> -   for (int i = 0; i <= maxEnabledUnit; i++) {
> -      if (!brw->ctx.Texture.Unit[i]._Current)
> -         continue;
> -      tex_obj = intel_texture_object(brw->ctx.Texture.Unit[i]._Current);
> -      if (!tex_obj || !tex_obj->mt)
> -         continue;
> -      intel_miptree_all_slices_resolve_depth(brw, tex_obj->mt);
> -      intel_miptree_resolve_color(brw, tex_obj->mt);
> -      brw_render_cache_set_check_flush(brw, tex_obj->mt->bo);
> +   if (brw->NewGLState & _NEW_TEXTURE) {
> +      int maxEnabledUnit = brw->ctx.Texture._MaxEnabledTexImageUnit;
> +      for (int i = 0; i <= maxEnabledUnit; i++) {
> +         if (!brw->ctx.Texture.Unit[i]._Current)
> +            continue;
> +         tex_obj = intel_texture_object(brw->ctx.Texture.Unit[i]._Current);
> +         if (!tex_obj || !tex_obj->mt)
> +            continue;
> +         intel_miptree_all_slices_resolve_depth(brw, tex_obj->mt);
> +         intel_miptree_resolve_color(brw, tex_obj->mt);
> +         brw_render_cache_set_check_flush(brw, tex_obj->mt->bo);
> +      }
>     }
>  
>     /* As we may have resolved using meta operations and so left the
> -- 
> 2.5.1
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 212 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20150930/939a7272/attachment.sig>


More information about the mesa-dev mailing list