mesa: Remove checks of Visual.rgbMode
authorIan Romanick <ian.d.romanick@intel.com>
Thu, 25 Feb 2010 02:58:38 +0000 (18:58 -0800)
committerIan Romanick <ian.d.romanick@intel.com>
Wed, 3 Mar 2010 20:37:04 +0000 (12:37 -0800)
This must always be true now, so there is no reason to check it.  Ever.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
src/mesa/main/clear.c
src/mesa/main/context.c
src/mesa/main/feedback.c
src/mesa/main/framebuffer.c
src/mesa/main/light.c
src/mesa/main/rastpos.c
src/mesa/main/readpix.c
src/mesa/main/renderbuffer.c

index 8085bed..e76ab55 100644 (file)
@@ -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));
index b827d54..73126b9 100644 (file)
@@ -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)
index e20456f..323cc53 100644 (file)
@@ -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" );
index 269bc9a..6a85162 100644 (file)
@@ -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;
-         }
       }
    }
 
index 6899ed0..19dc968 100644 (file)
@@ -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);
 }
 
 
index d72b846..03ff3b6 100644 (file)
@@ -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 */
    {
index feea1d3..f4d74e8 100644 (file)
@@ -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;
index 2f42924..7557b79 100644 (file)
@@ -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,