Replaces: "[PATCH] mesa: Fix meta smashing stencil reference value on restore"

This series changes the way stencil reference values are clamped. Previously,
the values would be clamped according to the bit depth of the stencil buffer
bound _when the the value was specified_. This looked correct in most cases, 
but fell apart
in some cases where the stencil buffer validated against is not the same as the 
buffer that
would be rendered into.


A simple example is this sequence, which would produce a reference value of 
zero,
even though the user probably meant otherwise:

1. BindFramebuffer( .. fbo with NO stencil )
2. StencilFuncSeparate( .. 0xff .. )
3. BindFramebuffer( .. fbo with stencil )


A more realistic case involves a meta op restoring the stencil state, which is 
done by calling
the StencilFuncSeparate() API just the same as the user:

1. BindFramebuffer( .. fbo with stencil )
2. StencilFuncSeparate( .. 0xff .. )
3. BindFramebuffer( .. fbo with NO stencil .. )
4. <some meta op>
5. BindFramebuffer( .. fbo with stencil )

In this case, the stencil reference value would be revalidated against zero 
stencil
bits at (4) and so smashed to zero. This sequence is from Portal.


This series moves the clamping to the point of use, which is consistent with 
the 3.2 spec,
and the behavior of NVIDIA's driver.

Fixes broken rendering in Portal.

Thanks to Ken for pointing out my misinterpretation of the spec in my original 
patch.

-- Chris


_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to