ReactOS Fundraising Campaign 2012
 
€ 4,410 / € 30,000

Information | Donate

Home | Info | Community | Development | myReactOS | Contact Us

  1. Home
  2. Community
  3. Development
  4. myReactOS
  5. Fundraiser 2012

  1. Main Page
  2. Alphabetical List
  3. Data Structures
  4. Directories
  5. File List
  6. Data Fields
  7. Globals
  8. Related Pages

ReactOS Development > Doxygen

sparc.c
Go to the documentation of this file.
00001 /*
00002  * Mesa 3-D graphics library
00003  * Version:  6.3
00004  * 
00005  * Copyright (C) 1999-2003  Brian Paul   All Rights Reserved.
00006  * 
00007  * Permission is hereby granted, free of charge, to any person obtaining a
00008  * copy of this software and associated documentation files (the "Software"),
00009  * to deal in the Software without restriction, including without limitation
00010  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
00011  * and/or sell copies of the Software, and to permit persons to whom the
00012  * Software is furnished to do so, subject to the following conditions:
00013  * 
00014  * The above copyright notice and this permission notice shall be included
00015  * in all copies or substantial portions of the Software.
00016  * 
00017  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
00018  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
00019  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
00020  * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
00021  * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
00022  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
00023  */
00024 
00025 /*
00026  * Sparc assembly code by David S. Miller
00027  */
00028 
00029 
00030 #include "sparc.h"
00031 
00032 #ifdef USE_SPARC_ASM
00033 
00034 #include "main/context.h"
00035 #include "math/m_xform.h"
00036 #include "tnl/t_context.h"
00037 
00038 #ifdef DEBUG
00039 #include "math/m_debug.h"
00040 #endif
00041 
00042 #define XFORM_ARGS  GLvector4f *to_vec,         \
00043             const GLfloat m[16],        \
00044             const GLvector4f *from_vec
00045 
00046 #define DECLARE_XFORM_GROUP(pfx, sz)                       \
00047  extern void _mesa_##pfx##_transform_points##sz##_general(XFORM_ARGS);     \
00048  extern void _mesa_##pfx##_transform_points##sz##_identity(XFORM_ARGS);    \
00049  extern void _mesa_##pfx##_transform_points##sz##_3d_no_rot(XFORM_ARGS);   \
00050  extern void _mesa_##pfx##_transform_points##sz##_perspective(XFORM_ARGS); \
00051  extern void _mesa_##pfx##_transform_points##sz##_2d(XFORM_ARGS);          \
00052  extern void _mesa_##pfx##_transform_points##sz##_2d_no_rot(XFORM_ARGS);   \
00053  extern void _mesa_##pfx##_transform_points##sz##_3d(XFORM_ARGS);
00054 
00055 #define ASSIGN_XFORM_GROUP(pfx, sz)                 \
00056    _mesa_transform_tab[sz][MATRIX_GENERAL] =                \
00057       _mesa_##pfx##_transform_points##sz##_general;         \
00058    _mesa_transform_tab[sz][MATRIX_IDENTITY] =               \
00059       _mesa_##pfx##_transform_points##sz##_identity;            \
00060    _mesa_transform_tab[sz][MATRIX_3D_NO_ROT] =              \
00061       _mesa_##pfx##_transform_points##sz##_3d_no_rot;           \
00062    _mesa_transform_tab[sz][MATRIX_PERSPECTIVE] =            \
00063       _mesa_##pfx##_transform_points##sz##_perspective;         \
00064    _mesa_transform_tab[sz][MATRIX_2D] =                 \
00065       _mesa_##pfx##_transform_points##sz##_2d;              \
00066    _mesa_transform_tab[sz][MATRIX_2D_NO_ROT] =              \
00067       _mesa_##pfx##_transform_points##sz##_2d_no_rot;           \
00068    _mesa_transform_tab[sz][MATRIX_3D] =                 \
00069       _mesa_##pfx##_transform_points##sz##_3d;
00070 
00071 
00072 DECLARE_XFORM_GROUP(sparc, 1)
00073 DECLARE_XFORM_GROUP(sparc, 2)
00074 DECLARE_XFORM_GROUP(sparc, 3)
00075 DECLARE_XFORM_GROUP(sparc, 4)
00076 
00077 extern GLvector4f  *_mesa_sparc_cliptest_points4(GLvector4f *clip_vec,
00078                          GLvector4f *proj_vec,
00079                          GLubyte clipMask[],
00080                          GLubyte *orMask,
00081                          GLubyte *andMask);
00082 
00083 extern GLvector4f  *_mesa_sparc_cliptest_points4_np(GLvector4f *clip_vec,
00084                             GLvector4f *proj_vec,
00085                             GLubyte clipMask[],
00086                             GLubyte *orMask,
00087                             GLubyte *andMask);
00088 
00089 #define NORM_ARGS   const GLmatrix *mat,                \
00090             GLfloat scale,                  \
00091             const GLvector4f *in,               \
00092             const GLfloat *lengths,             \
00093             GLvector4f *dest
00094 
00095 extern void _mesa_sparc_transform_normalize_normals(NORM_ARGS);
00096 extern void _mesa_sparc_transform_normalize_normals_no_rot(NORM_ARGS);
00097 extern void _mesa_sparc_transform_rescale_normals_no_rot(NORM_ARGS);
00098 extern void _mesa_sparc_transform_rescale_normals(NORM_ARGS);
00099 extern void _mesa_sparc_transform_normals_no_rot(NORM_ARGS);
00100 extern void _mesa_sparc_transform_normals(NORM_ARGS);
00101 extern void _mesa_sparc_normalize_normals(NORM_ARGS);
00102 extern void _mesa_sparc_rescale_normals(NORM_ARGS);
00103 
00104 
00105 
00106 void _mesa_init_all_sparc_transform_asm(void)
00107 {
00108    ASSIGN_XFORM_GROUP(sparc, 1)
00109    ASSIGN_XFORM_GROUP(sparc, 2)
00110    ASSIGN_XFORM_GROUP(sparc, 3)
00111    ASSIGN_XFORM_GROUP(sparc, 4)
00112 
00113    _mesa_clip_tab[4] = _mesa_sparc_cliptest_points4;
00114    _mesa_clip_np_tab[4] = _mesa_sparc_cliptest_points4_np;
00115 
00116 #if 0
00117    /* disable these too.  See bug 673938 */
00118    _mesa_normal_tab[NORM_TRANSFORM | NORM_NORMALIZE] =
00119        _mesa_sparc_transform_normalize_normals;
00120    _mesa_normal_tab[NORM_TRANSFORM_NO_ROT | NORM_NORMALIZE] =
00121        _mesa_sparc_transform_normalize_normals_no_rot;
00122    _mesa_normal_tab[NORM_TRANSFORM_NO_ROT | NORM_RESCALE] =
00123        _mesa_sparc_transform_rescale_normals_no_rot;
00124    _mesa_normal_tab[NORM_TRANSFORM | NORM_RESCALE] =
00125        _mesa_sparc_transform_rescale_normals;
00126    _mesa_normal_tab[NORM_TRANSFORM_NO_ROT] =
00127        _mesa_sparc_transform_normals_no_rot;
00128    _mesa_normal_tab[NORM_TRANSFORM] =
00129        _mesa_sparc_transform_normals;
00130    _mesa_normal_tab[NORM_NORMALIZE] =
00131        _mesa_sparc_normalize_normals;
00132    _mesa_normal_tab[NORM_RESCALE] =
00133        _mesa_sparc_rescale_normals;
00134 #endif
00135 
00136 #ifdef DEBUG_MATH
00137    _math_test_all_transform_functions("sparc");
00138    _math_test_all_cliptest_functions("sparc");
00139    _math_test_all_normal_transform_functions("sparc");
00140 #endif
00141 }
00142 
00143 extern unsigned int _mesa_sparc_glapi_begin;
00144 extern unsigned int _mesa_sparc_glapi_end;
00145 extern void __glapi_sparc_icache_flush(unsigned int *);
00146 
00147 #endif /* USE_SPARC_ASM */
00148 
00149 
00150 void _mesa_init_sparc_glapi_relocs(void)
00151 {
00152 #ifdef USE_SPARC_ASM
00153     unsigned int *insn_ptr, *end_ptr;
00154     unsigned long disp_addr;
00155 
00156     insn_ptr = &_mesa_sparc_glapi_begin;
00157     end_ptr = &_mesa_sparc_glapi_end;
00158     disp_addr = (unsigned long) &_glapi_Dispatch;
00159 
00160     while (insn_ptr < end_ptr) {
00161 #ifdef __arch64__
00162         insn_ptr[0] |= (disp_addr >> (32 + 10));
00163         insn_ptr[1] |= ((disp_addr & 0xffffffff) >> 10);
00164         __glapi_sparc_icache_flush(&insn_ptr[0]);
00165         insn_ptr[2] |= ((disp_addr >> 32) & ((1 << 10) - 1));
00166         insn_ptr[3] |= (disp_addr & ((1 << 10) - 1));
00167         __glapi_sparc_icache_flush(&insn_ptr[2]);
00168         insn_ptr += 11;
00169 #else
00170         insn_ptr[0] |= (disp_addr >> 10);
00171         insn_ptr[1] |= (disp_addr & ((1 << 10) - 1));
00172         __glapi_sparc_icache_flush(&insn_ptr[0]);
00173         insn_ptr += 5;
00174 #endif
00175     }
00176 #endif /* USE_SPARC_ASM */
00177 }

Generated on Sat May 26 2012 04:19:28 for ReactOS by doxygen 1.7.6.1

ReactOS is a registered trademark or a trademark of ReactOS Foundation in the United States and other countries.