From cab974cf6c2dbfbf5dd5d291e1aae0f8eeb34290 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Tue, 26 Dec 2000 05:09:27 +0000 Subject: Major rework of tnl module New array_cache module Support 8 texture units in core mesa (now support 8 everywhere) Rework core mesa statechange operations to avoid flushing on many noop statechanges. --- src/mesa/math/m_clip_tmp.h | 12 +- src/mesa/math/m_copy_tmp.h | 37 +--- src/mesa/math/m_dotprod_tmp.h | 42 ++-- src/mesa/math/m_eval.c | 501 ++++++++++++++++++++++++++++++++++++++++++ src/mesa/math/m_eval.h | 79 +++++++ src/mesa/math/m_translate.c | 130 ++++++++++- src/mesa/math/m_translate.h | 106 ++++----- src/mesa/math/m_vector.c | 26 +-- src/mesa/math/m_vector.h | 13 +- src/mesa/math/m_xform.c | 4 +- src/mesa/math/m_xform.h | 68 +++--- src/mesa/math/m_xform_tmp.h | 7 +- 12 files changed, 821 insertions(+), 204 deletions(-) create mode 100644 src/mesa/math/m_eval.c create mode 100644 src/mesa/math/m_eval.h (limited to 'src/mesa/math') diff --git a/src/mesa/math/m_clip_tmp.h b/src/mesa/math/m_clip_tmp.h index 321d3a9e61..d977698da5 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.1 2000/11/16 21:05:41 keithw Exp $ */ +/* $Id: m_clip_tmp.h,v 1.2 2000/12/26 05:09:31 keithw Exp $ */ /* * Mesa 3-D graphics library @@ -78,16 +78,16 @@ static GLvector4f * _XFORMAPI TAG(cliptest_points4)( GLvector4f *clip_vec, c++; tmpAndMask &= mask; tmpOrMask |= mask; - vProj[i][0] = 0; /* no longer required? */ + vProj[i][0] = 0; vProj[i][1] = 0; vProj[i][2] = 0; vProj[i][3] = 1; } else { GLfloat oow = 1.0F / cw; - vProj[i][3] = oow; vProj[i][0] = cx * oow; vProj[i][1] = cy * oow; vProj[i][2] = cz * oow; + vProj[i][3] = oow; } } @@ -95,7 +95,7 @@ static GLvector4f * _XFORMAPI TAG(cliptest_points4)( GLvector4f *clip_vec, *andMask = (GLubyte) (c < count ? 0 : tmpAndMask); proj_vec->flags |= VEC_SIZE_4; - proj_vec->size = 3; + proj_vec->size = 4; proj_vec->count = clip_vec->count; return proj_vec; } @@ -127,8 +127,6 @@ static GLvector4f * _XFORMAPI TAG(cliptest_points3)( GLvector4f *clip_vec, tmpAndMask &= mask; } - gl_vector4f_clean_elem(proj_vec, count, 3); - *orMask = tmpOrMask; *andMask = tmpAndMask; return clip_vec; @@ -159,8 +157,6 @@ static GLvector4f * _XFORMAPI TAG(cliptest_points2)( GLvector4f *clip_vec, tmpAndMask &= mask; } - gl_vector4f_clean_elem(proj_vec, count, 3); - *orMask = tmpOrMask; *andMask = tmpAndMask; return clip_vec; diff --git a/src/mesa/math/m_copy_tmp.h b/src/mesa/math/m_copy_tmp.h index b328537faf..3119b95589 100644 --- a/src/mesa/math/m_copy_tmp.h +++ b/src/mesa/math/m_copy_tmp.h @@ -1,4 +1,4 @@ -/* $Id: m_copy_tmp.h,v 1.1 2000/11/16 21:05:41 keithw Exp $ */ +/* $Id: m_copy_tmp.h,v 1.2 2000/12/26 05:09:31 keithw Exp $ */ /* * Mesa 3-D graphics library @@ -51,24 +51,6 @@ static void TAG2(copy, BITS)(GLvector4f *to, const GLvector4f *f, \ } \ } - - -/* static void TAG2(clean, BITS)(GLvector4f *to ) */ -/* { */ -/* GLfloat (*t)[4] = to->data; */ -/* GLuint i; */ - -/* if (BITS) */ -/* for (i = 0 ; i < VB_SIZE ; i++) { */ -/* if (BITS&1) t[i][0] = 0; */ -/* if (BITS&2) t[i][1] = 0; */ -/* if (BITS&4) t[i][2] = 0; */ -/* if (BITS&8) t[i][3] = 1; */ -/* } */ -/* to->flags &= ~BITS; */ -/* } */ - - /* We got them all here: */ COPY_FUNC( 0x0 ) /* noop */ @@ -106,21 +88,4 @@ static void TAG2(init_copy, 0 ) ( void ) gl_copy_tab[IDX][0xd] = TAG2(copy, 0xd); gl_copy_tab[IDX][0xe] = TAG2(copy, 0xe); gl_copy_tab[IDX][0xf] = TAG2(copy, 0xf); - -/* gl_clean_tab[IDX][0x0] = TAG2(clean, 0x0); */ -/* gl_clean_tab[IDX][0x1] = TAG2(clean, 0x1); */ -/* gl_clean_tab[IDX][0x2] = TAG2(clean, 0x2); */ -/* gl_clean_tab[IDX][0x3] = TAG2(clean, 0x3); */ -/* gl_clean_tab[IDX][0x4] = TAG2(clean, 0x4); */ -/* gl_clean_tab[IDX][0x5] = TAG2(clean, 0x5); */ -/* gl_clean_tab[IDX][0x6] = TAG2(clean, 0x6); */ -/* gl_clean_tab[IDX][0x7] = TAG2(clean, 0x7); */ -/* gl_clean_tab[IDX][0x8] = TAG2(clean, 0x8); */ -/* gl_clean_tab[IDX][0x9] = TAG2(clean, 0x9); */ -/* gl_clean_tab[IDX][0xa] = TAG2(clean, 0xa); */ -/* gl_clean_tab[IDX][0xb] = TAG2(clean, 0xb); */ -/* gl_clean_tab[IDX][0xc] = TAG2(clean, 0xc); */ -/* gl_clean_tab[IDX][0xd] = TAG2(clean, 0xd); */ -/* gl_clean_tab[IDX][0xe] = TAG2(clean, 0xe); */ -/* gl_clean_tab[IDX][0xf] = TAG2(clean, 0xf); */ } diff --git a/src/mesa/math/m_dotprod_tmp.h b/src/mesa/math/m_dotprod_tmp.h index 637e35fd58..4bd875c681 100644 --- a/src/mesa/math/m_dotprod_tmp.h +++ b/src/mesa/math/m_dotprod_tmp.h @@ -1,4 +1,4 @@ -/* $Id: m_dotprod_tmp.h,v 1.1 2000/11/16 21:05:41 keithw Exp $ */ +/* $Id: m_dotprod_tmp.h,v 1.2 2000/12/26 05:09:31 keithw Exp $ */ /* * Mesa 3-D graphics library @@ -31,18 +31,16 @@ /* Note - respects the stride of the output vector. */ -static void TAG(dotprod_vec2)( GLvector4f *out_vec, - GLuint elt, - const GLvector4f *coord_vec, - const GLfloat plane[4], - const GLubyte mask[]) +static void TAG(dotprod_vec2)( GLfloat *out, + GLuint outstride, + const GLvector4f *coord_vec, + const GLfloat plane[4], + const GLubyte mask[]) { GLuint stride = coord_vec->stride; GLfloat *coord = coord_vec->start; GLuint count = coord_vec->count; - GLuint outstride = out_vec->stride; - GLfloat *out = out_vec->start + elt; GLuint i; const GLfloat plane0 = plane[0], plane1 = plane[1], plane3 = plane[3]; @@ -56,21 +54,18 @@ static void TAG(dotprod_vec2)( GLvector4f *out_vec, plane3); } } - out_vec->count = coord_vec->count; } -static void TAG(dotprod_vec3)( GLvector4f *out_vec, - GLuint elt, - const GLvector4f *coord_vec, - const GLfloat plane[4], - const GLubyte mask[]) +static void TAG(dotprod_vec3)( GLfloat *out, + GLuint outstride, + const GLvector4f *coord_vec, + const GLfloat plane[4], + const GLubyte mask[]) { GLuint stride = coord_vec->stride; GLfloat *coord = coord_vec->start; GLuint count = coord_vec->count; - GLuint outstride = out_vec->stride; - GLfloat *out = out_vec->start + elt; GLuint i; const GLfloat plane0 = plane[0], plane1 = plane[1], plane2 = plane[2]; @@ -86,21 +81,17 @@ static void TAG(dotprod_vec3)( GLvector4f *out_vec, plane3); } } - out_vec->count = coord_vec->count; } -static void TAG(dotprod_vec4)( GLvector4f *out_vec, - GLuint elt, - const GLvector4f *coord_vec, - const GLfloat plane[4], - const GLubyte mask[]) +static void TAG(dotprod_vec4)( GLfloat *out, + GLuint outstride, + const GLvector4f *coord_vec, + const GLfloat plane[4], + const GLubyte mask[]) { GLuint stride = coord_vec->stride; GLfloat *coord = coord_vec->start; GLuint count = coord_vec->count; - - GLuint outstride = out_vec->stride; - GLfloat *out = out_vec->start + elt; GLuint i; const GLfloat plane0 = plane[0], plane1 = plane[1], plane2 = plane[2]; @@ -116,7 +107,6 @@ static void TAG(dotprod_vec4)( GLvector4f *out_vec, coord[3] * plane3); } } - out_vec->count = coord_vec->count; } diff --git a/src/mesa/math/m_eval.c b/src/mesa/math/m_eval.c new file mode 100644 index 0000000000..a4ae0395ca --- /dev/null +++ b/src/mesa/math/m_eval.c @@ -0,0 +1,501 @@ +/* $Id: m_eval.c,v 1.1 2000/12/26 05:09:31 keithw Exp $ */ + +/* + * Mesa 3-D graphics library + * Version: 3.5 + * + * Copyright (C) 1999-2000 Brian Paul All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN + * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + + +/* + * eval.c was written by + * Bernd Barsuhn (bdbarsuh@cip.informatik.uni-erlangen.de) and + * Volker Weiss (vrweiss@cip.informatik.uni-erlangen.de). + * + * My original implementation of evaluators was simplistic and didn't + * compute surface normal vectors properly. Bernd and Volker applied + * used more sophisticated methods to get better results. + * + * Thanks guys! + */ + + +#include "glheader.h" +#include "config.h" +#include "m_eval.h" + +static GLfloat inv_tab[MAX_EVAL_ORDER]; + + + +/* + * Horner scheme for Bezier curves + * + * Bezier curves can be computed via a Horner scheme. + * Horner is numerically less stable than the de Casteljau + * algorithm, but it is faster. For curves of degree n + * the complexity of Horner is O(n) and de Casteljau is O(n^2). + * Since stability is not important for displaying curve + * points I decided to use the Horner scheme. + * + * A cubic Bezier curve with control points b0, b1, b2, b3 can be + * written as + * + * (([3] [3] ) [3] ) [3] + * c(t) = (([0]*s*b0 + [1]*t*b1)*s + [2]*t^2*b2)*s + [3]*t^2*b3 + * + * [n] + * where s=1-t and the binomial coefficients [i]. These can + * be computed iteratively using the identity: + * + * [n] [n ] [n] + * [i] = (n-i+1)/i * [i-1] and [0] = 1 + */ + + +void +_math_horner_bezier_curve(const GLfloat *cp, GLfloat *out, GLfloat t, + GLuint dim, GLuint order) +{ + GLfloat s, powert; + GLuint i, k, bincoeff; + + if(order >= 2) + { + bincoeff = order-1; + s = 1.0-t; + + for(k=0; k constant curve */ + { + for(k=0; k uorder) + { + if(uorder >= 2) + { + GLfloat s, poweru; + GLuint j, k, bincoeff; + + /* Compute the control polygon for the surface-curve in u-direction */ + for(j=0; j cn defines a curve in v */ + _math_horner_bezier_curve(cn, out, v, dim, vorder); + } + else /* vorder <= uorder */ + { + if(vorder > 1) + { + GLuint i; + + /* Compute the control polygon for the surface-curve in u-direction */ + for(i=0; i cn defines a curve in u */ + _math_horner_bezier_curve(cn, out, u, dim, uorder); + } +} + +/* + * The direct de Casteljau algorithm is used when a point on the + * surface and the tangent directions spanning the tangent plane + * should be computed (this is needed to compute normals to the + * surface). In this case the de Casteljau algorithm approach is + * nicer because a point and the partial derivatives can be computed + * at the same time. To get the correct tangent length du and dv + * must be multiplied with the (u2-u1)/uorder-1 and (v2-v1)/vorder-1. + * Since only the directions are needed, this scaling step is omitted. + * + * De Casteljau needs additional storage for uorder*vorder + * values in the control net cn. + */ + +void +_math_de_casteljau_surf(GLfloat *cn, GLfloat *out, GLfloat *du, GLfloat *dv, + GLfloat u, GLfloat v, GLuint dim, + GLuint uorder, GLuint vorder) +{ + GLfloat *dcn = cn + uorder*vorder*dim; + GLfloat us = 1.0-u, vs = 1.0-v; + GLuint h, i, j, k; + GLuint minorder = uorder < vorder ? uorder : vorder; + GLuint uinc = vorder*dim; + GLuint dcuinc = vorder; + + /* Each component is evaluated separately to save buffer space */ + /* This does not drasticaly decrease the performance of the */ + /* algorithm. If additional storage for (uorder-1)*(vorder-1) */ + /* points would be available, the components could be accessed */ + /* in the innermost loop which could lead to less cache misses. */ + +#define CN(I,J,K) cn[(I)*uinc+(J)*dim+(K)] +#define DCN(I, J) dcn[(I)*dcuinc+(J)] + if(minorder < 3) + { + if(uorder==vorder) + { + for(k=0; kfloat or ubyte->ubyte, which are never used. - */ -extern trans_1f_func gl_trans_1f_tab[MAX_TYPES]; -extern trans_1ui_func gl_trans_1ui_tab[MAX_TYPES]; -extern trans_1ub_func gl_trans_1ub_tab[MAX_TYPES]; -extern trans_3f_func gl_trans_3f_tab[MAX_TYPES]; -extern trans_4ub_func gl_trans_4ub_tab[5][MAX_TYPES]; -extern trans_4f_func gl_trans_4f_tab[5][MAX_TYPES]; - - - -extern void -_math_init_translate( void ); +extern void _math_trans_1f(GLfloat *to, + CONST void *ptr, + GLuint stride, + GLenum type, + GLuint start, + GLuint n ); + +extern void _math_trans_1ui(GLuint *to, + CONST void *ptr, + GLuint stride, + GLenum type, + GLuint start, + GLuint n ); + +extern void _math_trans_1ub(GLubyte *to, + CONST void *ptr, + GLuint stride, + GLenum type, + GLuint start, + GLuint n ); + +extern void _math_trans_4ub(GLubyte (*to)[4], + CONST void *ptr, + GLuint stride, + GLenum type, + GLuint size, + GLuint start, + GLuint n ); + +extern void _math_trans_4f(GLfloat (*to)[4], + CONST void *ptr, + GLuint stride, + GLenum type, + GLuint size, + GLuint start, + GLuint n ); + +extern void _math_trans_3f(GLfloat (*to)[3], + CONST void *ptr, + GLuint stride, + GLenum type, + GLuint start, + GLuint n ); + +extern void _math_init_translate( void ); #endif diff --git a/src/mesa/math/m_vector.c b/src/mesa/math/m_vector.c index 4dbf68f8e0..e582ccce37 100644 --- a/src/mesa/math/m_vector.c +++ b/src/mesa/math/m_vector.c @@ -1,4 +1,4 @@ -/* $Id: m_vector.c,v 1.1 2000/11/16 21:05:41 keithw Exp $ */ +/* $Id: m_vector.c,v 1.2 2000/12/26 05:09:31 keithw Exp $ */ /* * Mesa 3-D graphics library @@ -85,7 +85,7 @@ void gl_vector4f_init( GLvector4f *v, GLuint flags, GLfloat (*storage)[4] ) v->data = storage; v->start = (GLfloat *) storage; v->count = 0; - v->flags = size_bits[4] | flags | VEC_GOOD_STRIDE; + v->flags = size_bits[4] | flags ; } void gl_vector3f_init( GLvector3f *v, GLuint flags, GLfloat (*storage)[3] ) @@ -94,7 +94,7 @@ void gl_vector3f_init( GLvector3f *v, GLuint flags, GLfloat (*storage)[3] ) v->data = storage; v->start = (GLfloat *) storage; v->count = 0; - v->flags = flags | VEC_GOOD_STRIDE; + v->flags = flags ; } void gl_vector1f_init( GLvector1f *v, GLuint flags, GLfloat *storage ) @@ -103,7 +103,7 @@ void gl_vector1f_init( GLvector1f *v, GLuint flags, GLfloat *storage ) v->data = storage; v->start = (GLfloat *)storage; v->count = 0; - v->flags = flags | VEC_GOOD_STRIDE; + v->flags = flags ; } void gl_vector4ub_init( GLvector4ub *v, GLuint flags, GLubyte (*storage)[4] ) @@ -112,7 +112,7 @@ void gl_vector4ub_init( GLvector4ub *v, GLuint flags, GLubyte (*storage)[4] ) v->data = storage; v->start = (GLubyte *) storage; v->count = 0; - v->flags = flags | VEC_GOOD_STRIDE; + v->flags = flags ; } void gl_vector1ub_init( GLvector1ub *v, GLuint flags, GLubyte *storage ) @@ -121,7 +121,7 @@ void gl_vector1ub_init( GLvector1ub *v, GLuint flags, GLubyte *storage ) v->data = storage; v->start = (GLubyte *) storage; v->count = 0; - v->flags = flags | VEC_GOOD_STRIDE; + v->flags = flags ; } void gl_vector1ui_init( GLvector1ui *v, GLuint flags, GLuint *storage ) @@ -130,7 +130,7 @@ void gl_vector1ui_init( GLvector1ui *v, GLuint flags, GLuint *storage ) v->data = storage; v->start = (GLuint *) storage; v->count = 0; - v->flags = flags | VEC_GOOD_STRIDE; + v->flags = flags ; } @@ -153,7 +153,7 @@ void gl_vector4f_alloc( GLvector4f *v, GLuint flags, GLuint count, v->start = (GLfloat *) v->storage; v->data = (GLfloat (*)[4]) v->storage; v->count = 0; - v->flags = size_bits[4] | flags | VEC_MALLOC | VEC_GOOD_STRIDE; + v->flags = size_bits[4] | flags | VEC_MALLOC ; } void gl_vector3f_alloc( GLvector3f *v, GLuint flags, GLuint count, @@ -164,7 +164,7 @@ void gl_vector3f_alloc( GLvector3f *v, GLuint flags, GLuint count, v->start = (GLfloat *) v->storage; v->data = (GLfloat (*)[3]) v->storage; v->count = 0; - v->flags = flags | VEC_MALLOC | VEC_GOOD_STRIDE; + v->flags = flags | VEC_MALLOC ; } void gl_vector1f_alloc( GLvector1f *v, GLuint flags, GLuint count, @@ -175,7 +175,7 @@ void gl_vector1f_alloc( GLvector1f *v, GLuint flags, GLuint count, ALIGN_MALLOC( count * sizeof(GLfloat), alignment ); v->data = v->start; v->count = 0; - v->flags = flags | VEC_MALLOC | VEC_GOOD_STRIDE; + v->flags = flags | VEC_MALLOC ; } void gl_vector4ub_alloc( GLvector4ub *v, GLuint flags, GLuint count, @@ -186,7 +186,7 @@ void gl_vector4ub_alloc( GLvector4ub *v, GLuint flags, GLuint count, v->start = (GLubyte *) v->storage; v->data = (GLubyte (*)[4]) v->storage; v->count = 0; - v->flags = flags | VEC_MALLOC | VEC_GOOD_STRIDE; + v->flags = flags | VEC_MALLOC ; } void gl_vector1ub_alloc( GLvector1ub *v, GLuint flags, GLuint count, @@ -197,7 +197,7 @@ void gl_vector1ub_alloc( GLvector1ub *v, GLuint flags, GLuint count, v->start = (GLubyte *) v->storage; v->data = (GLubyte *) v->storage; v->count = 0; - v->flags = flags | VEC_MALLOC | VEC_GOOD_STRIDE; + v->flags = flags | VEC_MALLOC ; } void gl_vector1ui_alloc( GLvector1ui *v, GLuint flags, GLuint count, @@ -208,7 +208,7 @@ void gl_vector1ui_alloc( GLvector1ui *v, GLuint flags, GLuint count, v->start = (GLuint *) v->storage; v->data = (GLuint *) v->storage; v->count = 0; - v->flags = flags | VEC_MALLOC | VEC_GOOD_STRIDE; + v->flags = flags | VEC_MALLOC ; } diff --git a/src/mesa/math/m_vector.h b/src/mesa/math/m_vector.h index c4af1eaade..24a392a12b 100644 --- a/src/mesa/math/m_vector.h +++ b/src/mesa/math/m_vector.h @@ -1,4 +1,4 @@ -/* $Id: m_vector.h,v 1.1 2000/11/16 21:05:41 keithw Exp $ */ +/* $Id: m_vector.h,v 1.2 2000/12/26 05:09:31 keithw Exp $ */ /* * Mesa 3-D graphics library @@ -35,18 +35,13 @@ #include "glheader.h" -#define VEC_DIRTY_0 0x1 /* dirty flags not really used any more */ +#define VEC_DIRTY_0 0x1 #define VEC_DIRTY_1 0x2 #define VEC_DIRTY_2 0x4 #define VEC_DIRTY_3 0x8 #define VEC_MALLOC 0x10 /* storage field points to self-allocated mem*/ -#define VEC_WRITABLE 0x20 /* keep both + and - bits for easy testing */ -#define VEC_NOT_WRITABLE 0x40 -#define VEC_GOOD_STRIDE 0x80 -#define VEC_BAD_STRIDE 0x100 - -#define VEC_WRITABLE_FLAGS (VEC_WRITABLE|VEC_NOT_WRITABLE) -#define VEC_STRIDE_FLAGS (VEC_GOOD_STRIDE|VEC_BAD_STRIDE) +#define VEC_NOT_WRITEABLE 0x40 /* writable elements to hold clipped data */ +#define VEC_BAD_STRIDE 0x100 /* matches tnl's prefered stride */ #define VEC_SIZE_1 VEC_DIRTY_0 diff --git a/src/mesa/math/m_xform.c b/src/mesa/math/m_xform.c index a6e34e9eb2..72aec3a06a 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.4 2000/11/24 10:25:11 keithw Exp $ */ +/* $Id: m_xform.c,v 1.5 2000/12/26 05:09:31 keithw Exp $ */ /* * Mesa 3-D graphics library @@ -41,6 +41,7 @@ #include "macros.h" #include "mmath.h" +#include "m_eval.h" #include "m_matrix.h" #include "m_translate.h" #include "m_xform.h" @@ -250,4 +251,5 @@ _math_init( void ) _math_init_transformation(); _math_init_translate(); _math_init_vertices(); + _math_init_eval(); } diff --git a/src/mesa/math/m_xform.h b/src/mesa/math/m_xform.h index 7fc5be3ab1..046fc3d937 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.2 2000/11/17 21:01:49 brianp Exp $ */ +/* $Id: m_xform.h,v 1.3 2000/12/26 05:09:31 keithw Exp $ */ /* * Mesa 3-D graphics library @@ -75,8 +75,8 @@ do { \ extern void gl_transform_vector( GLfloat u[4], - const GLfloat v[4], - const GLfloat m[16] ); + CONST GLfloat v[4], + CONST GLfloat m[16] ); extern void @@ -132,37 +132,36 @@ _math_init_transformation( void ); #define CLIP_NEAR_BIT 0x10 #define CLIP_FAR_BIT 0x20 #define CLIP_USER_BIT 0x40 -#define CLIP_CULLED_BIT 0x80 /* Vertex has been culled */ #define CLIP_ALL_BITS 0x3f typedef GLvector4f * (_XFORMAPIP clip_func)( GLvector4f *vClip, - GLvector4f *vProj, - GLubyte clipMask[], - GLubyte *orMask, - GLubyte *andMask ); + GLvector4f *vProj, + GLubyte clipMask[], + GLubyte *orMask, + GLubyte *andMask ); -typedef void (*dotprod_func)( GLvector4f *out_vec, - GLuint elt, - const GLvector4f *coord_vec, - const GLfloat plane[4], - const GLubyte mask[]); +typedef void (*dotprod_func)( GLfloat *out, + GLuint out_stride, + CONST GLvector4f *coord_vec, + CONST GLfloat plane[4], + CONST GLubyte mask[]); typedef void (*vec_copy_func)( GLvector4f *to, - const GLvector4f *from, - const GLubyte mask[]); + CONST GLvector4f *from, + CONST GLubyte mask[]); /* * Functions for transformation of normals in the VB. */ -typedef void (_NORMAPIP normal_func)( const GLmatrix *mat, - GLfloat scale, - const GLvector3f *in, - const GLfloat lengths[], - const GLubyte mask[], - GLvector3f *dest ); +typedef void (_NORMAPIP normal_func)( CONST GLmatrix *mat, + GLfloat scale, + CONST GLvector3f *in, + CONST GLfloat lengths[], + CONST GLubyte mask[], + GLvector3f *dest ); /* Flags for selecting a normal transformation function. @@ -181,26 +180,27 @@ typedef void (_NORMAPIP normal_func)( const GLmatrix *mat, * parameter, to allow a unified interface. */ typedef void (_XFORMAPIP transform_func)( GLvector4f *to_vec, - const GLfloat m[16], - const GLvector4f *from_vec, - const GLubyte *clipmask, - const GLubyte flag ); + CONST GLfloat m[16], + CONST GLvector4f *from_vec, + CONST GLubyte *clipmask, + CONST GLubyte flag ); extern GLvector4f *gl_project_points( GLvector4f *to, - const GLvector4f *from ); + CONST GLvector4f *from ); extern void gl_transform_bounds3( GLubyte *orMask, GLubyte *andMask, - const GLfloat m[16], - CONST GLfloat src[][3] ); + CONST GLfloat m[16], + CONST GLfloat src[][3] ); extern void gl_transform_bounds2( GLubyte *orMask, GLubyte *andMask, - const GLfloat m[16], - CONST GLfloat src[][3] ); + CONST GLfloat m[16], + CONST GLfloat src[][3] ); 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 normal_func gl_normal_tab[0xf][0x4]; @@ -210,17 +210,13 @@ extern normal_func gl_normal_tab[0xf][0x4]; extern transform_func **(gl_transform_tab[2]); -extern void gl_transform_point_sz( GLfloat Q[4], const GLfloat M[16], - const GLfloat P[4], GLuint sz ); +extern void gl_transform_point_sz( GLfloat Q[4], CONST GLfloat M[16], + CONST GLfloat P[4], GLuint sz ); #define TransformRaw( to, mat, from ) \ ( (*gl_transform_tab[0][(from)->size][(mat)->type])( to, (mat)->m, from, 0, 0 ), \ (to) ) -#define Transform( to, mat, from, mask, cull ) \ - ( (*gl_transform_tab[cull!=0][(from)->size][(mat)->type])( to, (mat)->m, from, mask, cull ), \ - (to) ) - #endif diff --git a/src/mesa/math/m_xform_tmp.h b/src/mesa/math/m_xform_tmp.h index 289255a9cf..cb94f88ed1 100644 --- a/src/mesa/math/m_xform_tmp.h +++ b/src/mesa/math/m_xform_tmp.h @@ -1,4 +1,4 @@ -/* $Id: m_xform_tmp.h,v 1.1 2000/11/16 21:05:41 keithw Exp $ */ +/* $Id: m_xform_tmp.h,v 1.2 2000/12/26 05:09:31 keithw Exp $ */ /* * Mesa 3-D graphics library @@ -457,10 +457,7 @@ TAG(transform_points2_3d_no_rot)( GLvector4f *to_vec, to_vec->count = from_vec->count; } -/* This may not be called too often, but I wouldn't say it was dead - * code. It's also hard to remove any of these functions if you are - * attached to the assertions that have appeared in them. - */ + static void _XFORMAPI TAG(transform_points2_perspective)( GLvector4f *to_vec, const GLfloat m[16], -- cgit v1.2.3