aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa/swrast
diff options
context:
space:
mode:
Diffstat (limited to 'mesalib/src/mesa/swrast')
-rw-r--r--mesalib/src/mesa/swrast/s_accum.c4
-rw-r--r--mesalib/src/mesa/swrast/s_context.c14
-rw-r--r--mesalib/src/mesa/swrast/s_context.h1
-rw-r--r--mesalib/src/mesa/swrast/s_fog.c2
-rw-r--r--mesalib/src/mesa/swrast/s_readpix.c22
-rw-r--r--mesalib/src/mesa/swrast/s_span.c8
6 files changed, 29 insertions, 22 deletions
diff --git a/mesalib/src/mesa/swrast/s_accum.c b/mesalib/src/mesa/swrast/s_accum.c
index 560a1d143..2889d908b 100644
--- a/mesalib/src/mesa/swrast/s_accum.c
+++ b/mesalib/src/mesa/swrast/s_accum.c
@@ -24,6 +24,7 @@
#include "main/glheader.h"
+#include "main/condrender.h"
#include "main/context.h"
#include "main/macros.h"
#include "main/imports.h"
@@ -553,6 +554,9 @@ _swrast_Accum(struct gl_context *ctx, GLenum op, GLfloat value)
return;
}
+ if (!_mesa_check_conditional_render(ctx))
+ return;
+
swrast_render_start(ctx);
/* Compute region after calling swrast_render_start() so that we know the
diff --git a/mesalib/src/mesa/swrast/s_context.c b/mesalib/src/mesa/swrast/s_context.c
index b0c9880b1..d5f49923c 100644
--- a/mesalib/src/mesa/swrast/s_context.c
+++ b/mesalib/src/mesa/swrast/s_context.c
@@ -248,18 +248,10 @@ _swrast_update_fog_state( struct gl_context *ctx )
SWcontext *swrast = SWRAST_CONTEXT(ctx);
const struct gl_fragment_program *fp = ctx->FragmentProgram._Current;
+ assert((fp == NULL) || (fp->Base.Target == GL_FRAGMENT_PROGRAM_ARB));
+
/* determine if fog is needed, and if so, which fog mode */
- swrast->_FogEnabled = GL_FALSE;
- if (fp && fp->Base.Target == GL_FRAGMENT_PROGRAM_ARB) {
- if (fp->FogOption != GL_NONE) {
- swrast->_FogEnabled = GL_TRUE;
- swrast->_FogMode = fp->FogOption;
- }
- }
- else if (ctx->Fog.Enabled) {
- swrast->_FogEnabled = GL_TRUE;
- swrast->_FogMode = ctx->Fog.Mode;
- }
+ swrast->_FogEnabled = (fp == NULL && ctx->Fog.Enabled);
}
diff --git a/mesalib/src/mesa/swrast/s_context.h b/mesalib/src/mesa/swrast/s_context.h
index 7535832ab..1673cece1 100644
--- a/mesalib/src/mesa/swrast/s_context.h
+++ b/mesalib/src/mesa/swrast/s_context.h
@@ -135,7 +135,6 @@ typedef struct
GLboolean _TextureCombinePrimary;
GLboolean _FogEnabled;
GLboolean _DeferredTexture;
- GLenum _FogMode; /* either GL_FOG_MODE or fragment program's fog mode */
/** List/array of the fragment attributes to interpolate */
GLuint _ActiveAttribs[FRAG_ATTRIB_MAX];
diff --git a/mesalib/src/mesa/swrast/s_fog.c b/mesalib/src/mesa/swrast/s_fog.c
index 5acb5f4d1..5df071481 100644
--- a/mesalib/src/mesa/swrast/s_fog.c
+++ b/mesalib/src/mesa/swrast/s_fog.c
@@ -158,7 +158,7 @@ _swrast_fog_rgba_span( const struct gl_context *ctx, SWspan *span )
/* The span's fog values are fog coordinates, now compute blend factors
* and blend the fragment colors with the fog color.
*/
- switch (swrast->_FogMode) {
+ switch (ctx->Fog.Mode) {
case GL_LINEAR:
{
const GLfloat fogEnd = ctx->Fog.End;
diff --git a/mesalib/src/mesa/swrast/s_readpix.c b/mesalib/src/mesa/swrast/s_readpix.c
index 23da10dab..59fb04a98 100644
--- a/mesalib/src/mesa/swrast/s_readpix.c
+++ b/mesalib/src/mesa/swrast/s_readpix.c
@@ -191,7 +191,13 @@ fast_read_rgba_pixels( struct gl_context *ctx,
if (!rb)
return GL_FALSE;
- ASSERT(rb->_BaseFormat == GL_RGBA || rb->_BaseFormat == GL_RGB ||
+ ASSERT(rb->_BaseFormat == GL_RGBA ||
+ rb->_BaseFormat == GL_RGB ||
+ rb->_BaseFormat == GL_RG ||
+ rb->_BaseFormat == GL_RED ||
+ rb->_BaseFormat == GL_LUMINANCE ||
+ rb->_BaseFormat == GL_INTENSITY ||
+ rb->_BaseFormat == GL_LUMINANCE_ALPHA ||
rb->_BaseFormat == GL_ALPHA);
/* clipping should have already been done */
@@ -312,12 +318,12 @@ read_rgba_pixels( struct gl_context *ctx,
if (!rb)
return;
- if (type == GL_FLOAT && ((ctx->Color.ClampReadColor == GL_TRUE) ||
- (ctx->Color.ClampReadColor == GL_FIXED_ONLY_ARB &&
- rb->DataType != GL_FLOAT)))
+ if ((ctx->Color._ClampReadColor == GL_TRUE || type != GL_FLOAT) &&
+ !_mesa_is_integer_format(format)) {
transferOps |= IMAGE_CLAMP_BIT;
+ }
- /* Try optimized path first */
+ /* Try the optimized path first. */
if (fast_read_rgba_pixels(ctx, x, y, width, height,
format, type, pixels, packing, transferOps)) {
return; /* done! */
@@ -341,9 +347,9 @@ read_rgba_pixels( struct gl_context *ctx,
_swrast_read_rgba_span(ctx, rb, width, x, y, GL_FLOAT, rgba);
/* apply fudge factor for shallow color buffers */
- if (fb->Visual.redBits < 8 ||
- fb->Visual.greenBits < 8 ||
- fb->Visual.blueBits < 8) {
+ if ((fb->Visual.redBits < 8 && fb->Visual.redBits != 0) ||
+ (fb->Visual.greenBits < 8 && fb->Visual.greenBits != 0) ||
+ (fb->Visual.blueBits < 8 && fb->Visual.blueBits != 0)) {
adjust_colors(fb, width, rgba);
}
diff --git a/mesalib/src/mesa/swrast/s_span.c b/mesalib/src/mesa/swrast/s_span.c
index f0222f5a0..13e11180f 100644
--- a/mesalib/src/mesa/swrast/s_span.c
+++ b/mesalib/src/mesa/swrast/s_span.c
@@ -1348,7 +1348,13 @@ _swrast_read_rgba_span( struct gl_context *ctx, struct gl_renderbuffer *rb,
ASSERT(rb);
ASSERT(rb->GetRow);
- ASSERT(rb->_BaseFormat == GL_RGB || rb->_BaseFormat == GL_RGBA ||
+ ASSERT(rb->_BaseFormat == GL_RGBA ||
+ rb->_BaseFormat == GL_RGB ||
+ rb->_BaseFormat == GL_RG ||
+ rb->_BaseFormat == GL_RED ||
+ rb->_BaseFormat == GL_LUMINANCE ||
+ rb->_BaseFormat == GL_INTENSITY ||
+ rb->_BaseFormat == GL_LUMINANCE_ALPHA ||
rb->_BaseFormat == GL_ALPHA);
if (rb->DataType == dstType) {