123caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell
223caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell/*
323caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell * Mesa 3-D graphics library
422144ab7552f0799bcfca506bf4ffa7f70a06649Gareth Hughes * Version:  3.5
523caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell *
622144ab7552f0799bcfca506bf4ffa7f70a06649Gareth Hughes * Copyright (C) 1999-2001  Brian Paul   All Rights Reserved.
723caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell *
823caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell * Permission is hereby granted, free of charge, to any person obtaining a
923caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell * copy of this software and associated documentation files (the "Software"),
1023caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell * to deal in the Software without restriction, including without limitation
1123caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell * the rights to use, copy, modify, merge, publish, distribute, sublicense,
1223caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell * and/or sell copies of the Software, and to permit persons to whom the
1323caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell * Software is furnished to do so, subject to the following conditions:
1423caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell *
1523caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell * The above copyright notice and this permission notice shall be included
1623caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell * in all copies or substantial portions of the Software.
1723caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell *
1823caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
1923caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
2023caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
2123caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
2223caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
2323caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
2423caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell */
2523caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell
2623caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell/*
2723caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell * New (3.1) transformation code written by Keith Whitwell.
2823caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell */
2923caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell
3023caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell
3123caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell/*----------------------------------------------------------------------
3223caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell * Begin Keith's new code
3323caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell *
3423caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell *----------------------------------------------------------------------
3523caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell */
3623caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell
3723caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell/* KW: Fixed stride, now measured in bytes as is the OpenGL array stride.
3823caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell */
3923caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell
4023caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell/* KW: These are now parameterized to produce two versions, one
4123caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell *     which transforms all incoming points, and a second which
4223caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell *     takes notice of a cullmask array, and only transforms
4323caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell *     unculled vertices.
4423caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell */
4523caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell
4623caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell/* KW: 1-vectors can sneak into the texture pipeline via the array
4723caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell *     interface.  These functions are here because I want consistant
4823caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell *     treatment of the vertex sizes and a lazy strategy for
4923caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell *     cleaning unused parts of the vector, and so as not to exclude
5023caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell *     them from the vertex array interface.
5123caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell *
5223caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell *     Under our current analysis of matrices, there is no way that
5323caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell *     the product of a matrix and a 1-vector can remain a 1-vector,
5423caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell *     with the exception of the identity transform.
5523caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell */
5623caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell
5723caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell/* KW: No longer zero-pad outgoing vectors.  Now that external
5823caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell *     vectors can get into the pipeline we cannot ever assume
5923caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell *     that there is more to a vector than indicated by its
6023caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell *     size.
6123caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell */
6223caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell
6323caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell/* KW: Now uses clipmask and a flag to allow us to skip both/either
6423caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell *     cliped and/or culled vertices.
6523caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell */
6623caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell
675e23af22f708a66695c0e44e599c26f02d8d4dcdGareth Hughes/* GH: Not any more -- it's easier (and faster) to just process the
685e23af22f708a66695c0e44e599c26f02d8d4dcdGareth Hughes *     entire vector.  Clipping and culling are handled further down
695e23af22f708a66695c0e44e599c26f02d8d4dcdGareth Hughes *     the pipe, most often during or after the conversion to some
705e23af22f708a66695c0e44e599c26f02d8d4dcdGareth Hughes *     driver-specific vertex format.
715e23af22f708a66695c0e44e599c26f02d8d4dcdGareth Hughes */
725e23af22f708a66695c0e44e599c26f02d8d4dcdGareth Hughes
7323caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwellstatic void _XFORMAPI
7423caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith WhitwellTAG(transform_points1_general)( GLvector4f *to_vec,
7523caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell				const GLfloat m[16],
765e23af22f708a66695c0e44e599c26f02d8d4dcdGareth Hughes				const GLvector4f *from_vec )
7723caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell{
7823caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   const GLuint stride = from_vec->stride;
7923caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   GLfloat *from = from_vec->start;
8023caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start;
8123caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   GLuint count = from_vec->count;
8223caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   const GLfloat m0 = m[0],  m12 = m[12];
8323caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   const GLfloat m1 = m[1],  m13 = m[13];
8423caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   const GLfloat m2 = m[2],  m14 = m[14];
8523caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   const GLfloat m3 = m[3],  m15 = m[15];
8623caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   GLuint i;
8723caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   STRIDE_LOOP {
885e23af22f708a66695c0e44e599c26f02d8d4dcdGareth Hughes      const GLfloat ox = from[0];
895e23af22f708a66695c0e44e599c26f02d8d4dcdGareth Hughes      to[i][0] = m0 * ox + m12;
905e23af22f708a66695c0e44e599c26f02d8d4dcdGareth Hughes      to[i][1] = m1 * ox + m13;
915e23af22f708a66695c0e44e599c26f02d8d4dcdGareth Hughes      to[i][2] = m2 * ox + m14;
925e23af22f708a66695c0e44e599c26f02d8d4dcdGareth Hughes      to[i][3] = m3 * ox + m15;
9323caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   }
9423caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   to_vec->size = 4;
9523caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   to_vec->flags |= VEC_SIZE_4;
9623caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   to_vec->count = from_vec->count;
9723caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell}
9823caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell
9923caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwellstatic void _XFORMAPI
10023caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith WhitwellTAG(transform_points1_identity)( GLvector4f *to_vec,
10123caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell				 const GLfloat m[16],
1025e23af22f708a66695c0e44e599c26f02d8d4dcdGareth Hughes				 const GLvector4f *from_vec )
10323caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell{
10423caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   const GLuint stride = from_vec->stride;
10523caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   GLfloat *from = from_vec->start;
10623caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   GLuint count = from_vec->count;
10723caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start;
10823caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   GLuint i;
109a6c423d95663cfd8601cf84e10e8e1b12fa6ef15Brian Paul   (void) m;
11023caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   if (to_vec == from_vec) return;
11123caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   STRIDE_LOOP {
1125e23af22f708a66695c0e44e599c26f02d8d4dcdGareth Hughes      to[i][0] = from[0];
11323caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   }
11423caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   to_vec->size = 1;
11523caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   to_vec->flags |= VEC_SIZE_1;
11623caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   to_vec->count = from_vec->count;
11723caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell}
11823caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell
11923caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwellstatic void _XFORMAPI
12023caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith WhitwellTAG(transform_points1_2d)( GLvector4f *to_vec,
12123caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell			   const GLfloat m[16],
1225e23af22f708a66695c0e44e599c26f02d8d4dcdGareth Hughes			   const GLvector4f *from_vec )
12323caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell{
12423caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   const GLuint stride = from_vec->stride;
12523caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   GLfloat *from = from_vec->start;
12623caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start;
12723caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   GLuint count = from_vec->count;
12823caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   const GLfloat m0 = m[0], m1 = m[1];
12923caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   const GLfloat m12 = m[12], m13 = m[13];
13023caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   GLuint i;
13123caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   STRIDE_LOOP {
1325e23af22f708a66695c0e44e599c26f02d8d4dcdGareth Hughes      const GLfloat ox = from[0];
1335e23af22f708a66695c0e44e599c26f02d8d4dcdGareth Hughes      to[i][0] = m0 * ox + m12;
1345e23af22f708a66695c0e44e599c26f02d8d4dcdGareth Hughes      to[i][1] = m1 * ox + m13;
13523caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   }
13623caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   to_vec->size = 2;
13723caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   to_vec->flags |= VEC_SIZE_2;
13823caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   to_vec->count = from_vec->count;
13923caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell}
14023caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell
14123caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwellstatic void _XFORMAPI
14223caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith WhitwellTAG(transform_points1_2d_no_rot)( GLvector4f *to_vec,
14323caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell				  const GLfloat m[16],
1445e23af22f708a66695c0e44e599c26f02d8d4dcdGareth Hughes				  const GLvector4f *from_vec )
14523caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell{
14623caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   const GLuint stride = from_vec->stride;
14723caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   GLfloat *from = from_vec->start;
14823caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start;
14923caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   GLuint count = from_vec->count;
15023caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   const GLfloat m0 = m[0], m12 = m[12], m13 = m[13];
15123caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   GLuint i;
15223caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   STRIDE_LOOP {
1535e23af22f708a66695c0e44e599c26f02d8d4dcdGareth Hughes      const GLfloat ox = from[0];
1545e23af22f708a66695c0e44e599c26f02d8d4dcdGareth Hughes      to[i][0] = m0 * ox + m12;
1555e23af22f708a66695c0e44e599c26f02d8d4dcdGareth Hughes      to[i][1] =           m13;
15623caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   }
15723caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   to_vec->size = 2;
15823caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   to_vec->flags |= VEC_SIZE_2;
15923caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   to_vec->count = from_vec->count;
16023caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell}
16123caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell
16223caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwellstatic void _XFORMAPI
16323caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith WhitwellTAG(transform_points1_3d)( GLvector4f *to_vec,
16423caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell			   const GLfloat m[16],
1655e23af22f708a66695c0e44e599c26f02d8d4dcdGareth Hughes			   const GLvector4f *from_vec )
16623caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell{
16723caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   const GLuint stride = from_vec->stride;
16823caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   GLfloat *from = from_vec->start;
16923caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start;
17023caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   GLuint count = from_vec->count;
17123caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   const GLfloat m0 = m[0], m1 = m[1], m2 = m[2];
17223caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   const GLfloat m12 = m[12], m13 = m[13], m14 = m[14];
17323caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   GLuint i;
17423caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   STRIDE_LOOP {
1755e23af22f708a66695c0e44e599c26f02d8d4dcdGareth Hughes      const GLfloat ox = from[0];
1765e23af22f708a66695c0e44e599c26f02d8d4dcdGareth Hughes      to[i][0] = m0 * ox + m12;
1775e23af22f708a66695c0e44e599c26f02d8d4dcdGareth Hughes      to[i][1] = m1 * ox + m13;
1785e23af22f708a66695c0e44e599c26f02d8d4dcdGareth Hughes      to[i][2] = m2 * ox + m14;
17923caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   }
18023caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   to_vec->size = 3;
18123caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   to_vec->flags |= VEC_SIZE_3;
18223caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   to_vec->count = from_vec->count;
18323caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell}
18423caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell
18523caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell
18623caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwellstatic void _XFORMAPI
18723caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith WhitwellTAG(transform_points1_3d_no_rot)( GLvector4f *to_vec,
18823caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell				  const GLfloat m[16],
1895e23af22f708a66695c0e44e599c26f02d8d4dcdGareth Hughes				  const GLvector4f *from_vec )
19023caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell{
19123caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   const GLuint stride = from_vec->stride;
19223caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   GLfloat *from = from_vec->start;
19323caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start;
19423caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   GLuint count = from_vec->count;
19523caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   const GLfloat m0 = m[0];
19623caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   const GLfloat m12 = m[12], m13 = m[13], m14 = m[14];
19723caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   GLuint i;
19823caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   STRIDE_LOOP {
1995e23af22f708a66695c0e44e599c26f02d8d4dcdGareth Hughes      const GLfloat ox = from[0];
2005e23af22f708a66695c0e44e599c26f02d8d4dcdGareth Hughes      to[i][0] = m0 * ox           + m12;
2015e23af22f708a66695c0e44e599c26f02d8d4dcdGareth Hughes      to[i][1] =                     m13;
2025e23af22f708a66695c0e44e599c26f02d8d4dcdGareth Hughes      to[i][2] =                     m14;
20323caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   }
20423caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   to_vec->size = 3;
20523caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   to_vec->flags |= VEC_SIZE_3;
20623caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   to_vec->count = from_vec->count;
20723caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell}
20823caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell
20923caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwellstatic void _XFORMAPI
21023caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith WhitwellTAG(transform_points1_perspective)( GLvector4f *to_vec,
21123caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell				    const GLfloat m[16],
2125e23af22f708a66695c0e44e599c26f02d8d4dcdGareth Hughes				    const GLvector4f *from_vec )
21323caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell{
21423caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   const GLuint stride = from_vec->stride;
21523caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   GLfloat *from = from_vec->start;
21623caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start;
21723caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   GLuint count = from_vec->count;
21823caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   const GLfloat m0 = m[0], m14 = m[14];
21923caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   GLuint i;
22023caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   STRIDE_LOOP {
2215e23af22f708a66695c0e44e599c26f02d8d4dcdGareth Hughes      const GLfloat ox = from[0];
2225e23af22f708a66695c0e44e599c26f02d8d4dcdGareth Hughes      to[i][0] = m0 * ox                ;
2235e23af22f708a66695c0e44e599c26f02d8d4dcdGareth Hughes      to[i][1] =           0            ;
2245e23af22f708a66695c0e44e599c26f02d8d4dcdGareth Hughes      to[i][2] =                     m14;
2255e23af22f708a66695c0e44e599c26f02d8d4dcdGareth Hughes      to[i][3] = 0;
22623caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   }
22723caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   to_vec->size = 4;
22823caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   to_vec->flags |= VEC_SIZE_4;
22923caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   to_vec->count = from_vec->count;
23023caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell}
23123caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell
23223caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell
23323caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell
23423caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell
23523caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell/* 2-vectors, which are a lot more relevant than 1-vectors, are
23623caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell * present early in the geometry pipeline and throughout the
23723caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell * texture pipeline.
23823caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell */
23923caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwellstatic void _XFORMAPI
24023caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith WhitwellTAG(transform_points2_general)( GLvector4f *to_vec,
24123caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell				const GLfloat m[16],
2425e23af22f708a66695c0e44e599c26f02d8d4dcdGareth Hughes				const GLvector4f *from_vec )
24323caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell{
24423caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   const GLuint stride = from_vec->stride;
24523caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   GLfloat *from = from_vec->start;
24623caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start;
24723caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   GLuint count = from_vec->count;
24823caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   const GLfloat m0 = m[0],  m4 = m[4],  m12 = m[12];
24923caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   const GLfloat m1 = m[1],  m5 = m[5],  m13 = m[13];
25023caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   const GLfloat m2 = m[2],  m6 = m[6],  m14 = m[14];
25123caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   const GLfloat m3 = m[3],  m7 = m[7],  m15 = m[15];
25223caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   GLuint i;
25323caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   STRIDE_LOOP {
2545e23af22f708a66695c0e44e599c26f02d8d4dcdGareth Hughes      const GLfloat ox = from[0], oy = from[1];
2555e23af22f708a66695c0e44e599c26f02d8d4dcdGareth Hughes      to[i][0] = m0 * ox + m4 * oy + m12;
2565e23af22f708a66695c0e44e599c26f02d8d4dcdGareth Hughes      to[i][1] = m1 * ox + m5 * oy + m13;
2575e23af22f708a66695c0e44e599c26f02d8d4dcdGareth Hughes      to[i][2] = m2 * ox + m6 * oy + m14;
2585e23af22f708a66695c0e44e599c26f02d8d4dcdGareth Hughes      to[i][3] = m3 * ox + m7 * oy + m15;
25923caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   }
26023caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   to_vec->size = 4;
26123caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   to_vec->flags |= VEC_SIZE_4;
26223caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   to_vec->count = from_vec->count;
26323caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell}
26423caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell
26523caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwellstatic void _XFORMAPI
26623caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith WhitwellTAG(transform_points2_identity)( GLvector4f *to_vec,
26723caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell				 const GLfloat m[16],
2685e23af22f708a66695c0e44e599c26f02d8d4dcdGareth Hughes				 const GLvector4f *from_vec )
26923caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell{
27023caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   const GLuint stride = from_vec->stride;
27123caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   GLfloat *from = from_vec->start;
27223caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start;
27323caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   GLuint count = from_vec->count;
27423caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   GLuint i;
275a6c423d95663cfd8601cf84e10e8e1b12fa6ef15Brian Paul   (void) m;
27623caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   if (to_vec == from_vec) return;
27723caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   STRIDE_LOOP {
2785e23af22f708a66695c0e44e599c26f02d8d4dcdGareth Hughes      to[i][0] = from[0];
2795e23af22f708a66695c0e44e599c26f02d8d4dcdGareth Hughes      to[i][1] = from[1];
28023caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   }
28123caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   to_vec->size = 2;
28223caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   to_vec->flags |= VEC_SIZE_2;
28323caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   to_vec->count = from_vec->count;
28423caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell}
28523caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell
28623caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwellstatic void _XFORMAPI
28723caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith WhitwellTAG(transform_points2_2d)( GLvector4f *to_vec,
28823caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell			   const GLfloat m[16],
2895e23af22f708a66695c0e44e599c26f02d8d4dcdGareth Hughes			   const GLvector4f *from_vec )
29023caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell{
29123caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   const GLuint stride = from_vec->stride;
29223caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   GLfloat *from = from_vec->start;
29323caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start;
29423caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   GLuint count = from_vec->count;
29523caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   const GLfloat m0 = m[0], m1 = m[1], m4 = m[4], m5 = m[5];
29623caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   const GLfloat m12 = m[12], m13 = m[13];
29723caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   GLuint i;
29823caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   STRIDE_LOOP {
2995e23af22f708a66695c0e44e599c26f02d8d4dcdGareth Hughes      const GLfloat ox = from[0], oy = from[1];
3005e23af22f708a66695c0e44e599c26f02d8d4dcdGareth Hughes      to[i][0] = m0 * ox + m4 * oy + m12;
3015e23af22f708a66695c0e44e599c26f02d8d4dcdGareth Hughes      to[i][1] = m1 * ox + m5 * oy + m13;
30223caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   }
30323caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   to_vec->size = 2;
30423caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   to_vec->flags |= VEC_SIZE_2;
30523caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   to_vec->count = from_vec->count;
30623caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell}
30723caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell
30823caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwellstatic void _XFORMAPI
30923caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith WhitwellTAG(transform_points2_2d_no_rot)( GLvector4f *to_vec,
31023caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell				  const GLfloat m[16],
3115e23af22f708a66695c0e44e599c26f02d8d4dcdGareth Hughes				  const GLvector4f *from_vec )
31223caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell{
31323caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   const GLuint stride = from_vec->stride;
31423caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   GLfloat *from = from_vec->start;
31523caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start;
31623caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   GLuint count = from_vec->count;
31723caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   const GLfloat m0 = m[0], m5 = m[5], m12 = m[12], m13 = m[13];
31823caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   GLuint i;
31923caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   STRIDE_LOOP {
3205e23af22f708a66695c0e44e599c26f02d8d4dcdGareth Hughes      const GLfloat ox = from[0], oy = from[1];
3215e23af22f708a66695c0e44e599c26f02d8d4dcdGareth Hughes      to[i][0] = m0 * ox           + m12;
3225e23af22f708a66695c0e44e599c26f02d8d4dcdGareth Hughes      to[i][1] =           m5 * oy + m13;
32323caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   }
32423caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   to_vec->size = 2;
32523caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   to_vec->flags |= VEC_SIZE_2;
32623caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   to_vec->count = from_vec->count;
32723caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell}
32823caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell
32923caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwellstatic void _XFORMAPI
33023caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith WhitwellTAG(transform_points2_3d)( GLvector4f *to_vec,
33123caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell			   const GLfloat m[16],
3325e23af22f708a66695c0e44e599c26f02d8d4dcdGareth Hughes			   const GLvector4f *from_vec )
33323caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell{
33423caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   const GLuint stride = from_vec->stride;
33523caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   GLfloat *from = from_vec->start;
33623caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start;
33723caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   GLuint count = from_vec->count;
33823caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   const GLfloat m0 = m[0], m1 = m[1], m2 = m[2], m4 = m[4], m5 = m[5];
33923caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   const GLfloat m6 = m[6], m12 = m[12], m13 = m[13], m14 = m[14];
34023caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   GLuint i;
34123caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   STRIDE_LOOP {
3425e23af22f708a66695c0e44e599c26f02d8d4dcdGareth Hughes      const GLfloat ox = from[0], oy = from[1];
3435e23af22f708a66695c0e44e599c26f02d8d4dcdGareth Hughes      to[i][0] = m0 * ox + m4 * oy + m12;
3445e23af22f708a66695c0e44e599c26f02d8d4dcdGareth Hughes      to[i][1] = m1 * ox + m5 * oy + m13;
3455e23af22f708a66695c0e44e599c26f02d8d4dcdGareth Hughes      to[i][2] = m2 * ox + m6 * oy + m14;
34623caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   }
34723caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   to_vec->size = 3;
34823caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   to_vec->flags |= VEC_SIZE_3;
34923caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   to_vec->count = from_vec->count;
35023caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell}
35123caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell
35223caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell
35323caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell/* I would actually say this was a fairly important function, from
35423caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell * a texture transformation point of view.
35523caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell */
35623caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwellstatic void _XFORMAPI
35723caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith WhitwellTAG(transform_points2_3d_no_rot)( GLvector4f *to_vec,
35823caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell				  const GLfloat m[16],
3595e23af22f708a66695c0e44e599c26f02d8d4dcdGareth Hughes				  const GLvector4f *from_vec )
36023caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell{
36123caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   const GLuint stride = from_vec->stride;
36223caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   GLfloat *from = from_vec->start;
36323caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start;
36423caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   GLuint count = from_vec->count;
36523caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   const GLfloat m0 = m[0], m5 = m[5];
36623caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   const GLfloat m12 = m[12], m13 = m[13], m14 = m[14];
36723caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   GLuint i;
36823caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   STRIDE_LOOP {
3695e23af22f708a66695c0e44e599c26f02d8d4dcdGareth Hughes      const GLfloat ox = from[0], oy = from[1];
3705e23af22f708a66695c0e44e599c26f02d8d4dcdGareth Hughes      to[i][0] = m0 * ox           + m12;
3715e23af22f708a66695c0e44e599c26f02d8d4dcdGareth Hughes      to[i][1] =           m5 * oy + m13;
3725e23af22f708a66695c0e44e599c26f02d8d4dcdGareth Hughes      to[i][2] =                     m14;
37323caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   }
37423caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   if (m14 == 0) {
37523caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell      to_vec->size = 2;
37623caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell      to_vec->flags |= VEC_SIZE_2;
37723caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   } else {
37823caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell      to_vec->size = 3;
37923caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell      to_vec->flags |= VEC_SIZE_3;
38023caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   }
38123caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   to_vec->count = from_vec->count;
38223caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell}
38323caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell
384cab974cf6c2dbfbf5dd5d291e1aae0f8eeb34290Keith Whitwell
38523caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwellstatic void _XFORMAPI
38623caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith WhitwellTAG(transform_points2_perspective)( GLvector4f *to_vec,
38723caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell				    const GLfloat m[16],
3885e23af22f708a66695c0e44e599c26f02d8d4dcdGareth Hughes				    const GLvector4f *from_vec )
38923caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell{
39023caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   const GLuint stride = from_vec->stride;
39123caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   GLfloat *from = from_vec->start;
39223caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start;
39323caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   GLuint count = from_vec->count;
39423caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   const GLfloat m0 = m[0], m5 = m[5], m14 = m[14];
39523caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   GLuint i;
39623caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   STRIDE_LOOP {
3975e23af22f708a66695c0e44e599c26f02d8d4dcdGareth Hughes      const GLfloat ox = from[0], oy = from[1];
3985e23af22f708a66695c0e44e599c26f02d8d4dcdGareth Hughes      to[i][0] = m0 * ox                ;
3995e23af22f708a66695c0e44e599c26f02d8d4dcdGareth Hughes      to[i][1] =           m5 * oy      ;
4005e23af22f708a66695c0e44e599c26f02d8d4dcdGareth Hughes      to[i][2] =                     m14;
4015e23af22f708a66695c0e44e599c26f02d8d4dcdGareth Hughes      to[i][3] = 0;
40223caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   }
40323caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   to_vec->size = 4;
40423caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   to_vec->flags |= VEC_SIZE_4;
40523caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   to_vec->count = from_vec->count;
40623caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell}
40723caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell
40823caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell
40923caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell
41023caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwellstatic void _XFORMAPI
41123caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith WhitwellTAG(transform_points3_general)( GLvector4f *to_vec,
41223caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell				const GLfloat m[16],
4135e23af22f708a66695c0e44e599c26f02d8d4dcdGareth Hughes				const GLvector4f *from_vec )
41423caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell{
41523caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   const GLuint stride = from_vec->stride;
41623caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   GLfloat *from = from_vec->start;
41723caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start;
41823caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   GLuint count = from_vec->count;
41923caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   const GLfloat m0 = m[0],  m4 = m[4],  m8 = m[8],  m12 = m[12];
42023caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   const GLfloat m1 = m[1],  m5 = m[5],  m9 = m[9],  m13 = m[13];
42123caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   const GLfloat m2 = m[2],  m6 = m[6],  m10 = m[10],  m14 = m[14];
42223caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   const GLfloat m3 = m[3],  m7 = m[7],  m11 = m[11],  m15 = m[15];
42323caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   GLuint i;
42423caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   STRIDE_LOOP {
4255e23af22f708a66695c0e44e599c26f02d8d4dcdGareth Hughes      const GLfloat ox = from[0], oy = from[1], oz = from[2];
4265e23af22f708a66695c0e44e599c26f02d8d4dcdGareth Hughes      to[i][0] = m0 * ox + m4 * oy + m8  * oz + m12;
4275e23af22f708a66695c0e44e599c26f02d8d4dcdGareth Hughes      to[i][1] = m1 * ox + m5 * oy + m9  * oz + m13;
4285e23af22f708a66695c0e44e599c26f02d8d4dcdGareth Hughes      to[i][2] = m2 * ox + m6 * oy + m10 * oz + m14;
4295e23af22f708a66695c0e44e599c26f02d8d4dcdGareth Hughes      to[i][3] = m3 * ox + m7 * oy + m11 * oz + m15;
43023caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   }
43123caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   to_vec->size = 4;
43223caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   to_vec->flags |= VEC_SIZE_4;
43323caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   to_vec->count = from_vec->count;
43423caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell}
43523caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell
43623caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwellstatic void _XFORMAPI
43723caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith WhitwellTAG(transform_points3_identity)( GLvector4f *to_vec,
43823caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell				 const GLfloat m[16],
4395e23af22f708a66695c0e44e599c26f02d8d4dcdGareth Hughes				 const GLvector4f *from_vec )
44023caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell{
44123caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   const GLuint stride = from_vec->stride;
44223caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   GLfloat *from = from_vec->start;
44323caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start;
44423caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   GLuint count = from_vec->count;
44523caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   GLuint i;
446a6c423d95663cfd8601cf84e10e8e1b12fa6ef15Brian Paul   (void) m;
44723caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   if (to_vec == from_vec) return;
44823caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   STRIDE_LOOP {
4495e23af22f708a66695c0e44e599c26f02d8d4dcdGareth Hughes      to[i][0] = from[0];
4505e23af22f708a66695c0e44e599c26f02d8d4dcdGareth Hughes      to[i][1] = from[1];
4515e23af22f708a66695c0e44e599c26f02d8d4dcdGareth Hughes      to[i][2] = from[2];
45223caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   }
45323caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   to_vec->size = 3;
45423caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   to_vec->flags |= VEC_SIZE_3;
45523caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   to_vec->count = from_vec->count;
45623caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell}
45723caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell
45823caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwellstatic void _XFORMAPI
45923caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith WhitwellTAG(transform_points3_2d)( GLvector4f *to_vec,
46023caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell			   const GLfloat m[16],
4615e23af22f708a66695c0e44e599c26f02d8d4dcdGareth Hughes			   const GLvector4f *from_vec )
46223caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell{
46323caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   const GLuint stride = from_vec->stride;
46423caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   GLfloat *from = from_vec->start;
46523caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start;
46623caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   GLuint count = from_vec->count;
46723caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   const GLfloat m0 = m[0], m1 = m[1], m4 = m[4], m5 = m[5];
46823caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   const GLfloat m12 = m[12], m13 = m[13];
46923caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   GLuint i;
47023caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   STRIDE_LOOP {
4715e23af22f708a66695c0e44e599c26f02d8d4dcdGareth Hughes      const GLfloat ox = from[0], oy = from[1], oz = from[2];
4725e23af22f708a66695c0e44e599c26f02d8d4dcdGareth Hughes      to[i][0] = m0 * ox + m4 * oy            + m12       ;
4735e23af22f708a66695c0e44e599c26f02d8d4dcdGareth Hughes      to[i][1] = m1 * ox + m5 * oy            + m13       ;
4745e23af22f708a66695c0e44e599c26f02d8d4dcdGareth Hughes      to[i][2] =                   +       oz             ;
47523caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   }
47623caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   to_vec->size = 3;
47723caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   to_vec->flags |= VEC_SIZE_3;
47823caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   to_vec->count = from_vec->count;
47923caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell}
48023caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell
48123caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwellstatic void _XFORMAPI
48223caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith WhitwellTAG(transform_points3_2d_no_rot)( GLvector4f *to_vec,
48323caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell				  const GLfloat m[16],
4845e23af22f708a66695c0e44e599c26f02d8d4dcdGareth Hughes				  const GLvector4f *from_vec )
48523caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell{
48623caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   const GLuint stride = from_vec->stride;
48723caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   GLfloat *from = from_vec->start;
48823caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start;
48923caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   GLuint count = from_vec->count;
49023caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   const GLfloat m0 = m[0], m5 = m[5], m12 = m[12], m13 = m[13];
49123caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   GLuint i;
49223caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   STRIDE_LOOP {
4935e23af22f708a66695c0e44e599c26f02d8d4dcdGareth Hughes      const GLfloat ox = from[0], oy = from[1], oz = from[2];
4945e23af22f708a66695c0e44e599c26f02d8d4dcdGareth Hughes      to[i][0] = m0 * ox                      + m12       ;
4955e23af22f708a66695c0e44e599c26f02d8d4dcdGareth Hughes      to[i][1] =           m5 * oy            + m13       ;
4965e23af22f708a66695c0e44e599c26f02d8d4dcdGareth Hughes      to[i][2] =                   +       oz             ;
49723caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   }
49823caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   to_vec->size = 3;
49923caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   to_vec->flags |= VEC_SIZE_3;
50023caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   to_vec->count = from_vec->count;
50123caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell}
50223caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell
50323caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwellstatic void _XFORMAPI
50423caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith WhitwellTAG(transform_points3_3d)( GLvector4f *to_vec,
50523caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell			   const GLfloat m[16],
5065e23af22f708a66695c0e44e599c26f02d8d4dcdGareth Hughes			   const GLvector4f *from_vec )
50723caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell{
50823caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   const GLuint stride = from_vec->stride;
50923caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   GLfloat *from = from_vec->start;
51023caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start;
51123caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   GLuint count = from_vec->count;
51223caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   const GLfloat m0 = m[0], m1 = m[1], m2 = m[2], m4 = m[4], m5 = m[5];
51323caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   const GLfloat m6 = m[6], m8 = m[8], m9 = m[9], m10 = m[10];
51423caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   const GLfloat m12 = m[12], m13 = m[13], m14 = m[14];
51523caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   GLuint i;
51623caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   STRIDE_LOOP {
5175e23af22f708a66695c0e44e599c26f02d8d4dcdGareth Hughes      const GLfloat ox = from[0], oy = from[1], oz = from[2];
5185e23af22f708a66695c0e44e599c26f02d8d4dcdGareth Hughes      to[i][0] = m0 * ox + m4 * oy +  m8 * oz + m12       ;
5195e23af22f708a66695c0e44e599c26f02d8d4dcdGareth Hughes      to[i][1] = m1 * ox + m5 * oy +  m9 * oz + m13       ;
5205e23af22f708a66695c0e44e599c26f02d8d4dcdGareth Hughes      to[i][2] = m2 * ox + m6 * oy + m10 * oz + m14       ;
52123caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   }
52223caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   to_vec->size = 3;
52323caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   to_vec->flags |= VEC_SIZE_3;
52423caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   to_vec->count = from_vec->count;
52523caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell}
52623caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell
52723caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell/* previously known as ortho...
52823caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell */
52923caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwellstatic void _XFORMAPI
53023caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith WhitwellTAG(transform_points3_3d_no_rot)( GLvector4f *to_vec,
53123caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell				  const GLfloat m[16],
5325e23af22f708a66695c0e44e599c26f02d8d4dcdGareth Hughes				  const GLvector4f *from_vec )
53323caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell{
53423caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   const GLuint stride = from_vec->stride;
53523caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   GLfloat *from = from_vec->start;
53623caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start;
53723caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   GLuint count = from_vec->count;
53823caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   const GLfloat m0 = m[0], m5 = m[5];
53923caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   const GLfloat m10 = m[10], m12 = m[12], m13 = m[13], m14 = m[14];
54023caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   GLuint i;
54123caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   STRIDE_LOOP {
5425e23af22f708a66695c0e44e599c26f02d8d4dcdGareth Hughes      const GLfloat ox = from[0], oy = from[1], oz = from[2];
5435e23af22f708a66695c0e44e599c26f02d8d4dcdGareth Hughes      to[i][0] = m0 * ox                      + m12       ;
5445e23af22f708a66695c0e44e599c26f02d8d4dcdGareth Hughes      to[i][1] =           m5 * oy            + m13       ;
5455e23af22f708a66695c0e44e599c26f02d8d4dcdGareth Hughes      to[i][2] =                     m10 * oz + m14       ;
54623caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   }
54723caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   to_vec->size = 3;
54823caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   to_vec->flags |= VEC_SIZE_3;
54923caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   to_vec->count = from_vec->count;
55023caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell}
55123caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell
55223caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwellstatic void _XFORMAPI
55323caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith WhitwellTAG(transform_points3_perspective)( GLvector4f *to_vec,
55423caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell				    const GLfloat m[16],
5555e23af22f708a66695c0e44e599c26f02d8d4dcdGareth Hughes				    const GLvector4f *from_vec )
55623caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell{
55723caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   const GLuint stride = from_vec->stride;
55823caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   GLfloat *from = from_vec->start;
55923caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start;
56023caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   GLuint count = from_vec->count;
56123caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   const GLfloat m0 = m[0], m5 = m[5], m8 = m[8], m9 = m[9];
56223caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   const GLfloat m10 = m[10], m14 = m[14];
56323caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   GLuint i;
56423caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   STRIDE_LOOP {
5655e23af22f708a66695c0e44e599c26f02d8d4dcdGareth Hughes      const GLfloat ox = from[0], oy = from[1], oz = from[2];
5665e23af22f708a66695c0e44e599c26f02d8d4dcdGareth Hughes      to[i][0] = m0 * ox           + m8  * oz       ;
5675e23af22f708a66695c0e44e599c26f02d8d4dcdGareth Hughes      to[i][1] =           m5 * oy + m9  * oz       ;
5685e23af22f708a66695c0e44e599c26f02d8d4dcdGareth Hughes      to[i][2] =                     m10 * oz + m14 ;
5695e23af22f708a66695c0e44e599c26f02d8d4dcdGareth Hughes      to[i][3] =                          -oz       ;
57023caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   }
57123caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   to_vec->size = 4;
57223caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   to_vec->flags |= VEC_SIZE_4;
57323caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   to_vec->count = from_vec->count;
57423caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell}
57523caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell
57623caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell
57723caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell
57823caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwellstatic void _XFORMAPI
57923caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith WhitwellTAG(transform_points4_general)( GLvector4f *to_vec,
58023caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell				const GLfloat m[16],
5815e23af22f708a66695c0e44e599c26f02d8d4dcdGareth Hughes				const GLvector4f *from_vec )
58223caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell{
58323caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   const GLuint stride = from_vec->stride;
58423caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   GLfloat *from = from_vec->start;
58523caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start;
58623caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   GLuint count = from_vec->count;
58723caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   const GLfloat m0 = m[0],  m4 = m[4],  m8 = m[8],  m12 = m[12];
58823caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   const GLfloat m1 = m[1],  m5 = m[5],  m9 = m[9],  m13 = m[13];
58923caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   const GLfloat m2 = m[2],  m6 = m[6],  m10 = m[10],  m14 = m[14];
59023caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   const GLfloat m3 = m[3],  m7 = m[7],  m11 = m[11],  m15 = m[15];
59123caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   GLuint i;
59223caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   STRIDE_LOOP {
5935e23af22f708a66695c0e44e599c26f02d8d4dcdGareth Hughes      const GLfloat ox = from[0], oy = from[1], oz = from[2], ow = from[3];
5945e23af22f708a66695c0e44e599c26f02d8d4dcdGareth Hughes      to[i][0] = m0 * ox + m4 * oy + m8  * oz + m12 * ow;
5955e23af22f708a66695c0e44e599c26f02d8d4dcdGareth Hughes      to[i][1] = m1 * ox + m5 * oy + m9  * oz + m13 * ow;
5965e23af22f708a66695c0e44e599c26f02d8d4dcdGareth Hughes      to[i][2] = m2 * ox + m6 * oy + m10 * oz + m14 * ow;
5975e23af22f708a66695c0e44e599c26f02d8d4dcdGareth Hughes      to[i][3] = m3 * ox + m7 * oy + m11 * oz + m15 * ow;
59823caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   }
59923caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   to_vec->size = 4;
60023caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   to_vec->flags |= VEC_SIZE_4;
60123caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   to_vec->count = from_vec->count;
60223caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell}
60323caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell
60423caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwellstatic void _XFORMAPI
60523caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith WhitwellTAG(transform_points4_identity)( GLvector4f *to_vec,
60623caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell				 const GLfloat m[16],
6075e23af22f708a66695c0e44e599c26f02d8d4dcdGareth Hughes				 const GLvector4f *from_vec )
60823caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell{
60923caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   const GLuint stride = from_vec->stride;
61023caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   GLfloat *from = from_vec->start;
61123caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start;
61223caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   GLuint count = from_vec->count;
61323caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   GLuint i;
614a6c423d95663cfd8601cf84e10e8e1b12fa6ef15Brian Paul   (void) m;
61523caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   if (to_vec == from_vec) return;
61623caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   STRIDE_LOOP {
6175e23af22f708a66695c0e44e599c26f02d8d4dcdGareth Hughes      to[i][0] = from[0];
6185e23af22f708a66695c0e44e599c26f02d8d4dcdGareth Hughes      to[i][1] = from[1];
6195e23af22f708a66695c0e44e599c26f02d8d4dcdGareth Hughes      to[i][2] = from[2];
6205e23af22f708a66695c0e44e599c26f02d8d4dcdGareth Hughes      to[i][3] = from[3];
62123caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   }
62223caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   to_vec->size = 4;
62323caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   to_vec->flags |= VEC_SIZE_4;
62423caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   to_vec->count = from_vec->count;
62523caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell}
62623caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell
62723caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwellstatic void _XFORMAPI
62823caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith WhitwellTAG(transform_points4_2d)( GLvector4f *to_vec,
62923caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell			   const GLfloat m[16],
6305e23af22f708a66695c0e44e599c26f02d8d4dcdGareth Hughes			   const GLvector4f *from_vec )
63123caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell{
63223caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   const GLuint stride = from_vec->stride;
63323caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   GLfloat *from = from_vec->start;
63423caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start;
63523caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   GLuint count = from_vec->count;
63623caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   const GLfloat m0 = m[0], m1 = m[1], m4 = m[4], m5 = m[5];
63723caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   const GLfloat m12 = m[12], m13 = m[13];
63823caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   GLuint i;
63923caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   STRIDE_LOOP {
6405e23af22f708a66695c0e44e599c26f02d8d4dcdGareth Hughes      const GLfloat ox = from[0], oy = from[1], oz = from[2], ow = from[3];
6415e23af22f708a66695c0e44e599c26f02d8d4dcdGareth Hughes      to[i][0] = m0 * ox + m4 * oy            + m12 * ow;
6425e23af22f708a66695c0e44e599c26f02d8d4dcdGareth Hughes      to[i][1] = m1 * ox + m5 * oy            + m13 * ow;
6435e23af22f708a66695c0e44e599c26f02d8d4dcdGareth Hughes      to[i][2] =                   +       oz           ;
6445e23af22f708a66695c0e44e599c26f02d8d4dcdGareth Hughes      to[i][3] =                                      ow;
64523caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   }
64623caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   to_vec->size = 4;
64723caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   to_vec->flags |= VEC_SIZE_4;
64823caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   to_vec->count = from_vec->count;
64923caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell}
65023caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell
65123caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwellstatic void _XFORMAPI
65223caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith WhitwellTAG(transform_points4_2d_no_rot)( GLvector4f *to_vec,
65323caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell				  const GLfloat m[16],
6545e23af22f708a66695c0e44e599c26f02d8d4dcdGareth Hughes				  const GLvector4f *from_vec )
65523caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell{
65623caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   const GLuint stride = from_vec->stride;
65723caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   GLfloat *from = from_vec->start;
65823caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start;
65923caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   GLuint count = from_vec->count;
66023caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   const GLfloat m0 = m[0], m5 = m[5], m12 = m[12], m13 = m[13];
66123caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   GLuint i;
66223caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   STRIDE_LOOP {
6635e23af22f708a66695c0e44e599c26f02d8d4dcdGareth Hughes      const GLfloat ox = from[0], oy = from[1], oz = from[2], ow = from[3];
6645e23af22f708a66695c0e44e599c26f02d8d4dcdGareth Hughes      to[i][0] = m0 * ox                      + m12 * ow;
6655e23af22f708a66695c0e44e599c26f02d8d4dcdGareth Hughes      to[i][1] =           m5 * oy            + m13 * ow;
6665e23af22f708a66695c0e44e599c26f02d8d4dcdGareth Hughes      to[i][2] =                   +       oz           ;
6675e23af22f708a66695c0e44e599c26f02d8d4dcdGareth Hughes      to[i][3] =                                      ow;
66823caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   }
66923caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   to_vec->size = 4;
67023caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   to_vec->flags |= VEC_SIZE_4;
67123caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   to_vec->count = from_vec->count;
67223caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell}
67323caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell
67423caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwellstatic void _XFORMAPI
67523caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith WhitwellTAG(transform_points4_3d)( GLvector4f *to_vec,
67623caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell			   const GLfloat m[16],
6775e23af22f708a66695c0e44e599c26f02d8d4dcdGareth Hughes			   const GLvector4f *from_vec )
67823caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell{
67923caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   const GLuint stride = from_vec->stride;
68023caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   GLfloat *from = from_vec->start;
68123caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start;
68223caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   GLuint count = from_vec->count;
68323caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   const GLfloat m0 = m[0], m1 = m[1], m2 = m[2], m4 = m[4], m5 = m[5];
68423caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   const GLfloat m6 = m[6], m8 = m[8], m9 = m[9], m10 = m[10];
68523caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   const GLfloat m12 = m[12], m13 = m[13], m14 = m[14];
68623caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   GLuint i;
68723caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   STRIDE_LOOP {
6885e23af22f708a66695c0e44e599c26f02d8d4dcdGareth Hughes      const GLfloat ox = from[0], oy = from[1], oz = from[2], ow = from[3];
6895e23af22f708a66695c0e44e599c26f02d8d4dcdGareth Hughes      to[i][0] = m0 * ox + m4 * oy +  m8 * oz + m12 * ow;
6905e23af22f708a66695c0e44e599c26f02d8d4dcdGareth Hughes      to[i][1] = m1 * ox + m5 * oy +  m9 * oz + m13 * ow;
6915e23af22f708a66695c0e44e599c26f02d8d4dcdGareth Hughes      to[i][2] = m2 * ox + m6 * oy + m10 * oz + m14 * ow;
6925e23af22f708a66695c0e44e599c26f02d8d4dcdGareth Hughes      to[i][3] =                                      ow;
69323caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   }
69423caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   to_vec->size = 4;
69523caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   to_vec->flags |= VEC_SIZE_4;
69623caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   to_vec->count = from_vec->count;
69723caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell}
69823caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell
69923caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwellstatic void _XFORMAPI
70023caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith WhitwellTAG(transform_points4_3d_no_rot)( GLvector4f *to_vec,
70123caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell				  const GLfloat m[16],
7025e23af22f708a66695c0e44e599c26f02d8d4dcdGareth Hughes				  const GLvector4f *from_vec )
70323caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell{
70423caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   const GLuint stride = from_vec->stride;
70523caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   GLfloat *from = from_vec->start;
70623caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start;
70723caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   GLuint count = from_vec->count;
70823caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   const GLfloat m0 = m[0], m5 = m[5];
70923caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   const GLfloat m10 = m[10], m12 = m[12], m13 = m[13], m14 = m[14];
71023caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   GLuint i;
71123caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   STRIDE_LOOP {
7125e23af22f708a66695c0e44e599c26f02d8d4dcdGareth Hughes      const GLfloat ox = from[0], oy = from[1], oz = from[2], ow = from[3];
7135e23af22f708a66695c0e44e599c26f02d8d4dcdGareth Hughes      to[i][0] = m0 * ox                      + m12 * ow;
7145e23af22f708a66695c0e44e599c26f02d8d4dcdGareth Hughes      to[i][1] =           m5 * oy            + m13 * ow;
7155e23af22f708a66695c0e44e599c26f02d8d4dcdGareth Hughes      to[i][2] =                     m10 * oz + m14 * ow;
7165e23af22f708a66695c0e44e599c26f02d8d4dcdGareth Hughes      to[i][3] =                                      ow;
71723caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   }
71823caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   to_vec->size = 4;
71923caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   to_vec->flags |= VEC_SIZE_4;
72023caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   to_vec->count = from_vec->count;
72123caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell}
72223caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell
72323caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwellstatic void _XFORMAPI
72423caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith WhitwellTAG(transform_points4_perspective)( GLvector4f *to_vec,
72523caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell				    const GLfloat m[16],
7265e23af22f708a66695c0e44e599c26f02d8d4dcdGareth Hughes				    const GLvector4f *from_vec )
72723caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell{
72823caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   const GLuint stride = from_vec->stride;
72923caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   GLfloat *from = from_vec->start;
73023caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start;
73123caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   GLuint count = from_vec->count;
73223caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   const GLfloat m0 = m[0], m5 = m[5], m8 = m[8], m9 = m[9];
73323caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   const GLfloat m10 = m[10], m14 = m[14];
73423caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   GLuint i;
73523caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   STRIDE_LOOP {
7365e23af22f708a66695c0e44e599c26f02d8d4dcdGareth Hughes      const GLfloat ox = from[0], oy = from[1], oz = from[2], ow = from[3];
7375e23af22f708a66695c0e44e599c26f02d8d4dcdGareth Hughes      to[i][0] = m0 * ox           + m8  * oz            ;
7385e23af22f708a66695c0e44e599c26f02d8d4dcdGareth Hughes      to[i][1] =           m5 * oy + m9  * oz            ;
7395e23af22f708a66695c0e44e599c26f02d8d4dcdGareth Hughes      to[i][2] =                     m10 * oz + m14 * ow ;
7405e23af22f708a66695c0e44e599c26f02d8d4dcdGareth Hughes      to[i][3] =                          -oz            ;
74123caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   }
74223caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   to_vec->size = 4;
74323caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   to_vec->flags |= VEC_SIZE_4;
74423caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   to_vec->count = from_vec->count;
74523caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell}
74623caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell
747a6c423d95663cfd8601cf84e10e8e1b12fa6ef15Brian Paulstatic transform_func TAG(transform_tab_1)[7];
748a6c423d95663cfd8601cf84e10e8e1b12fa6ef15Brian Paulstatic transform_func TAG(transform_tab_2)[7];
749a6c423d95663cfd8601cf84e10e8e1b12fa6ef15Brian Paulstatic transform_func TAG(transform_tab_3)[7];
750a6c423d95663cfd8601cf84e10e8e1b12fa6ef15Brian Paulstatic transform_func TAG(transform_tab_4)[7];
75123caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell
75223caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell/* Similar functions could be called several times, with more highly
75323caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell * optimized routines overwriting the arrays.  This only occurs during
75423caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell * startup.
75523caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell */
75623caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwellstatic void _XFORMAPI TAG(init_c_transformations)( void )
75723caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell{
7585e23af22f708a66695c0e44e599c26f02d8d4dcdGareth Hughes#define TAG_TAB   _mesa_transform_tab
75923caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell#define TAG_TAB_1 TAG(transform_tab_1)
76023caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell#define TAG_TAB_2 TAG(transform_tab_2)
76123caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell#define TAG_TAB_3 TAG(transform_tab_3)
76223caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell#define TAG_TAB_4 TAG(transform_tab_4)
76323caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell
76423caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   TAG_TAB[1] = TAG_TAB_1;
76523caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   TAG_TAB[2] = TAG_TAB_2;
76623caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   TAG_TAB[3] = TAG_TAB_3;
76723caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   TAG_TAB[4] = TAG_TAB_4;
76823caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell
76923caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   /* 1-D points (ie texcoords) */
77023caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   TAG_TAB_1[MATRIX_GENERAL]     = TAG(transform_points1_general);
77123caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   TAG_TAB_1[MATRIX_IDENTITY]    = TAG(transform_points1_identity);
77223caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   TAG_TAB_1[MATRIX_3D_NO_ROT]   = TAG(transform_points1_3d_no_rot);
7735e23af22f708a66695c0e44e599c26f02d8d4dcdGareth Hughes   TAG_TAB_1[MATRIX_PERSPECTIVE] = TAG(transform_points1_perspective);
77423caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   TAG_TAB_1[MATRIX_2D]          = TAG(transform_points1_2d);
77523caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   TAG_TAB_1[MATRIX_2D_NO_ROT]   = TAG(transform_points1_2d_no_rot);
77623caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   TAG_TAB_1[MATRIX_3D]          = TAG(transform_points1_3d);
77723caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell
77823caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   /* 2-D points */
77923caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   TAG_TAB_2[MATRIX_GENERAL]     = TAG(transform_points2_general);
78023caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   TAG_TAB_2[MATRIX_IDENTITY]    = TAG(transform_points2_identity);
78123caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   TAG_TAB_2[MATRIX_3D_NO_ROT]   = TAG(transform_points2_3d_no_rot);
7825e23af22f708a66695c0e44e599c26f02d8d4dcdGareth Hughes   TAG_TAB_2[MATRIX_PERSPECTIVE] = TAG(transform_points2_perspective);
78323caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   TAG_TAB_2[MATRIX_2D]          = TAG(transform_points2_2d);
78423caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   TAG_TAB_2[MATRIX_2D_NO_ROT]   = TAG(transform_points2_2d_no_rot);
78523caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   TAG_TAB_2[MATRIX_3D]          = TAG(transform_points2_3d);
78623caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell
78723caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   /* 3-D points */
78823caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   TAG_TAB_3[MATRIX_GENERAL]     = TAG(transform_points3_general);
78923caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   TAG_TAB_3[MATRIX_IDENTITY]    = TAG(transform_points3_identity);
79023caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   TAG_TAB_3[MATRIX_3D_NO_ROT]   = TAG(transform_points3_3d_no_rot);
79123caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   TAG_TAB_3[MATRIX_PERSPECTIVE] = TAG(transform_points3_perspective);
79223caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   TAG_TAB_3[MATRIX_2D]          = TAG(transform_points3_2d);
79323caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   TAG_TAB_3[MATRIX_2D_NO_ROT]   = TAG(transform_points3_2d_no_rot);
79423caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   TAG_TAB_3[MATRIX_3D]          = TAG(transform_points3_3d);
79523caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell
79623caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   /* 4-D points */
79723caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   TAG_TAB_4[MATRIX_GENERAL]     = TAG(transform_points4_general);
79823caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   TAG_TAB_4[MATRIX_IDENTITY]    = TAG(transform_points4_identity);
79923caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   TAG_TAB_4[MATRIX_3D_NO_ROT]   = TAG(transform_points4_3d_no_rot);
80023caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   TAG_TAB_4[MATRIX_PERSPECTIVE] = TAG(transform_points4_perspective);
80123caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   TAG_TAB_4[MATRIX_2D]          = TAG(transform_points4_2d);
80223caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   TAG_TAB_4[MATRIX_2D_NO_ROT]   = TAG(transform_points4_2d_no_rot);
80323caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   TAG_TAB_4[MATRIX_3D]          = TAG(transform_points4_3d);
80423caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell
80523caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell#undef TAG_TAB
806d577248b8973bee8fa4f84be9f6c87eb33a3f163Brian Paul#undef TAG_TAB_1
807d577248b8973bee8fa4f84be9f6c87eb33a3f163Brian Paul#undef TAG_TAB_2
808d577248b8973bee8fa4f84be9f6c87eb33a3f163Brian Paul#undef TAG_TAB_3
809d577248b8973bee8fa4f84be9f6c87eb33a3f163Brian Paul#undef TAG_TAB_4
81023caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell}
811