1 /* $Id: m_dotprod_tmp.h,v 1.1 2000/11/16 21:05:41 keithw Exp $ */
4 * Mesa 3-D graphics library
7 * Copyright (C) 1999 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
)( GLvector4f
*out_vec
,
36 const GLvector4f
*coord_vec
,
37 const GLfloat plane
[4],
40 GLuint stride
= coord_vec
->stride
;
41 GLfloat
*coord
= coord_vec
->start
;
42 GLuint count
= coord_vec
->count
;
44 GLuint outstride
= out_vec
->stride
;
45 GLfloat
*out
= out_vec
->start
+ elt
;
48 const GLfloat plane0
= plane
[0], plane1
= plane
[1], plane3
= plane
[3];
52 for (i
=0;i
<count
;i
++,STRIDE_F(coord
,stride
),STRIDE_F(out
,outstride
)) {
54 *out
= (coord
[0] * plane0
+
59 out_vec
->count
= coord_vec
->count
;
62 static void TAG(dotprod_vec3
)( GLvector4f
*out_vec
,
64 const GLvector4f
*coord_vec
,
65 const GLfloat plane
[4],
68 GLuint stride
= coord_vec
->stride
;
69 GLfloat
*coord
= coord_vec
->start
;
70 GLuint count
= coord_vec
->count
;
72 GLuint outstride
= out_vec
->stride
;
73 GLfloat
*out
= out_vec
->start
+ elt
;
76 const GLfloat plane0
= plane
[0], plane1
= plane
[1], plane2
= plane
[2];
77 const GLfloat plane3
= plane
[3];
81 for (i
=0;i
<count
;i
++,STRIDE_F(coord
,stride
),STRIDE_F(out
,outstride
)) {
83 *out
= (coord
[0] * plane0
+
89 out_vec
->count
= coord_vec
->count
;
92 static void TAG(dotprod_vec4
)( GLvector4f
*out_vec
,
94 const GLvector4f
*coord_vec
,
95 const GLfloat plane
[4],
98 GLuint stride
= coord_vec
->stride
;
99 GLfloat
*coord
= coord_vec
->start
;
100 GLuint count
= coord_vec
->count
;
102 GLuint outstride
= out_vec
->stride
;
103 GLfloat
*out
= out_vec
->start
+ elt
;
106 const GLfloat plane0
= plane
[0], plane1
= plane
[1], plane2
= plane
[2];
107 const GLfloat plane3
= plane
[3];
111 for (i
=0;i
<count
;i
++,STRIDE_F(coord
,stride
),STRIDE_F(out
,outstride
)) {
113 *out
= (coord
[0] * plane0
+
119 out_vec
->count
= coord_vec
->count
;
123 static void TAG(init_dotprod
)( void )
125 gl_dotprod_tab
[IDX
&1][2] = TAG(dotprod_vec2
);
126 gl_dotprod_tab
[IDX
&1][3] = TAG(dotprod_vec3
);
127 gl_dotprod_tab
[IDX
&1][4] = TAG(dotprod_vec4
);