summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2011-11-11 07:30:18 -0700
committerBrian Paul <[email protected]>2011-11-15 07:49:25 -0700
commit6d68855df133bdd4891e8aa428787b520739e0fe (patch)
tree4d242ff9bbbc094774792440ae25cff47346568f
parentcc502aa9419a6fb127b264dbb131c786281cb8c7 (diff)
mesa: replace GLstencil with GLubyte
-rw-r--r--src/mesa/main/mtypes.h12
-rw-r--r--src/mesa/main/pack.c23
-rw-r--r--src/mesa/main/pack.h4
-rw-r--r--src/mesa/main/pixeltransfer.c4
-rw-r--r--src/mesa/main/pixeltransfer.h2
-rw-r--r--src/mesa/state_tracker/st_cb_readpixels.c2
-rw-r--r--src/mesa/swrast/s_copypix.c16
-rw-r--r--src/mesa/swrast/s_drawpix.c10
-rw-r--r--src/mesa/swrast/s_readpix.c6
-rw-r--r--src/mesa/swrast/s_stencil.c184
-rw-r--r--src/mesa/swrast/s_stencil.h4
-rw-r--r--src/mesa/swrast/s_zoom.c4
-rw-r--r--src/mesa/swrast/s_zoom.h2
13 files changed, 124 insertions, 149 deletions
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index 8495a9c2e63..285ec0783da 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -49,18 +49,6 @@ extern "C" {
/**
- * Stencil buffer data type.
- */
-#if STENCIL_BITS==8
- typedef GLubyte GLstencil;
-#elif STENCIL_BITS==16
- typedef GLushort GLstencil;
-#else
-# error "illegal number of stencil bits"
-#endif
-
-
-/**
* \name 64-bit extension of GLbitfield.
*/
/*@{*/
diff --git a/src/mesa/main/pack.c b/src/mesa/main/pack.c
index 539a06c9a07..de29395b0fe 100644
--- a/src/mesa/main/pack.c
+++ b/src/mesa/main/pack.c
@@ -4586,10 +4586,10 @@ _mesa_unpack_stencil_span( struct gl_context *ctx, GLuint n,
void
_mesa_pack_stencil_span( struct gl_context *ctx, GLuint n,
- GLenum dstType, GLvoid *dest, const GLstencil *source,
+ GLenum dstType, GLvoid *dest, const GLubyte *source,
const struct gl_pixelstore_attrib *dstPacking )
{
- GLstencil *stencil = (GLstencil *) malloc(n * sizeof(GLstencil));
+ GLubyte *stencil = (GLubyte *) malloc(n * sizeof(GLubyte));
if (!stencil) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "stencil packing");
@@ -4599,23 +4599,14 @@ _mesa_pack_stencil_span( struct gl_context *ctx, GLuint n,
if (ctx->Pixel.IndexShift || ctx->Pixel.IndexOffset ||
ctx->Pixel.MapStencilFlag) {
/* make a copy of input */
- memcpy(stencil, source, n * sizeof(GLstencil));
+ memcpy(stencil, source, n * sizeof(GLubyte));
_mesa_apply_stencil_transfer_ops(ctx, n, stencil);
source = stencil;
}
switch (dstType) {
case GL_UNSIGNED_BYTE:
- if (sizeof(GLstencil) == 1) {
- memcpy( dest, source, n );
- }
- else {
- GLubyte *dst = (GLubyte *) dest;
- GLuint i;
- for (i=0;i<n;i++) {
- dst[i] = (GLubyte) source[i];
- }
- }
+ memcpy(dest, source, n);
break;
case GL_BYTE:
{
@@ -5120,11 +5111,11 @@ void
_mesa_pack_depth_stencil_span(struct gl_context *ctx,GLuint n,
GLenum dstType, GLuint *dest,
const GLfloat *depthVals,
- const GLstencil *stencilVals,
+ const GLubyte *stencilVals,
const struct gl_pixelstore_attrib *dstPacking)
{
GLfloat *depthCopy = (GLfloat *) malloc(n * sizeof(GLfloat));
- GLstencil *stencilCopy = (GLstencil *) malloc(n * sizeof(GLstencil));
+ GLubyte *stencilCopy = (GLubyte *) malloc(n * sizeof(GLubyte));
GLuint i;
if (!depthCopy || !stencilCopy) {
@@ -5143,7 +5134,7 @@ _mesa_pack_depth_stencil_span(struct gl_context *ctx,GLuint n,
if (ctx->Pixel.IndexShift ||
ctx->Pixel.IndexOffset ||
ctx->Pixel.MapStencilFlag) {
- memcpy(stencilCopy, stencilVals, n * sizeof(GLstencil));
+ memcpy(stencilCopy, stencilVals, n * sizeof(GLubyte));
_mesa_apply_stencil_transfer_ops(ctx, n, stencilCopy);
stencilVals = stencilCopy;
}
diff --git a/src/mesa/main/pack.h b/src/mesa/main/pack.h
index 7a0089c2f2c..b1853cd5909 100644
--- a/src/mesa/main/pack.h
+++ b/src/mesa/main/pack.h
@@ -113,7 +113,7 @@ _mesa_unpack_stencil_span(struct gl_context *ctx, GLuint n,
extern void
_mesa_pack_stencil_span(struct gl_context *ctx, GLuint n,
- GLenum dstType, GLvoid *dest, const GLstencil *source,
+ GLenum dstType, GLvoid *dest, const GLubyte *source,
const struct gl_pixelstore_attrib *dstPacking);
@@ -133,7 +133,7 @@ extern void
_mesa_pack_depth_stencil_span(struct gl_context *ctx,GLuint n,
GLenum dstType, GLuint *dest,
const GLfloat *depthVals,
- const GLstencil *stencilVals,
+ const GLubyte *stencilVals,
const struct gl_pixelstore_attrib *dstPacking);
diff --git a/src/mesa/main/pixeltransfer.c b/src/mesa/main/pixeltransfer.c
index 5e881436afd..5c167e0a90a 100644
--- a/src/mesa/main/pixeltransfer.c
+++ b/src/mesa/main/pixeltransfer.c
@@ -273,7 +273,7 @@ _mesa_apply_ci_transfer_ops(const struct gl_context *ctx,
*/
void
_mesa_apply_stencil_transfer_ops(const struct gl_context *ctx, GLuint n,
- GLstencil stencil[])
+ GLubyte stencil[])
{
if (ctx->Pixel.IndexShift != 0 || ctx->Pixel.IndexOffset != 0) {
const GLint offset = ctx->Pixel.IndexOffset;
@@ -300,7 +300,7 @@ _mesa_apply_stencil_transfer_ops(const struct gl_context *ctx, GLuint n,
GLuint mask = ctx->PixelMaps.StoS.Size - 1;
GLuint i;
for (i = 0; i < n; i++) {
- stencil[i] = (GLstencil)ctx->PixelMaps.StoS.Map[ stencil[i] & mask ];
+ stencil[i] = (GLubyte) ctx->PixelMaps.StoS.Map[ stencil[i] & mask ];
}
}
}
diff --git a/src/mesa/main/pixeltransfer.h b/src/mesa/main/pixeltransfer.h
index 8af2e9ee2d8..a8c14757ffa 100644
--- a/src/mesa/main/pixeltransfer.h
+++ b/src/mesa/main/pixeltransfer.h
@@ -75,7 +75,7 @@ _mesa_apply_ci_transfer_ops(const struct gl_context *ctx,
extern void
_mesa_apply_stencil_transfer_ops(const struct gl_context *ctx, GLuint n,
- GLstencil stencil[]);
+ GLubyte stencil[]);
#endif
diff --git a/src/mesa/state_tracker/st_cb_readpixels.c b/src/mesa/state_tracker/st_cb_readpixels.c
index bd73f3bf037..0c68e02fc87 100644
--- a/src/mesa/state_tracker/st_cb_readpixels.c
+++ b/src/mesa/state_tracker/st_cb_readpixels.c
@@ -96,7 +96,7 @@ st_read_stencil_pixels(struct gl_context *ctx, GLint x, GLint y,
/* process image row by row */
for (j = 0; j < height; j++) {
GLvoid *dest;
- GLstencil sValues[MAX_WIDTH];
+ GLubyte sValues[MAX_WIDTH];
GLfloat zValues[MAX_WIDTH];
GLint srcY;
diff --git a/src/mesa/swrast/s_copypix.c b/src/mesa/swrast/s_copypix.c
index 46d63792822..3ba31f22c04 100644
--- a/src/mesa/swrast/s_copypix.c
+++ b/src/mesa/swrast/s_copypix.c
@@ -342,7 +342,7 @@ copy_stencil_pixels( struct gl_context *ctx, GLint srcx, GLint srcy,
struct gl_renderbuffer *rb = fb->_StencilBuffer;
GLint sy, dy, stepy;
GLint j;
- GLstencil *p, *tmpImage;
+ GLubyte *p, *tmpImage;
const GLboolean zoom = ctx->Pixel.ZoomX != 1.0F || ctx->Pixel.ZoomY != 1.0F;
GLint overlapping;
@@ -375,7 +375,7 @@ copy_stencil_pixels( struct gl_context *ctx, GLint srcx, GLint srcy,
if (overlapping) {
GLint ssy = sy;
- tmpImage = (GLstencil *) malloc(width * height * sizeof(GLstencil));
+ tmpImage = (GLubyte *) malloc(width * height * sizeof(GLubyte));
if (!tmpImage) {
_mesa_error( ctx, GL_OUT_OF_MEMORY, "glCopyPixels" );
return;
@@ -393,11 +393,11 @@ copy_stencil_pixels( struct gl_context *ctx, GLint srcx, GLint srcy,
}
for (j = 0; j < height; j++, sy += stepy, dy += stepy) {
- GLstencil stencil[MAX_WIDTH];
+ GLubyte stencil[MAX_WIDTH];
/* Get stencil values */
if (overlapping) {
- memcpy(stencil, p, width * sizeof(GLstencil));
+ memcpy(stencil, p, width * sizeof(GLubyte));
p += width;
}
else {
@@ -435,7 +435,7 @@ copy_depth_stencil_pixels(struct gl_context *ctx,
struct gl_renderbuffer *stencilReadRb, *depthReadRb, *depthDrawRb;
GLint sy, dy, stepy;
GLint j;
- GLstencil *tempStencilImage = NULL, *stencilPtr = NULL;
+ GLubyte *tempStencilImage = NULL, *stencilPtr = NULL;
GLfloat *tempDepthImage = NULL, *depthPtr = NULL;
const GLfloat depthScale = ctx->DrawBuffer->_DepthMaxF;
const GLuint stencilMask = ctx->Stencil.WriteMask[0];
@@ -479,7 +479,7 @@ copy_depth_stencil_pixels(struct gl_context *ctx,
if (stencilMask != 0x0) {
tempStencilImage
- = (GLstencil *) malloc(width * height * sizeof(GLstencil));
+ = (GLubyte *) malloc(width * height * sizeof(GLubyte));
if (!tempStencilImage) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glCopyPixels");
return;
@@ -517,11 +517,11 @@ copy_depth_stencil_pixels(struct gl_context *ctx,
for (j = 0; j < height; j++, sy += stepy, dy += stepy) {
if (stencilMask != 0x0) {
- GLstencil stencil[MAX_WIDTH];
+ GLubyte stencil[MAX_WIDTH];
/* Get stencil values */
if (overlapping) {
- memcpy(stencil, stencilPtr, width * sizeof(GLstencil));
+ memcpy(stencil, stencilPtr, width * sizeof(GLubyte));
stencilPtr += width;
}
else {
diff --git a/src/mesa/swrast/s_drawpix.c b/src/mesa/swrast/s_drawpix.c
index 20bf4d62635..b6c433753af 100644
--- a/src/mesa/swrast/s_drawpix.c
+++ b/src/mesa/swrast/s_drawpix.c
@@ -320,6 +320,7 @@ draw_stencil_pixels( struct gl_context *ctx, GLint x, GLint y,
const GLvoid *pixels )
{
const GLboolean zoom = ctx->Pixel.ZoomX != 1.0 || ctx->Pixel.ZoomY != 1.0;
+ const GLenum destType = GL_UNSIGNED_BYTE;
GLint skipPixels;
/* if width > MAX_WIDTH, have to process image in chunks */
@@ -330,9 +331,7 @@ draw_stencil_pixels( struct gl_context *ctx, GLint x, GLint y,
GLint row;
for (row = 0; row < height; row++) {
const GLint spanY = y + row;
- GLstencil values[MAX_WIDTH];
- GLenum destType = (sizeof(GLstencil) == sizeof(GLubyte))
- ? GL_UNSIGNED_BYTE : GL_UNSIGNED_SHORT;
+ GLubyte values[MAX_WIDTH];
const GLvoid *source = _mesa_image_address2d(unpack, pixels,
width, height,
GL_STENCIL_INDEX, type,
@@ -570,8 +569,7 @@ draw_depth_stencil_pixels(struct gl_context *ctx, GLint x, GLint y,
= ctx->Pixel.DepthScale != 1.0 || ctx->Pixel.DepthBias != 0.0;
const GLuint depthMax = ctx->DrawBuffer->_DepthMax;
const GLuint stencilMask = ctx->Stencil.WriteMask[0];
- const GLuint stencilType = (STENCIL_BITS == 8) ?
- GL_UNSIGNED_BYTE : GL_UNSIGNED_SHORT;
+ const GLenum stencilType = GL_UNSIGNED_BYTE;
const GLboolean zoom = ctx->Pixel.ZoomX != 1.0 || ctx->Pixel.ZoomY != 1.0;
struct gl_renderbuffer *depthRb, *stencilRb;
struct gl_pixelstore_attrib clippedUnpack = *unpack;
@@ -672,7 +670,7 @@ draw_depth_stencil_pixels(struct gl_context *ctx, GLint x, GLint y,
}
if (stencilMask != 0x0) {
- GLstencil stencilValues[MAX_WIDTH];
+ GLubyte stencilValues[MAX_WIDTH];
/* get stencil values, with shift/offset/mapping */
_mesa_unpack_stencil_span(ctx, width, stencilType, stencilValues,
type, depthStencilSrc, &clippedUnpack,
diff --git a/src/mesa/swrast/s_readpix.c b/src/mesa/swrast/s_readpix.c
index 3cef7304a4a..3a31a0d0528 100644
--- a/src/mesa/swrast/s_readpix.c
+++ b/src/mesa/swrast/s_readpix.c
@@ -171,7 +171,7 @@ read_stencil_pixels( struct gl_context *ctx,
/* process image row by row */
for (j = 0; j < height; j++) {
GLvoid *dest;
- GLstencil stencil[MAX_WIDTH];
+ GLubyte stencil[MAX_WIDTH];
_mesa_unpack_ubyte_stencil_row(rb->Format, width, map, stencil);
dest = _mesa_image_address2d(packing, pixels, width, height,
@@ -369,7 +369,7 @@ fast_read_depth_stencil_pixels_separate(struct gl_context *ctx,
GL_MAP_READ_BIT, &stencilMap, &stencilStride);
for (j = 0; j < height; j++) {
- GLstencil stencilVals[MAX_WIDTH];
+ GLubyte stencilVals[MAX_WIDTH];
_mesa_unpack_uint_z_row(depthRb->Format, width, depthMap, dst);
_mesa_unpack_ubyte_stencil_row(stencilRb->Format, width,
@@ -410,7 +410,7 @@ slow_read_depth_stencil_pixels_separate(struct gl_context *ctx,
GL_MAP_READ_BIT, &stencilMap, &stencilStride);
for (j = 0; j < height; j++) {
- GLstencil stencilVals[MAX_WIDTH];
+ GLubyte stencilVals[MAX_WIDTH];
GLfloat depthVals[MAX_WIDTH];
_mesa_unpack_float_z_row(depthRb->Format, width, depthMap, depthVals);
diff --git a/src/mesa/swrast/s_stencil.c b/src/mesa/swrast/s_stencil.c
index e713e2393dd..101ee505671 100644
--- a/src/mesa/swrast/s_stencil.c
+++ b/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;i<n;i++) {
if (mask[i]) {
- stencil[i] = (GLstencil) (stencil[i] & invmask);
+ stencil[i] = (GLubyte) (stencil[i] & invmask);
}
}
}
@@ -101,8 +101,8 @@ apply_stencil_op( const struct gl_context *ctx, GLenum oper, GLuint face,
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));
}
}
}
@@ -111,9 +111,9 @@ apply_stencil_op( const struct gl_context *ctx, GLenum oper, GLuint face,
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);
}
}
}
@@ -122,9 +122,9 @@ apply_stencil_op( const struct gl_context *ctx, GLenum oper, GLuint face,
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)));
}
}
}
@@ -134,9 +134,9 @@ apply_stencil_op( const struct gl_context *ctx, GLenum oper, GLuint face,
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);
}
}
}
@@ -145,9 +145,9 @@ apply_stencil_op( const struct gl_context *ctx, GLenum oper, GLuint face,
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)));
}
}
}
@@ -164,8 +164,8 @@ apply_stencil_op( const struct gl_context *ctx, GLenum oper, GLuint face,
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)));
}
}
}
@@ -181,8 +181,8 @@ apply_stencil_op( const struct gl_context *ctx, GLenum oper, GLuint face,
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)));
}
}
}
@@ -191,16 +191,16 @@ apply_stencil_op( const struct gl_context *ctx, GLenum oper, GLuint face,
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));
}
}
}
@@ -225,15 +225,15 @@ apply_stencil_op( const struct gl_context *ctx, GLenum oper, GLuint face,
* 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);
@@ -263,7 +263,7 @@ do_stencil_test( struct gl_context *ctx, GLuint face, GLuint n, GLstencil stenci
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;
@@ -281,7 +281,7 @@ do_stencil_test( struct gl_context *ctx, GLuint face, GLuint n, GLstencil stenci
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;
@@ -299,7 +299,7 @@ do_stencil_test( struct gl_context *ctx, GLuint face, GLuint n, GLstencil stenci
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;
@@ -317,7 +317,7 @@ do_stencil_test( struct gl_context *ctx, GLuint face, GLuint n, GLstencil stenci
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;
@@ -335,7 +335,7 @@ do_stencil_test( struct gl_context *ctx, GLuint face, GLuint n, GLstencil stenci
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;
@@ -353,7 +353,7 @@ do_stencil_test( struct gl_context *ctx, GLuint face, GLuint n, GLstencil stenci
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;
@@ -422,8 +422,8 @@ stencil_and_ztest_span(struct gl_context *ctx, SWspan *span, GLuint face)
{
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;
@@ -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;i<n;i++) {
if (mask[i]) {
- GLstencil *sptr = STENCIL_ADDRESS( x[i], y[i] );
+ GLubyte *sptr = STENCIL_ADDRESS( x[i], y[i] );
*sptr = 0;
}
}
@@ -558,8 +557,8 @@ apply_stencil_op_to_pixels( struct gl_context *ctx,
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);
}
}
}
@@ -568,7 +567,7 @@ apply_stencil_op_to_pixels( struct gl_context *ctx,
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;
}
}
@@ -576,8 +575,8 @@ apply_stencil_op_to_pixels( struct gl_context *ctx,
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));
}
}
}
@@ -586,9 +585,9 @@ apply_stencil_op_to_pixels( struct gl_context *ctx,
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);
}
}
}
@@ -596,9 +595,9 @@ apply_stencil_op_to_pixels( struct gl_context *ctx,
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)));
}
}
}
@@ -608,9 +607,9 @@ apply_stencil_op_to_pixels( struct gl_context *ctx,
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);
}
}
}
@@ -618,9 +617,9 @@ apply_stencil_op_to_pixels( struct gl_context *ctx,
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)));
}
}
}
@@ -630,16 +629,16 @@ apply_stencil_op_to_pixels( struct gl_context *ctx,
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)));
}
}
}
@@ -648,16 +647,16 @@ apply_stencil_op_to_pixels( struct gl_context *ctx,
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)));
}
}
}
@@ -666,16 +665,16 @@ apply_stencil_op_to_pixels( struct gl_context *ctx,
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));
}
}
}
@@ -705,15 +704,14 @@ stencil_test_pixels( struct gl_context *ctx, GLuint face, GLuint n,
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
@@ -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;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;
@@ -760,11 +758,11 @@ stencil_test_pixels( struct gl_context *ctx, GLuint face, GLuint n,
}
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;
@@ -780,11 +778,11 @@ stencil_test_pixels( struct gl_context *ctx, GLuint face, GLuint n,
}
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;
@@ -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<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;
@@ -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;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;
@@ -840,11 +838,11 @@ stencil_test_pixels( struct gl_context *ctx, GLuint face, GLuint n,
}
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;
@@ -914,7 +912,7 @@ stencil_and_ztest_pixels( struct gl_context *ctx, SWspan *span, GLuint face )
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));
@@ -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++) {
diff --git a/src/mesa/swrast/s_stencil.h b/src/mesa/swrast/s_stencil.h
index 00f5179e046..37f3c8da147 100644
--- a/src/mesa/swrast/s_stencil.h
+++ b/src/mesa/swrast/s_stencil.h
@@ -38,12 +38,12 @@ _swrast_stencil_and_ztest_span(struct gl_context *ctx, SWspan *span);
extern 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[]);
extern void
_swrast_write_stencil_span( struct gl_context *ctx, GLint n, GLint x, GLint y,
- const GLstencil stencil[] );
+ const GLubyte stencil[] );
extern void
diff --git a/src/mesa/swrast/s_zoom.c b/src/mesa/swrast/s_zoom.c
index 3fb78484765..16bb997f36c 100644
--- a/src/mesa/swrast/s_zoom.c
+++ b/src/mesa/swrast/s_zoom.c
@@ -351,9 +351,9 @@ _swrast_write_zoomed_depth_span(struct gl_context *ctx, GLint imgX, GLint imgY,
void
_swrast_write_zoomed_stencil_span(struct gl_context *ctx, GLint imgX, GLint imgY,
GLint width, GLint spanX, GLint spanY,
- const GLstencil stencil[])
+ const GLubyte stencil[])
{
- GLstencil zoomedVals[MAX_WIDTH];
+ GLubyte zoomedVals[MAX_WIDTH];
GLint x0, x1, y0, y1, y;
GLint i, zoomedWidth;
diff --git a/src/mesa/swrast/s_zoom.h b/src/mesa/swrast/s_zoom.h
index 581ea178e89..0b82bb82471 100644
--- a/src/mesa/swrast/s_zoom.h
+++ b/src/mesa/swrast/s_zoom.h
@@ -45,7 +45,7 @@ _swrast_write_zoomed_depth_span(struct gl_context *ctx, GLint imgX, GLint imgY,
extern void
_swrast_write_zoomed_stencil_span(struct gl_context *ctx, GLint imgX, GLint imgY,
GLint width, GLint spanX, GLint spanY,
- const GLstencil stencil[]);
+ const GLubyte stencil[]);
extern void
_swrast_write_zoomed_z_span(struct gl_context *ctx, GLint imgX, GLint imgY,