cleanning

This commit is contained in:
2026-03-25 00:29:34 +01:00
parent 1acaf93b2d
commit 583de68697
24 changed files with 87 additions and 279 deletions

4
.gitignore vendored
View File

@@ -2,6 +2,8 @@
*.a
*.lo
*.so
*.exe
fxgasm.h
fxgasm.exe
*.exe
fxgasm
fxinline.h

View File

@@ -17,6 +17,9 @@
#
# COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED
#
# $Revision$
# $Date$
#
# local defines, options, includes
LCDEFS =

View File

@@ -129,10 +129,6 @@ 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");

View File

@@ -1,10 +0,0 @@
#ifndef __FX_INLINE_H__
#define __FX_INLINE_H__
#define kCurGCOffset 0x2CUL
#define kTriProcOffset 0x350UL
#define kTriProcOffsetClean 848
/* The # of 2-byte entries in the hw fog table */
#define kInternalFogTableEntryCount 0x40UL
#endif /* __FX_INLINE_H__ */

View File

@@ -95,6 +95,7 @@
* 77 11/15/97 7:43p Peter
* more comdex silliness
*
**
*/
#include <memory.h>
@@ -649,8 +650,7 @@ all_done: /* come here on degenerate lines */
/*---------------------------------------------------------------------------
** grDrawTriangle
*/
#ifndef HAVE_XDRAWTRI_ASM /* grDrawTriangle() not in asm */
#if defined(_MSC_VER) && !GLIDE_USE_C_TRISETUP && !defined(GLIDE_DEBUG)
#if (GLIDE_PLATFORM & GLIDE_OS_WIN32) && !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 +694,8 @@ GR_ENTRY(grDrawTriangle, void, (const GrVertex *a, const GrVertex *b, const GrVe
all_done:
GR_END();
#elif defined(_MSC_VER)
#else
#if defined(__MSC__)
{
__asm {
mov edx, [_GlideRoot + kCurGCOffset];
@@ -703,13 +703,47 @@ all_done:
jmp eax;
}
}
#endif
#if defined( __linux__ )
#else
#error "Write triangle proc dispatch for this compiler"
/* 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
#endif
#undef FN_NAME
} /* grDrawTriangle */
#endif /* HAVE_XDRAWTRI_ASM */
/*---------------------------------------------------------------------------
** grDrawPlanarPolygon

View File

@@ -43,6 +43,8 @@
# realclean: remove all generated files
#
.PHONY: all glide2x clean realclean
.INTERMEDIATE: fxgasm
.SUFFIXES: .lo
@@ -108,8 +110,6 @@ 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,9 +194,6 @@ 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
@@ -287,8 +284,6 @@ 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) $< $@
@@ -302,8 +297,6 @@ 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

View File

@@ -1,46 +0,0 @@
;; 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

View File

@@ -279,6 +279,7 @@ UnknownVendor:
mov eax, 0ffffffffh
jmp DoneCpu
endp

View File

@@ -17,6 +17,9 @@
;;
;; COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED
;;
;; $Revision$
;; $Log$
;;
;; 3 3/17/99 6:16p Dow
;; Phantom Menace and other fixes.
;;
@@ -25,6 +28,10 @@
;**
;** IMPLIB.ASM: This is a template for an import library.
;**
;; $Header$
;**
;**
.386p
.MODEL FLAT

View File

@@ -112,8 +112,6 @@ 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,15 +192,14 @@ GLIDE_OBJECTS = \
cpuid.o \
xtexdl_def.o
ifeq ($(USE_DRAWTRI_ASM),1)
GLIDE_OBJECTS += xdrawtri.o
endif
ifeq ($(USE_X86),1)
GLIDE_OBJECTS += \
xdraw2_def.o
xdraw2_def.o \
xdraw3_def.o
ifeq ($(USE_3DNOW),1)
GLIDE_OBJECTS += \
xdraw2_3dnow.o \
xdraw3_3dnow.o \
xtexdl_3dnow.o
endif
else
@@ -270,12 +267,14 @@ cpuid.o: cpudtect.asm
$(AS) -o $@ $(ASFLAGS) $<
xdraw2_def.o: xdraw2.asm
$(AS) -o $@ $(ASFLAGS) $<
xdraw3_def.o: xdraw3.asm
$(AS) -o $@ $(ASFLAGS) $<
xdraw2_3dnow.o: xdraw2.asm
$(AS) -o $@ $(ASFLAGS) -DGL_AMD3D=1 $<
xdraw3_3dnow.o: xdraw3.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) $< $@
@@ -289,8 +288,6 @@ xdraw3_3dnow.lo: xdraw3_3dnow.o
$(CP) $< $@
xtexdl_3dnow.lo: xtexdl_3dnow.o
$(CP) $< $@
xdrawtri.lo: xdrawtri.o
$(CP) $< $@
$(GLIDE_OBJECTS): fxinline.h fxgasm.h

View File

@@ -16,6 +16,10 @@
;;
;; COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED
;;
;; $Header$
;; $Revision$
;; $Log$
;;
;; 3 3/17/99 6:17p Dow
;; Phantom Menace and other fixes.
;;

View File

@@ -16,6 +16,10 @@
;; THE UNITED STATES.
;;
;; COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED
;;
;; $Header$
;; $Revision$
;; $Log$
;
; 2 10/30/97 6:53p Peter
; first real cut at tri asm

View File

@@ -1,38 +0,0 @@
/*
* 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 gas */
#include "fxgasm.h"
.extern _GlideRoot
.text
.p2align 4,,15
.globl grDrawTriangle
.type grDrawTriangle,@function
grDrawTriangle:
/*movl (_GlideRoot+curGC),%edx
movl kTriProcOffset(%edx),%eax*/
movl (_GlideRoot + curGC),%eax
jmp *kTriProcOffset(%eax)
.p2align 4,,15

View File

@@ -1,46 +0,0 @@
;; 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

View File

@@ -16,6 +16,10 @@
;;
;; COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED
;;
;; $Header$
;; $Revision$
;; $Log$
;;
;; 3 3/17/99 6:17p Dow
;; Phantom Menace and other fixes.
;;

View File

@@ -19,9 +19,9 @@
# DRI=1 Build DRI version.
# target = h3
# default = no
# XPATH specify X11 path; needed by SST96 and H3.
# default = /usr/X11R6
# X11LIBS X libraries path; default = $(XPATH)/lib
# XPATH specify X libraries path; needed by DRI.
# target = h3
# default = /usr/X11R6/lib
# H4=1 High speed Avenger/Napalm.
# target = h3
# default = no

View File

@@ -1,7 +0,0 @@
#ifndef __FX_INLINE_H__
#define __FX_INLINE_H__
/* The # of 2-byte entries in the hw fog table */
#define kInternalFogTableEntryCount 0x40UL
#endif /* __FX_INLINE_H__ */

View File

@@ -1,82 +0,0 @@
;----------------------------------------------------------------------
; Assembler offsets for SSTREGS struct
;----------------------------------------------------------------------
;----------------------------------------------------------------------
; Assembler offsets for GC struct
;----------------------------------------------------------------------
base_ptr equ 00000000h
reg_ptr equ 00000004h
lfb_ptr equ 0000000ch
tex_ptr equ 00000008h
cull_mode equ 000000d0h
tsuDataList equ 00000014h
triPacketHdr equ 00000358h
cullStripHdr equ 0000035ch
paramMask equ 00000360h
triSetupProc equ 00000344h
drawTrianglesProc equ 00000348h
drawVertexList equ 0000034ch
fifoStart equ 00000364h
fifoEnd equ 00000368h
fifoOffset equ 0000036ch
fifoSize equ 00000370h
fifoJmpHdr equ 00000374h
fifoPtr equ 00000378h
fifoRead equ 0000037ch
fifoRoom equ 00000380h
roomToReadPtr equ 00000384h
roomToEnd equ 00000388h
fifoLfbP equ 0000038ch
lfbLockCount equ 00000390h
vertexSize equ 00000278h
vertexStride equ 00000274h
invalid equ 00000280h
CoordinateSpace equ 0000033ch
paramIndex equ 000000d4h
vp_hwidth equ 00000208h
vp_hheight equ 0000020ch
vp_hdepth equ 00000210h
vp_ox equ 000001fch
vp_oy equ 00000200h
vp_oz equ 00000204h
colorType equ 0000027ch
wInfo_offset equ 00000228h
qInfo_mode equ 0000025ch
qInfo_offset equ 00000260h
q0Info_offset equ 00000268h
q1Info_offset equ 00000270h
q0Info_mode equ 00000264h
q1Info_mode equ 0000026ch
tmu0_s_scale equ 00000144h
tmu0_t_scale equ 00000148h
tmu1_s_scale equ 00000184h
tmu1_t_scale equ 00000188h
SIZEOF_GrState equ 00000274h
SIZEOF_GC equ 00000438h
;----------------------------------------------------------------------
; Assembler offsets for GlideRoot struct
;----------------------------------------------------------------------
p6Fencer equ 00000000h
current_sst equ 00000004h
curGC equ 00000008h
curTriSize equ 00000014h
stats_linesDrawn equ 00000074h
stats_otherTrisDrawn equ 00000080h
trisProcessed equ 00000078h
trisDrawn equ 0000007ch
pool_f0 equ 00000020h
pool_fHalf equ 00000024h
pool_f1 equ 00000028h
pool_f255 equ 0000002ch
pool_fTemp1 equ 00000030h
pool_fTemp2 equ 00000034h
SIZEOF_GlideRoot equ 00001248h

View File

@@ -1,10 +0,0 @@
#ifndef __FX_INLINE_H__
#define __FX_INLINE_H__
#define kCurGCOffset 0x8UL
#define kTriProcOffset 0x344UL
#define kGCStateInvalid 0x280UL
/* The # of 2-byte entries in the hw fog table */
#define kInternalFogTableEntryCount 0x40
#endif /* __FX_INLINE_H__ */

Binary file not shown.

View File

@@ -274,6 +274,7 @@ UnknownVendor:
mov eax, 0ffffffffh
jmp DoneCpu
endp

View File

@@ -75,7 +75,6 @@ endif
# FX_COMPILER must be set to either MICROSOFT or WATCOM
# DEBUG must be set to enable debugging flags for cc and link
#
ifeq ($(CC),)
CC = gcc
endif
@@ -180,6 +179,7 @@ LDLIBS = $(LLDLIBS) $(GLDLIBS)
#--------------------------------------------------------------------------
# configure OS commands
#
ifeq "$(OS)" "sunos"
AR = /usr/5bin/ar crsl
ECHO = /usr/5bin/echo
@@ -371,8 +371,6 @@ $(THISDIR)rmtargets:
.SUFFIXES: .cod .i .bat .sh
.c.cod:
echo "TADAA!!!"
echo "$OS"
$(CC) $(CFLAGS) $(ASM_LIST_FLAGS) $*.c
.c.i:

View File

@@ -14,6 +14,9 @@
# successor clauses in the FAR, DOD or NASA FAR Supplement. Unpublished -
# rights reserved under the Copyright Laws of the United States.
#
# $Revision$
# $Date$
#
THISDIR = texus2