i965: switch gen6 to use its own cc state bo
[mesa.git] / src / mesa / main / clear.c
index e76ab5527b0b938529a811189848ad1238b0137a..43a9ccc116a1777dc45502130109486e349e73f9 100644 (file)
@@ -35,6 +35,8 @@
 #include "context.h"
 #include "colormac.h"
 #include "enums.h"
+#include "macros.h"
+#include "mtypes.h"
 #include "state.h"
 
 
@@ -94,12 +96,74 @@ _mesa_ClearColor( GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha )
 }
 
 
+/**
+ * GL_EXT_texture_integer
+ */
+void GLAPIENTRY
+_mesa_ClearColorIiEXT(GLint r, GLint g, GLint b, GLint a)
+{
+   GLfloat tmp[4];
+   GET_CURRENT_CONTEXT(ctx);
+   ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+   tmp[0] = (GLfloat) r;
+   tmp[1] = (GLfloat) g;
+   tmp[2] = (GLfloat) b;
+   tmp[3] = (GLfloat) a;
+
+   if (TEST_EQ_4V(tmp, ctx->Color.ClearColor))
+      return; /* no change */
+
+   FLUSH_VERTICES(ctx, _NEW_COLOR);
+
+   /* XXX we should eventually have a float/int/uint union for
+    * the ctx->Color.ClearColor state.
+    */
+   COPY_4V(ctx->Color.ClearColor, tmp);
+
+   if (ctx->Driver.ClearColor) {
+      ctx->Driver.ClearColor(ctx, ctx->Color.ClearColor);
+   }
+}
+
+
+/**
+ * GL_EXT_texture_integer
+ */
+void GLAPIENTRY
+_mesa_ClearColorIuiEXT(GLuint r, GLuint g, GLuint b, GLuint a)
+{
+   GLfloat tmp[4];
+   GET_CURRENT_CONTEXT(ctx);
+   ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+   tmp[0] = (GLfloat) r;
+   tmp[1] = (GLfloat) g;
+   tmp[2] = (GLfloat) b;
+   tmp[3] = (GLfloat) a;
+
+   if (TEST_EQ_4V(tmp, ctx->Color.ClearColor))
+      return; /* no change */
+
+   FLUSH_VERTICES(ctx, _NEW_COLOR);
+
+   /* XXX we should eventually have a float/int/uint union for
+    * the ctx->Color.ClearColor state.
+    */
+   COPY_4V(ctx->Color.ClearColor, tmp);
+
+   if (ctx->Driver.ClearColor) {
+      ctx->Driver.ClearColor(ctx, ctx->Color.ClearColor);
+   }
+}
+
+
 /**
  * Clear buffers.
  * 
  * \param mask bit-mask indicating the buffers to be cleared.
  *
- * Flushes the vertices and verifies the parameter. If __GLcontextRec::NewState
+ * Flushes the vertices and verifies the parameter. If __struct gl_contextRec::NewState
  * is set then calls _mesa_update_state() to update gl_frame_buffer::_Xmin,
  * etc. If the rasterization mode is set to GL_RENDER then requests the driver
  * to clear the buffers, via the dd_function_table::Clear callback.
@@ -190,7 +254,7 @@ _mesa_Clear( GLbitfield mask )
  * Return INVALID_MASK if the drawbuffer value is invalid.
  */
 static GLbitfield
-make_color_buffer_mask(GLcontext *ctx, GLint drawbuffer)
+make_color_buffer_mask(struct gl_context *ctx, GLint drawbuffer)
 {
    const struct gl_renderbuffer_attachment *att = ctx->DrawBuffer->Attachment;
    GLbitfield mask = 0x0;
@@ -341,7 +405,7 @@ _mesa_ClearBufferuiv(GLenum buffer, GLint drawbuffer, const GLuint *value)
       {
          const GLbitfield mask = make_color_buffer_mask(ctx, drawbuffer);
          if (mask == INVALID_MASK) {
-            _mesa_error(ctx, GL_INVALID_VALUE, "glClearBufferiv(drawbuffer=%d)",
+            _mesa_error(ctx, GL_INVALID_VALUE, "glClearBufferuiv(drawbuffer=%d)",
                         drawbuffer);
             return;
          }