summaryrefslogtreecommitdiff
path: root/src/mesa
diff options
context:
space:
mode:
authorBrian Paul <brian.paul@tungstengraphics.com>2000-09-07 15:45:26 +0000
committerBrian Paul <brian.paul@tungstengraphics.com>2000-09-07 15:45:26 +0000
commitc4c639c9a46967678725370cb9824031a068633c (patch)
treef0008c2a00c6f5f65cc4800b87a560a39551b569 /src/mesa
parent18f73b622ffa1d1cebea5556b9ebe53a9adc31ac (diff)
Removed ctx->Driver.LogicOp().
ctx->Driver.Index/ColorMask() now return void. Removed SWmasking and SWLogicOpEnabled variables. LogicOps and color/index masking are no longer special-case device driver functions. The Xlib driver was the only driver that used them. Things are more uniform now.
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/drivers/glide/fxdrv.h6
-rw-r--r--src/mesa/drivers/glide/fxsetup.c6
-rw-r--r--src/mesa/drivers/windows/wmesa.c33
-rw-r--r--src/mesa/drivers/windows/wmesa_stereo.c13
-rw-r--r--src/mesa/main/accum.c11
-rw-r--r--src/mesa/main/blend.c10
-rw-r--r--src/mesa/main/buffers.c6
-rw-r--r--src/mesa/main/context.c4
-rw-r--r--src/mesa/main/dd.h22
-rw-r--r--src/mesa/main/state.c137
10 files changed, 52 insertions, 196 deletions
diff --git a/src/mesa/drivers/glide/fxdrv.h b/src/mesa/drivers/glide/fxdrv.h
index c85c73d8e2..e3a865b0d4 100644
--- a/src/mesa/drivers/glide/fxdrv.h
+++ b/src/mesa/drivers/glide/fxdrv.h
@@ -644,9 +644,9 @@ extern int fxTexGetInfo(int, int, GrLOD_t *, GrAspectRatio_t *,
extern void fxDDScissor( GLcontext *ctx,
GLint x, GLint y, GLsizei w, GLsizei h );
extern void fxDDFogfv( GLcontext *ctx, GLenum pname, const GLfloat *params );
-extern GLboolean fxDDColorMask(GLcontext *ctx,
- GLboolean r, GLboolean g,
- GLboolean b, GLboolean a );
+extern void fxDDColorMask(GLcontext *ctx,
+ GLboolean r, GLboolean g,
+ GLboolean b, GLboolean a );
extern void fxDDWriteDepthSpan(GLcontext *ctx, GLuint n, GLint x, GLint y,
const GLdepth depth[], const GLubyte mask[]);
diff --git a/src/mesa/drivers/glide/fxsetup.c b/src/mesa/drivers/glide/fxsetup.c
index f1a56650bd..b6bbb0c85b 100644
--- a/src/mesa/drivers/glide/fxsetup.c
+++ b/src/mesa/drivers/glide/fxsetup.c
@@ -1398,9 +1398,9 @@ static void fxSetupDepthTest(GLcontext *ctx)
/**************************** Color Mask SetUp **************************/
/************************************************************************/
-GLboolean fxDDColorMask(GLcontext *ctx,
- GLboolean r, GLboolean g,
- GLboolean b, GLboolean a )
+void fxDDColorMask(GLcontext *ctx,
+ GLboolean r, GLboolean g,
+ GLboolean b, GLboolean a )
{
fxMesaContext fxMesa=(fxMesaContext)ctx->DriverCtx;
fxMesa->new_state |= FX_NEW_COLOR_MASK;
diff --git a/src/mesa/drivers/windows/wmesa.c b/src/mesa/drivers/windows/wmesa.c
index 00f156a102..f0a1c84fe5 100644
--- a/src/mesa/drivers/windows/wmesa.c
+++ b/src/mesa/drivers/windows/wmesa.c
@@ -1,4 +1,4 @@
-/* $Id: wmesa.c,v 1.4 2000/08/02 20:29:03 brianp Exp $ */
+/* $Id: wmesa.c,v 1.5 2000/09/07 15:45:28 brianp Exp $ */
/*
* File name : wmesa.c
@@ -22,6 +22,14 @@
/*
* $Log: wmesa.c,v $
+ * Revision 1.5 2000/09/07 15:45:28 brianp
+ * Removed ctx->Driver.LogicOp().
+ * ctx->Driver.Index/ColorMask() now return void.
+ * Removed SWmasking and SWLogicOpEnabled variables.
+ * LogicOps and color/index masking are no longer special-case device
+ * driver functions. The Xlib driver was the only driver that used
+ * them. Things are more uniform now.
+ *
* Revision 1.4 2000/08/02 20:29:03 brianp
* updates from mesa3d@billbaxter.com
*
@@ -562,27 +570,6 @@ static void set_color( GLcontext* ctx, GLubyte r, GLubyte g, GLubyte b, GLubyte
}
-
-/* Set the index mode bitplane mask. */
-static GLboolean index_mask(GLcontext* ctx, GLuint mask)
-{
- /* can't implement */
- return GL_FALSE;
-}
-
-
-
-/* Set the RGBA drawing mask. */
-static GLboolean color_mask( GLcontext* ctx,
- GLboolean rmask, GLboolean gmask,
- GLboolean bmask, GLboolean amask)
-{
- /* can't implement */
- return GL_FALSE;
-}
-
-
-
static void dither( GLcontext* ctx, GLboolean enable )
{
if (!Current)
@@ -1177,8 +1164,6 @@ void setup_DD_pointers( GLcontext* ctx )
ctx->Driver.Index = set_index;
ctx->Driver.Color = set_color;
- ctx->Driver.IndexMask = index_mask;
- ctx->Driver.ColorMask = color_mask;
ctx->Driver.Dither = dither;
diff --git a/src/mesa/drivers/windows/wmesa_stereo.c b/src/mesa/drivers/windows/wmesa_stereo.c
index ea721a13b6..fe3c315bd9 100644
--- a/src/mesa/drivers/windows/wmesa_stereo.c
+++ b/src/mesa/drivers/windows/wmesa_stereo.c
@@ -299,18 +299,6 @@ static GLboolean color_mask( GLcontext* ctx,
-/*
- * Set the pixel logic operation. Return GL_TRUE if the device driver
- * can perform the operation, otherwise return GL_FALSE. If GL_FALSE
- * is returned, the logic op will be done in software by Mesa.
- */
-GLboolean logicop( GLcontext* ctx, GLenum op )
-{
- /* can't implement */
- return GL_FALSE;
-}
-
-
static void dither( GLcontext* ctx, GLboolean enable )
{
/* No op */
@@ -1046,7 +1034,6 @@ void setup_DD_pointers( GLcontext* ctx )
ctx->Driver.IndexMask = index_mask;
ctx->Driver.ColorMask = color_mask;
- ctx->Driver.LogicOp = logicop;
ctx->Driver.Dither = dither;
ctx->Driver.SetBuffer = set_buffer;
diff --git a/src/mesa/main/accum.c b/src/mesa/main/accum.c
index 79733d6aca..7b2f1ca57e 100644
--- a/src/mesa/main/accum.c
+++ b/src/mesa/main/accum.c
@@ -1,4 +1,4 @@
-/* $Id: accum.c,v 1.23 2000/07/15 03:14:25 brianp Exp $ */
+/* $Id: accum.c,v 1.24 2000/09/07 15:45:26 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -140,6 +140,7 @@ _mesa_Accum( GLenum op, GLfloat value )
GLuint xpos, ypos, width, height, width4;
GLfloat acc_scale;
GLubyte rgba[MAX_WIDTH][4];
+ const GLuint colorMask = *((GLuint *) &ctx->Color.ColorMask);
const GLint iChanMax = (1 << (sizeof(GLchan) * 8)) - 1;
const GLfloat fChanMax = (1 << (sizeof(GLchan) * 8)) - 1;
@@ -350,11 +351,11 @@ _mesa_Accum( GLenum op, GLfloat value )
if (ctx->IntegerAccumMode && ctx->IntegerAccumScaler > 0) {
/* build lookup table to avoid many floating point multiplies */
- const GLfloat mult = ctx->IntegerAccumScaler;
static GLchan multTable[32768];
static GLfloat prevMult = 0.0;
- GLuint j;
+ const GLfloat mult = ctx->IntegerAccumScaler;
const GLint max = MIN2((GLint) (256 / mult), 32767);
+ GLuint j;
if (mult != prevMult) {
for (j = 0; j < max; j++)
multTable[j] = (GLint) ((GLfloat) j * mult + 0.5F);
@@ -376,7 +377,7 @@ _mesa_Accum( GLenum op, GLfloat value )
rgba[i][BCOMP] = multTable[acc[i4+2]];
rgba[i][ACOMP] = multTable[acc[i4+3]];
}
- if (ctx->Color.SWmasking) {
+ if (colorMask != 0xffffffff) {
_mesa_mask_rgba_span( ctx, width, xpos, ypos, rgba );
}
(*ctx->Driver.WriteRGBASpan)( ctx, width, xpos, ypos,
@@ -403,7 +404,7 @@ _mesa_Accum( GLenum op, GLfloat value )
rgba[i][BCOMP] = CLAMP( b, 0, iChanMax );
rgba[i][ACOMP] = CLAMP( a, 0, iChanMax );
}
- if (ctx->Color.SWmasking) {
+ if (colorMask != 0xffffffff) {
_mesa_mask_rgba_span( ctx, width, xpos, ypos, rgba );
}
(*ctx->Driver.WriteRGBASpan)( ctx, width, xpos, ypos,
diff --git a/src/mesa/main/blend.c b/src/mesa/main/blend.c
index 431fa603d2..b9b2b4788b 100644
--- a/src/mesa/main/blend.c
+++ b/src/mesa/main/blend.c
@@ -1,4 +1,4 @@
-/* $Id: blend.c,v 1.17 2000/08/30 18:21:06 brianp Exp $ */
+/* $Id: blend.c,v 1.18 2000/09/07 15:45:27 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -875,7 +875,8 @@ _mesa_blend_span( GLcontext *ctx, GLuint n, GLint x, GLint y,
GLubyte dest[MAX_WIDTH][4];
/* Check if device driver can do the work */
- if (ctx->Color.BlendEquation==GL_LOGIC_OP && !ctx->Color.SWLogicOpEnabled) {
+ if (ctx->Color.BlendEquation==GL_LOGIC_OP &&
+ !ctx->Color.ColorLogicOpEnabled) {
return;
}
@@ -890,8 +891,6 @@ _mesa_blend_span( GLcontext *ctx, GLuint n, GLint x, GLint y,
-
-
/*
* Apply the blending operator to an array of pixels.
* Input: n - number of pixels in span
@@ -907,7 +906,8 @@ _mesa_blend_pixels( GLcontext *ctx,
GLubyte dest[PB_SIZE][4];
/* Check if device driver can do the work */
- if (ctx->Color.BlendEquation==GL_LOGIC_OP && !ctx->Color.SWLogicOpEnabled) {
+ if (ctx->Color.BlendEquation==GL_LOGIC_OP &&
+ !ctx->Color.ColorLogicOpEnabled) {
return;
}
diff --git a/src/mesa/main/buffers.c b/src/mesa/main/buffers.c
index 566afed929..dd87009031 100644
--- a/src/mesa/main/buffers.c
+++ b/src/mesa/main/buffers.c
@@ -142,6 +142,7 @@ clear_color_buffer(GLcontext *ctx)
const GLint y = ctx->DrawBuffer->Ymin;
const GLint height = ctx->DrawBuffer->Ymax - ctx->DrawBuffer->Ymin + 1;
const GLint width = ctx->DrawBuffer->Xmax - ctx->DrawBuffer->Xmin + 1;
+ const GLuint colorMask = *((GLuint *) &ctx->Color.ColorMask);
if (ctx->Visual->RGBAflag) {
/* RGBA mode */
@@ -152,7 +153,7 @@ clear_color_buffer(GLcontext *ctx)
GLubyte span[MAX_WIDTH][4];
GLint i;
- ASSERT(!ctx->Color.SWmasking);
+ ASSERT(colorMask == 0xffffffff);
for (i = 0; i < width; i++) {
span[i][RCOMP] = r;
@@ -201,6 +202,7 @@ clear_color_buffer(GLcontext *ctx)
static void
clear_color_buffers(GLcontext *ctx)
{
+ const GLuint colorMask = *((GLuint *) &ctx->Color.ColorMask);
GLuint bufferBit;
/* loop over four possible dest color buffers */
@@ -219,7 +221,7 @@ clear_color_buffers(GLcontext *ctx)
(void) (*ctx->Driver.SetDrawBuffer)( ctx, GL_BACK_RIGHT);
}
- if (ctx->Color.SWmasking) {
+ if (colorMask != 0xffffffff) {
clear_color_buffer_with_masking(ctx);
}
else {
diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c
index 2b29d80f83..5fbe5d0838 100644
--- a/src/mesa/main/context.c
+++ b/src/mesa/main/context.c
@@ -1,4 +1,4 @@
-/* $Id: context.c,v 1.82 2000/09/05 20:28:06 brianp Exp $ */
+/* $Id: context.c,v 1.83 2000/09/07 15:45:27 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -815,7 +815,6 @@ init_attrib_groups( GLcontext *ctx )
ctx->Color.ColorMask[1] = 0xff;
ctx->Color.ColorMask[2] = 0xff;
ctx->Color.ColorMask[3] = 0xff;
- ctx->Color.SWmasking = GL_FALSE;
ctx->Color.ClearIndex = 0;
ASSIGN_4V( ctx->Color.ClearColor, 0.0, 0.0, 0.0, 0.0 );
ctx->Color.DrawBuffer = GL_FRONT;
@@ -832,7 +831,6 @@ init_attrib_groups( GLcontext *ctx )
ASSIGN_4V( ctx->Color.BlendColor, 0.0, 0.0, 0.0, 0.0 );
ctx->Color.IndexLogicOpEnabled = GL_FALSE;
ctx->Color.ColorLogicOpEnabled = GL_FALSE;
- ctx->Color.SWLogicOpEnabled = GL_FALSE;
ctx->Color.LogicOp = GL_COPY;
ctx->Color.DitherFlag = GL_TRUE;
ctx->Color.MultiDrawBuffer = GL_FALSE;
diff --git a/src/mesa/main/dd.h b/src/mesa/main/dd.h
index d37eac3d1f..66a740d4ec 100644
--- a/src/mesa/main/dd.h
+++ b/src/mesa/main/dd.h
@@ -1,4 +1,4 @@
-/* $Id: dd.h,v 1.29 2000/09/07 15:38:49 brianp Exp $ */
+/* $Id: dd.h,v 1.30 2000/09/07 15:45:27 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -336,23 +336,6 @@ struct dd_function_table {
* This is called whenever glFlush() is called.
*/
- GLboolean (*IndexMask)( GLcontext *ctx, GLuint mask );
- /*
- * Implements glIndexMask() if possible, else return GL_FALSE.
- */
-
- GLboolean (*ColorMask)( GLcontext *ctx,
- GLboolean rmask, GLboolean gmask,
- GLboolean bmask, GLboolean amask );
- /*
- * Implements glColorMask() if possible, else return GL_FALSE.
- */
-
- GLboolean (*LogicOp)( GLcontext *ctx, GLenum op );
- /*
- * Implements glLogicOp() if possible, else return GL_FALSE.
- */
-
void (*Dither)( GLcontext *ctx, GLboolean enable );
/*
* Enable/disable dithering.
@@ -933,6 +916,8 @@ struct dd_function_table {
GLenum dfactorRGB, GLenum sfactorA,
GLenum dfactorA );
void (*ClearDepth)(GLcontext *ctx, GLclampd d);
+ void (*ColorMask)(GLcontext *ctx, GLboolean rmask, GLboolean gmask,
+ GLboolean bmask, GLboolean amask );
void (*CullFace)(GLcontext *ctx, GLenum mode);
void (*FrontFace)(GLcontext *ctx, GLenum mode);
void (*DepthFunc)(GLcontext *ctx, GLenum func);
@@ -941,6 +926,7 @@ struct dd_function_table {
void (*Enable)(GLcontext* ctx, GLenum cap, GLboolean state);
void (*Fogfv)(GLcontext *ctx, GLenum pname, const GLfloat *params);
void (*Hint)(GLcontext *ctx, GLenum target, GLenum mode);
+ void (*IndexMask)(GLcontext *ctx, GLuint mask);
void (*Lightfv)(GLcontext *ctx, GLenum light,
GLenum pname, const GLfloat *params, GLint nparams );
void (*LightModelfv)(GLcontext *ctx, GLenum pname, const GLfloat *params);
diff --git a/src/mesa/main/state.c b/src/mesa/main/state.c
index caca1f87f9..9a40102f5d 100644
--- a/src/mesa/main/state.c
+++ b/src/mesa/main/state.c
@@ -1,4 +1,4 @@
-/* $Id: state.c,v 1.23 2000/08/23 14:33:04 brianp Exp $ */
+/* $Id: state.c,v 1.24 2000/09/07 15:45:27 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -666,114 +666,6 @@ _mesa_init_exec_table(struct _glapi_table *exec, GLuint tableSize)
/**********************************************************************/
-/*
- * Since the device driver may or may not support pixel logic ops we
- * have to make some extensive tests to determine whether or not
- * software-implemented logic operations have to be used.
- */
-static void update_pixel_logic( GLcontext *ctx )
-{
- if (ctx->Visual->RGBAflag) {
- /* RGBA mode blending w/ Logic Op */
- if (ctx->Color.ColorLogicOpEnabled) {
- if (ctx->Driver.LogicOp
- && (*ctx->Driver.LogicOp)( ctx, ctx->Color.LogicOp )) {
- /* Device driver can do logic, don't have to do it in software */
- ctx->Color.SWLogicOpEnabled = GL_FALSE;
- }
- else {
- /* Device driver can't do logic op so we do it in software */
- ctx->Color.SWLogicOpEnabled = GL_TRUE;
- }
- }
- else {
- /* no logic op */
- if (ctx->Driver.LogicOp) {
- (void) (*ctx->Driver.LogicOp)( ctx, GL_COPY );
- }
- ctx->Color.SWLogicOpEnabled = GL_FALSE;
- }
- }
- else {
- /* CI mode Logic Op */
- if (ctx->Color.IndexLogicOpEnabled) {
- if (ctx->Driver.LogicOp
- && (*ctx->Driver.LogicOp)( ctx, ctx->Color.LogicOp )) {
- /* Device driver can do logic, don't have to do it in software */
- ctx->Color.SWLogicOpEnabled = GL_FALSE;
- }
- else {
- /* Device driver can't do logic op so we do it in software */
- ctx->Color.SWLogicOpEnabled = GL_TRUE;
- }
- }
- else {
- /* no logic op */
- if (ctx->Driver.LogicOp) {
- (void) (*ctx->Driver.LogicOp)( ctx, GL_COPY );
- }
- ctx->Color.SWLogicOpEnabled = GL_FALSE;
- }
- }
-}
-
-
-
-/*
- * Check if software implemented RGBA or Color Index masking is needed.
- */
-static void update_pixel_masking( GLcontext *ctx )
-{
- if (ctx->Visual->RGBAflag) {
- GLuint *colorMask = (GLuint *) ctx->Color.ColorMask;
- if (*colorMask == 0xffffffff) {
- /* disable masking */
- if (ctx->Driver.ColorMask) {
- (void) (*ctx->Driver.ColorMask)( ctx, GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE );
- }
- ctx->Color.SWmasking = GL_FALSE;
- }
- else {
- /* Ask driver to do color masking, if it can't then
- * do it in software
- */
- GLboolean red = ctx->Color.ColorMask[RCOMP] ? GL_TRUE : GL_FALSE;
- GLboolean green = ctx->Color.ColorMask[GCOMP] ? GL_TRUE : GL_FALSE;
- GLboolean blue = ctx->Color.ColorMask[BCOMP] ? GL_TRUE : GL_FALSE;
- GLboolean alpha = ctx->Color.ColorMask[ACOMP] ? GL_TRUE : GL_FALSE;
- if (ctx->Driver.ColorMask
- && (*ctx->Driver.ColorMask)( ctx, red, green, blue, alpha )) {
- ctx->Color.SWmasking = GL_FALSE;
- }
- else {
- ctx->Color.SWmasking = GL_TRUE;
- }
- }
- }
- else {
- if (ctx->Color.IndexMask==0xffffffff) {
- /* disable masking */
- if (ctx->Driver.IndexMask) {
- (void) (*ctx->Driver.IndexMask)( ctx, 0xffffffff );
- }
- ctx->Color.SWmasking = GL_FALSE;
- }
- else {
- /* Ask driver to do index masking, if it can't then
- * do it in software
- */
- if (ctx->Driver.IndexMask
- && (*ctx->Driver.IndexMask)( ctx, ctx->Color.IndexMask )) {
- ctx->Color.SWmasking = GL_FALSE;
- }
- else {
- ctx->Color.SWmasking = GL_TRUE;
- }
- }
- }
-}
-
-
static void update_fog_mode( GLcontext *ctx )
{
int old_mode = ctx->FogMode;
@@ -807,15 +699,22 @@ static void update_rasterflags( GLcontext *ctx )
{
ctx->RasterMask = 0;
- if (ctx->Color.AlphaEnabled) ctx->RasterMask |= ALPHATEST_BIT;
- if (ctx->Color.BlendEnabled) ctx->RasterMask |= BLEND_BIT;
- if (ctx->Depth.Test) ctx->RasterMask |= DEPTH_BIT;
- if (ctx->FogMode==FOG_FRAGMENT) ctx->RasterMask |= FOG_BIT;
- if (ctx->Color.SWLogicOpEnabled) ctx->RasterMask |= LOGIC_OP_BIT;
- if (ctx->Scissor.Enabled) ctx->RasterMask |= SCISSOR_BIT;
- if (ctx->Stencil.Enabled) ctx->RasterMask |= STENCIL_BIT;
- if (ctx->Color.SWmasking) ctx->RasterMask |= MASKING_BIT;
- if (ctx->Texture.ReallyEnabled) ctx->RasterMask |= TEXTURE_BIT;
+ if (ctx->Color.AlphaEnabled) ctx->RasterMask |= ALPHATEST_BIT;
+ if (ctx->Color.BlendEnabled) ctx->RasterMask |= BLEND_BIT;
+ if (ctx->Depth.Test) ctx->RasterMask |= DEPTH_BIT;
+ if (ctx->FogMode == FOG_FRAGMENT) ctx->RasterMask |= FOG_BIT;
+ if (ctx->Scissor.Enabled) ctx->RasterMask |= SCISSOR_BIT;
+ if (ctx->Stencil.Enabled) ctx->RasterMask |= STENCIL_BIT;
+ if (ctx->Visual->RGBAflag) {
+ const GLuint colorMask = *((GLuint *) &ctx->Color.ColorMask);
+ if (colorMask != 0xffffffff) ctx->RasterMask |= MASKING_BIT;
+ if (ctx->Color.ColorLogicOpEnabled) ctx->RasterMask |= LOGIC_OP_BIT;
+ if (ctx->Texture.ReallyEnabled) ctx->RasterMask |= TEXTURE_BIT;
+ }
+ else {
+ if (ctx->Color.IndexMask != 0xffffffff) ctx->RasterMask |= MASKING_BIT;
+ if (ctx->Color.IndexLogicOpEnabled) ctx->RasterMask |= LOGIC_OP_BIT;
+ }
if (ctx->DrawBuffer->UseSoftwareAlphaBuffers
&& ctx->Color.ColorMask[ACOMP]
@@ -984,8 +883,6 @@ void gl_update_state( GLcontext *ctx )
if (ctx->NewState & (NEW_RASTER_OPS | NEW_LIGHTING | NEW_FOG | NEW_TEXTURE_ENABLE)) {
if (ctx->NewState & (NEW_RASTER_OPS | NEW_TEXTURE_ENABLE)) {
- update_pixel_logic(ctx);
- update_pixel_masking(ctx);
update_fog_mode(ctx);
update_rasterflags(ctx);
if (ctx->Driver.Dither) {