mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-15 09:21:33 +00:00
bce7d5b832
This moves the common camera setup code out of the individual drivers, and completely removes vup/vright/vpn from the non-software renderers. This has highlighted the craziness around AngleVectors with it putting +X forward, -Y right and +Z up. The main issue with this is it requires a 90 degree pre-rotation about the Z axis to get the camera pointing in the right direction, and that's for the native sw renderer (vulkan needs a 90 degree pre-rotation about X, and gl and glsl need to invert an axis, too), though at least it's just a matrix swizzle and vector negation. However, it does mean the camera matrices can't be used directly. Also rename vpn to vfwd (still abbreviated, but fwd is much clearer in meaning (to me, at least) than pn (plane normal, I guess, but which way?)).
116 lines
2.9 KiB
ArmAsm
116 lines
2.9 KiB
ArmAsm
/*
|
|
cl_math.S
|
|
|
|
Client x86 assembly-language math routines.
|
|
|
|
Copyright (C) 1996-1997 Id Software, Inc.
|
|
|
|
This program is free software; you can redistribute it and/or
|
|
modify it under the terms of the GNU General Public License
|
|
as published by the Free Software Foundation; either version 2
|
|
of the License, or (at your option) any later version.
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
See the GNU General Public License for more details.
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
along with this program; if not, write to:
|
|
|
|
Free Software Foundation, Inc.
|
|
59 Temple Place - Suite 330
|
|
Boston, MA 02111-1307, USA
|
|
|
|
$Id$
|
|
*/
|
|
|
|
#ifdef HAVE_CONFIG_H
|
|
# include <config.h>
|
|
#endif
|
|
#include "asm_i386.h"
|
|
#include "quakeasm.h"
|
|
|
|
#ifdef PIC
|
|
#undef USE_INTEL_ASM //XXX asm pic hack
|
|
#endif
|
|
|
|
#ifdef USE_INTEL_ASM
|
|
|
|
.data
|
|
|
|
.text
|
|
|
|
// TODO: rounding needed?
|
|
// stack parameter offset
|
|
#define val 4
|
|
|
|
.globl C(Invert24To16)
|
|
C(Invert24To16):
|
|
|
|
movl val(%esp),%ecx
|
|
movl $0x100,%edx // 0x10000000000 as dividend
|
|
cmpl %edx,%ecx
|
|
jle LOutOfRange
|
|
|
|
subl %eax,%eax
|
|
divl %ecx
|
|
|
|
ret
|
|
|
|
LOutOfRange:
|
|
movl $0xFFFFFFFF,%eax
|
|
ret
|
|
|
|
#define in 4
|
|
#define out 8
|
|
|
|
.align 2
|
|
.globl C(TransformVector)
|
|
C(TransformVector):
|
|
movl in(%esp),%eax
|
|
movl out(%esp),%edx
|
|
|
|
flds (%eax) // in[0]
|
|
fmuls C(vright) // in[0]*vright[0]
|
|
flds (%eax) // in[0] | in[0]*vright[0]
|
|
fmuls C(vup) // in[0]*vup[0] | in[0]*vright[0]
|
|
flds (%eax) // in[0] | in[0]*vup[0] | in[0]*vright[0]
|
|
fmuls C(vfwd) // in[0]*vfwd[0] | in[0]*vup[0] | in[0]*vright[0]
|
|
|
|
flds 4(%eax) // in[1] | ...
|
|
fmuls C(vright)+4 // in[1]*vright[1] | ...
|
|
flds 4(%eax) // in[1] | in[1]*vright[1] | ...
|
|
fmuls C(vup)+4 // in[1]*vup[1] | in[1]*vright[1] | ...
|
|
flds 4(%eax) // in[1] | in[1]*vup[1] | in[1]*vright[1] | ...
|
|
fmuls C(vfwd)+4 // in[1]*vfwd[1] | in[1]*vup[1] | in[1]*vright[1] | ...
|
|
fxch %st(2) // in[1]*vright[1] | in[1]*vup[1] | in[1]*vfwd[1] | ...
|
|
|
|
faddp %st(0),%st(5) // in[1]*vup[1] | in[1]*vfwd[1] | ...
|
|
faddp %st(0),%st(3) // in[1]*vfwd[1] | ...
|
|
faddp %st(0),%st(1) // vfwd | vup_accum | vright_accum
|
|
|
|
flds 8(%eax) // in[2] | ...
|
|
fmuls C(vright)+8 // in[2]*vright[2] | ...
|
|
flds 8(%eax) // in[2] | in[2]*vright[2] | ...
|
|
fmuls C(vup)+8 // in[2]*vup[2] | in[2]*vright[2] | ...
|
|
flds 8(%eax) // in[2] | in[2]*vup[2] | in[2]*vright[2] | ...
|
|
fmuls C(vfwd)+8 // in[2]*vfwd[2] | in[2]*vup[2] | in[2]*vright[2] | ...
|
|
fxch %st(2) // in[2]*vright[2] | in[2]*vup[2] | in[2]*vfwd[2] | ...
|
|
|
|
faddp %st(0),%st(5) // in[2]*vup[2] | in[2]*vfwd[2] | ...
|
|
faddp %st(0),%st(3) // in[2]*vfwd[2] | ...
|
|
faddp %st(0),%st(1) // vfwd | vup_accum | vright_accum
|
|
|
|
fstps 8(%edx) // out[2]
|
|
fstps 4(%edx) // out[1]
|
|
fstps (%edx) // out[0]
|
|
|
|
ret
|
|
|
|
#endif // USE_INTEL_ASM
|
|
|
|
#if defined(__linux__) && defined(__ELF__)
|
|
.section .note.GNU-stack,"",%progbits
|
|
#endif
|