summaryrefslogtreecommitdiffstats
path: root/src/mesa/swrast
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/swrast')
-rw-r--r--src/mesa/swrast/s_accum.c4
-rw-r--r--src/mesa/swrast/s_buffers.c18
-rw-r--r--src/mesa/swrast/s_context.c49
-rw-r--r--src/mesa/swrast/s_drawpix.c60
-rw-r--r--src/mesa/swrast/s_span.c24
-rw-r--r--src/mesa/swrast/s_span.h4
6 files changed, 119 insertions, 40 deletions
diff --git a/src/mesa/swrast/s_accum.c b/src/mesa/swrast/s_accum.c
index be5c4b4a130..09c4d8647b0 100644
--- a/src/mesa/swrast/s_accum.c
+++ b/src/mesa/swrast/s_accum.c
@@ -1,4 +1,4 @@
-/* $Id: s_accum.c,v 1.16 2002/03/19 16:47:05 brianp Exp $ */
+/* $Id: s_accum.c,v 1.17 2002/06/15 02:38:17 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -62,7 +62,7 @@
*/
-#if CHAN_BITS == 8
+#if CHAN_BITS == 8 && ACCUM_BITS < 32
#define USE_OPTIMIZED_ACCUM /* enable the optimization */
#endif
diff --git a/src/mesa/swrast/s_buffers.c b/src/mesa/swrast/s_buffers.c
index d787acfafb1..6c7b447aba8 100644
--- a/src/mesa/swrast/s_buffers.c
+++ b/src/mesa/swrast/s_buffers.c
@@ -1,4 +1,4 @@
-/* $Id: s_buffers.c,v 1.10 2002/03/16 00:53:15 brianp Exp $ */
+/* $Id: s_buffers.c,v 1.11 2002/06/15 02:38:17 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -169,20 +169,20 @@ clear_color_buffers(GLcontext *ctx)
for (bufferBit = 1; bufferBit <= 8; bufferBit = bufferBit << 1) {
if (bufferBit & ctx->Color.DrawDestMask) {
if (bufferBit == FRONT_LEFT_BIT) {
- (void) (*ctx->Driver.SetDrawBuffer)( ctx, GL_FRONT_LEFT);
- (void) (*swrast->Driver.SetReadBuffer)( ctx, ctx->DrawBuffer, GL_FRONT_LEFT);
+ (*ctx->Driver.SetDrawBuffer)( ctx, GL_FRONT_LEFT);
+ (*swrast->Driver.SetReadBuffer)( ctx, ctx->DrawBuffer, GL_FRONT_LEFT);
}
else if (bufferBit == FRONT_RIGHT_BIT) {
- (void) (*ctx->Driver.SetDrawBuffer)( ctx, GL_FRONT_RIGHT);
- (void) (*swrast->Driver.SetReadBuffer)( ctx, ctx->DrawBuffer, GL_FRONT_RIGHT);
+ (*ctx->Driver.SetDrawBuffer)( ctx, GL_FRONT_RIGHT);
+ (*swrast->Driver.SetReadBuffer)( ctx, ctx->DrawBuffer, GL_FRONT_RIGHT);
}
else if (bufferBit == BACK_LEFT_BIT) {
- (void) (*ctx->Driver.SetDrawBuffer)( ctx, GL_BACK_LEFT);
- (void) (*swrast->Driver.SetReadBuffer)( ctx, ctx->DrawBuffer, GL_BACK_LEFT);
+ (*ctx->Driver.SetDrawBuffer)( ctx, GL_BACK_LEFT);
+ (*swrast->Driver.SetReadBuffer)( ctx, ctx->DrawBuffer, GL_BACK_LEFT);
}
else {
- (void) (*ctx->Driver.SetDrawBuffer)( ctx, GL_BACK_RIGHT);
- (void) (*swrast->Driver.SetReadBuffer)( ctx, ctx->DrawBuffer, GL_BACK_RIGHT);
+ (*ctx->Driver.SetDrawBuffer)( ctx, GL_BACK_RIGHT);
+ (*swrast->Driver.SetReadBuffer)( ctx, ctx->DrawBuffer, GL_BACK_RIGHT);
}
if (colorMask != 0xffffffff) {
diff --git a/src/mesa/swrast/s_context.c b/src/mesa/swrast/s_context.c
index 60b389bde75..e0180d1ca78 100644
--- a/src/mesa/swrast/s_context.c
+++ b/src/mesa/swrast/s_context.c
@@ -1,4 +1,4 @@
-/* $Id: s_context.c,v 1.33 2002/06/13 04:49:17 brianp Exp $ */
+/* $Id: s_context.c,v 1.34 2002/06/15 02:38:17 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -28,6 +28,7 @@
*/
#include "glheader.h"
+#include "context.h"
#include "mtypes.h"
#include "mem.h"
@@ -86,10 +87,8 @@ _swrast_update_rasterflags( GLcontext *ctx )
* MULTI_DRAW_BIT flag. Also set it if we're drawing to no
* buffers or the RGBA or CI mask disables all writes.
*/
- if (ctx->Color.MultiDrawBuffer) {
- RasterMask |= MULTI_DRAW_BIT;
- }
- else if (ctx->Color.DrawBuffer==GL_NONE) {
+ if (ctx->Color.DrawBuffer == GL_FRONT_AND_BACK ||
+ ctx->Color.DrawBuffer == GL_NONE) {
RasterMask |= MULTI_DRAW_BIT;
}
else if (ctx->Visual.rgbMode && *((GLuint *) ctx->Color.ColorMask) == 0) {
@@ -389,7 +388,7 @@ _swrast_Quad( GLcontext *ctx,
const SWvertex *v2, const SWvertex *v3 )
{
if (SWRAST_DEBUG) {
- _mesa_debug("_swrast_Quad\n");
+ _mesa_debug(ctx, "_swrast_Quad\n");
_swrast_print_vertex( ctx, v0 );
_swrast_print_vertex( ctx, v1 );
_swrast_print_vertex( ctx, v2 );
@@ -404,7 +403,7 @@ _swrast_Triangle( GLcontext *ctx, const SWvertex *v0,
const SWvertex *v1, const SWvertex *v2 )
{
if (SWRAST_DEBUG) {
- _mesa_debug("_swrast_Triangle\n");
+ _mesa_debug(ctx, "_swrast_Triangle\n");
_swrast_print_vertex( ctx, v0 );
_swrast_print_vertex( ctx, v1 );
_swrast_print_vertex( ctx, v2 );
@@ -416,7 +415,7 @@ void
_swrast_Line( GLcontext *ctx, const SWvertex *v0, const SWvertex *v1 )
{
if (SWRAST_DEBUG) {
- _mesa_debug("_swrast_Line\n");
+ _mesa_debug(ctx, "_swrast_Line\n");
_swrast_print_vertex( ctx, v0 );
_swrast_print_vertex( ctx, v1 );
}
@@ -427,7 +426,7 @@ void
_swrast_Point( GLcontext *ctx, const SWvertex *v0 )
{
if (SWRAST_DEBUG) {
- _mesa_debug("_swrast_Point\n");
+ _mesa_debug(ctx, "_swrast_Point\n");
_swrast_print_vertex( ctx, v0 );
}
SWRAST_CONTEXT(ctx)->Point( ctx, v0 );
@@ -437,7 +436,7 @@ void
_swrast_InvalidateState( GLcontext *ctx, GLuint new_state )
{
if (SWRAST_DEBUG) {
- _mesa_debug("_swrast_InvalidateState\n");
+ _mesa_debug(ctx, "_swrast_InvalidateState\n");
}
SWRAST_CONTEXT(ctx)->InvalidateState( ctx, new_state );
}
@@ -446,7 +445,7 @@ void
_swrast_ResetLineStipple( GLcontext *ctx )
{
if (SWRAST_DEBUG) {
- _mesa_debug("_swrast_ResetLineStipple\n");
+ _mesa_debug(ctx, "_swrast_ResetLineStipple\n");
}
SWRAST_CONTEXT(ctx)->StippleCounter = 0;
}
@@ -455,7 +454,7 @@ void
_swrast_allow_vertex_fog( GLcontext *ctx, GLboolean value )
{
if (SWRAST_DEBUG) {
- _mesa_debug("_swrast_allow_vertex_fog %d\n", value);
+ _mesa_debug(ctx, "_swrast_allow_vertex_fog %d\n", value);
}
SWRAST_CONTEXT(ctx)->InvalidateState( ctx, _NEW_HINT );
SWRAST_CONTEXT(ctx)->AllowVertexFog = value;
@@ -465,7 +464,7 @@ void
_swrast_allow_pixel_fog( GLcontext *ctx, GLboolean value )
{
if (SWRAST_DEBUG) {
- _mesa_debug("_swrast_allow_pixel_fog %d\n", value);
+ _mesa_debug(ctx, "_swrast_allow_pixel_fog %d\n", value);
}
SWRAST_CONTEXT(ctx)->InvalidateState( ctx, _NEW_HINT );
SWRAST_CONTEXT(ctx)->AllowPixelFog = value;
@@ -479,7 +478,7 @@ _swrast_CreateContext( GLcontext *ctx )
SWcontext *swrast = (SWcontext *)CALLOC(sizeof(SWcontext));
if (SWRAST_DEBUG) {
- _mesa_debug("_swrast_CreateContext\n");
+ _mesa_debug(ctx, "_swrast_CreateContext\n");
}
if (!swrast)
@@ -539,7 +538,7 @@ _swrast_DestroyContext( GLcontext *ctx )
SWcontext *swrast = SWRAST_CONTEXT(ctx);
if (SWRAST_DEBUG) {
- _mesa_debug("_swrast_DestroyContext\n");
+ _mesa_debug(ctx, "_swrast_DestroyContext\n");
}
FREE( swrast->span );
@@ -565,32 +564,32 @@ _swrast_print_vertex( GLcontext *ctx, const SWvertex *v )
GLuint i;
if (SWRAST_DEBUG_VERTICES) {
- _mesa_debug("win %f %f %f %f\n",
+ _mesa_debug(ctx, "win %f %f %f %f\n",
v->win[0], v->win[1], v->win[2], v->win[3]);
for (i = 0 ; i < ctx->Const.MaxTextureUnits ; i++)
if (ctx->Texture.Unit[i]._ReallyEnabled)
- _mesa_debug("texcoord[%d] %f %f %f %f\n", i,
+ _mesa_debug(ctx, "texcoord[%d] %f %f %f %f\n", i,
v->texcoord[i][0], v->texcoord[i][1],
v->texcoord[i][2], v->texcoord[i][3]);
#if CHAN_TYPE == GL_FLOAT
- _mesa_debug("color %f %f %f %f\n",
+ _mesa_debug(ctx, "color %f %f %f %f\n",
v->color[0], v->color[1], v->color[2], v->color[3]);
- _mesa_debug("spec %f %f %f %f\n",
+ _mesa_debug(ctx, "spec %f %f %f %f\n",
v->specular[0], v->specular[1],
v->specular[2], v->specular[3]);
#else
- _mesa_debug("color %d %d %d %d\n",
+ _mesa_debug(ctx, "color %d %d %d %d\n",
v->color[0], v->color[1], v->color[2], v->color[3]);
- _mesa_debug("spec %d %d %d %d\n",
+ _mesa_debug(ctx, "spec %d %d %d %d\n",
v->specular[0], v->specular[1],
v->specular[2], v->specular[3]);
#endif
- _mesa_debug("fog %f\n", v->fog);
- _mesa_debug("index %d\n", v->index);
- _mesa_debug("pointsize %f\n", v->pointSize);
- _mesa_debug("\n");
+ _mesa_debug(ctx, "fog %f\n", v->fog);
+ _mesa_debug(ctx, "index %d\n", v->index);
+ _mesa_debug(ctx, "pointsize %f\n", v->pointSize);
+ _mesa_debug(ctx, "\n");
}
}
diff --git a/src/mesa/swrast/s_drawpix.c b/src/mesa/swrast/s_drawpix.c
index e0e6e7868d3..ab2dec8e192 100644
--- a/src/mesa/swrast/s_drawpix.c
+++ b/src/mesa/swrast/s_drawpix.c
@@ -1,4 +1,4 @@
-/* $Id: s_drawpix.c,v 1.33 2002/04/19 14:05:50 brianp Exp $ */
+/* $Id: s_drawpix.c,v 1.34 2002/06/15 02:38:17 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -629,6 +629,8 @@ draw_depth_pixels( GLcontext *ctx, GLint x, GLint y,
if (ctx->Fog.Enabled)
_mesa_span_default_fog(ctx, span);
+ if (ctx->Texture._ReallyEnabled)
+ _mesa_span_default_texcoords(ctx, span);
if (type==GL_UNSIGNED_SHORT && ctx->Visual.depthBits == 16
&& !bias_or_scale && !zoom && ctx->Visual.rgbMode) {
@@ -732,6 +734,8 @@ draw_rgba_pixels( GLcontext *ctx, GLint x, GLint y,
_mesa_span_default_z(ctx, span);
if (ctx->Fog.Enabled)
_mesa_span_default_fog(ctx, span);
+ if (ctx->Texture._ReallyEnabled)
+ _mesa_span_default_texcoords(ctx, span);
if (SWRAST_CONTEXT(ctx)->_RasterMask == 0 && !zoom && x >= 0 && y >= 0
&& x + width <= (GLint) ctx->DrawBuffer->Width
@@ -859,11 +863,11 @@ _swrast_DrawPixels( GLcontext *ctx,
SWcontext *swrast = SWRAST_CONTEXT(ctx);
(void) unpack;
-
if (swrast->NewState)
_swrast_validate_derived( ctx );
RENDER_START(swrast,ctx);
+
switch (format) {
case GL_STENCIL_INDEX:
draw_stencil_pixels( ctx, x, y, width, height, type, pixels );
@@ -896,3 +900,55 @@ _swrast_DrawPixels( GLcontext *ctx,
RENDER_FINISH(swrast,ctx);
}
+
+
+
+#if 0 /* experimental */
+/*
+ * Execute glDrawDepthPixelsMESA().
+ */
+void
+_swrast_DrawDepthPixelsMESA( GLcontext *ctx,
+ GLint x, GLint y,
+ GLsizei width, GLsizei height,
+ GLenum colorFormat, GLenum colorType,
+ const GLvoid *colors,
+ GLenum depthType, const GLvoid *depths,
+ const struct gl_pixelstore_attrib *unpack )
+{
+ SWcontext *swrast = SWRAST_CONTEXT(ctx);
+ (void) unpack;
+
+ if (swrast->NewState)
+ _swrast_validate_derived( ctx );
+
+ RENDER_START(swrast,ctx);
+
+ switch (colorFormat) {
+ case GL_COLOR_INDEX:
+ if (ctx->Visual.rgbMode)
+ draw_rgba_pixels(ctx, x,y, width, height, colorFormat, colorType, colors);
+ else
+ draw_index_pixels(ctx, x, y, width, height, colorType, colors);
+ break;
+ case GL_RED:
+ case GL_GREEN:
+ case GL_BLUE:
+ case GL_ALPHA:
+ case GL_LUMINANCE:
+ case GL_LUMINANCE_ALPHA:
+ case GL_RGB:
+ case GL_BGR:
+ case GL_RGBA:
+ case GL_BGRA:
+ case GL_ABGR_EXT:
+ draw_rgba_pixels(ctx, x, y, width, height, colorFormat, colorType, colors);
+ break;
+ default:
+ _mesa_error( ctx, GL_INVALID_ENUM,
+ "glDrawDepthPixelsMESA(colorFormat)" );
+ }
+
+ RENDER_FINISH(swrast,ctx);
+}
+#endif
diff --git a/src/mesa/swrast/s_span.c b/src/mesa/swrast/s_span.c
index 1e3c710b8a1..0a1e3176083 100644
--- a/src/mesa/swrast/s_span.c
+++ b/src/mesa/swrast/s_span.c
@@ -1,4 +1,4 @@
-/* $Id: s_span.c,v 1.42 2002/05/02 00:59:20 brianp Exp $ */
+/* $Id: s_span.c,v 1.43 2002/06/15 02:38:17 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -119,6 +119,28 @@ _mesa_span_default_color( GLcontext *ctx, struct sw_span *span )
}
+/**
+ * Init span's texcoord interpolation values to the RasterPos texcoords.
+ * Used during setup for glDraw/CopyPixels.
+ */
+void
+_mesa_span_default_texcoords( GLcontext *ctx, struct sw_span *span )
+{
+ GLuint i;
+ for (i = 0; i < ctx->Const.MaxTextureUnits; i++) {
+ span->tex[i][0] = ctx->Current.RasterTexCoords[i][0];
+ span->tex[i][1] = ctx->Current.RasterTexCoords[i][1];
+ span->tex[i][2] = ctx->Current.RasterTexCoords[i][2];
+ span->tex[i][3] = ctx->Current.RasterTexCoords[i][3];
+ span->texStepX[i][0] = 0.0;
+ span->texStepX[i][1] = 0.0;
+ span->texStepX[i][2] = 0.0;
+ span->texStepX[i][3] = 0.0;
+ }
+ span->interpMask |= SPAN_TEXTURE;
+}
+
+
/* Fill in the span.color.rgba array from the interpolation values */
static void
interpolate_colors(GLcontext *ctx, struct sw_span *span)
diff --git a/src/mesa/swrast/s_span.h b/src/mesa/swrast/s_span.h
index 54301c3433f..be577ed6e56 100644
--- a/src/mesa/swrast/s_span.h
+++ b/src/mesa/swrast/s_span.h
@@ -1,4 +1,4 @@
-/* $Id: s_span.h,v 1.16 2002/04/12 15:39:59 brianp Exp $ */
+/* $Id: s_span.h,v 1.17 2002/06/15 02:38:17 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -45,6 +45,8 @@ _mesa_span_default_fog( GLcontext *ctx, struct sw_span *span );
extern void
_mesa_span_default_color( GLcontext *ctx, struct sw_span *span );
+extern void
+_mesa_span_default_texcoords( GLcontext *ctx, struct sw_span *span );
extern void
_mesa_write_index_span( GLcontext *ctx, struct sw_span *span);