[Mesa-dev] [PATCH] llvmpipe: Obey back writemask.
Jose Fonseca
jfonseca at vmware.com
Tue Oct 30 13:18:54 PDT 2012
----- Original Message -----
> On 10/30/2012 01:48 PM, jfonseca at vmware.com wrote:
> > From: José Fonseca<jose.r.fonseca at gmail.com>
> >
> > Tested with a modified glean tstencil2 test.
> > ---
> > src/gallium/drivers/llvmpipe/lp_bld_depth.c | 10 ++++++++--
> > 1 file changed, 8 insertions(+), 2 deletions(-)
> >
> > diff --git a/src/gallium/drivers/llvmpipe/lp_bld_depth.c
> > b/src/gallium/drivers/llvmpipe/lp_bld_depth.c
> > index 8efa75c..5c3715a 100644
> > --- a/src/gallium/drivers/llvmpipe/lp_bld_depth.c
> > +++ b/src/gallium/drivers/llvmpipe/lp_bld_depth.c
> > @@ -273,11 +273,17 @@ lp_build_stencil_op(struct lp_build_context
> > *bld,
> > res = lp_build_select(bld, front_facing, res, back_res);
> > }
> >
> > - /* XXX what about the back-face writemask? */
> > - if (stencil[0].writemask != 0xff) {
> > + if (stencil[0].writemask != 0xff ||
> > + (stencil[1].enabled&& front_facing != NULL&&
> > stencil[1].writemask != 0xff)) {
> > /* mask&= stencil[0].writemask */
> > LLVMValueRef writemask =
> > lp_build_const_int_vec(bld->gallivm, bld->type,
> > stencil[0].writemask);
> > + if (stencil[1].enabled&& stencil[1].writemask !=
> > stencil[0].writemask&& front_facing != NULL) {
> > + LLVMValueRef back_writemask =
> > lp_build_const_int_vec(bld->gallivm, bld->type,
> > +
> > stencil[1].writemask);
> > + writemask = lp_build_select(bld, front_facing, writemask,
> > back_writemask);
> > + }
> > +
> > mask = LLVMBuildAnd(builder, mask, writemask, "");
> > /* res = (res& mask) | (stencilVals& ~mask) */
> > res = lp_build_select_bitwise(bld, mask, res, stencilVals);
>
>
> Reviewed-by: Brian Paul <brianp at vmware.com>
>
> Does this fix https://bugs.freedesktop.org/show_bug.cgi?id=41787 ?
Unfortunately no.
Very peculiar bug. Although the symptom is seen in the stencil buffer, I'm getting the feeling that the bug is due to a depth fighting issue, and not a problem in the stencil state translation. Alas it's not a trivial depth fighting issue neither -- fiddling with polygon offset doesn't seem to help in anyway.
> If so, maybe make note of that in the commit message.
>
> Candidate for stable branches?
Yes. Thanks for reminding me.
Jose
More information about the mesa-dev
mailing list