mesa: remove MESA_FUNCTION
[mesa.git] / src / mesa / main / rastpos.c
index b468219e688ddd25661fa6b5a1bb6608ba33e227..43f67596d1fe1cdc169a0b08229e0dc2667357c1 100644 (file)
@@ -37,7 +37,7 @@
 #include "state.h"
 #include "main/dispatch.h"
 #include "main/viewport.h"
-#include "util/simple_list.h"
+#include "util/bitscan.h"
 
 
 
@@ -91,17 +91,16 @@ viewclip_point_z( const GLfloat v[] )
 static GLuint
 userclip_point( struct gl_context *ctx, const GLfloat v[] )
 {
-   GLuint p;
+   GLbitfield mask = ctx->Transform.ClipPlanesEnabled;
+   while (mask) {
+      const int p = u_bit_scan(&mask);
+      GLfloat dot = v[0] * ctx->Transform._ClipUserPlane[p][0]
+         + v[1] * ctx->Transform._ClipUserPlane[p][1]
+         + v[2] * ctx->Transform._ClipUserPlane[p][2]
+         + v[3] * ctx->Transform._ClipUserPlane[p][3];
 
-   for (p = 0; p < ctx->Const.MaxClipPlanes; p++) {
-      if (ctx->Transform.ClipPlanesEnabled & (1 << p)) {
-        GLfloat dot = v[0] * ctx->Transform._ClipUserPlane[p][0]
-                    + v[1] * ctx->Transform._ClipUserPlane[p][1]
-                    + v[2] * ctx->Transform._ClipUserPlane[p][2]
-                    + v[3] * ctx->Transform._ClipUserPlane[p][3];
-         if (dot < 0.0F) {
-            return 0;
-         }
+      if (dot < 0.0F) {
+         return 0;
       }
    }
 
@@ -125,7 +124,7 @@ shade_rastpos(struct gl_context *ctx,
               GLfloat Rspec[4])
 {
    /*const*/ GLfloat (*base)[3] = ctx->Light._BaseColor;
-   const struct gl_light *light;
+   GLbitfield mask;
    GLfloat diffuseColor[4], specularColor[4];  /* for RGB mode only */
 
    COPY_3V(diffuseColor, base[0]);
@@ -133,7 +132,10 @@ shade_rastpos(struct gl_context *ctx,
       ctx->Light.Material.Attrib[MAT_ATTRIB_FRONT_DIFFUSE][3], 0.0F, 1.0F );
    ASSIGN_4V(specularColor, 0.0, 0.0, 0.0, 1.0);
 
-   foreach (light, &ctx->Light.EnabledList) {
+   mask = ctx->Light._EnabledLights;
+   while (mask) {
+      const int i = u_bit_scan(&mask);
+      struct gl_light *light = &ctx->Light.Light[i];
       GLfloat attenuation = 1.0;
       GLfloat VP[3]; /* vector from vertex to light pos */
       GLfloat n_dot_VP;
@@ -370,7 +372,7 @@ compute_texgen(struct gl_context *ctx, const GLfloat vObj[4], const GLfloat vEye
 void
 _mesa_RasterPos(struct gl_context *ctx, const GLfloat vObj[4])
 {
-   if (ctx->VertexProgram._Enabled) {
+   if (_mesa_arb_vertex_program_enabled(ctx)) {
       /* XXX implement this */
       _mesa_problem(ctx, "Vertex programs not implemented for glRasterPos");
       return;