OSDN Git Service

ba155caae1d371686f09329780315083743df7e5
[android-x86/external-mesa.git] / src / mesa / x86 / common_x86_macros.h
1 /* $Id: common_x86_macros.h,v 1.3 2002/10/29 20:28:58 brianp 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  * Authors:
27  *    Gareth Hughes
28  */
29
30 #ifndef __COMMON_X86_MACROS_H__
31 #define __COMMON_X86_MACROS_H__
32
33
34 /* =============================================================
35  * Transformation function declarations:
36  */
37
38 #define XFORM_ARGS      GLvector4f *to_vec,                             \
39                         const GLfloat m[16],                            \
40                         const GLvector4f *from_vec
41
42 #define DECLARE_XFORM_GROUP( pfx, sz ) \
43 extern void _ASMAPI _mesa_##pfx##_transform_points##sz##_general( XFORM_ARGS );         \
44 extern void _ASMAPI _mesa_##pfx##_transform_points##sz##_identity( XFORM_ARGS );        \
45 extern void _ASMAPI _mesa_##pfx##_transform_points##sz##_3d_no_rot( XFORM_ARGS );       \
46 extern void _ASMAPI _mesa_##pfx##_transform_points##sz##_perspective( XFORM_ARGS );     \
47 extern void _ASMAPI _mesa_##pfx##_transform_points##sz##_2d( XFORM_ARGS );              \
48 extern void _ASMAPI _mesa_##pfx##_transform_points##sz##_2d_no_rot( XFORM_ARGS );       \
49 extern void _ASMAPI _mesa_##pfx##_transform_points##sz##_3d( XFORM_ARGS );
50
51 #define ASSIGN_XFORM_GROUP( pfx, sz )                                   \
52    _mesa_transform_tab[sz][MATRIX_GENERAL] =                            \
53       _mesa_##pfx##_transform_points##sz##_general;                     \
54    _mesa_transform_tab[sz][MATRIX_IDENTITY] =                           \
55       _mesa_##pfx##_transform_points##sz##_identity;                    \
56    _mesa_transform_tab[sz][MATRIX_3D_NO_ROT] =                          \
57       _mesa_##pfx##_transform_points##sz##_3d_no_rot;                   \
58    _mesa_transform_tab[sz][MATRIX_PERSPECTIVE] =                        \
59       _mesa_##pfx##_transform_points##sz##_perspective;                 \
60    _mesa_transform_tab[sz][MATRIX_2D] =                                 \
61       _mesa_##pfx##_transform_points##sz##_2d;                          \
62    _mesa_transform_tab[sz][MATRIX_2D_NO_ROT] =                          \
63       _mesa_##pfx##_transform_points##sz##_2d_no_rot;                   \
64    _mesa_transform_tab[sz][MATRIX_3D] =                                 \
65       _mesa_##pfx##_transform_points##sz##_3d;
66
67
68 /* =============================================================
69  * Normal transformation function declarations:
70  */
71
72 #define NORM_ARGS       const GLmatrix *mat,                            \
73                         GLfloat scale,                                  \
74                         const GLvector4f *in,                           \
75                         const GLfloat *lengths,                         \
76                         GLvector4f *dest
77
78 #define DECLARE_NORM_GROUP( pfx ) \
79 extern void _ASMAPI _mesa_##pfx##_rescale_normals( NORM_ARGS );                         \
80 extern void _ASMAPI _mesa_##pfx##_normalize_normals( NORM_ARGS );                       \
81 extern void _ASMAPI _mesa_##pfx##_transform_normals( NORM_ARGS );                       \
82 extern void _ASMAPI _mesa_##pfx##_transform_normals_no_rot( NORM_ARGS );                \
83 extern void _ASMAPI _mesa_##pfx##_transform_rescale_normals( NORM_ARGS );               \
84 extern void _ASMAPI _mesa_##pfx##_transform_rescale_normals_no_rot( NORM_ARGS );        \
85 extern void _ASMAPI _mesa_##pfx##_transform_normalize_normals( NORM_ARGS );             \
86 extern void _ASMAPI _mesa_##pfx##_transform_normalize_normals_no_rot( NORM_ARGS );
87
88 #define ASSIGN_NORM_GROUP( pfx )                                        \
89    _mesa_normal_tab[NORM_RESCALE] =                                     \
90       _mesa_##pfx##_rescale_normals;                                    \
91    _mesa_normal_tab[NORM_NORMALIZE] =                                   \
92       _mesa_##pfx##_normalize_normals;                                  \
93    _mesa_normal_tab[NORM_TRANSFORM] =                                   \
94       _mesa_##pfx##_transform_normals;                                  \
95    _mesa_normal_tab[NORM_TRANSFORM_NO_ROT] =                            \
96       _mesa_##pfx##_transform_normals_no_rot;                           \
97    _mesa_normal_tab[NORM_TRANSFORM | NORM_RESCALE] =                    \
98       _mesa_##pfx##_transform_rescale_normals;                          \
99    _mesa_normal_tab[NORM_TRANSFORM_NO_ROT | NORM_RESCALE] =             \
100       _mesa_##pfx##_transform_rescale_normals_no_rot;                   \
101    _mesa_normal_tab[NORM_TRANSFORM | NORM_NORMALIZE] =                  \
102       _mesa_##pfx##_transform_normalize_normals;                        \
103    _mesa_normal_tab[NORM_TRANSFORM_NO_ROT | NORM_NORMALIZE] =           \
104       _mesa_##pfx##_transform_normalize_normals_no_rot;
105
106
107 #endif