diff options
Diffstat (limited to 'src/mesa/math')
-rw-r--r-- | src/mesa/math/m_clip_tmp.h | 60 | ||||
-rw-r--r-- | src/mesa/math/m_xform.c | 3 | ||||
-rw-r--r-- | src/mesa/math/m_xform.h | 3 |
3 files changed, 63 insertions, 3 deletions
diff --git a/src/mesa/math/m_clip_tmp.h b/src/mesa/math/m_clip_tmp.h index d977698da57..87571541989 100644 --- a/src/mesa/math/m_clip_tmp.h +++ b/src/mesa/math/m_clip_tmp.h @@ -1,4 +1,4 @@ -/* $Id: m_clip_tmp.h,v 1.2 2000/12/26 05:09:31 keithw Exp $ */ +/* $Id: m_clip_tmp.h,v 1.3 2001/01/13 05:48:25 keithw Exp $ */ /* * Mesa 3-D graphics library @@ -100,6 +100,59 @@ static GLvector4f * _XFORMAPI TAG(cliptest_points4)( GLvector4f *clip_vec, return proj_vec; } + + +static GLvector4f * _XFORMAPI TAG(cliptest_np_points4)( GLvector4f *clip_vec, + GLvector4f *proj_vec, + GLubyte clipMask[], + GLubyte *orMask, + GLubyte *andMask ) +{ + const GLuint stride = clip_vec->stride; + const GLfloat *from = (GLfloat *)clip_vec->start; + const GLuint count = clip_vec->count; + GLuint c = 0; + GLubyte tmpAndMask = *andMask; + GLubyte tmpOrMask = *orMask; + GLuint i; + STRIDE_LOOP { + const GLfloat cx = from[0]; + const GLfloat cy = from[1]; + const GLfloat cz = from[2]; + const GLfloat cw = from[3]; +#if defined(macintosh) + /* on powerpc cliptest is 17% faster in this way. */ + GLuint mask; + mask = (((cw < cx) << CLIP_RIGHT_SHIFT)); + mask |= (((cw < -cx) << CLIP_LEFT_SHIFT)); + mask |= (((cw < cy) << CLIP_TOP_SHIFT)); + mask |= (((cw < -cy) << CLIP_BOTTOM_SHIFT)); + mask |= (((cw < cz) << CLIP_FAR_SHIFT)); + mask |= (((cw < -cz) << CLIP_NEAR_SHIFT)); +#else /* !defined(macintosh)) */ + GLubyte mask = 0; + if (-cx + cw < 0) mask |= CLIP_RIGHT_BIT; + if ( cx + cw < 0) mask |= CLIP_LEFT_BIT; + if (-cy + cw < 0) mask |= CLIP_TOP_BIT; + if ( cy + cw < 0) mask |= CLIP_BOTTOM_BIT; + if (-cz + cw < 0) mask |= CLIP_FAR_BIT; + if ( cz + cw < 0) mask |= CLIP_NEAR_BIT; +#endif /* defined(macintosh) */ + + clipMask[i] = mask; + if (mask) { + c++; + tmpAndMask &= mask; + tmpOrMask |= mask; + } + } + + *orMask = tmpOrMask; + *andMask = (GLubyte) (c < count ? 0 : tmpAndMask); + return clip_vec; +} + + static GLvector4f * _XFORMAPI TAG(cliptest_points3)( GLvector4f *clip_vec, GLvector4f *proj_vec, GLubyte clipMask[], @@ -132,6 +185,7 @@ static GLvector4f * _XFORMAPI TAG(cliptest_points3)( GLvector4f *clip_vec, return clip_vec; } + static GLvector4f * _XFORMAPI TAG(cliptest_points2)( GLvector4f *clip_vec, GLvector4f *proj_vec, GLubyte clipMask[], @@ -168,4 +222,8 @@ static void TAG(init_c_cliptest)( void ) gl_clip_tab[4] = TAG(cliptest_points4); gl_clip_tab[3] = TAG(cliptest_points3); gl_clip_tab[2] = TAG(cliptest_points2); + + gl_clip_np_tab[4] = TAG(cliptest_np_points4); + gl_clip_np_tab[3] = TAG(cliptest_points3); + gl_clip_np_tab[2] = TAG(cliptest_points2); } diff --git a/src/mesa/math/m_xform.c b/src/mesa/math/m_xform.c index 77acce922e4..a51037741fb 100644 --- a/src/mesa/math/m_xform.c +++ b/src/mesa/math/m_xform.c @@ -1,4 +1,4 @@ -/* $Id: m_xform.c,v 1.6 2001/01/08 04:09:41 keithw Exp $ */ +/* $Id: m_xform.c,v 1.7 2001/01/13 05:48:25 keithw Exp $ */ /* * Mesa 3-D graphics library @@ -57,6 +57,7 @@ #endif clip_func gl_clip_tab[5]; +clip_func gl_clip_np_tab[5]; dotprod_func gl_dotprod_tab[2][5]; vec_copy_func gl_copy_tab[2][0x10]; normal_func gl_normal_tab[0xf][0x4]; diff --git a/src/mesa/math/m_xform.h b/src/mesa/math/m_xform.h index 4024949257f..f6b10d6ad36 100644 --- a/src/mesa/math/m_xform.h +++ b/src/mesa/math/m_xform.h @@ -1,4 +1,4 @@ -/* $Id: m_xform.h,v 1.4 2001/01/05 05:31:42 keithw Exp $ */ +/* $Id: m_xform.h,v 1.5 2001/01/13 05:48:25 keithw Exp $ */ /* * Mesa 3-D graphics library @@ -201,6 +201,7 @@ extern dotprod_func gl_dotprod_tab[2][5]; extern vec_copy_func gl_copy_tab[2][0x10]; extern vec_copy_func gl_copy_clean_tab[2][5]; extern clip_func gl_clip_tab[5]; +extern clip_func gl_clip_np_tab[5]; extern normal_func gl_normal_tab[0xf][0x4]; /* Use of 3 layers of linked 1-dimensional arrays to reduce |