diff --git a/glide3x/h5/glide3/src/cpudtect.s b/glide3x/h5/glide3/src/cpudtect.s index 66cc77d..c2a23ef 100644 --- a/glide3x/h5/glide3/src/cpudtect.s +++ b/glide3x/h5/glide3/src/cpudtect.s @@ -1,151 +1,150 @@ -# 1 "cpudtect.S" - +/* +** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONL +** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGH +** TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DF +** 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 +** FULL TEXT OF THE NON-WARRANTY PROVISIONS. +** +** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT T +** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS I +** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 252.227-7013 +** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FA +** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS O +** THE UNITED STATES. +** +** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVE + * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +/* $Header$ * +/* $Log$ +/* Revision 1.1 2000/06/15 00:27:42 josep +/* Initial checkin into SourceForge +/ +/* Revision 1.1.1.1 2000/04/26 20:35:32 poppa +/* Initial Napalm Glide from Precision Insight +/* */ +/* */ +/* 9 3/10/99 10:40a Peter */ +/* detect katmai-ness */ +/* */ +/* 8 1/20/99 5:50p Peter */ +/* norbert's code for k6 and k7 (?) wc */ +/* */ +/* 7 12/09/98 1:11p Peter */ +/* cpu detection from Norbert for teh rest of the 3DNow!(tm) partners */ +/* */ +/* 6 10/03/98 3:35p Peter */ +/* First pass at dynamic detection of 3DNow!(tm) */ +/* */ +/* 5 7/24/98 1:40p Hohn */ +/* */ +/* 4 5/28/97 8:23a Peter */ +/* Merge w/ original glide source */ +/* */ +/* 2 3/04/97 9:10p Dow */ .file "cpudtect.asm" - - - +/* Data for data segment goes here */ +/* _DATA SEGMENT DWORD USE32 PUBLIC 'DATA' */ +/* _DATA ENDS */ - - +/* Some useful constants */ +/* CPU Type */ +#define CPUTypeUnknown $0x0ffffffff +#define CPUTypePrePent $0x4 +#define CPUTypeP5 $0x5 +#define CPUTypeP6 $0x6 - - - - - +/* References to external data: */ .text - - - +/* _cpu_detect_asm - detect the type of CPU */ +/* */ +/* USAGE: */ - +/* int __cdecl _cpu_detect_asm(void) */ - +/* returns 4 for non-pen */ .globl _cpu_detect_asm .type _cpu_detect_asm,@function _cpu_detect_asm: .L_cpu_detect_asm_P6Stuff: - push %esi + push %esi /* save registers that are not volatile */ push %edi push %ebx push %ebp - - - pushf - pop %eax - mov %eax , %ecx - xor $0x0200000 , %eax - push %eax - popf - pushf - pop %eax - xor %ecx , %eax - jz .L_cpu_detect_asm_NotPentium +/* First, determine whether CPUID instruction is available. */ +/* If it's not, then it's a 386 or 486. */ + pushf /* push original EFLAGS. */ + pop %eax /* pop into eax */ + mov %eax , %ecx /* save original EFLAGS in ecx */ + xor $0x0200000 , %eax /* flip ID bit in EFLAGS */ + push %eax /* put it back on stack */ + popf /* pop into EFLAGS */ + pushf /* get EFLAGS back */ + pop %eax /* into eax */ + xor %ecx , %eax /* check to see if we could toggle ID */ + jz .L_cpu_detect_asm_NotPentium /* Sorry, not P5 or P6. */ - +/* Now determine whether it's an intel P6 CPU. */ - - xor %eax , %eax - cpuid - xor $0x0756e6547 , %ebx +/* Is it an Intel CPU? */ + xor %eax , %eax /* eax = 0. */ + cpuid /* get cpuid */ + xor $0x0756e6547 , %ebx /* "Genu" */ jnz .L_cpu_detect_asm_NotIntel - xor $0x049656e69 , %edx + xor $0x049656e69 , %edx /* "ineI" */ jnz .L_cpu_detect_asm_NotIntel - xor $0x06c65746e , %ecx + xor $0x06c65746e , %ecx /* "ntel" */ jnz .L_cpu_detect_asm_NotIntel - - - +/* Verifying architecture family */ +/* eax - type[13:12] family[11:8] model[7:4] revision[3:0] */ +/* edx - feature bits */ mov $1 , %eax - cpuid + cpuid /* get family/model/stepping */ - shr $8 , %eax - and $0x0f , %eax + shr $8 , %eax /* rid of model & stepping number */ + and $0x0f , %eax /* use only family */ cmp $6 , %eax - jl .L_cpu_detect_asm_IsP5 - + jl .L_cpu_detect_asm_IsP5 /* It's a P5 */ +/* Else it's a P6 */ - - +/* Intel P6 processor. */ +/* feature bits are in edx from the cpuid[1] */ .L_cpu_detect_asm_IsP6: - +/* Make sure it supports Memory Type Range Request registers (bit 12) */ mov %edx , %ebx test $0x1000 , %ebx - +/* Hmmmm... p6 w/o mtrr's? */ jz .L_cpu_detect_asm_IsP5 - +/* Check for katmai-ness (bit 25) */ test $0x2000000 , %edx jz .L_cpu_detect_asm_noKNI mov $7 , %eax - jmp .L_cpu_detect_asm_DoneCpu + jmp .L_cpu_detect_asm_DoneCpu /* return */ .L_cpu_detect_asm_noKNI: - mov $6 , %eax - jmp .L_cpu_detect_asm_DoneCpu + mov $6 , %eax /* */ + jmp .L_cpu_detect_asm_DoneCpu /* return */ .L_cpu_detect_asm_IsP5: - mov $5 , %eax + mov $5 , %eax /* */ jmp .L_cpu_detect_asm_DoneCpu .L_cpu_detect_asm_NotPentium: @@ -161,35 +160,35 @@ _cpu_detect_asm: .L_cpu_detect_asm_NotIntel: - - - +/* This is a non-Intel processor. Figure out whether it supports */ +/* both MMX and 3DNow!, in which case we can use Norbert's cool */ +/* MMX/3DNow!(tm) code */ - - +/* The return value is split into two 16-bit fields. Bits [31:16] */ +/* identify the processor vendor as follows: */ - - - +/* 8001h AMD */ +/* 8002h Cyrix */ +/* 8003h IDT */ - +/* Bits [15:0] identify processor features as follows: */ - - - - +/* 0001h MMX */ +/* 0002h 3DNow! (tm) */ +/* 0004h K6-style MTRRs */ +/* 0008h PentiumII-style MTRRs */ - xor %esi , %esi - xor %edi , %edi + xor %esi , %esi /* default feature flags */ + xor %edi , %edi /* default extended feature flags */ - +/* Test whether extended feature function is supported */ mov $0x80000000 , %eax cpuid cmp $0x80000000 , %eax jbe .L_cpu_detect_asm_NoExtendedFeatures - +/* execute extended feature function */ mov $0x80000001 , %eax cpuid @@ -197,81 +196,81 @@ _cpu_detect_asm: .L_cpu_detect_asm_NoExtendedFeatures: - +/* execute standard feature function */ mov $1 , %eax cpuid mov %edx , %esi - mov %eax , %ebp + mov %eax , %ebp /* save family/model/stepping */ - +/* get the vendor string */ mov $0 , %eax cpuid .L_cpu_detect_asm_ChkAMD: - cmp $0x68747541 , %ebx + cmp $0x68747541 , %ebx /* 'htuA' */ jne .L_cpu_detect_asm_ChkCyrix - cmp $0x69746E65 , %edx + cmp $0x69746E65 , %edx /* 'itne' */ jne .L_cpu_detect_asm_ChkCyrix - cmp $0x444D4163 , %ecx + cmp $0x444D4163 , %ecx /* 'DMAc' */ je .L_cpu_detect_asm_CPUisAMD .L_cpu_detect_asm_ChkCyrix: - cmp $0x69727943 , %ebx + cmp $0x69727943 , %ebx /* 'iryC' */ jne .L_cpu_detect_asm_ChkIDT - cmp $0x736E4978 , %edx + cmp $0x736E4978 , %edx /* 'snIx' */ jne .L_cpu_detect_asm_ChkIDT - cmp $0x64616574 , %ecx + cmp $0x64616574 , %ecx /* 'deat' */ je .L_cpu_detect_asm_CPUisCyrix .L_cpu_detect_asm_ChkIDT: - cmp $0x746E6543 , %ebx + cmp $0x746E6543 , %ebx /* 'tneC' */ jne .L_cpu_detect_asm_UnknownVendor - cmp $0x48727561 , %edx + cmp $0x48727561 , %edx /* 'Hrua' */ jne .L_cpu_detect_asm_UnknownVendor - cmp $0x736C7561 , %ecx + cmp $0x736C7561 , %ecx /* 'slua' */ jne .L_cpu_detect_asm_UnknownVendor .L_cpu_detect_asm_CPUisIDT: - mov $0x80030000 , %eax - test $0x00800000 , %esi + mov $0x80030000 , %eax /* vendor = IDT, features = none */ + test $0x00800000 , %esi /* check for MMX bit in features */ jz .L_cpu_detect_asm_DoneCpu - or $1 , %eax - test $0x80000000 , %edi + or $1 , %eax /* set MMX feature flag */ + test $0x80000000 , %edi /* check for 3DNow! bit in extended features */ jz .L_cpu_detect_asm_DoneCpu - or $2 , %eax + or $2 , %eax /* set 3DNow! feature flag */ jmp .L_cpu_detect_asm_DoneCpu .L_cpu_detect_asm_CPUisAMD: - mov $0x80010000 , %eax - mov %ebp , %edx - and $0x00000FFF , %edx - cmp $0x00000588 , %edx - jb .L_cpu_detect_asm_AmdMTRRchkDone - cmp $0x00000600 , %edx - jb .L_cpu_detect_asm_AmdHasK6MTRR - or $8 , %eax + mov $0x80010000 , %eax /* vendor = AMD, features = none */ + mov %ebp , %edx /* family/model/stepping information */ + and $0x00000FFF , %edx /* extract family/model/stepping */ + cmp $0x00000588 , %edx /* CXT, Sharptooth, or K7 ? */ + jb .L_cpu_detect_asm_AmdMTRRchkDone /* nope, definitely no MTRRs */ + cmp $0x00000600 , %edx /* K7 or better ? */ + jb .L_cpu_detect_asm_AmdHasK6MTRR /* nope, but supports K6 MTRRs */ + or $8 , %eax /* set P2_MTRR feature flag */ jmp .L_cpu_detect_asm_AmdMTRRchkDone .L_cpu_detect_asm_AmdHasK6MTRR: - or $4 , %eax + or $4 , %eax /* set K6_MTRR feature flag */ .L_cpu_detect_asm_AmdMTRRchkDone: - test $0x00800000 , %esi + test $0x00800000 , %esi /* check for MMX bit in features */ jz .L_cpu_detect_asm_DoneCpu - or $1 , %eax - test $0x80000000 , %edi + or $1 , %eax /* set MMX feature flag */ + test $0x80000000 , %edi /* check for 3DNow! bit in extended features */ jz .L_cpu_detect_asm_DoneCpu - or $2 , %eax + or $2 , %eax /* set 3DNow! feature flag */ jmp .L_cpu_detect_asm_DoneCpu .L_cpu_detect_asm_CPUisCyrix: - mov $0x80020000 , %eax - test $0x00800000 , %esi + mov $0x80020000 , %eax /* vendor = Cyrix, features = none */ + test $0x00800000 , %esi /* check for MMX bit in features */ jz .L_cpu_detect_asm_DoneCpu - or $1 , %eax - test $0x80000000 , %edi + or $1 , %eax /* set MMX feature flag */ + test $0x80000000 , %edi /* check for 3DNow! bit in extended features */ jz .L_cpu_detect_asm_DoneCpu - or $2 , %eax + or $2 , %eax /* set 3DNow! feature flag */ jmp .L_cpu_detect_asm_DoneCpu .L_cpu_detect_asm_UnknownVendor: @@ -283,18 +282,18 @@ _cpu_detect_asm: .size _cpu_detect_asm,.L_END__cpu_detect_asm-_cpu_detect_asm - - - -.align 4 +/* ------------------------------------------------------------------------------ */ +/* this routine sets the precision to single */ +/* which effects all adds, mults, and divs */ +.align 4 /* */ .globl single_precision_asm .type single_precision_asm,@function single_precision_asm: - push %eax - fnclex + push %eax /* make room */ + fnclex /* clear pending exceptions */ fstcw (%esp) movl (%esp) , %eax - and $0x0000fcff , %eax + and $0x0000fcff , %eax /* clear bits 9:8 */ movl %eax , (%esp) fldcw (%esp) pop %eax @@ -302,19 +301,19 @@ single_precision_asm: .L_END_single_precision_asm: .size single_precision_asm,.L_END_single_precision_asm-single_precision_asm - - - -.align 4 +/* ------------------------------------------------------------------------------ */ +/* this routine sets the precision to double */ +/* which effects all adds, mults, and divs */ +.align 4 /* */ .globl double_precision_asm .type double_precision_asm,@function double_precision_asm: - push %eax - fnclex + push %eax /* make room */ + fnclex /* clear pending exceptions */ fstcw (%esp) movl (%esp) , %eax - and $0x0000fcff , %eax - or $0x000002ff , %eax + and $0x0000fcff , %eax /* clear bits 9:8 */ + or $0x000002ff , %eax /* set 9:8 to 10 */ movl %eax , (%esp) fldcw (%esp) pop %eax diff --git a/glide3x/h5/glide3/src/makefile.linux b/glide3x/h5/glide3/src/makefile.linux index f26ff8b..48427ea 100644 --- a/glide3x/h5/glide3/src/makefile.linux +++ b/glide3x/h5/glide3/src/makefile.linux @@ -279,7 +279,7 @@ endif # PREPROCESSOR=/lib/cpp -$$ %.o: %.s - $(PREPROCESSOR) $< > $*.tmp.s + $(PREPROCESSOR) $(PREPROCESSOR_FLAGS) $< > $*.tmp.s $(CC) $(AFLAGS) -c -o $@ $*.tmp.s $(RM) -f $*.tmp.s @@ -290,20 +290,35 @@ cpudtect.o: cpudtect.s # 3DNow!(tm) dependencies # XXX_def.obj targets are the default targets + ifneq ($(GL_AMD3D),) +# I have to copy the build rule from above, because the _def/_3dnow +# causes the object file names not to match up with the source file names. +# And I need to selectively enable the 3DNow flags. + xdraw2_def.o: xdraw2.s xdraw2.inc.s fxgasm.h - $(CC) $(AFLAGS) -c -o $@ xdraw2.s + $(PREPROCESSOR) $< > $*.tmp.s + $(CC) $(AFLAGS) -c -o $@ $*.tmp.s + $(RM) -f $*.tmp.s xdraw2_3dnow.o: xdraw2.s xdraw2.inc.s fxgasm.h - $(CC) $(AFLAGS) -DGL_AMD3D -DUSE_PACKET_FIFO=1 -c -o $@ xdraw2.s + $(PREPROCESSOR) -DGL_AMD3D -DUSE_PACKET_FIFO=1 $< > $*.tmp.s + $(CC) $(AFLAGS) -c -o $@ $*.tmp.s + $(RM) -f $*.tmp.s xdraw3_def.o: xdraw3.s fxgasm.h - $(CC) $(AFLAGS) -c -o $@ xdraw3.s + $(PREPROCESSOR) $< > $*.tmp.s + $(CC) $(AFLAGS) -c -o $@ $*.tmp.s + $(RM) -f $*.tmp.s xdraw3_3dnow.o: xdraw3.s fxgasm.h - $(CC) $(AFLAGS) -DGL_AMD3D -DUSE_PACKET_FIFO=1 -c -o $@ xdraw3.s + $(PREPROCESSOR) -DGL_AMD3D -DUSE_PACKET_FIFO=1 $< > $*.tmp.s + $(CC) $(AFLAGS) -c -o $@ $*.tmp.s + $(RM) -f $*.tmp.s xtexdl_3dnow.o: xtexdl.s fxgasm.h - $(CC) $(AFLAGS) -DGL_AMD3D -DUSE_PACKET_FIFO=1 -c -o $@ xtexdl.s + $(PREPROCESSOR) -DGL_AMD3D -DUSE_PACKET_FIFO=1 $< > $*.tmp.s + $(CC) $(AFLAGS) -c -o $@ $*.tmp.s + $(RM) -f $*.tmp.s endif # GL_AMD3D diff --git a/glide3x/h5/glide3/src/xdraw2.inc.s b/glide3x/h5/glide3/src/xdraw2.inc.s index 604e71e..dd41dde 100644 --- a/glide3x/h5/glide3/src/xdraw2.inc.s +++ b/glide3x/h5/glide3/src/xdraw2.inc.s @@ -1,46 +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. -** +** 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 +** 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 -*/ + */ /* -*-asm-*- */ -/* $Header$ */ -/* $Revision$ */ -/* $Log$ */ -/* Revision 1.1 2000/06/15 00:27:43 joseph */ -/* Initial checkin into SourceForge. */ +/* $Header$ * +/* $Revision$ * +/* $Log$ +/* Revision 1.1 2000/06/15 00:27:43 joseph +/* Initial checkin into SourceForge. / -/* Revision 1.1.1.1 2000/04/26 20:35:32 poppa */ -/* Initial Napalm Glide from Precision Insight */ -/* */ -/* Revision 1.2 2000/04/18 15:58:15 poppa */ -/* h5/glide3/src/glide.h: Define grSwapBuffers as grDRISwapBuffers. This */ -/* may not be right. */ -/* h5/glide3/src/makefile.linux: */ -/* Added definition of AFLAGS. */ -/* h5/glide3/src/xdraw2.S:Fixed some macros to make the assembler work on */ -/* this file. */ -/* h5/glide3/src/xdraw2.inc.S: */ -/* Fixed some macros to make the assembler work on */ -/* this file. */ -/* h5/minihwc/gdebug.c: Apparently fclose(NULL) fails in Linux. This */ -/* is the POSIX behavior as I recall. */ +/* Revision 1.1.1.1 2000/04/26 20:35:32 poppa +/* Initial Napalm Glide from Precision Insight +/* +/* Revision 1.2 2000/04/18 15:58:15 poppa +/* h5/glide3/src/glide.h: Define grSwapBuffers as grDRISwapBuffers. This +/* may not be right. +/* h5/glide3/src/makefile.linux: +/* Added definition of AFLAGS. +/* h5/glide3/src/xdraw2.S:Fixed some macros to make the assembler work on +/* this file. +/* h5/glide3/src/xdraw2.inc.S: +/* Fixed some macros to make the assembler work on +/* this file. +/* h5/minihwc/gdebug.c: Apparently fclose(NULL) fails in Linux. This +/* is the POSIX behavior as I recall. /* */ /* */ /* 2 10/30/97 6:53p Peter */ @@ -245,7 +245,7 @@ LOCAL(no_validation): cmp tempVal , %ebx /* fifo space required >= space available ? */ jge LOCAL(__triBegin) /* yup, push out triangle data to Voodoo */ - pushl $__LINE__ /* line number inside this function */ + push $__LINE__ /* line number inside this function */ push $0x0 /* pointer to function name = NULL */ push tempVal /* fifo space required */ @@ -833,7 +833,7 @@ LOCAL(nocull): jge LOCAL(__triBegin) - pushl $__LINE__ + push $__LINE__ push $0x0 push %eax diff --git a/glide3x/h5/glide3/src/xdraw2.s b/glide3x/h5/glide3/src/xdraw2.s index a1f875f..69129b2 100644 --- a/glide3x/h5/glide3/src/xdraw2.s +++ b/glide3x/h5/glide3/src/xdraw2.s @@ -1,203 +1,118 @@ -# 1 "xdraw2.S" - +/* +** 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 +** 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 + */ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +/* $Header$ */ +/* $Revision$ */ +/* $Log$ +/* Revision 1.1 2000/06/15 00:27:43 joseph +/* Initial checkin into SourceForge. +/* +/* Revision 1.1.1.1 2000/04/26 20:35:33 poppa +/* Initial Napalm Glide from Precision Insight +/* +/* Revision 1.2 2000/04/18 15:58:15 poppa +/* h5/glide3/src/glide.h: Define grSwapBuffers as grDRISwapBuffers. This +/* may not be right. +/* h5/glide3/src/makefile.linux: +/* Added definition of AFLAGS. +/* h5/glide3/src/xdraw2.S:Fixed some macros to make the assembler work on +/* this file. +/* h5/glide3/src/xdraw2.inc.s +/* Fixed some macros to make the assembler work on +/* this file. +/* h5/minihwc/gdebug.c: Apparently fclose(NULL) fails in Linux. This +/* is the POSIX behavior as I recall. +/* */ +/* */ +/* 4 4/06/99 3:54p Dow */ +/* Alt tab again. */ +/* */ +/* 12 4/05/99 11:34a Atai */ +/* added GLIDE_ALT_TAB for xdraw2.inc to query context in the retail build */ +/* */ +/* 11 3/19/99 11:26a Peter */ +/* expose direct fifo for gl */ +/* */ +/* 10 10/14/98 12:05p Peter */ +/* fixed my effed up assumption about non-volatile regs */ +/* */ +/* 9 10/12/98 9:51a Peter */ +/* dynamic 3DNow!(tm) */ +/* */ +/* 8 9/24/98 11:17a Dow */ +/* AMD 3DNow! (tm) mods */ +/* */ +/* 7 8/30/98 1:34p Dow */ +/* State & other optimizations */ +/* */ +/* 6 8/29/98 8:12p Dow */ +/* Clip optimization */ +/* */ +/* 5 7/01/98 8:41a Jdt */ +/* removed gc arg from trisetup funcs */ +/* */ +/* 4 8/03/98 6:36a Jdt */ +/* Add GC to trisetup arglist */ +/* */ +/* 3 6/09/98 11:59a Atai */ +/* 1. update glide header */ +/* 2. fix cull mode */ +/* 3. fix tri stats */ +/* */ +/* 8 5/18/98 3:21p Peter */ +/* dynamic culling changes */ +/* */ +/* 6 1/15/98 1:12p Peter */ +/* dispatch w/o packing */ +/* */ +/* 5 11/06/97 3:47p Peter */ +/* dispatch code w/ simulator */ +/* */ +/* 4 11/04/97 5:04p Peter */ +/* cataclysm part deux */ +/* */ +/* 3 11/01/97 10:01a Peter */ +/* tri dispatch stuff */ +/* */ +/* 2 10/30/97 6:53p Peter */ +/* first real cut at tri asm */ +/* */ +/* 1 10/30/97 4:29p Peter */ +/* asm tri code */ +/* */ +/* 2 7/07/97 2:14p Jdt */ +/* assembly now on par with C code. */ +/* */ +/* 1 7/07/97 8:37a Jdt */ +/* B4 Chip field fix. */ .file "xdraw2.asm" - -# 1 "fxgasm.h" 1 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -# 111 "xdraw2.S" 2 - - - +/* Definitions of cvg regs and glide root structures. */ +#include "fxgasm.h" +#ifdef HAL_CSIM +#endif .data .type One,@object @@ -211,1771 +126,306 @@ Area: .int 0 .section .rodata .type T2003,@object .size T2003,4 -T2003: .int 0x46400000 +T2003: .int 0x46400000 /* 12288 */ .type T2005,@object .size T2005,4 -T2005: .int 0x3f800000 +T2005: .int 0x3f800000 /* 1 */ .type T2006,@object .size T2006,4 -T2006: .int 0x43800000 +T2006: .int 0x43800000 /* 256 */ - +/* Arguments (STKOFF = 16 from 4 pushes) */ +#define STKOFF 16 +#define _gc 4 + STKOFF +#define _va 8 + STKOFF +#define _vb 12 + STKOFF +#define _vc 16 + STKOFF +/* coordinate offsets into vertex. */ +/* NB: These are constants and are not */ +/* user settable like the rest of the */ +/* parameter offset. Weird. */ +#define X 0 +#define Y 4 +#ifdef GL_AMD3D +#define PROC_TYPE(arg) _trisetup_3DNow_##arg +#define END_PROC_TYPE(arg) .L_END_trisetup_3Dnow_##arg +#else +#define PROC_TYPE(arg) _trisetup_Default_##arg +#define END_PROC_TYPE(arg) .L_END_trisetup_Default_##arg +#endif +/* enables/disables trisProcessed and trisDrawn counters */ +#define STATS 1 +/* offsets into vertex struct */ +#define X 0 +#define Y 4 +/* NB: All of the base triangle procs expect to have the gc */ +/* passed from the caller in edx so that we can avoid */ +/* the agi from the far pointer. Screw w/ this at your */ +/* own peril. */ - - - - +/* YOU HAVE BEEN WARNED */ - - - - - - - - - - - - - - - - - - - - - - - - - +/* -------------------------------------------------------------------------- */ .text .align 32 -.globl _trisetup_Default_clip_nocull_invalid -.type _trisetup_Default_clip_nocull_invalid ,@function -_trisetup_Default_clip_nocull_invalid : - - - - +.globl PROC_TYPE(clip_nocull_invalid) +.type PROC_TYPE(clip_nocull_invalid),@function +PROC_TYPE(clip_nocull_invalid): +#ifdef LOCAL +#undef LOCAL +#endif +#define LOCAL(arg) L_clip_nocull_invalid##arg +#define GLIDE_VALIDATE_STATE 1 +#define GLIDE_CLIP_COORDS 1 +#define GLIDE_CULLING 0 +#define GLIDE_PACK_RGB 0 +#define GLIDE_PACK_ALPHA 0 +#define GLIDE_GENERIC_SETUP 0 +#include "xdraw2.inc.s" +#undef GLIDE_GENERIC_SETUP +#undef GLIDE_PACK_ALPHA +#undef GLIDE_PACK_RGB +#undef GLIDE_CULLING +#undef GLIDE_CLIP_COORDS +#undef GLIDE_VALIDATE_STATE - - - - - -# 1 "xdraw2.inc.s" 1 - - - - - - - - - - - - - - - - - - - - - - - - - - - -/ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -# 674 "xdraw2.inc.s" - - - - - - - - - -.file "xdraw2.inc.S" - - - - - - - - - - - - - - - - - - - - - - - - - -# 960 "xdraw2.inc.s" - - -# 194 "xdraw2.S" 2 - - - - - - - - -.L_END_trisetup_Default_clip_nocull_invalid : -.size _trisetup_Default_clip_nocull_invalid ,.L_END_trisetup_Default_clip_nocull_invalid - _trisetup_Default_clip_nocull_invalid +END_PROC_TYPE(clip_nocull_invalid): +.size PROC_TYPE(clip_nocull_invalid),END_PROC_TYPE(clip_nocull_invalid)-PROC_TYPE(clip_nocull_invalid) .align 32 -.globl _trisetup_Default_clip_cull_invalid -.type _trisetup_Default_clip_cull_invalid ,@function -_trisetup_Default_clip_cull_invalid : - +.globl PROC_TYPE(clip_cull_invalid) +.type PROC_TYPE(clip_cull_invalid),@function +PROC_TYPE(clip_cull_invalid): +#define LOCL(arg) .L_clip_cull_invalid_##arg +#define GLIDE_VALIDATE_STATE 1 +#define GLIDE_CLIP_COORDS 1 +#define GLIDE_CULLING 1 +#define GLIDE_PACK_RGB 0 +#define GLIDE_PACK_ALPHA 0 +#define GLIDE_GENERIC_SETUP 0 +#include "xdraw2.inc.s" +#undef GLIDE_GENERIC_SETUP +#undef GLIDE_PACK_ALPHA +#undef GLIDE_PACK_RGB +#undef GLIDE_CULLING +#undef GLIDE_CLIP_COORDS +#undef GLIDE_VALIDATE_STATE - - - - - -# 1 "xdraw2.inc.s" 1 - - - - - - - - - - - - - - - - - - - - - - - - - - - -/ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -# 674 "xdraw2.inc.s" - - - - - - - - - -.file "xdraw2.inc.S" - - - - - - - - - - - - - - - - - - - - - - - - - -# 960 "xdraw2.inc.s" - - -# 218 "xdraw2.S" 2 - - - - - - - - -.L_END_trisetup_Default_clip_cull_invalid : -.size _trisetup_Default_clip_cull_invalid ,.L_END_trisetup_Default_clip_cull_invalid - _trisetup_Default_clip_cull_invalid +END_PROC_TYPE(clip_cull_invalid): +.size PROC_TYPE(clip_cull_invalid),END_PROC_TYPE(clip_cull_invalid)-PROC_TYPE(clip_cull_invalid) .align 32 -.globl _trisetup_Default_clip_cull_valid -.type _trisetup_Default_clip_cull_valid ,@function -_trisetup_Default_clip_cull_valid : - - - - +.globl PROC_TYPE(clip_cull_valid) +.type PROC_TYPE(clip_cull_valid),@function +PROC_TYPE(clip_cull_valid): +#ifdef LOCAL +#undef LOCAL +#endif +#define LOCAL(arg) L_clip_cull_valid_##arg +#define GLIDE_VALIDATE_STATE 0 +#define GLIDE_CLIP_COORDS 1 +#define GLIDE_CULLING 1 +#define GLIDE_PACK_RGB 0 +#define GLIDE_PACK_ALPHA 0 +#define GLIDE_GENERIC_SETUP 0 +#include "xdraw2.inc.s" +#undef GLIDE_GENERIC_SETUP +#undef GLIDE_PACK_ALPHA +#undef GLIDE_PACK_RGB +#undef GLIDE_CULLING +#undef GLIDE_CLIP_COORDS +#undef GLIDE_VALIDATE_STATE - - - - - -# 1 "xdraw2.inc.s" 1 - - - - - - - - - - - - - - - - - - - - - - - - - - - -/ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -# 674 "xdraw2.inc.s" - - - - - - - - - -.file "xdraw2.inc.S" - - - - - - - - - - - - - - - - - - - - - - - - - -# 960 "xdraw2.inc.s" - - -# 245 "xdraw2.S" 2 - - - - - - - - -.L_END_trisetup_Default_clip_cull_valid : -.size _trisetup_Default_clip_cull_valid ,.L_END_trisetup_Default_clip_cull_valid - _trisetup_Default_clip_cull_valid +END_PROC_TYPE(clip_cull_valid): +.size PROC_TYPE(clip_cull_valid),END_PROC_TYPE(clip_cull_valid)-PROC_TYPE(clip_cull_valid) .align 32 -.globl _trisetup_Default_clip_nocull_valid -.type _trisetup_Default_clip_nocull_valid ,@function -_trisetup_Default_clip_nocull_valid : - - - - +.globl PROC_TYPE(clip_nocull_valid) +.type PROC_TYPE(clip_nocull_valid),@function +PROC_TYPE(clip_nocull_valid): +#ifdef LOCAL +#undef LOCAL +#endif +#define LOCAL(arg) L_clip_nocull_valid_##arg +#define GLIDE_VALIDATE_STATE 0 +#define GLIDE_CLIP_COORDS 1 +#define GLIDE_CULLING 0 +#define GLIDE_PACK_RGB 0 +#define GLIDE_PACK_ALPHA 0 +#define GLIDE_GENERIC_SETUP 0 +#include "xdraw2.inc.s" +#undef GLIDE_GENERIC_SETUP +#undef GLIDE_PACK_ALPHA +#undef GLIDE_PACK_RGB +#undef GLIDE_CULLING +#undef GLIDE_CLIP_COORDS +#undef GLIDE_VALIDATE_STATE - - - - - -# 1 "xdraw2.inc.s" 1 - - - - - - - - - - - - - - - - - - - - - - - - - - - -/ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -# 674 "xdraw2.inc.s" - - - - - - - - - -.file "xdraw2.inc.S" - - - - - - - - - - - - - - - - - - - - - - - - - -# 960 "xdraw2.inc.s" - - -# 272 "xdraw2.S" 2 - - - - - - - - -.L_END_trisetup_Default_clip_nocull_valid : -.size _trisetup_Default_clip_nocull_valid ,.L_END_trisetup_Default_clip_nocull_valid - _trisetup_Default_clip_nocull_valid +END_PROC_TYPE(clip_nocull_valid): +.size PROC_TYPE(clip_nocull_valid),END_PROC_TYPE(clip_nocull_valid)-PROC_TYPE(clip_nocull_valid) .align 32 -.globl _trisetup_Default_win_nocull_invalid -.type _trisetup_Default_win_nocull_invalid ,@function -_trisetup_Default_win_nocull_invalid : - - - - +.globl PROC_TYPE(win_nocull_invalid) +.type PROC_TYPE(win_nocull_invalid),@function +PROC_TYPE(win_nocull_invalid): +#ifdef LOCAL +#undef LOCAL +#endif +#define LOCAL(arg) L_win_nocull_invalid_##arg - - - - - - -# 1 "xdraw2.inc.s" 1 - - - - - - - - - - - - - - - - - - - - - - - - - - - -/ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -# 674 "xdraw2.inc.s" - - - - - - - - - -.file "xdraw2.inc.S" - - - - - - - - - - - - - - - - - -# 709 "xdraw2.inc.s" - - - push %esi - push %edi - - push %ebx - push %ebp - - mov 4 + 16 (%esp) , %esi - - - - -# 737 "xdraw2.inc.s" - - - -# 751 "xdraw2.inc.s" - - -L_win_nocull_invalid_pastContextTest : - - - movl 0x00000b78 (%esi ) , %edx - test %edx , %edx - je L_win_nocull_invalid_no_validation - call _grValidateState -.align 4 - - -L_win_nocull_invalid_no_validation : -# 823 "xdraw2.inc.s" - - -L_win_nocull_invalid_nocull : - - - mov 0x0000004c (%esi ) , %eax - mov 0x00000dec (%esi ) , %ebx - - add $4 , %eax - cmp %eax , %ebx - - jge L_win_nocull_invalid___triBegin - - pushl $836 - push $0x0 - - push %eax - call _grCommandTransportMakeRoom - add $12, %esp - - - - - - - - - - - -.macro GR_FIFO_WRITE __addr __offset __data -# 866 "xdraw2.inc.s" - - mov \__data , \__offset(\__addr) - -.endm - -.align 4 -L_win_nocull_invalid___triBegin : - mov 0x00000de4 (%esi ) , %ebp - mov $8 + 16 - 16 , %ecx - - mov 0x00000dd8 (%esi ) , %eax - nop - - GR_FIFO_WRITE %ebp , 0 , %eax - add $4 , %ebp - -.align 4 -L_win_nocull_invalid___vertexStart : - mov 16 (%esp, %ecx ) , %edx - add $8 , %ebp - - nop - nop - - movl (%edx ) , %eax - lea 0x00000124 (%esi ) , %ebx - - GR_FIFO_WRITE %ebp , -8 , %eax - movl 4(%edx ) , %eax - - xor %edi , %edi - GR_FIFO_WRITE %ebp , -4 , %eax - -L_win_nocull_invalid___doParams : - movl (%ebx ) , %eax - add $4 , %ebx - - cmp $0 , %eax - je L_win_nocull_invalid___nextVertex - - - - nop - nop - -L_win_nocull_invalid___paramLoop : - movl (%eax,%edx ) , %edi - add $4 , %ebp - - movl (%ebx ) , %eax - add $4 , %ebx - - cmp $0 , %eax - GR_FIFO_WRITE %ebp , -4 , %edi - - jne L_win_nocull_invalid___paramLoop - -.align 4 -L_win_nocull_invalid___nextVertex : - - add $4 , %ecx - - cmp $16 + 16 - 16 +4 , %ecx - jne L_win_nocull_invalid___vertexStart - - - mov %ebp , %eax - mov 0x00000de4 (%esi ) , %ebx - - mov %ebp , 0x00000de4 (%esi ) - sub %ebx , %eax - - mov 0x00000010 (%esi ) , %ebx - sub %eax , 0x00000dec (%esi ) - - add $1 , %ebx - mov %ebx , 0x00000010 (%esi ) - - - mov $0x1 , %eax - -L_win_nocull_invalid___triDone : - - mov 0x0000000c (%esi ) , %ecx - pop %ebp - - add $1 , %ecx - pop %ebx - - pop %edi - mov %ecx , 0x0000000c (%esi ) - - pop %esi - ret - - -# 299 "xdraw2.S" 2 - - - - - - - - -.L_END_trisetup_Default_win_nocull_invalid : -.size _trisetup_Default_win_nocull_invalid ,.L_END_trisetup_Default_win_nocull_invalid - _trisetup_Default_win_nocull_invalid +#define GLIDE_VALIDATE_STATE 1 +#define GLIDE_CLIP_COORDS 0 +#define GLIDE_CULLING 0 +#define GLIDE_PACK_RGB 0 +#define GLIDE_PACK_ALPHA 0 +#define GLIDE_GENERIC_SETUP 0 +#include "xdraw2.inc.s" +#undef GLIDE_GENERIC_SETUP +#undef GLIDE_PACK_ALPHA +#undef GLIDE_PACK_RGB +#undef GLIDE_CULLING +#undef GLIDE_CLIP_COORDS +#undef GLIDE_VALIDATE_STATE + +END_PROC_TYPE(win_nocull_invalid): +.size PROC_TYPE(win_nocull_invalid),END_PROC_TYPE(win_nocull_invalid)-PROC_TYPE(win_nocull_invalid) .align 32 -.globl _trisetup_Default_win_cull_invalid - -.type _trisetup_Default_win_cull_invalid ,@function -_trisetup_Default_win_cull_invalid : - - - +.globl PROC_TYPE(win_cull_invalid) +.type PROC_TYPE(win_cull_invalid),@function +PROC_TYPE(win_cull_invalid): +#ifdef LOCAL +#undef LOCAL +#endif +#define LOCAL(arg) L_win_cull_invalid_##arg - - - - - - -# 1 "xdraw2.inc.s" 1 - - - - - - - - - - - - - - - - - - - - - - - - - - - -/ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -# 674 "xdraw2.inc.s" - - - - - - - - - -.file "xdraw2.inc.S" - - - - - - - - - - - - - - - - - -# 709 "xdraw2.inc.s" - - - push %esi - push %edi - - push %ebx - push %ebp - - mov 4 + 16 (%esp) , %esi - - - - -# 737 "xdraw2.inc.s" - - - -# 751 "xdraw2.inc.s" - - -L_win_cull_invalid_pastContextTest : - - - movl 0x00000b78 (%esi ) , %edx - test %edx , %edx - je L_win_cull_invalid_no_validation - call _grValidateState -.align 4 - - -L_win_cull_invalid_no_validation : - - - - - - - - - - - mov 8 + 16 (%esp) , %eax - mov 12 + 16 (%esp) , %ebx - - mov 0x000001e0 (%esi ) , %edx - mov 16 + 16 (%esp) , %ecx - - test %edx , %edx - jz L_win_cull_invalid_nocull - - shl $31 , %edx - -L_win_cull_invalid_Area_Computation : - - - flds 0 (%eax ) - fsubs 0 (%ebx ) - flds 0 (%ebx ) - fsubs 0 (%ecx ) - flds 4 (%ebx ) - fsubs 4 (%ecx ) - flds 4 (%eax ) - fsubs 4 (%ebx ) - fld %st(3) - fmul %st(2) , %st - fld %st(3) - fmul %st(2) , %st - fsubrp %st , %st(1) - fsts One+0x04 - - - fstp %st(0) - fstp %st(0) - fstp %st(0) - fstp %st(0) - fstp %st(0) - - mov One+0x04 , %ebp - xor %eax , %eax - - - and $0x7fffffff , %ebp - jz L_win_cull_invalid___triDone - - - mov One+0x04 , %ebp - xor %edx , %ebp - - jge L_win_cull_invalid___triDone -.align 4 - - -L_win_cull_invalid_nocull : - - - mov 0x0000004c (%esi ) , %eax - mov 0x00000dec (%esi ) , %ebx - - add $4 , %eax - cmp %eax , %ebx - - jge L_win_cull_invalid___triBegin - - pushl $836 - push $0x0 - - push %eax - call _grCommandTransportMakeRoom - add $12, %esp - - - - - - - - - - - -.macro GR_FIFO_WRITE __addr __offset __data -# 866 "xdraw2.inc.s" - - mov \__data , \__offset(\__addr) - -.endm - -.align 4 -L_win_cull_invalid___triBegin : - mov 0x00000de4 (%esi ) , %ebp - mov $8 + 16 - 16 , %ecx - - mov 0x00000dd8 (%esi ) , %eax - nop - - GR_FIFO_WRITE %ebp , 0 , %eax - add $4 , %ebp - -.align 4 -L_win_cull_invalid___vertexStart : - mov 16 (%esp, %ecx ) , %edx - add $8 , %ebp - - nop - nop - - movl (%edx ) , %eax - lea 0x00000124 (%esi ) , %ebx - - GR_FIFO_WRITE %ebp , -8 , %eax - movl 4(%edx ) , %eax - - xor %edi , %edi - GR_FIFO_WRITE %ebp , -4 , %eax - -L_win_cull_invalid___doParams : - movl (%ebx ) , %eax - add $4 , %ebx - - cmp $0 , %eax - je L_win_cull_invalid___nextVertex - - - - nop - nop - -L_win_cull_invalid___paramLoop : - movl (%eax,%edx ) , %edi - add $4 , %ebp - - movl (%ebx ) , %eax - add $4 , %ebx - - cmp $0 , %eax - GR_FIFO_WRITE %ebp , -4 , %edi - - jne L_win_cull_invalid___paramLoop - -.align 4 -L_win_cull_invalid___nextVertex : - - add $4 , %ecx - - cmp $16 + 16 - 16 +4 , %ecx - jne L_win_cull_invalid___vertexStart - - - mov %ebp , %eax - mov 0x00000de4 (%esi ) , %ebx - - mov %ebp , 0x00000de4 (%esi ) - sub %ebx , %eax - - mov 0x00000010 (%esi ) , %ebx - sub %eax , 0x00000dec (%esi ) - - add $1 , %ebx - mov %ebx , 0x00000010 (%esi ) - - - mov $0x1 , %eax - -L_win_cull_invalid___triDone : - - mov 0x0000000c (%esi ) , %ecx - pop %ebp - - add $1 , %ecx - pop %ebx - - pop %edi - mov %ecx , 0x0000000c (%esi ) - - pop %esi - ret - - -# 327 "xdraw2.S" 2 - - - - - - - - -.L_END_trisetup_Default_win_cull_invalid : -.size _trisetup_Default_win_cull_invalid ,.L_END_trisetup_Default_win_cull_invalid - _trisetup_Default_win_cull_invalid +#define GLIDE_VALIDATE_STATE 1 +#define GLIDE_CLIP_COORDS 0 +#define GLIDE_CULLING 1 +#define GLIDE_PACK_RGB 0 +#define GLIDE_PACK_ALPHA 0 +#define GLIDE_GENERIC_SETUP 0 +#include "xdraw2.inc.s" +#undef GLIDE_GENERIC_SETUP +#undef GLIDE_PACK_ALPHA +#undef GLIDE_PACK_RGB +#undef GLIDE_CULLING +#undef GLIDE_CLIP_COORDS +#undef GLIDE_VALIDATE_STATE + +END_PROC_TYPE(win_cull_invalid): +.size PROC_TYPE(win_cull_invalid),END_PROC_TYPE(win_cull_invalid)-PROC_TYPE(win_cull_invalid) .align 32 -.globl _trisetup_Default_win_cull_valid -.type _trisetup_Default_win_cull_valid ,@function -_trisetup_Default_win_cull_valid : - - - - +.globl PROC_TYPE(win_cull_valid) +.type PROC_TYPE(win_cull_valid),@function +PROC_TYPE(win_cull_valid): +#ifdef LOCAL +#undef LOCAL +#endif +#define LOCAL(arg) L_win_cull_valid_##arg - - - - - - -# 1 "xdraw2.inc.s" 1 - - - - - - - - - - - - - - - - - - - - - - - - - - - -/ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -# 674 "xdraw2.inc.s" - - - - - - - - - -.file "xdraw2.inc.S" - - - - - - - - - - - - - - - - - -# 709 "xdraw2.inc.s" - - - push %esi - push %edi - - push %ebx - push %ebp - - mov 4 + 16 (%esp) , %esi - - - - -# 737 "xdraw2.inc.s" - - - -# 751 "xdraw2.inc.s" - - -L_win_cull_valid_pastContextTest : - - - - - - - - - -L_win_cull_valid_no_validation : - - - - - - - - - - - mov 8 + 16 (%esp) , %eax - mov 12 + 16 (%esp) , %ebx - - mov 0x000001e0 (%esi ) , %edx - mov 16 + 16 (%esp) , %ecx - - test %edx , %edx - jz L_win_cull_valid_nocull - - shl $31 , %edx - -L_win_cull_valid_Area_Computation : - - - flds 0 (%eax ) - fsubs 0 (%ebx ) - flds 0 (%ebx ) - fsubs 0 (%ecx ) - flds 4 (%ebx ) - fsubs 4 (%ecx ) - flds 4 (%eax ) - fsubs 4 (%ebx ) - fld %st(3) - fmul %st(2) , %st - fld %st(3) - fmul %st(2) , %st - fsubrp %st , %st(1) - fsts One+0x04 - - - fstp %st(0) - fstp %st(0) - fstp %st(0) - fstp %st(0) - fstp %st(0) - - mov One+0x04 , %ebp - xor %eax , %eax - - - and $0x7fffffff , %ebp - jz L_win_cull_valid___triDone - - - mov One+0x04 , %ebp - xor %edx , %ebp - - jge L_win_cull_valid___triDone -.align 4 - - -L_win_cull_valid_nocull : - - - mov 0x0000004c (%esi ) , %eax - mov 0x00000dec (%esi ) , %ebx - - add $4 , %eax - cmp %eax , %ebx - - jge L_win_cull_valid___triBegin - - pushl $836 - push $0x0 - - push %eax - call _grCommandTransportMakeRoom - add $12, %esp - - - - - - - - - - - -.macro GR_FIFO_WRITE __addr __offset __data -# 866 "xdraw2.inc.s" - - mov \__data , \__offset(\__addr) - -.endm - -.align 4 -L_win_cull_valid___triBegin : - mov 0x00000de4 (%esi ) , %ebp - mov $8 + 16 - 16 , %ecx - - mov 0x00000dd8 (%esi ) , %eax - nop - - GR_FIFO_WRITE %ebp , 0 , %eax - add $4 , %ebp - -.align 4 -L_win_cull_valid___vertexStart : - mov 16 (%esp, %ecx ) , %edx - add $8 , %ebp - - nop - nop - - movl (%edx ) , %eax - lea 0x00000124 (%esi ) , %ebx - - GR_FIFO_WRITE %ebp , -8 , %eax - movl 4(%edx ) , %eax - - xor %edi , %edi - GR_FIFO_WRITE %ebp , -4 , %eax - -L_win_cull_valid___doParams : - movl (%ebx ) , %eax - add $4 , %ebx - - cmp $0 , %eax - je L_win_cull_valid___nextVertex - - - - nop - nop - -L_win_cull_valid___paramLoop : - movl (%eax,%edx ) , %edi - add $4 , %ebp - - movl (%ebx ) , %eax - add $4 , %ebx - - cmp $0 , %eax - GR_FIFO_WRITE %ebp , -4 , %edi - - jne L_win_cull_valid___paramLoop - -.align 4 -L_win_cull_valid___nextVertex : - - add $4 , %ecx - - cmp $16 + 16 - 16 +4 , %ecx - jne L_win_cull_valid___vertexStart - - - mov %ebp , %eax - mov 0x00000de4 (%esi ) , %ebx - - mov %ebp , 0x00000de4 (%esi ) - sub %ebx , %eax - - mov 0x00000010 (%esi ) , %ebx - sub %eax , 0x00000dec (%esi ) - - add $1 , %ebx - mov %ebx , 0x00000010 (%esi ) - - - mov $0x1 , %eax - -L_win_cull_valid___triDone : - - mov 0x0000000c (%esi ) , %ecx - pop %ebp - - add $1 , %ecx - pop %ebx - - pop %edi - mov %ecx , 0x0000000c (%esi ) - - pop %esi - ret - - -# 354 "xdraw2.S" 2 - - - - - - - - -.L_END_trisetup_Default_win_cull_valid : -.size _trisetup_Default_win_cull_valid ,.L_END_trisetup_Default_win_cull_valid - _trisetup_Default_win_cull_valid +#define GLIDE_VALIDATE_STATE 0 +#define GLIDE_CLIP_COORDS 0 +#define GLIDE_CULLING 1 +#define GLIDE_PACK_RGB 0 +#define GLIDE_PACK_ALPHA 0 +#define GLIDE_GENERIC_SETUP 0 +#include "xdraw2.inc.s" +#undef GLIDE_GENERIC_SETUP +#undef GLIDE_PACK_ALPHA +#undef GLIDE_PACK_RGB +#undef GLIDE_CULLING +#undef GLIDE_CLIP_COORDS +#undef GLIDE_VALIDATE_STATE + +END_PROC_TYPE(win_cull_valid): +.size PROC_TYPE(win_cull_valid),END_PROC_TYPE(win_cull_valid)-PROC_TYPE(win_cull_valid) .align 32 -.globl _trisetup_Default_win_nocull_valid -.type _trisetup_Default_win_nocull_valid ,@function -_trisetup_Default_win_nocull_valid : - - - - +.globl PROC_TYPE(win_nocull_valid) +.type PROC_TYPE(win_nocull_valid),@function +PROC_TYPE(win_nocull_valid): +#ifdef LOCAL +#undef LOCAL +#endif +#define LOCAL(arg) L_win_nocull_valid_##arg - - - - - - -# 1 "xdraw2.inc.s" 1 - - - - - - - - - - - - - - - - - - - - - - - - - - - -/ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -# 674 "xdraw2.inc.s" - - - - - - - - - -.file "xdraw2.inc.S" - - - - - - - - - - - - - - - - - -# 709 "xdraw2.inc.s" - - - push %esi - push %edi - - push %ebx - push %ebp - - mov 4 + 16 (%esp) , %esi - - - - -# 737 "xdraw2.inc.s" - - - -# 751 "xdraw2.inc.s" - - -L_win_nocull_valid_pastContextTest : - - - - - - - - - -L_win_nocull_valid_no_validation : -# 823 "xdraw2.inc.s" - - -L_win_nocull_valid_nocull : - - - mov 0x0000004c (%esi ) , %eax - mov 0x00000dec (%esi ) , %ebx - - add $4 , %eax - cmp %eax , %ebx - - jge L_win_nocull_valid___triBegin - - pushl $836 - push $0x0 - - push %eax - call _grCommandTransportMakeRoom - add $12, %esp - - - - - - - - - - - -.macro GR_FIFO_WRITE __addr __offset __data -# 866 "xdraw2.inc.s" - - mov \__data , \__offset(\__addr) - -.endm - -.align 4 -L_win_nocull_valid___triBegin : - mov 0x00000de4 (%esi ) , %ebp - mov $8 + 16 - 16 , %ecx - - mov 0x00000dd8 (%esi ) , %eax - nop - - GR_FIFO_WRITE %ebp , 0 , %eax - add $4 , %ebp - -.align 4 -L_win_nocull_valid___vertexStart : - mov 16 (%esp, %ecx ) , %edx - add $8 , %ebp - - nop - nop - - movl (%edx ) , %eax - lea 0x00000124 (%esi ) , %ebx - - GR_FIFO_WRITE %ebp , -8 , %eax - movl 4(%edx ) , %eax - - xor %edi , %edi - GR_FIFO_WRITE %ebp , -4 , %eax - -L_win_nocull_valid___doParams : - movl (%ebx ) , %eax - add $4 , %ebx - - cmp $0 , %eax - je L_win_nocull_valid___nextVertex - - - - nop - nop - -L_win_nocull_valid___paramLoop : - movl (%eax,%edx ) , %edi - add $4 , %ebp - - movl (%ebx ) , %eax - add $4 , %ebx - - cmp $0 , %eax - GR_FIFO_WRITE %ebp , -4 , %edi - - jne L_win_nocull_valid___paramLoop - -.align 4 -L_win_nocull_valid___nextVertex : - - add $4 , %ecx - - cmp $16 + 16 - 16 +4 , %ecx - jne L_win_nocull_valid___vertexStart - - - mov %ebp , %eax - mov 0x00000de4 (%esi ) , %ebx - - mov %ebp , 0x00000de4 (%esi ) - sub %ebx , %eax - - mov 0x00000010 (%esi ) , %ebx - sub %eax , 0x00000dec (%esi ) - - add $1 , %ebx - mov %ebx , 0x00000010 (%esi ) - - - mov $0x1 , %eax - -L_win_nocull_valid___triDone : - - mov 0x0000000c (%esi ) , %ecx - pop %ebp - - add $1 , %ecx - pop %ebx - - pop %edi - mov %ecx , 0x0000000c (%esi ) - - pop %esi - ret - - -# 381 "xdraw2.S" 2 - - - - - - - - -.L_END_trisetup_Default_win_nocull_valid : -.size _trisetup_Default_win_nocull_valid ,.L_END_trisetup_Default_win_nocull_valid - _trisetup_Default_win_nocull_valid - -# 428 "xdraw2.S" - +#define GLIDE_VALIDATE_STATE 0 +#define GLIDE_CLIP_COORDS 0 +#define GLIDE_CULLING 0 +#define GLIDE_PACK_RGB 0 +#define GLIDE_PACK_ALPHA 0 +#define GLIDE_GENERIC_SETUP 0 +#include "xdraw2.inc.s" +#undef GLIDE_GENERIC_SETUP +#undef GLIDE_PACK_ALPHA +#undef GLIDE_PACK_RGB +#undef GLIDE_CULLING +#undef GLIDE_CLIP_COORDS +#undef GLIDE_VALIDATE_STATE + +END_PROC_TYPE(win_nocull_valid): +.size PROC_TYPE(win_nocull_valid),END_PROC_TYPE(win_nocull_valid)-PROC_TYPE(win_nocull_valid) + +#ifdef GL_AMD3D +.align 32 +.globl _trisetup_clip_coor_thunk +.type _trisetup_clip_coor_thunk,@function +_trisetup_clip_coor_thunk: + +#define procPtr %eax +#define vPtr %ecx +#define gc %edx /* Current graphics context passed implicitly through edx */ + +/* Call through to the gc->curArchProcs.drawTrianglesProc w/o */ +/* adding extra stuff to the stack. I wish we could actually * +/* do a direct return here w/o too much work. */ + lea _va-STKOFF(%esp) , vPtr /* Get vertex pointer address */ + mov drawTrianglesProc(gc) , procPtr /* Prefetch drawTriangles proc addr */ + + push vPtr /* vertex array address */ + push $3 /* 3 vertices */ + +/* If debugging make sure that we're in clip coordinates */ +#ifdef GLIDE_DEBUG + mov CoordinateSpace(gc) , %eax + test $1 , %eax + jnz L_trisetup_clip_coor_thunk__clipSpace + xor %eax , %eax + mov %eax , (%eax) +L_trisetup_clip_coor_thunk__clipSpace: +#endif /* GLIDE_DEBUG */ + + push $1 /* mode = grDrawVertexArray */ + call procPtr /* (*gc->curArchProcs.drawTrianglesProc)(grDrawVertexArray, 3, vPtr) */ + + ret /* pop 3 dwords (vertex addrs) and return */ +L_END__trisetup_clip_coor_thunk: +.size _trisetup_clip_coor_thunk,L_END__trisetup_clip_coor_thunk-_trisetup_clip_coor_thunk + +#endif /* GL_AMD3D */ .end diff --git a/glide3x/h5/glide3/src/xdraw3.s b/glide3x/h5/glide3/src/xdraw3.s index 12b54e5..44f1cc3 100644 --- a/glide3x/h5/glide3/src/xdraw3.s +++ b/glide3x/h5/glide3/src/xdraw3.s @@ -1,20 +1,20 @@ -/* +/* ** 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 +** 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. -** +** 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. -** +** THE UNITED STATES. +** ** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED */