1 /* $Id: m_dotprod_tmp.h,v 1.6 2001/03/30 14:44:43 gareth Exp $ */
4 * Mesa 3-D graphics library
7 * Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
9 * Permission is hereby granted, free of charge, to any person obtaining a
10 * copy of this software and associated documentation files (the "Software"),
11 * to deal in the Software without restriction, including without limitation
12 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
13 * and/or sell copies of the Software, and to permit persons to whom the
14 * Software is furnished to do so, subject to the following conditions:
16 * The above copyright notice and this permission notice shall be included
17 * in all copies or substantial portions of the Software.
19 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
20 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
22 * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
23 * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
24 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
28 * New (3.1) transformation code written by Keith Whitwell.
32 /* Note - respects the stride of the output vector.
34 static void TAG(dotprod_vec2
)( GLfloat
*out
,
36 const GLvector4f
*coord_vec
,
37 const GLfloat plane
[4] )
39 GLuint stride
= coord_vec
->stride
;
40 GLfloat
*coord
= coord_vec
->start
;
41 GLuint count
= coord_vec
->count
;
45 const GLfloat plane0
= plane
[0], plane1
= plane
[1], plane3
= plane
[3];
47 for (i
=0;i
<count
;i
++,STRIDE_F(coord
,stride
),STRIDE_F(out
,outstride
)) {
48 *out
= (coord
[0] * plane0
+
54 static void TAG(dotprod_vec3
)( GLfloat
*out
,
56 const GLvector4f
*coord_vec
,
57 const GLfloat plane
[4] )
59 GLuint stride
= coord_vec
->stride
;
60 GLfloat
*coord
= coord_vec
->start
;
61 GLuint count
= coord_vec
->count
;
65 const GLfloat plane0
= plane
[0], plane1
= plane
[1], plane2
= plane
[2];
66 const GLfloat plane3
= plane
[3];
68 for (i
=0;i
<count
;i
++,STRIDE_F(coord
,stride
),STRIDE_F(out
,outstride
)) {
69 *out
= (coord
[0] * plane0
+
76 static void TAG(dotprod_vec4
)( GLfloat
*out
,
78 const GLvector4f
*coord_vec
,
79 const GLfloat plane
[4] )
81 GLuint stride
= coord_vec
->stride
;
82 GLfloat
*coord
= coord_vec
->start
;
83 GLuint count
= coord_vec
->count
;
86 const GLfloat plane0
= plane
[0], plane1
= plane
[1], plane2
= plane
[2];
87 const GLfloat plane3
= plane
[3];
89 for (i
=0;i
<count
;i
++,STRIDE_F(coord
,stride
),STRIDE_F(out
,outstride
)) {
90 *out
= (coord
[0] * plane0
+
98 static void TAG(init_dotprod
)( void )
100 _mesa_dotprod_tab
[2] = TAG(dotprod_vec2
);
101 _mesa_dotprod_tab
[3] = TAG(dotprod_vec3
);
102 _mesa_dotprod_tab
[4] = TAG(dotprod_vec4
);