From d41bc08d1ae8c4784c09d8977816c0fadab1ba52 Mon Sep 17 00:00:00 2001 From: marha Date: Thu, 17 Nov 2011 16:37:26 +0100 Subject: xserver mesa git update 17 nov 2011 --- mesalib/src/mesa/swrast/s_stencil.c | 184 ++++++++++++++++++------------------ 1 file changed, 91 insertions(+), 93 deletions(-) (limited to 'mesalib/src/mesa/swrast/s_stencil.c') diff --git a/mesalib/src/mesa/swrast/s_stencil.c b/mesalib/src/mesa/swrast/s_stencil.c index e713e2393..101ee5056 100644 --- a/mesalib/src/mesa/swrast/s_stencil.c +++ b/mesalib/src/mesa/swrast/s_stencil.c @@ -62,12 +62,12 @@ ENDIF */ 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) { @@ -85,7 +85,7 @@ apply_stencil_op( const struct gl_context *ctx, GLenum oper, GLuint face, else { for (i=0;i0) { - stencil[i] = (GLstencil) (s-1); + stencil[i] = (GLubyte) (s-1); } } } @@ -145,9 +145,9 @@ apply_stencil_op( const struct gl_context *ctx, GLenum oper, GLuint face, for (i=0;i0) { - stencil[i] = (GLstencil) ((invmask & s) | (wrtmask & (s-1))); + stencil[i] = (GLubyte) ((invmask & s) | (wrtmask & (s-1))); } } } @@ -164,8 +164,8 @@ apply_stencil_op( const struct gl_context *ctx, GLenum oper, GLuint face, else { for (i=0;iStencil.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); @@ -263,7 +263,7 @@ do_stencil_test( struct gl_context *ctx, GLuint face, GLuint n, GLstencil stenci case GL_LESS: for (i=0;i s) { /* passed */ fail[i] = 0; @@ -317,7 +317,7 @@ do_stencil_test( struct gl_context *ctx, GLuint face, GLuint n, GLstencil stenci case GL_GEQUAL: for (i=0;i= s) { /* passed */ fail[i] = 0; @@ -335,7 +335,7 @@ do_stencil_test( struct gl_context *ctx, GLuint face, GLuint n, GLstencil stenci case GL_EQUAL: for (i=0;iDrawBuffer; 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; @@ -438,7 +438,7 @@ stencil_and_ztest_span(struct gl_context *ctx, SWspan *span, GLuint face) } #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; @@ -531,16 +531,15 @@ apply_stencil_op_to_pixels( struct gl_context *ctx, { 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: @@ -550,7 +549,7 @@ apply_stencil_op_to_pixels( struct gl_context *ctx, if (invmask==0) { for (i=0;i0) { - *sptr = (GLstencil) (*sptr - 1); + *sptr = (GLubyte) (*sptr - 1); } } } @@ -618,9 +617,9 @@ apply_stencil_op_to_pixels( struct gl_context *ctx, else { for (i=0;i0) { - *sptr = (GLstencil) ((invmask & *sptr) | (wrtmask & (*sptr-1))); + *sptr = (GLubyte) ((invmask & *sptr) | (wrtmask & (*sptr-1))); } } } @@ -630,16 +629,16 @@ apply_stencil_op_to_pixels( struct gl_context *ctx, if (invmask==0) { for (i=0;iDrawBuffer; 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 @@ -740,11 +738,11 @@ stencil_test_pixels( struct gl_context *ctx, GLuint face, GLuint n, allfail = GL_TRUE; break; case GL_LESS: - r = (GLstencil) (ctx->Stencil.Ref[face] & valueMask); + r = (GLubyte) (ctx->Stencil.Ref[face] & valueMask); for (i=0;iStencil.Ref[face] & valueMask); + r = (GLubyte) (ctx->Stencil.Ref[face] & valueMask); for (i=0;iStencil.Ref[face] & valueMask); + r = (GLubyte) (ctx->Stencil.Ref[face] & valueMask); for (i=0;i s) { /* passed */ fail[i] = 0; @@ -800,11 +798,11 @@ stencil_test_pixels( struct gl_context *ctx, GLuint face, GLuint n, } break; case GL_GEQUAL: - r = (GLstencil) (ctx->Stencil.Ref[face] & valueMask); + r = (GLubyte) (ctx->Stencil.Ref[face] & valueMask); for (i=0;i= s) { /* passed */ fail[i] = 0; @@ -820,11 +818,11 @@ stencil_test_pixels( struct gl_context *ctx, GLuint face, GLuint n, } break; case GL_EQUAL: - r = (GLstencil) (ctx->Stencil.Ref[face] & valueMask); + r = (GLubyte) (ctx->Stencil.Ref[face] & valueMask); for (i=0;iStencil.Ref[face] & valueMask); + r = (GLubyte) (ctx->Stencil.Ref[face] & valueMask); for (i=0;iGetPointer(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)); @@ -1044,7 +1042,7 @@ clip_span(GLuint bufferWidth, GLuint bufferHeight, */ 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) { @@ -1081,7 +1079,7 @@ _swrast_read_stencil_span(struct gl_context *ctx, struct gl_renderbuffer *rb, */ 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; @@ -1109,7 +1107,7 @@ _swrast_write_stencil_span(struct gl_context *ctx, GLint n, GLint x, GLint y, 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++) { -- cgit v1.2.3