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 | * x86-64 optimizations shamelessy converted from x86/sse/3dnow assembly by |
||
27 | * Mikko Tiihonen |
||
28 | */ |
||
29 | |||
30 | |||
31 | |||
32 | |||
33 | #include "main/context.h" |
||
34 | #include "math/m_xform.h" |
||
35 | #include "tnl/t_context.h" |
||
36 | #include "x86-64.h" |
||
37 | #include "../x86/x86_xform.h" |
||
38 | |||
39 | |||
40 | #include "math/m_debug.h" |
||
41 | #endif |
||
42 | |||
43 | |||
44 | |||
45 | |||
46 | DECLARE_XFORM_GROUP( 3dnow, 4 ) |
||
47 | |||
48 | |||
49 | /* just to silence warning below */ |
||
50 | #include "x86-64.h" |
||
51 | #endif |
||
52 | |||
53 | |||
54 | extern void _mesa_x86_64_transform_points4_general( XFORM_ARGS ); |
||
55 | extern void _mesa_x86_64_transform_points4_identity( XFORM_ARGS ); |
||
56 | extern void _mesa_x86_64_transform_points4_perspective( XFORM_ARGS ); |
||
57 | extern void _mesa_x86_64_transform_points4_3d( XFORM_ARGS ); |
||
58 | extern void _mesa_x86_64_transform_points4_3d_no_rot( XFORM_ARGS ); |
||
59 | extern void _mesa_x86_64_transform_points4_2d_no_rot( XFORM_ARGS ); |
||
60 | extern void _mesa_x86_64_transform_points4_2d( XFORM_ARGS ); |
||
61 | */ |
||
62 | |||
63 | |||
64 | static void message( const char *msg ) |
||
65 | { |
||
66 | if (_mesa_getenv("MESA_DEBUG")) { |
||
67 | _mesa_debug( NULL, "%s", msg ); |
||
68 | } |
||
69 | } |
||
70 | #endif |
||
71 | |||
72 | |||
73 | |||
74 | { |
||
75 | #ifdef USE_X86_64_ASM |
||
76 | unsigned int regs[4]; |
||
77 | |||
78 | |||
79 | return; |
||
80 | } |
||
81 | |||
82 | |||
83 | |||
84 | |||
85 | |||
86 | _mesa_x86_64_transform_points4_general; |
||
87 | _mesa_transform_tab[4][MATRIX_IDENTITY] = |
||
88 | _mesa_x86_64_transform_points4_identity; |
||
89 | _mesa_transform_tab[4][MATRIX_3D] = |
||
90 | _mesa_x86_64_transform_points4_3d; |
||
91 | |||
92 | |||
93 | regs[1] = 0x00000000; |
||
94 | regs[2] = 0x00000000; |
||
95 | regs[3] = 0x00000000; |
||
96 | _mesa_x86_64_cpuid(regs); |
||
97 | if (regs[3] & (1U << 31)) { |
||
98 | message("3Dnow! detected\n"); |
||
99 | _mesa_transform_tab[4][MATRIX_3D_NO_ROT] = |
||
100 | _mesa_3dnow_transform_points4_3d_no_rot; |
||
101 | _mesa_transform_tab[4][MATRIX_PERSPECTIVE] = |
||
102 | _mesa_3dnow_transform_points4_perspective; |
||
103 | _mesa_transform_tab[4][MATRIX_2D_NO_ROT] = |
||
104 | _mesa_3dnow_transform_points4_2d_no_rot; |
||
105 | _mesa_transform_tab[4][MATRIX_2D] = |
||
106 | _mesa_3dnow_transform_points4_2d; |
||
107 | |||
108 | |||
109 | |||
110 | |||
111 | |||
112 | _math_test_all_transform_functions("x86_64"); |
||
113 | _math_test_all_cliptest_functions("x86_64"); |
||
114 | _math_test_all_normal_transform_functions("x86_64"); |
||
115 | #endif |
||
116 | |||
117 | |||
118 | }><> |
||
119 |