Skip to content

iris: Consider resolves after changing a resource's aux state

Kenneth Graunke requested to merge kwg/mesa:iris-aux-flag-fix into master

The intention of IRIS_DIRTY_{RENDER,COMPUTE}_RESOLVES_AND_FLUSHES is to avoid considering resolves/flushes on back to back draw calls where nothing of significance has changed with the resources. When anything changes that could require a resolve, we must flag those.

Those situations are:

  1. Texture/image/framebuffer bindings change (as the set of images we need to look at is now different)
  2. Depth writes are enabled/disabled (the resolve code uses this)
  3. The aux state for a currently bound resource changes.

We were missing this last case. In particular, one example where we missed this was:

  1. Bind a texture.
  2. Clear that texture (likely blits/copies/teximage would work too)
  3. Draw and sample from that texture

Clear-then-Bind would work, as binding would flag resolves as dirty. But Bind-then-Clear doesn't work, as clear can change the aux state of the bound texture, but wasn't flagging that anything had changed.

Technically, we could consider whether the resource whose aux state is changing is bound for compute (and only flag COMPUTE_RESOLVES), or bound for a 3D stage (and only flag RENDER_RESOLVES), and flag nothing at all if it isn't bound. But we don't track that well, and it probably isn't worth bothering. So, flag unconditionally for now.

This does not appear to impact Piglit's drawoverhead scores.

Closes: #3994 (closed)

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/4019

Cc: mesa-stable

+@nchery +@tpalli

Merge request reports