diff options
author | Brian Paul <[email protected]> | 2005-09-20 04:25:03 +0000 |
---|---|---|
committer | Brian Paul <[email protected]> | 2005-09-20 04:25:03 +0000 |
commit | 3211b28ee633707218fe7eb2bdfc604c10fd8d29 (patch) | |
tree | b3ab56f47b858a86180ff03e329f73eb3c0db222 /src/mesa/swrast/s_stencil.c | |
parent | cd81190d5c5f7064e0013eb313f2ad5da863fad7 (diff) |
remove STENCIL_MAX
Diffstat (limited to 'src/mesa/swrast/s_stencil.c')
-rw-r--r-- | src/mesa/swrast/s_stencil.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/mesa/swrast/s_stencil.c b/src/mesa/swrast/s_stencil.c index d8e49cbe415..f0d8bef39c2 100644 --- a/src/mesa/swrast/s_stencil.c +++ b/src/mesa/swrast/s_stencil.c @@ -69,6 +69,7 @@ apply_stencil_op( const GLcontext *ctx, GLenum oper, GLuint face, const GLstencil ref = ctx->Stencil.Ref[face]; const GLstencil wrtmask = ctx->Stencil.WriteMask[face]; const GLstencil invmask = (GLstencil) (~wrtmask); + const GLstencil stencilMax = (1 << ctx->DrawBuffer->Visual.stencilBits) - 1; GLuint i; switch (oper) { @@ -113,7 +114,7 @@ apply_stencil_op( const GLcontext *ctx, GLenum oper, GLuint face, for (i=0;i<n;i++) { if (mask[i]) { GLstencil s = stencil[i]; - if (s < STENCIL_MAX) { + if (s < stencilMax) { stencil[i] = (GLstencil) (s+1); } } @@ -124,7 +125,7 @@ apply_stencil_op( const GLcontext *ctx, GLenum oper, GLuint face, if (mask[i]) { /* VERIFY logic of adding 1 to a write-masked value */ GLstencil s = stencil[i]; - if (s < STENCIL_MAX) { + if (s < stencilMax) { stencil[i] = (GLstencil) ((invmask & s) | (wrtmask & (s+1))); } } @@ -530,6 +531,7 @@ apply_stencil_op_to_pixels( GLcontext *ctx, { struct gl_framebuffer *fb = ctx->DrawBuffer; struct gl_renderbuffer *rb = fb->Attachment[BUFFER_STENCIL].Renderbuffer; + const GLstencil stencilMax = (1 << fb->Visual.stencilBits) - 1; const GLstencil ref = ctx->Stencil.Ref[face]; const GLstencil wrtmask = ctx->Stencil.WriteMask[face]; const GLstencil invmask = (GLstencil) (~wrtmask); @@ -585,7 +587,7 @@ apply_stencil_op_to_pixels( GLcontext *ctx, for (i=0;i<n;i++) { if (mask[i]) { GLstencil *sptr = STENCIL_ADDRESS( x[i], y[i] ); - if (*sptr < STENCIL_MAX) { + if (*sptr < stencilMax) { *sptr = (GLstencil) (*sptr + 1); } } @@ -595,7 +597,7 @@ apply_stencil_op_to_pixels( GLcontext *ctx, for (i=0;i<n;i++) { if (mask[i]) { GLstencil *sptr = STENCIL_ADDRESS( x[i], y[i] ); - if (*sptr < STENCIL_MAX) { + if (*sptr < stencilMax) { *sptr = (GLstencil) ((invmask & *sptr) | (wrtmask & (*sptr+1))); } } |