Subversion Repositories Kolibri OS

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

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