*/
static void
apply_stencil_op( const struct gl_context *ctx, GLenum oper, GLuint face,
- GLuint n, GLstencil stencil[], const GLubyte mask[] )
+ GLuint n, GLubyte stencil[], const GLubyte mask[] )
{
- 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;
+ const GLubyte ref = ctx->Stencil.Ref[face];
+ const GLubyte wrtmask = ctx->Stencil.WriteMask[face];
+ const GLubyte invmask = (GLubyte) (~wrtmask);
+ const GLubyte stencilMax = (1 << ctx->DrawBuffer->Visual.stencilBits) - 1;
GLuint i;
switch (oper) {
else {
for (i=0;i<n;i++) {
if (mask[i]) {
- stencil[i] = (GLstencil) (stencil[i] & invmask);
+ stencil[i] = (GLubyte) (stencil[i] & invmask);
}
}
}
else {
for (i=0;i<n;i++) {
if (mask[i]) {
- GLstencil s = stencil[i];
- stencil[i] = (GLstencil) ((invmask & s ) | (wrtmask & ref));
+ GLubyte s = stencil[i];
+ stencil[i] = (GLubyte) ((invmask & s ) | (wrtmask & ref));
}
}
}
if (invmask==0) {
for (i=0;i<n;i++) {
if (mask[i]) {
- GLstencil s = stencil[i];
+ GLubyte s = stencil[i];
if (s < stencilMax) {
- stencil[i] = (GLstencil) (s+1);
+ stencil[i] = (GLubyte) (s+1);
}
}
}
for (i=0;i<n;i++) {
if (mask[i]) {
/* VERIFY logic of adding 1 to a write-masked value */
- GLstencil s = stencil[i];
+ GLubyte s = stencil[i];
if (s < stencilMax) {
- stencil[i] = (GLstencil) ((invmask & s) | (wrtmask & (s+1)));
+ stencil[i] = (GLubyte) ((invmask & s) | (wrtmask & (s+1)));
}
}
}
if (invmask==0) {
for (i=0;i<n;i++) {
if (mask[i]) {
- GLstencil s = stencil[i];
+ GLubyte s = stencil[i];
if (s>0) {
- stencil[i] = (GLstencil) (s-1);
+ stencil[i] = (GLubyte) (s-1);
}
}
}
for (i=0;i<n;i++) {
if (mask[i]) {
/* VERIFY logic of subtracting 1 to a write-masked value */
- GLstencil s = stencil[i];
+ GLubyte s = stencil[i];
if (s>0) {
- stencil[i] = (GLstencil) ((invmask & s) | (wrtmask & (s-1)));
+ stencil[i] = (GLubyte) ((invmask & s) | (wrtmask & (s-1)));
}
}
}
else {
for (i=0;i<n;i++) {
if (mask[i]) {
- GLstencil s = stencil[i];
- stencil[i] = (GLstencil) ((invmask & s) | (wrtmask & (s+1)));
+ GLubyte s = stencil[i];
+ stencil[i] = (GLubyte) ((invmask & s) | (wrtmask & (s+1)));
}
}
}
else {
for (i=0;i<n;i++) {
if (mask[i]) {
- GLstencil s = stencil[i];
- stencil[i] = (GLstencil) ((invmask & s) | (wrtmask & (s-1)));
+ GLubyte s = stencil[i];
+ stencil[i] = (GLubyte) ((invmask & s) | (wrtmask & (s-1)));
}
}
}
if (invmask==0) {
for (i=0;i<n;i++) {
if (mask[i]) {
- GLstencil s = stencil[i];
- stencil[i] = (GLstencil) ~s;
+ GLubyte s = stencil[i];
+ stencil[i] = (GLubyte) ~s;
}
}
}
else {
for (i=0;i<n;i++) {
if (mask[i]) {
- GLstencil s = stencil[i];
- stencil[i] = (GLstencil) ((invmask & s) | (wrtmask & ~s));
+ GLubyte s = stencil[i];
+ stencil[i] = (GLubyte) ((invmask & s) | (wrtmask & ~s));
}
}
}
* Return: GL_FALSE = all pixels failed, GL_TRUE = zero or more pixels passed.
*/
static GLboolean
-do_stencil_test( struct gl_context *ctx, GLuint face, GLuint n, GLstencil stencil[],
+do_stencil_test( struct gl_context *ctx, GLuint face, GLuint n, GLubyte stencil[],
GLubyte mask[] )
{
GLubyte fail[MAX_WIDTH];
GLboolean allfail = GL_FALSE;
GLuint i;
const GLuint valueMask = ctx->Stencil.ValueMask[face];
- const GLstencil r = (GLstencil) (ctx->Stencil.Ref[face] & valueMask);
- GLstencil s;
+ const GLubyte r = (GLubyte) (ctx->Stencil.Ref[face] & valueMask);
+ GLubyte s;
ASSERT(n <= MAX_WIDTH);
case GL_LESS:
for (i=0;i<n;i++) {
if (mask[i]) {
- s = (GLstencil) (stencil[i] & valueMask);
+ s = (GLubyte) (stencil[i] & valueMask);
if (r < s) {
/* passed */
fail[i] = 0;
case GL_LEQUAL:
for (i=0;i<n;i++) {
if (mask[i]) {
- s = (GLstencil) (stencil[i] & valueMask);
+ s = (GLubyte) (stencil[i] & valueMask);
if (r <= s) {
/* pass */
fail[i] = 0;
case GL_GREATER:
for (i=0;i<n;i++) {
if (mask[i]) {
- s = (GLstencil) (stencil[i] & valueMask);
+ s = (GLubyte) (stencil[i] & valueMask);
if (r > s) {
/* passed */
fail[i] = 0;
case GL_GEQUAL:
for (i=0;i<n;i++) {
if (mask[i]) {
- s = (GLstencil) (stencil[i] & valueMask);
+ s = (GLubyte) (stencil[i] & valueMask);
if (r >= s) {
/* passed */
fail[i] = 0;
case GL_EQUAL:
for (i=0;i<n;i++) {
if (mask[i]) {
- s = (GLstencil) (stencil[i] & valueMask);
+ s = (GLubyte) (stencil[i] & valueMask);
if (r == s) {
/* passed */
fail[i] = 0;
case GL_NOTEQUAL:
for (i=0;i<n;i++) {
if (mask[i]) {
- s = (GLstencil) (stencil[i] & valueMask);
+ s = (GLubyte) (stencil[i] & valueMask);
if (r != s) {
/* passed */
fail[i] = 0;
{
struct gl_framebuffer *fb = ctx->DrawBuffer;
struct gl_renderbuffer *rb = fb->_StencilBuffer;
- GLstencil stencilRow[MAX_WIDTH];
- GLstencil *stencil;
+ GLubyte stencilRow[MAX_WIDTH];
+ GLubyte *stencil;
const GLuint n = span->end;
const GLint x = span->x;
const GLint y = span->y;
}
#endif
- stencil = (GLstencil *) rb->GetPointer(ctx, rb, x, y);
+ stencil = (GLubyte *) rb->GetPointer(ctx, rb, x, y);
if (!stencil) {
rb->GetRow(ctx, rb, n, x, y, stencilRow);
stencil = stencilRow;
{
struct gl_framebuffer *fb = ctx->DrawBuffer;
struct gl_renderbuffer *rb = fb->_StencilBuffer;
- 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);
+ const GLubyte stencilMax = (1 << fb->Visual.stencilBits) - 1;
+ const GLubyte ref = ctx->Stencil.Ref[face];
+ const GLubyte wrtmask = ctx->Stencil.WriteMask[face];
+ const GLubyte invmask = (GLubyte) (~wrtmask);
GLuint i;
- GLstencil *stencilStart = (GLubyte *) rb->Data;
+ GLubyte *stencilStart = (GLubyte *) rb->Data;
const GLuint stride = rb->Width;
ASSERT(rb->GetPointer(ctx, rb, 0, 0));
- ASSERT(sizeof(GLstencil) == 1);
switch (oper) {
case GL_KEEP:
if (invmask==0) {
for (i=0;i<n;i++) {
if (mask[i]) {
- GLstencil *sptr = STENCIL_ADDRESS( x[i], y[i] );
+ GLubyte *sptr = STENCIL_ADDRESS( x[i], y[i] );
*sptr = 0;
}
}
else {
for (i=0;i<n;i++) {
if (mask[i]) {
- GLstencil *sptr = STENCIL_ADDRESS( x[i], y[i] );
- *sptr = (GLstencil) (invmask & *sptr);
+ GLubyte *sptr = STENCIL_ADDRESS( x[i], y[i] );
+ *sptr = (GLubyte) (invmask & *sptr);
}
}
}
if (invmask==0) {
for (i=0;i<n;i++) {
if (mask[i]) {
- GLstencil *sptr = STENCIL_ADDRESS( x[i], y[i] );
+ GLubyte *sptr = STENCIL_ADDRESS( x[i], y[i] );
*sptr = ref;
}
}
else {
for (i=0;i<n;i++) {
if (mask[i]) {
- GLstencil *sptr = STENCIL_ADDRESS( x[i], y[i] );
- *sptr = (GLstencil) ((invmask & *sptr ) | (wrtmask & ref));
+ GLubyte *sptr = STENCIL_ADDRESS( x[i], y[i] );
+ *sptr = (GLubyte) ((invmask & *sptr ) | (wrtmask & ref));
}
}
}
if (invmask==0) {
for (i=0;i<n;i++) {
if (mask[i]) {
- GLstencil *sptr = STENCIL_ADDRESS( x[i], y[i] );
+ GLubyte *sptr = STENCIL_ADDRESS( x[i], y[i] );
if (*sptr < stencilMax) {
- *sptr = (GLstencil) (*sptr + 1);
+ *sptr = (GLubyte) (*sptr + 1);
}
}
}
else {
for (i=0;i<n;i++) {
if (mask[i]) {
- GLstencil *sptr = STENCIL_ADDRESS( x[i], y[i] );
+ GLubyte *sptr = STENCIL_ADDRESS( x[i], y[i] );
if (*sptr < stencilMax) {
- *sptr = (GLstencil) ((invmask & *sptr) | (wrtmask & (*sptr+1)));
+ *sptr = (GLubyte) ((invmask & *sptr) | (wrtmask & (*sptr+1)));
}
}
}
if (invmask==0) {
for (i=0;i<n;i++) {
if (mask[i]) {
- GLstencil *sptr = STENCIL_ADDRESS( x[i], y[i] );
+ GLubyte *sptr = STENCIL_ADDRESS( x[i], y[i] );
if (*sptr>0) {
- *sptr = (GLstencil) (*sptr - 1);
+ *sptr = (GLubyte) (*sptr - 1);
}
}
}
else {
for (i=0;i<n;i++) {
if (mask[i]) {
- GLstencil *sptr = STENCIL_ADDRESS( x[i], y[i] );
+ GLubyte *sptr = STENCIL_ADDRESS( x[i], y[i] );
if (*sptr>0) {
- *sptr = (GLstencil) ((invmask & *sptr) | (wrtmask & (*sptr-1)));
+ *sptr = (GLubyte) ((invmask & *sptr) | (wrtmask & (*sptr-1)));
}
}
}
if (invmask==0) {
for (i=0;i<n;i++) {
if (mask[i]) {
- GLstencil *sptr = STENCIL_ADDRESS( x[i], y[i] );
- *sptr = (GLstencil) (*sptr + 1);
+ GLubyte *sptr = STENCIL_ADDRESS( x[i], y[i] );
+ *sptr = (GLubyte) (*sptr + 1);
}
}
}
else {
for (i=0;i<n;i++) {
if (mask[i]) {
- GLstencil *sptr = STENCIL_ADDRESS( x[i], y[i] );
- *sptr = (GLstencil) ((invmask & *sptr) | (wrtmask & (*sptr+1)));
+ GLubyte *sptr = STENCIL_ADDRESS( x[i], y[i] );
+ *sptr = (GLubyte) ((invmask & *sptr) | (wrtmask & (*sptr+1)));
}
}
}
if (invmask==0) {
for (i=0;i<n;i++) {
if (mask[i]) {
- GLstencil *sptr = STENCIL_ADDRESS( x[i], y[i] );
- *sptr = (GLstencil) (*sptr - 1);
+ GLubyte *sptr = STENCIL_ADDRESS( x[i], y[i] );
+ *sptr = (GLubyte) (*sptr - 1);
}
}
}
else {
for (i=0;i<n;i++) {
if (mask[i]) {
- GLstencil *sptr = STENCIL_ADDRESS( x[i], y[i] );
- *sptr = (GLstencil) ((invmask & *sptr) | (wrtmask & (*sptr-1)));
+ GLubyte *sptr = STENCIL_ADDRESS( x[i], y[i] );
+ *sptr = (GLubyte) ((invmask & *sptr) | (wrtmask & (*sptr-1)));
}
}
}
if (invmask==0) {
for (i=0;i<n;i++) {
if (mask[i]) {
- GLstencil *sptr = STENCIL_ADDRESS( x[i], y[i] );
- *sptr = (GLstencil) (~*sptr);
+ GLubyte *sptr = STENCIL_ADDRESS( x[i], y[i] );
+ *sptr = (GLubyte) (~*sptr);
}
}
}
else {
for (i=0;i<n;i++) {
if (mask[i]) {
- GLstencil *sptr = STENCIL_ADDRESS( x[i], y[i] );
- *sptr = (GLstencil) ((invmask & *sptr) | (wrtmask & ~*sptr));
+ GLubyte *sptr = STENCIL_ADDRESS( x[i], y[i] );
+ *sptr = (GLubyte) ((invmask & *sptr) | (wrtmask & ~*sptr));
}
}
}
const struct gl_framebuffer *fb = ctx->DrawBuffer;
struct gl_renderbuffer *rb = fb->_StencilBuffer;
GLubyte fail[MAX_WIDTH];
- GLstencil r, s;
+ GLubyte r, s;
GLuint i;
GLboolean allfail = GL_FALSE;
const GLuint valueMask = ctx->Stencil.ValueMask[face];
- const GLstencil *stencilStart = (GLstencil *) rb->Data;
+ const GLubyte *stencilStart = (GLubyte *) rb->Data;
const GLuint stride = rb->Width;
ASSERT(rb->GetPointer(ctx, rb, 0, 0));
- ASSERT(sizeof(GLstencil) == 1);
/*
* Perform stencil test. The results of this operation are stored
allfail = GL_TRUE;
break;
case GL_LESS:
- r = (GLstencil) (ctx->Stencil.Ref[face] & valueMask);
+ r = (GLubyte) (ctx->Stencil.Ref[face] & valueMask);
for (i=0;i<n;i++) {
if (mask[i]) {
- const GLstencil *sptr = STENCIL_ADDRESS(x[i],y[i]);
- s = (GLstencil) (*sptr & valueMask);
+ const GLubyte *sptr = STENCIL_ADDRESS(x[i],y[i]);
+ s = (GLubyte) (*sptr & valueMask);
if (r < s) {
/* passed */
fail[i] = 0;
}
break;
case GL_LEQUAL:
- r = (GLstencil) (ctx->Stencil.Ref[face] & valueMask);
+ r = (GLubyte) (ctx->Stencil.Ref[face] & valueMask);
for (i=0;i<n;i++) {
if (mask[i]) {
- const GLstencil *sptr = STENCIL_ADDRESS(x[i],y[i]);
- s = (GLstencil) (*sptr & valueMask);
+ const GLubyte *sptr = STENCIL_ADDRESS(x[i],y[i]);
+ s = (GLubyte) (*sptr & valueMask);
if (r <= s) {
/* pass */
fail[i] = 0;
}
break;
case GL_GREATER:
- r = (GLstencil) (ctx->Stencil.Ref[face] & valueMask);
+ r = (GLubyte) (ctx->Stencil.Ref[face] & valueMask);
for (i=0;i<n;i++) {
if (mask[i]) {
- const GLstencil *sptr = STENCIL_ADDRESS(x[i],y[i]);
- s = (GLstencil) (*sptr & valueMask);
+ const GLubyte *sptr = STENCIL_ADDRESS(x[i],y[i]);
+ s = (GLubyte) (*sptr & valueMask);
if (r > s) {
/* passed */
fail[i] = 0;
}
break;
case GL_GEQUAL:
- r = (GLstencil) (ctx->Stencil.Ref[face] & valueMask);
+ r = (GLubyte) (ctx->Stencil.Ref[face] & valueMask);
for (i=0;i<n;i++) {
if (mask[i]) {
- const GLstencil *sptr = STENCIL_ADDRESS(x[i],y[i]);
- s = (GLstencil) (*sptr & valueMask);
+ const GLubyte *sptr = STENCIL_ADDRESS(x[i],y[i]);
+ s = (GLubyte) (*sptr & valueMask);
if (r >= s) {
/* passed */
fail[i] = 0;
}
break;
case GL_EQUAL:
- r = (GLstencil) (ctx->Stencil.Ref[face] & valueMask);
+ r = (GLubyte) (ctx->Stencil.Ref[face] & valueMask);
for (i=0;i<n;i++) {
if (mask[i]) {
- const GLstencil *sptr = STENCIL_ADDRESS(x[i],y[i]);
- s = (GLstencil) (*sptr & valueMask);
+ const GLubyte *sptr = STENCIL_ADDRESS(x[i],y[i]);
+ s = (GLubyte) (*sptr & valueMask);
if (r == s) {
/* passed */
fail[i] = 0;
}
break;
case GL_NOTEQUAL:
- r = (GLstencil) (ctx->Stencil.Ref[face] & valueMask);
+ r = (GLubyte) (ctx->Stencil.Ref[face] & valueMask);
for (i=0;i<n;i++) {
if (mask[i]) {
- const GLstencil *sptr = STENCIL_ADDRESS(x[i],y[i]);
- s = (GLstencil) (*sptr & valueMask);
+ const GLubyte *sptr = STENCIL_ADDRESS(x[i],y[i]);
+ s = (GLubyte) (*sptr & valueMask);
if (r != s) {
/* passed */
fail[i] = 0;
if (!rb->GetPointer(ctx, rb, 0, 0)) {
/* No direct access */
- GLstencil stencil[MAX_WIDTH];
+ GLubyte stencil[MAX_WIDTH];
ASSERT(rb->DataType == GL_UNSIGNED_BYTE);
_swrast_get_values(ctx, rb, n, x, y, stencil, sizeof(GLubyte));
*/
void
_swrast_read_stencil_span(struct gl_context *ctx, struct gl_renderbuffer *rb,
- GLint n, GLint x, GLint y, GLstencil stencil[])
+ GLint n, GLint x, GLint y, GLubyte stencil[])
{
if (y < 0 || y >= (GLint) rb->Height ||
x + n <= 0 || x >= (GLint) rb->Width) {
*/
void
_swrast_write_stencil_span(struct gl_context *ctx, GLint n, GLint x, GLint y,
- const GLstencil stencil[] )
+ const GLubyte stencil[] )
{
struct gl_framebuffer *fb = ctx->DrawBuffer;
struct gl_renderbuffer *rb = fb->_StencilBuffer;
if ((stencilMask & stencilMax) != stencilMax) {
/* need to apply writemask */
- GLstencil destVals[MAX_WIDTH], newVals[MAX_WIDTH];
+ GLubyte destVals[MAX_WIDTH], newVals[MAX_WIDTH];
GLint i;
rb->GetRow(ctx, rb, n, x, y, destVals);
for (i = 0; i < n; i++) {