diff options
author | Chia-I Wu <[email protected]> | 2014-02-20 14:37:23 +0800 |
---|---|---|
committer | Chia-I Wu <[email protected]> | 2014-02-22 22:45:13 +0800 |
commit | f57bddc7e431e553e946563d1030e5f239911c8b (patch) | |
tree | c36cda8e0fd1222366b3d2c545b0d856a62e0916 /src/gallium/drivers/ilo/ilo_blit.c | |
parent | 4afb8a7fb5a5f0581ba1bbf608033e69dab6dbb3 (diff) |
ilo: add slice clear value
It is needed for 3DSTATE_CLEAR_PARAMS, and can also be used to track what
value the slice has been cleared to.
Diffstat (limited to 'src/gallium/drivers/ilo/ilo_blit.c')
-rw-r--r-- | src/gallium/drivers/ilo/ilo_blit.c | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/src/gallium/drivers/ilo/ilo_blit.c b/src/gallium/drivers/ilo/ilo_blit.c index 74bb3554235..ad304c7109a 100644 --- a/src/gallium/drivers/ilo/ilo_blit.c +++ b/src/gallium/drivers/ilo/ilo_blit.c @@ -163,10 +163,26 @@ ilo_blit_resolve_slices_for_hiz(struct ilo_context *ilo, * When ILO_TEXTURE_RENDER_WRITE is set, there can be no reader. We * need to perform a HiZ Buffer Resolve in case the resource was * previously written by another writer, unless this is a clear. + * + * When slices have different clear values, we perform a Depth Buffer + * Resolve on all slices not sharing the clear value of the first slice. + * After resolving, those slices do not use 3DSTATE_CLEAR_PARAMS and can + * be made to have the same clear value as the first slice does. This + * way, + * + * - 3DSTATE_CLEAR_PARAMS can be set to the clear value of any slice + * - we will not resolve unnecessarily next time this function is + * called + * + * Since slice clear value is the value the slice is cleared to when + * ILO_TEXTURE_CLEAR is set, the bit needs to be unset. */ assert(!(resolve_flags & (other_writers | any_reader))); if (!(resolve_flags & ILO_TEXTURE_CLEAR)) { + bool set_clear_value = false; + uint32_t first_clear_value; + for (i = 0; i < num_slices; i++) { const struct ilo_texture_slice *slice = ilo_texture_get_slice(tex, level, first_slice + i); @@ -175,6 +191,21 @@ ilo_blit_resolve_slices_for_hiz(struct ilo_context *ilo, ilo_blitter_rectlist_resolve_hiz(ilo->blitter, res, level, first_slice + i); } + else if (i == 0) { + first_clear_value = slice->clear_value; + } + else if (slice->clear_value != first_clear_value && + (slice->flags & ILO_TEXTURE_RENDER_WRITE)) { + ilo_blitter_rectlist_resolve_z(ilo->blitter, + res, level, first_slice + i); + set_clear_value = true; + } + } + + if (set_clear_value) { + /* ILO_TEXTURE_CLEAR will be cleared later */ + ilo_texture_set_slice_clear_value(tex, level, + first_slice, num_slices, first_clear_value); } } } |