1 /* $Id: nvvertexec.c,v 1.5 2003/03/29 16:04:31 brianp Exp $ */
4 * Mesa 3-D graphics library
7 * Copyright (C) 1999-2003 Brian Paul All Rights Reserved.
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:
16 * The above copyright notice and this permission notice shall be included
17 * in all copies or substantial portions of the Software.
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.
29 * \brief Code to execute vertex programs.
38 #include "nvvertexec.h"
39 #include "nvvertprog.h"
40 #include "math/m_matrix.h"
44 * Load/initialize the vertex program registers.
45 * This needs to be done per vertex.
48 _mesa_init_vp_registers(GLcontext
*ctx
)
50 struct vp_machine
*machine
= &(ctx
->VertexProgram
.Machine
);
53 /* Input registers get initialized from the current vertex attribs */
54 MEMCPY(machine
->Registers
[VP_INPUT_REG_START
],
56 16 * 4 * sizeof(GLfloat
));
58 /* Output and temp regs are initialized to [0,0,0,1] */
59 for (i
= VP_OUTPUT_REG_START
; i
<= VP_OUTPUT_REG_END
; i
++) {
60 machine
->Registers
[i
][0] = 0.0F
;
61 machine
->Registers
[i
][1] = 0.0F
;
62 machine
->Registers
[i
][2] = 0.0F
;
63 machine
->Registers
[i
][3] = 1.0F
;
65 for (i
= VP_TEMP_REG_START
; i
<= VP_TEMP_REG_END
; i
++) {
66 machine
->Registers
[i
][0] = 0.0F
;
67 machine
->Registers
[i
][1] = 0.0F
;
68 machine
->Registers
[i
][2] = 0.0F
;
69 machine
->Registers
[i
][3] = 1.0F
;
72 /* The program regs aren't touched */
78 * Copy the 16 elements of a matrix into four consecutive program
79 * registers starting at 'pos'.
82 load_matrix(GLfloat registers
[][4], GLuint pos
, const GLfloat mat
[16])
85 pos
+= VP_PROG_REG_START
;
86 for (i
= 0; i
< 4; i
++) {
87 registers
[pos
+ i
][0] = mat
[0 + i
];
88 registers
[pos
+ i
][1] = mat
[4 + i
];
89 registers
[pos
+ i
][2] = mat
[8 + i
];
90 registers
[pos
+ i
][3] = mat
[12 + i
];
96 * As above, but transpose the matrix.
99 load_transpose_matrix(GLfloat registers
[][4], GLuint pos
,
100 const GLfloat mat
[16])
102 pos
+= VP_PROG_REG_START
;
103 MEMCPY(registers
[pos
], mat
, 16 * sizeof(GLfloat
));
108 * Load all currently tracked matrices into the program registers.
109 * This needs to be done per glBegin/glEnd.
112 _mesa_init_tracked_matrices(GLcontext
*ctx
)
116 for (i
= 0; i
< VP_NUM_PROG_REGS
/ 4; i
++) {
117 /* point 'mat' at source matrix */
119 if (ctx
->VertexProgram
.TrackMatrix
[i
] == GL_MODELVIEW
) {
120 mat
= ctx
->ModelviewMatrixStack
.Top
;
122 else if (ctx
->VertexProgram
.TrackMatrix
[i
] == GL_PROJECTION
) {
123 mat
= ctx
->ProjectionMatrixStack
.Top
;
125 else if (ctx
->VertexProgram
.TrackMatrix
[i
] == GL_TEXTURE
) {
126 mat
= ctx
->TextureMatrixStack
[ctx
->Texture
.CurrentUnit
].Top
;
128 else if (ctx
->VertexProgram
.TrackMatrix
[i
] == GL_COLOR
) {
129 mat
= ctx
->ColorMatrixStack
.Top
;
131 else if (ctx
->VertexProgram
.TrackMatrix
[i
]==GL_MODELVIEW_PROJECTION_NV
) {
132 /* XXX verify the combined matrix is up to date */
133 mat
= &ctx
->_ModelProjectMatrix
;
135 else if (ctx
->VertexProgram
.TrackMatrix
[i
] >= GL_MATRIX0_NV
&&
136 ctx
->VertexProgram
.TrackMatrix
[i
] <= GL_MATRIX7_NV
) {
137 GLuint n
= ctx
->VertexProgram
.TrackMatrix
[i
] - GL_MATRIX0_NV
;
138 ASSERT(n
< MAX_PROGRAM_MATRICES
);
139 mat
= ctx
->ProgramMatrixStack
[n
].Top
;
142 /* no matrix is tracked, but we leave the register values as-is */
143 assert(ctx
->VertexProgram
.TrackMatrix
[i
] == GL_NONE
);
147 /* load the matrix */
148 if (ctx
->VertexProgram
.TrackMatrixTransform
[i
] == GL_IDENTITY_NV
) {
149 load_matrix(ctx
->VertexProgram
.Machine
.Registers
, i
*4, mat
->m
);
151 else if (ctx
->VertexProgram
.TrackMatrixTransform
[i
] == GL_INVERSE_NV
) {
152 _math_matrix_analyse(mat
); /* update the inverse */
153 assert((mat
->flags
& MAT_DIRTY_INVERSE
) == 0);
154 load_matrix(ctx
->VertexProgram
.Machine
.Registers
, i
*4, mat
->inv
);
156 else if (ctx
->VertexProgram
.TrackMatrixTransform
[i
] == GL_TRANSPOSE_NV
) {
157 load_transpose_matrix(ctx
->VertexProgram
.Machine
.Registers
, i
*4, mat
->m
);
160 assert(ctx
->VertexProgram
.TrackMatrixTransform
[i
]
161 == GL_INVERSE_TRANSPOSE_NV
);
162 _math_matrix_analyse(mat
); /* update the inverse */
163 assert((mat
->flags
& MAT_DIRTY_INVERSE
) == 0);
164 load_transpose_matrix(ctx
->VertexProgram
.Machine
.Registers
,
173 * For debugging. Dump the current vertex program machine registers.
176 _mesa_dump_vp_machine( const struct vp_machine
*machine
)
179 _mesa_printf("VertexIn:\n");
180 for (i
= 0; i
< VP_NUM_INPUT_REGS
; i
++) {
181 _mesa_printf("%d: %f %f %f %f ", i
,
182 machine
->Registers
[i
+ VP_INPUT_REG_START
][0],
183 machine
->Registers
[i
+ VP_INPUT_REG_START
][1],
184 machine
->Registers
[i
+ VP_INPUT_REG_START
][2],
185 machine
->Registers
[i
+ VP_INPUT_REG_START
][3]);
189 _mesa_printf("VertexOut:\n");
190 for (i
= 0; i
< VP_NUM_OUTPUT_REGS
; i
++) {
191 _mesa_printf("%d: %f %f %f %f ", i
,
192 machine
->Registers
[i
+ VP_OUTPUT_REG_START
][0],
193 machine
->Registers
[i
+ VP_OUTPUT_REG_START
][1],
194 machine
->Registers
[i
+ VP_OUTPUT_REG_START
][2],
195 machine
->Registers
[i
+ VP_OUTPUT_REG_START
][3]);
199 _mesa_printf("Registers:\n");
200 for (i
= 0; i
< VP_NUM_TEMP_REGS
; i
++) {
201 _mesa_printf("%d: %f %f %f %f ", i
,
202 machine
->Registers
[i
+ VP_TEMP_REG_START
][0],
203 machine
->Registers
[i
+ VP_TEMP_REG_START
][1],
204 machine
->Registers
[i
+ VP_TEMP_REG_START
][2],
205 machine
->Registers
[i
+ VP_TEMP_REG_START
][3]);
209 _mesa_printf("Parameters:\n");
210 for (i
= 0; i
< VP_NUM_PROG_REGS
; i
++) {
211 _mesa_printf("%d: %f %f %f %f ", i
,
212 machine
->Registers
[i
+ VP_PROG_REG_START
][0],
213 machine
->Registers
[i
+ VP_PROG_REG_START
][1],
214 machine
->Registers
[i
+ VP_PROG_REG_START
][2],
215 machine
->Registers
[i
+ VP_PROG_REG_START
][3]);
222 * Fetch a 4-element float vector from the given source register.
223 * Apply swizzling and negating as needed.
226 fetch_vector4( const struct vp_src_register
*source
,
227 const struct vp_machine
*machine
,
230 static const GLfloat zero
[4] = { 0, 0, 0, 0 };
233 if (source
->RelAddr
) {
234 const GLint reg
= source
->Register
+ machine
->AddressReg
;
235 if (reg
< 0 || reg
> MAX_NV_VERTEX_PROGRAM_PARAMS
)
238 src
= machine
->Registers
[VP_PROG_REG_START
+ reg
];
241 src
= machine
->Registers
[source
->Register
];
244 if (source
->Negate
) {
245 result
[0] = -src
[source
->Swizzle
[0]];
246 result
[1] = -src
[source
->Swizzle
[1]];
247 result
[2] = -src
[source
->Swizzle
[2]];
248 result
[3] = -src
[source
->Swizzle
[3]];
251 result
[0] = src
[source
->Swizzle
[0]];
252 result
[1] = src
[source
->Swizzle
[1]];
253 result
[2] = src
[source
->Swizzle
[2]];
254 result
[3] = src
[source
->Swizzle
[3]];
260 * As above, but only return result[0] element.
263 fetch_vector1( const struct vp_src_register
*source
,
264 const struct vp_machine
*machine
,
267 static const GLfloat zero
[4] = { 0, 0, 0, 0 };
270 if (source
->RelAddr
) {
271 const GLint reg
= source
->Register
+ machine
->AddressReg
;
272 if (reg
< 0 || reg
> MAX_NV_VERTEX_PROGRAM_PARAMS
)
275 src
= machine
->Registers
[VP_PROG_REG_START
+ reg
];
278 src
= machine
->Registers
[source
->Register
];
281 if (source
->Negate
) {
282 result
[0] = -src
[source
->Swizzle
[0]];
285 result
[0] = src
[source
->Swizzle
[0]];
291 * Store 4 floats into a register.
294 store_vector4( const struct vp_dst_register
*dest
, struct vp_machine
*machine
,
295 const GLfloat value
[4] )
297 GLfloat
*dst
= machine
->Registers
[dest
->Register
];
299 if (dest
->WriteMask
[0])
301 if (dest
->WriteMask
[1])
303 if (dest
->WriteMask
[2])
305 if (dest
->WriteMask
[3])
311 * Set x to positive or negative infinity.
314 #define SET_POS_INFINITY(x) ( *((GLuint *) &x) = 0x7F800000 )
315 #define SET_NEG_INFINITY(x) ( *((GLuint *) &x) = 0xFF800000 )
317 #define SET_POS_INFINITY(x) x = __MAXFLOAT
318 #define SET_NEG_INFINITY(x) x = -__MAXFLOAT
320 #define SET_POS_INFINITY(x) x = (GLfloat) HUGE_VAL
321 #define SET_NEG_INFINITY(x) x = (GLfloat) -HUGE_VAL
324 #define SET_FLOAT_BITS(x, bits) ((fi_type *) &(x))->i = bits
328 * Execute the given vertex program
331 _mesa_exec_vertex_program(GLcontext
*ctx
, const struct vertex_program
*program
)
333 struct vp_machine
*machine
= &ctx
->VertexProgram
.Machine
;
334 const struct vp_instruction
*inst
;
336 for (inst
= program
->Instructions
; inst
->Opcode
!= VP_OPCODE_END
; inst
++) {
337 switch (inst
->Opcode
) {
341 fetch_vector4( &inst
->SrcReg
[0], machine
, t
);
342 store_vector4( &inst
->DstReg
, machine
, t
);
347 const GLfloat epsilon
= 1.0e-5F
; /* XXX fix? */
348 GLfloat t
[4], lit
[4];
349 fetch_vector4( &inst
->SrcReg
[0], machine
, t
);
350 if (t
[3] < -(128.0F
- epsilon
))
351 t
[3] = - (128.0F
- epsilon
);
352 else if (t
[3] > 128.0F
- epsilon
)
353 t
[3] = 128.0F
- epsilon
;
360 lit
[2] = (t
[0] > 0.0) ? (GLfloat
) exp(t
[3] * log(t
[1])) : 0.0F
;
362 store_vector4( &inst
->DstReg
, machine
, lit
);
368 fetch_vector1( &inst
->SrcReg
[0], machine
, t
);
370 t
[0] = 1.0F
/ t
[0]; /* div by zero is infinity! */
371 t
[1] = t
[2] = t
[3] = t
[0];
372 store_vector4( &inst
->DstReg
, machine
, t
);
378 fetch_vector1( &inst
->SrcReg
[0], machine
, t
);
379 t
[0] = INV_SQRTF(FABSF(t
[0]));
380 t
[1] = t
[2] = t
[3] = t
[0];
381 store_vector4( &inst
->DstReg
, machine
, t
);
386 GLfloat t
[4], q
[4], floor_t0
;
387 fetch_vector1( &inst
->SrcReg
[0], machine
, t
);
388 floor_t0
= (float) floor(t
[0]);
389 if (floor_t0
> FLT_MAX_EXP
) {
390 SET_POS_INFINITY(q
[0]);
391 SET_POS_INFINITY(q
[2]);
393 else if (floor_t0
< FLT_MIN_EXP
) {
399 GLint ii
= (GLint
) floor_t0
;
400 ii
= (ii
< 23) + 0x3f800000;
401 SET_FLOAT_BITS(q
[0], ii
);
402 q
[0] = *((GLfloat
*) &ii
);
404 q
[0] = (GLfloat
) pow(2.0, floor_t0
);
406 q
[2] = (GLfloat
) (q
[0] * LOG2(q
[1]));
408 q
[1] = t
[0] - floor_t0
;
410 store_vector4( &inst
->DstReg
, machine
, q
);
415 GLfloat t
[4], q
[4], abs_t0
;
416 fetch_vector1( &inst
->SrcReg
[0], machine
, t
);
417 abs_t0
= (GLfloat
) fabs(t
[0]);
418 if (abs_t0
!= 0.0F
) {
419 /* Since we really can't handle infinite values on VMS
420 * like other OSes we'll use __MAXFLOAT to represent
421 * infinity. This may need some tweaking.
424 if (abs_t0
== __MAXFLOAT
) {
426 if (IS_INF_OR_NAN(abs_t0
)) {
428 SET_POS_INFINITY(q
[0]);
430 SET_POS_INFINITY(q
[2]);
434 double mantissa
= frexp(t
[0], &exponent
);
435 q
[0] = (GLfloat
) (exponent
- 1);
436 q
[1] = (GLfloat
) (2.0 * mantissa
); /* map [.5, 1) -> [1, 2) */
437 q
[2] = (GLfloat
) (q
[0] + LOG2(q
[1]));
441 SET_NEG_INFINITY(q
[0]);
443 SET_NEG_INFINITY(q
[2]);
446 store_vector4( &inst
->DstReg
, machine
, q
);
451 GLfloat t
[4], u
[4], prod
[4];
452 fetch_vector4( &inst
->SrcReg
[0], machine
, t
);
453 fetch_vector4( &inst
->SrcReg
[1], machine
, u
);
454 prod
[0] = t
[0] * u
[0];
455 prod
[1] = t
[1] * u
[1];
456 prod
[2] = t
[2] * u
[2];
457 prod
[3] = t
[3] * u
[3];
458 store_vector4( &inst
->DstReg
, machine
, prod
);
463 GLfloat t
[4], u
[4], sum
[4];
464 fetch_vector4( &inst
->SrcReg
[0], machine
, t
);
465 fetch_vector4( &inst
->SrcReg
[1], machine
, u
);
466 sum
[0] = t
[0] + u
[0];
467 sum
[1] = t
[1] + u
[1];
468 sum
[2] = t
[2] + u
[2];
469 sum
[3] = t
[3] + u
[3];
470 store_vector4( &inst
->DstReg
, machine
, sum
);
475 GLfloat t
[4], u
[4], dot
[4];
476 fetch_vector4( &inst
->SrcReg
[0], machine
, t
);
477 fetch_vector4( &inst
->SrcReg
[1], machine
, u
);
478 dot
[0] = t
[0] * u
[0] + t
[1] * u
[1] + t
[2] * u
[2];
479 dot
[1] = dot
[2] = dot
[3] = dot
[0];
480 store_vector4( &inst
->DstReg
, machine
, dot
);
485 GLfloat t
[4], u
[4], dot
[4];
486 fetch_vector4( &inst
->SrcReg
[0], machine
, t
);
487 fetch_vector4( &inst
->SrcReg
[1], machine
, u
);
488 dot
[0] = t
[0] * u
[0] + t
[1] * u
[1] + t
[2] * u
[2] + t
[3] * u
[3];
489 dot
[1] = dot
[2] = dot
[3] = dot
[0];
490 store_vector4( &inst
->DstReg
, machine
, dot
);
495 GLfloat t
[4], u
[4], dst
[4];
496 fetch_vector4( &inst
->SrcReg
[0], machine
, t
);
497 fetch_vector4( &inst
->SrcReg
[1], machine
, u
);
499 dst
[1] = t
[1] * u
[1];
502 store_vector4( &inst
->DstReg
, machine
, dst
);
507 GLfloat t
[4], u
[4], min
[4];
508 fetch_vector4( &inst
->SrcReg
[0], machine
, t
);
509 fetch_vector4( &inst
->SrcReg
[1], machine
, u
);
510 min
[0] = (t
[0] < u
[0]) ? t
[0] : u
[0];
511 min
[1] = (t
[1] < u
[1]) ? t
[1] : u
[1];
512 min
[2] = (t
[2] < u
[2]) ? t
[2] : u
[2];
513 min
[3] = (t
[3] < u
[3]) ? t
[3] : u
[3];
514 store_vector4( &inst
->DstReg
, machine
, min
);
519 GLfloat t
[4], u
[4], max
[4];
520 fetch_vector4( &inst
->SrcReg
[0], machine
, t
);
521 fetch_vector4( &inst
->SrcReg
[1], machine
, u
);
522 max
[0] = (t
[0] > u
[0]) ? t
[0] : u
[0];
523 max
[1] = (t
[1] > u
[1]) ? t
[1] : u
[1];
524 max
[2] = (t
[2] > u
[2]) ? t
[2] : u
[2];
525 max
[3] = (t
[3] > u
[3]) ? t
[3] : u
[3];
526 store_vector4( &inst
->DstReg
, machine
, max
);
531 GLfloat t
[4], u
[4], slt
[4];
532 fetch_vector4( &inst
->SrcReg
[0], machine
, t
);
533 fetch_vector4( &inst
->SrcReg
[1], machine
, u
);
534 slt
[0] = (t
[0] < u
[0]) ? 1.0F
: 0.0F
;
535 slt
[1] = (t
[1] < u
[1]) ? 1.0F
: 0.0F
;
536 slt
[2] = (t
[2] < u
[2]) ? 1.0F
: 0.0F
;
537 slt
[3] = (t
[3] < u
[3]) ? 1.0F
: 0.0F
;
538 store_vector4( &inst
->DstReg
, machine
, slt
);
543 GLfloat t
[4], u
[4], sge
[4];
544 fetch_vector4( &inst
->SrcReg
[0], machine
, t
);
545 fetch_vector4( &inst
->SrcReg
[1], machine
, u
);
546 sge
[0] = (t
[0] >= u
[0]) ? 1.0F
: 0.0F
;
547 sge
[1] = (t
[1] >= u
[1]) ? 1.0F
: 0.0F
;
548 sge
[2] = (t
[2] >= u
[2]) ? 1.0F
: 0.0F
;
549 sge
[3] = (t
[3] >= u
[3]) ? 1.0F
: 0.0F
;
550 store_vector4( &inst
->DstReg
, machine
, sge
);
555 GLfloat t
[4], u
[4], v
[4], sum
[4];
556 fetch_vector4( &inst
->SrcReg
[0], machine
, t
);
557 fetch_vector4( &inst
->SrcReg
[1], machine
, u
);
558 fetch_vector4( &inst
->SrcReg
[2], machine
, v
);
559 sum
[0] = t
[0] * u
[0] + v
[0];
560 sum
[1] = t
[1] * u
[1] + v
[1];
561 sum
[2] = t
[2] * u
[2] + v
[2];
562 sum
[3] = t
[3] * u
[3] + v
[3];
563 store_vector4( &inst
->DstReg
, machine
, sum
);
569 fetch_vector4( &inst
->SrcReg
[0], machine
, t
);
570 machine
->AddressReg
= (GLint
) floor(t
[0]);
575 GLfloat t
[4], u
[4], dot
[4];
576 fetch_vector4( &inst
->SrcReg
[0], machine
, t
);
577 fetch_vector4( &inst
->SrcReg
[1], machine
, u
);
578 dot
[0] = t
[0] * u
[0] + t
[1] * u
[1] + t
[2] * u
[2] + u
[3];
579 dot
[1] = dot
[2] = dot
[3] = dot
[0];
580 store_vector4( &inst
->DstReg
, machine
, dot
);
586 fetch_vector1( &inst
->SrcReg
[0], machine
, t
);
592 if (u
> 1.884467e+019F
) {
593 u
= 1.884467e+019F
; /* IEEE 32-bit binary value 0x5F800000 */
595 else if (u
< 5.42101e-020F
) {
596 u
= 5.42101e-020F
; /* IEEE 32-bit binary value 0x1F800000 */
600 if (u
< -1.884467e+019F
) {
601 u
= -1.884467e+019F
; /* IEEE 32-bit binary value 0xDF800000 */
603 else if (u
> -5.42101e-020F
) {
604 u
= -5.42101e-020F
; /* IEEE 32-bit binary value 0x9F800000 */
607 t
[0] = t
[1] = t
[2] = t
[3] = u
;
608 store_vector4( &inst
->DstReg
, machine
, t
);
613 GLfloat t
[4], u
[4], sum
[4];
614 fetch_vector4( &inst
->SrcReg
[0], machine
, t
);
615 fetch_vector4( &inst
->SrcReg
[1], machine
, u
);
616 sum
[0] = t
[0] - u
[0];
617 sum
[1] = t
[1] - u
[1];
618 sum
[2] = t
[2] - u
[2];
619 sum
[3] = t
[3] - u
[3];
620 store_vector4( &inst
->DstReg
, machine
, sum
);
626 fetch_vector4( &inst
->SrcReg
[0], machine
, t
);
627 if (t
[0] < 0.0) t
[0] = -t
[0];
628 if (t
[1] < 0.0) t
[1] = -t
[1];
629 if (t
[2] < 0.0) t
[2] = -t
[2];
630 if (t
[3] < 0.0) t
[3] = -t
[3];
631 store_vector4( &inst
->DstReg
, machine
, t
);
638 /* bad instruction opcode */
639 _mesa_problem(ctx
, "Bad VP Opcode in _mesa_exec_vertex_program");
648 Thoughts on vertex program optimization:
650 The obvious thing to do is to compile the vertex program into X86/SSE/3DNow!
651 assembly code. That will probably be a lot of work.
653 Another approach might be to replace the vp_instruction->Opcode field with
654 a pointer to a specialized C function which executes the instruction.
655 In particular we can write functions which skip swizzling, negating,
656 masking, relative addressing, etc. when they're not needed.
660 void simple_add( struct vp_instruction *inst )
662 GLfloat *sum = machine->Registers[inst->DstReg.Register];
663 GLfloat *a = machine->Registers[inst->SrcReg[0].Register];
664 GLfloat *b = machine->Registers[inst->SrcReg[1].Register];
665 sum[0] = a[0] + b[0];
666 sum[1] = a[1] + b[1];
667 sum[2] = a[2] + b[2];
668 sum[3] = a[3] + b[3];
677 A first step would be to 'vectorize' the programs in the same way as
678 the normal transformation code in the tnl module. Thus each opcode
679 takes zero or more input vectors (registers) and produces one or more
682 These operations would intially be coded in C, with machine-specific
683 assembly following, as is currently the case for matrix
684 transformations in the math/ directory. The preprocessing scheme for
685 selecting simpler operations Brian describes above would also work
688 This should give reasonable performance without excessive effort.