grrr
This commit is contained in:
@@ -129,6 +129,10 @@ main (int argc, char **argv)
|
||||
OFFSET (gc, cmdTransportInfo.fifoLfbP, "fifoLfbP");
|
||||
OFFSET (gc, cmdTransportInfo.lfbLockCount, "lfbLockCount");
|
||||
|
||||
#if GLIDE_DISPATCH_SETUP
|
||||
OFFSET (gc,curArchProcs.triSetupProc,"kTriProcOffset\t\t");
|
||||
#endif
|
||||
|
||||
SIZEOF (gr.GCs[0].state,"GrState\t");
|
||||
SIZEOF (gr.hwConfig,"GrHwConfiguration");
|
||||
SIZEOF (gr.GCs[0],"GC\t");
|
||||
|
||||
@@ -650,7 +650,8 @@ all_done: /* come here on degenerate lines */
|
||||
/*---------------------------------------------------------------------------
|
||||
** grDrawTriangle
|
||||
*/
|
||||
#if (GLIDE_PLATFORM & GLIDE_OS_WIN32) && !GLIDE_USE_C_TRISETUP && !defined(GLIDE_DEBUG)
|
||||
#ifndef HAVE_XDRAWTRI_ASM /* grDrawTriangle() not in asm */
|
||||
#if defined(_MSC_VER) && !GLIDE_USE_C_TRISETUP && !defined(GLIDE_DEBUG)
|
||||
__declspec(naked)
|
||||
#endif
|
||||
GR_ENTRY(grDrawTriangle, void, (const GrVertex *a, const GrVertex *b, const GrVertex *c))
|
||||
@@ -694,8 +695,8 @@ GR_ENTRY(grDrawTriangle, void, (const GrVertex *a, const GrVertex *b, const GrVe
|
||||
|
||||
all_done:
|
||||
GR_END();
|
||||
#else
|
||||
#if defined(__MSC__)
|
||||
|
||||
#elif defined(_MSC_VER)
|
||||
{
|
||||
__asm {
|
||||
mov edx, [_GlideRoot + kCurGCOffset];
|
||||
@@ -703,47 +704,13 @@ all_done:
|
||||
jmp eax;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#if defined( __linux__ )
|
||||
|
||||
/* Here's the basic strategy for this dispatch code:
|
||||
* We jump to _GlideRoot.curGC->archDispatchProcs.triSetupProc
|
||||
* which contains code that looks like a function, we leave the
|
||||
* paramters passed to grDrawTriangle on the stack and the dispatched
|
||||
* function picks them up. However we have to compensate for
|
||||
* the compiler pushing anything on the stack. The following describes
|
||||
* why and when we have to pop.
|
||||
*
|
||||
* BIG_OPT: gcc pushes a frame pointer to maintain things, BIG_OPT
|
||||
* turns on -fomit-frame-pointer so we don't have to pop it.
|
||||
*
|
||||
* PIC: When using position independant code gcc stores eip in ebx
|
||||
* so it saves ebx from the previous call automatically.
|
||||
* Therefore, once we have the jump address we have to pop ebx
|
||||
* to restore the stack.
|
||||
*
|
||||
* The syntax is further complicated by the fact that gcc can (and will)
|
||||
* emit code between the asm statements, so they all need to be in a single
|
||||
* asm statement, wrapped with #ifdef's. This means we have fun with
|
||||
* deciding if we need to list trashed registers and when we need commas
|
||||
* between them.
|
||||
*/
|
||||
|
||||
asm (
|
||||
#if defined(PIC)
|
||||
"popl %%ebx\n\t"
|
||||
#endif
|
||||
"jmp *%0"
|
||||
:
|
||||
: "m" (_GlideRoot.curGC->curArchProcs.triSetupProc)
|
||||
#if defined(PIC)
|
||||
: "ebx"
|
||||
#endif
|
||||
);
|
||||
#endif
|
||||
#else
|
||||
#error "Write triangle proc dispatch for this compiler"
|
||||
#endif
|
||||
#undef FN_NAME
|
||||
} /* grDrawTriangle */
|
||||
#endif /* HAVE_XDRAWTRI_ASM */
|
||||
|
||||
/*---------------------------------------------------------------------------
|
||||
** grDrawPlanarPolygon
|
||||
|
||||
@@ -110,6 +110,8 @@ override USE_FIFO = 1
|
||||
ifeq ($(USE_X86),1)
|
||||
CDEFS += -DGLIDE_DISPATCH_SETUP=1 -DGLIDE_DISPATCH_DOWNLOAD=1
|
||||
override USE_FIFO = 1
|
||||
CDEFS += -DHAVE_XDRAWTRI_ASM=1
|
||||
override USE_DRAWTRI_ASM = 1
|
||||
else
|
||||
CDEFS += -DGLIDE_USE_C_TRISETUP=1
|
||||
endif
|
||||
@@ -194,6 +196,9 @@ GLIDE_OBJECTS = \
|
||||
fpu.o \
|
||||
xtexdl_def.o
|
||||
|
||||
ifeq ($(USE_DRAWTRI_ASM),1)
|
||||
GLIDE_OBJECTS += xdrawtri.o
|
||||
endif
|
||||
ifeq ($(USE_X86),1)
|
||||
GLIDE_OBJECTS += \
|
||||
xdraw2_def.o
|
||||
@@ -284,6 +289,8 @@ xdraw2_3dnow.o: xdraw2.asm
|
||||
$(AS) -o $@ $(ASFLAGS) -DGL_AMD3D=1 $<
|
||||
xtexdl_3dnow.o: xtexdl.asm
|
||||
$(AS) -o $@ $(ASFLAGS) -DGL_AMD3D=1 $<
|
||||
xdrawtri.o: xdrawtri.asm
|
||||
$(AS) -o $@ $(ASFLAGS) $<
|
||||
|
||||
#cpuid.lo: cpuid.o
|
||||
# $(CP) $< $@
|
||||
@@ -297,6 +304,8 @@ xdraw2_3dnow.lo: xdraw2_3dnow.o
|
||||
$(CP) $< $@
|
||||
xtexdl_3dnow.lo: xtexdl_3dnow.o
|
||||
$(CP) $< $@
|
||||
xdrawtri.lo: xdrawtri.o
|
||||
$(CP) $< $@
|
||||
|
||||
$(GLIDE_OBJECTS): fxinline.h fxgasm.h
|
||||
|
||||
|
||||
46
glide2x/cvg/glide/src/xdrawtri.asm
Normal file
46
glide2x/cvg/glide/src/xdrawtri.asm
Normal file
@@ -0,0 +1,46 @@
|
||||
;; THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY
|
||||
;; PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT
|
||||
;; TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX
|
||||
;; INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE
|
||||
;; DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com).
|
||||
;; THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
|
||||
;; EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A
|
||||
;; FULL TEXT OF THE NON-WARRANTY PROVISIONS.
|
||||
;;
|
||||
;; USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO
|
||||
;; RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN
|
||||
;; TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 252.227-7013,
|
||||
;; AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR
|
||||
;; SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF
|
||||
;; THE UNITED STATES.
|
||||
;;
|
||||
;; COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED
|
||||
|
||||
;; Adapted from gdraw.c:grDrawTriangle() for nasm
|
||||
|
||||
%include "xos.inc"
|
||||
|
||||
%include "fxgasm.h"
|
||||
|
||||
extrn _GlideRoot
|
||||
|
||||
segment SEG_TEXT
|
||||
|
||||
align 16
|
||||
proc grDrawTriangle, 12
|
||||
|
||||
;;mov edx, dword [_GlideRoot+curGC]
|
||||
;;mov eax, dword [edx+kTriProcOffset]
|
||||
mov eax, dword [_GlideRoot+curGC]
|
||||
jmp [eax + kTriProcOffset]
|
||||
endp
|
||||
align 16
|
||||
|
||||
%if XOS == XOS_WIN32
|
||||
%ifdef __MINGW32__
|
||||
; GNU LD fails with '_' prefix
|
||||
export grDrawTriangle@12
|
||||
%else
|
||||
export _grDrawTriangle@12
|
||||
%endif
|
||||
%endif ; _WIN32
|
||||
Reference in New Issue
Block a user