summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBrian <brian.paul@tungstengraphics.com>2007-06-21 16:04:04 -0600
committerBrian <brian.paul@tungstengraphics.com>2007-06-21 16:04:04 -0600
commit4d528e54549fb3f12462f9c5ec6e033f1ec91b0f (patch)
tree446823c639d60e0fceb73b52b8d1de05f3b107cf /src
parentf9c17ec58a492a7657ea120fa394056a680b9ec5 (diff)
parented5ed6fe2f64f45eb3a43f9c57037d9e9b7fa5ea (diff)
Merge branch 'master' of git+ssh://brianp@git.freedesktop.org/git/mesa/mesa
Diffstat (limited to 'src')
-rw-r--r--src/mesa/drivers/dri/i915/intel_pixel.c34
-rw-r--r--src/mesa/drivers/dri/i915tex/intel_pixel_draw.c9
-rw-r--r--src/mesa/drivers/dri/r300/r300_state.c2
-rw-r--r--src/mesa/swrast/s_context.c7
-rw-r--r--src/mesa/swrast/s_copypix.c14
-rw-r--r--src/mesa/swrast/s_drawpix.c17
-rw-r--r--src/mesa/swrast/s_span.c16
7 files changed, 62 insertions, 37 deletions
diff --git a/src/mesa/drivers/dri/i915/intel_pixel.c b/src/mesa/drivers/dri/i915/intel_pixel.c
index a52a81bf13..d175870a0c 100644
--- a/src/mesa/drivers/dri/i915/intel_pixel.c
+++ b/src/mesa/drivers/dri/i915/intel_pixel.c
@@ -439,21 +439,25 @@ intelDrawPixels( GLcontext *ctx,
if (INTEL_DEBUG & DEBUG_PIXEL)
fprintf(stderr, "%s\n", __FUNCTION__);
- if (!intelTryDrawPixels( ctx, x, y, width, height, format, type,
- unpack, pixels )) {
- if (ctx->FragmentProgram._Current ==
- ctx->FragmentProgram._TexEnvProgram) {
- /* don't want the i915 texenv program to be applied to DrawPixels */
- struct gl_fragment_program *fpSave = ctx->FragmentProgram._Current;
- ctx->FragmentProgram._Current = NULL;
- _swrast_DrawPixels( ctx, x, y, width, height, format, type,
- unpack, pixels );
- ctx->FragmentProgram._Current = fpSave;
- }
- else {
- _swrast_DrawPixels( ctx, x, y, width, height, format, type,
- unpack, pixels );
- }
+ if (intelTryDrawPixels( ctx, x, y, width, height, format, type,
+ unpack, pixels ))
+ return;
+
+ if (ctx->FragmentProgram._Current == ctx->FragmentProgram._TexEnvProgram) {
+ /*
+ * We don't want the i915 texenv program to be applied to DrawPixels.
+ * This is really just a performance optimization (mesa will other-
+ * wise happily run the fragment program on each pixel in the image).
+ */
+ struct gl_fragment_program *fpSave = ctx->FragmentProgram._Current;
+ ctx->FragmentProgram._Current = NULL;
+ _swrast_DrawPixels( ctx, x, y, width, height, format, type,
+ unpack, pixels );
+ ctx->FragmentProgram._Current = fpSave;
+ }
+ else {
+ _swrast_DrawPixels( ctx, x, y, width, height, format, type,
+ unpack, pixels );
}
}
diff --git a/src/mesa/drivers/dri/i915tex/intel_pixel_draw.c b/src/mesa/drivers/dri/i915tex/intel_pixel_draw.c
index 46480da1b1..77c67c821e 100644
--- a/src/mesa/drivers/dri/i915tex/intel_pixel_draw.c
+++ b/src/mesa/drivers/dri/i915tex/intel_pixel_draw.c
@@ -363,9 +363,12 @@ intelDrawPixels(GLcontext * ctx,
if (INTEL_DEBUG & DEBUG_PIXEL)
_mesa_printf("%s: fallback to swrast\n", __FUNCTION__);
- if (ctx->FragmentProgram._Current ==
- ctx->FragmentProgram._TexEnvProgram) {
- /* don't want the i915 texenv program to be applied to DrawPixels */
+ if (ctx->FragmentProgram._Current == ctx->FragmentProgram._TexEnvProgram) {
+ /*
+ * We don't want the i915 texenv program to be applied to DrawPixels.
+ * This is really just a performance optimization (mesa will other-
+ * wise happily run the fragment program on each pixel in the image).
+ */
struct gl_fragment_program *fpSave = ctx->FragmentProgram._Current;
ctx->FragmentProgram._Current = NULL;
_swrast_DrawPixels( ctx, x, y, width, height, format, type,
diff --git a/src/mesa/drivers/dri/r300/r300_state.c b/src/mesa/drivers/dri/r300/r300_state.c
index e6c394610d..bdd6855802 100644
--- a/src/mesa/drivers/dri/r300/r300_state.c
+++ b/src/mesa/drivers/dri/r300/r300_state.c
@@ -715,7 +715,7 @@ static void r300LineWidth(GLcontext * ctx, GLfloat widthf)
widthf = ctx->Line._Width;
R300_STATECHANGE(r300, lcntl);
- r300->hw.lcntl.cmd[1] |=
+ r300->hw.lcntl.cmd[1] =
R300_LINE_CNT_HO | R300_LINE_CNT_VE | (int)(widthf * 6.0);
}
diff --git a/src/mesa/swrast/s_context.c b/src/mesa/swrast/s_context.c
index cb3bc756a4..791850cb50 100644
--- a/src/mesa/swrast/s_context.c
+++ b/src/mesa/swrast/s_context.c
@@ -535,10 +535,11 @@ _swrast_update_texture_samplers(GLcontext *ctx)
/**
- * Update swrast->_ActiveAttribs, swrast->_NumActiveAttribs, swrast->_ActiveAtttribMask.
+ * Update swrast->_ActiveAttribs, swrast->_NumActiveAttribs,
+ * swrast->_ActiveAtttribMask.
*/
static void
-_swrast_update_fragment_attribs(GLcontext *ctx)
+_swrast_update_active_attribs(GLcontext *ctx)
{
SWcontext *swrast = SWRAST_CONTEXT(ctx);
GLuint attribsMask;
@@ -679,7 +680,7 @@ _swrast_validate_derived( GLcontext *ctx )
_NEW_LIGHT |
_NEW_PROGRAM |
_NEW_TEXTURE))
- _swrast_update_fragment_attribs(ctx);
+ _swrast_update_active_attribs(ctx);
if (swrast->NewState & (_NEW_PROGRAM | _NEW_BUFFERS))
_swrast_update_color_outputs(ctx);
diff --git a/src/mesa/swrast/s_copypix.c b/src/mesa/swrast/s_copypix.c
index 53e584b3b6..2383015000 100644
--- a/src/mesa/swrast/s_copypix.c
+++ b/src/mesa/swrast/s_copypix.c
@@ -188,6 +188,8 @@ static void
copy_rgba_pixels(GLcontext *ctx, GLint srcx, GLint srcy,
GLint width, GLint height, GLint destx, GLint desty)
{
+ SWcontext *swrast = SWRAST_CONTEXT(ctx);
+ const GLbitfield prevActiveAttribs = swrast->_ActiveAttribMask;
GLfloat *tmpImage, *p;
GLint sy, dy, stepy, row;
const GLboolean zoom = ctx->Pixel.ZoomX != 1.0F || ctx->Pixel.ZoomY != 1.0F;
@@ -197,12 +199,15 @@ copy_rgba_pixels(GLcontext *ctx, GLint srcx, GLint srcy,
if (!ctx->ReadBuffer->_ColorReadBuffer) {
/* no readbuffer - OK */
- return;
+ goto end;
}
+ /* don't interpolate COL0 and overwrite the glDrawPixel colors! */
+ swrast->_ActiveAttribMask &= ~FRAG_BIT_COL0;
+
if (ctx->Pixel.Convolution2DEnabled || ctx->Pixel.Separable2DEnabled) {
copy_conv_rgba_pixels(ctx, srcx, srcy, width, height, destx, desty);
- return;
+ goto end;
}
else if (ctx->Pixel.Convolution1DEnabled) {
/* make sure we don't apply 1D convolution */
@@ -239,7 +244,7 @@ copy_rgba_pixels(GLcontext *ctx, GLint srcx, GLint srcy,
tmpImage = (GLfloat *) _mesa_malloc(width * height * sizeof(GLfloat) * 4);
if (!tmpImage) {
_mesa_error( ctx, GL_OUT_OF_MEMORY, "glCopyPixels" );
- return;
+ goto end;
}
/* read the source image as RGBA/float */
p = tmpImage;
@@ -294,6 +299,9 @@ copy_rgba_pixels(GLcontext *ctx, GLint srcx, GLint srcy,
if (overlapping)
_mesa_free(tmpImage);
+
+end:
+ swrast->_ActiveAttribMask = prevActiveAttribs;
}
diff --git a/src/mesa/swrast/s_drawpix.c b/src/mesa/swrast/s_drawpix.c
index d971d90fb9..925358d77e 100644
--- a/src/mesa/swrast/s_drawpix.c
+++ b/src/mesa/swrast/s_drawpix.c
@@ -532,16 +532,22 @@ draw_rgba_pixels( GLcontext *ctx, GLint x, GLint y,
const struct gl_pixelstore_attrib *unpack,
const GLvoid *pixels )
{
+ SWcontext *swrast = SWRAST_CONTEXT(ctx);
+ const GLbitfield prevActiveAttribs = swrast->_ActiveAttribMask;
const GLint imgX = x, imgY = y;
const GLboolean zoom = ctx->Pixel.ZoomX!=1.0 || ctx->Pixel.ZoomY!=1.0;
GLfloat *convImage = NULL;
GLbitfield transferOps = ctx->_ImageTransferState;
SWspan span;
+ /* don't interpolate COL0 and overwrite the glDrawPixel colors! */
+ swrast->_ActiveAttribMask &= ~FRAG_BIT_COL0;
+
/* Try an optimized glDrawPixels first */
if (fast_draw_rgba_pixels(ctx, x, y, width, height, format, type,
- unpack, pixels))
- return;
+ unpack, pixels)) {
+ goto end;
+ }
INIT_SPAN(span, GL_BITMAP, 0, 0x0, SPAN_RGBA);
_swrast_span_default_attribs(ctx, &span);
@@ -559,13 +565,13 @@ draw_rgba_pixels( GLcontext *ctx, GLint x, GLint y,
tmpImage = (GLfloat *) _mesa_malloc(width * height * 4 * sizeof(GLfloat));
if (!tmpImage) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glDrawPixels");
- return;
+ goto end;
}
convImage = (GLfloat *) _mesa_malloc(width * height * 4 * sizeof(GLfloat));
if (!convImage) {
_mesa_free(tmpImage);
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glDrawPixels");
- return;
+ goto end;
}
/* Unpack the image and apply transfer ops up to convolution */
@@ -669,6 +675,9 @@ draw_rgba_pixels( GLcontext *ctx, GLint x, GLint y,
if (convImage) {
_mesa_free(convImage);
}
+
+end:
+ swrast->_ActiveAttribMask = prevActiveAttribs;
}
diff --git a/src/mesa/swrast/s_span.c b/src/mesa/swrast/s_span.c
index 3aaa3395e4..431629efb1 100644
--- a/src/mesa/swrast/s_span.c
+++ b/src/mesa/swrast/s_span.c
@@ -171,6 +171,11 @@ interpolate_active_attribs(GLcontext *ctx, SWspan *span, GLbitfield attrMask)
{
const SWcontext *swrast = SWRAST_CONTEXT(ctx);
+ /* for glDraw/CopyPixels() we may have turned off some bits in
+ * the _ActiveAttribMask - be sure to obey that mask now.
+ */
+ attrMask &= swrast->_ActiveAttribMask;
+
ATTRIB_LOOP_BEGIN
if (attrMask & (1 << attr)) {
const GLfloat dwdx = span->attrStepX[FRAG_ATTRIB_WPOS][3];
@@ -1169,15 +1174,10 @@ shade_texture_span(GLcontext *ctx, SWspan *span)
if (ctx->FragmentProgram._Current ||
ctx->ATIFragmentShader._Enabled) {
/* programmable shading */
- if (span->primitive == GL_BITMAP) {
- if (span->array->ChanType != GL_FLOAT)
- convert_color_type(span, GL_FLOAT, 0);
- interpolate_active_attribs(ctx, span, ~FRAG_ATTRIB_COL0);
- }
- else {
- /* point, line, triangle */
- interpolate_active_attribs(ctx, span, ~0);
+ if (span->primitive == GL_BITMAP && span->array->ChanType != GL_FLOAT) {
+ convert_color_type(span, GL_FLOAT, 0);
}
+ interpolate_active_attribs(ctx, span, ~0);
span->array->ChanType = GL_FLOAT;
if (!(span->arrayMask & SPAN_Z))