i965/vs: Fix support for "IF" instructions by copying brw_fs_visitor.cpp.
[mesa.git] / src / mesa / swrast / s_clear.c
index efe500ae2b151acc0d2d865b21adf45b3f3f533c..9e9b5311684cd51d680c50a51d19d61cd9f03f2b 100644 (file)
@@ -40,7 +40,7 @@
  * Clear the color buffer when glColorMask is in effect.
  */
 static void
-clear_rgba_buffer_with_masking(GLcontext *ctx, struct gl_renderbuffer *rb,
+clear_rgba_buffer_with_masking(struct gl_context *ctx, struct gl_renderbuffer *rb,
                                GLuint buf)
 {
    const GLint x = ctx->DrawBuffer->_Xmin;
@@ -106,7 +106,7 @@ clear_rgba_buffer_with_masking(GLcontext *ctx, struct gl_renderbuffer *rb,
  * Clear an rgba color buffer without channel masking.
  */
 static void
-clear_rgba_buffer(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint buf)
+clear_rgba_buffer(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint buf)
 {
    const GLint x = ctx->DrawBuffer->_Xmin;
    const GLint y = ctx->DrawBuffer->_Ymin;
@@ -159,12 +159,20 @@ clear_rgba_buffer(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint buf)
  * clear its own color buffers for some reason (such as with masking).
  */
 static void
-clear_color_buffers(GLcontext *ctx)
+clear_color_buffers(struct gl_context *ctx)
 {
    GLuint buf;
 
    for (buf = 0; buf < ctx->DrawBuffer->_NumColorDrawBuffers; buf++) {
       struct gl_renderbuffer *rb = ctx->DrawBuffer->_ColorDrawBuffers[buf];
+
+      /* If this is an ES2 context or GL_ARB_ES2_compatibility is supported,
+       * the framebuffer can be complete with some attachments be missing.  In
+       * this case the _ColorDrawBuffers pointer will be NULL.
+       */
+      if (rb == NULL)
+        continue;
+
       if (ctx->Color.ColorMask[buf][0] == 0 ||
           ctx->Color.ColorMask[buf][1] == 0 ||
           ctx->Color.ColorMask[buf][2] == 0 ||
@@ -186,7 +194,7 @@ clear_color_buffers(GLcontext *ctx)
  * \param all  if GL_TRUE, clear whole buffer, else clear specified region.
  */
 void
-_swrast_Clear(GLcontext *ctx, GLbitfield buffers)
+_swrast_Clear(struct gl_context *ctx, GLbitfield buffers)
 {
 #ifdef DEBUG_FOO
    {