1848b8605Smrg/* 2848b8605Smrg * Mesa 3-D graphics library 3848b8605Smrg * 4848b8605Smrg * Copyright (C) 1999-2003 Brian Paul All Rights Reserved. 5848b8605Smrg * 6848b8605Smrg * Permission is hereby granted, free of charge, to any person obtaining a 7848b8605Smrg * copy of this software and associated documentation files (the "Software"), 8848b8605Smrg * to deal in the Software without restriction, including without limitation 9848b8605Smrg * the rights to use, copy, modify, merge, publish, distribute, sublicense, 10848b8605Smrg * and/or sell copies of the Software, and to permit persons to whom the 11848b8605Smrg * Software is furnished to do so, subject to the following conditions: 12848b8605Smrg * 13848b8605Smrg * The above copyright notice and this permission notice shall be included 14848b8605Smrg * in all copies or substantial portions of the Software. 15848b8605Smrg * 16848b8605Smrg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 17848b8605Smrg * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18848b8605Smrg * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 19848b8605Smrg * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR 20848b8605Smrg * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 21848b8605Smrg * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 22848b8605Smrg * OTHER DEALINGS IN THE SOFTWARE. 23848b8605Smrg */ 24848b8605Smrg 25848b8605Smrg/* 26848b8605Smrg * Sparc assembly code by David S. Miller 27848b8605Smrg */ 28848b8605Smrg 29848b8605Smrg 30848b8605Smrg#include "sparc.h" 31848b8605Smrg 32848b8605Smrg#ifdef USE_SPARC_ASM 33848b8605Smrg 34848b8605Smrg#include "main/context.h" 35848b8605Smrg#include "math/m_xform.h" 36848b8605Smrg#include "tnl/t_context.h" 37848b8605Smrg 38848b8605Smrg#ifdef DEBUG 39848b8605Smrg#include "math/m_debug.h" 40848b8605Smrg#endif 41848b8605Smrg 42848b8605Smrg#define XFORM_ARGS GLvector4f *to_vec, \ 43848b8605Smrg const GLfloat m[16], \ 44848b8605Smrg const GLvector4f *from_vec 45848b8605Smrg 46848b8605Smrg#define DECLARE_XFORM_GROUP(pfx, sz) \ 47848b8605Smrg extern void _mesa_##pfx##_transform_points##sz##_general(XFORM_ARGS); \ 48848b8605Smrg extern void _mesa_##pfx##_transform_points##sz##_identity(XFORM_ARGS); \ 49848b8605Smrg extern void _mesa_##pfx##_transform_points##sz##_3d_no_rot(XFORM_ARGS); \ 50848b8605Smrg extern void _mesa_##pfx##_transform_points##sz##_perspective(XFORM_ARGS); \ 51848b8605Smrg extern void _mesa_##pfx##_transform_points##sz##_2d(XFORM_ARGS); \ 52848b8605Smrg extern void _mesa_##pfx##_transform_points##sz##_2d_no_rot(XFORM_ARGS); \ 53848b8605Smrg extern void _mesa_##pfx##_transform_points##sz##_3d(XFORM_ARGS); 54848b8605Smrg 55848b8605Smrg#define ASSIGN_XFORM_GROUP(pfx, sz) \ 56848b8605Smrg _mesa_transform_tab[sz][MATRIX_GENERAL] = \ 57848b8605Smrg _mesa_##pfx##_transform_points##sz##_general; \ 58848b8605Smrg _mesa_transform_tab[sz][MATRIX_IDENTITY] = \ 59848b8605Smrg _mesa_##pfx##_transform_points##sz##_identity; \ 60848b8605Smrg _mesa_transform_tab[sz][MATRIX_3D_NO_ROT] = \ 61848b8605Smrg _mesa_##pfx##_transform_points##sz##_3d_no_rot; \ 62848b8605Smrg _mesa_transform_tab[sz][MATRIX_PERSPECTIVE] = \ 63848b8605Smrg _mesa_##pfx##_transform_points##sz##_perspective; \ 64848b8605Smrg _mesa_transform_tab[sz][MATRIX_2D] = \ 65848b8605Smrg _mesa_##pfx##_transform_points##sz##_2d; \ 66848b8605Smrg _mesa_transform_tab[sz][MATRIX_2D_NO_ROT] = \ 67848b8605Smrg _mesa_##pfx##_transform_points##sz##_2d_no_rot; \ 68848b8605Smrg _mesa_transform_tab[sz][MATRIX_3D] = \ 69848b8605Smrg _mesa_##pfx##_transform_points##sz##_3d; 70848b8605Smrg 71848b8605Smrg 72848b8605SmrgDECLARE_XFORM_GROUP(sparc, 1) 73848b8605SmrgDECLARE_XFORM_GROUP(sparc, 2) 74848b8605SmrgDECLARE_XFORM_GROUP(sparc, 3) 75848b8605SmrgDECLARE_XFORM_GROUP(sparc, 4) 76848b8605Smrg 77848b8605Smrgextern GLvector4f *_mesa_sparc_cliptest_points4(GLvector4f *clip_vec, 78848b8605Smrg GLvector4f *proj_vec, 79848b8605Smrg GLubyte clipMask[], 80848b8605Smrg GLubyte *orMask, 81848b8605Smrg GLubyte *andMask, 82848b8605Smrg GLboolean viewport_z_clip); 83848b8605Smrg 84848b8605Smrgextern GLvector4f *_mesa_sparc_cliptest_points4_np(GLvector4f *clip_vec, 85848b8605Smrg GLvector4f *proj_vec, 86848b8605Smrg GLubyte clipMask[], 87848b8605Smrg GLubyte *orMask, 88848b8605Smrg GLubyte *andMask, 89848b8605Smrg GLboolean viewport_z_clip); 90848b8605Smrg 91848b8605Smrg#define NORM_ARGS const GLmatrix *mat, \ 92848b8605Smrg GLfloat scale, \ 93848b8605Smrg const GLvector4f *in, \ 94848b8605Smrg const GLfloat *lengths, \ 95848b8605Smrg GLvector4f *dest 96848b8605Smrg 97848b8605Smrgextern void _mesa_sparc_transform_normalize_normals(NORM_ARGS); 98848b8605Smrgextern void _mesa_sparc_transform_normalize_normals_no_rot(NORM_ARGS); 99848b8605Smrgextern void _mesa_sparc_transform_rescale_normals_no_rot(NORM_ARGS); 100848b8605Smrgextern void _mesa_sparc_transform_rescale_normals(NORM_ARGS); 101848b8605Smrgextern void _mesa_sparc_transform_normals_no_rot(NORM_ARGS); 102848b8605Smrgextern void _mesa_sparc_transform_normals(NORM_ARGS); 103848b8605Smrgextern void _mesa_sparc_normalize_normals(NORM_ARGS); 104848b8605Smrgextern void _mesa_sparc_rescale_normals(NORM_ARGS); 105848b8605Smrg 106848b8605Smrg 107848b8605Smrg 108848b8605Smrgvoid _mesa_init_all_sparc_transform_asm(void) 109848b8605Smrg{ 110848b8605Smrg ASSIGN_XFORM_GROUP(sparc, 1) 111848b8605Smrg ASSIGN_XFORM_GROUP(sparc, 2) 112848b8605Smrg ASSIGN_XFORM_GROUP(sparc, 3) 113848b8605Smrg ASSIGN_XFORM_GROUP(sparc, 4) 114848b8605Smrg 115848b8605Smrg _mesa_clip_tab[4] = _mesa_sparc_cliptest_points4; 116848b8605Smrg _mesa_clip_np_tab[4] = _mesa_sparc_cliptest_points4_np; 117848b8605Smrg 118848b8605Smrg _mesa_normal_tab[NORM_TRANSFORM | NORM_NORMALIZE] = 119848b8605Smrg _mesa_sparc_transform_normalize_normals; 120848b8605Smrg _mesa_normal_tab[NORM_TRANSFORM_NO_ROT | NORM_NORMALIZE] = 121848b8605Smrg _mesa_sparc_transform_normalize_normals_no_rot; 122848b8605Smrg _mesa_normal_tab[NORM_TRANSFORM_NO_ROT | NORM_RESCALE] = 123848b8605Smrg _mesa_sparc_transform_rescale_normals_no_rot; 124848b8605Smrg _mesa_normal_tab[NORM_TRANSFORM | NORM_RESCALE] = 125848b8605Smrg _mesa_sparc_transform_rescale_normals; 126848b8605Smrg _mesa_normal_tab[NORM_TRANSFORM_NO_ROT] = 127848b8605Smrg _mesa_sparc_transform_normals_no_rot; 128848b8605Smrg _mesa_normal_tab[NORM_TRANSFORM] = 129848b8605Smrg _mesa_sparc_transform_normals; 130848b8605Smrg _mesa_normal_tab[NORM_NORMALIZE] = 131848b8605Smrg _mesa_sparc_normalize_normals; 132848b8605Smrg _mesa_normal_tab[NORM_RESCALE] = 133848b8605Smrg _mesa_sparc_rescale_normals; 134848b8605Smrg 135848b8605Smrg#ifdef DEBUG_MATH 136848b8605Smrg _math_test_all_transform_functions("sparc"); 137848b8605Smrg _math_test_all_cliptest_functions("sparc"); 138848b8605Smrg _math_test_all_normal_transform_functions("sparc"); 139848b8605Smrg#endif 140848b8605Smrg} 141848b8605Smrg 142848b8605Smrg#endif /* USE_SPARC_ASM */ 143