[Mesa-dev] [PATCH 1/2] i965/brw: Emit state for hiz and separate stencil buffers

Kenneth Graunke kenneth at whitecape.org
Sun Jun 5 01:37:27 PDT 2011


On 06/04/2011 04:29 PM, Chad Versace wrote:
> On 06/03/2011 03:33 PM, Kenneth Graunke wrote:
>> Do we need to emit 3DSTATE_STENCIL_BUFFER with all 0's in the stencil_irb == NULL case?  Ditto for HiZ I guess.  Just being a
>> bit paranoid.
>
> The test results for these paranoiac cases pass, so paranoia is unneeded. Regarding "Do we need to emit 3DSTATE_STENCIL_BUFFER
> with all 0's in the stencil_irb == NULL case", see tests:
> 	* hiz-depth-test-fbo-d24-s0 : column 6
> 	* hiz-depth-stencil-fbo-d24-s0 : columns 3, 6
> Regarding "Ditto for HiZ", the following test runs emit a stencil buffer but no hiz buffer:
> 	* hiz-stencil-test-fbo-d0-s8 : column 6
> 	* hiz-stencil-read-fbo-d0-s8 : column 6
> 	* hiz-depth-stencil-fbo-d0-s8 : column 6

Hrm.  I was thinking of a slightly more elaborate case: Render to an FBO 
that has both depth and stencil...then render to another FBO that only 
has depth.  The question is: would the old stencil buffer stay 
programmed and somehow get used.  Although come to think of it, I think 
the "Separate Stencil Enable" bit in 3DSTATE_DEPTH_BUFFER ought to be 
sufficient.  So it's probably okay.

> On your suggestion, I added this hunk to the patch.
>
> diff --git a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
> index 5dadb5b..f560bc3 100644
> --- a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
> +++ b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
> @@ -169,6 +169,7 @@ translate_tex_format(gl_format mesa_format,
>            return BRW_SURFACEFORMAT_L16_UNORM;
>
>      case MESA_FORMAT_S8_Z24:
> +   case MESA_FORMAT_X8_Z24:
>         /* XXX: these different surface formats don't seem to
>          * make any difference for shadow sampler/compares.
>          */

Thanks!
Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>


More information about the mesa-dev mailing list