1 /* $Id: m_dotprod_tmp.h,v 1.4 2001/03/12 00:48:41 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],
40 GLuint stride = coord_vec->stride;
41 GLfloat *coord = coord_vec->start;
42 GLuint count = coord_vec->count;
46 const GLfloat plane0 = plane[0], plane1 = plane[1], plane3 = plane[3];
50 for (i=0;i<count;i++,STRIDE_F(coord,stride),STRIDE_F(out,outstride)) {
52 *out = (coord[0] * plane0 +
59 static void TAG(dotprod_vec3)( GLfloat *out,
61 const GLvector4f *coord_vec,
62 const GLfloat plane[4],
65 GLuint stride = coord_vec->stride;
66 GLfloat *coord = coord_vec->start;
67 GLuint count = coord_vec->count;
71 const GLfloat plane0 = plane[0], plane1 = plane[1], plane2 = plane[2];
72 const GLfloat plane3 = plane[3];
76 for (i=0;i<count;i++,STRIDE_F(coord,stride),STRIDE_F(out,outstride)) {
78 *out = (coord[0] * plane0 +
86 static void TAG(dotprod_vec4)( GLfloat *out,
88 const GLvector4f *coord_vec,
89 const GLfloat plane[4],
92 GLuint stride = coord_vec->stride;
93 GLfloat *coord = coord_vec->start;
94 GLuint count = coord_vec->count;
97 const GLfloat plane0 = plane[0], plane1 = plane[1], plane2 = plane[2];
98 const GLfloat plane3 = plane[3];
102 for (i=0;i<count;i++,STRIDE_F(coord,stride),STRIDE_F(out,outstride)) {
104 *out = (coord[0] * plane0 +
113 static void TAG(init_dotprod)( void )
115 _mesa_dotprod_tab[IDX&1][2] = TAG(dotprod_vec2);
116 _mesa_dotprod_tab[IDX&1][3] = TAG(dotprod_vec3);
117 _mesa_dotprod_tab[IDX&1][4] = TAG(dotprod_vec4);