swr: invalidate attachment on transition change
authorGeorge Kyriazis <george.kyriazis@intel.com>
Thu, 15 Jun 2017 19:39:36 +0000 (14:39 -0500)
committerGeorge Kyriazis <george.kyriazis@intel.com>
Thu, 22 Jun 2017 16:51:08 +0000 (11:51 -0500)
commit08cb8cf2566719307203d6a7ae4c1d8b56342bd1
tree9378e2cbcc67620abd35b0953807e232424a953b
parent87a2d3963a3d879ced67ba2d9a81e336a5ac0cdf
swr: invalidate attachment on transition change

Consider the following RT attachment order:
1. Attach surfaces attachments 0 & 1, and render with them
2. Detach 0 & 1
3. Re-attach 0 & 1 to different surfaces
4. Render with the new attachment

The definition of a tile being resolved is that local changes have been
flushed out to the surface, hence there is no need to reload the tile before
it's written to.  For an invalid tile, the tile has to be reloaded from
the surface before rendering.

Stage (2) was marking hot tiles for attachements 0 & 1 as RESOLVED,
which means that the hot tiles can be written out to memory with no
need to read them back in (they are "clean").  They need to be marked as
resolved here, because a surface may be destroyed after a detach, and we
don't want to have un-resolved tiles that may force a readback from a
NULL (destroyed) surface.  (Part of a destroy is detach all attachments first)

Stage (3), during the no att -> att transition, we  need to realize that the
"new" surface tiles need to be fetched fresh from the new surface, instead
of using the resolved tiles, that belong to a stale attachment.

This is done by marking the hot tiles as invalid in stage (3), when we realize
that a new attachment is being made, so that they are re-fetched during
rendering in stage (4).

Also note that hot tiles are indexed by attachment.

- Fixes VTK dual depth-peeling tests.
- No piglit changes

Reviewed-by: Tim Rowley <timothy.o.rowley@intel.com>
src/gallium/drivers/swr/swr_draw.cpp
src/gallium/drivers/swr/swr_resource.h
src/gallium/drivers/swr/swr_state.cpp