Merge commit 'origin/gallium-0.1' into gallium-0.2
[mesa.git] / src / mesa / swrast / s_triangle.c
index 938cdefa561450b83034d499b3e82821bdc4e0ae..2033ab55291ff8b9781fb950dbbaee0f65b3d25d 100644 (file)
  * functions to draw triangles.
  */
 
-#include "glheader.h"
-#include "context.h"
-#include "colormac.h"
-#include "imports.h"
-#include "macros.h"
-#include "texformat.h"
+#include "main/glheader.h"
+#include "main/context.h"
+#include "main/colormac.h"
+#include "main/imports.h"
+#include "main/macros.h"
+#include "main/texformat.h"
 
 #include "s_aatriangle.h"
 #include "s_context.h"
@@ -130,7 +130,7 @@ _swrast_culltriangle( GLcontext *ctx,
 #define T_SCALE theight
 
 #define SETUP_CODE                                                     \
-   struct gl_renderbuffer *rb = ctx->DrawBuffer->_ColorDrawBuffers[0][0];\
+   struct gl_renderbuffer *rb = ctx->DrawBuffer->_ColorDrawBuffers[0]\
    struct gl_texture_object *obj = ctx->Texture.Unit[0].Current2D;     \
    const GLint b = obj->BaseLevel;                                     \
    const GLfloat twidth = (GLfloat) obj->Image[0][b]->Width;           \
@@ -139,8 +139,7 @@ _swrast_culltriangle( GLcontext *ctx,
    const GLchan *texture = (const GLchan *) obj->Image[0][b]->Data;    \
    const GLint smask = obj->Image[0][b]->Width - 1;                    \
    const GLint tmask = obj->Image[0][b]->Height - 1;                   \
-   if (!texture) {                                                     \
-      /* this shouldn't happen */                                      \
+   if (!rb || !texture) {                                              \
       return;                                                          \
    }
 
@@ -182,7 +181,7 @@ _swrast_culltriangle( GLcontext *ctx,
 #define T_SCALE theight
 
 #define SETUP_CODE                                                     \
-   struct gl_renderbuffer *rb = ctx->DrawBuffer->_ColorDrawBuffers[0][0];\
+   struct gl_renderbuffer *rb = ctx->DrawBuffer->_ColorDrawBuffers[0]\
    struct gl_texture_object *obj = ctx->Texture.Unit[0].Current2D;     \
    const GLint b = obj->BaseLevel;                                     \
    const GLfloat twidth = (GLfloat) obj->Image[0][b]->Width;           \
@@ -191,8 +190,7 @@ _swrast_culltriangle( GLcontext *ctx,
    const GLchan *texture = (const GLchan *) obj->Image[0][b]->Data;    \
    const GLint smask = obj->Image[0][b]->Width - 1;                    \
    const GLint tmask = obj->Image[0][b]->Height - 1;                   \
-   if (!texture) {                                                     \
-      /* this shouldn't happen */                                      \
+   if (!rb || !texture) {                                              \
       return;                                                          \
    }