_mesa_StencilFunc( GLenum func, GLint ref, GLuint mask )
{
GET_CURRENT_CONTEXT(ctx);
- GLint maxref;
+ const GLint stencilMax = (1 << ctx->DrawBuffer->Visual.stencilBits) - 1;
ASSERT_OUTSIDE_BEGIN_END(ctx);
switch (func) {
return;
}
- maxref = (1 << STENCIL_BITS) - 1;
- ref = CLAMP( ref, 0, maxref );
+ ref = CLAMP( ref, 0, stencilMax );
if (ctx->Extensions.EXT_stencil_two_side) {
/* only set active face state */
_mesa_StencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask)
{
GET_CURRENT_CONTEXT(ctx);
- GLint maxref;
+ const GLint stencilMax = (1 << ctx->DrawBuffer->Visual.stencilBits) - 1;
ASSERT_OUTSIDE_BEGIN_END(ctx);
if (face != GL_FRONT && face != GL_BACK && face != GL_FRONT_AND_BACK) {
return;
}
- maxref = (1 << STENCIL_BITS) - 1;
- ref = CLAMP(ref, 0, maxref);
+ ref = CLAMP(ref, 0, stencilMax);
FLUSH_VERTICES(ctx, _NEW_STENCIL);