[Mesa-dev] [PATCH 17/19] i965: After emitting a HiZ buffer, mark that it needs a HiZ resolve

Eric Anholt eric at anholt.net
Mon Sep 26 14:38:41 PDT 2011


On Fri, 23 Sep 2011 17:37:47 -0700, Chad Versace <chad at chad-versace.us> wrote:
> Signed-off-by: Chad Versace <chad at chad-versace.us>
> ---
>  src/mesa/drivers/dri/i965/brw_misc_state.c |    6 ++++++
>  1 files changed, 6 insertions(+), 0 deletions(-)
> 
> diff --git a/src/mesa/drivers/dri/i965/brw_misc_state.c b/src/mesa/drivers/dri/i965/brw_misc_state.c
> index 5adf2d7..1121f61 100644
> --- a/src/mesa/drivers/dri/i965/brw_misc_state.c
> +++ b/src/mesa/drivers/dri/i965/brw_misc_state.c
> @@ -377,6 +377,8 @@ static void emit_depthbuffer(struct brw_context *brw)
>        /* Emit hiz buffer. */
>        if (has_hiz) {
>  	 struct intel_hiz_control *hiz = &depth_irb->region->hiz;
> +	 assert(hiz->need_resolve != INTEL_HIZ_NEED_HIZ_RESOLVE);
> +
>  	 BEGIN_BATCH(3);
>  	 OUT_BATCH((_3DSTATE_HIER_DEPTH_BUFFER << 16) | (3 - 2));
>  	 OUT_BATCH(hiz->region->pitch * hiz->region->cpp - 1);
> @@ -384,6 +386,10 @@ static void emit_depthbuffer(struct brw_context *brw)
>  		   I915_GEM_DOMAIN_RENDER, I915_GEM_DOMAIN_RENDER,
>  		   0);
>  	 ADVANCE_BATCH();
> +
> +	 if (!brw->hiz.op) {
> +	    hiz->need_resolve = INTEL_HIZ_NEED_DEPTH_RESOLVE;
> +	 }

This one makes me uncomfortable, because emit_depthbuffer isn't called
every single time drawing using the depthbuffer occurs.  However, I
can't come up with a way to fail:

If you had a swrast-driven depth access between two Render engine draws,
then there was a batch flush, so the second Render draw will
emit_depthbuffer() too.

If you had texturing from it, then for there to be defined behavior
(without whatever that GL extension is), you must have unbound the depth
buffer iirc, so that will result in an emit_depthbuffer() when
re-bound.

We don't have anything using the blitter in between draws, because lol Y
tiling.

So I think this is OK, but I'm still nervous.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20110926/0fc89743/attachment.pgp>


More information about the mesa-dev mailing list