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.
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[]);
/**************************** 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;
-/* $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
/*
* $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
*
}
-
-/* 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)
ctx->Driver.Index = set_index;
ctx->Driver.Color = set_color;
- ctx->Driver.IndexMask = index_mask;
- ctx->Driver.ColorMask = color_mask;
ctx->Driver.Dither = dither;
\r
\r
\r
-/*\r
- * Set the pixel logic operation. Return GL_TRUE if the device driver\r
- * can perform the operation, otherwise return GL_FALSE. If GL_FALSE\r
- * is returned, the logic op will be done in software by Mesa.\r
- */\r
-GLboolean logicop( GLcontext* ctx, GLenum op )\r
-{\r
- /* can't implement */\r
- return GL_FALSE;\r
-}\r
-\r
-\r
static void dither( GLcontext* ctx, GLboolean enable )\r
{\r
/* No op */\r
ctx->Driver.IndexMask = index_mask;\r
ctx->Driver.ColorMask = color_mask;\r
\r
- ctx->Driver.LogicOp = logicop;\r
ctx->Driver.Dither = dither;\r
\r
ctx->Driver.SetBuffer = set_buffer;\r
-/* $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
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;
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);
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,
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,
-/* $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
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;
}
-
-
/*
* Apply the blending operator to an array of pixels.
* Input: n - number of pixels in span
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;
}
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 */
GLubyte span[MAX_WIDTH][4];
GLint i;
- ASSERT(!ctx->Color.SWmasking);
+ ASSERT(colorMask == 0xffffffff);
for (i = 0; i < width; i++) {
span[i][RCOMP] = r;
static void
clear_color_buffers(GLcontext *ctx)
{
+ const GLuint colorMask = *((GLuint *) &ctx->Color.ColorMask);
GLuint bufferBit;
/* loop over four possible dest color buffers */
(void) (*ctx->Driver.SetDrawBuffer)( ctx, GL_BACK_RIGHT);
}
- if (ctx->Color.SWmasking) {
+ if (colorMask != 0xffffffff) {
clear_color_buffer_with_masking(ctx);
}
else {
-/* $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
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;
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;
-/* $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
* 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.
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);
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);
-/* $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
/**********************************************************************/
-/*
- * 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;
{
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]
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) {