i965/miptree: Use num_samples of 1 instead of 0 for single-sampled
[mesa.git] / src / mesa / tnl / t_vb_vertex.c
index 7c57f17cc1b0c8306283bf4fb035a2666f817932..71a32b49528ec3a1a176181c2975d3a66c5c18ee 100644 (file)
  * OTHER DEALINGS IN THE SOFTWARE.
  *
  * Authors:
- *    Keith Whitwell <keith@tungstengraphics.com>
+ *    Keith Whitwell <keithw@vmware.com>
  */
 
 
 #include "main/glheader.h"
-#include "main/colormac.h"
 #include "main/macros.h"
 #include "main/imports.h"
 #include "main/mtypes.h"
 
 #include "math/m_xform.h"
 
+#include "util/bitscan.h"
+
 #include "t_context.h"
 #include "t_pipeline.h"
 
@@ -64,40 +65,39 @@ static void NAME( struct gl_context *ctx,                           \
                  GLubyte *clipormask,                          \
                  GLubyte *clipandmask )                        \
 {                                                              \
-   GLuint p;                                                   \
-                                                               \
-   for (p = 0; p < ctx->Const.MaxClipPlanes; p++)              \
-      if (ctx->Transform.ClipPlanesEnabled & (1 << p)) {       \
-        GLuint nr, i;                                          \
-        const GLfloat a = ctx->Transform._ClipUserPlane[p][0]; \
-        const GLfloat b = ctx->Transform._ClipUserPlane[p][1]; \
-        const GLfloat c = ctx->Transform._ClipUserPlane[p][2]; \
-        const GLfloat d = ctx->Transform._ClipUserPlane[p][3]; \
-         GLfloat *coord = (GLfloat *)clip->data;               \
-         GLuint stride = clip->stride;                         \
-         GLuint count = clip->count;                           \
+   GLbitfield mask = ctx->Transform.ClipPlanesEnabled;          \
+   while (mask) {                                               \
+      const int p = u_bit_scan(&mask);                          \
+      GLuint nr, i;                                            \
+      const GLfloat a = ctx->Transform._ClipUserPlane[p][0];   \
+      const GLfloat b = ctx->Transform._ClipUserPlane[p][1];   \
+      const GLfloat c = ctx->Transform._ClipUserPlane[p][2];   \
+      const GLfloat d = ctx->Transform._ClipUserPlane[p][3];   \
+      GLfloat *coord = (GLfloat *)clip->data;                   \
+      GLuint stride = clip->stride;                            \
+      GLuint count = clip->count;                              \
                                                                \
-        for (nr = 0, i = 0 ; i < count ; i++) {                \
-           GLfloat dp = coord[0] * a + coord[1] * b;           \
-           if (SZ > 2) dp += coord[2] * c;                     \
-           if (SZ > 3) dp += coord[3] * d; else dp += d;       \
+      for (nr = 0, i = 0 ; i < count ; i++) {                   \
+         GLfloat dp = coord[0] * a + coord[1] * b;             \
+         if (SZ > 2) dp += coord[2] * c;                       \
+         if (SZ > 3) dp += coord[3] * d; else dp += d;          \
                                                                \
-           if (dp < 0) {                                       \
-              nr++;                                            \
-              clipmask[i] |= CLIP_USER_BIT;                    \
-           }                                                   \
+         if (dp < 0) {                                          \
+            nr++;                                              \
+            clipmask[i] |= CLIP_USER_BIT;                      \
+         }                                                     \
                                                                \
-           STRIDE_F(coord, stride);                            \
-        }                                                      \
+         STRIDE_F(coord, stride);                              \
+      }                                                         \
                                                                \
-        if (nr > 0) {                                          \
-           *clipormask |= CLIP_USER_BIT;                       \
-           if (nr == count) {                                  \
-              *clipandmask |= CLIP_USER_BIT;                   \
-              return;                                          \
-           }                                                   \
-        }                                                      \
+      if (nr > 0) {                                            \
+         *clipormask |= CLIP_USER_BIT;                          \
+         if (nr == count) {                                    \
+            *clipandmask |= CLIP_USER_BIT;                     \
+            return;                                            \
+         }                                                     \
       }                                                                \
+   }                                                           \
 }