i965: directly write wm state to batch
[mesa.git] / src / mesa / swrast / s_alpha.c
index 8776e6128d5c3e155e87ef5212061145a2e4f0af..df2181ba968f2233bf109f4fb1aef54f7b0b6d39 100644 (file)
  * \brief Functions to apply alpha test.
  */
 
-#include "glheader.h"
-#include "context.h"
-#include "colormac.h"
-#include "macros.h"
+#include "main/glheader.h"
+#include "main/context.h"
+#include "main/colormac.h"
+#include "main/macros.h"
 
 #include "s_alpha.h"
 #include "s_context.h"
@@ -90,7 +90,7 @@ do {                                          \
  *          1 if one or more pixels passed the alpha test.
  */
 GLint
-_swrast_alpha_test(const GLcontext *ctx, struct sw_span *span)
+_swrast_alpha_test(const struct gl_context *ctx, SWspan *span)
 {
    const GLuint n = span->end;
    GLubyte *mask = span->array->mask;
@@ -111,19 +111,19 @@ _swrast_alpha_test(const GLcontext *ctx, struct sw_span *span)
    if (span->arrayMask & SPAN_RGBA) {
       /* Use array's alpha values */
       if (span->array->ChanType == GL_UNSIGNED_BYTE) {
-         GLubyte (*rgba)[4] = span->array->color.sz1.rgba;
+         GLubyte (*rgba)[4] = span->array->rgba8;
          GLubyte ref;
          CLAMPED_FLOAT_TO_UBYTE(ref, ctx->Color.AlphaRef);
          ALPHA_TEST(rgba[i][ACOMP], ;);
       }
       else if (span->array->ChanType == GL_UNSIGNED_SHORT) {
-         GLushort (*rgba)[4] = span->array->color.sz2.rgba;
+         GLushort (*rgba)[4] = span->array->rgba16;
          GLushort ref;
          CLAMPED_FLOAT_TO_USHORT(ref, ctx->Color.AlphaRef);
          ALPHA_TEST(rgba[i][ACOMP], ;);
       }
       else {
-         GLfloat (*rgba)[4] = span->array->color.sz4.rgba;
+         GLfloat (*rgba)[4] = span->array->attribs[FRAG_ATTRIB_COL0];
          const GLfloat ref = ctx->Color.AlphaRef;
          ALPHA_TEST(rgba[i][ACOMP], ;);
       }
@@ -136,18 +136,18 @@ _swrast_alpha_test(const GLcontext *ctx, struct sw_span *span)
          GLfixed alpha = span->alpha;
          GLubyte ref;
          CLAMPED_FLOAT_TO_UBYTE(ref, ctx->Color.AlphaRef);
-         ALPHA_TEST(alpha, alpha += alphaStep);
+         ALPHA_TEST(FixedToInt(alpha), alpha += alphaStep);
       }
       else if (span->array->ChanType == GL_UNSIGNED_SHORT) {
          const GLfixed alphaStep = span->alphaStep;
          GLfixed alpha = span->alpha;
          GLushort ref;
          CLAMPED_FLOAT_TO_USHORT(ref, ctx->Color.AlphaRef);
-         ALPHA_TEST(alpha, alpha += alphaStep);
+         ALPHA_TEST(FixedToInt(alpha), alpha += alphaStep);
       }
       else {
-         const GLfloat alphaStep = span->alphaStep;
-         GLfloat alpha = span->alpha;
+         const GLfloat alphaStep = FixedToFloat(span->alphaStep);
+         GLfloat alpha = FixedToFloat(span->alpha);
          const GLfloat ref = ctx->Color.AlphaRef;
          ALPHA_TEST(alpha, alpha += alphaStep);
       }