[Mesa-dev] [PATCH 5/8] radeon: Use accessor for stencil reference values

Ian Romanick idr at freedesktop.org
Mon May 13 10:58:26 PDT 2013


On 05/13/2013 04:10 AM, Chris Forbes wrote:
> Signed-off-by: Chris Forbes <chrisf at ijw.co.nz>
> ---
>   src/mesa/drivers/dri/r200/r200_state.c     | 3 ++-
>   src/mesa/drivers/dri/radeon/radeon_state.c | 4 +++-
>   2 files changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/src/mesa/drivers/dri/r200/r200_state.c b/src/mesa/drivers/dri/r200/r200_state.c
> index f812a15..3548684 100644
> --- a/src/mesa/drivers/dri/r200/r200_state.c
> +++ b/src/mesa/drivers/dri/r200/r200_state.c
> @@ -41,6 +41,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
>   #include "main/light.h"
>   #include "main/framebuffer.h"
>   #include "main/fbobject.h"
> +#include "main/stencil.h"
>
>   #include "swrast/swrast.h"
>   #include "vbo/vbo.h"
> @@ -1384,7 +1385,7 @@ r200StencilFuncSeparate( struct gl_context *ctx, GLenum face, GLenum func,
>                            GLint ref, GLuint mask )
>   {
>      r200ContextPtr rmesa = R200_CONTEXT(ctx);
> -   GLuint refmask = (((ctx->Stencil.Ref[0] & 0xff) << R200_STENCIL_REF_SHIFT) |
> +   GLuint refmask = (((_mesa_get_stencil_ref(ctx, 0) & 0xff) << R200_STENCIL_REF_SHIFT) |
>   		     ((ctx->Stencil.ValueMask[0] & 0xff) << R200_STENCIL_MASK_SHIFT));
>
>      R200_STATECHANGE( rmesa, ctx );
> diff --git a/src/mesa/drivers/dri/radeon/radeon_state.c b/src/mesa/drivers/dri/radeon/radeon_state.c
> index 94fb69b..2d9e87e 100644
> --- a/src/mesa/drivers/dri/radeon/radeon_state.c
> +++ b/src/mesa/drivers/dri/radeon/radeon_state.c
> @@ -42,6 +42,8 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
>   #include "main/fbobject.h"
>   #include "main/simple_list.h"
>   #include "main/state.h"
> +#include "main/core.h"
> +#include "main/stencil.h"
>
>   #include "vbo/vbo.h"
>   #include "tnl/tnl.h"
> @@ -1156,7 +1158,7 @@ radeonStencilFuncSeparate( struct gl_context *ctx, GLenum face, GLenum func,
>                              GLint ref, GLuint mask )
>   {
>      r100ContextPtr rmesa = R100_CONTEXT(ctx);
> -   GLuint refmask = (((ctx->Stencil.Ref[0] & 0xff) << RADEON_STENCIL_REF_SHIFT) |
> +   GLuint refmask = (((_mesa_get_stencil_ref(ctx, 0) & 0xff) << RADEON_STENCIL_REF_SHIFT) |

I don't think the '& 0xff' is still necessary since a maximum of 8-bits 
stencil is supported.

>   		     ((ctx->Stencil.ValueMask[0] & 0xff) << RADEON_STENCIL_MASK_SHIFT));
>
>      RADEON_STATECHANGE( rmesa, ctx );
>



More information about the mesa-dev mailing list