summaryrefslogtreecommitdiffstats
path: root/src/mesa/main
diff options
context:
space:
mode:
authorIan Romanick <[email protected]>2010-02-24 18:58:38 -0800
committerIan Romanick <[email protected]>2010-03-03 12:37:04 -0800
commit22a96f305898b5d1aa26809c7156a01686eb9bf0 (patch)
treea6a863d1bd28f639f92467364d4d4687f4367413 /src/mesa/main
parentfcf438e9e03f6e75bca4a49ad372fe7c4b1abbf8 (diff)
mesa: Remove checks of Visual.rgbMode
This must always be true now, so there is no reason to check it. Ever. Signed-off-by: Ian Romanick <[email protected]>
Diffstat (limited to 'src/mesa/main')
-rw-r--r--src/mesa/main/clear.c27
-rw-r--r--src/mesa/main/context.c2
-rw-r--r--src/mesa/main/feedback.c11
-rw-r--r--src/mesa/main/framebuffer.c7
-rw-r--r--src/mesa/main/light.c41
-rw-r--r--src/mesa/main/rastpos.c38
-rw-r--r--src/mesa/main/readpix.c16
-rw-r--r--src/mesa/main/renderbuffer.c25
8 files changed, 48 insertions, 119 deletions
diff --git a/src/mesa/main/clear.c b/src/mesa/main/clear.c
index 8085bedf1c1..e76ab5527b0 100644
--- a/src/mesa/main/clear.c
+++ b/src/mesa/main/clear.c
@@ -51,11 +51,6 @@ _mesa_ClearIndex( GLfloat c )
FLUSH_VERTICES(ctx, _NEW_COLOR);
ctx->Color.ClearIndex = (GLuint) c;
-
- if (!ctx->Visual.rgbMode && ctx->Driver.ClearIndex) {
- /* it's OK to call glClearIndex in RGBA mode but it should be a NOP */
- (*ctx->Driver.ClearIndex)( ctx, ctx->Color.ClearIndex );
- }
}
#endif
@@ -92,7 +87,7 @@ _mesa_ClearColor( GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha )
FLUSH_VERTICES(ctx, _NEW_COLOR);
COPY_4V(ctx->Color.ClearColor, tmp);
- if (ctx->Visual.rgbMode && ctx->Driver.ClearColor) {
+ if (ctx->Driver.ClearColor) {
/* it's OK to call glClearColor in CI mode but it should be a NOP */
(*ctx->Driver.ClearColor)(ctx, ctx->Color.ClearColor);
}
@@ -261,11 +256,6 @@ _mesa_ClearBufferiv(GLenum buffer, GLint drawbuffer, const GLint *value)
FLUSH_CURRENT(ctx, 0);
- if (!ctx->DrawBuffer->Visual.rgbMode) {
- _mesa_error(ctx, GL_INVALID_OPERATION, "glClearBufferiv()");
- return;
- }
-
if (ctx->NewState) {
_mesa_update_state( ctx );
}
@@ -342,11 +332,6 @@ _mesa_ClearBufferuiv(GLenum buffer, GLint drawbuffer, const GLuint *value)
FLUSH_CURRENT(ctx, 0);
- if (!ctx->DrawBuffer->Visual.rgbMode) {
- _mesa_error(ctx, GL_INVALID_OPERATION, "glClearBufferuiv()");
- return;
- }
-
if (ctx->NewState) {
_mesa_update_state( ctx );
}
@@ -401,11 +386,6 @@ _mesa_ClearBufferfv(GLenum buffer, GLint drawbuffer, const GLfloat *value)
FLUSH_CURRENT(ctx, 0);
- if (!ctx->DrawBuffer->Visual.rgbMode) {
- _mesa_error(ctx, GL_INVALID_OPERATION, "glClearBufferfv()");
- return;
- }
-
if (ctx->NewState) {
_mesa_update_state( ctx );
}
@@ -480,11 +460,6 @@ _mesa_ClearBufferfi(GLenum buffer, GLint drawbuffer,
FLUSH_CURRENT(ctx, 0);
- if (!ctx->DrawBuffer->Visual.rgbMode) {
- _mesa_error(ctx, GL_INVALID_OPERATION, "glClearBufferfi()");
- return;
- }
-
if (buffer != GL_DEPTH_STENCIL) {
_mesa_error(ctx, GL_INVALID_ENUM, "glClearBufferfi(buffer=%s)",
_mesa_lookup_enum_by_nr(buffer));
diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c
index b827d54176e..73126b95755 100644
--- a/src/mesa/main/context.c
+++ b/src/mesa/main/context.c
@@ -1164,8 +1164,6 @@ check_compatible(const GLcontext *ctx, const GLframebuffer *buffer)
if (ctxvis == bufvis)
return GL_TRUE;
- if (ctxvis->rgbMode != bufvis->rgbMode)
- return GL_FALSE;
#if 0
/* disabling this fixes the fgl_glxgears pbuffer demo */
if (ctxvis->doubleBufferMode && !bufvis->doubleBufferMode)
diff --git a/src/mesa/main/feedback.c b/src/mesa/main/feedback.c
index e20456fa758..323cc530363 100644
--- a/src/mesa/main/feedback.c
+++ b/src/mesa/main/feedback.c
@@ -78,18 +78,13 @@ _mesa_FeedbackBuffer( GLsizei size, GLenum type, GLfloat *buffer )
ctx->Feedback._Mask = FB_3D;
break;
case GL_3D_COLOR:
- ctx->Feedback._Mask = (FB_3D |
- (ctx->Visual.rgbMode ? FB_COLOR : FB_INDEX));
+ ctx->Feedback._Mask = (FB_3D | FB_COLOR);
break;
case GL_3D_COLOR_TEXTURE:
- ctx->Feedback._Mask = (FB_3D |
- (ctx->Visual.rgbMode ? FB_COLOR : FB_INDEX) |
- FB_TEXTURE);
+ ctx->Feedback._Mask = (FB_3D | FB_COLOR | FB_TEXTURE);
break;
case GL_4D_COLOR_TEXTURE:
- ctx->Feedback._Mask = (FB_3D | FB_4D |
- (ctx->Visual.rgbMode ? FB_COLOR : FB_INDEX) |
- FB_TEXTURE);
+ ctx->Feedback._Mask = (FB_3D | FB_4D | FB_COLOR | FB_TEXTURE);
break;
default:
_mesa_error( ctx, GL_INVALID_ENUM, "glFeedbackBuffer" );
diff --git a/src/mesa/main/framebuffer.c b/src/mesa/main/framebuffer.c
index 269bc9ac6ca..6a85162d5da 100644
--- a/src/mesa/main/framebuffer.c
+++ b/src/mesa/main/framebuffer.c
@@ -536,7 +536,7 @@ _mesa_update_framebuffer_visual(struct gl_framebuffer *fb)
}
#endif
- /* find first RGB or CI renderbuffer */
+ /* find first RGB renderbuffer */
for (i = 0; i < BUFFER_COUNT; i++) {
if (fb->Attachment[i].Renderbuffer) {
const struct gl_renderbuffer *rb = fb->Attachment[i].Renderbuffer;
@@ -554,11 +554,6 @@ _mesa_update_framebuffer_visual(struct gl_framebuffer *fb)
fb->Visual.samples = rb->NumSamples;
break;
}
- else if (baseFormat == GL_COLOR_INDEX) {
- fb->Visual.indexBits = _mesa_get_format_bits(fmt, GL_INDEX_BITS);
- fb->Visual.rgbMode = GL_FALSE;
- break;
- }
}
}
diff --git a/src/mesa/main/light.c b/src/mesa/main/light.c
index 6899ed0ddf3..19dc96892d2 100644
--- a/src/mesa/main/light.c
+++ b/src/mesa/main/light.c
@@ -1093,31 +1093,22 @@ _mesa_update_lighting( GLcontext *ctx )
* FLUSH_UPDATE_CURRENT, as when any outstanding material changes
* are flushed, they will update the derived state at that time.
*/
- if (ctx->Visual.rgbMode) {
- if (ctx->Light.Model.TwoSide)
- _mesa_update_material( ctx,
- MAT_BIT_FRONT_EMISSION |
- MAT_BIT_FRONT_AMBIENT |
- MAT_BIT_FRONT_DIFFUSE |
- MAT_BIT_FRONT_SPECULAR |
- MAT_BIT_BACK_EMISSION |
- MAT_BIT_BACK_AMBIENT |
- MAT_BIT_BACK_DIFFUSE |
- MAT_BIT_BACK_SPECULAR);
- else
- _mesa_update_material( ctx,
- MAT_BIT_FRONT_EMISSION |
- MAT_BIT_FRONT_AMBIENT |
- MAT_BIT_FRONT_DIFFUSE |
- MAT_BIT_FRONT_SPECULAR);
- }
- else {
- static const GLfloat ci[3] = { .30F, .59F, .11F };
- foreach(light, &ctx->Light.EnabledList) {
- light->_dli = DOT3(ci, light->Diffuse);
- light->_sli = DOT3(ci, light->Specular);
- }
- }
+ if (ctx->Light.Model.TwoSide)
+ _mesa_update_material(ctx,
+ MAT_BIT_FRONT_EMISSION |
+ MAT_BIT_FRONT_AMBIENT |
+ MAT_BIT_FRONT_DIFFUSE |
+ MAT_BIT_FRONT_SPECULAR |
+ MAT_BIT_BACK_EMISSION |
+ MAT_BIT_BACK_AMBIENT |
+ MAT_BIT_BACK_DIFFUSE |
+ MAT_BIT_BACK_SPECULAR);
+ else
+ _mesa_update_material(ctx,
+ MAT_BIT_FRONT_EMISSION |
+ MAT_BIT_FRONT_AMBIENT |
+ MAT_BIT_FRONT_DIFFUSE |
+ MAT_BIT_FRONT_SPECULAR);
}
diff --git a/src/mesa/main/rastpos.c b/src/mesa/main/rastpos.c
index d72b846c362..03ff3b6bbc4 100644
--- a/src/mesa/main/rastpos.c
+++ b/src/mesa/main/rastpos.c
@@ -246,28 +246,22 @@ window_pos3f(GLfloat x, GLfloat y, GLfloat z)
ctx->Current.RasterDistance = 0.0;
/* raster color = current color or index */
- if (ctx->Visual.rgbMode) {
- ctx->Current.RasterColor[0]
- = CLAMP(ctx->Current.Attrib[VERT_ATTRIB_COLOR0][0], 0.0F, 1.0F);
- ctx->Current.RasterColor[1]
- = CLAMP(ctx->Current.Attrib[VERT_ATTRIB_COLOR0][1], 0.0F, 1.0F);
- ctx->Current.RasterColor[2]
- = CLAMP(ctx->Current.Attrib[VERT_ATTRIB_COLOR0][2], 0.0F, 1.0F);
- ctx->Current.RasterColor[3]
- = CLAMP(ctx->Current.Attrib[VERT_ATTRIB_COLOR0][3], 0.0F, 1.0F);
- ctx->Current.RasterSecondaryColor[0]
- = CLAMP(ctx->Current.Attrib[VERT_ATTRIB_COLOR1][0], 0.0F, 1.0F);
- ctx->Current.RasterSecondaryColor[1]
- = CLAMP(ctx->Current.Attrib[VERT_ATTRIB_COLOR1][1], 0.0F, 1.0F);
- ctx->Current.RasterSecondaryColor[2]
- = CLAMP(ctx->Current.Attrib[VERT_ATTRIB_COLOR1][2], 0.0F, 1.0F);
- ctx->Current.RasterSecondaryColor[3]
- = CLAMP(ctx->Current.Attrib[VERT_ATTRIB_COLOR1][3], 0.0F, 1.0F);
- }
- else {
- ctx->Current.RasterIndex
- = ctx->Current.Attrib[VERT_ATTRIB_COLOR_INDEX][0];
- }
+ ctx->Current.RasterColor[0]
+ = CLAMP(ctx->Current.Attrib[VERT_ATTRIB_COLOR0][0], 0.0F, 1.0F);
+ ctx->Current.RasterColor[1]
+ = CLAMP(ctx->Current.Attrib[VERT_ATTRIB_COLOR0][1], 0.0F, 1.0F);
+ ctx->Current.RasterColor[2]
+ = CLAMP(ctx->Current.Attrib[VERT_ATTRIB_COLOR0][2], 0.0F, 1.0F);
+ ctx->Current.RasterColor[3]
+ = CLAMP(ctx->Current.Attrib[VERT_ATTRIB_COLOR0][3], 0.0F, 1.0F);
+ ctx->Current.RasterSecondaryColor[0]
+ = CLAMP(ctx->Current.Attrib[VERT_ATTRIB_COLOR1][0], 0.0F, 1.0F);
+ ctx->Current.RasterSecondaryColor[1]
+ = CLAMP(ctx->Current.Attrib[VERT_ATTRIB_COLOR1][1], 0.0F, 1.0F);
+ ctx->Current.RasterSecondaryColor[2]
+ = CLAMP(ctx->Current.Attrib[VERT_ATTRIB_COLOR1][2], 0.0F, 1.0F);
+ ctx->Current.RasterSecondaryColor[3]
+ = CLAMP(ctx->Current.Attrib[VERT_ATTRIB_COLOR1][3], 0.0F, 1.0F);
/* raster texcoord = current texcoord */
{
diff --git a/src/mesa/main/readpix.c b/src/mesa/main/readpix.c
index feea1d375f6..f4d74e8be6d 100644
--- a/src/mesa/main/readpix.c
+++ b/src/mesa/main/readpix.c
@@ -77,14 +77,7 @@ _mesa_error_check_format_type(GLcontext *ctx, GLenum format, GLenum type,
case GL_RGBA:
case GL_BGRA:
case GL_ABGR_EXT:
- if (drawing) {
- if (!ctx->DrawBuffer->Visual.rgbMode) {
- _mesa_error(ctx, GL_INVALID_OPERATION,
- "glDrawPixels(drawing RGB pixels into color index buffer)");
- return GL_TRUE;
- }
- }
- else {
+ if (!drawing) {
/* reading */
if (!_mesa_source_buffer_exists(ctx, GL_COLOR)) {
_mesa_error(ctx, GL_INVALID_OPERATION,
@@ -95,10 +88,9 @@ _mesa_error_check_format_type(GLcontext *ctx, GLenum format, GLenum type,
break;
case GL_COLOR_INDEX:
if (drawing) {
- if (ctx->DrawBuffer->Visual.rgbMode &&
- (ctx->PixelMaps.ItoR.Size == 0 ||
- ctx->PixelMaps.ItoG.Size == 0 ||
- ctx->PixelMaps.ItoB.Size == 0)) {
+ if (ctx->PixelMaps.ItoR.Size == 0 ||
+ ctx->PixelMaps.ItoG.Size == 0 ||
+ ctx->PixelMaps.ItoB.Size == 0) {
_mesa_error(ctx, GL_INVALID_OPERATION,
"glDrawPixels(drawing color index pixels into RGB buffer)");
return GL_TRUE;
diff --git a/src/mesa/main/renderbuffer.c b/src/mesa/main/renderbuffer.c
index 2f429240465..7557b791e5c 100644
--- a/src/mesa/main/renderbuffer.c
+++ b/src/mesa/main/renderbuffer.c
@@ -1907,21 +1907,13 @@ _mesa_add_soft_renderbuffers(struct gl_framebuffer *fb,
GLboolean backRight = fb->Visual.stereoMode && fb->Visual.doubleBufferMode;
if (color) {
- if (fb->Visual.rgbMode) {
- assert(fb->Visual.redBits == fb->Visual.greenBits);
- assert(fb->Visual.redBits == fb->Visual.blueBits);
- _mesa_add_color_renderbuffers(NULL, fb,
- fb->Visual.redBits,
- fb->Visual.alphaBits,
- frontLeft, backLeft,
- frontRight, backRight);
- }
- else {
- _mesa_add_color_index_renderbuffers(NULL, fb,
- fb->Visual.indexBits,
- frontLeft, backLeft,
- frontRight, backRight);
- }
+ assert(fb->Visual.redBits == fb->Visual.greenBits);
+ assert(fb->Visual.redBits == fb->Visual.blueBits);
+ _mesa_add_color_renderbuffers(NULL, fb,
+ fb->Visual.redBits,
+ fb->Visual.alphaBits,
+ frontLeft, backLeft,
+ frontRight, backRight);
}
if (depth) {
@@ -1935,7 +1927,6 @@ _mesa_add_soft_renderbuffers(struct gl_framebuffer *fb,
}
if (accum) {
- assert(fb->Visual.rgbMode);
assert(fb->Visual.accumRedBits > 0);
assert(fb->Visual.accumGreenBits > 0);
assert(fb->Visual.accumBlueBits > 0);
@@ -1947,14 +1938,12 @@ _mesa_add_soft_renderbuffers(struct gl_framebuffer *fb,
}
if (aux) {
- assert(fb->Visual.rgbMode);
assert(fb->Visual.numAuxBuffers > 0);
_mesa_add_aux_renderbuffers(NULL, fb, fb->Visual.redBits,
fb->Visual.numAuxBuffers);
}
if (alpha) {
- assert(fb->Visual.rgbMode);
assert(fb->Visual.alphaBits > 0);
_mesa_add_alpha_renderbuffers(NULL, fb, fb->Visual.alphaBits,
frontLeft, backLeft,