@@ -1,4 +1,4 @@ | |||
/* $Id: texformat.c,v 1.6 2001/03/28 20:40:51 gareth Exp $ */ | |||
/* $Id: texformat.c,v 1.7 2001/03/30 14:44:43 gareth Exp $ */ | |||
/* | |||
* Mesa 3-D graphics library | |||
@@ -68,7 +68,7 @@ static void fetch_null_texel( const struct gl_texture_image *texImage, | |||
} | |||
/* ================================================================ | |||
/* ============================================================= | |||
* Default GLchan-based formats: | |||
*/ | |||
@@ -217,7 +217,7 @@ const struct gl_texture_format _mesa_texformat_depth_component = { | |||
}; | |||
/* ================================================================ | |||
/* ============================================================= | |||
* Hardware formats: | |||
*/ | |||
@@ -438,7 +438,7 @@ const struct gl_texture_format _mesa_texformat_ci8 = { | |||
}; | |||
/* ================================================================ | |||
/* ============================================================= | |||
* Null format: | |||
*/ | |||
@@ -1,4 +1,4 @@ | |||
/* $Id: texutil.c,v 1.21 2001/03/28 20:40:51 gareth Exp $ */ | |||
/* $Id: texutil.c,v 1.22 2001/03/30 14:44:43 gareth Exp $ */ | |||
/* | |||
* Mesa 3-D graphics library | |||
@@ -67,7 +67,7 @@ typedef GLboolean (*convert_func)( struct gl_texture_convert *convert ); | |||
/* ================================================================ | |||
/* ============================================================= | |||
* RGBA8888 textures: | |||
*/ | |||
@@ -146,7 +146,7 @@ CONVERT_RGBA8888( texsubimage3d ) | |||
/* ================================================================ | |||
/* ============================================================= | |||
* ARGB8888 textures: | |||
*/ | |||
@@ -224,7 +224,7 @@ CONVERT_ARGB8888( texsubimage3d ) | |||
/* ================================================================ | |||
/* ============================================================= | |||
* RGB888 textures: | |||
*/ | |||
@@ -246,7 +246,7 @@ convert_texsubimage3d_rgb888( struct gl_texture_convert *convert ) | |||
/* ================================================================ | |||
/* ============================================================= | |||
* RGB565 textures: | |||
*/ | |||
@@ -328,7 +328,7 @@ CONVERT_RGB565( texsubimage3d ) | |||
/* ================================================================ | |||
/* ============================================================= | |||
* ARGB4444 textures: | |||
*/ | |||
@@ -391,7 +391,7 @@ CONVERT_ARGB4444( texsubimage3d ) | |||
/* ================================================================ | |||
/* ============================================================= | |||
* ARGB1555 textures: | |||
*/ | |||
@@ -475,7 +475,7 @@ CONVERT_ARGB1555( texsubimage3d ) | |||
/* ================================================================ | |||
/* ============================================================= | |||
* AL88 textures: | |||
*/ | |||
@@ -576,7 +576,7 @@ CONVERT_AL88( texsubimage3d ) | |||
/* ================================================================ | |||
/* ============================================================= | |||
* RGB332 textures: | |||
*/ | |||
@@ -598,7 +598,7 @@ convert_texsubimage3d_rgb332( struct gl_texture_convert *convert ) | |||
/* ================================================================ | |||
/* ============================================================= | |||
* CI8 (and all other single-byte texel) textures: | |||
*/ | |||
@@ -644,7 +644,7 @@ CONVERT_CI8( texsubimage3d ) | |||
/* ================================================================ | |||
/* ============================================================= | |||
* Global entry points | |||
*/ | |||
@@ -1,4 +1,4 @@ | |||
/* $Id: texutil_tmp.h,v 1.6 2001/03/27 20:32:24 brianp Exp $ */ | |||
/* $Id: texutil_tmp.h,v 1.7 2001/03/30 14:44:43 gareth Exp $ */ | |||
/* | |||
* Mesa 3-D graphics library | |||
@@ -42,7 +42,7 @@ | |||
convert->dstImageHeight * DST_TEXEL_BYTES) | |||
/* ================================================================ | |||
/* ============================================================= | |||
* PRE: No pixelstore attribs, width == dstImageWidth. | |||
*/ | |||
static GLboolean | |||
@@ -106,7 +106,7 @@ TAG(texsubimage3d)( struct gl_texture_convert *convert ) | |||
/* ================================================================ | |||
/* ============================================================= | |||
* PRE: No pixelstore attribs, width != dstImageWidth. | |||
*/ | |||
static GLboolean | |||
@@ -179,7 +179,7 @@ TAG(texsubimage3d_stride)( struct gl_texture_convert *convert ) | |||
/* ================================================================ | |||
/* ============================================================= | |||
* PRE: Require pixelstore attribs, width == dstImageWidth. | |||
*/ | |||
static GLboolean | |||
@@ -271,7 +271,7 @@ TAG(texsubimage3d_pack)( struct gl_texture_convert *convert ) | |||
/* ================================================================ | |||
/* ============================================================= | |||
* PRE: Require pixelstore attribs, width != dstImageWidth. | |||
*/ | |||
static GLboolean |
@@ -1,4 +1,4 @@ | |||
/* $Id: m_copy_tmp.h,v 1.5 2001/03/12 02:02:36 gareth Exp $ */ | |||
/* $Id: m_copy_tmp.h,v 1.6 2001/03/30 14:44:43 gareth Exp $ */ | |||
/* | |||
* Mesa 3-D graphics library | |||
@@ -30,24 +30,20 @@ | |||
#define COPY_FUNC( BITS ) \ | |||
static void TAG2(copy, BITS)( GLvector4f *to, const GLvector4f *f, \ | |||
const GLubyte mask[] ) \ | |||
static void TAG2(copy, BITS)( GLvector4f *to, const GLvector4f *f ) \ | |||
{ \ | |||
GLfloat (*t)[4] = (GLfloat (*)[4])to->start; \ | |||
GLfloat *from = f->start; \ | |||
GLuint stride = f->stride; \ | |||
GLuint count = f->count; \ | |||
GLuint i; \ | |||
(void) mask; \ | |||
\ | |||
if (BITS) \ | |||
STRIDE_LOOP { \ | |||
CULL_CHECK { \ | |||
if (BITS&1) t[i][0] = from[0]; \ | |||
if (BITS&2) t[i][1] = from[1]; \ | |||
if (BITS&4) t[i][2] = from[2]; \ | |||
if (BITS&8) t[i][3] = from[3]; \ | |||
} \ | |||
if (BITS&1) t[i][0] = from[0]; \ | |||
if (BITS&2) t[i][1] = from[1]; \ | |||
if (BITS&4) t[i][2] = from[2]; \ | |||
if (BITS&8) t[i][3] = from[3]; \ | |||
} \ | |||
} | |||
@@ -70,22 +66,22 @@ COPY_FUNC( 0xd ) | |||
COPY_FUNC( 0xe ) | |||
COPY_FUNC( 0xf ) | |||
static void TAG2(init_copy, 0 ) ( void ) | |||
static void TAG2(init_copy, 0)( void ) | |||
{ | |||
_mesa_copy_tab[IDX][0x0] = TAG2(copy, 0x0); | |||
_mesa_copy_tab[IDX][0x1] = TAG2(copy, 0x1); | |||
_mesa_copy_tab[IDX][0x2] = TAG2(copy, 0x2); | |||
_mesa_copy_tab[IDX][0x3] = TAG2(copy, 0x3); | |||
_mesa_copy_tab[IDX][0x4] = TAG2(copy, 0x4); | |||
_mesa_copy_tab[IDX][0x5] = TAG2(copy, 0x5); | |||
_mesa_copy_tab[IDX][0x6] = TAG2(copy, 0x6); | |||
_mesa_copy_tab[IDX][0x7] = TAG2(copy, 0x7); | |||
_mesa_copy_tab[IDX][0x8] = TAG2(copy, 0x8); | |||
_mesa_copy_tab[IDX][0x9] = TAG2(copy, 0x9); | |||
_mesa_copy_tab[IDX][0xa] = TAG2(copy, 0xa); | |||
_mesa_copy_tab[IDX][0xb] = TAG2(copy, 0xb); | |||
_mesa_copy_tab[IDX][0xc] = TAG2(copy, 0xc); | |||
_mesa_copy_tab[IDX][0xd] = TAG2(copy, 0xd); | |||
_mesa_copy_tab[IDX][0xe] = TAG2(copy, 0xe); | |||
_mesa_copy_tab[IDX][0xf] = TAG2(copy, 0xf); | |||
_mesa_copy_tab[0x0] = TAG2(copy, 0x0); | |||
_mesa_copy_tab[0x1] = TAG2(copy, 0x1); | |||
_mesa_copy_tab[0x2] = TAG2(copy, 0x2); | |||
_mesa_copy_tab[0x3] = TAG2(copy, 0x3); | |||
_mesa_copy_tab[0x4] = TAG2(copy, 0x4); | |||
_mesa_copy_tab[0x5] = TAG2(copy, 0x5); | |||
_mesa_copy_tab[0x6] = TAG2(copy, 0x6); | |||
_mesa_copy_tab[0x7] = TAG2(copy, 0x7); | |||
_mesa_copy_tab[0x8] = TAG2(copy, 0x8); | |||
_mesa_copy_tab[0x9] = TAG2(copy, 0x9); | |||
_mesa_copy_tab[0xa] = TAG2(copy, 0xa); | |||
_mesa_copy_tab[0xb] = TAG2(copy, 0xb); | |||
_mesa_copy_tab[0xc] = TAG2(copy, 0xc); | |||
_mesa_copy_tab[0xd] = TAG2(copy, 0xd); | |||
_mesa_copy_tab[0xe] = TAG2(copy, 0xe); | |||
_mesa_copy_tab[0xf] = TAG2(copy, 0xf); | |||
} |
@@ -1,4 +1,4 @@ | |||
/* $Id: m_debug_norm.c,v 1.6 2001/03/29 06:46:27 gareth Exp $ */ | |||
/* $Id: m_debug_norm.c,v 1.7 2001/03/30 14:44:43 gareth Exp $ */ | |||
/* | |||
* Mesa 3-D graphics library | |||
@@ -113,7 +113,7 @@ static char *norm_strings[8] = { | |||
}; | |||
/* ================================================================ | |||
/* ============================================================= | |||
* Reference transformations | |||
*/ | |||
@@ -121,7 +121,6 @@ static void ref_norm_transform_rescale( const GLmatrix *mat, | |||
GLfloat scale, | |||
const GLvector3f *in, | |||
const GLfloat *lengths, | |||
const GLubyte mask[], | |||
GLvector3f *dest ) | |||
{ | |||
GLuint i; | |||
@@ -129,7 +128,6 @@ static void ref_norm_transform_rescale( const GLmatrix *mat, | |||
const GLfloat *m = mat->inv; | |||
GLfloat (*out)[3] = (GLfloat (*)[3])dest->start; | |||
(void) mask; | |||
(void) lengths; | |||
for ( i = 0 ; i < in->count ; i++ ) { | |||
@@ -146,7 +144,6 @@ static void ref_norm_transform_normalize( const GLmatrix *mat, | |||
GLfloat scale, | |||
const GLvector3f *in, | |||
const GLfloat *lengths, | |||
const GLubyte mask[], | |||
GLvector3f *dest ) | |||
{ | |||
GLuint i; | |||
@@ -154,8 +151,6 @@ static void ref_norm_transform_normalize( const GLmatrix *mat, | |||
const GLfloat *m = mat->inv; | |||
GLfloat (*out)[3] = (GLfloat (*)[3])dest->start; | |||
(void) mask; | |||
for ( i = 0 ; i < in->count ; i++ ) { | |||
GLfloat t[3]; | |||
@@ -182,7 +177,7 @@ static void ref_norm_transform_normalize( const GLmatrix *mat, | |||
} | |||
/* ================================================================ | |||
/* ============================================================= | |||
* Normal transformation tests | |||
*/ | |||
@@ -268,20 +263,20 @@ static int test_norm_function( normal_func func, int mtype, long *cycles ) | |||
ref2->flags = 0; | |||
if ( norm_normalize_types[mtype] == 0 ) { | |||
ref_norm_transform_rescale( mat, scale, source, NULL, NULL, ref ); | |||
ref_norm_transform_rescale( mat, scale, source, NULL, ref ); | |||
} else { | |||
ref_norm_transform_normalize( mat, scale, source, NULL, NULL, ref ); | |||
ref_norm_transform_normalize( mat, scale, source, length, NULL, ref2 ); | |||
ref_norm_transform_normalize( mat, scale, source, NULL, ref ); | |||
ref_norm_transform_normalize( mat, scale, source, length, ref2 ); | |||
} | |||
if ( mesa_profile ) { | |||
BEGIN_RACE( *cycles ); | |||
func( mat, scale, source, NULL, NULL, dest ); | |||
func( mat, scale, source, NULL, dest ); | |||
END_RACE( *cycles ); | |||
func( mat, scale, source, length, NULL, dest2 ); | |||
func( mat, scale, source, length, dest2 ); | |||
} else { | |||
func( mat, scale, source, NULL, NULL, dest ); | |||
func( mat, scale, source, length, NULL, dest2 ); | |||
func( mat, scale, source, NULL, dest ); | |||
func( mat, scale, source, length, dest2 ); | |||
} | |||
for ( i = 0 ; i < TEST_COUNT ; i++ ) { | |||
@@ -327,7 +322,7 @@ static int test_norm_function( normal_func func, int mtype, long *cycles ) | |||
void _math_test_all_normal_transform_functions( char *description ) | |||
{ | |||
int mtype; | |||
long benchmark_tab[0xf][0x4]; | |||
long benchmark_tab[0xf]; | |||
static int first_time = 1; | |||
if ( first_time ) { | |||
@@ -348,8 +343,8 @@ void _math_test_all_normal_transform_functions( char *description ) | |||
#endif | |||
for ( mtype = 0 ; mtype < 8 ; mtype++ ) { | |||
normal_func func = _mesa_normal_tab[norm_types[mtype]][0]; | |||
long *cycles = &(benchmark_tab[mtype][0]); | |||
normal_func func = _mesa_normal_tab[norm_types[mtype]]; | |||
long *cycles = &benchmark_tab[mtype]; | |||
if ( test_norm_function( func, mtype, cycles ) == 0 ) { | |||
char buf[100]; | |||
@@ -360,7 +355,7 @@ void _math_test_all_normal_transform_functions( char *description ) | |||
#ifdef RUN_DEBUG_BENCHMARK | |||
if ( mesa_profile ) { | |||
printf( " %li\t", benchmark_tab[mtype][0] ); | |||
printf( " %li\t", benchmark_tab[mtype] ); | |||
printf( " | [%s]\n", norm_strings[mtype] ); | |||
} | |||
#endif |
@@ -1,4 +1,4 @@ | |||
/* $Id: m_debug_util.h,v 1.2 2001/03/12 00:48:41 gareth Exp $ */ | |||
/* $Id: m_debug_util.h,v 1.3 2001/03/30 14:44:43 gareth Exp $ */ | |||
/* | |||
* Mesa 3-D graphics library | |||
@@ -191,7 +191,7 @@ extern char *mesa_profile; | |||
#endif | |||
/* ================================================================ | |||
/* ============================================================= | |||
* Helper functions | |||
*/ | |||
@@ -1,4 +1,4 @@ | |||
/* $Id: m_debug_xform.c,v 1.7 2001/03/29 06:46:27 gareth Exp $ */ | |||
/* $Id: m_debug_xform.c,v 1.8 2001/03/30 14:44:43 gareth Exp $ */ | |||
/* | |||
* Mesa 3-D graphics library | |||
@@ -126,24 +126,19 @@ static char *mstrings[7] = { | |||
}; | |||
/* ================================================================ | |||
/* ============================================================= | |||
* Reference transformations | |||
*/ | |||
static void ref_transform( GLvector4f *dst, | |||
const GLmatrix *mat, | |||
const GLvector4f *src, | |||
const GLubyte *clipmask, | |||
const GLubyte flag ) | |||
const GLvector4f *src ) | |||
{ | |||
GLuint i; | |||
GLfloat *s = (GLfloat *)src->start; | |||
GLfloat (*d)[4] = (GLfloat (*)[4])dst->start; | |||
const GLfloat *m = mat->m; | |||
(void) clipmask; | |||
(void) flag; | |||
for ( i = 0 ; i < src->count ; i++ ) { | |||
TRANSFORM_POINT( d[i], m, s ); | |||
s = (GLfloat *)((char *)s + src->stride); | |||
@@ -151,7 +146,7 @@ static void ref_transform( GLvector4f *dst, | |||
} | |||
/* ================================================================ | |||
/* ============================================================= | |||
* Vertex transformation tests | |||
*/ | |||
@@ -165,7 +160,6 @@ static int test_transform_function( transform_func func, int psize, | |||
GLvector4f source[1], dest[1], ref[1]; | |||
GLmatrix mat[1]; | |||
GLfloat *m; | |||
GLubyte mask[TEST_COUNT]; | |||
int i, j; | |||
#ifdef RUN_DEBUG_BENCHMARK | |||
int cycle_i; /* the counter for the benchmarks we run */ | |||
@@ -207,7 +201,6 @@ static int test_transform_function( transform_func func, int psize, | |||
} | |||
for ( i = 0 ; i < TEST_COUNT ; i++) { | |||
mask[i] = i % 2; /* mask every 2nd element */ | |||
ASSIGN_4V( d[i], 0.0, 0.0, 0.0, 1.0 ); | |||
ASSIGN_4V( s[i], 0.0, 0.0, 0.0, 1.0 ); | |||
for ( j = 0 ; j < psize ; j++ ) | |||
@@ -235,15 +228,15 @@ static int test_transform_function( transform_func func, int psize, | |||
ref->size = 0; | |||
ref->flags = 0; | |||
ref_transform( ref, mat, source, NULL, 0 ); | |||
ref_transform( ref, mat, source ); | |||
if ( mesa_profile ) { | |||
BEGIN_RACE( *cycles ); | |||
func( dest, mat->m, source, NULL, 0 ); | |||
func( dest, mat->m, source ); | |||
END_RACE( *cycles ); | |||
} | |||
else { | |||
func( dest, mat->m, source, NULL, 0 ); | |||
func( dest, mat->m, source ); | |||
} | |||
for ( i = 0 ; i < TEST_COUNT ; i++ ) { | |||
@@ -275,7 +268,7 @@ static int test_transform_function( transform_func func, int psize, | |||
void _math_test_all_transform_functions( char *description ) | |||
{ | |||
int psize, mtype; | |||
long benchmark_tab[2][4][7]; | |||
long benchmark_tab[4][7]; | |||
static int first_time = 1; | |||
if ( first_time ) { | |||
@@ -305,8 +298,8 @@ void _math_test_all_transform_functions( char *description ) | |||
for ( mtype = 0 ; mtype < 7 ; mtype++ ) { | |||
for ( psize = 1 ; psize <= 4 ; psize++ ) { | |||
transform_func func = _mesa_transform_tab[0][psize][mtypes[mtype]]; | |||
long *cycles = &(benchmark_tab[0][psize-1][mtype]); | |||
transform_func func = _mesa_transform_tab[psize][mtypes[mtype]]; | |||
long *cycles = &(benchmark_tab[psize-1][mtype]); | |||
if ( test_transform_function( func, psize, mtype, cycles ) == 0 ) { | |||
char buf[100]; | |||
@@ -316,7 +309,7 @@ void _math_test_all_transform_functions( char *description ) | |||
} | |||
#ifdef RUN_DEBUG_BENCHMARK | |||
if ( mesa_profile ) | |||
printf( " %li\t", benchmark_tab[0][psize-1][mtype] ); | |||
printf( " %li\t", benchmark_tab[psize-1][mtype] ); | |||
#endif | |||
} | |||
#ifdef RUN_DEBUG_BENCHMARK |
@@ -1,4 +1,4 @@ | |||
/* $Id: m_dotprod_tmp.h,v 1.5 2001/03/12 02:02:36 gareth Exp $ */ | |||
/* $Id: m_dotprod_tmp.h,v 1.6 2001/03/30 14:44:43 gareth Exp $ */ | |||
/* | |||
* Mesa 3-D graphics library | |||
@@ -34,8 +34,7 @@ | |||
static void TAG(dotprod_vec2)( GLfloat *out, | |||
GLuint outstride, | |||
const GLvector4f *coord_vec, | |||
const GLfloat plane[4], | |||
const GLubyte mask[] ) | |||
const GLfloat plane[4] ) | |||
{ | |||
GLuint stride = coord_vec->stride; | |||
GLfloat *coord = coord_vec->start; | |||
@@ -45,22 +44,17 @@ static void TAG(dotprod_vec2)( GLfloat *out, | |||
const GLfloat plane0 = plane[0], plane1 = plane[1], plane3 = plane[3]; | |||
(void) mask; | |||
for (i=0;i<count;i++,STRIDE_F(coord,stride),STRIDE_F(out,outstride)) { | |||
CULL_CHECK { | |||
*out = (coord[0] * plane0 + | |||
coord[1] * plane1 + | |||
plane3); | |||
} | |||
*out = (coord[0] * plane0 + | |||
coord[1] * plane1 + | |||
plane3); | |||
} | |||
} | |||
static void TAG(dotprod_vec3)( GLfloat *out, | |||
GLuint outstride, | |||
const GLvector4f *coord_vec, | |||
const GLfloat plane[4], | |||
const GLubyte mask[] ) | |||
const GLfloat plane[4] ) | |||
{ | |||
GLuint stride = coord_vec->stride; | |||
GLfloat *coord = coord_vec->start; | |||
@@ -71,23 +65,18 @@ static void TAG(dotprod_vec3)( GLfloat *out, | |||
const GLfloat plane0 = plane[0], plane1 = plane[1], plane2 = plane[2]; | |||
const GLfloat plane3 = plane[3]; | |||
(void) mask; | |||
for (i=0;i<count;i++,STRIDE_F(coord,stride),STRIDE_F(out,outstride)) { | |||
CULL_CHECK { | |||
*out = (coord[0] * plane0 + | |||
coord[1] * plane1 + | |||
coord[2] * plane2 + | |||
plane3); | |||
} | |||
*out = (coord[0] * plane0 + | |||
coord[1] * plane1 + | |||
coord[2] * plane2 + | |||
plane3); | |||
} | |||
} | |||
static void TAG(dotprod_vec4)( GLfloat *out, | |||
GLuint outstride, | |||
const GLvector4f *coord_vec, | |||
const GLfloat plane[4], | |||
const GLubyte mask[] ) | |||
const GLfloat plane[4] ) | |||
{ | |||
GLuint stride = coord_vec->stride; | |||
GLfloat *coord = coord_vec->start; | |||
@@ -97,22 +86,18 @@ static void TAG(dotprod_vec4)( GLfloat *out, | |||
const GLfloat plane0 = plane[0], plane1 = plane[1], plane2 = plane[2]; | |||
const GLfloat plane3 = plane[3]; | |||
(void) mask; | |||
for (i=0;i<count;i++,STRIDE_F(coord,stride),STRIDE_F(out,outstride)) { | |||
CULL_CHECK { | |||
*out = (coord[0] * plane0 + | |||
coord[1] * plane1 + | |||
coord[2] * plane2 + | |||
coord[3] * plane3); | |||
} | |||
*out = (coord[0] * plane0 + | |||
coord[1] * plane1 + | |||
coord[2] * plane2 + | |||
coord[3] * plane3); | |||
} | |||
} | |||
static void TAG(init_dotprod)( void ) | |||
{ | |||
_mesa_dotprod_tab[IDX&1][2] = TAG(dotprod_vec2); | |||
_mesa_dotprod_tab[IDX&1][3] = TAG(dotprod_vec3); | |||
_mesa_dotprod_tab[IDX&1][4] = TAG(dotprod_vec4); | |||
_mesa_dotprod_tab[2] = TAG(dotprod_vec2); | |||
_mesa_dotprod_tab[3] = TAG(dotprod_vec3); | |||
_mesa_dotprod_tab[4] = TAG(dotprod_vec4); | |||
} |
@@ -1,4 +1,4 @@ | |||
/* $Id: m_norm_tmp.h,v 1.6 2001/03/12 02:02:36 gareth Exp $ */ | |||
/* $Id: m_norm_tmp.h,v 1.7 2001/03/30 14:44:43 gareth Exp $ */ | |||
/* | |||
* Mesa 3-D graphics library | |||
@@ -36,7 +36,6 @@ TAG(transform_normalize_normals)( const GLmatrix *mat, | |||
GLfloat scale, | |||
const GLvector3f *in, | |||
const GLfloat *lengths, | |||
const GLubyte mask[], | |||
GLvector3f *dest ) | |||
{ | |||
GLuint i; | |||
@@ -49,29 +48,26 @@ TAG(transform_normalize_normals)( const GLmatrix *mat, | |||
GLfloat m1 = m[1], m5 = m[5], m9 = m[9]; | |||
GLfloat m2 = m[2], m6 = m[6], m10 = m[10]; | |||
(void) mask; | |||
if (!lengths) { | |||
STRIDE_LOOP { | |||
CULL_CHECK { | |||
GLfloat tx, ty, tz; | |||
{ | |||
const GLfloat ux = from[0], uy = from[1], uz = from[2]; | |||
tx = ux * m0 + uy * m1 + uz * m2; | |||
ty = ux * m4 + uy * m5 + uz * m6; | |||
tz = ux * m8 + uy * m9 + uz * m10; | |||
GLfloat tx, ty, tz; | |||
{ | |||
const GLfloat ux = from[0], uy = from[1], uz = from[2]; | |||
tx = ux * m0 + uy * m1 + uz * m2; | |||
ty = ux * m4 + uy * m5 + uz * m6; | |||
tz = ux * m8 + uy * m9 + uz * m10; | |||
} | |||
{ | |||
GLdouble len = tx*tx + ty*ty + tz*tz; | |||
if (len > 1e-20) { | |||
GLdouble scale = 1.0 / GL_SQRT(len); | |||
out[i][0] = (GLfloat) (tx * scale); | |||
out[i][1] = (GLfloat) (ty * scale); | |||
out[i][2] = (GLfloat) (tz * scale); | |||
} | |||
else | |||
{ | |||
GLdouble len = tx*tx + ty*ty + tz*tz; | |||
if (len > 1e-20) { | |||
GLdouble scale = 1.0 / GL_SQRT(len); | |||
out[i][0] = (GLfloat) (tx * scale); | |||
out[i][1] = (GLfloat) (ty * scale); | |||
out[i][2] = (GLfloat) (tz * scale); | |||
} | |||
else | |||
{ | |||
out[i][0] = out[i][1] = out[i][2] = 0; | |||
} | |||
out[i][0] = out[i][1] = out[i][2] = 0; | |||
} | |||
} | |||
} | |||
@@ -84,20 +80,18 @@ TAG(transform_normalize_normals)( const GLmatrix *mat, | |||
} | |||
STRIDE_LOOP { | |||
CULL_CHECK { | |||
GLfloat tx, ty, tz; | |||
{ | |||
const GLfloat ux = from[0], uy = from[1], uz = from[2]; | |||
tx = ux * m0 + uy * m1 + uz * m2; | |||
ty = ux * m4 + uy * m5 + uz * m6; | |||
tz = ux * m8 + uy * m9 + uz * m10; | |||
} | |||
{ | |||
GLfloat len = lengths[i]; | |||
out[i][0] = tx * len; | |||
out[i][1] = ty * len; | |||
out[i][2] = tz * len; | |||
} | |||
GLfloat tx, ty, tz; | |||
{ | |||
const GLfloat ux = from[0], uy = from[1], uz = from[2]; | |||
tx = ux * m0 + uy * m1 + uz * m2; | |||
ty = ux * m4 + uy * m5 + uz * m6; | |||
tz = ux * m8 + uy * m9 + uz * m10; | |||
} | |||
{ | |||
GLfloat len = lengths[i]; | |||
out[i][0] = tx * len; | |||
out[i][1] = ty * len; | |||
out[i][2] = tz * len; | |||
} | |||
} | |||
} | |||
@@ -110,7 +104,6 @@ TAG(transform_normalize_normals_no_rot)( const GLmatrix *mat, | |||
GLfloat scale, | |||
const GLvector3f *in, | |||
const GLfloat *lengths, | |||
const GLubyte mask[], | |||
GLvector3f *dest ) | |||
{ | |||
GLuint i; | |||
@@ -122,29 +115,26 @@ TAG(transform_normalize_normals_no_rot)( const GLmatrix *mat, | |||
GLfloat m0 = m[0]; | |||
GLfloat m5 = m[5]; | |||
GLfloat m10 = m[10]; | |||
(void) mask; | |||
if (!lengths) { | |||
STRIDE_LOOP { | |||
CULL_CHECK { | |||
GLfloat tx, ty, tz; | |||
{ | |||
const GLfloat ux = from[0], uy = from[1], uz = from[2]; | |||
tx = ux * m0 ; | |||
ty = uy * m5 ; | |||
tz = uz * m10; | |||
GLfloat tx, ty, tz; | |||
{ | |||
const GLfloat ux = from[0], uy = from[1], uz = from[2]; | |||
tx = ux * m0 ; | |||
ty = uy * m5 ; | |||
tz = uz * m10; | |||
} | |||
{ | |||
GLdouble len = tx*tx + ty*ty + tz*tz; | |||
if (len > 1e-20) { | |||
GLdouble scale = 1.0 / GL_SQRT(len); | |||
out[i][0] = (GLfloat) (tx * scale); | |||
out[i][1] = (GLfloat) (ty * scale); | |||
out[i][2] = (GLfloat) (tz * scale); | |||
} | |||
else | |||
{ | |||
GLdouble len = tx*tx + ty*ty + tz*tz; | |||
if (len > 1e-20) { | |||
GLdouble scale = 1.0 / GL_SQRT(len); | |||
out[i][0] = (GLfloat) (tx * scale); | |||
out[i][1] = (GLfloat) (ty * scale); | |||
out[i][2] = (GLfloat) (tz * scale); | |||
} | |||
else | |||
{ | |||
out[i][0] = out[i][1] = out[i][2] = 0; | |||
} | |||
out[i][0] = out[i][1] = out[i][2] = 0; | |||
} | |||
} | |||
} | |||
@@ -159,20 +149,18 @@ TAG(transform_normalize_normals_no_rot)( const GLmatrix *mat, | |||
} | |||
STRIDE_LOOP { | |||
CULL_CHECK { | |||
GLfloat tx, ty, tz; | |||
{ | |||
const GLfloat ux = from[0], uy = from[1], uz = from[2]; | |||
tx = ux * m0 ; | |||
ty = uy * m5 ; | |||
tz = uz * m10; | |||
} | |||
{ | |||
GLfloat len = lengths[i]; | |||
out[i][0] = tx * len; | |||
out[i][1] = ty * len; | |||
out[i][2] = tz * len; | |||
} | |||
GLfloat tx, ty, tz; | |||
{ | |||
const GLfloat ux = from[0], uy = from[1], uz = from[2]; | |||
tx = ux * m0 ; | |||
ty = uy * m5 ; | |||
tz = uz * m10; | |||
} | |||
{ | |||
GLfloat len = lengths[i]; | |||
out[i][0] = tx * len; | |||
out[i][1] = ty * len; | |||
out[i][2] = tz * len; | |||
} | |||
} | |||
} | |||
@@ -185,7 +173,6 @@ TAG(transform_rescale_normals_no_rot)( const GLmatrix *mat, | |||
GLfloat scale, | |||
const GLvector3f *in, | |||
const GLfloat *lengths, | |||
const GLubyte mask[], | |||
GLvector3f *dest ) | |||
{ | |||
GLuint i; | |||
@@ -198,14 +185,11 @@ TAG(transform_rescale_normals_no_rot)( const GLmatrix *mat, | |||
GLfloat m5 = scale*m[5]; | |||
GLfloat m10 = scale*m[10]; | |||
(void) lengths; | |||
(void) mask; | |||
STRIDE_LOOP { | |||
CULL_CHECK { | |||
GLfloat ux = from[0], uy = from[1], uz = from[2]; | |||
out[i][0] = ux * m0; | |||
out[i][1] = uy * m5; | |||
out[i][2] = uz * m10; | |||
} | |||
GLfloat ux = from[0], uy = from[1], uz = from[2]; | |||
out[i][0] = ux * m0; | |||
out[i][1] = uy * m5; | |||
out[i][2] = uz * m10; | |||
} | |||
dest->count = in->count; | |||
} | |||
@@ -215,7 +199,6 @@ TAG(transform_rescale_normals)( const GLmatrix *mat, | |||
GLfloat scale, | |||
const GLvector3f *in, | |||
const GLfloat *lengths, | |||
const GLubyte mask[], | |||
GLvector3f *dest ) | |||
{ | |||
GLuint i; | |||
@@ -231,14 +214,11 @@ TAG(transform_rescale_normals)( const GLmatrix *mat, | |||
GLfloat m1 = scale*m[1], m5 = scale*m[5], m9 = scale*m[9]; | |||
GLfloat m2 = scale*m[2], m6 = scale*m[6], m10 = scale*m[10]; | |||
(void) lengths; | |||
(void) mask; | |||
STRIDE_LOOP { | |||
CULL_CHECK { | |||
GLfloat ux = from[0], uy = from[1], uz = from[2]; | |||
out[i][0] = ux * m0 + uy * m1 + uz * m2; | |||
out[i][1] = ux * m4 + uy * m5 + uz * m6; | |||
out[i][2] = ux * m8 + uy * m9 + uz * m10; | |||
} | |||
GLfloat ux = from[0], uy = from[1], uz = from[2]; | |||
out[i][0] = ux * m0 + uy * m1 + uz * m2; | |||
out[i][1] = ux * m4 + uy * m5 + uz * m6; | |||
out[i][2] = ux * m8 + uy * m9 + uz * m10; | |||
} | |||
dest->count = in->count; | |||
} | |||
@@ -249,7 +229,6 @@ TAG(transform_normals_no_rot)( const GLmatrix *mat, | |||
GLfloat scale, | |||
const GLvector3f *in, | |||
const GLfloat *lengths, | |||
const GLubyte mask[], | |||
GLvector3f *dest ) | |||
{ | |||
GLuint i; | |||
@@ -263,14 +242,11 @@ TAG(transform_normals_no_rot)( const GLmatrix *mat, | |||
GLfloat m10 = m[10]; | |||
(void) scale; | |||
(void) lengths; | |||
(void) mask; | |||
STRIDE_LOOP { | |||
CULL_CHECK { | |||
GLfloat ux = from[0], uy = from[1], uz = from[2]; | |||
out[i][0] = ux * m0; | |||
out[i][1] = uy * m5; | |||
out[i][2] = uz * m10; | |||
} | |||
GLfloat ux = from[0], uy = from[1], uz = from[2]; | |||
out[i][0] = ux * m0; | |||
out[i][1] = uy * m5; | |||
out[i][2] = uz * m10; | |||
} | |||
dest->count = in->count; | |||
} | |||
@@ -281,7 +257,6 @@ TAG(transform_normals)( const GLmatrix *mat, | |||
GLfloat scale, | |||
const GLvector3f *in, | |||
const GLfloat *lengths, | |||
const GLubyte mask[], | |||
GLvector3f *dest ) | |||
{ | |||
GLuint i; | |||
@@ -295,14 +270,11 @@ TAG(transform_normals)( const GLmatrix *mat, | |||
GLfloat m2 = m[2], m6 = m[6], m10 = m[10]; | |||
(void) scale; | |||
(void) lengths; | |||
(void) mask; | |||
STRIDE_LOOP { | |||
CULL_CHECK { | |||
GLfloat ux = from[0], uy = from[1], uz = from[2]; | |||
out[i][0] = ux * m0 + uy * m1 + uz * m2; | |||
out[i][1] = ux * m4 + uy * m5 + uz * m6; | |||
out[i][2] = ux * m8 + uy * m9 + uz * m10; | |||
} | |||
GLfloat ux = from[0], uy = from[1], uz = from[2]; | |||
out[i][0] = ux * m0 + uy * m1 + uz * m2; | |||
out[i][1] = ux * m4 + uy * m5 + uz * m6; | |||
out[i][2] = ux * m8 + uy * m9 + uz * m10; | |||
} | |||
dest->count = in->count; | |||
} | |||
@@ -313,7 +285,6 @@ TAG(normalize_normals)( const GLmatrix *mat, | |||
GLfloat scale, | |||
const GLvector3f *in, | |||
const GLfloat *lengths, | |||
const GLubyte mask[], | |||
GLvector3f *dest ) | |||
{ | |||
GLuint i; | |||
@@ -322,35 +293,30 @@ TAG(normalize_normals)( const GLmatrix *mat, | |||
GLuint count = in->count; | |||
GLfloat (*out)[3] = (GLfloat (*)[3])dest->start; | |||
(void) mat; | |||
(void) mask; | |||
(void) scale; | |||
if (lengths) { | |||
STRIDE_LOOP { | |||
CULL_CHECK { | |||
const GLfloat x = from[0], y = from[1], z = from[2]; | |||
GLfloat invlen = lengths[i]; | |||
out[i][0] = x * invlen; | |||
out[i][1] = y * invlen; | |||
out[i][2] = z * invlen; | |||
} | |||
const GLfloat x = from[0], y = from[1], z = from[2]; | |||
GLfloat invlen = lengths[i]; | |||
out[i][0] = x * invlen; | |||
out[i][1] = y * invlen; | |||
out[i][2] = z * invlen; | |||
} | |||
} | |||
else { | |||
STRIDE_LOOP { | |||
CULL_CHECK { | |||
const GLfloat x = from[0], y = from[1], z = from[2]; | |||
GLdouble len = x * x + y * y + z * z; | |||
if (len > 1e-50) { | |||
len = 1.0 / GL_SQRT(len); | |||
out[i][0] = (GLfloat) (x * len); | |||
out[i][1] = (GLfloat) (y * len); | |||
out[i][2] = (GLfloat) (z * len); | |||
} | |||
else { | |||
out[i][0] = x; | |||
out[i][1] = y; | |||
out[i][2] = z; | |||
} | |||
const GLfloat x = from[0], y = from[1], z = from[2]; | |||
GLdouble len = x * x + y * y + z * z; | |||
if (len > 1e-50) { | |||
len = 1.0 / GL_SQRT(len); | |||
out[i][0] = (GLfloat) (x * len); | |||
out[i][1] = (GLfloat) (y * len); | |||
out[i][2] = (GLfloat) (z * len); | |||
} | |||
else { | |||
out[i][0] = x; | |||
out[i][1] = y; | |||
out[i][2] = z; | |||
} | |||
} | |||
} | |||
@@ -363,7 +329,6 @@ TAG(rescale_normals)( const GLmatrix *mat, | |||
GLfloat scale, | |||
const GLvector3f *in, | |||
const GLfloat *lengths, | |||
const GLubyte mask[], | |||
GLvector3f *dest ) | |||
{ | |||
GLuint i; | |||
@@ -373,12 +338,8 @@ TAG(rescale_normals)( const GLmatrix *mat, | |||
GLfloat (*out)[3] = (GLfloat (*)[3])dest->start; | |||
(void) mat; | |||
(void) lengths; | |||
(void) mask; | |||
STRIDE_LOOP { | |||
CULL_CHECK { | |||
SCALE_SCALAR_3V( out[i], scale, from ); | |||
} | |||
SCALE_SCALAR_3V( out[i], scale, from ); | |||
} | |||
dest->count = in->count; | |||
} | |||
@@ -387,27 +348,27 @@ TAG(rescale_normals)( const GLmatrix *mat, | |||
static void _XFORMAPI | |||
TAG(init_c_norm_transform)( void ) | |||
{ | |||
_mesa_normal_tab[NORM_TRANSFORM_NO_ROT][IDX] = | |||
_mesa_normal_tab[NORM_TRANSFORM_NO_ROT] = | |||
TAG(transform_normals_no_rot); | |||
_mesa_normal_tab[NORM_TRANSFORM_NO_ROT | NORM_RESCALE][IDX] = | |||
_mesa_normal_tab[NORM_TRANSFORM_NO_ROT | NORM_RESCALE] = | |||
TAG(transform_rescale_normals_no_rot); | |||
_mesa_normal_tab[NORM_TRANSFORM_NO_ROT | NORM_NORMALIZE][IDX] = | |||
_mesa_normal_tab[NORM_TRANSFORM_NO_ROT | NORM_NORMALIZE] = | |||
TAG(transform_normalize_normals_no_rot); | |||
_mesa_normal_tab[NORM_TRANSFORM][IDX] = | |||
_mesa_normal_tab[NORM_TRANSFORM] = | |||
TAG(transform_normals); | |||
_mesa_normal_tab[NORM_TRANSFORM | NORM_RESCALE][IDX] = | |||
_mesa_normal_tab[NORM_TRANSFORM | NORM_RESCALE] = | |||
TAG(transform_rescale_normals); | |||
_mesa_normal_tab[NORM_TRANSFORM | NORM_NORMALIZE][IDX] = | |||
_mesa_normal_tab[NORM_TRANSFORM | NORM_NORMALIZE] = | |||
TAG(transform_normalize_normals); | |||
_mesa_normal_tab[NORM_RESCALE][IDX] = | |||
_mesa_normal_tab[NORM_RESCALE] = | |||
TAG(rescale_normals); | |||
_mesa_normal_tab[NORM_NORMALIZE][IDX] = | |||
_mesa_normal_tab[NORM_NORMALIZE] = | |||
TAG(normalize_normals); | |||
} |
@@ -1,4 +1,4 @@ | |||
/* $Id: m_xform.c,v 1.11 2001/03/12 00:48:41 gareth Exp $ */ | |||
/* $Id: m_xform.c,v 1.12 2001/03/30 14:44:43 gareth Exp $ */ | |||
/* | |||
* Mesa 3-D graphics library | |||
@@ -58,12 +58,10 @@ | |||
clip_func _mesa_clip_tab[5]; | |||
clip_func _mesa_clip_np_tab[5]; | |||
dotprod_func _mesa_dotprod_tab[2][5]; | |||
vec_copy_func _mesa_copy_tab[2][0x10]; | |||
normal_func _mesa_normal_tab[0xf][0x4]; | |||
transform_func **(_mesa_transform_tab[2]); | |||
static transform_func *cull_transform_tab[5]; | |||
static transform_func *raw_transform_tab[5]; | |||
dotprod_func _mesa_dotprod_tab[5]; | |||
vec_copy_func _mesa_copy_tab[0x10]; | |||
normal_func _mesa_normal_tab[0xf]; | |||
transform_func *_mesa_transform_tab[5]; | |||
/* Raw data format used for: | |||
@@ -72,14 +70,14 @@ static transform_func *raw_transform_tab[5]; | |||
* - Eye-to-clip transform (via the function above). | |||
* - Cliptesting | |||
* - And everything else too, if culling happens to be disabled. | |||
* | |||
* GH: It's used for everything now, as clipping/culling is done | |||
* elsewhere (most often by the driver itself). | |||
*/ | |||
#define TAG(x) x##_raw | |||
#define TAG2(x,y) x##y##_raw | |||
#define IDX 0 | |||
#define STRIDE_LOOP for (i=0;i<count;i++, STRIDE_F(from, stride)) | |||
#define LOOP for (i=0;i<n;i++) | |||
#define CULL_CHECK | |||
#define CLIP_CHECK | |||
#define TAG(x) x | |||
#define TAG2(x,y) x##y | |||
#define STRIDE_LOOP for ( i = 0 ; i < count ; i++, STRIDE_F(from, stride) ) | |||
#define LOOP for ( i = 0 ; i < n ; i++ ) | |||
#define ARGS | |||
#include "m_xform_tmp.h" | |||
#include "m_clip_tmp.h" | |||
@@ -89,44 +87,13 @@ static transform_func *raw_transform_tab[5]; | |||
#undef TAG | |||
#undef TAG2 | |||
#undef LOOP | |||
#undef CULL_CHECK | |||
#undef CLIP_CHECK | |||
#undef ARGS | |||
#undef IDX | |||
/* Culled data used for: | |||
* - texture transformations | |||
* - viewport map transformation | |||
* - normal transformations prior to lighting | |||
* - user cliptests | |||
*/ | |||
#define TAG(x) x##_masked | |||
#define TAG2(x,y) x##y##_masked | |||
#define IDX 1 | |||
#define STRIDE_LOOP for (i=0;i<count;i++, STRIDE_F(from, stride)) | |||
#define LOOP for (i=0;i<n;i++) | |||
#define CULL_CHECK if (mask[i]) | |||
#define CLIP_CHECK if ((mask[i] & flag) == 0) | |||
#define ARGS , const GLubyte mask[] | |||
#include "m_xform_tmp.h" | |||
#include "m_norm_tmp.h" | |||
#include "m_dotprod_tmp.h" | |||
#include "m_copy_tmp.h" | |||
#undef TAG | |||
#undef TAG2 | |||
#undef LOOP | |||
#undef CULL_CHECK | |||
#undef CLIP_CHECK | |||
#undef ARGS | |||
#undef IDX | |||
GLvector4f *_mesa_project_points( GLvector4f *proj_vec, | |||
const GLvector4f *clip_vec ) | |||
const GLvector4f *clip_vec ) | |||
{ | |||
const GLuint stride = clip_vec->stride; | |||
const GLfloat *from = (GLfloat *)clip_vec->start; | |||
@@ -224,18 +191,11 @@ void _mesa_transform_point_sz( GLfloat Q[4], const GLfloat M[16], | |||
void | |||
_math_init_transformation( void ) | |||
{ | |||
_mesa_transform_tab[0] = raw_transform_tab; | |||
_mesa_transform_tab[1] = cull_transform_tab; | |||
init_c_transformations_raw(); | |||
init_c_transformations_masked(); | |||
init_c_norm_transform_raw(); | |||
init_c_norm_transform_masked(); | |||
init_c_cliptest_raw(); | |||
init_copy0_raw(); | |||
init_copy0_masked(); | |||
init_dotprod_raw(); | |||
init_dotprod_masked(); | |||
init_c_transformations(); | |||
init_c_norm_transform(); | |||
init_c_cliptest(); | |||
init_copy0(); | |||
init_dotprod(); | |||
#ifdef DEBUG | |||
_math_test_all_transform_functions( "default" ); |
@@ -1,4 +1,4 @@ | |||
/* $Id: m_xform.h,v 1.9 2001/03/12 02:02:36 gareth Exp $ */ | |||
/* $Id: m_xform.h,v 1.10 2001/03/30 14:44:43 gareth Exp $ */ | |||
/* | |||
* Mesa 3-D graphics library | |||
@@ -143,12 +143,10 @@ typedef GLvector4f * (_XFORMAPIP clip_func)( GLvector4f *vClip, | |||
typedef void (*dotprod_func)( GLfloat *out, | |||
GLuint out_stride, | |||
CONST GLvector4f *coord_vec, | |||
CONST GLfloat plane[4], | |||
CONST GLubyte mask[]); | |||
CONST GLfloat plane[4] ); | |||
typedef void (*vec_copy_func)( GLvector4f *to, | |||
CONST GLvector4f *from, | |||
CONST GLubyte mask[]); | |||
CONST GLvector4f *from ); | |||
@@ -159,15 +157,14 @@ 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. | |||
*/ | |||
#define NORM_RESCALE 0x1 /* apply the scale factor */ | |||
#define NORM_NORMALIZE 0x2 /* normalize */ | |||
#define NORM_TRANSFORM 0x4 /* apply the transformation matrix */ | |||
#define NORM_RESCALE 0x1 /* apply the scale factor */ | |||
#define NORM_NORMALIZE 0x2 /* normalize */ | |||
#define NORM_TRANSFORM 0x4 /* apply the transformation matrix */ | |||
#define NORM_TRANSFORM_NO_ROT 0x8 /* apply the transformation matrix */ | |||
@@ -180,9 +177,7 @@ typedef void (_NORMAPIP normal_func)( CONST GLmatrix *mat, | |||
*/ | |||
typedef void (_XFORMAPIP transform_func)( GLvector4f *to_vec, | |||
CONST GLfloat m[16], | |||
CONST GLvector4f *from_vec, | |||
CONST GLubyte *clipmask, | |||
CONST GLubyte flag ); | |||
CONST GLvector4f *from_vec ); | |||
extern GLvector4f *_mesa_project_points( GLvector4f *to, | |||
@@ -197,17 +192,17 @@ extern void _mesa_transform_bounds2( GLubyte *orMask, GLubyte *andMask, | |||
CONST GLfloat src[][3] ); | |||
extern dotprod_func _mesa_dotprod_tab[2][5]; | |||
extern vec_copy_func _mesa_copy_tab[2][0x10]; | |||
extern vec_copy_func _mesa_copy_clean_tab[2][5]; | |||
extern dotprod_func _mesa_dotprod_tab[5]; | |||
extern vec_copy_func _mesa_copy_tab[0x10]; | |||
extern vec_copy_func _mesa_copy_clean_tab[5]; | |||
extern clip_func _mesa_clip_tab[5]; | |||
extern clip_func _mesa_clip_np_tab[5]; | |||
extern normal_func _mesa_normal_tab[0xf][0x4]; | |||
extern normal_func _mesa_normal_tab[0xf]; | |||
/* Use of 3 layers of linked 1-dimensional arrays to reduce | |||
/* Use of 2 layers of linked 1-dimensional arrays to reduce | |||
* cost of lookup. | |||
*/ | |||
extern transform_func **(_mesa_transform_tab[2]); | |||
extern transform_func *_mesa_transform_tab[5]; | |||
extern void _mesa_transform_point_sz( GLfloat Q[4], CONST GLfloat M[16], | |||
@@ -215,8 +210,8 @@ extern void _mesa_transform_point_sz( GLfloat Q[4], CONST GLfloat M[16], | |||
#define TransformRaw( to, mat, from ) \ | |||
( (*_mesa_transform_tab[0][(from)->size][(mat)->type])( to, (mat)->m, from, 0, 0 ), \ | |||
(to) ) | |||
( _mesa_transform_tab[(from)->size][(mat)->type]( to, (mat)->m, from ), \ | |||
(to) ) | |||
#endif |
@@ -1,4 +1,4 @@ | |||
/* $Id: m_xform_tmp.h,v 1.5 2001/03/12 02:02:36 gareth Exp $ */ | |||
/* $Id: m_xform_tmp.h,v 1.6 2001/03/30 14:44:43 gareth Exp $ */ | |||
/* | |||
* Mesa 3-D graphics library | |||
@@ -65,12 +65,16 @@ | |||
* cliped and/or culled vertices. | |||
*/ | |||
/* GH: Not any more -- it's easier (and faster) to just process the | |||
* entire vector. Clipping and culling are handled further down | |||
* the pipe, most often during or after the conversion to some | |||
* driver-specific vertex format. | |||
*/ | |||
static void _XFORMAPI | |||
TAG(transform_points1_general)( GLvector4f *to_vec, | |||
const GLfloat m[16], | |||
const GLvector4f *from_vec, | |||
const GLubyte *mask, | |||
const GLubyte flag ) | |||
const GLvector4f *from_vec ) | |||
{ | |||
const GLuint stride = from_vec->stride; | |||
GLfloat *from = from_vec->start; | |||
@@ -81,18 +85,13 @@ TAG(transform_points1_general)( GLvector4f *to_vec, | |||
const GLfloat m2 = m[2], m14 = m[14]; | |||
const GLfloat m3 = m[3], m15 = m[15]; | |||
GLuint i; | |||
(void) mask; | |||
(void) flag; | |||
STRIDE_LOOP { | |||
CLIP_CHECK { | |||
const GLfloat ox = from[0]; | |||
to[i][0] = m0 * ox + m12; | |||
to[i][1] = m1 * ox + m13; | |||
to[i][2] = m2 * ox + m14; | |||
to[i][3] = m3 * ox + m15; | |||
} | |||
const GLfloat ox = from[0]; | |||
to[i][0] = m0 * ox + m12; | |||
to[i][1] = m1 * ox + m13; | |||
to[i][2] = m2 * ox + m14; | |||
to[i][3] = m3 * ox + m15; | |||
} | |||
to_vec->size = 4; | |||
to_vec->flags |= VEC_SIZE_4; | |||
to_vec->count = from_vec->count; | |||
@@ -101,24 +100,17 @@ TAG(transform_points1_general)( GLvector4f *to_vec, | |||
static void _XFORMAPI | |||
TAG(transform_points1_identity)( GLvector4f *to_vec, | |||
const GLfloat m[16], | |||
const GLvector4f *from_vec, | |||
const GLubyte *mask, | |||
const GLubyte flag ) | |||
const GLvector4f *from_vec ) | |||
{ | |||
const GLuint stride = from_vec->stride; | |||
GLfloat *from = from_vec->start; | |||
GLuint count = from_vec->count; | |||
GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start; | |||
GLuint i; | |||
(void) mask; | |||
(void) flag; | |||
if (to_vec == from_vec) return; | |||
STRIDE_LOOP { | |||
CLIP_CHECK { | |||
to[i][0] = from[0]; | |||
} | |||
to[i][0] = from[0]; | |||
} | |||
to_vec->size = 1; | |||
to_vec->flags |= VEC_SIZE_1; | |||
to_vec->count = from_vec->count; | |||
@@ -127,9 +119,7 @@ TAG(transform_points1_identity)( GLvector4f *to_vec, | |||
static void _XFORMAPI | |||
TAG(transform_points1_2d)( GLvector4f *to_vec, | |||
const GLfloat m[16], | |||
const GLvector4f *from_vec, | |||
const GLubyte *mask, | |||
const GLubyte flag ) | |||
const GLvector4f *from_vec ) | |||
{ | |||
const GLuint stride = from_vec->stride; | |||
GLfloat *from = from_vec->start; | |||
@@ -138,14 +128,10 @@ TAG(transform_points1_2d)( GLvector4f *to_vec, | |||
const GLfloat m0 = m[0], m1 = m[1]; | |||
const GLfloat m12 = m[12], m13 = m[13]; | |||
GLuint i; | |||
(void) mask; | |||
(void) flag; | |||
STRIDE_LOOP { | |||
CLIP_CHECK { | |||
const GLfloat ox = from[0]; | |||
to[i][0] = m0 * ox + m12; | |||
to[i][1] = m1 * ox + m13; | |||
} | |||
const GLfloat ox = from[0]; | |||
to[i][0] = m0 * ox + m12; | |||
to[i][1] = m1 * ox + m13; | |||
} | |||
to_vec->size = 2; | |||
to_vec->flags |= VEC_SIZE_2; | |||
@@ -155,9 +141,7 @@ TAG(transform_points1_2d)( GLvector4f *to_vec, | |||
static void _XFORMAPI | |||
TAG(transform_points1_2d_no_rot)( GLvector4f *to_vec, | |||
const GLfloat m[16], | |||
const GLvector4f *from_vec, | |||
const GLubyte *mask, | |||
const GLubyte flag ) | |||
const GLvector4f *from_vec ) | |||
{ | |||
const GLuint stride = from_vec->stride; | |||
GLfloat *from = from_vec->start; | |||
@@ -165,16 +149,11 @@ TAG(transform_points1_2d_no_rot)( GLvector4f *to_vec, | |||
GLuint count = from_vec->count; | |||
const GLfloat m0 = m[0], m12 = m[12], m13 = m[13]; | |||
GLuint i; | |||
(void) mask; | |||
(void) flag; | |||
STRIDE_LOOP { | |||
CLIP_CHECK { | |||
const GLfloat ox = from[0]; | |||
to[i][0] = m0 * ox + m12; | |||
to[i][1] = m13; | |||
} | |||
const GLfloat ox = from[0]; | |||
to[i][0] = m0 * ox + m12; | |||
to[i][1] = m13; | |||
} | |||
to_vec->size = 2; | |||
to_vec->flags |= VEC_SIZE_2; | |||
to_vec->count = from_vec->count; | |||
@@ -183,9 +162,7 @@ TAG(transform_points1_2d_no_rot)( GLvector4f *to_vec, | |||
static void _XFORMAPI | |||
TAG(transform_points1_3d)( GLvector4f *to_vec, | |||
const GLfloat m[16], | |||
const GLvector4f *from_vec, | |||
const GLubyte *mask, | |||
const GLubyte flag ) | |||
const GLvector4f *from_vec ) | |||
{ | |||
const GLuint stride = from_vec->stride; | |||
GLfloat *from = from_vec->start; | |||
@@ -194,15 +171,11 @@ TAG(transform_points1_3d)( GLvector4f *to_vec, | |||
const GLfloat m0 = m[0], m1 = m[1], m2 = m[2]; | |||
const GLfloat m12 = m[12], m13 = m[13], m14 = m[14]; | |||
GLuint i; | |||
(void) mask; | |||
(void) flag; | |||
STRIDE_LOOP { | |||
CLIP_CHECK { | |||
const GLfloat ox = from[0]; | |||
to[i][0] = m0 * ox + m12; | |||
to[i][1] = m1 * ox + m13; | |||
to[i][2] = m2 * ox + m14; | |||
} | |||
const GLfloat ox = from[0]; | |||
to[i][0] = m0 * ox + m12; | |||
to[i][1] = m1 * ox + m13; | |||
to[i][2] = m2 * ox + m14; | |||
} | |||
to_vec->size = 3; | |||
to_vec->flags |= VEC_SIZE_3; | |||
@@ -213,9 +186,7 @@ TAG(transform_points1_3d)( GLvector4f *to_vec, | |||
static void _XFORMAPI | |||
TAG(transform_points1_3d_no_rot)( GLvector4f *to_vec, | |||
const GLfloat m[16], | |||
const GLvector4f *from_vec, | |||
const GLubyte *mask, | |||
const GLubyte flag ) | |||
const GLvector4f *from_vec ) | |||
{ | |||
const GLuint stride = from_vec->stride; | |||
GLfloat *from = from_vec->start; | |||
@@ -224,15 +195,11 @@ TAG(transform_points1_3d_no_rot)( GLvector4f *to_vec, | |||
const GLfloat m0 = m[0]; | |||
const GLfloat m12 = m[12], m13 = m[13], m14 = m[14]; | |||
GLuint i; | |||
(void) mask; | |||
(void) flag; | |||
STRIDE_LOOP { | |||
CLIP_CHECK { | |||
const GLfloat ox = from[0]; | |||
to[i][0] = m0 * ox + m12; | |||
to[i][1] = m13; | |||
to[i][2] = m14; | |||
} | |||
const GLfloat ox = from[0]; | |||
to[i][0] = m0 * ox + m12; | |||
to[i][1] = m13; | |||
to[i][2] = m14; | |||
} | |||
to_vec->size = 3; | |||
to_vec->flags |= VEC_SIZE_3; | |||
@@ -242,9 +209,7 @@ TAG(transform_points1_3d_no_rot)( GLvector4f *to_vec, | |||
static void _XFORMAPI | |||
TAG(transform_points1_perspective)( GLvector4f *to_vec, | |||
const GLfloat m[16], | |||
const GLvector4f *from_vec, | |||
const GLubyte *mask, | |||
const GLubyte flag ) | |||
const GLvector4f *from_vec ) | |||
{ | |||
const GLuint stride = from_vec->stride; | |||
GLfloat *from = from_vec->start; | |||
@@ -252,16 +217,12 @@ TAG(transform_points1_perspective)( GLvector4f *to_vec, | |||
GLuint count = from_vec->count; | |||
const GLfloat m0 = m[0], m14 = m[14]; | |||
GLuint i; | |||
(void) mask; | |||
(void) flag; | |||
STRIDE_LOOP { | |||
CLIP_CHECK { | |||
const GLfloat ox = from[0]; | |||
to[i][0] = m0 * ox ; | |||
to[i][1] = 0 ; | |||
to[i][2] = m14; | |||
to[i][3] = 0; | |||
} | |||
const GLfloat ox = from[0]; | |||
to[i][0] = m0 * ox ; | |||
to[i][1] = 0 ; | |||
to[i][2] = m14; | |||
to[i][3] = 0; | |||
} | |||
to_vec->size = 4; | |||
to_vec->flags |= VEC_SIZE_4; | |||
@@ -278,9 +239,7 @@ TAG(transform_points1_perspective)( GLvector4f *to_vec, | |||
static void _XFORMAPI | |||
TAG(transform_points2_general)( GLvector4f *to_vec, | |||
const GLfloat m[16], | |||
const GLvector4f *from_vec, | |||
const GLubyte *mask, | |||
const GLubyte flag ) | |||
const GLvector4f *from_vec ) | |||
{ | |||
const GLuint stride = from_vec->stride; | |||
GLfloat *from = from_vec->start; | |||
@@ -291,16 +250,12 @@ TAG(transform_points2_general)( GLvector4f *to_vec, | |||
const GLfloat m2 = m[2], m6 = m[6], m14 = m[14]; | |||
const GLfloat m3 = m[3], m7 = m[7], m15 = m[15]; | |||
GLuint i; | |||
(void) mask; | |||
(void) flag; | |||
STRIDE_LOOP { | |||
CLIP_CHECK { | |||
const GLfloat ox = from[0], oy = from[1]; | |||
to[i][0] = m0 * ox + m4 * oy + m12; | |||
to[i][1] = m1 * ox + m5 * oy + m13; | |||
to[i][2] = m2 * ox + m6 * oy + m14; | |||
to[i][3] = m3 * ox + m7 * oy + m15; | |||
} | |||
const GLfloat ox = from[0], oy = from[1]; | |||
to[i][0] = m0 * ox + m4 * oy + m12; | |||
to[i][1] = m1 * ox + m5 * oy + m13; | |||
to[i][2] = m2 * ox + m6 * oy + m14; | |||
to[i][3] = m3 * ox + m7 * oy + m15; | |||
} | |||
to_vec->size = 4; | |||
to_vec->flags |= VEC_SIZE_4; | |||
@@ -310,23 +265,17 @@ TAG(transform_points2_general)( GLvector4f *to_vec, | |||
static void _XFORMAPI | |||
TAG(transform_points2_identity)( GLvector4f *to_vec, | |||
const GLfloat m[16], | |||
const GLvector4f *from_vec, | |||
const GLubyte *mask, | |||
const GLubyte flag ) | |||
const GLvector4f *from_vec ) | |||
{ | |||
const GLuint stride = from_vec->stride; | |||
GLfloat *from = from_vec->start; | |||
GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start; | |||
GLuint count = from_vec->count; | |||
GLuint i; | |||
(void) mask; | |||
(void) flag; | |||
if (to_vec == from_vec) return; | |||
STRIDE_LOOP { | |||
CLIP_CHECK { | |||
to[i][0] = from[0]; | |||
to[i][1] = from[1]; | |||
} | |||
to[i][0] = from[0]; | |||
to[i][1] = from[1]; | |||
} | |||
to_vec->size = 2; | |||
to_vec->flags |= VEC_SIZE_2; | |||
@@ -336,9 +285,7 @@ TAG(transform_points2_identity)( GLvector4f *to_vec, | |||
static void _XFORMAPI | |||
TAG(transform_points2_2d)( GLvector4f *to_vec, | |||
const GLfloat m[16], | |||
const GLvector4f *from_vec, | |||
const GLubyte *mask, | |||
const GLubyte flag ) | |||
const GLvector4f *from_vec ) | |||
{ | |||
const GLuint stride = from_vec->stride; | |||
GLfloat *from = from_vec->start; | |||
@@ -347,16 +294,11 @@ TAG(transform_points2_2d)( GLvector4f *to_vec, | |||
const GLfloat m0 = m[0], m1 = m[1], m4 = m[4], m5 = m[5]; | |||
const GLfloat m12 = m[12], m13 = m[13]; | |||
GLuint i; | |||
(void) mask; | |||
(void) flag; | |||
STRIDE_LOOP { | |||
CLIP_CHECK { | |||
const GLfloat ox = from[0], oy = from[1]; | |||
to[i][0] = m0 * ox + m4 * oy + m12; | |||
to[i][1] = m1 * ox + m5 * oy + m13; | |||
} | |||
const GLfloat ox = from[0], oy = from[1]; | |||
to[i][0] = m0 * ox + m4 * oy + m12; | |||
to[i][1] = m1 * ox + m5 * oy + m13; | |||
} | |||
to_vec->size = 2; | |||
to_vec->flags |= VEC_SIZE_2; | |||
to_vec->count = from_vec->count; | |||
@@ -365,9 +307,7 @@ TAG(transform_points2_2d)( GLvector4f *to_vec, | |||
static void _XFORMAPI | |||
TAG(transform_points2_2d_no_rot)( GLvector4f *to_vec, | |||
const GLfloat m[16], | |||
const GLvector4f *from_vec, | |||
const GLubyte *mask, | |||
const GLubyte flag ) | |||
const GLvector4f *from_vec ) | |||
{ | |||
const GLuint stride = from_vec->stride; | |||
GLfloat *from = from_vec->start; | |||
@@ -375,16 +315,11 @@ TAG(transform_points2_2d_no_rot)( GLvector4f *to_vec, | |||
GLuint count = from_vec->count; | |||
const GLfloat m0 = m[0], m5 = m[5], m12 = m[12], m13 = m[13]; | |||
GLuint i; | |||
(void) mask; | |||
(void) flag; | |||
STRIDE_LOOP { | |||
CLIP_CHECK { | |||
const GLfloat ox = from[0], oy = from[1]; | |||
to[i][0] = m0 * ox + m12; | |||
to[i][1] = m5 * oy + m13; | |||
} | |||
const GLfloat ox = from[0], oy = from[1]; | |||
to[i][0] = m0 * ox + m12; | |||
to[i][1] = m5 * oy + m13; | |||
} | |||
to_vec->size = 2; | |||
to_vec->flags |= VEC_SIZE_2; | |||
to_vec->count = from_vec->count; | |||
@@ -393,9 +328,7 @@ TAG(transform_points2_2d_no_rot)( GLvector4f *to_vec, | |||
static void _XFORMAPI | |||
TAG(transform_points2_3d)( GLvector4f *to_vec, | |||
const GLfloat m[16], | |||
const GLvector4f *from_vec, | |||
const GLubyte *mask, | |||
const GLubyte flag ) | |||
const GLvector4f *from_vec ) | |||
{ | |||
const GLuint stride = from_vec->stride; | |||
GLfloat *from = from_vec->start; | |||
@@ -404,15 +337,11 @@ TAG(transform_points2_3d)( GLvector4f *to_vec, | |||
const GLfloat m0 = m[0], m1 = m[1], m2 = m[2], m4 = m[4], m5 = m[5]; | |||
const GLfloat m6 = m[6], m12 = m[12], m13 = m[13], m14 = m[14]; | |||
GLuint i; | |||
(void) mask; | |||
(void) flag; | |||
STRIDE_LOOP { | |||
CLIP_CHECK { | |||
const GLfloat ox = from[0], oy = from[1]; | |||
to[i][0] = m0 * ox + m4 * oy + m12; | |||
to[i][1] = m1 * ox + m5 * oy + m13; | |||
to[i][2] = m2 * ox + m6 * oy + m14; | |||
} | |||
const GLfloat ox = from[0], oy = from[1]; | |||
to[i][0] = m0 * ox + m4 * oy + m12; | |||
to[i][1] = m1 * ox + m5 * oy + m13; | |||
to[i][2] = m2 * ox + m6 * oy + m14; | |||
} | |||
to_vec->size = 3; | |||
to_vec->flags |= VEC_SIZE_3; | |||
@@ -426,9 +355,7 @@ TAG(transform_points2_3d)( GLvector4f *to_vec, | |||
static void _XFORMAPI | |||
TAG(transform_points2_3d_no_rot)( GLvector4f *to_vec, | |||
const GLfloat m[16], | |||
const GLvector4f *from_vec, | |||
const GLubyte *mask, | |||
const GLubyte flag ) | |||
const GLvector4f *from_vec ) | |||
{ | |||
const GLuint stride = from_vec->stride; | |||
GLfloat *from = from_vec->start; | |||
@@ -437,15 +364,11 @@ TAG(transform_points2_3d_no_rot)( GLvector4f *to_vec, | |||
const GLfloat m0 = m[0], m5 = m[5]; | |||
const GLfloat m12 = m[12], m13 = m[13], m14 = m[14]; | |||
GLuint i; | |||
(void) mask; | |||
(void) flag; | |||
STRIDE_LOOP { | |||
CLIP_CHECK { | |||
const GLfloat ox = from[0], oy = from[1]; | |||
to[i][0] = m0 * ox + m12; | |||
to[i][1] = m5 * oy + m13; | |||
to[i][2] = m14; | |||
} | |||
const GLfloat ox = from[0], oy = from[1]; | |||
to[i][0] = m0 * ox + m12; | |||
to[i][1] = m5 * oy + m13; | |||
to[i][2] = m14; | |||
} | |||
if (m14 == 0) { | |||
to_vec->size = 2; | |||
@@ -461,9 +384,7 @@ TAG(transform_points2_3d_no_rot)( GLvector4f *to_vec, | |||
static void _XFORMAPI | |||
TAG(transform_points2_perspective)( GLvector4f *to_vec, | |||
const GLfloat m[16], | |||
const GLvector4f *from_vec, | |||
const GLubyte *mask, | |||
const GLubyte flag ) | |||
const GLvector4f *from_vec ) | |||
{ | |||
const GLuint stride = from_vec->stride; | |||
GLfloat *from = from_vec->start; | |||
@@ -471,16 +392,12 @@ TAG(transform_points2_perspective)( GLvector4f *to_vec, | |||
GLuint count = from_vec->count; | |||
const GLfloat m0 = m[0], m5 = m[5], m14 = m[14]; | |||
GLuint i; | |||
(void) mask; | |||
(void) flag; | |||
STRIDE_LOOP { | |||
CLIP_CHECK { | |||
const GLfloat ox = from[0], oy = from[1]; | |||
to[i][0] = m0 * ox ; | |||
to[i][1] = m5 * oy ; | |||
to[i][2] = m14; | |||
to[i][3] = 0; | |||
} | |||
const GLfloat ox = from[0], oy = from[1]; | |||
to[i][0] = m0 * ox ; | |||
to[i][1] = m5 * oy ; | |||
to[i][2] = m14; | |||
to[i][3] = 0; | |||
} | |||
to_vec->size = 4; | |||
to_vec->flags |= VEC_SIZE_4; | |||
@@ -492,9 +409,7 @@ TAG(transform_points2_perspective)( GLvector4f *to_vec, | |||
static void _XFORMAPI | |||
TAG(transform_points3_general)( GLvector4f *to_vec, | |||
const GLfloat m[16], | |||
const GLvector4f *from_vec, | |||
const GLubyte *mask, | |||
const GLubyte flag ) | |||
const GLvector4f *from_vec ) | |||
{ | |||
const GLuint stride = from_vec->stride; | |||
GLfloat *from = from_vec->start; | |||
@@ -505,16 +420,12 @@ TAG(transform_points3_general)( GLvector4f *to_vec, | |||
const GLfloat m2 = m[2], m6 = m[6], m10 = m[10], m14 = m[14]; | |||
const GLfloat m3 = m[3], m7 = m[7], m11 = m[11], m15 = m[15]; | |||
GLuint i; | |||
(void) mask; | |||
(void) flag; | |||
STRIDE_LOOP { | |||
CLIP_CHECK { | |||
const GLfloat ox = from[0], oy = from[1], oz = from[2]; | |||
to[i][0] = m0 * ox + m4 * oy + m8 * oz + m12; | |||
to[i][1] = m1 * ox + m5 * oy + m9 * oz + m13; | |||
to[i][2] = m2 * ox + m6 * oy + m10 * oz + m14; | |||
to[i][3] = m3 * ox + m7 * oy + m11 * oz + m15; | |||
} | |||
const GLfloat ox = from[0], oy = from[1], oz = from[2]; | |||
to[i][0] = m0 * ox + m4 * oy + m8 * oz + m12; | |||
to[i][1] = m1 * ox + m5 * oy + m9 * oz + m13; | |||
to[i][2] = m2 * ox + m6 * oy + m10 * oz + m14; | |||
to[i][3] = m3 * ox + m7 * oy + m11 * oz + m15; | |||
} | |||
to_vec->size = 4; | |||
to_vec->flags |= VEC_SIZE_4; | |||
@@ -524,24 +435,18 @@ TAG(transform_points3_general)( GLvector4f *to_vec, | |||
static void _XFORMAPI | |||
TAG(transform_points3_identity)( GLvector4f *to_vec, | |||
const GLfloat m[16], | |||
const GLvector4f *from_vec, | |||
const GLubyte *mask, | |||
const GLubyte flag ) | |||
const GLvector4f *from_vec ) | |||
{ | |||
const GLuint stride = from_vec->stride; | |||
GLfloat *from = from_vec->start; | |||
GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start; | |||
GLuint count = from_vec->count; | |||
GLuint i; | |||
(void) mask; | |||
(void) flag; | |||
if (to_vec == from_vec) return; | |||
STRIDE_LOOP { | |||
CLIP_CHECK { | |||
to[i][0] = from[0]; | |||
to[i][1] = from[1]; | |||
to[i][2] = from[2]; | |||
} | |||
to[i][0] = from[0]; | |||
to[i][1] = from[1]; | |||
to[i][2] = from[2]; | |||
} | |||
to_vec->size = 3; | |||
to_vec->flags |= VEC_SIZE_3; | |||
@@ -551,9 +456,7 @@ TAG(transform_points3_identity)( GLvector4f *to_vec, | |||
static void _XFORMAPI | |||
TAG(transform_points3_2d)( GLvector4f *to_vec, | |||
const GLfloat m[16], | |||
const GLvector4f *from_vec, | |||
const GLubyte *mask, | |||
const GLubyte flag ) | |||
const GLvector4f *from_vec ) | |||
{ | |||
const GLuint stride = from_vec->stride; | |||
GLfloat *from = from_vec->start; | |||
@@ -562,15 +465,11 @@ TAG(transform_points3_2d)( GLvector4f *to_vec, | |||
const GLfloat m0 = m[0], m1 = m[1], m4 = m[4], m5 = m[5]; | |||
const GLfloat m12 = m[12], m13 = m[13]; | |||
GLuint i; | |||
(void) mask; | |||
(void) flag; | |||
STRIDE_LOOP { | |||
CLIP_CHECK { | |||
const GLfloat ox = from[0], oy = from[1], oz = from[2]; | |||
to[i][0] = m0 * ox + m4 * oy + m12 ; | |||
to[i][1] = m1 * ox + m5 * oy + m13 ; | |||
to[i][2] = + oz ; | |||
} | |||
const GLfloat ox = from[0], oy = from[1], oz = from[2]; | |||
to[i][0] = m0 * ox + m4 * oy + m12 ; | |||
to[i][1] = m1 * ox + m5 * oy + m13 ; | |||
to[i][2] = + oz ; | |||
} | |||
to_vec->size = 3; | |||
to_vec->flags |= VEC_SIZE_3; | |||
@@ -580,9 +479,7 @@ TAG(transform_points3_2d)( GLvector4f *to_vec, | |||
static void _XFORMAPI | |||
TAG(transform_points3_2d_no_rot)( GLvector4f *to_vec, | |||
const GLfloat m[16], | |||
const GLvector4f *from_vec, | |||
const GLubyte *mask, | |||
const GLubyte flag ) | |||
const GLvector4f *from_vec ) | |||
{ | |||
const GLuint stride = from_vec->stride; | |||
GLfloat *from = from_vec->start; | |||
@@ -590,15 +487,11 @@ TAG(transform_points3_2d_no_rot)( GLvector4f *to_vec, | |||
GLuint count = from_vec->count; | |||
const GLfloat m0 = m[0], m5 = m[5], m12 = m[12], m13 = m[13]; | |||
GLuint i; | |||
(void) mask; | |||
(void) flag; | |||
STRIDE_LOOP { | |||
CLIP_CHECK { | |||
const GLfloat ox = from[0], oy = from[1], oz = from[2]; | |||
to[i][0] = m0 * ox + m12 ; | |||
to[i][1] = m5 * oy + m13 ; | |||
to[i][2] = + oz ; | |||
} | |||
const GLfloat ox = from[0], oy = from[1], oz = from[2]; | |||
to[i][0] = m0 * ox + m12 ; | |||
to[i][1] = m5 * oy + m13 ; | |||
to[i][2] = + oz ; | |||
} | |||
to_vec->size = 3; | |||
to_vec->flags |= VEC_SIZE_3; | |||
@@ -608,9 +501,7 @@ TAG(transform_points3_2d_no_rot)( GLvector4f *to_vec, | |||
static void _XFORMAPI | |||
TAG(transform_points3_3d)( GLvector4f *to_vec, | |||
const GLfloat m[16], | |||
const GLvector4f *from_vec, | |||
const GLubyte *mask, | |||
const GLubyte flag ) | |||
const GLvector4f *from_vec ) | |||
{ | |||
const GLuint stride = from_vec->stride; | |||
GLfloat *from = from_vec->start; | |||
@@ -620,15 +511,11 @@ TAG(transform_points3_3d)( GLvector4f *to_vec, | |||
const GLfloat m6 = m[6], m8 = m[8], m9 = m[9], m10 = m[10]; | |||
const GLfloat m12 = m[12], m13 = m[13], m14 = m[14]; | |||
GLuint i; | |||
(void) mask; | |||
(void) flag; | |||
STRIDE_LOOP { | |||
CLIP_CHECK { | |||
const GLfloat ox = from[0], oy = from[1], oz = from[2]; | |||
to[i][0] = m0 * ox + m4 * oy + m8 * oz + m12 ; | |||
to[i][1] = m1 * ox + m5 * oy + m9 * oz + m13 ; | |||
to[i][2] = m2 * ox + m6 * oy + m10 * oz + m14 ; | |||
} | |||
const GLfloat ox = from[0], oy = from[1], oz = from[2]; | |||
to[i][0] = m0 * ox + m4 * oy + m8 * oz + m12 ; | |||
to[i][1] = m1 * ox + m5 * oy + m9 * oz + m13 ; | |||
to[i][2] = m2 * ox + m6 * oy + m10 * oz + m14 ; | |||
} | |||
to_vec->size = 3; | |||
to_vec->flags |= VEC_SIZE_3; | |||
@@ -640,9 +527,7 @@ TAG(transform_points3_3d)( GLvector4f *to_vec, | |||
static void _XFORMAPI | |||
TAG(transform_points3_3d_no_rot)( GLvector4f *to_vec, | |||
const GLfloat m[16], | |||
const GLvector4f *from_vec, | |||
const GLubyte *mask, | |||
const GLubyte flag ) | |||
const GLvector4f *from_vec ) | |||
{ | |||
const GLuint stride = from_vec->stride; | |||
GLfloat *from = from_vec->start; | |||
@@ -651,15 +536,11 @@ TAG(transform_points3_3d_no_rot)( GLvector4f *to_vec, | |||
const GLfloat m0 = m[0], m5 = m[5]; | |||
const GLfloat m10 = m[10], m12 = m[12], m13 = m[13], m14 = m[14]; | |||
GLuint i; | |||
(void) mask; | |||
(void) flag; | |||
STRIDE_LOOP { | |||
CLIP_CHECK { | |||
const GLfloat ox = from[0], oy = from[1], oz = from[2]; | |||
to[i][0] = m0 * ox + m12 ; | |||
to[i][1] = m5 * oy + m13 ; | |||
to[i][2] = m10 * oz + m14 ; | |||
} | |||
const GLfloat ox = from[0], oy = from[1], oz = from[2]; | |||
to[i][0] = m0 * ox + m12 ; | |||
to[i][1] = m5 * oy + m13 ; | |||
to[i][2] = m10 * oz + m14 ; | |||
} | |||
to_vec->size = 3; | |||
to_vec->flags |= VEC_SIZE_3; | |||
@@ -669,9 +550,7 @@ TAG(transform_points3_3d_no_rot)( GLvector4f *to_vec, | |||
static void _XFORMAPI | |||
TAG(transform_points3_perspective)( GLvector4f *to_vec, | |||
const GLfloat m[16], | |||
const GLvector4f *from_vec, | |||
const GLubyte *mask, | |||
const GLubyte flag ) | |||
const GLvector4f *from_vec ) | |||
{ | |||
const GLuint stride = from_vec->stride; | |||
GLfloat *from = from_vec->start; | |||
@@ -680,16 +559,12 @@ TAG(transform_points3_perspective)( GLvector4f *to_vec, | |||
const GLfloat m0 = m[0], m5 = m[5], m8 = m[8], m9 = m[9]; | |||
const GLfloat m10 = m[10], m14 = m[14]; | |||
GLuint i; | |||
(void) mask; | |||
(void) flag; | |||
STRIDE_LOOP { | |||
CLIP_CHECK { | |||
const GLfloat ox = from[0], oy = from[1], oz = from[2]; | |||
to[i][0] = m0 * ox + m8 * oz ; | |||
to[i][1] = m5 * oy + m9 * oz ; | |||
to[i][2] = m10 * oz + m14 ; | |||
to[i][3] = -oz ; | |||
} | |||
const GLfloat ox = from[0], oy = from[1], oz = from[2]; | |||
to[i][0] = m0 * ox + m8 * oz ; | |||
to[i][1] = m5 * oy + m9 * oz ; | |||
to[i][2] = m10 * oz + m14 ; | |||
to[i][3] = -oz ; | |||
} | |||
to_vec->size = 4; | |||
to_vec->flags |= VEC_SIZE_4; | |||
@@ -701,9 +576,7 @@ TAG(transform_points3_perspective)( GLvector4f *to_vec, | |||
static void _XFORMAPI | |||
TAG(transform_points4_general)( GLvector4f *to_vec, | |||
const GLfloat m[16], | |||
const GLvector4f *from_vec, | |||
const GLubyte *mask, | |||
const GLubyte flag ) | |||
const GLvector4f *from_vec ) | |||
{ | |||
const GLuint stride = from_vec->stride; | |||
GLfloat *from = from_vec->start; | |||
@@ -714,16 +587,12 @@ TAG(transform_points4_general)( GLvector4f *to_vec, | |||
const GLfloat m2 = m[2], m6 = m[6], m10 = m[10], m14 = m[14]; | |||
const GLfloat m3 = m[3], m7 = m[7], m11 = m[11], m15 = m[15]; | |||
GLuint i; | |||
(void) mask; | |||
(void) flag; | |||
STRIDE_LOOP { | |||
CLIP_CHECK { | |||
const GLfloat ox = from[0], oy = from[1], oz = from[2], ow = from[3]; | |||
to[i][0] = m0 * ox + m4 * oy + m8 * oz + m12 * ow; | |||
to[i][1] = m1 * ox + m5 * oy + m9 * oz + m13 * ow; | |||
to[i][2] = m2 * ox + m6 * oy + m10 * oz + m14 * ow; | |||
to[i][3] = m3 * ox + m7 * oy + m11 * oz + m15 * ow; | |||
} | |||
const GLfloat ox = from[0], oy = from[1], oz = from[2], ow = from[3]; | |||
to[i][0] = m0 * ox + m4 * oy + m8 * oz + m12 * ow; | |||
to[i][1] = m1 * ox + m5 * oy + m9 * oz + m13 * ow; | |||
to[i][2] = m2 * ox + m6 * oy + m10 * oz + m14 * ow; | |||
to[i][3] = m3 * ox + m7 * oy + m11 * oz + m15 * ow; | |||
} | |||
to_vec->size = 4; | |||
to_vec->flags |= VEC_SIZE_4; | |||
@@ -733,25 +602,19 @@ TAG(transform_points4_general)( GLvector4f *to_vec, | |||
static void _XFORMAPI | |||
TAG(transform_points4_identity)( GLvector4f *to_vec, | |||
const GLfloat m[16], | |||
const GLvector4f *from_vec, | |||
const GLubyte *mask, | |||
const GLubyte flag ) | |||
const GLvector4f *from_vec ) | |||
{ | |||
const GLuint stride = from_vec->stride; | |||
GLfloat *from = from_vec->start; | |||
GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start; | |||
GLuint count = from_vec->count; | |||
GLuint i; | |||
(void) mask; | |||
(void) flag; | |||
if (to_vec == from_vec) return; | |||
STRIDE_LOOP { | |||
CLIP_CHECK { | |||
to[i][0] = from[0]; | |||
to[i][1] = from[1]; | |||
to[i][2] = from[2]; | |||
to[i][3] = from[3]; | |||
} | |||
to[i][0] = from[0]; | |||
to[i][1] = from[1]; | |||
to[i][2] = from[2]; | |||
to[i][3] = from[3]; | |||
} | |||
to_vec->size = 4; | |||
to_vec->flags |= VEC_SIZE_4; | |||
@@ -761,9 +624,7 @@ TAG(transform_points4_identity)( GLvector4f *to_vec, | |||
static void _XFORMAPI | |||
TAG(transform_points4_2d)( GLvector4f *to_vec, | |||
const GLfloat m[16], | |||
const GLvector4f *from_vec, | |||
const GLubyte *mask, | |||
const GLubyte flag ) | |||
const GLvector4f *from_vec ) | |||
{ | |||
const GLuint stride = from_vec->stride; | |||
GLfloat *from = from_vec->start; | |||
@@ -772,16 +633,12 @@ TAG(transform_points4_2d)( GLvector4f *to_vec, | |||
const GLfloat m0 = m[0], m1 = m[1], m4 = m[4], m5 = m[5]; | |||
const GLfloat m12 = m[12], m13 = m[13]; | |||
GLuint i; | |||
(void) mask; | |||
(void) flag; | |||
STRIDE_LOOP { | |||
CLIP_CHECK { | |||
const GLfloat ox = from[0], oy = from[1], oz = from[2], ow = from[3]; | |||
to[i][0] = m0 * ox + m4 * oy + m12 * ow; | |||
to[i][1] = m1 * ox + m5 * oy + m13 * ow; | |||
to[i][2] = + oz ; | |||
to[i][3] = ow; | |||
} | |||
const GLfloat ox = from[0], oy = from[1], oz = from[2], ow = from[3]; | |||
to[i][0] = m0 * ox + m4 * oy + m12 * ow; | |||
to[i][1] = m1 * ox + m5 * oy + m13 * ow; | |||
to[i][2] = + oz ; | |||
to[i][3] = ow; | |||
} | |||
to_vec->size = 4; | |||
to_vec->flags |= VEC_SIZE_4; | |||
@@ -791,9 +648,7 @@ TAG(transform_points4_2d)( GLvector4f *to_vec, | |||
static void _XFORMAPI | |||
TAG(transform_points4_2d_no_rot)( GLvector4f *to_vec, | |||
const GLfloat m[16], | |||
const GLvector4f *from_vec, | |||
const GLubyte *mask, | |||
const GLubyte flag ) | |||
const GLvector4f *from_vec ) | |||
{ | |||
const GLuint stride = from_vec->stride; | |||
GLfloat *from = from_vec->start; | |||
@@ -801,16 +656,12 @@ TAG(transform_points4_2d_no_rot)( GLvector4f *to_vec, | |||
GLuint count = from_vec->count; | |||
const GLfloat m0 = m[0], m5 = m[5], m12 = m[12], m13 = m[13]; | |||
GLuint i; | |||
(void) mask; | |||
(void) flag; | |||
STRIDE_LOOP { | |||
CLIP_CHECK { | |||
const GLfloat ox = from[0], oy = from[1], oz = from[2], ow = from[3]; | |||
to[i][0] = m0 * ox + m12 * ow; | |||
to[i][1] = m5 * oy + m13 * ow; | |||
to[i][2] = + oz ; | |||
to[i][3] = ow; | |||
} | |||
const GLfloat ox = from[0], oy = from[1], oz = from[2], ow = from[3]; | |||
to[i][0] = m0 * ox + m12 * ow; | |||
to[i][1] = m5 * oy + m13 * ow; | |||
to[i][2] = + oz ; | |||
to[i][3] = ow; | |||
} | |||
to_vec->size = 4; | |||
to_vec->flags |= VEC_SIZE_4; | |||
@@ -820,9 +671,7 @@ TAG(transform_points4_2d_no_rot)( GLvector4f *to_vec, | |||
static void _XFORMAPI | |||
TAG(transform_points4_3d)( GLvector4f *to_vec, | |||
const GLfloat m[16], | |||
const GLvector4f *from_vec, | |||
const GLubyte *mask, | |||
const GLubyte flag ) | |||
const GLvector4f *from_vec ) | |||
{ | |||
const GLuint stride = from_vec->stride; | |||
GLfloat *from = from_vec->start; | |||
@@ -832,16 +681,12 @@ TAG(transform_points4_3d)( GLvector4f *to_vec, | |||
const GLfloat m6 = m[6], m8 = m[8], m9 = m[9], m10 = m[10]; | |||
const GLfloat m12 = m[12], m13 = m[13], m14 = m[14]; | |||
GLuint i; | |||
(void) mask; | |||
(void) flag; | |||
STRIDE_LOOP { | |||
CLIP_CHECK { | |||
const GLfloat ox = from[0], oy = from[1], oz = from[2], ow = from[3]; | |||
to[i][0] = m0 * ox + m4 * oy + m8 * oz + m12 * ow; | |||
to[i][1] = m1 * ox + m5 * oy + m9 * oz + m13 * ow; | |||
to[i][2] = m2 * ox + m6 * oy + m10 * oz + m14 * ow; | |||
to[i][3] = ow; | |||
} | |||
const GLfloat ox = from[0], oy = from[1], oz = from[2], ow = from[3]; | |||
to[i][0] = m0 * ox + m4 * oy + m8 * oz + m12 * ow; | |||
to[i][1] = m1 * ox + m5 * oy + m9 * oz + m13 * ow; | |||
to[i][2] = m2 * ox + m6 * oy + m10 * oz + m14 * ow; | |||
to[i][3] = ow; | |||
} | |||
to_vec->size = 4; | |||
to_vec->flags |= VEC_SIZE_4; | |||
@@ -851,9 +696,7 @@ TAG(transform_points4_3d)( GLvector4f *to_vec, | |||
static void _XFORMAPI | |||
TAG(transform_points4_3d_no_rot)( GLvector4f *to_vec, | |||
const GLfloat m[16], | |||
const GLvector4f *from_vec, | |||
const GLubyte *mask, | |||
const GLubyte flag ) | |||
const GLvector4f *from_vec ) | |||
{ | |||
const GLuint stride = from_vec->stride; | |||
GLfloat *from = from_vec->start; | |||
@@ -862,16 +705,12 @@ TAG(transform_points4_3d_no_rot)( GLvector4f *to_vec, | |||
const GLfloat m0 = m[0], m5 = m[5]; | |||
const GLfloat m10 = m[10], m12 = m[12], m13 = m[13], m14 = m[14]; | |||
GLuint i; | |||
(void) mask; | |||
(void) flag; | |||
STRIDE_LOOP { | |||
CLIP_CHECK { | |||
const GLfloat ox = from[0], oy = from[1], oz = from[2], ow = from[3]; | |||
to[i][0] = m0 * ox + m12 * ow; | |||
to[i][1] = m5 * oy + m13 * ow; | |||
to[i][2] = m10 * oz + m14 * ow; | |||
to[i][3] = ow; | |||
} | |||
const GLfloat ox = from[0], oy = from[1], oz = from[2], ow = from[3]; | |||
to[i][0] = m0 * ox + m12 * ow; | |||
to[i][1] = m5 * oy + m13 * ow; | |||
to[i][2] = m10 * oz + m14 * ow; | |||
to[i][3] = ow; | |||
} | |||
to_vec->size = 4; | |||
to_vec->flags |= VEC_SIZE_4; | |||
@@ -881,9 +720,7 @@ TAG(transform_points4_3d_no_rot)( GLvector4f *to_vec, | |||
static void _XFORMAPI | |||
TAG(transform_points4_perspective)( GLvector4f *to_vec, | |||
const GLfloat m[16], | |||
const GLvector4f *from_vec, | |||
const GLubyte *mask, | |||
const GLubyte flag ) | |||
const GLvector4f *from_vec ) | |||
{ | |||
const GLuint stride = from_vec->stride; | |||
GLfloat *from = from_vec->start; | |||
@@ -892,18 +729,13 @@ TAG(transform_points4_perspective)( GLvector4f *to_vec, | |||
const GLfloat m0 = m[0], m5 = m[5], m8 = m[8], m9 = m[9]; | |||
const GLfloat m10 = m[10], m14 = m[14]; | |||
GLuint i; | |||
(void) mask; | |||
(void) flag; | |||
STRIDE_LOOP { | |||
CLIP_CHECK { | |||
const GLfloat ox = from[0], oy = from[1], oz = from[2], ow = from[3]; | |||
to[i][0] = m0 * ox + m8 * oz ; | |||
to[i][1] = m5 * oy + m9 * oz ; | |||
to[i][2] = m10 * oz + m14 * ow ; | |||
to[i][3] = -oz ; | |||
} | |||
const GLfloat ox = from[0], oy = from[1], oz = from[2], ow = from[3]; | |||
to[i][0] = m0 * ox + m8 * oz ; | |||
to[i][1] = m5 * oy + m9 * oz ; | |||
to[i][2] = m10 * oz + m14 * ow ; | |||
to[i][3] = -oz ; | |||
} | |||
to_vec->size = 4; | |||
to_vec->flags |= VEC_SIZE_4; | |||
to_vec->count = from_vec->count; | |||
@@ -920,7 +752,7 @@ static transform_func _XFORMAPI TAG(transform_tab_4)[7]; | |||
*/ | |||
static void _XFORMAPI TAG(init_c_transformations)( void ) | |||
{ | |||
#define TAG_TAB _mesa_transform_tab[IDX] | |||
#define TAG_TAB _mesa_transform_tab | |||
#define TAG_TAB_1 TAG(transform_tab_1) | |||
#define TAG_TAB_2 TAG(transform_tab_2) | |||
#define TAG_TAB_3 TAG(transform_tab_3) | |||
@@ -935,7 +767,7 @@ static void _XFORMAPI TAG(init_c_transformations)( void ) | |||
TAG_TAB_1[MATRIX_GENERAL] = TAG(transform_points1_general); | |||
TAG_TAB_1[MATRIX_IDENTITY] = TAG(transform_points1_identity); | |||
TAG_TAB_1[MATRIX_3D_NO_ROT] = TAG(transform_points1_3d_no_rot); | |||
TAG_TAB_1[MATRIX_PERSPECTIVE] = TAG(transform_points1_perspective) ; | |||
TAG_TAB_1[MATRIX_PERSPECTIVE] = TAG(transform_points1_perspective); | |||
TAG_TAB_1[MATRIX_2D] = TAG(transform_points1_2d); | |||
TAG_TAB_1[MATRIX_2D_NO_ROT] = TAG(transform_points1_2d_no_rot); | |||
TAG_TAB_1[MATRIX_3D] = TAG(transform_points1_3d); | |||
@@ -944,7 +776,7 @@ static void _XFORMAPI TAG(init_c_transformations)( void ) | |||
TAG_TAB_2[MATRIX_GENERAL] = TAG(transform_points2_general); | |||
TAG_TAB_2[MATRIX_IDENTITY] = TAG(transform_points2_identity); | |||
TAG_TAB_2[MATRIX_3D_NO_ROT] = TAG(transform_points2_3d_no_rot); | |||
TAG_TAB_2[MATRIX_PERSPECTIVE] = TAG(transform_points2_perspective) ; | |||
TAG_TAB_2[MATRIX_PERSPECTIVE] = TAG(transform_points2_perspective); | |||
TAG_TAB_2[MATRIX_2D] = TAG(transform_points2_2d); | |||
TAG_TAB_2[MATRIX_2D_NO_ROT] = TAG(transform_points2_2d_no_rot); | |||
TAG_TAB_2[MATRIX_3D] = TAG(transform_points2_3d); |
@@ -1,4 +1,4 @@ | |||
/* $Id: t_vb_fog.c,v 1.9 2001/03/19 02:25:37 keithw Exp $ */ | |||
/* $Id: t_vb_fog.c,v 1.10 2001/03/30 14:44:44 gareth Exp $ */ | |||
/* | |||
* Mesa 3-D graphics library | |||
@@ -160,8 +160,9 @@ static GLboolean run_fog_stage( GLcontext *ctx, | |||
/* Full eye coords weren't required, just calculate the | |||
* eye Z values. | |||
*/ | |||
_mesa_dotprod_tab[0][VB->ObjPtr->size](input->data, sizeof(GLfloat), | |||
VB->ObjPtr, plane, 0 ); | |||
_mesa_dotprod_tab[VB->ObjPtr->size]( input->data, | |||
sizeof(GLfloat), | |||
VB->ObjPtr, plane ); | |||
input->count = VB->ObjPtr->count; | |||
} |
@@ -1,4 +1,4 @@ | |||
/* $Id: t_vb_normals.c,v 1.7 2001/03/12 00:48:44 gareth Exp $ */ | |||
/* $Id: t_vb_normals.c,v 1.8 2001/03/30 14:44:44 gareth Exp $ */ | |||
/* | |||
* Mesa 3-D graphics library | |||
@@ -44,7 +44,7 @@ | |||
struct normal_stage_data { | |||
normal_func *NormalTransform; | |||
normal_func NormalTransform; | |||
GLvector3f normal; | |||
}; | |||
@@ -62,12 +62,11 @@ static GLboolean run_normal_stage( GLcontext *ctx, | |||
ASSERT(store->NormalTransform); | |||
if (stage->changed_inputs) | |||
(store->NormalTransform[0])(&ctx->ModelView, | |||
ctx->_ModelViewInvScale, | |||
VB->NormalPtr, | |||
0, | |||
0, | |||
&store->normal); | |||
store->NormalTransform( &ctx->ModelView, | |||
ctx->_ModelViewInvScale, | |||
VB->NormalPtr, | |||
0, | |||
&store->normal ); | |||
VB->NormalPtr = &store->normal; | |||
return GL_TRUE; | |||
@@ -75,7 +74,7 @@ static GLboolean run_normal_stage( GLcontext *ctx, | |||
static GLboolean run_validate_normal_stage( GLcontext *ctx, | |||
struct gl_pipeline_stage *stage) | |||
struct gl_pipeline_stage *stage ) | |||
{ | |||
struct normal_stage_data *store = NORMAL_STAGE_DATA(stage); | |||
@@ -1,4 +1,4 @@ | |||
/* $Id: t_vb_texgen.c,v 1.7 2001/03/29 21:16:26 keithw Exp $ */ | |||
/* $Id: t_vb_texgen.c,v 1.8 2001/03/30 14:44:44 gareth Exp $ */ | |||
/* | |||
* Mesa 3-D graphics library | |||
@@ -96,9 +96,9 @@ static GLuint all_bits[5] = { | |||
/* | |||
*/ | |||
static void build_m3(GLfloat f[][3], GLfloat m[], | |||
const GLvector3f *normal, | |||
const GLvector4f *eye ) | |||
static void build_m3( GLfloat f[][3], GLfloat m[], | |||
const GLvector3f *normal, | |||
const GLvector4f *eye ) | |||
{ | |||
GLuint stride = eye->stride; | |||
GLfloat *coord = (GLfloat *)eye->start; | |||
@@ -106,7 +106,6 @@ static void build_m3(GLfloat f[][3], GLfloat m[], | |||
const GLfloat *norm = normal->start; | |||
GLuint i; | |||
/* KW: Had to rearrange this loop to avoid a compiler bug with gcc | |||
* 2.7.3.1 at -O3 optimization. Using -fno-strength-reduce | |||
* also fixed the bug - is this generally necessary? | |||
@@ -130,9 +129,9 @@ static void build_m3(GLfloat f[][3], GLfloat m[], | |||
static void build_m2(GLfloat f[][3], GLfloat m[], | |||
const GLvector3f *normal, | |||
const GLvector4f *eye ) | |||
static void build_m2( GLfloat f[][3], GLfloat m[], | |||
const GLvector3f *normal, | |||
const GLvector4f *eye ) | |||
{ | |||
GLuint stride = eye->stride; | |||
GLfloat *coord = eye->start; | |||
@@ -162,11 +161,10 @@ static void build_m2(GLfloat f[][3], GLfloat m[], | |||
typedef void (*build_m_func)(GLfloat f[][3], | |||
GLfloat m[], | |||
const GLvector3f *normal, | |||
const GLvector4f *eye ); | |||
typedef void (*build_m_func)( GLfloat f[][3], | |||
GLfloat m[], | |||
const GLvector3f *normal, | |||
const GLvector4f *eye ); | |||
static build_m_func build_m_tab[5] = { | |||
@@ -275,7 +273,7 @@ static void texgen_reflection_map_nv( GLcontext *ctx, | |||
out->count = in->count; | |||
out->size = MAX2(in->size, 3); | |||
if (in->size == 4) | |||
_mesa_copy_tab[0][0x8](out, in, 0); | |||
_mesa_copy_tab[0x8]( out, in ); | |||
} | |||
else { | |||
out->flags |= VEC_SIZE_3; | |||
@@ -312,7 +310,7 @@ static void texgen_normal_map_nv( GLcontext *ctx, | |||
out->count = in->count; | |||
out->size = MAX2(in->size, 3); | |||
if (in->size == 4) | |||
_mesa_copy_tab[0][0x8](out, in, 0); | |||
_mesa_copy_tab[0x8]( out, in ); | |||
} | |||
else { | |||
out->flags |= VEC_SIZE_3; | |||
@@ -350,7 +348,7 @@ static void texgen_sphere_map( GLcontext *ctx, | |||
out->count = in->count; | |||
out->flags |= (in->flags & VEC_SIZE_FLAGS) | VEC_SIZE_2; | |||
if (in->size > 2) | |||
_mesa_copy_tab[0][all_bits[in->size] & ~0x3](out, in, 0); | |||
_mesa_copy_tab[all_bits[in->size] & ~0x3]( out, in ); | |||
} else { | |||
out->size = 2; | |||
out->flags |= VEC_SIZE_2; | |||
@@ -399,7 +397,7 @@ static void texgen( GLcontext *ctx, | |||
else { | |||
GLuint copy = (all_bits[in->size] & ~texUnit->TexGenEnabled); | |||
if (copy) | |||
_mesa_copy_tab[0][copy](out, in, 0); | |||
_mesa_copy_tab[copy]( out, in ); | |||
out->size = MAX2(in->size, store->TexgenSize[unit]); | |||
out->flags |= (in->flags & VEC_SIZE_FLAGS) | texUnit->TexGenEnabled; | |||
@@ -418,14 +416,14 @@ static void texgen( GLcontext *ctx, | |||
GLuint i; | |||
switch (texUnit->GenModeS) { | |||
case GL_OBJECT_LINEAR: | |||
(_mesa_dotprod_tab[0][obj->size])((GLfloat *)out->data, | |||
sizeof(out->data[0]), obj, | |||
texUnit->ObjectPlaneS, 0); | |||
_mesa_dotprod_tab[obj->size]( (GLfloat *)out->data, | |||
sizeof(out->data[0]), obj, | |||
texUnit->ObjectPlaneS ); | |||
break; | |||
case GL_EYE_LINEAR: | |||
(_mesa_dotprod_tab[0][eye->size])((GLfloat *)out->data, | |||
sizeof(out->data[0]), eye, | |||
texUnit->EyePlaneS, 0); | |||
_mesa_dotprod_tab[eye->size]( (GLfloat *)out->data, | |||
sizeof(out->data[0]), eye, | |||
texUnit->EyePlaneS ); | |||
break; | |||
case GL_SPHERE_MAP: | |||
for (indata=in->start,i=0 ; i<count ;i++, STRIDE_F(indata,in->stride)) | |||
@@ -451,14 +449,14 @@ static void texgen( GLcontext *ctx, | |||
GLuint i; | |||
switch (texUnit->GenModeT) { | |||
case GL_OBJECT_LINEAR: | |||
(_mesa_dotprod_tab[0][obj->size])(&(out->data[0][1]), | |||
sizeof(out->data[0]), obj, | |||
texUnit->ObjectPlaneT, 0); | |||
_mesa_dotprod_tab[obj->size]( &(out->data[0][1]), | |||
sizeof(out->data[0]), obj, | |||
texUnit->ObjectPlaneT ); | |||
break; | |||
case GL_EYE_LINEAR: | |||
(_mesa_dotprod_tab[0][eye->size])(&(out->data[0][1]), | |||
sizeof(out->data[0]), eye, | |||
texUnit->EyePlaneT, 0); | |||
_mesa_dotprod_tab[eye->size]( &(out->data[0][1]), | |||
sizeof(out->data[0]), eye, | |||
texUnit->EyePlaneT ); | |||
break; | |||
case GL_SPHERE_MAP: | |||
for (indata=in->start,i=0; i<count ;i++,STRIDE_F(indata,in->stride)) | |||
@@ -484,14 +482,14 @@ static void texgen( GLcontext *ctx, | |||
GLuint i; | |||
switch (texUnit->GenModeR) { | |||
case GL_OBJECT_LINEAR: | |||
(_mesa_dotprod_tab[0][obj->size])(&(out->data[0][2]), | |||
sizeof(out->data[0]), obj, | |||
texUnit->ObjectPlaneR, 0); | |||
_mesa_dotprod_tab[obj->size]( &(out->data[0][2]), | |||
sizeof(out->data[0]), obj, | |||
texUnit->ObjectPlaneR ); | |||
break; | |||
case GL_EYE_LINEAR: | |||
(_mesa_dotprod_tab[0][eye->size])(&(out->data[0][2]), | |||
sizeof(out->data[0]), eye, | |||
texUnit->EyePlaneR, 0); | |||
_mesa_dotprod_tab[eye->size]( &(out->data[0][2]), | |||
sizeof(out->data[0]), eye, | |||
texUnit->EyePlaneR ); | |||
break; | |||
case GL_REFLECTION_MAP_NV: | |||
for (i=0;i<count;i++) | |||
@@ -512,14 +510,14 @@ static void texgen( GLcontext *ctx, | |||
if (texUnit->TexGenEnabled & Q_BIT) { | |||
switch (texUnit->GenModeQ) { | |||
case GL_OBJECT_LINEAR: | |||
(_mesa_dotprod_tab[0][obj->size])(&(out->data[0][3]), | |||
sizeof(out->data[0]), obj, | |||
texUnit->ObjectPlaneQ, 0); | |||
_mesa_dotprod_tab[obj->size]( &(out->data[0][3]), | |||
sizeof(out->data[0]), obj, | |||
texUnit->ObjectPlaneQ ); | |||
break; | |||
case GL_EYE_LINEAR: | |||
(_mesa_dotprod_tab[0][eye->size])(&(out->data[0][3]), | |||
sizeof(out->data[0]), eye, | |||
texUnit->EyePlaneQ, 0); | |||
_mesa_dotprod_tab[eye->size]( &(out->data[0][3]), | |||
sizeof(out->data[0]), eye, | |||
texUnit->EyePlaneQ ); | |||
break; | |||
default: | |||
_mesa_problem(ctx, "Bad Q texgen"); |
@@ -1,4 +1,4 @@ | |||
/* $Id: 3dnow.c,v 1.18 2001/03/29 06:46:15 gareth Exp $ */ | |||
/* $Id: 3dnow.c,v 1.19 2001/03/30 14:44:43 gareth Exp $ */ | |||
/* | |||
* Mesa 3-D graphics library | |||
@@ -31,92 +31,18 @@ | |||
#include "glheader.h" | |||
#include "context.h" | |||
#include "mtypes.h" | |||
#include "3dnow.h" | |||
#include "math/m_vertices.h" | |||
#include "math/m_xform.h" | |||
#include "tnl/t_context.h" | |||
#include "3dnow.h" | |||
#include "common_x86_macros.h" | |||
#ifdef DEBUG | |||
#include "math/m_debug.h" | |||
#endif | |||
#define XFORM_ARGS GLvector4f *to_vec, \ | |||
const GLfloat m[16], \ | |||
const GLvector4f *from_vec, \ | |||
const GLubyte *mask, \ | |||
const GLubyte flag | |||
#define DECLARE_XFORM_GROUP( pfx, sz ) \ | |||
extern void _ASMAPI _mesa_##pfx##_transform_points##sz##_general( XFORM_ARGS ); \ | |||
extern void _ASMAPI _mesa_##pfx##_transform_points##sz##_identity( XFORM_ARGS ); \ | |||
extern void _ASMAPI _mesa_##pfx##_transform_points##sz##_3d_no_rot( XFORM_ARGS ); \ | |||
extern void _ASMAPI _mesa_##pfx##_transform_points##sz##_perspective( XFORM_ARGS ); \ | |||
extern void _ASMAPI _mesa_##pfx##_transform_points##sz##_2d( XFORM_ARGS ); \ | |||
extern void _ASMAPI _mesa_##pfx##_transform_points##sz##_2d_no_rot( XFORM_ARGS ); \ | |||
extern void _ASMAPI _mesa_##pfx##_transform_points##sz##_3d( XFORM_ARGS ); | |||
#define ASSIGN_XFORM_GROUP( pfx, sz ) \ | |||
_mesa_transform_tab[0][sz][MATRIX_GENERAL] = \ | |||
_mesa_##pfx##_transform_points##sz##_general; \ | |||
_mesa_transform_tab[0][sz][MATRIX_IDENTITY] = \ | |||
_mesa_##pfx##_transform_points##sz##_identity; \ | |||
_mesa_transform_tab[0][sz][MATRIX_3D_NO_ROT] = \ | |||
_mesa_##pfx##_transform_points##sz##_3d_no_rot; \ | |||
_mesa_transform_tab[0][sz][MATRIX_PERSPECTIVE] = \ | |||
_mesa_##pfx##_transform_points##sz##_perspective; \ | |||
_mesa_transform_tab[0][sz][MATRIX_2D] = \ | |||
_mesa_##pfx##_transform_points##sz##_2d; \ | |||
_mesa_transform_tab[0][sz][MATRIX_2D_NO_ROT] = \ | |||
_mesa_##pfx##_transform_points##sz##_2d_no_rot; \ | |||
_mesa_transform_tab[0][sz][MATRIX_3D] = \ | |||
_mesa_##pfx##_transform_points##sz##_3d; | |||
#define NORM_ARGS const GLmatrix *mat, \ | |||
GLfloat scale, \ | |||
const GLvector3f *in, \ | |||
const GLfloat *lengths, \ | |||
const GLubyte mask[], \ | |||
GLvector3f *dest | |||
#define DECLARE_NORM_GROUP( pfx ) \ | |||
extern void _ASMAPI _mesa_##pfx##_rescale_normals( NORM_ARGS ); \ | |||
extern void _ASMAPI _mesa_##pfx##_normalize_normals( NORM_ARGS ); \ | |||
extern void _ASMAPI _mesa_##pfx##_transform_normals( NORM_ARGS ); \ | |||
extern void _ASMAPI _mesa_##pfx##_transform_normals_no_rot( NORM_ARGS ); \ | |||
extern void _ASMAPI _mesa_##pfx##_transform_rescale_normals( NORM_ARGS ); \ | |||
extern void _ASMAPI _mesa_##pfx##_transform_rescale_normals_no_rot( NORM_ARGS ); \ | |||
extern void _ASMAPI _mesa_##pfx##_transform_normalize_normals( NORM_ARGS ); \ | |||
extern void _ASMAPI _mesa_##pfx##_transform_normalize_normals_no_rot( NORM_ARGS ); | |||
#define ASSIGN_NORM_GROUP( pfx ) \ | |||
_mesa_normal_tab[NORM_RESCALE][0] = \ | |||
_mesa_##pfx##_rescale_normals; \ | |||
_mesa_normal_tab[NORM_NORMALIZE][0] = \ | |||
_mesa_##pfx##_normalize_normals; \ | |||
_mesa_normal_tab[NORM_TRANSFORM][0] = \ | |||
_mesa_##pfx##_transform_normals; \ | |||
_mesa_normal_tab[NORM_TRANSFORM_NO_ROT][0] = \ | |||
_mesa_##pfx##_transform_normals_no_rot; \ | |||
_mesa_normal_tab[NORM_TRANSFORM|NORM_RESCALE][0] = \ | |||
_mesa_##pfx##_transform_rescale_normals; \ | |||
_mesa_normal_tab[NORM_TRANSFORM_NO_ROT|NORM_RESCALE][0] = \ | |||
_mesa_##pfx##_transform_rescale_normals_no_rot; \ | |||
_mesa_normal_tab[NORM_TRANSFORM|NORM_NORMALIZE][0] = \ | |||
_mesa_##pfx##_transform_normalize_normals; \ | |||
_mesa_normal_tab[NORM_TRANSFORM_NO_ROT|NORM_NORMALIZE][0] = \ | |||
_mesa_##pfx##_transform_normalize_normals_no_rot; | |||
#ifdef USE_3DNOW_ASM | |||
DECLARE_XFORM_GROUP( 3dnow, 2 ) | |||
DECLARE_XFORM_GROUP( 3dnow, 3 ) |
@@ -0,0 +1,107 @@ | |||
/* $Id: common_x86_macros.h,v 1.1 2001/03/30 14:44:43 gareth Exp $ */ | |||
/* | |||
* Mesa 3-D graphics library | |||
* Version: 3.5 | |||
* | |||
* Copyright (C) 1999-2001 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. | |||
* | |||
* Authors: | |||
* Gareth Hughes <gareth@valinux.com> | |||
*/ | |||
#ifndef __COMMON_X86_MACROS_H__ | |||
#define __COMMON_X86_MACROS_H__ | |||
/* ============================================================= | |||
* Transformation function declarations: | |||
*/ | |||
#define XFORM_ARGS GLvector4f *to_vec, \ | |||
const GLfloat m[16], \ | |||
const GLvector4f *from_vec | |||
#define DECLARE_XFORM_GROUP( pfx, sz ) \ | |||
extern void _ASMAPI _mesa_##pfx##_transform_points##sz##_general( XFORM_ARGS ); \ | |||
extern void _ASMAPI _mesa_##pfx##_transform_points##sz##_identity( XFORM_ARGS ); \ | |||
extern void _ASMAPI _mesa_##pfx##_transform_points##sz##_3d_no_rot( XFORM_ARGS ); \ | |||
extern void _ASMAPI _mesa_##pfx##_transform_points##sz##_perspective( XFORM_ARGS ); \ | |||
extern void _ASMAPI _mesa_##pfx##_transform_points##sz##_2d( XFORM_ARGS ); \ | |||
extern void _ASMAPI _mesa_##pfx##_transform_points##sz##_2d_no_rot( XFORM_ARGS ); \ | |||
extern void _ASMAPI _mesa_##pfx##_transform_points##sz##_3d( XFORM_ARGS ); | |||
#define ASSIGN_XFORM_GROUP( pfx, sz ) \ | |||
_mesa_transform_tab[sz][MATRIX_GENERAL] = \ | |||
_mesa_##pfx##_transform_points##sz##_general; \ | |||
_mesa_transform_tab[sz][MATRIX_IDENTITY] = \ | |||
_mesa_##pfx##_transform_points##sz##_identity; \ | |||
_mesa_transform_tab[sz][MATRIX_3D_NO_ROT] = \ | |||
_mesa_##pfx##_transform_points##sz##_3d_no_rot; \ | |||
_mesa_transform_tab[sz][MATRIX_PERSPECTIVE] = \ | |||
_mesa_##pfx##_transform_points##sz##_perspective; \ | |||
_mesa_transform_tab[sz][MATRIX_2D] = \ | |||
_mesa_##pfx##_transform_points##sz##_2d; \ | |||
_mesa_transform_tab[sz][MATRIX_2D_NO_ROT] = \ | |||
_mesa_##pfx##_transform_points##sz##_2d_no_rot; \ | |||
_mesa_transform_tab[sz][MATRIX_3D] = \ | |||
_mesa_##pfx##_transform_points##sz##_3d; | |||
/* ============================================================= | |||
* Normal transformation function declarations: | |||
*/ | |||
#define NORM_ARGS const GLmatrix *mat, \ | |||
GLfloat scale, \ | |||
const GLvector3f *in, \ | |||
const GLfloat *lengths, \ | |||
GLvector3f *dest | |||
#define DECLARE_NORM_GROUP( pfx ) \ | |||
extern void _ASMAPI _mesa_##pfx##_rescale_normals( NORM_ARGS ); \ | |||
extern void _ASMAPI _mesa_##pfx##_normalize_normals( NORM_ARGS ); \ | |||
extern void _ASMAPI _mesa_##pfx##_transform_normals( NORM_ARGS ); \ | |||
extern void _ASMAPI _mesa_##pfx##_transform_normals_no_rot( NORM_ARGS ); \ | |||
extern void _ASMAPI _mesa_##pfx##_transform_rescale_normals( NORM_ARGS ); \ | |||
extern void _ASMAPI _mesa_##pfx##_transform_rescale_normals_no_rot( NORM_ARGS ); \ | |||
extern void _ASMAPI _mesa_##pfx##_transform_normalize_normals( NORM_ARGS ); \ | |||
extern void _ASMAPI _mesa_##pfx##_transform_normalize_normals_no_rot( NORM_ARGS ); | |||
#define ASSIGN_NORM_GROUP( pfx ) \ | |||
_mesa_normal_tab[NORM_RESCALE] = \ | |||
_mesa_##pfx##_rescale_normals; \ | |||
_mesa_normal_tab[NORM_NORMALIZE] = \ | |||
_mesa_##pfx##_normalize_normals; \ | |||
_mesa_normal_tab[NORM_TRANSFORM] = \ | |||
_mesa_##pfx##_transform_normals; \ | |||
_mesa_normal_tab[NORM_TRANSFORM_NO_ROT] = \ | |||
_mesa_##pfx##_transform_normals_no_rot; \ | |||
_mesa_normal_tab[NORM_TRANSFORM | NORM_RESCALE] = \ | |||
_mesa_##pfx##_transform_rescale_normals; \ | |||
_mesa_normal_tab[NORM_TRANSFORM_NO_ROT | NORM_RESCALE] = \ | |||
_mesa_##pfx##_transform_rescale_normals_no_rot; \ | |||
_mesa_normal_tab[NORM_TRANSFORM | NORM_NORMALIZE] = \ | |||
_mesa_##pfx##_transform_normalize_normals; \ | |||
_mesa_normal_tab[NORM_TRANSFORM_NO_ROT | NORM_NORMALIZE] = \ | |||
_mesa_##pfx##_transform_normalize_normals_no_rot; | |||
#endif |
@@ -1,4 +1,4 @@ | |||
/* $Id: norm_args.h,v 1.1 2001/03/28 20:44:44 gareth Exp $ */ | |||
/* $Id: norm_args.h,v 1.2 2001/03/30 14:44:43 gareth Exp $ */ | |||
/* | |||
* Mesa 3-D graphics library | |||
@@ -41,21 +41,18 @@ | |||
* GLfloat scale, | |||
* CONST GLvector3f *in, | |||
* CONST GLfloat lengths[], | |||
* CONST GLubyte mask[], | |||
* GLvector3f *dest ); | |||
*/ | |||
#define OFFSET_MAT 4 | |||
#define OFFSET_SCALE 8 | |||
#define OFFSET_IN 12 | |||
#define OFFSET_LENGTHS 16 | |||
#define OFFSET_MASK 20 | |||
#define OFFSET_DEST 24 | |||
#define OFFSET_DEST 20 | |||
#define ARG_MAT REGOFF(FRAME_OFFSET+OFFSET_MAT, ESP) | |||
#define ARG_SCALE REGOFF(FRAME_OFFSET+OFFSET_SCALE, ESP) | |||
#define ARG_IN REGOFF(FRAME_OFFSET+OFFSET_IN, ESP) | |||
#define ARG_LENGTHS REGOFF(FRAME_OFFSET+OFFSET_LENGTHS, ESP) | |||
#define ARG_MASK REGOFF(FRAME_OFFSET+OFFSET_MASK, ESP) | |||
#define ARG_DEST REGOFF(FRAME_OFFSET+OFFSET_DEST, ESP) | |||
#endif |
@@ -1,4 +1,4 @@ | |||
/* $Id: sse.c,v 1.1 2001/03/29 06:46:16 gareth Exp $ */ | |||
/* $Id: sse.c,v 1.2 2001/03/30 14:44:43 gareth Exp $ */ | |||
/* | |||
* Mesa 3-D graphics library | |||
@@ -31,92 +31,18 @@ | |||
#include "glheader.h" | |||
#include "context.h" | |||
#include "mtypes.h" | |||
#include "sse.h" | |||
#include "math/m_vertices.h" | |||
#include "math/m_xform.h" | |||
#include "tnl/t_context.h" | |||
#include "sse.h" | |||
#include "common_x86_macros.h" | |||
#ifdef DEBUG | |||
#include "math/m_debug.h" | |||
#endif | |||
#define XFORM_ARGS GLvector4f *to_vec, \ | |||
const GLfloat m[16], \ | |||
const GLvector4f *from_vec, \ | |||
const GLubyte *mask, \ | |||
const GLubyte flag | |||
#define DECLARE_XFORM_GROUP( pfx, sz ) \ | |||
extern void _ASMAPI _mesa_##pfx##_transform_points##sz##_general( XFORM_ARGS ); \ | |||
extern void _ASMAPI _mesa_##pfx##_transform_points##sz##_identity( XFORM_ARGS ); \ | |||
extern void _ASMAPI _mesa_##pfx##_transform_points##sz##_3d_no_rot( XFORM_ARGS ); \ | |||
extern void _ASMAPI _mesa_##pfx##_transform_points##sz##_perspective( XFORM_ARGS ); \ | |||
extern void _ASMAPI _mesa_##pfx##_transform_points##sz##_2d( XFORM_ARGS ); \ | |||
extern void _ASMAPI _mesa_##pfx##_transform_points##sz##_2d_no_rot( XFORM_ARGS ); \ | |||
extern void _ASMAPI _mesa_##pfx##_transform_points##sz##_3d( XFORM_ARGS ); | |||
#define ASSIGN_XFORM_GROUP( pfx, sz ) \ | |||
_mesa_transform_tab[0][sz][MATRIX_GENERAL] = \ | |||
_mesa_##pfx##_transform_points##sz##_general; \ | |||
_mesa_transform_tab[0][sz][MATRIX_IDENTITY] = \ | |||
_mesa_##pfx##_transform_points##sz##_identity; \ | |||
_mesa_transform_tab[0][sz][MATRIX_3D_NO_ROT] = \ | |||
_mesa_##pfx##_transform_points##sz##_3d_no_rot; \ | |||
_mesa_transform_tab[0][sz][MATRIX_PERSPECTIVE] = \ | |||
_mesa_##pfx##_transform_points##sz##_perspective; \ | |||
_mesa_transform_tab[0][sz][MATRIX_2D] = \ | |||
_mesa_##pfx##_transform_points##sz##_2d; \ | |||
_mesa_transform_tab[0][sz][MATRIX_2D_NO_ROT] = \ | |||
_mesa_##pfx##_transform_points##sz##_2d_no_rot; \ | |||
_mesa_transform_tab[0][sz][MATRIX_3D] = \ | |||
_mesa_##pfx##_transform_points##sz##_3d; | |||
#define NORM_ARGS const GLmatrix *mat, \ | |||
GLfloat scale, \ | |||
const GLvector3f *in, \ | |||
const GLfloat *lengths, \ | |||
const GLubyte mask[], \ | |||
GLvector3f *dest | |||
#define DECLARE_NORM_GROUP( pfx ) \ | |||
extern void _ASMAPI _mesa_##pfx##_rescale_normals( NORM_ARGS ); \ | |||
extern void _ASMAPI _mesa_##pfx##_normalize_normals( NORM_ARGS ); \ | |||
extern void _ASMAPI _mesa_##pfx##_transform_normals( NORM_ARGS ); \ | |||
extern void _ASMAPI _mesa_##pfx##_transform_normals_no_rot( NORM_ARGS ); \ | |||
extern void _ASMAPI _mesa_##pfx##_transform_rescale_normals( NORM_ARGS ); \ | |||
extern void _ASMAPI _mesa_##pfx##_transform_rescale_normals_no_rot( NORM_ARGS ); \ | |||
extern void _ASMAPI _mesa_##pfx##_transform_normalize_normals( NORM_ARGS ); \ | |||
extern void _ASMAPI _mesa_##pfx##_transform_normalize_normals_no_rot( NORM_ARGS ); | |||
#define ASSIGN_NORM_GROUP( pfx ) \ | |||
_mesa_normal_tab[NORM_RESCALE][0] = \ | |||
_mesa_##pfx##_rescale_normals; \ | |||
_mesa_normal_tab[NORM_NORMALIZE][0] = \ | |||
_mesa_##pfx##_normalize_normals; \ | |||
_mesa_normal_tab[NORM_TRANSFORM][0] = \ | |||
_mesa_##pfx##_transform_normals; \ | |||
_mesa_normal_tab[NORM_TRANSFORM_NO_ROT][0] = \ | |||
_mesa_##pfx##_transform_normals_no_rot; \ | |||
_mesa_normal_tab[NORM_TRANSFORM|NORM_RESCALE][0] = \ | |||
_mesa_##pfx##_transform_rescale_normals; \ | |||
_mesa_normal_tab[NORM_TRANSFORM_NO_ROT|NORM_RESCALE][0] = \ | |||
_mesa_##pfx##_transform_rescale_normals_no_rot; \ | |||
_mesa_normal_tab[NORM_TRANSFORM|NORM_NORMALIZE][0] = \ | |||
_mesa_##pfx##_transform_normalize_normals; \ | |||
_mesa_normal_tab[NORM_TRANSFORM_NO_ROT|NORM_NORMALIZE][0] = \ | |||
_mesa_##pfx##_transform_normalize_normals_no_rot; | |||
#ifdef USE_SSE_ASM | |||
DECLARE_XFORM_GROUP( sse, 2 ) | |||
DECLARE_XFORM_GROUP( sse, 3 ) | |||
@@ -166,20 +92,22 @@ void _mesa_init_sse_transform_asm( void ) | |||
#if 1 | |||
/* TODO: Finish these off. | |||
*/ | |||
_mesa_normal_tab[NORM_TRANSFORM_NO_ROT][0] = | |||
_mesa_sse_transform_normals_no_rot; | |||
_mesa_normal_tab[NORM_TRANSFORM|NORM_RESCALE][0] = | |||
_mesa_sse_transform_rescale_normals; | |||
_mesa_normal_tab[NORM_TRANSFORM_NO_ROT|NORM_RESCALE][0] = | |||
_mesa_sse_transform_rescale_normals_no_rot; | |||
_mesa_transform_tab[0][4][MATRIX_GENERAL] = | |||
_mesa_transform_tab[4][MATRIX_GENERAL] = | |||
_mesa_sse_transform_points4_general; | |||
_mesa_transform_tab[0][4][MATRIX_3D] = | |||
_mesa_transform_tab[4][MATRIX_3D] = | |||
_mesa_sse_transform_points4_3d; | |||
_mesa_transform_tab[0][4][MATRIX_IDENTITY] = | |||
_mesa_transform_tab[4][MATRIX_IDENTITY] = | |||
_mesa_sse_transform_points4_identity; | |||
_mesa_normal_tab[NORM_TRANSFORM_NO_ROT] = | |||
_mesa_sse_transform_normals_no_rot; | |||
_mesa_normal_tab[NORM_TRANSFORM | NORM_RESCALE] = | |||
_mesa_sse_transform_rescale_normals; | |||
_mesa_normal_tab[NORM_TRANSFORM_NO_ROT | NORM_RESCALE] = | |||
_mesa_sse_transform_rescale_normals_no_rot; | |||
#else | |||
ASSIGN_XFORM_GROUP( sse, 4 ); | |||
ASSIGN_NORM_GROUP( sse ); | |||
#endif | |||
@@ -1,4 +1,4 @@ | |||
/* $Id: x86.c,v 1.20 2001/03/29 06:46:27 gareth Exp $ */ | |||
/* $Id: x86.c,v 1.21 2001/03/30 14:44:43 gareth Exp $ */ | |||
/* | |||
* Mesa 3-D graphics library | |||
@@ -30,53 +30,18 @@ | |||
#include "glheader.h" | |||
#include "context.h" | |||
#include "mtypes.h" | |||
#include "x86.h" | |||
#include "math/m_vertices.h" | |||
#include "math/m_xform.h" | |||
#include "tnl/t_context.h" | |||
#include "x86.h" | |||
#include "common_x86_macros.h" | |||
#ifdef DEBUG | |||
#include "math/m_debug.h" | |||
#endif | |||
#define XFORM_ARGS GLvector4f *to_vec, \ | |||
const GLfloat m[16], \ | |||
const GLvector4f *from_vec, \ | |||
const GLubyte *mask, \ | |||
const GLubyte flag | |||
#define DECLARE_XFORM_GROUP( pfx, sz ) \ | |||
extern void _ASMAPI _mesa_##pfx##_transform_points##sz##_general( XFORM_ARGS ); \ | |||
extern void _ASMAPI _mesa_##pfx##_transform_points##sz##_identity( XFORM_ARGS ); \ | |||
extern void _ASMAPI _mesa_##pfx##_transform_points##sz##_3d_no_rot( XFORM_ARGS ); \ | |||
extern void _ASMAPI _mesa_##pfx##_transform_points##sz##_perspective( XFORM_ARGS ); \ | |||
extern void _ASMAPI _mesa_##pfx##_transform_points##sz##_2d( XFORM_ARGS ); \ | |||
extern void _ASMAPI _mesa_##pfx##_transform_points##sz##_2d_no_rot( XFORM_ARGS ); \ | |||
extern void _ASMAPI _mesa_##pfx##_transform_points##sz##_3d( XFORM_ARGS ); | |||
#define ASSIGN_XFORM_GROUP( pfx, sz ) \ | |||
_mesa_transform_tab[0][sz][MATRIX_GENERAL] = \ | |||
_mesa_##pfx##_transform_points##sz##_general; \ | |||
_mesa_transform_tab[0][sz][MATRIX_IDENTITY] = \ | |||
_mesa_##pfx##_transform_points##sz##_identity; \ | |||
_mesa_transform_tab[0][sz][MATRIX_3D_NO_ROT] = \ | |||
_mesa_##pfx##_transform_points##sz##_3d_no_rot; \ | |||
_mesa_transform_tab[0][sz][MATRIX_PERSPECTIVE] = \ | |||
_mesa_##pfx##_transform_points##sz##_perspective; \ | |||
_mesa_transform_tab[0][sz][MATRIX_2D] = \ | |||
_mesa_##pfx##_transform_points##sz##_2d; \ | |||
_mesa_transform_tab[0][sz][MATRIX_2D_NO_ROT] = \ | |||
_mesa_##pfx##_transform_points##sz##_2d_no_rot; \ | |||
_mesa_transform_tab[0][sz][MATRIX_3D] = \ | |||
_mesa_##pfx##_transform_points##sz##_3d; | |||
#ifdef USE_X86_ASM | |||
DECLARE_XFORM_GROUP( x86, 2 ) | |||
DECLARE_XFORM_GROUP( x86, 3 ) |
@@ -1,4 +1,4 @@ | |||
/* $Id: xform_args.h,v 1.3 2001/03/28 20:44:44 gareth Exp $ */ | |||
/* $Id: xform_args.h,v 1.4 2001/03/30 14:44:43 gareth Exp $ */ | |||
/* | |||
* Mesa 3-D graphics library | |||
@@ -39,20 +39,14 @@ | |||
* | |||
* typedef void (*transform_func)( GLvector4f *to_vec, | |||
* const GLfloat m[16], | |||
* const GLvector4f *from_vec, | |||
* const GLubyte *clipmask, | |||
* const GLubyte flag ); | |||
* const GLvector4f *from_vec ); | |||
*/ | |||
#define OFFSET_DEST 4 | |||
#define OFFSET_MATRIX 8 | |||
#define OFFSET_SOURCE 12 | |||
#define OFFSET_CLIP 16 | |||
#define OFFSET_FLAG 20 | |||
#define ARG_DEST REGOFF(FRAME_OFFSET+OFFSET_DEST, ESP) | |||
#define ARG_MATRIX REGOFF(FRAME_OFFSET+OFFSET_MATRIX, ESP) | |||
#define ARG_SOURCE REGOFF(FRAME_OFFSET+OFFSET_SOURCE, ESP) | |||
#define ARG_CLIP REGOFF(FRAME_OFFSET+OFFSET_CLIP, ESP) | |||
#define ARG_FLAG REGOFF(FRAME_OFFSET+OFFSET_FLAG, ESP) | |||
#endif |