[3598] | 1 | /* $Id: x86.c,v 1.3 2000-05-23 20:41:06 jeroen Exp $ */
|
---|
[2938] | 2 |
|
---|
| 3 | /*
|
---|
| 4 | * Mesa 3-D graphics library
|
---|
| 5 | * Version: 3.1
|
---|
| 6 | *
|
---|
| 7 | * Copyright (C) 1999 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 |
|
---|
| 27 | /*
|
---|
| 28 | * Intel x86 assembly code by Josh Vanderhoof
|
---|
| 29 | */
|
---|
| 30 |
|
---|
| 31 |
|
---|
| 32 | #include <limits.h>
|
---|
| 33 | #include <stdio.h>
|
---|
| 34 | #include <stdlib.h>
|
---|
| 35 | #include <math.h>
|
---|
| 36 |
|
---|
[3598] | 37 | #include "glheader.h"
|
---|
[2962] | 38 | #include "types.h"
|
---|
[2938] | 39 | #include "context.h"
|
---|
| 40 | #include "vertices.h"
|
---|
| 41 | #include "xform.h"
|
---|
| 42 | #include "x86.h"
|
---|
| 43 |
|
---|
[3598] | 44 | extern void _ASMAPI gl_v16_x86_cliptest_points4(GLfloat *first_vert,
|
---|
[2938] | 45 | GLfloat *last_vert,
|
---|
| 46 | GLubyte *or_mask,
|
---|
| 47 | GLubyte *and_mask,
|
---|
| 48 | GLubyte *clip_mask );
|
---|
| 49 |
|
---|
| 50 |
|
---|
[3598] | 51 | extern void _ASMAPI gl_v16_x86_general_xform(GLfloat *dest,
|
---|
[2938] | 52 | const GLfloat *m,
|
---|
| 53 | const GLfloat *src,
|
---|
| 54 | GLuint src_stride,
|
---|
| 55 | GLuint count);
|
---|
| 56 |
|
---|
| 57 |
|
---|
| 58 |
|
---|
| 59 | #define XFORM_ARGS GLvector4f *to_vec, \
|
---|
| 60 | const GLmatrix *mat, \
|
---|
| 61 | const GLvector4f *from_vec, \
|
---|
| 62 | const GLubyte *mask, \
|
---|
| 63 | const GLubyte flag
|
---|
| 64 |
|
---|
| 65 | #define DECLARE_XFORM_GROUP(pfx, vsize, masked) \
|
---|
[3598] | 66 | extern void _ASMAPI gl_##pfx##_transform_points##vsize##_general_##masked(XFORM_ARGS); \
|
---|
| 67 | extern void _ASMAPI gl_##pfx##_transform_points##vsize##_identity_##masked(XFORM_ARGS); \
|
---|
| 68 | extern void _ASMAPI gl_##pfx##_transform_points##vsize##_3d_no_rot_##masked(XFORM_ARGS); \
|
---|
| 69 | extern void _ASMAPI gl_##pfx##_transform_points##vsize##_perspective_##masked(XFORM_ARGS); \
|
---|
| 70 | extern void _ASMAPI gl_##pfx##_transform_points##vsize##_2d_##masked(XFORM_ARGS); \
|
---|
| 71 | extern void _ASMAPI gl_##pfx##_transform_points##vsize##_2d_no_rot_##masked(XFORM_ARGS); \
|
---|
| 72 | extern void _ASMAPI gl_##pfx##_transform_points##vsize##_3d_##masked(XFORM_ARGS);
|
---|
[2938] | 73 |
|
---|
| 74 | #define ASSIGN_XFORM_GROUP( pfx, cma, vsize, masked ) \
|
---|
| 75 | gl_transform_tab[cma][vsize][MATRIX_GENERAL] \
|
---|
| 76 | = gl_##pfx##_transform_points##vsize##_general_##masked; \
|
---|
| 77 | gl_transform_tab[cma][vsize][MATRIX_IDENTITY] \
|
---|
| 78 | = gl_##pfx##_transform_points##vsize##_identity_##masked; \
|
---|
| 79 | gl_transform_tab[cma][vsize][MATRIX_3D_NO_ROT] \
|
---|
| 80 | = gl_##pfx##_transform_points##vsize##_3d_no_rot_##masked; \
|
---|
| 81 | gl_transform_tab[cma][vsize][MATRIX_PERSPECTIVE] \
|
---|
| 82 | = gl_##pfx##_transform_points##vsize##_perspective_##masked; \
|
---|
| 83 | gl_transform_tab[cma][vsize][MATRIX_2D] \
|
---|
| 84 | = gl_##pfx##_transform_points##vsize##_2d_##masked; \
|
---|
| 85 | gl_transform_tab[cma][vsize][MATRIX_2D_NO_ROT] \
|
---|
| 86 | = gl_##pfx##_transform_points##vsize##_2d_no_rot_##masked; \
|
---|
| 87 | gl_transform_tab[cma][vsize][MATRIX_3D] \
|
---|
| 88 | = gl_##pfx##_transform_points##vsize##_3d_##masked;
|
---|
| 89 |
|
---|
| 90 | void gl_init_x86_asm_transforms( void )
|
---|
| 91 | {
|
---|
| 92 | #ifdef USE_X86_ASM
|
---|
| 93 | DECLARE_XFORM_GROUP( x86, 2, raw )
|
---|
| 94 | DECLARE_XFORM_GROUP( x86, 3, raw )
|
---|
| 95 | DECLARE_XFORM_GROUP( x86, 4, raw )
|
---|
| 96 | DECLARE_XFORM_GROUP( x86, 2, masked )
|
---|
| 97 | DECLARE_XFORM_GROUP( x86, 3, masked )
|
---|
| 98 | DECLARE_XFORM_GROUP( x86, 4, masked )
|
---|
| 99 |
|
---|
[3598] | 100 | extern GLvector4f * _ASMAPI gl_x86_cliptest_points4( GLvector4f *clip_vec,
|
---|
[2938] | 101 | GLvector4f *proj_vec,
|
---|
| 102 | GLubyte clipMask[],
|
---|
| 103 | GLubyte *orMask,
|
---|
| 104 | GLubyte *andMask );
|
---|
| 105 |
|
---|
| 106 |
|
---|
| 107 | ASSIGN_XFORM_GROUP( x86, 0, 2, raw )
|
---|
| 108 | ASSIGN_XFORM_GROUP( x86, 0, 3, raw )
|
---|
| 109 | ASSIGN_XFORM_GROUP( x86, 0, 4, raw )
|
---|
| 110 |
|
---|
| 111 | ASSIGN_XFORM_GROUP( x86, CULL_MASK_ACTIVE, 2, masked )
|
---|
| 112 | ASSIGN_XFORM_GROUP( x86, CULL_MASK_ACTIVE, 3, masked )
|
---|
| 113 | ASSIGN_XFORM_GROUP( x86, CULL_MASK_ACTIVE, 4, masked )
|
---|
| 114 |
|
---|
| 115 | gl_clip_tab[4] = gl_x86_cliptest_points4;
|
---|
| 116 |
|
---|
| 117 | #ifdef DEBUG_XFORM
|
---|
| 118 | gl_test_all_transform_functions("x86");
|
---|
| 119 | #endif
|
---|
| 120 |
|
---|
| 121 |
|
---|
| 122 | gl_cliptest_points4_v16 = gl_v16_x86_cliptest_points4;
|
---|
| 123 | gl_xform_points3_v16_general = gl_v16_x86_general_xform;
|
---|
| 124 | #endif
|
---|
| 125 | }
|
---|