[Mesa-dev] [PATCH 03/16] st/nine: NineDevice9_Clear skip fastpath for bigger depth-buffers

Ilia Mirkin imirkin at alum.mit.edu
Fri Apr 24 14:10:59 PDT 2015


What if the depth buffer is smaller than the color RT? I'd assume that
the fb would be reduced in that case as well... or does
This->state.fb.width/height only represent the min of the color RT's
sizes?

On Fri, Apr 24, 2015 at 4:09 PM, Axel Davy <axel.davy at ens.fr> wrote:
> From: Patrick Rudolph <siro at das-labor.org>
>
> This adds an additional check to make sure the bound depth-buffer doesn't
> exceed the rendertarget size when clearing depth and color buffer at once.
> D3D9 clears only a rectangle with the same dimensions as the viewport, leaving
> other parts of the depth-buffer intact.
>
> This fixes failing WINE test visual.c:depth_buffer_test()
>
> Signed-off-by: Patrick Rudolph <siro at das-labor.org>
> Signed-off-by: Axel Davy <axel.davy at ens.fr>
> ---
>  src/gallium/state_trackers/nine/device9.c | 17 +++++++++++++----
>  1 file changed, 13 insertions(+), 4 deletions(-)
>
> diff --git a/src/gallium/state_trackers/nine/device9.c b/src/gallium/state_trackers/nine/device9.c
> index 78e148b..1430ca5 100644
> --- a/src/gallium/state_trackers/nine/device9.c
> +++ b/src/gallium/state_trackers/nine/device9.c
> @@ -1756,12 +1756,21 @@ NineDevice9_Clear( struct NineDevice9 *This,
>              rt_mask |= 1 << i;
>      }
>
> +    /* fast path, clears everything at once */
>      if (!Count &&
>          (!(bufs & PIPE_CLEAR_COLOR) || (rt_mask == This->state.rt_mask)) &&
> -        rect.x1 == 0 && rect.x2 >= This->state.fb.width &&
> -        rect.y1 == 0 && rect.y2 >= This->state.fb.height) {
> -        /* fast path, clears everything at once */
> -        DBG("fast path\n");
> +        rect.x1 == 0 && rect.y1 == 0 &&
> +        /* Case we clear only render target. Check clear region vs rt. */
> +        ((!(bufs & (PIPE_CLEAR_DEPTH | PIPE_CLEAR_STENCIL)) &&
> +         rect.x2 >= This->state.fb.width &&
> +         rect.y2 >= This->state.fb.height) ||
> +        /* Case we clear depth buffer (and eventually rt too).
> +         * depth buffer size is always >= rt size. Compare to clear region */
> +        ((bufs & (PIPE_CLEAR_DEPTH | PIPE_CLEAR_STENCIL)) &&
> +         This->state.fb.zsbuf != NULL &&
> +         rect.x2 >= zsbuf_surf->desc.Width &&
> +         rect.y2 >= zsbuf_surf->desc.Height))) {
> +        DBG("Clear fast path\n");
>          pipe->clear(pipe, bufs, &rgba, Z, Stencil);
>          return D3D_OK;
>      }
> --
> 2.1.0
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list