X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fmesa%2Ftnl%2Ft_vb_vertex.c;h=71a32b49528ec3a1a176181c2975d3a66c5c18ee;hb=76e2f390f9863a356d1419982dec705260d67eff;hp=ea3a56cd18514d89e61fccfdb0ee08df3a612595;hpb=877128505431adaf817dc8069172ebe4a1cdf5d8;p=mesa.git diff --git a/src/mesa/tnl/t_vb_vertex.c b/src/mesa/tnl/t_vb_vertex.c index ea3a56cd185..71a32b49528 100644 --- a/src/mesa/tnl/t_vb_vertex.c +++ b/src/mesa/tnl/t_vb_vertex.c @@ -27,13 +27,14 @@ #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; \ + } \ } \ + } \ }