glsl: Handle continuation characters in preprocessor.
[mesa.git] / src / mesa / swrast / s_accum.c
index 69e9404c55cc217b9cc44b2c4e3e895596daaabd..c6c7dbf5cf0e32082f3c8739c0488b43f45d5cd2 100644 (file)
  */
 
 
-#include "glheader.h"
-#include "context.h"
-#include "macros.h"
-#include "imports.h"
-#include "fbobject.h"
+#include "main/glheader.h"
+#include "main/context.h"
+#include "main/macros.h"
+#include "main/imports.h"
+#include "main/fbobject.h"
 
 #include "s_accum.h"
 #include "s_context.h"
@@ -136,7 +136,9 @@ _swrast_clear_accum_buffer( GLcontext *ctx, struct gl_renderbuffer *rb )
       return;
    }
 
-   assert(rb);
+   if (!rb || !rb->Data)
+      return;
+
    assert(rb->_BaseFormat == GL_RGBA);
    /* add other types in future? */
    assert(rb->DataType == GL_SHORT || rb->DataType == GL_UNSIGNED_SHORT);
@@ -472,7 +474,9 @@ accum_return(GLcontext *ctx, GLfloat value,
          SWspan span;
 
          /* init color span */
-         INIT_SPAN(span, GL_BITMAP, width, 0, SPAN_RGBA);
+         INIT_SPAN(span, GL_BITMAP);
+         span.end = width;
+         span.arrayMask = SPAN_RGBA;
          span.x = xpos;
          span.y = ypos + i;
 
@@ -521,8 +525,8 @@ accum_return(GLcontext *ctx, GLfloat value,
          }
 
          /* store colors */
-         for (buffer = 0; buffer < fb->_NumColorDrawBuffers[0]; buffer++) {
-            struct gl_renderbuffer *rb = fb->_ColorDrawBuffers[0][buffer];
+         for (buffer = 0; buffer < fb->_NumColorDrawBuffers; buffer++) {
+            struct gl_renderbuffer *rb = fb->_ColorDrawBuffers[buffer];
             if (masking) {
                _swrast_mask_rgba_span(ctx, rb, &span);
             }
@@ -546,7 +550,7 @@ _swrast_Accum(GLcontext *ctx, GLenum op, GLfloat value)
    SWcontext *swrast = SWRAST_CONTEXT(ctx);
    GLint xpos, ypos, width, height;
 
-   if (SWRAST_CONTEXT(ctx)->NewState)
+   if (swrast->NewState)
       _swrast_validate_derived( ctx );
 
    if (!ctx->DrawBuffer->Attachment[BUFFER_ACCUM].Renderbuffer) {
@@ -554,9 +558,9 @@ _swrast_Accum(GLcontext *ctx, GLenum op, GLfloat value)
       return;
    }
 
-   RENDER_START(swrast, ctx);
+   swrast_render_start(ctx);
 
-   /* Compute region after calling RENDER_START so that we know the
+   /* Compute region after calling swrast_render_start() so that we know the
     * drawbuffer's size/bounds are up to date.
     */
    xpos = ctx->DrawBuffer->_Xmin;
@@ -591,5 +595,5 @@ _swrast_Accum(GLcontext *ctx, GLenum op, GLfloat value)
          break;
    }
 
-   RENDER_FINISH(swrast, ctx);
+   swrast_render_finish(ctx);
 }