Subversion Repositories shark

Rev

Rev 56 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
56 pj 1
/* $Id: m_dotprod_tmp.h,v 1.1 2003-02-28 11:48:05 pj Exp $ */
2
 
3
/*
4
 * Mesa 3-D graphics library
5
 * Version:  3.5
6
 *
7
 * Copyright (C) 1999-2001  Brian Paul   All Rights Reserved.
8
 *
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:
15
 *
16
 * The above copyright notice and this permission notice shall be included
17
 * in all copies or substantial portions of the Software.
18
 *
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.
25
 */
26
 
27
/*
28
 * New (3.1) transformation code written by Keith Whitwell.
29
 */
30
 
31
 
32
/* Note - respects the stride of the output vector.
33
 */
34
static void TAG(dotprod_vec2)( GLfloat *out,
35
                               GLuint outstride,
36
                               const GLvector4f *coord_vec,
37
                               const GLfloat plane[4] )
38
{
39
   GLuint stride = coord_vec->stride;
40
   GLfloat *coord = coord_vec->start;
41
   GLuint count = coord_vec->count;
42
 
43
   GLuint i;
44
 
45
   const GLfloat plane0 = plane[0], plane1 = plane[1], plane3 = plane[3];
46
 
47
   for (i=0;i<count;i++,STRIDE_F(coord,stride),STRIDE_F(out,outstride)) {
48
      *out = (coord[0] * plane0 +
49
              coord[1] * plane1 +
50
              plane3);
51
   }
52
}
53
 
54
static void TAG(dotprod_vec3)( GLfloat *out,
55
                               GLuint outstride,
56
                               const GLvector4f *coord_vec,
57
                               const GLfloat plane[4] )
58
{
59
   GLuint stride = coord_vec->stride;
60
   GLfloat *coord = coord_vec->start;
61
   GLuint count = coord_vec->count;
62
 
63
   GLuint i;
64
 
65
   const GLfloat plane0 = plane[0], plane1 = plane[1], plane2 = plane[2];
66
   const GLfloat plane3 = plane[3];
67
 
68
   for (i=0;i<count;i++,STRIDE_F(coord,stride),STRIDE_F(out,outstride)) {
69
      *out = (coord[0] * plane0 +
70
              coord[1] * plane1 +
71
              coord[2] * plane2 +
72
              plane3);
73
   }
74
}
75
 
76
static void TAG(dotprod_vec4)( GLfloat *out,
77
                               GLuint outstride,
78
                               const GLvector4f *coord_vec,
79
                               const GLfloat plane[4] )
80
{
81
   GLuint stride = coord_vec->stride;
82
   GLfloat *coord = coord_vec->start;
83
   GLuint count = coord_vec->count;
84
   GLuint i;
85
 
86
   const GLfloat plane0 = plane[0], plane1 = plane[1], plane2 = plane[2];
87
   const GLfloat plane3 = plane[3];
88
 
89
   for (i=0;i<count;i++,STRIDE_F(coord,stride),STRIDE_F(out,outstride)) {
90
      *out = (coord[0] * plane0 +
91
              coord[1] * plane1 +
92
              coord[2] * plane2 +
93
              coord[3] * plane3);
94
   }
95
}
96
 
97
 
98
static void TAG(init_dotprod)( void )
99
{
100
   _mesa_dotprod_tab[2] = TAG(dotprod_vec2);
101
   _mesa_dotprod_tab[3] = TAG(dotprod_vec3);
102
   _mesa_dotprod_tab[4] = TAG(dotprod_vec4);
103
}