mesa: Restore 78-column wrapping of license text in C-style comments.
[mesa.git] / src / mesa / sparc / sparc.c
1 /*
2 * Mesa 3-D graphics library
3 * Version: 6.3
4 *
5 * Copyright (C) 1999-2003 Brian Paul All Rights Reserved.
6 *
7 * Permission is hereby granted, free of charge, to any person obtaining a
8 * copy of this software and associated documentation files (the "Software"),
9 * to deal in the Software without restriction, including without limitation
10 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
11 * and/or sell copies of the Software, and to permit persons to whom the
12 * Software is furnished to do so, subject to the following conditions:
13 *
14 * The above copyright notice and this permission notice shall be included
15 * in all copies or substantial portions of the Software.
16 *
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
18 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
20 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
21 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
22 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
23 * OTHER DEALINGS IN THE SOFTWARE.
24 */
25
26 /*
27 * Sparc assembly code by David S. Miller
28 */
29
30
31 #include "sparc.h"
32
33 #ifdef USE_SPARC_ASM
34
35 #include "main/context.h"
36 #include "math/m_xform.h"
37 #include "tnl/t_context.h"
38
39 #ifdef DEBUG
40 #include "math/m_debug.h"
41 #endif
42
43 #define XFORM_ARGS GLvector4f *to_vec, \
44 const GLfloat m[16], \
45 const GLvector4f *from_vec
46
47 #define DECLARE_XFORM_GROUP(pfx, sz) \
48 extern void _mesa_##pfx##_transform_points##sz##_general(XFORM_ARGS); \
49 extern void _mesa_##pfx##_transform_points##sz##_identity(XFORM_ARGS); \
50 extern void _mesa_##pfx##_transform_points##sz##_3d_no_rot(XFORM_ARGS); \
51 extern void _mesa_##pfx##_transform_points##sz##_perspective(XFORM_ARGS); \
52 extern void _mesa_##pfx##_transform_points##sz##_2d(XFORM_ARGS); \
53 extern void _mesa_##pfx##_transform_points##sz##_2d_no_rot(XFORM_ARGS); \
54 extern void _mesa_##pfx##_transform_points##sz##_3d(XFORM_ARGS);
55
56 #define ASSIGN_XFORM_GROUP(pfx, sz) \
57 _mesa_transform_tab[sz][MATRIX_GENERAL] = \
58 _mesa_##pfx##_transform_points##sz##_general; \
59 _mesa_transform_tab[sz][MATRIX_IDENTITY] = \
60 _mesa_##pfx##_transform_points##sz##_identity; \
61 _mesa_transform_tab[sz][MATRIX_3D_NO_ROT] = \
62 _mesa_##pfx##_transform_points##sz##_3d_no_rot; \
63 _mesa_transform_tab[sz][MATRIX_PERSPECTIVE] = \
64 _mesa_##pfx##_transform_points##sz##_perspective; \
65 _mesa_transform_tab[sz][MATRIX_2D] = \
66 _mesa_##pfx##_transform_points##sz##_2d; \
67 _mesa_transform_tab[sz][MATRIX_2D_NO_ROT] = \
68 _mesa_##pfx##_transform_points##sz##_2d_no_rot; \
69 _mesa_transform_tab[sz][MATRIX_3D] = \
70 _mesa_##pfx##_transform_points##sz##_3d;
71
72
73 DECLARE_XFORM_GROUP(sparc, 1)
74 DECLARE_XFORM_GROUP(sparc, 2)
75 DECLARE_XFORM_GROUP(sparc, 3)
76 DECLARE_XFORM_GROUP(sparc, 4)
77
78 extern GLvector4f *_mesa_sparc_cliptest_points4(GLvector4f *clip_vec,
79 GLvector4f *proj_vec,
80 GLubyte clipMask[],
81 GLubyte *orMask,
82 GLubyte *andMask,
83 GLboolean viewport_z_clip);
84
85 extern GLvector4f *_mesa_sparc_cliptest_points4_np(GLvector4f *clip_vec,
86 GLvector4f *proj_vec,
87 GLubyte clipMask[],
88 GLubyte *orMask,
89 GLubyte *andMask,
90 GLboolean viewport_z_clip);
91
92 #define NORM_ARGS const GLmatrix *mat, \
93 GLfloat scale, \
94 const GLvector4f *in, \
95 const GLfloat *lengths, \
96 GLvector4f *dest
97
98 extern void _mesa_sparc_transform_normalize_normals(NORM_ARGS);
99 extern void _mesa_sparc_transform_normalize_normals_no_rot(NORM_ARGS);
100 extern void _mesa_sparc_transform_rescale_normals_no_rot(NORM_ARGS);
101 extern void _mesa_sparc_transform_rescale_normals(NORM_ARGS);
102 extern void _mesa_sparc_transform_normals_no_rot(NORM_ARGS);
103 extern void _mesa_sparc_transform_normals(NORM_ARGS);
104 extern void _mesa_sparc_normalize_normals(NORM_ARGS);
105 extern void _mesa_sparc_rescale_normals(NORM_ARGS);
106
107
108
109 void _mesa_init_all_sparc_transform_asm(void)
110 {
111 ASSIGN_XFORM_GROUP(sparc, 1)
112 ASSIGN_XFORM_GROUP(sparc, 2)
113 ASSIGN_XFORM_GROUP(sparc, 3)
114 ASSIGN_XFORM_GROUP(sparc, 4)
115
116 _mesa_clip_tab[4] = _mesa_sparc_cliptest_points4;
117 _mesa_clip_np_tab[4] = _mesa_sparc_cliptest_points4_np;
118
119 _mesa_normal_tab[NORM_TRANSFORM | NORM_NORMALIZE] =
120 _mesa_sparc_transform_normalize_normals;
121 _mesa_normal_tab[NORM_TRANSFORM_NO_ROT | NORM_NORMALIZE] =
122 _mesa_sparc_transform_normalize_normals_no_rot;
123 _mesa_normal_tab[NORM_TRANSFORM_NO_ROT | NORM_RESCALE] =
124 _mesa_sparc_transform_rescale_normals_no_rot;
125 _mesa_normal_tab[NORM_TRANSFORM | NORM_RESCALE] =
126 _mesa_sparc_transform_rescale_normals;
127 _mesa_normal_tab[NORM_TRANSFORM_NO_ROT] =
128 _mesa_sparc_transform_normals_no_rot;
129 _mesa_normal_tab[NORM_TRANSFORM] =
130 _mesa_sparc_transform_normals;
131 _mesa_normal_tab[NORM_NORMALIZE] =
132 _mesa_sparc_normalize_normals;
133 _mesa_normal_tab[NORM_RESCALE] =
134 _mesa_sparc_rescale_normals;
135
136 #ifdef DEBUG_MATH
137 _math_test_all_transform_functions("sparc");
138 _math_test_all_cliptest_functions("sparc");
139 _math_test_all_normal_transform_functions("sparc");
140 #endif
141 }
142
143 #endif /* USE_SPARC_ASM */