unite the clans
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
# DOS/DJGPP makefile for Glide3(h5) and Texus2
|
||||
# DOS/DJGPP makefile for Glide3 and Texus2
|
||||
#
|
||||
# Copyright (c) 2003 - Borca Daniel
|
||||
# Email : dborca@users.sourceforge.net
|
||||
@@ -12,25 +12,36 @@
|
||||
# Available options:
|
||||
#
|
||||
# Environment variables:
|
||||
# FX_GLIDE_HW build for the given ASIC (cvg, h3, h5).
|
||||
# default = h5
|
||||
# H4=1 Avenger/Napalm.
|
||||
# target = h3, h5
|
||||
# default = no
|
||||
# CPU optimize for the given processor.
|
||||
# target = cvg, h3, h5
|
||||
# default = pentium
|
||||
# DEBUG=1 disable optimizations and build for debug.
|
||||
# target = cvg, h3, h5
|
||||
# default = no
|
||||
# USE_X86=1 use assembler triangle specializations.
|
||||
# USE_X86=1 use assembler triangle specializations; req by CVG
|
||||
# target = cvg, h3, h5
|
||||
# default = no
|
||||
# USE_3DNOW=1 allow 3DNow! specializations. However, the true CPU
|
||||
# capabilities are still checked at run-time to avoid
|
||||
# crashes.
|
||||
# target = cvg, h3, h5
|
||||
# default = no
|
||||
# USE_MMX=1 (see USE_3DNOW)
|
||||
# target = h5
|
||||
# default = no
|
||||
# USE_SSE=1 (see USE_3DNOW)
|
||||
# target = h5
|
||||
# default = no
|
||||
# USE_SSE2=1 (see USE_3DNOW)
|
||||
# target = h5
|
||||
# default = no
|
||||
# TEXUS2=1 embed Texus2 functions into Glide3.
|
||||
# target = cvg, h3, h5
|
||||
# default = no
|
||||
#
|
||||
# Targets:
|
||||
@@ -54,7 +65,7 @@ GLIDE_DXE = glide3x.dxe
|
||||
GLIDE_IMP = libgld3i.a
|
||||
TEXUS_EXE = texus2.exe
|
||||
|
||||
FX_GLIDE_HW = h5
|
||||
FX_GLIDE_HW ?= h5
|
||||
FX_GLIDE_SW = swlibs
|
||||
GLIDE_LIBDIR = $(FX_GLIDE_HW)/lib
|
||||
TEXUS_EXEDIR = $(FX_GLIDE_SW)/bin
|
||||
@@ -83,15 +94,20 @@ endif
|
||||
CDEFS = -D__DOS__ -D__DOS32__
|
||||
|
||||
# general
|
||||
CDEFS += -DGLIDE3 -DGLIDE3_ALPHA -DGLIDE_HW_TRI_SETUP=1 -DGLIDE_INIT_HWC -DGLIDE_PACKED_RGB=0 -DGLIDE_PACKET3_TRI_SETUP=1 -DGLIDE_TRI_CULLING=1 -DH3 -DUSE_PACKET_FIFO=1
|
||||
CDEFS += -DGLIDE3 -DGLIDE3_ALPHA -DGLIDE_HW_TRI_SETUP=1 -DGLIDE_INIT_HWC -DGLIDE_PACKED_RGB=0 -DGLIDE_PACKET3_TRI_SETUP=1 -DGLIDE_TRI_CULLING=1 -DUSE_PACKET_FIFO=1
|
||||
|
||||
# subsystem
|
||||
ifeq ($(FX_GLIDE_HW),cvg)
|
||||
CDEFS += -DCVG
|
||||
else
|
||||
CDEFS += -DH3
|
||||
ifdef H4
|
||||
CDEFS += -DH4
|
||||
endif
|
||||
ifeq ($(FX_GLIDE_HW),h5)
|
||||
CDEFS += -DFX_GLIDE_H5_CSIM=1 -DFX_GLIDE_NAPALM=1
|
||||
endif
|
||||
endif
|
||||
|
||||
# debug
|
||||
ifdef DEBUG
|
||||
@@ -101,7 +117,14 @@ endif
|
||||
# other
|
||||
CDEFS += -DGLIDE_PLUG -DGLIDE_SPLASH
|
||||
#CDEFS += -DGLIDE_LIB
|
||||
ifeq ($(FX_GLIDE_HW),cvg)
|
||||
#CDEFS += -DGLIDE3_SCALER
|
||||
CDEFS += -DGLIDE_DISPATCH_SETUP -DGLIDE_DISPATCH_DOWNLOAD
|
||||
CDEFS += -DINIT_DOS
|
||||
CDEFS += -D__3Dfx_PCI_CFG__
|
||||
else
|
||||
#CDEFS += -DGLIDE_CHECK_CONTEXT
|
||||
endif
|
||||
|
||||
###############################################################################
|
||||
# flags
|
||||
@@ -125,11 +148,21 @@ CPU ?= pentium
|
||||
CFLAGS += -O2 -ffast-math -mcpu=$(CPU)
|
||||
endif
|
||||
|
||||
CFLAGS += -I$(FX_GLIDE_HW)/glide3/src -I$(FX_GLIDE_HW)/incsrc -I$(FX_GLIDE_HW)/minihwc -I$(FX_GLIDE_HW)/cinit
|
||||
CFLAGS += -I$(FX_GLIDE_HW)/glide3/src -I$(FX_GLIDE_HW)/incsrc -I$(FX_GLIDE_HW)/minihwc -I$(FX_GLIDE_HW)/cinit -I$(FX_GLIDE_HW)/init
|
||||
CFLAGS += -I$(FX_GLIDE_SW)/fxmisc -I$(FX_GLIDE_SW)/newpci/pcilib -I$(FX_GLIDE_SW)/fxmemmap
|
||||
CFLAGS += -I$(FX_GLIDE_SW)/texus2/lib
|
||||
CFLAGS += $(CDEFS)
|
||||
|
||||
ifeq ($(FX_GLIDE_HW),cvg)
|
||||
override USE_X86 = 1
|
||||
else
|
||||
ifeq ($(FX_GLIDE_HW),h3)
|
||||
override USE_MMX = 0
|
||||
override USE_SSE = 0
|
||||
override USE_SSE2 = 0
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(USE_3DNOW),1)
|
||||
CFLAGS += -DGL_AMD3D
|
||||
override USE_X86 = 1
|
||||
@@ -156,10 +189,14 @@ endif
|
||||
###############################################################################
|
||||
|
||||
GLIDE_OBJECTS = \
|
||||
$(FX_GLIDE_HW)/glide3/src/fifo.o \
|
||||
$(FX_GLIDE_HW)/glide3/src/distate.o \
|
||||
$(FX_GLIDE_HW)/glide3/src/gstrip.o \
|
||||
$(FX_GLIDE_HW)/glide3/src/distrip.o \
|
||||
$(FX_GLIDE_HW)/glide3/src/diget.o \
|
||||
$(FX_GLIDE_HW)/glide3/src/gsplash.o \
|
||||
$(FX_GLIDE_HW)/glide3/src/g3df.o \
|
||||
$(FX_GLIDE_HW)/glide3/src/gu.o \
|
||||
$(FX_GLIDE_HW)/glide3/src/gthread.o \
|
||||
$(FX_GLIDE_HW)/glide3/src/gpci.o \
|
||||
$(FX_GLIDE_HW)/glide3/src/diglide.o \
|
||||
$(FX_GLIDE_HW)/glide3/src/disst.o \
|
||||
@@ -169,15 +206,14 @@ GLIDE_OBJECTS = \
|
||||
$(FX_GLIDE_HW)/glide3/src/gaa.o \
|
||||
$(FX_GLIDE_HW)/glide3/src/gdraw.o \
|
||||
$(FX_GLIDE_HW)/glide3/src/gglide.o \
|
||||
$(FX_GLIDE_HW)/glide3/src/distate.o \
|
||||
$(FX_GLIDE_HW)/glide3/src/gstrip.o \
|
||||
$(FX_GLIDE_HW)/glide3/src/distrip.o \
|
||||
$(FX_GLIDE_HW)/glide3/src/diget.o \
|
||||
$(FX_GLIDE_HW)/glide3/src/glfb.o \
|
||||
$(FX_GLIDE_HW)/glide3/src/gsst.o \
|
||||
$(FX_GLIDE_HW)/glide3/src/gtex.o \
|
||||
$(FX_GLIDE_HW)/glide3/src/gtexdl.o \
|
||||
$(FX_GLIDE_HW)/glide3/src/fifo.o
|
||||
$(FX_GLIDE_HW)/glide3/src/cpuid.o \
|
||||
$(FX_GLIDE_SW)/newpci/pcilib/fxpci.o \
|
||||
$(FX_GLIDE_SW)/newpci/pcilib/fxdpmi2.o \
|
||||
$(FX_GLIDE_HW)/glide3/src/xtexdl_def.o
|
||||
|
||||
ifeq ($(USE_X86),1)
|
||||
GLIDE_OBJECTS += \
|
||||
@@ -207,18 +243,31 @@ GLIDE_OBJECTS += \
|
||||
$(FX_GLIDE_HW)/glide3/src/gxdraw.o
|
||||
endif
|
||||
|
||||
ifeq ($(FX_GLIDE_HW),cvg)
|
||||
GLIDE_OBJECTS += \
|
||||
$(FX_GLIDE_HW)/glide3/src/xtexdl_def.o
|
||||
|
||||
$(FX_GLIDE_HW)/glide3/src/digutex.o \
|
||||
$(FX_GLIDE_SW)/newpci/pcilib/fxmsr.o \
|
||||
$(FX_GLIDE_HW)/init/canopus.o \
|
||||
$(FX_GLIDE_HW)/init/dac.o \
|
||||
$(FX_GLIDE_HW)/init/gamma.o \
|
||||
$(FX_GLIDE_HW)/init/gdebug.o \
|
||||
$(FX_GLIDE_HW)/init/info.o \
|
||||
$(FX_GLIDE_HW)/init/parse.o \
|
||||
$(FX_GLIDE_HW)/init/print.o \
|
||||
$(FX_GLIDE_HW)/init/sli.o \
|
||||
$(FX_GLIDE_HW)/init/sst1init.o \
|
||||
$(FX_GLIDE_HW)/init/util.o \
|
||||
$(FX_GLIDE_HW)/init/video.o \
|
||||
$(FX_GLIDE_HW)/init/fxremap.o
|
||||
else
|
||||
GLIDE_OBJECTS += \
|
||||
$(FX_GLIDE_HW)/glide3/src/cpuid.o \
|
||||
$(FX_GLIDE_HW)/cinit/h3cinit.o \
|
||||
$(FX_GLIDE_SW)/newpci/pcilib/fxpci.o \
|
||||
$(FX_GLIDE_SW)/newpci/pcilib/fxdpmi2.o \
|
||||
$(FX_GLIDE_HW)/glide3/src/gthread.o \
|
||||
$(FX_GLIDE_HW)/minihwc/hwcio.o \
|
||||
$(FX_GLIDE_HW)/minihwc/gdebug.o \
|
||||
$(FX_GLIDE_HW)/minihwc/minihwc.o \
|
||||
$(FX_GLIDE_HW)/minihwc/dos_mode.o
|
||||
$(FX_GLIDE_HW)/minihwc/dos_mode.o \
|
||||
h5/cinit/h3cinit.o
|
||||
endif
|
||||
|
||||
TEXUS_SOURCES = \
|
||||
$(FX_GLIDE_SW)/texus2/lib/texuslib.c \
|
||||
@@ -288,6 +337,13 @@ endif
|
||||
# rules(2)
|
||||
###############################################################################
|
||||
|
||||
cvg/glide3/src/xtexdl_def.o: cvg/glide3/src/xtexdl.c
|
||||
$(CC) -o $@ $(CFLAGS) -c $<
|
||||
cvg/glide3/src/cpuid.o: cvg/glide3/src/cpudtect.asm
|
||||
$(AS) -o $@ $(ASFLAGS) $<
|
||||
h3/glide3/src/cpuid.o: h3/glide3/src/cpudtect.asm
|
||||
$(AS) -o $@ $(ASFLAGS) $<
|
||||
|
||||
$(FX_GLIDE_HW)/glide3/src/xdraw2_def.o: $(FX_GLIDE_HW)/glide3/src/xdraw2.asm
|
||||
$(AS) -o $@ $(ASFLAGS) $<
|
||||
$(FX_GLIDE_HW)/glide3/src/xdraw3_def.o: $(FX_GLIDE_HW)/glide3/src/xdraw3.asm
|
||||
@@ -307,8 +363,10 @@ $(FX_GLIDE_HW)/glide3/src/xdraw3_sse.o: $(FX_GLIDE_HW)/glide3/src/xdraw3.asm
|
||||
$(FX_GLIDE_HW)/glide3/src/xtexdl_sse2.o: $(FX_GLIDE_HW)/glide3/src/xtexdl.asm
|
||||
$(AS) -o $@ $(ASFLAGS) -DGL_SSE2=1 $<
|
||||
|
||||
ifeq ($(FX_GLIDE_HW),h5)
|
||||
GENDATE = $(FX_GLIDE_HW)/incsrc/gendate.h
|
||||
FXBLDNO = $(FX_GLIDE_HW)/glide3/src/fxbldno.h
|
||||
endif
|
||||
|
||||
$(GLIDE_OBJECTS): $(FX_GLIDE_HW)/glide3/src/fxinline.h $(FX_GLIDE_HW)/glide3/src/fxgasm.h $(FXBLDNO)
|
||||
|
||||
@@ -338,7 +396,8 @@ fxbldno.exe: $(FXBLDNO:.h=.c)
|
||||
###############################################################################
|
||||
|
||||
clean:
|
||||
-$(call UNLINK,$(FX_GLIDE_HW)/cinit/*.o)
|
||||
-$(call UNLINK,cvg/init/*.o)
|
||||
-$(call UNLINK,h5/cinit/*.o)
|
||||
-$(call UNLINK,$(FX_GLIDE_HW)/glide3/src/*.o)
|
||||
-$(call UNLINK,$(FX_GLIDE_HW)/minihwc/*.o)
|
||||
-$(call UNLINK,$(FX_GLIDE_SW)/newpci/pcilib/*.o)
|
||||
|
||||
@@ -19,6 +19,9 @@
|
||||
**
|
||||
** $Header$
|
||||
** $Log$
|
||||
** Revision 1.1.1.1.8.1 2003/11/03 13:34:29 dborca
|
||||
** Voodoo2 happiness (DJGPP & Linux)
|
||||
**
|
||||
** Revision 1.1.1.1 1999/12/07 21:42:34 joseph
|
||||
** Initial checkin into SourceForge.
|
||||
**
|
||||
@@ -199,7 +202,7 @@ GR_DDFUNC(_grTexDownloadNccTableExt,
|
||||
_GlideRoot.stats.palDownloads++;
|
||||
_GlideRoot.stats.palBytes += (end-start+1)<<2;
|
||||
|
||||
if (gc->tmu_state[tmu].ncc_table[which] != table) {
|
||||
/*if (gc->tmu_state[tmu].ncc_table[which] != table)*/ {
|
||||
SstRegs* texHW;
|
||||
int i;
|
||||
#ifdef GLIDE_POINTCAST_PALETTE
|
||||
@@ -488,7 +491,7 @@ GR_DDFUNC(_grTexDownloadNccTable,
|
||||
_GlideRoot.stats.palDownloads++;
|
||||
_GlideRoot.stats.palBytes += (end-start+1)<<2;
|
||||
|
||||
if (gc->tmu_state[tmu].ncc_table[which] != table) {
|
||||
/*if (gc->tmu_state[tmu].ncc_table[which] != table)*/ {
|
||||
SstRegs* texHW;
|
||||
int i;
|
||||
#ifdef GLIDE_POINTCAST_PALETTE
|
||||
|
||||
@@ -32,7 +32,7 @@ extrn _FifoMakeRoom
|
||||
|
||||
segment CONST
|
||||
ALIGN 8
|
||||
_F256_F256 DD 043800000h, 43800000h ; 256 | 256
|
||||
_F256_F256 DD 043800000h, 43800000h
|
||||
|
||||
segment DATA
|
||||
ALIGN 8
|
||||
|
||||
@@ -19,6 +19,9 @@
|
||||
;;
|
||||
;; $Header$
|
||||
;; $Log$
|
||||
;; Revision 1.1.1.1 1999/11/24 21:44:53 joseph
|
||||
;; Initial checkin for SourceForge
|
||||
;;
|
||||
;;
|
||||
;; 4 4/06/99 3:54p Dow
|
||||
;; Alt tab again.
|
||||
@@ -45,10 +48,7 @@
|
||||
;;
|
||||
;;
|
||||
|
||||
TITLE cpudtect.asm
|
||||
|
||||
.586P
|
||||
.model FLAT,C ; Flat memory, mangle publics with leading '_'
|
||||
%include "xos.inc"
|
||||
|
||||
;; Data for data segment goes here
|
||||
;_DATA SEGMENT DWORD USE32 PUBLIC 'DATA';
|
||||
@@ -56,14 +56,14 @@ TITLE cpudtect.asm
|
||||
|
||||
;;; Some useful constants
|
||||
; CPU Type
|
||||
CPUTypeUnknown = 0ffffffffh
|
||||
CPUTypePrePent = 4h
|
||||
CPUTypeP5 = 5h
|
||||
CPUTypeP6 = 6h
|
||||
CPUTypeUnknown equ 0ffffffffh
|
||||
CPUTypePrePent equ 4h
|
||||
CPUTypeP5 equ 5h
|
||||
CPUTypeP6 equ 6h
|
||||
|
||||
;;; References to external data:
|
||||
|
||||
_TEXT SEGMENT
|
||||
segment TEXT
|
||||
;;
|
||||
;; _cpu_detect_asm - detect the type of CPU
|
||||
;;
|
||||
@@ -73,10 +73,8 @@ _TEXT SEGMENT
|
||||
;;
|
||||
;; returns 4 for non-pen
|
||||
|
||||
PUBLIC _cpu_detect_asm
|
||||
_cpu_detect_asm PROC NEAR
|
||||
proc _cpu_detect_asm
|
||||
P6Stuff:
|
||||
.586
|
||||
push esi ; save registers that are not volatile
|
||||
push edi
|
||||
push ebx
|
||||
@@ -276,45 +274,38 @@ UnknownVendor:
|
||||
jmp DoneCpu
|
||||
|
||||
|
||||
_cpu_detect_asm ENDP
|
||||
endp
|
||||
|
||||
|
||||
;------------------------------------------------------------------------------
|
||||
; this routine sets the precision to single
|
||||
; which effects all adds, mults, and divs
|
||||
align 4 ;
|
||||
PUBLIC single_precision_asm
|
||||
single_precision_asm PROC NEAR
|
||||
.586
|
||||
proc single_precision_asm
|
||||
push eax ; make room
|
||||
fnclex ; clear pending exceptions
|
||||
fstcw WORD PTR [esp]
|
||||
mov eax, DWORD PTR [esp]
|
||||
fstcw WORD [esp]
|
||||
mov eax, DWORD [esp]
|
||||
and eax, 0000fcffh ; clear bits 9:8
|
||||
mov DWORD PTR [esp], eax
|
||||
fldcw WORD PTR [esp]
|
||||
mov DWORD [esp], eax
|
||||
fldcw WORD [esp]
|
||||
pop eax
|
||||
ret 0
|
||||
single_precision_asm ENDP
|
||||
ret
|
||||
endp
|
||||
|
||||
;------------------------------------------------------------------------------
|
||||
; this routine sets the precision to double
|
||||
; which effects all adds, mults, and divs
|
||||
align 4 ;
|
||||
PUBLIC double_precision_asm
|
||||
double_precision_asm PROC NEAR
|
||||
.586
|
||||
proc double_precision_asm
|
||||
push eax ; make room
|
||||
fnclex ; clear pending exceptions
|
||||
fstcw WORD PTR [esp]
|
||||
mov eax, DWORD PTR [esp]
|
||||
fstcw WORD [esp]
|
||||
mov eax, DWORD [esp]
|
||||
and eax, 0000fcffh ; clear bits 9:8
|
||||
or eax, 000002ffh ; set 9:8 to 10
|
||||
mov DWORD PTR [esp], eax
|
||||
fldcw WORD PTR [esp]
|
||||
mov DWORD [esp], eax
|
||||
fldcw WORD [esp]
|
||||
pop eax
|
||||
ret 0
|
||||
double_precision_asm ENDP
|
||||
|
||||
_TEXT ENDS
|
||||
END
|
||||
ret
|
||||
endp
|
||||
|
||||
@@ -19,6 +19,9 @@
|
||||
**
|
||||
** $Header$
|
||||
** $Log$
|
||||
** Revision 1.1.1.1 1999/11/24 21:44:54 joseph
|
||||
** Initial checkin for SourceForge
|
||||
**
|
||||
**
|
||||
** 5 5/24/99 2:48p Jamesb
|
||||
** Added ptrLostContext to exported cmdTransport struct.
|
||||
@@ -686,6 +689,32 @@ GR_DIENTRY(grGetString, const char *, (FxU32 pname))
|
||||
#undef FN_NAME
|
||||
} /* grGetString */
|
||||
|
||||
/*-------------------------------------------------------------------
|
||||
Function: grGetRegistryOrEnvironmentStringExt
|
||||
Date: 4/17/2000
|
||||
Implementor(s): atom
|
||||
Description:
|
||||
|
||||
This is here so the spooky code for finding the correct registry
|
||||
tweak path in 9x/NT/2K does not have to be duplicated in 3dfxogl.
|
||||
|
||||
Arguments: char* to the name of the setting to check for.
|
||||
|
||||
Return: char* to the requested entry either from the registry
|
||||
or the environment settings. NULL on error.
|
||||
-------------------------------------------------------------------*/
|
||||
GR_EXT_ENTRY(grGetRegistryOrEnvironmentString, char*, (char* theEntry))
|
||||
{
|
||||
#define FN_NAME "grGetRegistryOrEnvironmentString"
|
||||
char* retval ;
|
||||
|
||||
retval = getenv(theEntry) ;
|
||||
|
||||
return retval ;
|
||||
|
||||
#undef FN_NAME
|
||||
} /* grGetRegistryOrEnvironmentString */
|
||||
|
||||
/*-------------------------------------------------------------------
|
||||
Function: grReset
|
||||
Date: 16-Dec-97
|
||||
@@ -790,6 +819,7 @@ typedef struct {
|
||||
} GrExtensionTuple;
|
||||
|
||||
static GrExtensionTuple _extensionTable[] = {
|
||||
{ "grGetRegistryOrEnvironmentStringExt", (GrProc)grGetRegistryOrEnvironmentString },
|
||||
{ "grChromaRangeModeExt", (GrProc)grChromaRangeMode },
|
||||
{ "grChromaRangeExt", (GrProc)grChromaRange },
|
||||
{ "grTexChromaModeExt", (GrProc)grTexChromaMode },
|
||||
@@ -805,6 +835,8 @@ static GrExtensionTuple _extensionTable[] = {
|
||||
#endif /* (GLIDE_PLATFORM & GLIDE_OS_WIN32) */
|
||||
{ "grCommandTransportInfoExt2", (GrProc)_grCommandTransportInfo },
|
||||
{ "grCommandTransportMakeRoomExt2", (GrProc)_grCommandTransportMakeRoom },
|
||||
/* POINTCAST */
|
||||
{ "grTexDownloadTableExt", (GrProc)grTexDownloadTableExt },
|
||||
{ 0, 0 }
|
||||
};
|
||||
|
||||
|
||||
@@ -19,6 +19,9 @@
|
||||
**
|
||||
** $Header$
|
||||
** $Log$
|
||||
** Revision 1.2.4.1 2003/06/29 18:45:55 guillemj
|
||||
** Fixed preprocessor invalid token errors.
|
||||
**
|
||||
** Revision 1.2 2000/11/24 18:36:48 alanh
|
||||
** Add new grStippleMode and grStipplePattern functions for both Voodoo3 and
|
||||
** Voodoo5 hardware.
|
||||
@@ -553,7 +556,6 @@ GR_DIENTRY(grDepthBufferMode, void , (GrDepthBufferMode_t mode) )
|
||||
|
||||
Return:
|
||||
-------------------------------------------------------------------*/
|
||||
#ifdef __linux__
|
||||
GR_EXT_ENTRY(grStipplePattern, void , (GrStipplePattern_t stipple))
|
||||
{
|
||||
#define FN_NAME "grStipplePattern"
|
||||
@@ -566,7 +568,6 @@ GR_EXT_ENTRY(grStipplePattern, void , (GrStipplePattern_t stipple))
|
||||
|
||||
#undef FN_NAME
|
||||
} /* grStipplePattern */
|
||||
#endif /* __linux__ */
|
||||
|
||||
/*-------------------------------------------------------------------
|
||||
Function: grStippleMode
|
||||
@@ -578,7 +579,6 @@ GR_EXT_ENTRY(grStipplePattern, void , (GrStipplePattern_t stipple))
|
||||
|
||||
Return:
|
||||
-------------------------------------------------------------------*/
|
||||
#ifdef __linux__
|
||||
GR_DIENTRY(grStippleMode, void , (GrStippleMode_t mode) )
|
||||
{
|
||||
#define FN_NAME "grStippleMode"
|
||||
@@ -591,7 +591,6 @@ GR_DIENTRY(grStippleMode, void , (GrStippleMode_t mode) )
|
||||
|
||||
#undef FN_NAME
|
||||
} /* grStippleMode */
|
||||
#endif /* __linux__ */
|
||||
|
||||
/*-------------------------------------------------------------------
|
||||
Function: grDitherMode
|
||||
@@ -952,9 +951,7 @@ _grValidateState()
|
||||
_grDepthBufferFunction(LOADARG(grDepthBufferFunction, fnc));
|
||||
_grDepthBufferMode(LOADARG(grDepthBufferMode, mode));
|
||||
_grDitherMode(LOADARG(grDitherMode, mode));
|
||||
#ifdef __linux__
|
||||
_grStippleMode(LOADARG(grStippleMode, mode));
|
||||
#endif /* __linux__ */
|
||||
_grSstOrigin(LOADARG(grSstOrigin, origin));
|
||||
_grRenderBuffer(LOADARG(grRenderBuffer, buffer));
|
||||
|
||||
@@ -1013,7 +1010,6 @@ _grValidateState()
|
||||
reg_cnt++;
|
||||
}
|
||||
|
||||
#ifdef __linux__
|
||||
if (NOTVALID(stipple)) {
|
||||
gc->state.shadow.stipple = LOADARG(grStipplePattern, stipple);
|
||||
REG_GROUP_BEGIN(BROADCAST_ID, stipple, 1, 0x01);
|
||||
@@ -1022,7 +1018,6 @@ _grValidateState()
|
||||
}
|
||||
REG_GROUP_END();
|
||||
}
|
||||
#endif /* __linux__ */
|
||||
|
||||
if (NOTVALID(lfbMode)) {
|
||||
FxU32
|
||||
@@ -1392,7 +1387,7 @@ GR_DIENTRY(grViewport, void , (FxI32 x, FxI32 y, FxI32 width, FxI32 height) )
|
||||
#undef FN_NAME
|
||||
} /* grViewport */
|
||||
|
||||
#ifdef __linux__
|
||||
#if DRI_BUILD
|
||||
void
|
||||
_grInvalidateAll()
|
||||
{
|
||||
|
||||
@@ -19,6 +19,9 @@
|
||||
**
|
||||
** $Header$
|
||||
** $Log$
|
||||
** Revision 1.1.1.1 1999/11/24 21:44:54 joseph
|
||||
** Initial checkin for SourceForge
|
||||
**
|
||||
**
|
||||
** 6 6/10/99 12:17p Stb_mmcclure
|
||||
** Cleaned up comments made in grTexMinAddress
|
||||
@@ -555,7 +558,7 @@ GR_DIENTRY(grTexMinAddress, FxU32, ( GrChipID_t tmu ))
|
||||
|
||||
FXUNUSED(hw);
|
||||
|
||||
#ifndef __linux__
|
||||
#if GLIDE_CHECK_CONTEXT
|
||||
if (!gc->lostContext)
|
||||
return 0;
|
||||
|
||||
|
||||
@@ -19,6 +19,9 @@
|
||||
**
|
||||
** $Header$
|
||||
** $Log$
|
||||
** Revision 1.1.1.1.6.1 2003/05/05 07:12:46 dborca
|
||||
** no message
|
||||
**
|
||||
** Revision 1.1.1.1 1999/11/24 21:44:55 joseph
|
||||
** Initial checkin for SourceForge
|
||||
**
|
||||
@@ -827,7 +830,7 @@ _grCommandTransportMakeRoom(const FxI32 blockSize, const char* fName, const int
|
||||
* we wrap check the current hw fifo pointer which is going to be the
|
||||
* 2d driver's fifo if we lost our context.
|
||||
*/
|
||||
#if defined(GLIDE_INIT_HWC) && !defined(__linux__)
|
||||
#if defined(GLIDE_INIT_HWC) && GLIDE_CHECK_CONTEXT
|
||||
gc->contextP = hwcQueryContext(gc->bInfo);
|
||||
#else
|
||||
gc->contextP = 1;
|
||||
@@ -1171,7 +1174,7 @@ _reg_group_begin_internal_wax( FxU32 __regBase,
|
||||
#endif /* GLIDE_DEBUG */
|
||||
#endif /* USE_PACKET_FIFO */
|
||||
|
||||
#ifdef __linux__
|
||||
#if DRI_BUILD
|
||||
void
|
||||
_grImportFifo(int fifoPtr, int fifoRead) {
|
||||
struct cmdTransportInfo* gcFifo;
|
||||
|
||||
@@ -37,7 +37,29 @@
|
||||
* macros for creating assembler offset files
|
||||
*----------------------------------------------------------------------*/
|
||||
|
||||
#if !defined(__linux__) && !defined(__FreeBSD__) && !defined(__DJGPP__) /* [dBorca] */
|
||||
#if 1 /* defined(NASM) - default */
|
||||
#define NEWLINE printf("\n")
|
||||
#define COMMENT printf(";----------------------------------------------------------------------\n")
|
||||
|
||||
#define HEADER(str) NEWLINE; COMMENT; \
|
||||
printf("; Assembler offsets for %s struct\n",str);\
|
||||
COMMENT; NEWLINE
|
||||
|
||||
#define OFFSET(p,o,pname) if (hex) \
|
||||
printf("%s\tequ %08xh\n",pname,((int)&p.o)-(int)&p); \
|
||||
else printf("%s\tequ %10d\n",pname,((int)&p.o)-(int)&p)
|
||||
|
||||
#define OFFSET2(p,o,pname) if (hex) \
|
||||
printf("%s\tequ %08xh\n",pname,((int)&o)-(int)&p); \
|
||||
else printf("%s\tequ %10d\n",pname,((int)&o)-(int)&p)
|
||||
|
||||
#define SIZEOF(p,pname) if (hex) \
|
||||
printf("SIZEOF_%s\tequ %08lxh\n",pname,sizeof(p)); \
|
||||
else printf("SIZEOF_%s\tequ %10ld\n",pname,sizeof(p))
|
||||
|
||||
#else /* !NASM */
|
||||
|
||||
#if !defined(__linux__) && !defined(__FreeBSD__) && !defined(__DJGPP__)
|
||||
#define NEWLINE printf("\n")
|
||||
#define COMMENT printf(";----------------------------------------------------------------------\n")
|
||||
|
||||
@@ -79,6 +101,8 @@
|
||||
else printf("#define SIZEOF_%s %10ld\n",pname,sizeof(p))
|
||||
#endif
|
||||
|
||||
#endif /* defined(NASM)*/
|
||||
|
||||
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
@@ -136,6 +160,9 @@ main (int argc, char **argv)
|
||||
OFFSET (gc,state.cull_mode,"cull_mode\t");
|
||||
#ifndef GLIDE3
|
||||
OFFSET (gc, regDataList,"regDataList\t");
|
||||
#endif
|
||||
#ifdef GLIDE_DEBUG
|
||||
OFFSET (gc,checkPtr,"checkPtr\t\t");
|
||||
#endif
|
||||
OFFSET (gc, tsuDataList,"tsuDataList\t");
|
||||
OFFSET (gc, cmdTransportInfo.triPacketHdr, "triPacketHdr");
|
||||
|
||||
@@ -19,6 +19,9 @@
|
||||
**
|
||||
** $Header$
|
||||
** $Log$
|
||||
** Revision 1.2.4.3 2003/07/25 07:13:41 dborca
|
||||
** removed debris
|
||||
**
|
||||
** Revision 1.2.4.2 2003/06/29 18:45:55 guillemj
|
||||
** Fixed preprocessor invalid token errors.
|
||||
**
|
||||
@@ -779,14 +782,12 @@ typedef struct {
|
||||
struct {
|
||||
GrDitherMode_t mode;
|
||||
} grDitherModeArgs;
|
||||
#ifdef __linux__
|
||||
struct {
|
||||
GrStippleMode_t mode;
|
||||
} grStippleModeArgs;
|
||||
struct {
|
||||
GrStipplePattern_t stipple;
|
||||
} grStipplePatternArgs;
|
||||
#endif /* __linux__ */
|
||||
struct {
|
||||
GrBuffer_t buffer;
|
||||
} grRenderBufferArgs;
|
||||
@@ -835,11 +836,7 @@ typedef struct {
|
||||
*/
|
||||
#define GR_MEMTYPE GR_GET_RESERVED_1
|
||||
|
||||
#if !defined(__linux__) && (!defined(__DJGPP__) || defined(GLIDE_USE_C_TRISETUP)) /* [dBorca] */
|
||||
#define TRISETUPARGS const void *a, const void *b, const void *c
|
||||
#else
|
||||
#define TRISETUPARGS const void *g, const void *a, const void *b, const void *c
|
||||
#endif
|
||||
|
||||
/* gpci.c
|
||||
*
|
||||
@@ -1244,11 +1241,8 @@ typedef struct GrGC_s
|
||||
windowedState;
|
||||
#endif /* GLIDE_INIT_HWC */
|
||||
} cmdTransportInfo;
|
||||
#if !defined(__linux__) && (!defined(__DJGPP__) || defined(GLIDE_USE_C_TRISETUP)) /* [dBorca] */
|
||||
|
||||
FxI32 (FX_CALL *triSetupProc)(const void *a, const void *b, const void *c);
|
||||
#else
|
||||
FxI32 (FX_CALL *triSetupProc)(const void *gc, const void *a, const void *b, const void *c);
|
||||
#endif
|
||||
|
||||
SstIORegs
|
||||
*ioRegs; /* I/O remap regs */
|
||||
@@ -1626,9 +1620,11 @@ _trisetup_noclip_valid(TRISETUPARGS);
|
||||
|
||||
#else
|
||||
|
||||
#if defined( __linux__ ) || (defined(__DJGPP__) && !defined(GLIDE_USE_C_TRISETUP)) /* [dBorca] */
|
||||
#if defined( __linux__ ) || defined(__DJGPP__) /* [dBorca] */
|
||||
|
||||
#define TRISETUP(a, b, c) (gc->triSetupProc)(gc, a, b, c)
|
||||
#define TRISETUP \
|
||||
__asm(""::"d"(gc)); \
|
||||
(*gc->triSetupProc)
|
||||
|
||||
#else
|
||||
#define TRISETUP \
|
||||
@@ -1670,11 +1666,9 @@ _grColorCombine(
|
||||
FxBool invert );
|
||||
|
||||
|
||||
#ifdef __linux__
|
||||
void FX_CALL
|
||||
grStipplePattern(
|
||||
GrStipplePattern_t stipple);
|
||||
#endif /* __linux__ */
|
||||
|
||||
void FX_CALL
|
||||
grChromaRangeMode(GrChromaRangeMode_t mode);
|
||||
@@ -1718,10 +1712,8 @@ _grDepthBufferMode( GrDepthBufferMode_t mode );
|
||||
void
|
||||
_grDitherMode( GrDitherMode_t mode );
|
||||
|
||||
#ifdef __linux__
|
||||
void
|
||||
_grStippleMode( GrStippleMode_t mode );
|
||||
#endif /* __linux__ */
|
||||
|
||||
void
|
||||
_grRenderBuffer( GrBuffer_t buffer );
|
||||
@@ -2281,5 +2273,8 @@ extern const FxU32 _gr_aspect_xlate_table[];
|
||||
#define HEIGHT_BY_ASPECT_LOD(__aspect, __lod) \
|
||||
_grMipMapHostWH[G3_ASPECT_TRANSLATE(__aspect)][G3_LOD_TRANSLATE(__lod)][1]
|
||||
|
||||
#endif /* __FXGLIDE_H__ */
|
||||
GR_EXT_ENTRY(grTexDownloadTableExt,
|
||||
void,
|
||||
(GrChipID_t tmu, GrTexTable_t type, void *data));
|
||||
|
||||
#endif /* __FXGLIDE_H__ */
|
||||
|
||||
@@ -19,6 +19,10 @@
|
||||
**
|
||||
** $Header$
|
||||
** $Log$
|
||||
** Revision 1.5 2000/11/24 18:36:48 alanh
|
||||
** Add new grStippleMode and grStipplePattern functions for both Voodoo3 and
|
||||
** Voodoo5 hardware.
|
||||
**
|
||||
** Revision 1.4 2000/11/16 20:25:38 alanh
|
||||
** fix a typo
|
||||
**
|
||||
@@ -438,7 +442,7 @@
|
||||
#include "fxcmd.h"
|
||||
#include "fxinline.h"
|
||||
|
||||
#ifdef __linux__
|
||||
#if DRI_BUILD
|
||||
#include <lindri.h>
|
||||
#endif
|
||||
|
||||
@@ -907,7 +911,7 @@ GR_ENTRY(grBufferClear, void, (GrColor_t color, GrAlpha_t alpha, FxU32 depth))
|
||||
|
||||
REG_GROUP_BEGIN(BROADCAST_ID, colBufferAddr, 2, 0x3);
|
||||
REG_GROUP_SET(hw, colBufferAddr,gc->buffers[gc->grColBuf]);
|
||||
#ifdef __linux__
|
||||
#if DRI_BUILD
|
||||
REG_GROUP_SET(hw, colBufferStride, (!gc->curBuffer)? driInfo.stride :
|
||||
gc->state.shadow.auxBufferStride);
|
||||
#else
|
||||
@@ -941,7 +945,7 @@ GR_ENTRY(grBufferClear, void, (GrColor_t color, GrAlpha_t alpha, FxU32 depth))
|
||||
REG_GROUP_BEGIN(BROADCAST_ID, colBufferAddr, 2, 0x3);
|
||||
REG_GROUP_SET(hw, colBufferAddr, gc->buffers[gc->windowed ? 0 : gc->curBuffer]);
|
||||
|
||||
#ifdef __linux__
|
||||
#if DRI_BUILD
|
||||
REG_GROUP_SET(hw, colBufferStride, (!gc->curBuffer) ? driInfo.stride :
|
||||
gc->state.shadow.colBufferStride);
|
||||
#else
|
||||
@@ -1032,7 +1036,7 @@ GR_ENTRY(grBufferClear, void, (GrColor_t color, GrAlpha_t alpha, FxU32 depth))
|
||||
} /* grBufferClear */
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
#if !DRI_BUILD
|
||||
/*---------------------------------------------------------------------------
|
||||
** grBufferSwap
|
||||
**
|
||||
@@ -1913,7 +1917,6 @@ GR_ENTRY(grDisableAllEffects, void, (void))
|
||||
** grStippleMode
|
||||
*/
|
||||
|
||||
#ifdef __linux__
|
||||
GR_STATE_ENTRY(grStippleMode, void, (GrStippleMode_t mode))
|
||||
{
|
||||
#define FN_NAME "_grStippleMode"
|
||||
@@ -1947,7 +1950,6 @@ GR_STATE_ENTRY(grStippleMode, void, (GrStippleMode_t mode))
|
||||
#endif /* !GLIDE3 */
|
||||
#undef FN_NAME
|
||||
} /* grStippleMode */
|
||||
#endif /* __linux__ */
|
||||
|
||||
/*---------------------------------------------------------------------------
|
||||
** grDitherMode
|
||||
@@ -2315,7 +2317,7 @@ GR_ENTRY(grGlideSetState, void, (const void *state))
|
||||
** and the only drawbuffer modes supported by the fbzMode register are 0
|
||||
** (back) and 1 (front)
|
||||
*/
|
||||
#ifndef __linux__
|
||||
#if !DRI_BUILD
|
||||
GR_STATE_ENTRY(grRenderBuffer, void, (GrBuffer_t buffer))
|
||||
{
|
||||
#define FN_NAME "_grRenderBuffer"
|
||||
@@ -2342,7 +2344,7 @@ GR_STATE_ENTRY(grRenderBuffer, void, (GrBuffer_t buffer))
|
||||
GR_END();
|
||||
#undef FN_NAME
|
||||
} /* grRenderBuffer */
|
||||
#else /* __linux__ */
|
||||
#else /* DRI_BUILD */
|
||||
GR_STATE_ENTRY(grRenderBuffer, void, (GrBuffer_t buffer))
|
||||
{
|
||||
#define FN_NAME "_grRenderBuffer"
|
||||
File diff suppressed because it is too large
Load Diff
@@ -19,6 +19,9 @@
|
||||
**
|
||||
** $Header$
|
||||
** $Log$
|
||||
** Revision 1.1.1.1 1999/11/24 21:45:02 joseph
|
||||
** Initial checkin for SourceForge
|
||||
**
|
||||
**
|
||||
** 4 4/06/99 3:54p Dow
|
||||
** Alt tab again.
|
||||
@@ -211,7 +214,7 @@
|
||||
#include "fxglide.h"
|
||||
#include "fxcmd.h"
|
||||
|
||||
#ifdef __linux__
|
||||
#if DRI_BUILD
|
||||
#include <lindri.h>
|
||||
#endif
|
||||
|
||||
@@ -450,7 +453,7 @@ GR_ENTRY(grLfbLock, FxBool,(GrLock_t type, GrBuffer_t buffer,
|
||||
}
|
||||
|
||||
if (rv) {
|
||||
#ifdef __linux__
|
||||
#if DRI_BUILD
|
||||
if (!colBufferIndex)
|
||||
info->strideInBytes = driInfo.stride;
|
||||
else
|
||||
@@ -481,7 +484,7 @@ GR_ENTRY(grLfbLock, FxBool,(GrLock_t type, GrBuffer_t buffer,
|
||||
GR_CHECK_SIZE();
|
||||
|
||||
info->lfbPtr = (void *)gc->lfb_ptr;
|
||||
#ifdef __linux__
|
||||
#if DRI_BUILD
|
||||
info->strideInBytes = 0x1000;
|
||||
#endif
|
||||
|
||||
@@ -1,952 +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
|
||||
**
|
||||
** $Header$
|
||||
** $Log$
|
||||
**
|
||||
** 4 4/06/99 3:54p Dow
|
||||
** Alt tab again.
|
||||
**
|
||||
** 25 4/04/99 8:51p Atai
|
||||
** Partial check-in for alt-tab issue. set FX_GLIDE_ALT_TAB=1 to build
|
||||
** glide3x with hwcQueryContext built into GR_BEGIN_NOFIFOCHECK. It works
|
||||
** with DEBUG glide only. In the non-debug glide, we can still see the
|
||||
** desktop corruption.
|
||||
**
|
||||
** 24 3/24/99 6:17p Peter
|
||||
** streamlined (made more dangerouse) state validation
|
||||
**
|
||||
** 23 3/10/99 6:47p Peter
|
||||
** need to bump-n-grind in lfb lock too, fixed nested lock error condition
|
||||
**
|
||||
** 22 3/08/99 4:28p Mikec
|
||||
** Made sure when we return raw lfb ptr in a write lock (pix pipe is off),
|
||||
** the origin is not lower left.
|
||||
**
|
||||
** 21 1/25/99 6:33p Peter
|
||||
** removed some cruft I saw when cleaning up tiled textures
|
||||
**
|
||||
** 20 9/10/98 12:40p Mikec
|
||||
** Changed grLfbLock to be in sync with glide2x.
|
||||
**
|
||||
** 19 9/08/98 7:19p Atai
|
||||
** fix debug info. added underline for internal routines and some \n
|
||||
**
|
||||
** 18 9/01/98 9:59a Dow
|
||||
** Fixed stride bug for 32-bit formats.
|
||||
**
|
||||
** 17 8/29/98 12:14p Mikec
|
||||
** Changed grLfbLock to return the current buffer lfbptr (read ptr) if it
|
||||
** is writeOnly and 565 and not pixelpipe.
|
||||
**
|
||||
** 15 8/11/98 7:22p Atai
|
||||
** fix grLfbLock read only
|
||||
**
|
||||
** 14 7/18/98 1:45p Jdt
|
||||
** Removed TACO_MEMORY_FIFO_HACK
|
||||
**
|
||||
** 13 7/18/98 12:28a Jdt
|
||||
** Changes to reflect new shadow register structure.
|
||||
**
|
||||
** 12 7/16/98 8:18a Jdt
|
||||
** fxcmd.h
|
||||
**
|
||||
** 11 7/01/98 12:41p Jdt
|
||||
** Moved some code around to do proper flushing for lfb
|
||||
** accesses
|
||||
** Protected hacks for Glide/Win ( FX_TACO_MEMORY_FIFO_HACK )
|
||||
** Moved towards fixing lfb read on Banshee
|
||||
**
|
||||
** 10 6/10/98 11:58a Peter
|
||||
** lfb tiled addressing
|
||||
**
|
||||
** 9 4/30/98 5:01p Peter
|
||||
** first pass glide3 merge
|
||||
**
|
||||
** 7 4/22/98 4:57p Peter
|
||||
** glide2x merge
|
||||
**
|
||||
** 6 4/21/98 1:34p Atai
|
||||
** make 32 bit clean
|
||||
**
|
||||
** 5 2/01/98 7:52p Peter
|
||||
** grLfbWriteRegion byte count problems
|
||||
**
|
||||
** 4 1/28/98 2:20p Atai
|
||||
** fixed lfb state validation
|
||||
**
|
||||
** 3 1/22/98 10:35a Atai
|
||||
** 1. introduce GLIDE_VERSION, g3\glide.h, g3\glideutl.h, g2\glide.h,
|
||||
** g2\glideutl.h
|
||||
** 2. fixed grChromaRange, grSstOrigin, and grGetProcAddress
|
||||
*
|
||||
* 2 1/16/98 6:44p Atai
|
||||
* fixed for glide 3 build
|
||||
*
|
||||
* 1 1/16/98 4:29p Atai
|
||||
* create glide 3 src
|
||||
*
|
||||
* 58 1/16/98 4:18p Atai
|
||||
* fixed lfb and grLoadGammaTable
|
||||
*
|
||||
* 57 1/06/98 3:53p Atai
|
||||
* remove grHint, modify grLfbWriteRegion and grGet
|
||||
*
|
||||
* 56 12/17/97 4:45p Peter
|
||||
* groundwork for CrybabyGlide
|
||||
*
|
||||
* 55 12/15/97 6:04p Atai
|
||||
* disable obsolete glide2 api for glide3
|
||||
*
|
||||
* 54 12/15/97 5:54p Peter
|
||||
* swizzle reads too
|
||||
*
|
||||
* 53 12/11/97 4:15p Peter
|
||||
* mac lfb write region
|
||||
*
|
||||
* 52 12/01/97 5:18p Peter
|
||||
*
|
||||
* 51 11/25/97 12:09p Peter
|
||||
* nested calls to grLfbLock vs init code locking on v2
|
||||
*
|
||||
* 50 11/18/97 4:36p Peter
|
||||
* chipfield stuff cleanup and w/ direct writes
|
||||
*
|
||||
* 49 11/17/97 4:55p Peter
|
||||
* watcom warnings/chipfield stuff
|
||||
*
|
||||
* 48 11/06/97 3:38p Dow
|
||||
* More banshee stuff
|
||||
*
|
||||
* 47 11/04/97 5:04p Peter
|
||||
* cataclysm part deux
|
||||
*
|
||||
* 46 11/03/97 3:43p Peter
|
||||
* h3/cvg cataclysm
|
||||
*
|
||||
* 45 10/27/97 11:10a Peter
|
||||
* starting cleanup
|
||||
*
|
||||
* 44 10/09/97 8:02p Dow
|
||||
* State Monster 1st Cut
|
||||
*
|
||||
* 43 10/08/97 5:18p Peter
|
||||
* fixed grLfbLock wrt writemode_any
|
||||
*
|
||||
* 42 10/08/97 11:33a Peter
|
||||
* hmmmm....
|
||||
*
|
||||
* 41 9/30/97 1:03p Peter
|
||||
* more debugging code
|
||||
*
|
||||
* 40 9/25/97 1:35p Peter
|
||||
*
|
||||
* 39 9/24/97 4:09p Peter
|
||||
* lfb/idle fixes
|
||||
*
|
||||
* 38 9/24/97 1:31p Peter
|
||||
* assert if grXX call inside lock/unlock
|
||||
*
|
||||
* 37 9/20/97 10:54a Peter
|
||||
* naked lfb writes
|
||||
*
|
||||
* 36 9/15/97 7:31p Peter
|
||||
* more cmdfifo cleanup, fixed normal buffer clear, banner in the right
|
||||
* place, lfb's are on, Hmmmm.. probably more
|
||||
*
|
||||
* 35 9/10/97 10:13p Peter
|
||||
* fifo logic from GaryT, non-normalized fp first cut
|
||||
*
|
||||
* 34 9/05/97 5:29p Peter
|
||||
* changes for direct hw
|
||||
*
|
||||
* 33 9/04/97 3:32p Peter
|
||||
* starting grouping serial reg writes
|
||||
*
|
||||
* 32 8/18/97 3:52p Peter
|
||||
* pre-hw arrival fixes/cleanup
|
||||
*
|
||||
* 31 7/30/97 2:42p Peter
|
||||
* more cleanup
|
||||
*
|
||||
* 30 7/28/97 2:41p Peter
|
||||
* turned sli code back on for cvg, but waiting for hal
|
||||
*
|
||||
* 29 7/26/97 3:04p Peter
|
||||
* gratuitous plug is translucent
|
||||
*
|
||||
* 28 7/02/97 12:28p Peter
|
||||
* removed spurious NOP, tex dl
|
||||
*
|
||||
* 27 6/26/97 10:14a Peter
|
||||
* cmd fifo for lfb
|
||||
*
|
||||
* 26 6/06/97 10:47a Peter
|
||||
* texture downloading, fixed 640x480 dimension, changed cvg dep to be the
|
||||
* same as sst1
|
||||
*
|
||||
**
|
||||
*/
|
||||
#include <3dfx.h>
|
||||
#define FX_DLL_DEFINITION
|
||||
#include <fxdll.h>
|
||||
#include <glide.h>
|
||||
|
||||
#include "fxglide.h"
|
||||
#include "fxcmd.h"
|
||||
|
||||
/*---------------------------------------------------------------------------
|
||||
** grLfbConstantAlpha
|
||||
*/
|
||||
GR_ENTRY(grLfbConstantAlpha, void, (GrAlpha_t alpha))
|
||||
{
|
||||
GR_BEGIN_NOFIFOCHECK("grLfbConstantAlpha",82);
|
||||
GDBG_INFO_MORE(gc->myLevel,"(0x%x)\n",alpha);
|
||||
|
||||
gc->state.lfb_constant_alpha = alpha;
|
||||
GR_END();
|
||||
} /* grLfbConstantAlpha */
|
||||
|
||||
/*---------------------------------------------------------------------------
|
||||
** grLfbConstantDepth
|
||||
*/
|
||||
GR_ENTRY(grLfbConstantDepth, void, (FxU32 depth))
|
||||
{
|
||||
GR_BEGIN_NOFIFOCHECK("grLfbConstantDepth",82);
|
||||
GDBG_INFO_MORE(gc->myLevel,"(0x%x)\n",depth);
|
||||
|
||||
gc->state.lfb_constant_depth = depth;
|
||||
GR_END();
|
||||
} /* grLfbConstantDepth */
|
||||
|
||||
/*-------------------------------------------------------------------
|
||||
Function: grLfbLock
|
||||
Date: 2/19
|
||||
Implementor(s): jdt
|
||||
Library: Glide
|
||||
Description:
|
||||
Secures a pointer to a requested frame buffer and guarantees ordered
|
||||
access to that buffer.
|
||||
|
||||
Arguments:
|
||||
type - type of lock, one of:
|
||||
GR_LOCK_WRITE_ONLY
|
||||
GR_LOCK_READ_ONLY
|
||||
buffer - which buffer to lock, one of:
|
||||
GR_BUFFER_FRONTBUFFER
|
||||
GR_BUFFER_BACKBUFFER
|
||||
GR_BUFFER_AUXBUFFER
|
||||
writeMode - desired destination color format
|
||||
origin - desired lfb origin
|
||||
pixelPipeline - flag whether to process through pixpipe
|
||||
info - pointer to info structure
|
||||
Return:
|
||||
FXTRUE - lock is successful
|
||||
FXFALSE - lock fails
|
||||
-------------------------------------------------------------------*/
|
||||
|
||||
GR_ENTRY(grLfbLock, FxBool,(GrLock_t type, GrBuffer_t buffer,
|
||||
GrLfbWriteMode_t writeMode, GrOriginLocation_t origin,
|
||||
FxBool pixelPipeline, GrLfbInfo_t *info))
|
||||
{
|
||||
#define FN_NAME "grLfbLock"
|
||||
FxBool
|
||||
rv = FXTRUE;
|
||||
const FxBool
|
||||
idleLockP = ((type & GR_LFB_NOIDLE) == 0);
|
||||
FxU32
|
||||
lfbMode,
|
||||
zaColor,
|
||||
fbzMode;
|
||||
|
||||
GR_BEGIN_NOFIFOCHECK_RET("grLfbLock", 82);
|
||||
GDBG_INFO_MORE(gc->myLevel,"(%d,%d,0x%x)\n", type, buffer, info);
|
||||
|
||||
GR_CHECK_COMPATABILITY(FN_NAME, !info,
|
||||
"Null info structure passed.");
|
||||
/* there is only one revision extant */
|
||||
GR_CHECK_COMPATABILITY(FN_NAME, info->size != sizeof(GrLfbInfo_t),
|
||||
"uninitialized info structure passed.");
|
||||
|
||||
type = type & ~(GR_LFB_NOIDLE);
|
||||
#if defined(GLIDE3)
|
||||
_grValidateState();
|
||||
#endif
|
||||
|
||||
/* Load now flushed state */
|
||||
lfbMode = gc->state.shadow.lfbMode;
|
||||
fbzMode = gc->state.shadow.fbzMode;
|
||||
zaColor = gc->state.shadow.zaColor;
|
||||
|
||||
type = type & ~(GR_LFB_NOIDLE);
|
||||
if (gc->lockPtrs[type] != (FxU32)-1) {
|
||||
GDBG_INFO(83, "Read lock failure due to existing lock");
|
||||
rv = FXFALSE;
|
||||
}
|
||||
|
||||
if (rv) {
|
||||
switch(type) {
|
||||
case GR_LFB_READ_ONLY:
|
||||
lfbMode &= ~(SST_LFB_READBUFSELECT |
|
||||
SST_LFB_YORIGIN);
|
||||
|
||||
switch(buffer) {
|
||||
case GR_BUFFER_FRONTBUFFER:
|
||||
case GR_BUFFER_BACKBUFFER:
|
||||
lfbMode |= SST_LFB_READCOLORBUFFER;
|
||||
break;
|
||||
|
||||
case GR_BUFFER_AUXBUFFER:
|
||||
lfbMode |= SST_LFB_READDEPTHABUFFER;
|
||||
break;
|
||||
|
||||
default:
|
||||
GR_CHECK_F(myName,
|
||||
1,
|
||||
"illegal buffer parameter passed");
|
||||
rv = FXFALSE;
|
||||
break;
|
||||
}
|
||||
|
||||
lfbMode |= (origin ? SST_LFB_YORIGIN : 0);
|
||||
break;
|
||||
|
||||
case GR_LFB_WRITE_ONLY:
|
||||
/* Set up the constant depth register because it may have
|
||||
* been trashed by a call to grDepthBiasLevel
|
||||
* (depthbiaslevel and constant depth use the same register)
|
||||
*/
|
||||
zaColor = (((FxU32) gc->state.lfb_constant_depth) << SST_ZACOLOR_DEPTH_SHIFT);
|
||||
zaColor |= (gc->state.lfb_constant_alpha << SST_ZACOLOR_ALPHA_SHIFT);
|
||||
|
||||
/* disable depth biasing */
|
||||
fbzMode &= ~(SST_ENZBIAS);
|
||||
|
||||
lfbMode &= ~(SST_LFB_YORIGIN |
|
||||
SST_LFB_FORMAT |
|
||||
SST_LFB_ENPIXPIPE);
|
||||
|
||||
switch(writeMode) {
|
||||
case GR_LFBWRITEMODE_RESERVED1:
|
||||
case GR_LFBWRITEMODE_RESERVED2:
|
||||
case GR_LFBWRITEMODE_RESERVED3:
|
||||
case GR_LFBWRITEMODE_RESERVED4:
|
||||
case GR_LFBWRITEMODE_RESERVED5:
|
||||
case GR_LFBWRITEMODE_RESERVED6:
|
||||
case GR_LFBWRITEMODE_RESERVED7:
|
||||
rv = FXFALSE;
|
||||
}
|
||||
|
||||
/* Default to hw */
|
||||
if (writeMode == GR_LFBWRITEMODE_ANY) {
|
||||
writeMode = ((buffer == GR_BUFFER_AUXBUFFER)
|
||||
? GR_LFBWRITEMODE_ZA16
|
||||
: GR_LFBWRITEMODE_565);
|
||||
}
|
||||
|
||||
switch(buffer) {
|
||||
case GR_BUFFER_FRONTBUFFER:
|
||||
case GR_BUFFER_BACKBUFFER:
|
||||
rv = (writeMode != GR_LFBWRITEMODE_ZA16);
|
||||
break;
|
||||
|
||||
case GR_BUFFER_AUXBUFFER:
|
||||
rv = (writeMode == GR_LFBWRITEMODE_ZA16);
|
||||
break;
|
||||
|
||||
default:
|
||||
GR_CHECK_F(myName, 1, "illegal buffer parameter passed");
|
||||
break;
|
||||
}
|
||||
|
||||
lfbMode |= (writeMode << SST_LFB_FORMAT_SHIFT);
|
||||
lfbMode |= (origin ? SST_LFB_YORIGIN : 0);
|
||||
|
||||
if (pixelPipeline) {
|
||||
lfbMode |= SST_LFB_ENPIXPIPE;
|
||||
|
||||
fbzMode &= ~SST_YORIGIN;
|
||||
fbzMode |= (origin ? SST_YORIGIN : 0);
|
||||
}
|
||||
info->writeMode = writeMode;
|
||||
break;
|
||||
|
||||
default:
|
||||
rv = FXFALSE;
|
||||
GDBG_INFO(gc->myLevel, "Lock failed because of invalid lock type.");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (rv) {
|
||||
const FxU32
|
||||
lockCount = gc->cmdTransportInfo.lfbLockCount;
|
||||
|
||||
gc->lockPtrs[type] = buffer;
|
||||
gc->cmdTransportInfo.lfbLockCount = 0x00UL;
|
||||
|
||||
/* Setup the hw w/ the settings computed above. */
|
||||
switch(type) {
|
||||
case GR_LFB_READ_ONLY:
|
||||
GR_SET_EXPECTED_SIZE(sizeof(FxU32), 1);
|
||||
GR_SET(BROADCAST_ID, hw, lfbMode, lfbMode);
|
||||
GR_CHECK_SIZE();
|
||||
break;
|
||||
|
||||
case GR_LFB_WRITE_ONLY:
|
||||
REG_GROUP_BEGIN(BROADCAST_ID, fbzMode, 3, 0x103);
|
||||
{
|
||||
REG_GROUP_SET(hw, fbzMode, fbzMode);
|
||||
REG_GROUP_SET(hw, lfbMode, lfbMode);
|
||||
REG_GROUP_SET(hw, zaColor, zaColor);
|
||||
}
|
||||
REG_GROUP_END();
|
||||
break;
|
||||
}
|
||||
gc->state.shadow.lfbMode = lfbMode;
|
||||
|
||||
/* Get the current lfb buffer */
|
||||
{
|
||||
/* FixMe: Is this true if we're triple buffering? */
|
||||
FxU32 colBufferIndex;
|
||||
|
||||
switch(buffer) {
|
||||
case GR_BUFFER_FRONTBUFFER:
|
||||
colBufferIndex = gc->frontBuffer;
|
||||
break;
|
||||
|
||||
case GR_BUFFER_BACKBUFFER:
|
||||
colBufferIndex = gc->backBuffer;
|
||||
break;
|
||||
|
||||
case GR_BUFFER_AUXBUFFER:
|
||||
colBufferIndex = gc->grColBuf;
|
||||
break;
|
||||
|
||||
default:
|
||||
GR_CHECK_F(myName, 1, "illegal buffer parameter passed");
|
||||
rv = FXFALSE;
|
||||
break;
|
||||
}
|
||||
|
||||
if (rv) {
|
||||
info->strideInBytes = 0x1000;
|
||||
info->origin = origin;
|
||||
|
||||
if (type == GR_LFB_READ_ONLY) {
|
||||
info->lfbPtr = (void *)gc->lfbBuffers[colBufferIndex];
|
||||
}
|
||||
/* Next, If it is writeOnly and 565 and not pixelpipe,
|
||||
we just return the current buffer lfbPtr as the write ptr.
|
||||
This fixes those games that use the lfb write pointer to do
|
||||
lfb reads. --mikec */
|
||||
else if ((type == GR_LFB_WRITE_ONLY) &&
|
||||
(writeMode == GR_LFBWRITEMODE_565) &&
|
||||
(!pixelPipeline) &&
|
||||
/* Origin must be upper left since we will return raw lfb */
|
||||
(origin != GR_ORIGIN_LOWER_LEFT)){
|
||||
info->lfbPtr = (void *)gc->lfbBuffers[colBufferIndex];
|
||||
gc->state.shadow.colBufferAddr = gc->buffers[colBufferIndex];
|
||||
} else {
|
||||
gc->state.shadow.colBufferAddr = gc->buffers[colBufferIndex];
|
||||
GR_SET_EXPECTED_SIZE(sizeof(FxU32), 1);
|
||||
GR_SET(BROADCAST_ID, hw, colBufferAddr, gc->buffers[colBufferIndex]);
|
||||
GR_CHECK_SIZE();
|
||||
|
||||
info->lfbPtr = (void *)gc->lfb_ptr;
|
||||
|
||||
switch (writeMode) {
|
||||
case GR_LFBWRITEMODE_565_DEPTH:
|
||||
case GR_LFBWRITEMODE_555_DEPTH:
|
||||
case GR_LFBWRITEMODE_1555_DEPTH:
|
||||
case GR_LFBWRITEMODE_888:
|
||||
case GR_LFBWRITEMODE_8888:
|
||||
info->strideInBytes <<= 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (idleLockP) {
|
||||
/* This is required to flush the write buffers before the
|
||||
* actual LFB accesses.
|
||||
*/
|
||||
P6FENCE;
|
||||
|
||||
/* If we're not using hole counting then we need to make sure that
|
||||
* any queued commands are actually flushed before checking the fifo
|
||||
* ptr's location.
|
||||
*/
|
||||
if (!gc->cmdTransportInfo.autoBump)
|
||||
GR_BUMP_N_GRIND;
|
||||
|
||||
grFinish();
|
||||
}
|
||||
|
||||
/* Increment lock count */
|
||||
gc->cmdTransportInfo.lfbLockCount = lockCount + 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
GR_RETURN(rv);
|
||||
#undef FN_NAME
|
||||
} /* grLfbLock */
|
||||
|
||||
/*-------------------------------------------------------------------
|
||||
Function: grLfbUnlock
|
||||
Date: 2/21
|
||||
Implementor(s): jdt
|
||||
Library: Glide
|
||||
Description:
|
||||
Unlock a previously locked buffer
|
||||
Arguments:
|
||||
type - type of lock (read only/write only)
|
||||
buffer - which buffer to unlock
|
||||
Return:
|
||||
FXTRUE - success
|
||||
FXFALSE - failure
|
||||
-------------------------------------------------------------------*/
|
||||
|
||||
GR_ENTRY(grLfbUnlock, FxBool, (GrLock_t type, GrBuffer_t buffer))
|
||||
{
|
||||
#define FN_NAME "grLfbUnlock"
|
||||
FxBool rval = FXFALSE;
|
||||
|
||||
GR_BEGIN_NOFIFOCHECK_RET("grLfbUnLock", 83);
|
||||
GDBG_INFO_MORE(gc->myLevel,"(%d, %d)\n", type, buffer);
|
||||
|
||||
type = type & ~(GR_LFB_NOIDLE);
|
||||
|
||||
GR_CHECK_COMPATABILITY(FN_NAME,
|
||||
type != GR_LFB_WRITE_ONLY &&
|
||||
type != GR_LFB_READ_ONLY,
|
||||
"Bad type");
|
||||
|
||||
GR_CHECK_COMPATABILITY(FN_NAME,
|
||||
buffer != GR_BUFFER_FRONTBUFFER &&
|
||||
buffer != GR_BUFFER_BACKBUFFER &&
|
||||
buffer != GR_BUFFER_AUXBUFFER,
|
||||
"Bad buffer");
|
||||
|
||||
rval = (gc->lockPtrs[type] == (FxU32)buffer);
|
||||
if (rval) {
|
||||
const FxU32
|
||||
lockCount = gc->cmdTransportInfo.lfbLockCount;
|
||||
|
||||
/* Clear the current lfb lock state */
|
||||
gc->cmdTransportInfo.lfbLockCount = 0;
|
||||
gc->lockPtrs[type] = (FxU32)-1;
|
||||
|
||||
GR_SET_EXPECTED_SIZE(sizeof(FxU32), 1);
|
||||
GR_SET(BROADCAST_ID, hw, colBufferAddr, gc->buffers[gc->curBuffer]);
|
||||
GR_CHECK_SIZE();
|
||||
gc->state.shadow.colBufferAddr = gc->buffers[gc->curBuffer];
|
||||
|
||||
if (type == GR_LFB_WRITE_ONLY) {
|
||||
GR_SET_EXPECTED_SIZE(sizeof(FxU32) << 1, 2);
|
||||
{
|
||||
/* Restore depth bias level */
|
||||
GR_SET(BROADCAST_ID, hw, zaColor, gc->state.shadow.zaColor);
|
||||
|
||||
/* turn back on depth biasing */
|
||||
GR_SET(BROADCAST_ID, hw, fbzMode, gc->state.shadow.fbzMode);
|
||||
}
|
||||
GR_CHECK_SIZE();
|
||||
}
|
||||
|
||||
gc->cmdTransportInfo.lfbLockCount = lockCount - 1;
|
||||
}
|
||||
|
||||
GR_RETURN(rval);
|
||||
#undef FN_NAME
|
||||
} /* grLfbUnlock */
|
||||
|
||||
|
||||
#if GLIDE_DEBUG
|
||||
/*---------------------------------------------------------------------------
|
||||
** grLfbWriteColorFormat
|
||||
**
|
||||
*/
|
||||
|
||||
GR_STATE_ENTRY(grLfbWriteColorFormat, void, (GrColorFormat_t colorFormat))
|
||||
{
|
||||
#define FN_NAME "_grLfbWriteColorFormat"
|
||||
FxU32 lfbMode;
|
||||
|
||||
GR_BEGIN_NOFIFOCHECK("_grLfbWriteColorFormat",82);
|
||||
GDBG_INFO_MORE(gc->myLevel,"(%d)\n",colorFormat);
|
||||
|
||||
GR_CHECK_F(myName,
|
||||
colorFormat < 0 || colorFormat > 0x3,
|
||||
"invalid color format");
|
||||
|
||||
lfbMode = gc->state.shadow.lfbMode;
|
||||
lfbMode &= ~SST_LFB_RGBALANES;
|
||||
lfbMode |= (colorFormat << SST_LFB_RGBALANES_SHIFT);
|
||||
|
||||
gc->state.shadow.lfbMode = lfbMode;
|
||||
|
||||
GR_END();
|
||||
#undef FN_NAME
|
||||
} /* grLfbWriteColorFormat */
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------------
|
||||
** grLfbWriteColorSwizzle - set up SST for byte swizzling and word swapping
|
||||
**
|
||||
** Registers/Bits Affected:
|
||||
** lfbMode: bit(11), bit(12)
|
||||
**
|
||||
** WARNING: GMT: SST_LFB_WRITE_SWAP16 changes pixel addressing!!!
|
||||
*/
|
||||
GR_STATE_ENTRY(grLfbWriteColorSwizzle, void, (FxBool swizzleBytes, FxBool swapWords))
|
||||
{
|
||||
#define FN_NAME "_grLfbWriteColorSwizzle"
|
||||
FxU32 lfbMode;
|
||||
|
||||
GR_BEGIN_NOFIFOCHECK("_grLfbWriteColorSwizzle",82);
|
||||
GDBG_INFO_MORE(gc->myLevel,"(%d,%d)\n",swizzleBytes,swapWords);
|
||||
|
||||
/* Clear out the bits we'll set back if appropriate */
|
||||
lfbMode = gc->state.shadow.lfbMode;
|
||||
lfbMode &= ~(SST_LFB_WRITE_SWAP16 | SST_LFB_WRITE_BYTESWAP);
|
||||
|
||||
if (swizzleBytes)
|
||||
lfbMode |= SST_LFB_WRITE_BYTESWAP;
|
||||
|
||||
if (swapWords)
|
||||
lfbMode |= SST_LFB_WRITE_SWAP16;
|
||||
|
||||
gc->state.shadow.lfbMode = lfbMode;
|
||||
|
||||
GR_END();
|
||||
#undef FN_NAME
|
||||
} /* grLfbWriteColorSwizzle */
|
||||
#endif /* GLIDE_DEBUG */
|
||||
|
||||
FxBool
|
||||
_grLfbWriteRegion(FxBool pixPipelineP,
|
||||
GrBuffer_t dst_buffer, FxU32 dst_x, FxU32 dst_y,
|
||||
GrLfbSrcFmt_t src_format,
|
||||
FxU32 src_width, FxU32 src_height,
|
||||
FxI32 src_stride, const void *src_data)
|
||||
{
|
||||
#define FN_NAME "_grLfbWriteRegion"
|
||||
FxBool rv = FXTRUE;
|
||||
GrLfbInfo_t info;
|
||||
GrLfbWriteMode_t writeMode;
|
||||
|
||||
GR_BEGIN_NOFIFOCHECK_RET("_grLfbWriteRegion", 82);
|
||||
GDBG_INFO_MORE(gc->myLevel,
|
||||
"(0x%x, %s, %d, %d, %d, %d, %d, %d, 0x%x)\n",
|
||||
dst_buffer,
|
||||
(pixPipelineP ? "Enable" : "Disable"),
|
||||
dst_x, dst_y,
|
||||
src_format, src_width, src_height,
|
||||
src_stride, src_data);
|
||||
|
||||
writeMode = ((src_format == GR_LFB_SRC_FMT_RLE16)
|
||||
? GR_LFBWRITEMODE_565
|
||||
: src_format);
|
||||
|
||||
info.size = sizeof(info);
|
||||
|
||||
if (grLfbLock(GR_LFB_WRITE_ONLY,
|
||||
dst_buffer,
|
||||
writeMode,
|
||||
GR_ORIGIN_UPPER_LEFT,
|
||||
pixPipelineP,
|
||||
&info)) {
|
||||
FxU32 *srcData; /* Tracking Source Pointer */
|
||||
FxU32 *dstData; /* Tracking Destination Pointer */
|
||||
FxU32 *end; /* Demarks End of each Scanline */
|
||||
FxI32 srcJump; /* bytes to next scanline */
|
||||
FxU32 dstJump; /* bytes to next scanline */
|
||||
FxU32 length; /* bytes to copy in scanline */
|
||||
FxU32 scanline; /* scanline number */
|
||||
int aligned; /* word aligned? */
|
||||
|
||||
|
||||
srcData = (FxU32 *) src_data;
|
||||
dstData = (FxU32 *) (((char*)info.lfbPtr)+ (dst_y*info.strideInBytes));
|
||||
scanline = src_height;
|
||||
|
||||
switch(src_format) {
|
||||
/* 16-bit aligned */
|
||||
case GR_LFB_SRC_FMT_565:
|
||||
case GR_LFB_SRC_FMT_555:
|
||||
case GR_LFB_SRC_FMT_1555:
|
||||
case GR_LFB_SRC_FMT_ZA16:
|
||||
dstData = (FxU32*)(((FxU16*)dstData) + dst_x);
|
||||
length = src_width * 2;
|
||||
aligned = !((int)dstData&0x2);
|
||||
srcJump = src_stride - length;
|
||||
dstJump = info.strideInBytes - length;
|
||||
if (aligned) {
|
||||
while(scanline--) {
|
||||
end = (FxU32*)((char*)srcData + length - 2);
|
||||
while(srcData < end) {
|
||||
SET(dstData[0], srcData[0]);
|
||||
dstData++;
|
||||
srcData++;
|
||||
}
|
||||
|
||||
if (((int)length) & 0x2) {
|
||||
SET16((*(FxU16*)&(dstData[0])),
|
||||
(*(FxU16*)&(srcData[0])));
|
||||
dstData = (FxU32*)(((FxU16*)dstData) + 1);
|
||||
srcData = (FxU32*)(((FxU16*)srcData) + 1);
|
||||
}
|
||||
|
||||
dstData = (FxU32*)(((char*)dstData)+dstJump);
|
||||
srcData = (FxU32*)(((char*)srcData)+srcJump);
|
||||
}
|
||||
} else {
|
||||
while(scanline--) {
|
||||
end = (FxU32*)((char*)srcData + length - 2);
|
||||
|
||||
SET16((*(FxU16*)&(dstData[0])),
|
||||
(*(FxU16*)&(srcData[0])));
|
||||
dstData = (FxU32*)(((FxU16*)dstData) + 1);
|
||||
srcData = (FxU32*)(((FxU16*)srcData) + 1);
|
||||
|
||||
while(srcData < end) {
|
||||
SET(dstData[0], srcData[0]);
|
||||
dstData++;
|
||||
srcData++;
|
||||
}
|
||||
|
||||
if (!(length & 0x2)) {
|
||||
SET16((*(FxU16*)&(dstData[0])),
|
||||
(*(FxU16*)&(srcData[0])));
|
||||
dstData = (FxU32*)(((FxU16*)dstData) + 1);
|
||||
srcData = (FxU32*)(((FxU16*)srcData) + 1);
|
||||
}
|
||||
|
||||
dstData = (FxU32*)(((char*)dstData)+dstJump);
|
||||
srcData = (FxU32*)(((char*)srcData)+srcJump);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
/* 32-bit aligned */
|
||||
case GR_LFB_SRC_FMT_888:
|
||||
case GR_LFB_SRC_FMT_8888:
|
||||
case GR_LFB_SRC_FMT_565_DEPTH:
|
||||
case GR_LFB_SRC_FMT_555_DEPTH:
|
||||
case GR_LFB_SRC_FMT_1555_DEPTH:
|
||||
dstData = ((FxU32*)dstData) + dst_x;
|
||||
length = src_width * 4;
|
||||
srcJump = src_stride - length;
|
||||
dstJump = info.strideInBytes - length;
|
||||
while(scanline--) {
|
||||
end = (FxU32*)((char*)srcData + length);
|
||||
while(srcData < end) {
|
||||
SET(dstData[0], srcData[0]);
|
||||
dstData++;
|
||||
srcData++;
|
||||
}
|
||||
dstData = (FxU32*)(((char*)dstData)+dstJump);
|
||||
srcData = (FxU32*)(((char*)srcData)+srcJump);
|
||||
}
|
||||
break;
|
||||
|
||||
case GR_LFB_SRC_FMT_RLE16:
|
||||
/* needs to be implemented */
|
||||
rv = FXFALSE;
|
||||
break;
|
||||
}
|
||||
grLfbUnlock(GR_LFB_WRITE_ONLY, dst_buffer);
|
||||
} else {
|
||||
rv = FXFALSE;
|
||||
}
|
||||
|
||||
GR_RETURN(rv);
|
||||
#undef FN_NAME
|
||||
} /* _grLfbWriteRegion */
|
||||
|
||||
/*-------------------------------------------------------------------
|
||||
Function: grLfbWriteRegion
|
||||
Date: 3/5
|
||||
Implementor(s): jdt
|
||||
Library: Glide
|
||||
Description:
|
||||
Write a pixel rectangle to the frame buffer as efficiently as possible
|
||||
Arguments:
|
||||
dst_buffer - buffer to which to copy data
|
||||
dst_x,dst_y - destination image start coordinates
|
||||
src_format - data format of source image
|
||||
src_width, src_height
|
||||
- dimensions of source image
|
||||
src_stride - stride of source image in bytes, not meaningful
|
||||
for RLE images
|
||||
src_data - pointer to source data memory
|
||||
Return:
|
||||
FXTRUE succeed
|
||||
FXFALSE fail
|
||||
-------------------------------------------------------------------*/
|
||||
#if defined(GLIDE3) && defined(GLIDE3_ALPHA)
|
||||
GR_ENTRY(grLfbWriteRegion, FxBool, (GrBuffer_t dst_buffer,
|
||||
FxU32 dst_x, FxU32 dst_y,
|
||||
GrLfbSrcFmt_t src_format,
|
||||
FxU32 src_width, FxU32 src_height,
|
||||
FxBool pixelPipeline,
|
||||
FxI32 src_stride, void *src_data))
|
||||
#else
|
||||
GR_ENTRY(grLfbWriteRegion, FxBool, (GrBuffer_t dst_buffer,
|
||||
FxU32 dst_x, FxU32 dst_y,
|
||||
GrLfbSrcFmt_t src_format,
|
||||
FxU32 src_width, FxU32 src_height,
|
||||
FxI32 src_stride, void *src_data))
|
||||
#endif
|
||||
{
|
||||
FxBool rv = FXTRUE;
|
||||
|
||||
GR_BEGIN_NOFIFOCHECK_RET("grLfbWriteRegion",82);
|
||||
GDBG_INFO_MORE(gc->myLevel,
|
||||
"(0x%x,%d,%d,%d,%d,%d,%d,0x%x)\n",
|
||||
dst_buffer, dst_x, dst_y,
|
||||
src_format, src_width, src_height,
|
||||
src_stride, src_data);
|
||||
|
||||
#if defined(GLIDE3) && defined(GLIDE3_ALPHA)
|
||||
if ((_GlideRoot.hwConfig.SSTs[_GlideRoot.current_sst].type == GR_SSTTYPE_SST96) && (pixelPipeline == FXTRUE))
|
||||
rv = FXFALSE;
|
||||
else
|
||||
rv = _grLfbWriteRegion(pixelPipeline, dst_buffer, dst_x, dst_y,
|
||||
src_format, src_width, src_height,
|
||||
src_stride, src_data);
|
||||
#else
|
||||
rv = _grLfbWriteRegion(FXFALSE, dst_buffer, dst_x, dst_y,
|
||||
src_format, src_width, src_height,
|
||||
src_stride, src_data);
|
||||
#endif
|
||||
|
||||
GR_RETURN(rv);
|
||||
} /* grLfbWriteRegion */
|
||||
|
||||
/*-------------------------------------------------------------------
|
||||
Function: grLfbReadRegion
|
||||
Date: 3/12
|
||||
Implementor(s): jdt
|
||||
Library: Glide
|
||||
Description:
|
||||
Grab a rectangle from the frame buffer into user supplied memory
|
||||
Arguments:
|
||||
src_buffer - buffer to read from
|
||||
src_x - x coordinate of upper left corner rectangle to read
|
||||
src_y - y coordinate of upper left corner of rectangle to read
|
||||
src_width - width of rectangle to read
|
||||
src_height - height of rectangle to read
|
||||
dst_stride - distance between scanlines in destination buffer
|
||||
dst_data - pointer to user memory in which to place image
|
||||
Return:
|
||||
FXTRUE - success
|
||||
FXFALSE - failure
|
||||
-------------------------------------------------------------------*/
|
||||
GR_ENTRY(grLfbReadRegion, FxBool, (GrBuffer_t src_buffer,
|
||||
FxU32 src_x, FxU32 src_y,
|
||||
FxU32 src_width, FxU32 src_height,
|
||||
FxU32 dst_stride, void *dst_data))
|
||||
{
|
||||
#define FN_NAME "grLfbReadRegion"
|
||||
FxBool rv = FXTRUE;
|
||||
GrLfbInfo_t info;
|
||||
|
||||
GR_BEGIN_NOFIFOCHECK_RET("grLfbReadRegion",82);
|
||||
GDBG_INFO_MORE(gc->myLevel,
|
||||
"(0x%x,%d,%d,%d,%d,%d,0x%x)\n",
|
||||
src_buffer, src_x, src_y,
|
||||
src_width, src_height, dst_stride, dst_data);
|
||||
|
||||
info.size = sizeof(info);
|
||||
if (grLfbLock(GR_LFB_READ_ONLY,
|
||||
src_buffer,
|
||||
GR_LFBWRITEMODE_ANY,
|
||||
GR_ORIGIN_UPPER_LEFT,
|
||||
FXFALSE,
|
||||
&info)) {
|
||||
FxU32 *srcData; /* Tracking Source Pointer */
|
||||
FxU32 *dstData; /* Tracking Destination Pointer */
|
||||
FxU32 *end; /* Demarks End of each Scanline */
|
||||
FxU32 srcJump; /* bytes to next scanline */
|
||||
FxU32 dstJump; /* bytes to next scanline */
|
||||
FxU32 length; /* bytes to copy in scanline */
|
||||
FxU32 scanline; /* scanline number */
|
||||
int aligned; /* word aligned? */
|
||||
FxU32 odd; /* is src_y odd? (for sli) */
|
||||
|
||||
dstData = (FxU32 *) dst_data;
|
||||
srcData = (FxU32 *) (((char*)info.lfbPtr)+
|
||||
(src_y*info.strideInBytes) +
|
||||
(src_x<<1));
|
||||
scanline = src_height;
|
||||
length = src_width * 2;
|
||||
dstJump = dst_stride - length;
|
||||
srcJump = info.strideInBytes - length;
|
||||
aligned = !((int)srcData&0x2);
|
||||
odd = (src_y+src_height) & 0x1;
|
||||
|
||||
if (aligned) {
|
||||
while(scanline--) {
|
||||
end = (FxU32*)((char*)srcData + length - 2);
|
||||
|
||||
while(srcData < end) {
|
||||
*dstData++ = GR_GET(*srcData++);
|
||||
}
|
||||
|
||||
if (((int)length) & 0x2) {
|
||||
(*(FxU16*)dstData) = GR_GET16(*srcData);
|
||||
dstData = (FxU32*)(((FxU16*)dstData) + 1);
|
||||
srcData = (FxU32*)(((FxU16*)srcData) + 1);
|
||||
}
|
||||
|
||||
dstData = (FxU32*)(((char*)dstData)+dstJump);
|
||||
srcData = (FxU32*)(((char*)srcData)+srcJump);
|
||||
}
|
||||
} else {
|
||||
while(scanline--) {
|
||||
end = (FxU32*)((char*)srcData + length - 2);
|
||||
|
||||
(*(FxU16*)dstData) = (FxU16)GR_GET16(*srcData);
|
||||
dstData = (FxU32*)(((FxU16*)dstData) + 1);
|
||||
srcData = (FxU32*)(((FxU16*)srcData) + 1);
|
||||
|
||||
while(srcData < end) {
|
||||
*dstData++ = GR_GET(*srcData++);
|
||||
}
|
||||
|
||||
if (!(((int)length) & 0x2)) {
|
||||
(*(FxU16*)dstData) = GR_GET16(*srcData);
|
||||
dstData = (FxU32*)(((FxU16*)dstData) + 1);
|
||||
srcData = (FxU32*)(((FxU16*)srcData) + 1);
|
||||
}
|
||||
|
||||
dstData = (FxU32*)(((char*)dstData)+dstJump);
|
||||
srcData = (FxU32*)(((char*)srcData)+srcJump);
|
||||
}
|
||||
}
|
||||
grLfbUnlock(GR_LFB_READ_ONLY, src_buffer);
|
||||
} else {
|
||||
rv = FXFALSE;
|
||||
}
|
||||
GR_RETURN(rv);
|
||||
#undef FN_NAME
|
||||
}/* grLfbReadRegion */
|
||||
|
||||
@@ -52,9 +52,7 @@ extern "C" {
|
||||
typedef FxU32 GrColor_t;
|
||||
typedef FxU8 GrAlpha_t;
|
||||
typedef FxU32 GrMipMapId_t;
|
||||
#ifdef __linux__
|
||||
typedef FxU32 GrStipplePattern_t;
|
||||
#endif /* __linux__ */
|
||||
typedef FxU8 GrFog_t;
|
||||
typedef FxU32 GrContext_t;
|
||||
typedef int (FX_CALL *GrProc)();
|
||||
@@ -253,12 +251,10 @@ typedef FxI32 GrDitherMode_t;
|
||||
#define GR_DITHER_2x2 0x1
|
||||
#define GR_DITHER_4x4 0x2
|
||||
|
||||
#ifdef __linux__
|
||||
typedef FxI32 GrStippleMode_t;
|
||||
#define GR_STIPPLE_DISABLE 0x0
|
||||
#define GR_STIPPLE_PATTERN 0x1
|
||||
#define GR_STIPPLE_ROTATE 0x2
|
||||
#endif /* __linux__ */
|
||||
|
||||
typedef FxI32 GrFogMode_t;
|
||||
#define GR_FOG_DISABLE 0x0
|
||||
@@ -709,13 +705,11 @@ grDisableAllEffects( void );
|
||||
FX_ENTRY void FX_CALL
|
||||
grDitherMode( GrDitherMode_t mode );
|
||||
|
||||
#ifdef __linux__
|
||||
FX_ENTRY void FX_CALL
|
||||
grStippleMode( GrStippleMode_t mode );
|
||||
|
||||
FX_ENTRY void FX_CALL
|
||||
grStipplePattern( GrStipplePattern_t mode );
|
||||
#endif /* __linux__ */
|
||||
|
||||
FX_ENTRY void FX_CALL
|
||||
grFogColorValue( GrColor_t fogcolor );
|
||||
|
||||
@@ -19,6 +19,9 @@
|
||||
**
|
||||
** $Header$
|
||||
** $Log$
|
||||
** Revision 1.1.1.1.6.1 2003/06/29 18:43:27 guillemj
|
||||
** Fix compilation warnings.
|
||||
**
|
||||
** Revision 1.1.1.1 1999/11/24 21:45:01 joseph
|
||||
** Initial checkin for SourceForge
|
||||
**
|
||||
@@ -531,7 +534,7 @@
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
#ifdef __linux__
|
||||
#if DRI_BUILD
|
||||
#include <lindri.h>
|
||||
#endif
|
||||
|
||||
@@ -743,7 +746,7 @@ initGC ( GrGC *gc )
|
||||
GDBG_INFO(95, FN_NAME"(0x%X)\n", gc);
|
||||
|
||||
/* Setup the indices of the logical buffers */
|
||||
#ifdef __linux__
|
||||
#if DRI_BUILD
|
||||
gc->curBuffer = (gc->grColBuf > 1) ? 1 : 0;
|
||||
gc->frontBuffer = 0;
|
||||
#else
|
||||
@@ -936,7 +939,7 @@ GR_ENTRY(grSstWinOpen, GrContext_t, ( FxU32 hWnd,
|
||||
struct cmdTransportInfo *gcFifo = 0;
|
||||
GrContext_t retVal = 0;
|
||||
|
||||
#ifndef __linux__
|
||||
#if !defined(__linux__) && !defined(__DJGPP__)
|
||||
if (!hWnd)
|
||||
GrErrorCallback("grSstWinOpen: need to use a valid window handle",
|
||||
FXTRUE);
|
||||
@@ -974,7 +977,7 @@ GR_ENTRY(grSstWinOpen, GrContext_t, ( FxU32 hWnd,
|
||||
? GR_RESOLUTION_640x480
|
||||
: resolution;
|
||||
|
||||
#ifdef __linux__
|
||||
#if DRI_BUILD
|
||||
gc->state.screen_width = driInfo.screenWidth;
|
||||
gc->state.screen_height = driInfo.screenHeight;
|
||||
#else
|
||||
@@ -1056,7 +1059,7 @@ GR_ENTRY(grSstWinOpen, GrContext_t, ( FxU32 hWnd,
|
||||
gc->hwInitP = FXTRUE;
|
||||
}
|
||||
|
||||
#ifdef __linux__
|
||||
#if DRI_BUILD
|
||||
vInfo->xRes = driInfo.w;
|
||||
vInfo->yRes = driInfo.h;
|
||||
#else
|
||||
@@ -1115,7 +1118,7 @@ GR_ENTRY(grSstWinOpen, GrContext_t, ( FxU32 hWnd,
|
||||
/* This actually gets taken in hwcInitVideo */
|
||||
gc->contextP = FXTRUE;
|
||||
|
||||
#ifndef __linux__
|
||||
#if GLIDE_CHECK_CONTEXT
|
||||
/* CSR - Set up flag for display driver to tell us that context was lost */
|
||||
if ( !gc->open ) /* If we already have a context open, then lets not
|
||||
re-initialize the pointers */
|
||||
@@ -1397,7 +1400,7 @@ GR_ENTRY(grSstWinOpen, GrContext_t, ( FxU32 hWnd,
|
||||
gcFifo->fifoPtr = gcFifo->fifoStart;
|
||||
gcFifo->fifoRead = HW_FIFO_PTR( FXTRUE );
|
||||
|
||||
#ifndef __linux__
|
||||
#if !DRI_BUILD
|
||||
if ( (void*)gcFifo->fifoPtr != (void*)gcFifo->fifoRead ) {
|
||||
#ifdef GLIDE_INIT_HWC
|
||||
hwcRestoreVideo( bInfo );
|
||||
@@ -1439,7 +1442,7 @@ GR_ENTRY(grSstWinOpen, GrContext_t, ( FxU32 hWnd,
|
||||
gcFifo->fifoSize,
|
||||
gcFifo->fifoPtr );
|
||||
|
||||
#ifdef __linux__
|
||||
#if DRI_BUILD
|
||||
_grImportFifo(*driInfo.fifoPtr, *driInfo.fifoRead);
|
||||
#endif
|
||||
|
||||
@@ -1493,7 +1496,7 @@ GR_ENTRY(grSstWinOpen, GrContext_t, ( FxU32 hWnd,
|
||||
REG_GROUP_BEGIN(BROADCAST_ID, colBufferAddr, 4, 0xf);
|
||||
{
|
||||
REG_GROUP_SET(hw, colBufferAddr, gc->state.shadow.colBufferAddr);
|
||||
#ifdef __linux__
|
||||
#if DRI_BUILD
|
||||
REG_GROUP_SET(hw, colBufferStride, (!gc->curBuffer) ? driInfo.stride :
|
||||
gc->state.shadow.colBufferStride);
|
||||
#else
|
||||
@@ -1507,7 +1510,7 @@ GR_ENTRY(grSstWinOpen, GrContext_t, ( FxU32 hWnd,
|
||||
|
||||
GDBG_INFO( gc->myLevel, " Setting all Glide state\n" );
|
||||
assertDefaultState();
|
||||
#ifdef __linux__
|
||||
#if DRI_BUILD
|
||||
if (nColBuffers>1)
|
||||
grRenderBuffer(GR_BUFFER_BACKBUFFER);
|
||||
else
|
||||
@@ -1575,7 +1578,7 @@ GR_ENTRY(grSstWinClose, FxBool, (GrContext_t context))
|
||||
GrGC* gc = (GrGC*)context;
|
||||
GDBG_INFO(80, FN_NAME"(0x%X)\n", context);
|
||||
|
||||
#ifndef __linux__
|
||||
#if GLIDE_CHECK_CONTEXT
|
||||
if (gc->lostContext) {
|
||||
if (*gc->lostContext)
|
||||
return 0;
|
||||
@@ -1623,7 +1626,7 @@ GR_ENTRY(grSstWinClose, FxBool, (GrContext_t context))
|
||||
* safe everywhere.
|
||||
*/
|
||||
GDBG_INFO(gc->myLevel, " Restore Video");
|
||||
#ifndef __linux__
|
||||
#if GLIDE_CHECK_CONTEXT
|
||||
if (!*gc->lostContext)
|
||||
#endif
|
||||
hwcRestoreVideo(gc->bInfo);
|
||||
@@ -1654,7 +1657,7 @@ GR_ENTRY(grSstWinClose, FxBool, (GrContext_t context))
|
||||
}
|
||||
_GlideRoot.windowsInit--;
|
||||
|
||||
#ifndef __linux__
|
||||
#if !defined(__linux__) && !defined (__DJGPP__)
|
||||
if ( gc->bInfo->osNT )
|
||||
hwcUnmapMemory();
|
||||
else
|
||||
@@ -1665,7 +1668,27 @@ GR_ENTRY(grSstWinClose, FxBool, (GrContext_t context))
|
||||
#undef FN_NAME
|
||||
} /* grSstWinClose */
|
||||
|
||||
/*-------------------------------------------------------------------
|
||||
Function: grSetNumPendingBuffers
|
||||
Date: 13-Oct-2000
|
||||
Implementor(s): mmcclure
|
||||
Description:
|
||||
|
||||
Allow the application to supply the number of pending buffers
|
||||
|
||||
Arguments:
|
||||
|
||||
NumPendingBuffers - Sent to force number of pending buffers
|
||||
|
||||
Return:
|
||||
-------------------------------------------------------------------*/
|
||||
GR_DIENTRY(grSetNumPendingBuffers, void, (FxI32 NumPendingBuffers))
|
||||
{
|
||||
/* [dBorca] TODO
|
||||
*
|
||||
_GlideRoot.environment.swapPendingCount = NumPendingBuffers;
|
||||
*/
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------
|
||||
Function: grSelectContext
|
||||
@@ -1728,7 +1751,7 @@ GR_DIENTRY(grSelectContext, FxBool , (GrContext_t context) )
|
||||
GR_ASSERT((gc >= _GlideRoot.GCs) &&
|
||||
(gc <= _GlideRoot.GCs + MAX_NUM_SST));
|
||||
|
||||
#if defined( GLIDE_INIT_HWC ) && !defined(__linux__)
|
||||
#if defined( GLIDE_INIT_HWC ) && GLIDE_CHECK_CONTEXT
|
||||
gc->contextP = hwcQueryContext(gc->bInfo);
|
||||
#else
|
||||
gc->contextP = 1;
|
||||
@@ -1879,7 +1902,7 @@ GR_ENTRY(grFinish, void, (void))
|
||||
|
||||
grFlush();
|
||||
if ( gc->windowed ) {
|
||||
#if defined( GLIDE_INIT_HWC ) && !defined( __linux__ )
|
||||
#if defined( GLIDE_INIT_HWC ) && !defined( __linux__ ) && !defined( __DJGPP__ )
|
||||
struct cmdTransportInfo*
|
||||
gcFifo = &gc->cmdTransportInfo;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -19,6 +19,9 @@
|
||||
**
|
||||
** $Header$
|
||||
** $Log$
|
||||
** Revision 1.1.1.1 1999/11/24 21:44:57 joseph
|
||||
** Initial checkin for SourceForge
|
||||
**
|
||||
**
|
||||
** 5 5/26/99 9:22a Stb_acampbel
|
||||
** Removed an extra string format parameter from a debug output statement
|
||||
@@ -264,6 +267,361 @@
|
||||
#include "fxglide.h"
|
||||
#include "fxcmd.h"
|
||||
|
||||
#define GLIDE_POINTCAST_PALETTE 1
|
||||
|
||||
/*---------------------------------------------------------------------------
|
||||
** _grTexDownloadNccTableExt
|
||||
**
|
||||
** Downloads an ncctable to the specified _physical_ TMU(s). This
|
||||
** function is called internally by Glide and should not be executed
|
||||
** by an application.
|
||||
*/
|
||||
GR_DDFUNC(_grTexDownloadNccTableExt,
|
||||
void,
|
||||
(GrChipID_t tmu, FxU32 which, const GuNccTable *table, int start, int end))
|
||||
{
|
||||
#define FN_NAME "_grTexDownloadNccTableExt"
|
||||
GR_BEGIN_NOFIFOCHECK(FN_NAME,89);
|
||||
GDBG_INFO_MORE(gc->myLevel,"(%d,%d, 0x%x, %d,%d)\n",tmu,which,table,start,end);
|
||||
GR_ASSERT(start==0);
|
||||
GR_ASSERT(end==11);
|
||||
|
||||
/* check for null pointer */
|
||||
if (table == NULL) return;
|
||||
|
||||
gc->stats.palDownloads++;
|
||||
gc->stats.palBytes += (end-start+1)<<2;
|
||||
|
||||
/*if (gc->tmu_state[tmu].ncc_table[which] != table)*/ {
|
||||
SstRegs* texHW;
|
||||
int i;
|
||||
#ifdef GLIDE_POINTCAST_PALETTE
|
||||
texHW = SST_TMU(hw,tmu);
|
||||
#else
|
||||
texHW = SST_CHIP(hw, 0x06UL);
|
||||
#endif
|
||||
|
||||
if (which == 0) {
|
||||
#ifdef GLIDE_POINTCAST_PALETTE
|
||||
REG_GROUP_BEGIN((0x02UL << tmu), nccTable0, 12, 0x0FFF);
|
||||
#else
|
||||
REG_GROUP_BEGIN(0x06UL, nccTable0, 12, 0x0FFF);
|
||||
#endif
|
||||
for (i = 0; i < 12; i++) {
|
||||
gc->state.shadow.tmuState[tmu].nccTable0[i] = table->packed_data[i];
|
||||
REG_GROUP_SET(texHW, nccTable0[i], table->packed_data[i]);
|
||||
}
|
||||
REG_GROUP_END();
|
||||
} else {
|
||||
#ifdef GLIDE_POINTCAST_PALETTE
|
||||
REG_GROUP_BEGIN((0x02UL << tmu), nccTable1, 12, 0x0FFF);
|
||||
#else
|
||||
REG_GROUP_BEGIN(0x06UL, nccTable1, 12, 0x0FFF);
|
||||
#endif
|
||||
for (i = 0; i < 12; i++) {
|
||||
gc->state.shadow.tmuState[tmu].nccTable1[i] = table->packed_data[i];
|
||||
REG_GROUP_SET(texHW, nccTable1[i], table->packed_data[i]);
|
||||
}
|
||||
REG_GROUP_END();
|
||||
}
|
||||
|
||||
gc->tmu_state[tmu].ncc_table[which] = table;
|
||||
}
|
||||
|
||||
GR_END();
|
||||
#undef FN_NAME
|
||||
} /* _grTexDownloadNccTableExt */
|
||||
|
||||
/*-------------------------------------------------------------------
|
||||
Function: _grTexDownloadPaletteExt
|
||||
Date: 6/9
|
||||
Implementor(s): jdt
|
||||
Library: Glide
|
||||
Description:
|
||||
Private function to download a palette to the specified tmu
|
||||
Arguments:
|
||||
tmu - which tmu to download the palette to
|
||||
pal - the pallete data
|
||||
start - beginning index to download
|
||||
end - ending index to download
|
||||
Return:
|
||||
none
|
||||
-------------------------------------------------------------------*/
|
||||
GR_DDFUNC(_grTexDownloadPaletteExt,
|
||||
void,
|
||||
(GrChipID_t tmu, GrTexTable_t type, GuTexPalette *pal, int start, int end))
|
||||
{
|
||||
#define FN_NAME "_grTexDownloadPaletteExt"
|
||||
GR_BEGIN_NOFIFOCHECK(FN_NAME, 89);
|
||||
GDBG_INFO_MORE(gc->myLevel,"(%d,0x%x, %d,%d)\n",tmu,pal,start,end);
|
||||
|
||||
GR_CHECK_F(FN_NAME, pal == NULL, "pal invalid");
|
||||
GR_CHECK_F(FN_NAME, start < 0, "invalid start index");
|
||||
GR_CHECK_F(FN_NAME, end > 255, "invalid end index");
|
||||
|
||||
/* NOTE:
|
||||
**
|
||||
** This code broadcasts the palette because in the future, we will
|
||||
** only support one global texture palette no matter how many TMUs
|
||||
** there are. This is fallout from the fact that future hardware
|
||||
** has a unified memory architecture.
|
||||
**
|
||||
** Source licensees (meaning arcade or LBE vendors that) require the
|
||||
** one palette/tmu mode should define GLIDE_POINTCAST_PALETTE on
|
||||
** the command line for this file. Understand, however, that this
|
||||
** will not work on future hardware.
|
||||
*/
|
||||
|
||||
#ifdef GLIDE_POINTCAST_PALETTE
|
||||
/*
|
||||
** FURTHER NOTE:
|
||||
** There is a sublety (nice way of saying BUG) here.
|
||||
** If TMU0 is specified, then the palette will be broadcast to all
|
||||
** TMUS. So, if the user downloads TMU1's palette, then TMU0's
|
||||
** palette, TMU0's palette will be on *both* TMUs. This is a
|
||||
** pretty strong indicator that no one is using separate palettes
|
||||
** on different TMUs.
|
||||
*/
|
||||
hw = SST_TMU(hw,tmu);
|
||||
#else
|
||||
hw = SST_CHIP(hw,0xE);
|
||||
#endif
|
||||
|
||||
gc->stats.palDownloads++;
|
||||
gc->stats.palBytes += ((end - start + 1) << 2);
|
||||
|
||||
/* We divide the writes into 3 chunks trying to group things into
|
||||
* complete 8 word grouped packets to fit the nccTable palette
|
||||
* format: stuff before the 8 word alignment, aligned writes, and
|
||||
* stuff after the 8 word alignment to the end. The slop regions
|
||||
* are one packet apiece.
|
||||
*/
|
||||
{
|
||||
#ifdef GLIDE_POINTCAST_PALETTE
|
||||
const FifoChipField chipId = (FifoChipField)(0x02UL << tmu);
|
||||
#else
|
||||
const FifoChipField chipId = (FifoChipField)0x06UL;
|
||||
#endif
|
||||
const int endSlop = (end & ~0x07);
|
||||
const int startSlop = MIN(((start + 8) & ~0x07) - 1, end);
|
||||
int i = start;
|
||||
|
||||
if (type == GR_TEXTABLE_PALETTE) {
|
||||
/* Is the start of the palette range unaligned or is the end of
|
||||
* the range less than a completely aligned range?
|
||||
*/
|
||||
if (((start & 0x07) != 0) || (end < ((start + 8) & ~0x07))) {
|
||||
const FxI32 slopCount = startSlop - start + 1;
|
||||
GR_ASSERT((slopCount > 0) && (slopCount <= 8));
|
||||
|
||||
REG_GROUP_BEGIN(chipId, nccTable0[4 + (start & 0x07)],
|
||||
slopCount, (0xFF >> (8 - slopCount)));
|
||||
while(i < start + slopCount) {
|
||||
FxU32 entry;
|
||||
|
||||
entry = (0x80000000 | ((i & 0xFE) << 23) | pal->data[i] & 0xFFFFFF);
|
||||
|
||||
gc->state.shadow.paletteRow[i>>3].data[i&7] = entry;
|
||||
REG_GROUP_SET(hw, nccTable0[4 + (i & 0x07)], entry );
|
||||
|
||||
i++;
|
||||
}
|
||||
REG_GROUP_END();
|
||||
}
|
||||
|
||||
/* Do all of the aligned palette ranges. */
|
||||
while(i < endSlop) {
|
||||
const int endIndex = i + 8;
|
||||
|
||||
REG_GROUP_BEGIN(chipId, nccTable0[4], 8, 0xFF);
|
||||
while(i < endIndex) {
|
||||
FxU32 entry;
|
||||
|
||||
entry = (0x80000000 | ((i & 0xFE) << 23) | pal->data[i] & 0xFFFFFF);
|
||||
|
||||
gc->state.shadow.paletteRow[i>>3].data[i&7] = entry;
|
||||
REG_GROUP_SET(hw, nccTable0[4 + (i & 0x07)], entry );
|
||||
|
||||
i++;
|
||||
}
|
||||
REG_GROUP_END();
|
||||
}
|
||||
|
||||
/* Do we have any more slop at the end of the ragne? */
|
||||
if (i <= end) {
|
||||
const FxU32 slopCount = end - endSlop + 1;
|
||||
|
||||
REG_GROUP_BEGIN(chipId, nccTable0[4],
|
||||
slopCount, (0xFF >> (8 - slopCount)));
|
||||
while(i <= end) {
|
||||
FxU32 entry;
|
||||
|
||||
entry = (0x80000000 | ((i & 0xFE) << 23) | pal->data[i] & 0xFFFFFF);
|
||||
|
||||
gc->state.shadow.paletteRow[i>>3].data[i&7] = entry;
|
||||
REG_GROUP_SET(hw, nccTable0[4 + (i & 0x07)], entry );
|
||||
|
||||
i++;
|
||||
}
|
||||
REG_GROUP_END();
|
||||
}
|
||||
} else {
|
||||
/* Is the start of the palette range unaligned or is the end of
|
||||
* the range less than a completely aligned range?
|
||||
*/
|
||||
if (((start & 0x07) != 0) || (end < ((start + 8) & ~0x07))) {
|
||||
const FxI32 slopCount = startSlop - start + 1;
|
||||
GR_ASSERT((slopCount > 0) && (slopCount <= 8));
|
||||
|
||||
REG_GROUP_BEGIN(chipId, nccTable0[4 + (start & 0x07)],
|
||||
slopCount, (0xFF >> (8 - slopCount)));
|
||||
while(i < start + slopCount) {
|
||||
FxU32
|
||||
p1, p2, p3, p4,
|
||||
entry;
|
||||
|
||||
p1 = p2 = pal->data[i];
|
||||
p1 &= 0xfc000000; p2 &= 0x00fc0000;
|
||||
p1 >>= 8; p2 >>= 6;
|
||||
p3 = p4 = pal->data[i];
|
||||
p3 &= 0x0000fc00; p4 &= 0x000000fc;
|
||||
p3 >>= 4; p4 >>= 2;
|
||||
p1 |= p2; p3 |= p4; p1 |= p3;
|
||||
|
||||
entry = (0x80000000UL | ((i & 0xFEUL) << 23) | p1);
|
||||
gc->state.shadow.paletteRow[i>>3].data[i&7] = entry;
|
||||
REG_GROUP_SET(hw, nccTable0[4 + (i & 0x07)], entry);
|
||||
|
||||
i++;
|
||||
}
|
||||
REG_GROUP_END();
|
||||
}
|
||||
|
||||
/* Do all of the aligned palette ranges. */
|
||||
while(i < endSlop) {
|
||||
const int endIndex = i + 8;
|
||||
|
||||
REG_GROUP_BEGIN(chipId, nccTable0[4], 8, 0xFF);
|
||||
while(i < endIndex) {
|
||||
FxU32 p1, p2, p3, p4;
|
||||
p1 = p2 = pal->data[i];
|
||||
p1 &= 0xfc000000; p2 &= 0x00fc0000;
|
||||
p1 >>= 8; p2 >>= 6;
|
||||
p3 = p4 = pal->data[i];
|
||||
p3 &= 0x0000fc00; p4 &= 0x000000fc;
|
||||
p3 >>= 4; p4 >>= 2;
|
||||
p1 |= p2; p3 |= p4; p1 |= p3;
|
||||
REG_GROUP_SET(hw, nccTable0[4 + (i & 0x07)],
|
||||
(0x80000000 | ((i & 0xFE) << 23) | p1));
|
||||
i++;
|
||||
}
|
||||
REG_GROUP_END();
|
||||
}
|
||||
|
||||
/* Do we have any more slop at the end of the ragne? */
|
||||
if (i <= end) {
|
||||
const FxU32 slopCount = end - endSlop + 1;
|
||||
|
||||
REG_GROUP_BEGIN(chipId, nccTable0[4],
|
||||
slopCount, (0xFF >> (8 - slopCount)));
|
||||
while(i <= end) {
|
||||
FxU32
|
||||
p1, p2, p3, p4,
|
||||
entry;
|
||||
|
||||
p1 = p2 = pal->data[i];
|
||||
p1 &= 0xfc000000; p2 &= 0x00fc0000;
|
||||
p1 >>= 8; p2 >>= 6;
|
||||
p3 = p4 = pal->data[i];
|
||||
p3 &= 0x0000fc00; p4 &= 0x000000fc;
|
||||
p3 >>= 4; p4 >>= 2;
|
||||
p1 |= p2; p3 |= p4; p1 |= p3;
|
||||
|
||||
entry = (0x80000000UL | ((i & 0xFE) << 23) | p1);
|
||||
gc->state.shadow.paletteRow[i>>3].data[i&7] = entry;
|
||||
REG_GROUP_SET(hw, nccTable0[4 + (i & 0x07)], entry);
|
||||
|
||||
i++;
|
||||
}
|
||||
REG_GROUP_END();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* NB: If we're changing table types and the currently selected texture is
|
||||
* a palettized texture then we need to change the texture format
|
||||
* behind the user's back to match the table type.
|
||||
*/
|
||||
if (type != gc->state.tex_table) {
|
||||
FxI32
|
||||
i;
|
||||
|
||||
for(i = 0; i < gc->num_tmu; i++) {
|
||||
const FxU32
|
||||
texFmt = (gc->state.shadow.tmuState[i].textureMode & SST_TFORMAT),
|
||||
newTexMode = (gc->state.shadow.tmuState[i].textureMode ^
|
||||
((GR_TEXFMT_P_8 ^ GR_TEXFMT_P_8_RGBA) << SST_TFORMAT_SHIFT));
|
||||
|
||||
if ((texFmt == (GR_TEXFMT_P_8 << SST_TFORMAT_SHIFT)) ||
|
||||
(texFmt == (GR_TEXFMT_P_8_RGBA << SST_TFORMAT_SHIFT))) {
|
||||
|
||||
GR_SET_EXPECTED_SIZE(sizeof(FxU32), 1);
|
||||
GR_SET((0x02UL << i), SST_TMU(hw, i), textureMode, newTexMode);
|
||||
GR_CHECK_SIZE();
|
||||
|
||||
gc->state.shadow.tmuState[i].textureMode = newTexMode;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
GR_END();
|
||||
#undef FN_NAME
|
||||
} /* _grTexDownloadPaletteExt */
|
||||
|
||||
/*-------------------------------------------------------------------
|
||||
Function: grTexDownloadTableExt
|
||||
Date: 6/3
|
||||
Implementor(s): jdt, GaryMcT
|
||||
Library: glide
|
||||
Description:
|
||||
download look up table data to a tmu
|
||||
Arguments:
|
||||
tmu - which tmu
|
||||
type - what type of table to download
|
||||
One of:
|
||||
GR_TEXTABLE_NCC0
|
||||
GR_TEXTABLE_NCC1
|
||||
GR_TEXTABLE_PALETTE
|
||||
void *data - pointer to table data
|
||||
Return:
|
||||
none
|
||||
-------------------------------------------------------------------*/
|
||||
GR_EXT_ENTRY(grTexDownloadTableExt,
|
||||
void,
|
||||
(GrChipID_t tmu, GrTexTable_t type, void *data))
|
||||
{
|
||||
GR_BEGIN_NOFIFOCHECK("grTexDownloadTableExt",89);
|
||||
GDBG_INFO_MORE(gc->myLevel,"(%d,0x%x)\n",type,data);
|
||||
GR_CHECK_F(myName, type > GR_TEXTABLE_PALETTE_6666_EXT, "invalid table specified");
|
||||
GR_CHECK_F(myName, !data, "invalid data pointer");
|
||||
|
||||
if ((type == GR_TEXTABLE_PALETTE) || (type == GR_TEXTABLE_PALETTE_6666_EXT)) {
|
||||
_grTexDownloadPaletteExt(tmu, type, (GuTexPalette *)data, 0, 255);
|
||||
} else { /* Type is an ncc table */
|
||||
_grTexDownloadNccTableExt(tmu, type, (GuNccTable*)data, 0, 11);
|
||||
}
|
||||
|
||||
/* NB: Set the current palette type after we do the download because
|
||||
* the palette download code may need to know that there is a table
|
||||
* type change and do something hoopti.
|
||||
*/
|
||||
gc->state.tex_table = type;
|
||||
|
||||
GR_END();
|
||||
} /* grTexDownloadTableExt */
|
||||
|
||||
#undef GLIDE_POINTCAST_PALETTE
|
||||
|
||||
/*---------------------------------------------------------------------------
|
||||
** _grTexDownloadNccTable
|
||||
**
|
||||
@@ -287,7 +645,7 @@ GR_DDFUNC(_grTexDownloadNccTable,
|
||||
gc->stats.palDownloads++;
|
||||
gc->stats.palBytes += (end-start+1)<<2;
|
||||
|
||||
if (gc->tmu_state[tmu].ncc_table[which] != table) {
|
||||
/*if (gc->tmu_state[tmu].ncc_table[which] != table)*/ {
|
||||
SstRegs* texHW;
|
||||
int i;
|
||||
#ifdef GLIDE_POINTCAST_PALETTE
|
||||
|
||||
@@ -19,6 +19,9 @@
|
||||
;; $Header$
|
||||
;; $Revision$
|
||||
;; $Log$
|
||||
;; Revision 1.1.1.1 1999/11/24 21:44:58 joseph
|
||||
;; Initial checkin for SourceForge
|
||||
;;
|
||||
;;
|
||||
;; 4 4/06/99 3:54p Dow
|
||||
;; Alt tab again.
|
||||
@@ -82,59 +85,61 @@
|
||||
; B4 Chip field fix.
|
||||
;;
|
||||
|
||||
TITLE xdraw2.asm
|
||||
OPTION OLDSTRUCTS
|
||||
|
||||
.586P
|
||||
.MMX
|
||||
.K3D
|
||||
%include "xos.inc"
|
||||
|
||||
;;; Definitions of cvg regs and glide root structures.
|
||||
INCLUDE fxgasm.h
|
||||
%INCLUDE "fxgasm.h"
|
||||
|
||||
EXTRN __GlideRoot: DWORD
|
||||
EXTRN __grCommandTransportMakeRoom@12: NEAR
|
||||
EXTRN __grValidateState:NEAR
|
||||
EXTRN _hwcQueryContext:NEAR
|
||||
extrn _GlideRoot
|
||||
extrn _grCommandTransportMakeRoom, 12
|
||||
extrn _grValidateState
|
||||
|
||||
%MACRO GR_FIFO_WRITE 3
|
||||
mov [%1 + %2], %3
|
||||
%ENDMACRO ; GR_FIFO_WRITE
|
||||
|
||||
_DATA SEGMENT
|
||||
One DD 03f800000r
|
||||
|
||||
%MACRO WRITE_MM1_FIFO_ALIGNED 1
|
||||
movq [fifo+%1], mm1 ; store current param | previous param
|
||||
%ENDMACRO ; WRITE_MM1_FIFO_ALIGNED
|
||||
|
||||
|
||||
%MACRO WRITE_MM1LOW_FIFO 0
|
||||
movd [fifo], mm1 ; store current param | previous param
|
||||
%ENDMACRO ; WRITE_MM1LOW_FIFO
|
||||
|
||||
segment DATA
|
||||
One DD 1.0
|
||||
Area DD 0
|
||||
_DATA ENDS
|
||||
|
||||
CONST SEGMENT
|
||||
$T2003 DD 046400000r ; 12288
|
||||
$T2005 DD 03f800000r ; 1
|
||||
$T2006 DD 043800000r ; 256
|
||||
CONST ENDS
|
||||
segment CONST
|
||||
$T2003 DD 12288.0
|
||||
$T2005 DD 1.0
|
||||
$T2006 DD 256.0
|
||||
|
||||
; Arguments (STKOFF = 16 from 4 pushes)
|
||||
STKOFF = 16
|
||||
_va$ = 4 + STKOFF
|
||||
_vb$ = 8 + STKOFF
|
||||
_vc$ = 12 + STKOFF
|
||||
STKOFF equ 16
|
||||
_va$ equ 4 + STKOFF
|
||||
_vb$ equ 8 + STKOFF
|
||||
_vc$ equ 12 + STKOFF
|
||||
|
||||
;; coordinate offsets into vertex.
|
||||
;; NB: These are constants and are not
|
||||
;; user settable like the rest of the
|
||||
;; parameter offset. Weird.
|
||||
X = 0
|
||||
Y = 4
|
||||
X equ 0
|
||||
Y equ 4
|
||||
|
||||
PROC_TYPE MACRO procType:=<Default>
|
||||
IFDEF GL_AMD3D
|
||||
EXITM <__trisetup_3DNow_&procType&@12>
|
||||
ELSE
|
||||
EXITM <__trisetup_Default_&procType&@12>
|
||||
ENDIF
|
||||
ENDM
|
||||
%MACRO PROC_TYPE 1
|
||||
%IFDEF GL_AMD3D
|
||||
proc _trisetup_3DNow_%1, 12
|
||||
%ELSE
|
||||
proc _trisetup_Default_%1, 12
|
||||
%ENDIF
|
||||
%ENDM
|
||||
|
||||
;; enables/disables trisProcessed and trisDrawn counters
|
||||
STATS = 1
|
||||
|
||||
;; offsets into vertex struct
|
||||
X = 0
|
||||
Y = 4
|
||||
%define STATS 1
|
||||
|
||||
;; NB: All of the base triangle procs expect to have the gc
|
||||
;; passed from the caller in edx so that we can avoid
|
||||
@@ -145,206 +150,186 @@ Y = 4
|
||||
|
||||
;--------------------------------------------------------------------------
|
||||
|
||||
_TEXT SEGMENT PAGE PUBLIC USE32 'CODE'
|
||||
ASSUME DS: FLAT, SS: FLAT
|
||||
segment TEXT
|
||||
|
||||
ALIGN 32
|
||||
PUBLIC PROC_TYPE(clip_nocull_invalid)
|
||||
PROC_TYPE(clip_nocull_invalid) PROC NEAR
|
||||
PROC_TYPE clip_nocull_invalid
|
||||
|
||||
GLIDE_VALIDATE_STATE textequ <1>
|
||||
GLIDE_CLIP_COORDS textequ <1>
|
||||
GLIDE_CULLING textequ <0>
|
||||
GLIDE_PACK_RGB textequ <0>
|
||||
GLIDE_PACK_ALPHA textequ <0>
|
||||
GLIDE_GENERIC_SETUP textequ <0>
|
||||
INCLUDE xdraw2.inc
|
||||
GLIDE_GENERIC_SETUP textequ <0>
|
||||
GLIDE_PACK_ALPHA textequ <0>
|
||||
GLIDE_PACK_RGB textequ <0>
|
||||
GLIDE_CULLING textequ <0>
|
||||
GLIDE_CLIP_COORDS textequ <0>
|
||||
GLIDE_VALIDATE_STATE textequ <0>
|
||||
%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"
|
||||
%undef GLIDE_GENERIC_SETUP
|
||||
%undef GLIDE_PACK_ALPHA
|
||||
%undef GLIDE_PACK_RGB
|
||||
%undef GLIDE_CULLING
|
||||
%undef GLIDE_CLIP_COORDS
|
||||
%undef GLIDE_VALIDATE_STATE
|
||||
|
||||
PROC_TYPE(clip_nocull_invalid) ENDP
|
||||
endp
|
||||
|
||||
ALIGN 32
|
||||
PUBLIC PROC_TYPE(clip_cull_invalid)
|
||||
PROC_TYPE(clip_cull_invalid) PROC NEAR
|
||||
PROC_TYPE clip_cull_invalid
|
||||
|
||||
GLIDE_VALIDATE_STATE textequ <1>
|
||||
GLIDE_CLIP_COORDS textequ <1>
|
||||
GLIDE_CULLING textequ <1>
|
||||
GLIDE_PACK_RGB textequ <0>
|
||||
GLIDE_PACK_ALPHA textequ <0>
|
||||
GLIDE_GENERIC_SETUP textequ <0>
|
||||
INCLUDE xdraw2.inc
|
||||
GLIDE_GENERIC_SETUP textequ <0>
|
||||
GLIDE_PACK_ALPHA textequ <0>
|
||||
GLIDE_PACK_RGB textequ <0>
|
||||
GLIDE_CULLING textequ <0>
|
||||
GLIDE_CLIP_COORDS textequ <0>
|
||||
GLIDE_VALIDATE_STATE textequ <0>
|
||||
%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"
|
||||
%undef GLIDE_GENERIC_SETUP
|
||||
%undef GLIDE_PACK_ALPHA
|
||||
%undef GLIDE_PACK_RGB
|
||||
%undef GLIDE_CULLING
|
||||
%undef GLIDE_CLIP_COORDS
|
||||
%undef GLIDE_VALIDATE_STATE
|
||||
|
||||
PROC_TYPE(clip_cull_invalid) ENDP
|
||||
|
||||
ALIGN 32
|
||||
PUBLIC PROC_TYPE(clip_cull_valid)
|
||||
PROC_TYPE(clip_cull_valid) PROC NEAR
|
||||
|
||||
GLIDE_VALIDATE_STATE textequ <0>
|
||||
GLIDE_CLIP_COORDS textequ <1>
|
||||
GLIDE_CULLING textequ <1>
|
||||
GLIDE_PACK_RGB textequ <0>
|
||||
GLIDE_PACK_ALPHA textequ <0>
|
||||
GLIDE_GENERIC_SETUP textequ <0>
|
||||
INCLUDE xdraw2.inc
|
||||
GLIDE_GENERIC_SETUP textequ <0>
|
||||
GLIDE_PACK_ALPHA textequ <0>
|
||||
GLIDE_PACK_RGB textequ <0>
|
||||
GLIDE_CULLING textequ <0>
|
||||
GLIDE_CLIP_COORDS textequ <0>
|
||||
GLIDE_VALIDATE_STATE textequ <0>
|
||||
|
||||
PROC_TYPE(clip_cull_valid) ENDP
|
||||
|
||||
ALIGN 32
|
||||
PUBLIC PROC_TYPE(clip_nocull_valid)
|
||||
PROC_TYPE(clip_nocull_valid) PROC NEAR
|
||||
|
||||
GLIDE_VALIDATE_STATE textequ <0>
|
||||
GLIDE_CLIP_COORDS textequ <1>
|
||||
GLIDE_CULLING textequ <0>
|
||||
GLIDE_PACK_RGB textequ <0>
|
||||
GLIDE_PACK_ALPHA textequ <0>
|
||||
GLIDE_GENERIC_SETUP textequ <0>
|
||||
INCLUDE xdraw2.inc
|
||||
GLIDE_GENERIC_SETUP textequ <0>
|
||||
GLIDE_PACK_ALPHA textequ <0>
|
||||
GLIDE_PACK_RGB textequ <0>
|
||||
GLIDE_CULLING textequ <0>
|
||||
GLIDE_CLIP_COORDS textequ <0>
|
||||
GLIDE_VALIDATE_STATE textequ <0>
|
||||
|
||||
PROC_TYPE(clip_nocull_valid) ENDP
|
||||
endp
|
||||
|
||||
ALIGN 32
|
||||
PUBLIC PROC_TYPE(win_nocull_invalid)
|
||||
PROC_TYPE(win_nocull_invalid) PROC NEAR
|
||||
PROC_TYPE clip_cull_valid
|
||||
|
||||
%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"
|
||||
%undef GLIDE_GENERIC_SETUP
|
||||
%undef GLIDE_PACK_ALPHA
|
||||
%undef GLIDE_PACK_RGB
|
||||
%undef GLIDE_CULLING
|
||||
%undef GLIDE_CLIP_COORDS
|
||||
%undef GLIDE_VALIDATE_STATE
|
||||
|
||||
endp
|
||||
|
||||
ALIGN 32
|
||||
PROC_TYPE clip_nocull_valid
|
||||
|
||||
%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"
|
||||
%undef GLIDE_GENERIC_SETUP
|
||||
%undef GLIDE_PACK_ALPHA
|
||||
%undef GLIDE_PACK_RGB
|
||||
%undef GLIDE_CULLING
|
||||
%undef GLIDE_CLIP_COORDS
|
||||
%undef GLIDE_VALIDATE_STATE
|
||||
|
||||
endp
|
||||
|
||||
ALIGN 32
|
||||
PROC_TYPE win_nocull_invalid
|
||||
|
||||
GLIDE_VALIDATE_STATE textequ <1>
|
||||
GLIDE_CLIP_COORDS textequ <0>
|
||||
GLIDE_CULLING textequ <0>
|
||||
GLIDE_PACK_RGB textequ <0>
|
||||
GLIDE_PACK_ALPHA textequ <0>
|
||||
GLIDE_GENERIC_SETUP textequ <0>
|
||||
INCLUDE xdraw2.inc
|
||||
GLIDE_GENERIC_SETUP textequ <0>
|
||||
GLIDE_PACK_ALPHA textequ <0>
|
||||
GLIDE_PACK_RGB textequ <0>
|
||||
GLIDE_CULLING textequ <0>
|
||||
GLIDE_CLIP_COORDS textequ <0>
|
||||
GLIDE_VALIDATE_STATE textequ <0>
|
||||
%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"
|
||||
%undef GLIDE_GENERIC_SETUP
|
||||
%undef GLIDE_PACK_ALPHA
|
||||
%undef GLIDE_PACK_RGB
|
||||
%undef GLIDE_CULLING
|
||||
%undef GLIDE_CLIP_COORDS
|
||||
%undef GLIDE_VALIDATE_STATE
|
||||
|
||||
PROC_TYPE(win_nocull_invalid) ENDP
|
||||
endp
|
||||
|
||||
ALIGN 32
|
||||
PUBLIC PROC_TYPE(win_cull_invalid)
|
||||
|
||||
PROC_TYPE(win_cull_invalid) PROC NEAR
|
||||
PROC_TYPE win_cull_invalid
|
||||
|
||||
GLIDE_VALIDATE_STATE textequ <1>
|
||||
GLIDE_CLIP_COORDS textequ <0>
|
||||
GLIDE_CULLING textequ <1>
|
||||
GLIDE_PACK_RGB textequ <0>
|
||||
GLIDE_PACK_ALPHA textequ <0>
|
||||
GLIDE_GENERIC_SETUP textequ <0>
|
||||
INCLUDE xdraw2.inc
|
||||
GLIDE_GENERIC_SETUP textequ <0>
|
||||
GLIDE_PACK_ALPHA textequ <0>
|
||||
GLIDE_PACK_RGB textequ <0>
|
||||
GLIDE_CULLING textequ <0>
|
||||
GLIDE_CLIP_COORDS textequ <0>
|
||||
GLIDE_VALIDATE_STATE textequ <0>
|
||||
%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"
|
||||
%undef GLIDE_GENERIC_SETUP
|
||||
%undef GLIDE_PACK_ALPHA
|
||||
%undef GLIDE_PACK_RGB
|
||||
%undef GLIDE_CULLING
|
||||
%undef GLIDE_CLIP_COORDS
|
||||
%undef GLIDE_VALIDATE_STATE
|
||||
|
||||
PROC_TYPE(win_cull_invalid) ENDP
|
||||
endp
|
||||
|
||||
ALIGN 32
|
||||
PUBLIC PROC_TYPE(win_cull_valid)
|
||||
PROC_TYPE(win_cull_valid) PROC NEAR
|
||||
PROC_TYPE win_cull_valid
|
||||
|
||||
GLIDE_VALIDATE_STATE textequ <0>
|
||||
GLIDE_CLIP_COORDS textequ <0>
|
||||
GLIDE_CULLING textequ <1>
|
||||
GLIDE_PACK_RGB textequ <0>
|
||||
GLIDE_PACK_ALPHA textequ <0>
|
||||
GLIDE_GENERIC_SETUP textequ <0>
|
||||
INCLUDE xdraw2.inc
|
||||
GLIDE_GENERIC_SETUP textequ <0>
|
||||
GLIDE_PACK_ALPHA textequ <0>
|
||||
GLIDE_PACK_RGB textequ <0>
|
||||
GLIDE_CULLING textequ <0>
|
||||
GLIDE_CLIP_COORDS textequ <0>
|
||||
GLIDE_VALIDATE_STATE textequ <0>
|
||||
%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"
|
||||
%undef GLIDE_GENERIC_SETUP
|
||||
%undef GLIDE_PACK_ALPHA
|
||||
%undef GLIDE_PACK_RGB
|
||||
%undef GLIDE_CULLING
|
||||
%undef GLIDE_CLIP_COORDS
|
||||
%undef GLIDE_VALIDATE_STATE
|
||||
|
||||
PROC_TYPE(win_cull_valid) ENDP
|
||||
endp
|
||||
|
||||
ALIGN 32
|
||||
PUBLIC PROC_TYPE(win_nocull_valid)
|
||||
PROC_TYPE(win_nocull_valid) PROC NEAR
|
||||
PROC_TYPE win_nocull_valid
|
||||
|
||||
GLIDE_VALIDATE_STATE textequ <0>
|
||||
GLIDE_CLIP_COORDS textequ <0>
|
||||
GLIDE_CULLING textequ <0>
|
||||
GLIDE_PACK_RGB textequ <0>
|
||||
GLIDE_PACK_ALPHA textequ <0>
|
||||
GLIDE_GENERIC_SETUP textequ <0>
|
||||
INCLUDE xdraw2.inc
|
||||
GLIDE_GENERIC_SETUP textequ <0>
|
||||
GLIDE_PACK_ALPHA textequ <0>
|
||||
GLIDE_PACK_RGB textequ <0>
|
||||
GLIDE_CULLING textequ <0>
|
||||
GLIDE_CLIP_COORDS textequ <0>
|
||||
GLIDE_VALIDATE_STATE textequ <0>
|
||||
%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"
|
||||
%undef GLIDE_GENERIC_SETUP
|
||||
%undef GLIDE_PACK_ALPHA
|
||||
%undef GLIDE_PACK_RGB
|
||||
%undef GLIDE_CULLING
|
||||
%undef GLIDE_CLIP_COORDS
|
||||
%undef GLIDE_VALIDATE_STATE
|
||||
|
||||
PROC_TYPE(win_nocull_valid) ENDP
|
||||
endp
|
||||
|
||||
IFDEF GL_AMD3D
|
||||
%IFDEF GL_AMD3D
|
||||
ALIGN 32
|
||||
PUBLIC __trisetup_clip_coor_thunk@12
|
||||
__trisetup_clip_coor_thunk@12 PROC NEAR
|
||||
proc _trisetup_clip_coor_thunk, 12
|
||||
|
||||
%define procPtr eax
|
||||
%define vPtr ecx
|
||||
%define gc edx ; Current graphics context passed implicitly through edx
|
||||
|
||||
procPtr TEXTEQU <eax>
|
||||
vPtr TEXTEQU <ecx>
|
||||
gc TEXTEQU <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 vPtr, [esp + _va$ - STKOFF] ; Get vertex pointer address
|
||||
mov procPtr, [gc + drawTrianglesProc] ; 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 eax, [gc + CoordinateSpace]
|
||||
test eax, 1
|
||||
%IFDEF GLIDE_DEBUG
|
||||
test dword [gc + CoordinateSpace], 1
|
||||
jnz __clipSpace
|
||||
xor eax, eax
|
||||
mov [eax], eax
|
||||
__clipSpace:
|
||||
ENDIF ; GLIDE_DEBUG
|
||||
%ENDIF ; GLIDE_DEBUG
|
||||
|
||||
push 1 ; mode = grDrawVertexArray
|
||||
call procPtr ; (*gc->curArchProcs.drawTrianglesProc)(grDrawVertexArray, 3, vPtr)
|
||||
invoke procPtr, 1, 3, vPtr ; (*gc->curArchProcs.drawTrianglesProc)(grDrawVertexArray, 3, vPtr)
|
||||
|
||||
ret 12 ; pop 3 dwords (vertex addrs) and return
|
||||
__trisetup_clip_coor_thunk@12 ENDP
|
||||
|
||||
ENDIF ; GL_AMD3D
|
||||
|
||||
_TEXT ENDS
|
||||
END
|
||||
ret ; pop 3 dwords (vertex addrs) and return
|
||||
endp
|
||||
|
||||
%ENDIF ; GL_AMD3D
|
||||
|
||||
@@ -20,6 +20,9 @@
|
||||
;; $Header$
|
||||
;; $Revision$
|
||||
;; $Log$
|
||||
;; Revision 1.1.1.1 1999/11/24 21:44:58 joseph
|
||||
;; Initial checkin for SourceForge
|
||||
;;
|
||||
;
|
||||
; 2 10/30/97 6:53p Peter
|
||||
; first real cut at tri asm
|
||||
@@ -41,60 +44,32 @@
|
||||
;;
|
||||
;; YOU HAVE BEEN WARNED
|
||||
|
||||
ifdef GL_AMD3D
|
||||
%ifdef GL_AMD3D
|
||||
|
||||
;---------------------------------------------------------------------------
|
||||
; start 3DNow! version
|
||||
;---------------------------------------------------------------------------
|
||||
|
||||
TITLE xdraw2.inc
|
||||
.586P
|
||||
.MMX
|
||||
.K3D
|
||||
%define gc edi ; points to graphics context
|
||||
%define fifo ebp ; points to fifo entries
|
||||
%define tempVal esi
|
||||
|
||||
|
||||
GR_FIFO_WRITE MACRO __addr, __offset, __data
|
||||
mov [__addr + __offset], __data
|
||||
ENDM ; GR_FIFO_WRITE
|
||||
|
||||
|
||||
WRITE_MM1_FIFO_ALIGNED MACRO __offset
|
||||
movq [fifo+__offset], mm1 ; store current param | previous param
|
||||
ENDM ; WRITE_MM1_FIFO_ALIGNED
|
||||
|
||||
|
||||
WRITE_MM1LOW_FIFO MACRO
|
||||
movd [fifo], mm1 ; store current param | previous param
|
||||
ENDM ; WRITE_MM1LOW_FIFO
|
||||
|
||||
|
||||
; Arguments (STKOFF = 16 from 4 pushes)
|
||||
STKOFF = 16
|
||||
_va$ = 4 + STKOFF
|
||||
_vb$ = 8 + STKOFF
|
||||
_vc$ = 12 + STKOFF
|
||||
|
||||
|
||||
gc TEXTEQU <edi> ; points to graphics context
|
||||
fifo TEXTEQU <ebp> ; points to fifo entries
|
||||
tempVal TEXTEQU <esi>
|
||||
|
||||
IF GLIDE_CLIP_COORDS
|
||||
%IF GLIDE_CLIP_COORDS
|
||||
;; NB: Currently, the 3DNow!(tm) clip coordinate stuff
|
||||
;; thunks through to the grDrawTriangles functions
|
||||
;; which has already been specialized for 3DNow!(tm).
|
||||
;; This means that we should never get here.
|
||||
IFDEF GLIDE_DEBUG
|
||||
%IFDEF GLIDE_DEBUG
|
||||
xor eax, eax
|
||||
mov [eax], eax
|
||||
ENDIF
|
||||
ELSE
|
||||
IF GLIDE_CULLING
|
||||
fa TEXTEQU <eax> ; vtx a from caller
|
||||
fb TEXTEQU <ebx> ; vtx b from caller
|
||||
fc TEXTEQU <ecx> ; vtx c from caller
|
||||
cull TEXTEQU <edx> ; cull mode
|
||||
intArea TEXTEQU <ecx> ; area temp storage
|
||||
%ENDIF
|
||||
%ELSE
|
||||
%IF GLIDE_CULLING
|
||||
%define fa eax ; vtx a from caller
|
||||
%define fb ebx ; vtx b from caller
|
||||
%define fc ecx ; vtx c from caller
|
||||
%define cull edx ; cull mode
|
||||
%define intArea ecx ; area temp storage
|
||||
|
||||
;; Prologue stuff
|
||||
push edi ; save caller's register variable
|
||||
@@ -106,25 +81,21 @@ intArea TEXTEQU <ecx> ; area temp storage
|
||||
mov fb, [esp + _vb$ - 4] ; get base address of vertex B
|
||||
push ebp ; save frame pointer
|
||||
|
||||
if GLIDE_CLIP_COORDS
|
||||
%if GLIDE_CLIP_COORDS
|
||||
mov esi, [gc+CoordinateSpace] ; which coord. space (clip/window)?
|
||||
endif
|
||||
%endif
|
||||
|
||||
if GLIDE_VALIDATE_STATE
|
||||
%if GLIDE_VALIDATE_STATE
|
||||
mov ebp, [gc + invalid] ; state validated?
|
||||
endif
|
||||
%endif
|
||||
|
||||
if GLIDE_CLIP_COORDS
|
||||
%if GLIDE_CLIP_COORDS
|
||||
lea eax, [esp+ _va$] ; pointer to vertex pointers
|
||||
test esi, esi ; window coordinates ?
|
||||
|
||||
jz win_coordinates ; yup
|
||||
push eax ; pointer to vertex pointers
|
||||
|
||||
push 3 ; 3 vertices
|
||||
push 1 ; mode = grDrawVertexArray
|
||||
|
||||
call __grDrawTriangles@12 ; draw the triangle in clip coordinate space
|
||||
invoke _grDrawTriangles, 1, 3, eax; draw the triangle in clip coordinate space
|
||||
|
||||
pop ebp ; restore frame pointer
|
||||
pop ebx ; restore caller's register variable
|
||||
@@ -132,20 +103,20 @@ if GLIDE_CLIP_COORDS
|
||||
pop esi ; restore caller's register variable
|
||||
pop edi ; restore caller's register variable
|
||||
|
||||
ret 12 ; return, pop 3 DWORD arguments off stack
|
||||
ret ; return, pop 3 DWORD arguments off stack
|
||||
|
||||
win_coordinates:
|
||||
endif ; GLIDE_CLIP_COORDS
|
||||
.win_coordinates:
|
||||
%endif ; GLIDE_CLIP_COORDS
|
||||
|
||||
if GLIDE_VALIDATE_STATE
|
||||
%if GLIDE_VALIDATE_STATE
|
||||
test ebp, ebp ; does state need validation?
|
||||
jz no_validation ; valid, don't need to validate
|
||||
jz .no_validation ; valid, don't need to validate
|
||||
|
||||
call __grValidateState ; validate state
|
||||
invoke _grValidateState ; validate state
|
||||
|
||||
no_validation:
|
||||
.no_validation:
|
||||
|
||||
endif ; GLIDE_VALIDATE_STATE
|
||||
%endif ; GLIDE_VALIDATE_STATE
|
||||
|
||||
mov cull, [gc + cull_mode]; get cull mode
|
||||
nop ; filler
|
||||
@@ -162,7 +133,7 @@ endif ; GLIDE_VALIDATE_STATE
|
||||
|
||||
;; Cull Check
|
||||
|
||||
jz nocull ; nope, no culling
|
||||
jz .nocull ; nope, no culling
|
||||
mov fa, [esp + _va$] ; get base address of vertex A
|
||||
|
||||
movq mm2, [fc + X] ; yc | xc
|
||||
@@ -195,27 +166,23 @@ endif ; GLIDE_VALIDATE_STATE
|
||||
; Zero Area Triangle Check
|
||||
|
||||
test intArea, 7fffffffh ; if ((j & 0x7FFFFFFF) == 0)
|
||||
jz __cullFail ; area zero, triangle culled
|
||||
jz .__cullFail ; area zero, triangle culled
|
||||
|
||||
xor intArea, cull ; if (j ^ (culltest << 31))
|
||||
jge __cullFail ; triangle facing away from viewer, culled
|
||||
jge .__cullFail ; triangle facing away from viewer, culled
|
||||
|
||||
cmp ebx, tempVal ; fifo space required >= space available ?
|
||||
jge __triBegin ; yup, push out triangle data to Voodoo
|
||||
jge .__triBegin ; yup, push out triangle data to Voodoo
|
||||
|
||||
push @Line ; line number inside this function
|
||||
push 0h ; pointer to function name = NULL
|
||||
|
||||
push tempVal ; fifo space required
|
||||
call __grCommandTransportMakeRoom@12 ; note: updates fifoPtr
|
||||
invoke _grCommandTransportMakeRoom, tempVal, 0, __LINE__; note: updates fifoPtr
|
||||
|
||||
jmp __triBegin ; merge back with short path
|
||||
jmp .__triBegin ; merge back with short path
|
||||
|
||||
;; culling disabled
|
||||
|
||||
ALIGN 16
|
||||
|
||||
nocull:
|
||||
.nocull:
|
||||
;; Check to make sure that we have enough room for
|
||||
;; the complete triangle packet.
|
||||
|
||||
@@ -223,14 +190,10 @@ nocull:
|
||||
mov ebx, [gc + fifoRoom] ; fifo space available
|
||||
|
||||
cmp ebx, tempVal ; fifo spce available >= space needed ?
|
||||
jge __triBegin ; yup, ready to draw triangle
|
||||
jge .__triBegin ; yup, ready to draw triangle
|
||||
|
||||
push @Line ; line number inside this function
|
||||
push 0h ; pointer to function name = NULL
|
||||
|
||||
push tempVal ; fifo space needed
|
||||
call __grCommandTransportMakeRoom@12 ; note: updates fifoPtr
|
||||
ELSE ; !GLIDE_CULLING
|
||||
invoke _grCommandTransportMakeRoom, tempVal, 0, __LINE__; note: updates fifoPtr
|
||||
%ELSE ; !GLIDE_CULLING
|
||||
|
||||
;; Prologue stuff
|
||||
|
||||
@@ -242,25 +205,21 @@ ELSE ; !GLIDE_CULLING
|
||||
|
||||
push ebp ; save frame pointer
|
||||
|
||||
if GLIDE_CLIP_COORDS
|
||||
%if GLIDE_CLIP_COORDS
|
||||
mov edx, [gc+CoordinateSpace]; window coordinates or clip coordinates ?
|
||||
endif
|
||||
%endif
|
||||
|
||||
if GLIDE_VALIDATE_STATE
|
||||
%if GLIDE_VALIDATE_STATE
|
||||
mov ebp, [gc + invalid] ; state validated?
|
||||
endif
|
||||
%endif
|
||||
|
||||
if GLIDE_CLIP_COORDS
|
||||
%if GLIDE_CLIP_COORDS
|
||||
lea eax, [esp+ _va$] ; pointer to vertex pointers
|
||||
test edx, edx ; window coordinates ?
|
||||
|
||||
jz win_coordinates ; yup
|
||||
push eax ; pointer to vertex pointers
|
||||
|
||||
push 3 ; 3 vertices
|
||||
push 1 ; mode = grDrawVertexArray
|
||||
|
||||
call __grDrawTriangles@12 ; draw the triangle in coordinate space
|
||||
invoke _grDrawTriangles, 1, 3, eax; draw the triangle in coordinate space
|
||||
|
||||
pop ebp ; restore frame pointer
|
||||
pop ebx ; restore caller's register variable
|
||||
@@ -268,22 +227,22 @@ if GLIDE_CLIP_COORDS
|
||||
pop esi ; restore caller's register variable
|
||||
pop edi ; restore caller's register variable
|
||||
|
||||
ret 12 ; return, pop 3 DWORD arguments off stack
|
||||
ret ; return, pop 3 DWORD arguments off stack
|
||||
|
||||
ALIGN 16
|
||||
win_coordinates:
|
||||
.win_coordinates:
|
||||
|
||||
endif
|
||||
%endif
|
||||
|
||||
if GLIDE_VALIDATE_STATE
|
||||
%if GLIDE_VALIDATE_STATE
|
||||
test ebp, ebp ; does state need validation?
|
||||
jz no_validation ; valid, don't need to validate
|
||||
jz .no_validation ; valid, don't need to validate
|
||||
|
||||
call __grValidateState ; validate state
|
||||
invoke _grValidateState ; validate state
|
||||
|
||||
no_validation:
|
||||
.no_validation:
|
||||
|
||||
endif
|
||||
%endif
|
||||
|
||||
mov tempVal, [gc + curTriSize] ; data for whole triangle in bytes
|
||||
add tempVal, 4 ; fifo space needed (include 4-byte header)
|
||||
@@ -292,25 +251,21 @@ endif
|
||||
femms ; will use AMD3D, clear FPU/MMX registers
|
||||
|
||||
cmp ebx, tempVal ; fifo spce available >= space needed ?
|
||||
jge __triBegin ; yup, ready to draw triangle
|
||||
jge .__triBegin ; yup, ready to draw triangle
|
||||
|
||||
push @Line ; line number inside this function
|
||||
push 0h ; pointer to function name = NULL
|
||||
|
||||
push tempVal ; fifo space needed
|
||||
call __grCommandTransportMakeRoom@12 ; note: updates fifoPtr
|
||||
invoke _grCommandTransportMakeRoom, tempVal, 0, __LINE__; note: updates fifoPtr
|
||||
|
||||
jmp __triBegin ; large distance due to alignment
|
||||
endif ; GLIDE_CULLING
|
||||
jmp .__triBegin ; large distance due to alignment
|
||||
%ENDIF ; GLIDE_CULLING
|
||||
|
||||
|
||||
dlp TEXTEQU <ebx> ; points to dataList structure
|
||||
dlpstrt TEXTEQU <ecx> ; points to begin of dataList structure
|
||||
vertex TEXTEQU <edx> ; the current vertex
|
||||
%define dlp ebx ; points to dataList structure
|
||||
%define dlpstrt ecx ; points to begin of dataList structure
|
||||
%define vertex edx ; the current vertex
|
||||
|
||||
ALIGN 32
|
||||
|
||||
__triBegin:
|
||||
.__triBegin:
|
||||
mov eax, [gc+triPacketHdr]; Packet 3 header
|
||||
lea dlp,[gc + tsuDataList]; Reset the dataList
|
||||
|
||||
@@ -320,7 +275,7 @@ __triBegin:
|
||||
mov dlpstrt, dlp ; save pointer to start of dataList
|
||||
test fifo, 4 ; is fifo pointer qword aligned ?
|
||||
|
||||
jz __fifo_aligned ; yes, it is qword aligned
|
||||
jz .__fifo_aligned ; yes, it is qword aligned
|
||||
movq mm1, [vertex+X] ; y | x
|
||||
|
||||
GR_FIFO_WRITE fifo, 0, eax ; write header to fifo; now qword aligned
|
||||
@@ -334,14 +289,14 @@ __triBegin:
|
||||
add dlp, 4 ; dlp++
|
||||
|
||||
test eax, eax ; at end of list ?
|
||||
jz __paramLoopDoneWBzero1; yes, "write buffer" empty
|
||||
jz .__paramLoopDoneWBzero1; yes, "write buffer" empty
|
||||
|
||||
__paramLoop1a:
|
||||
.__paramLoop1a:
|
||||
movd mm1, [eax+vertex] ; get next parameter
|
||||
mov eax, [dlp] ; offset = *(dlp + 1)
|
||||
|
||||
test eax, eax ; at end of offset list (offset == 0) ?
|
||||
jz __paramLoopDoneWBone1 ; exit, write buffer contains one DWORD
|
||||
jz .__paramLoopDoneWBone1; exit, write buffer contains one DWORD
|
||||
|
||||
movd mm2, [eax+vertex] ; get next parameter
|
||||
add dlp, 8 ; dlp += 2
|
||||
@@ -353,11 +308,11 @@ __paramLoop1a:
|
||||
test eax, eax ; at end of offset list (offset == 0) ?
|
||||
|
||||
WRITE_MM1_FIFO_ALIGNED -8 ; PCI write current param | previous param
|
||||
jnz __paramLoop1a ; nope, copy next parameter
|
||||
jnz .__paramLoop1a ; nope, copy next parameter
|
||||
|
||||
jmp __paramLoopDoneWBzero1; write buffer empty
|
||||
jmp .__paramLoopDoneWBzero1; write buffer empty
|
||||
|
||||
__fifo_aligned:
|
||||
.__fifo_aligned:
|
||||
movd mm2, [vertex+X] ; y | x of vertex A
|
||||
add fifo, 8 ; fifoPtr += 2*sizeof(FxU32)
|
||||
|
||||
@@ -371,9 +326,9 @@ __fifo_aligned:
|
||||
add dlp, 4 ; dlp++
|
||||
|
||||
test eax, eax ; end of list ?
|
||||
jz __paramLoopDoneWBone1 ; yes, "write buffer" has y data
|
||||
jz .__paramLoopDoneWBone1; yes, "write buffer" has y data
|
||||
|
||||
__paramLoop1b:
|
||||
.__paramLoop1b:
|
||||
movd mm2, [eax+vertex] ; get next parameter
|
||||
add fifo, 8 ; fifoPtr += 2*sizeof(FxU32)
|
||||
|
||||
@@ -384,15 +339,15 @@ __paramLoop1b:
|
||||
test eax, eax ; at end of offset list (offset == 0) ?
|
||||
|
||||
WRITE_MM1_FIFO_ALIGNED -8 ; PCI write current param | previous param
|
||||
jz __paramLoopDoneWBzero1; exit, "write buffer" empty
|
||||
jz .__paramLoopDoneWBzero1; exit, "write buffer" empty
|
||||
|
||||
movd mm1, [eax+vertex] ; get next parameter
|
||||
mov eax, [dlp-4] ; offset = *(dlp + 1)
|
||||
|
||||
test eax, eax ; at end of offset list (offset == 0) ?
|
||||
jnz __paramLoop1b ; nope, copy next parameter
|
||||
jnz .__paramLoop1b ; nope, copy next parameter
|
||||
|
||||
__paramLoopDoneWBone1:
|
||||
.__paramLoopDoneWBone1:
|
||||
|
||||
;; here: "write buffer" has one DWORD left over from vertex A
|
||||
|
||||
@@ -411,9 +366,9 @@ __paramLoopDoneWBone1:
|
||||
add dlp, 4 ; dlp++
|
||||
|
||||
test eax, eax ; end of list ?
|
||||
jz __paramLoopDoneWBone2 ; yes, "write buffer" has y data
|
||||
jz .__paramLoopDoneWBone2; yes, "write buffer" has y data
|
||||
|
||||
__paramLoop2b:
|
||||
.__paramLoop2b:
|
||||
movd mm2, [eax+vertex] ; get next parameter
|
||||
add fifo, 8 ; fifoPtr += 2*sizeof(FxU32)
|
||||
|
||||
@@ -424,17 +379,17 @@ __paramLoop2b:
|
||||
cmp eax, 0 ; at end of offset list (offset == 0) ?
|
||||
|
||||
WRITE_MM1_FIFO_ALIGNED -8 ; PCI write current param | previous param
|
||||
jz __paramLoopDoneWBzero2; exit, "write buffer" empty
|
||||
jz .__paramLoopDoneWBzero2; exit, "write buffer" empty
|
||||
|
||||
movd mm1, [eax+vertex] ; get next parameter
|
||||
mov eax, [dlp-4] ; offset = *(dlp + 1)
|
||||
|
||||
test eax, eax ; at end of offset list (offset == 0) ?
|
||||
jnz __paramLoop2b ; nope, copy next parameter
|
||||
jnz .__paramLoop2b ; nope, copy next parameter
|
||||
|
||||
jmp __paramLoopDoneWBone2 ; write buffer contains one DWORD
|
||||
jmp .__paramLoopDoneWBone2; write buffer contains one DWORD
|
||||
|
||||
__paramLoopDoneWBzero1:
|
||||
.__paramLoopDoneWBzero1:
|
||||
|
||||
mov vertex, [esp + _vb$] ; Current vertex = B
|
||||
mov dlp, dlpstrt ; Reset the dataList
|
||||
@@ -451,14 +406,14 @@ __paramLoopDoneWBzero1:
|
||||
add dlp, 4 ; dlp++
|
||||
|
||||
cmp eax, 0 ; at end of list ?
|
||||
jz __paramLoopDoneWBzero2; yes, "write buffer" empty
|
||||
jz .__paramLoopDoneWBzero2; yes, "write buffer" empty
|
||||
|
||||
__paramLoop2a:
|
||||
.__paramLoop2a:
|
||||
movd mm1, [eax+vertex] ; get next parameter
|
||||
mov eax, [dlp] ; offset = *(dlp + 1)
|
||||
|
||||
cmp eax, 0 ; at end of offset list (offset == 0) ?
|
||||
jz __paramLoopDoneWBone2 ; exit, write buffer contains one DWORD
|
||||
jz .__paramLoopDoneWBone2; exit, write buffer contains one DWORD
|
||||
|
||||
movd mm2, [eax+vertex] ; get next parameter
|
||||
add dlp, 8 ; dlp += 2
|
||||
@@ -470,9 +425,9 @@ __paramLoop2a:
|
||||
test eax, eax ; at end of offset list (offset == 0) ?
|
||||
|
||||
WRITE_MM1_FIFO_ALIGNED -8 ; PCI write current param | previous param
|
||||
jnz __paramLoop2a ; nope, copy next parameter
|
||||
jnz .__paramLoop2a ; nope, copy next parameter
|
||||
|
||||
__paramLoopDoneWBzero2:
|
||||
.__paramLoopDoneWBzero2:
|
||||
|
||||
mov vertex, [esp + _vc$] ; Current vertex = C
|
||||
mov dlp, dlpstrt ; Reset the dataList
|
||||
@@ -488,14 +443,14 @@ __paramLoopDoneWBzero2:
|
||||
add dlp, 4 ; dlp++
|
||||
|
||||
test eax, eax ; at end of list ?
|
||||
jz __paramLoopDoneWBzero3; yes, "write buffer" empty
|
||||
jz .__paramLoopDoneWBzero3; yes, "write buffer" empty
|
||||
|
||||
__paramLoop3a:
|
||||
.__paramLoop3a:
|
||||
movd mm1, [eax+vertex] ; get next parameter
|
||||
mov eax, [dlp] ; offset = *(dlp + 1)
|
||||
|
||||
test eax, eax ; at end of offset list (offset == 0) ?
|
||||
jz __paramLoopDoneWBone3 ; exit, write buffer contains one DWORD
|
||||
jz .__paramLoopDoneWBone3; exit, write buffer contains one DWORD
|
||||
|
||||
movd mm2, [eax+vertex] ; get next parameter
|
||||
add dlp, 8 ; dlp += 2
|
||||
@@ -507,11 +462,11 @@ __paramLoop3a:
|
||||
test eax, eax ; at end of offset list (offset == 0) ?
|
||||
|
||||
WRITE_MM1_FIFO_ALIGNED -8 ; PCI write current param | previous param
|
||||
jnz __paramLoop3a ; nope, copy next parameter
|
||||
jnz .__paramLoop3a ; nope, copy next parameter
|
||||
|
||||
jmp __paramLoopDoneWBzero3; write buffer empty
|
||||
jmp .__paramLoopDoneWBzero3; write buffer empty
|
||||
|
||||
__paramLoopDoneWBone2:
|
||||
.__paramLoopDoneWBone2:
|
||||
|
||||
;; here: "write buffer" has one DWORD left over from vertex B
|
||||
|
||||
@@ -531,9 +486,9 @@ __paramLoopDoneWBone2:
|
||||
add dlp, 4 ; dlp++
|
||||
|
||||
test eax, eax ; end of list ?
|
||||
jz __paramLoopDoneWBone3 ; yes, "write buffer" has y data
|
||||
jz .__paramLoopDoneWBone3; yes, "write buffer" has y data
|
||||
|
||||
__paramLoop3b:
|
||||
.__paramLoop3b:
|
||||
movd mm2, [eax+vertex] ; get next parameter
|
||||
add fifo, 8 ; fifoPtr += 2*sizeof(FxU32)
|
||||
|
||||
@@ -544,22 +499,22 @@ __paramLoop3b:
|
||||
test eax, eax ; at end of offset list (offset == 0) ?
|
||||
|
||||
WRITE_MM1_FIFO_ALIGNED -8 ; PCI write current param | previous param
|
||||
jz __paramLoopDoneWBzero3; exit, "write buffer" empty
|
||||
jz .__paramLoopDoneWBzero3; exit, "write buffer" empty
|
||||
|
||||
movd mm1, [eax+vertex] ; get next parameter
|
||||
mov eax, [dlp-4] ; offset = *(dlp + 1)
|
||||
|
||||
test eax, eax ; at end of offset list (offset == 0) ?
|
||||
jnz __paramLoop3b ; nope, copy next parameter
|
||||
jnz .__paramLoop3b ; nope, copy next parameter
|
||||
|
||||
__paramLoopDoneWBone3:
|
||||
.__paramLoopDoneWBone3:
|
||||
|
||||
; "write buffer" contains one DWORD that needs to be flushed
|
||||
|
||||
WRITE_MM1LOW_FIFO ;
|
||||
add fifo, 4 ;
|
||||
|
||||
__paramLoopDoneWBzero3:
|
||||
.__paramLoopDoneWBzero3:
|
||||
|
||||
;; Update gc->fifoPtr and gc->fifoRoom
|
||||
|
||||
@@ -583,7 +538,7 @@ __paramLoopDoneWBzero3:
|
||||
|
||||
;; Restore trashed registers
|
||||
|
||||
__triDone_nocull:
|
||||
.__triDone_nocull:
|
||||
|
||||
inc esi ; _GlideRoot.stats.trisProcessed++
|
||||
pop ebp ; restore frame pointer
|
||||
@@ -596,17 +551,17 @@ __triDone_nocull:
|
||||
|
||||
femms ; no more AMD3D code, clear FPU/MMX regs
|
||||
|
||||
ret 12 ; return to caller
|
||||
ret ; return to caller
|
||||
|
||||
|
||||
IF GLIDE_CULLING
|
||||
__cullFail:
|
||||
%IF GLIDE_CULLING
|
||||
.__cullFail:
|
||||
mov esi, [gc + trisProcessed]; triangles processed so far
|
||||
xor eax, eax ; return value = triangle not drawn
|
||||
|
||||
femms ; no more AMD3D code, clear FPU/MMX regs
|
||||
|
||||
__triDone_cull:
|
||||
.__triDone_cull:
|
||||
;; Restore trashed registers
|
||||
inc esi ; _GlideRoot.stats.trisProcessed++;
|
||||
pop ebp ; restore frame pointer
|
||||
@@ -617,48 +572,45 @@ __triDone_cull:
|
||||
pop esi
|
||||
pop edi
|
||||
|
||||
ret 12
|
||||
ENDIF ; GLIDE_CULLING
|
||||
ENDIF ; !GLIDE_CLIP_COORDS
|
||||
ret
|
||||
%ENDIF ; GLIDE_CULLING
|
||||
%ENDIF ; !GLIDE_CLIP_COORDS
|
||||
|
||||
;---------------------------------------------------------------------------
|
||||
; end 3DNow! version
|
||||
;---------------------------------------------------------------------------
|
||||
|
||||
endif ; GL_AMD3D
|
||||
%endif ; GL_AMD3D
|
||||
|
||||
|
||||
ifndef GL_AMD3D
|
||||
%ifndef GL_AMD3D
|
||||
|
||||
;---------------------------------------------------------------------------
|
||||
; original code
|
||||
;---------------------------------------------------------------------------
|
||||
|
||||
TITLE xdraw2.inc
|
||||
.586P
|
||||
|
||||
; Ugly, but seems to workaround the problem with locally defined
|
||||
; data segment globals not getting relocated properly when using
|
||||
; djgpp.
|
||||
|
||||
zArea TEXTEQU <One+04h>
|
||||
zdxAB TEXTEQU <One+08h>
|
||||
zdxBC TEXTEQU <One+0ch>
|
||||
zdyAB TEXTEQU <One+10h>
|
||||
zdyBC TEXTEQU <One+14h>
|
||||
zculltest TEXTEQU <One+18h>
|
||||
%define zArea One+04h
|
||||
%define zdxAB One+08h
|
||||
%define zdxBC One+0ch
|
||||
%define zdyAB One+10h
|
||||
%define zdyBC One+14h
|
||||
%define zculltest One+18h
|
||||
|
||||
gc TEXTEQU <esi> ; points to graphics context
|
||||
%define gc esi ; points to graphics context
|
||||
|
||||
IF GLIDE_CLIP_COORDS
|
||||
%IF GLIDE_CLIP_COORDS
|
||||
;; NB: We should never hit this because the proc is
|
||||
;; either specialized or we thunk through to
|
||||
;; grDrawTriangles for the clipping etc.
|
||||
IFDEF GLIDE_DEBUG
|
||||
%IFDEF GLIDE_DEBUG
|
||||
xor eax, eax
|
||||
mov [eax], eax
|
||||
ENDIF
|
||||
ELSE
|
||||
%ENDIF
|
||||
%ELSE
|
||||
;; Prologue stuff
|
||||
push esi
|
||||
push edi
|
||||
@@ -669,7 +621,7 @@ ELSE
|
||||
;; call getThreadValueSLOW
|
||||
;; mov gc, eax
|
||||
|
||||
IF 0
|
||||
%IF 0
|
||||
;;; TRICKY STUFF HERE:
|
||||
;;; The following code would be expressed like this if MASM didn't suck:
|
||||
;;; mov eax, DWORD PTR fs:[18h]
|
||||
@@ -682,46 +634,46 @@ IF 0
|
||||
db 00h
|
||||
db 00h
|
||||
|
||||
add eax, DWORD PTR __GlideRoot + tlsOffset
|
||||
add eax, DWORD [_GlideRoot + tlsOffset]
|
||||
mov gc, [eax]
|
||||
ELSE
|
||||
%ELSE
|
||||
mov gc, edx
|
||||
ENDIF
|
||||
IFDEF GLIDE_ALT_TAB
|
||||
%ENDIF
|
||||
%IFDEF GLIDE_ALT_TAB
|
||||
test gc, gc
|
||||
je __triDone
|
||||
mov edx, [gc + windowed]
|
||||
je .__triDone
|
||||
mov edx, [gc + windowed]
|
||||
test edx, 1
|
||||
jnz pastContextTest ;
|
||||
mov edx, DWORD PTR [gc+lostContext]
|
||||
mov ebx, [edx]
|
||||
jnz .pastContextTest ;
|
||||
mov edx, DWORD [gc+lostContext]
|
||||
mov ebx, [edx]
|
||||
test ebx, 1
|
||||
jnz __triDone
|
||||
pastContextTest:
|
||||
jnz .__triDone
|
||||
.pastContextTest:
|
||||
|
||||
ENDIF
|
||||
%ENDIF
|
||||
align 4
|
||||
IF GLIDE_VALIDATE_STATE
|
||||
%IF GLIDE_VALIDATE_STATE
|
||||
;;; GR_FLUSH_STATE()
|
||||
mov edx, DWORD PTR [gc+invalid]
|
||||
mov edx, DWORD [gc+invalid]
|
||||
test edx, edx
|
||||
je SHORT no_validatioin
|
||||
call __grValidateState
|
||||
no_validatioin:
|
||||
ENDIF
|
||||
je .no_validatioin
|
||||
invoke _grValidateState
|
||||
.no_validatioin:
|
||||
%ENDIF
|
||||
align 4
|
||||
IF GLIDE_CULLING
|
||||
fa TEXTEQU <eax> ; vtx a from caller
|
||||
fb TEXTEQU <ebx> ; vtx b from caller
|
||||
fc TEXTEQU <ecx> ; vtx c from caller
|
||||
%IF GLIDE_CULLING
|
||||
%define fa eax ; vtx a from caller
|
||||
%define fb ebx ; vtx b from caller
|
||||
%define fc ecx ; vtx c from caller
|
||||
|
||||
cull TEXTEQU <edx>
|
||||
intArea TEXTEQU <ebp> ; temp Y storage
|
||||
%define cull edx
|
||||
%define intArea ebp ; temp Y storage
|
||||
|
||||
; some useful floating load and store macros <ala gmt>
|
||||
flds TEXTEQU <fld DWORD PTR>
|
||||
fsubs TEXTEQU <fsub DWORD PTR>
|
||||
fmuls TEXTEQU <fmul DWORD PTR>
|
||||
%define flds fld DWORD
|
||||
%define fsubs fsub DWORD
|
||||
%define fmuls fmul DWORD
|
||||
|
||||
;; Pre-load the current culling mode before all of the
|
||||
;; floating point area stuff.
|
||||
@@ -732,11 +684,11 @@ fmuls TEXTEQU <fmul DWORD PTR>
|
||||
mov fc, [esp + _vc$]
|
||||
|
||||
test cull, cull
|
||||
jz nocull
|
||||
jz .nocull
|
||||
|
||||
shl cull, 31 ; culltest << 31
|
||||
|
||||
Area_Computation:
|
||||
; Area_Computation:
|
||||
; 47-3
|
||||
; jmp ret_pop0f
|
||||
flds [fa + X] ; xa
|
||||
@@ -747,34 +699,34 @@ Area_Computation:
|
||||
fsubs [fc + Y] ; | | dyBC
|
||||
flds [fa + Y] ; | | | ya
|
||||
fsubs [fb + Y] ; | | | dyAB
|
||||
fld st(3) ; | | | | dxAB
|
||||
fmul st, st(2) ; | | | | t0 t0=dxAB*dyBC
|
||||
fld st(3) ; | | | | | dxBC
|
||||
fmul st, st(2) ; | | | | | t1 t1=dxBC*dyAB
|
||||
fsubp st(1),st ; | | | | area
|
||||
fst zArea ; | | | | area
|
||||
fld st3 ; | | | | dxAB
|
||||
fmul st0, st2 ; | | | | t0 t0=dxAB*dyBC
|
||||
fld st3 ; | | | | | dxBC
|
||||
fmul st0, st2 ; | | | | | t1 t1=dxBC*dyAB
|
||||
fsubp st1,st0 ; | | | | area
|
||||
fst dword [zArea] ; | | | | area
|
||||
|
||||
;; Pop temp things from the sw culling off the fp stack
|
||||
fstp st(0) ; 4
|
||||
fstp st(0) ; 3
|
||||
fstp st(0) ; 2
|
||||
fstp st(0) ; 1
|
||||
fstp st(0) ; 0
|
||||
fstp st0 ; 4
|
||||
fstp st0 ; 3
|
||||
fstp st0 ; 2
|
||||
fstp st0 ; 1
|
||||
fstp st0 ; 0
|
||||
|
||||
mov intArea, zArea ; j = *(long *)&area
|
||||
mov intArea, [zArea] ; j = *(long *)&area
|
||||
xor eax, eax ; Clear the return value (0 == culled)
|
||||
|
||||
; Zero Area Triangle Check
|
||||
and intArea, 7fffffffh ; if ((j & 0x7FFFFFFF) == 0)
|
||||
jz __triDone
|
||||
jz .__triDone
|
||||
|
||||
;; Triangle area check vs culling mode
|
||||
mov intArea, zArea ; reload area just in case we're culling
|
||||
mov intArea, [zArea] ; reload area just in case we're culling
|
||||
xor intArea, cull ; if (j ^ (culltest << 31))
|
||||
|
||||
jge __triDone
|
||||
nocull:
|
||||
ENDIF ; GLIDE_CULLING
|
||||
jge .__triDone
|
||||
.nocull:
|
||||
%ENDIF ; GLIDE_CULLING
|
||||
|
||||
align 4
|
||||
;; Check to make sure that we have enough room for
|
||||
@@ -785,30 +737,22 @@ ENDIF ; GLIDE_CULLING
|
||||
add eax, 4
|
||||
cmp ebx, eax
|
||||
|
||||
jge __triBegin
|
||||
jge .__triBegin
|
||||
|
||||
push @Line
|
||||
push 0h
|
||||
|
||||
push eax
|
||||
call __grCommandTransportMakeRoom@12
|
||||
invoke _grCommandTransportMakeRoom, eax, 0, __LINE__
|
||||
|
||||
;; Send triangle parameters
|
||||
|
||||
dlp TEXTEQU <ebx> ; points to dataList structure
|
||||
fifo TEXTEQU <ebp> ; points to next entry in fifo
|
||||
vertex TEXTEQU <edx> ; the current vertex
|
||||
vOffset TEXTEQU <ecx> ; Current vertex offset
|
||||
%define dlp ebx ; points to dataList structure
|
||||
%define fifo ebp ; points to next entry in fifo
|
||||
%define vertex edx ; the current vertex
|
||||
%define vOffset ecx ; Current vertex offset
|
||||
|
||||
packCol TEXTEQU <edi>
|
||||
tempVal TEXTEQU <edi>
|
||||
|
||||
GR_FIFO_WRITE MACRO __addr, __offset, __data
|
||||
mov [__addr + __offset], __data
|
||||
ENDM ; GR_FIFO_WRITE
|
||||
%define packCol edi
|
||||
%define tempVal edi
|
||||
|
||||
align 32
|
||||
__triBegin:
|
||||
.__triBegin:
|
||||
mov fifo, [gc + fifoPtr] ; Fetch Fifo Ptr
|
||||
mov vOffset, 4 ; Starting vertex
|
||||
|
||||
@@ -819,53 +763,53 @@ __triBegin:
|
||||
add fifo, 4 ; Advance fifo for hdr & x/y coordinate
|
||||
|
||||
align 32
|
||||
__vertexStart:
|
||||
.__vertexStart:
|
||||
mov vertex, [esp + STKOFF + vOffset] ; Current vertex
|
||||
add fifo, 8
|
||||
|
||||
nop ; Avoid p5 agi w/ load of vertex ptr
|
||||
nop
|
||||
|
||||
mov eax, DWORD PTR [vertex] ; X
|
||||
mov eax, DWORD [vertex] ; X
|
||||
lea dlp, [gc + tsuDataList] ; Reset the dataList
|
||||
|
||||
GR_FIFO_WRITE fifo, -8, eax ; PCI write X
|
||||
mov eax, DWORD PTR [vertex + 4] ; Y
|
||||
mov eax, DWORD [vertex + 4] ; Y
|
||||
|
||||
xor packCol, packCol ; Clear packed color
|
||||
GR_FIFO_WRITE fifo, -4, eax ; PCI write Y
|
||||
|
||||
__doParams:
|
||||
mov eax, DWORD PTR [dlp] ; Get first offset from the data list
|
||||
.__doParams:
|
||||
mov eax, DWORD [dlp] ; Get first offset from the data list
|
||||
add dlp, 4 ; dlp++
|
||||
|
||||
cmp eax, 0 ; Are we done?
|
||||
je __nextVertex
|
||||
je .__nextVertex
|
||||
|
||||
;; Not using align directive here because it sometimes
|
||||
;; introduces an agi for the eax use below.
|
||||
nop
|
||||
nop
|
||||
|
||||
__paramLoop:
|
||||
mov tempVal, DWORD PTR [eax + vertex] ; Get the parameter from teh vertex
|
||||
.__paramLoop:
|
||||
mov tempVal, DWORD [eax + vertex] ; Get the parameter from teh vertex
|
||||
add fifo, 4 ; fifoPtr += sizeof(FxU32)
|
||||
|
||||
mov eax, DWORD PTR [dlp] ; offset = *(dlp + 1)
|
||||
mov eax, DWORD [dlp] ; offset = *(dlp + 1)
|
||||
add dlp, 4 ; dlp++
|
||||
|
||||
cmp eax, 0 ; Are we done?
|
||||
GR_FIFO_WRITE fifo, -4, tempVal ; *fifoPtr = data
|
||||
|
||||
jne SHORT __paramLoop
|
||||
jne .__paramLoop
|
||||
|
||||
align 4
|
||||
__nextVertex:
|
||||
.__nextVertex:
|
||||
;; On to the next vertex
|
||||
add vOffset, 4
|
||||
|
||||
cmp vOffset, 16 ; Offset of one past last vertex?
|
||||
jne __vertexStart
|
||||
jne .__vertexStart
|
||||
|
||||
;; Update gc->fifoPtr and gc->fifoRoom
|
||||
mov eax, fifo
|
||||
@@ -883,7 +827,7 @@ __nextVertex:
|
||||
;; return 1 (triangle drawn)
|
||||
mov eax, 1h
|
||||
|
||||
__triDone:
|
||||
.__triDone:
|
||||
;; Restore trashed registers
|
||||
mov ecx, [gc + trisProcessed]
|
||||
pop ebp
|
||||
@@ -895,6 +839,6 @@ __triDone:
|
||||
mov [gc + trisProcessed], ecx
|
||||
|
||||
pop esi
|
||||
ret 12
|
||||
ENDIF ; !GLIDE_CLIP_COOR
|
||||
ENDIF ; !GL_AMD3D
|
||||
ret
|
||||
%ENDIF ; !GLIDE_CLIP_COOR
|
||||
%ENDIF ; !GL_AMD3D
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
159
glide3x/h3/glide3/src/xos.inc
Normal file
159
glide3x/h3/glide3/src/xos.inc
Normal file
@@ -0,0 +1,159 @@
|
||||
;
|
||||
; compulsory header for h5/glide3/xdraw* assembly specializations (NASM)
|
||||
;
|
||||
; $Header$
|
||||
; $Log$
|
||||
; Revision 1.1.2.2 2003/06/13 07:22:59 dborca
|
||||
; more fixes to NASM sources
|
||||
;
|
||||
; Revision 1.1.2.1 2003/06/07 09:53:25 dborca
|
||||
; initial checkin for NASM sources
|
||||
;
|
||||
|
||||
;---------------------------------------
|
||||
; platform defines
|
||||
;---------------------------------------
|
||||
%define XOS_DJGPP 1
|
||||
%define XOS_LINUX 2
|
||||
%define XOS_WIN32 4
|
||||
|
||||
%define STDCALL 0
|
||||
|
||||
;---------------------------------------
|
||||
; pick up the right OS
|
||||
;---------------------------------------
|
||||
%ifdef __DJGPP__
|
||||
%define XOS XOS_DJGPP
|
||||
%elifdef __linux__
|
||||
%define XOS XOS_LINUX
|
||||
%elifdef __WIN32__
|
||||
%define XOS XOS_WIN32
|
||||
%define STDCALL 1
|
||||
%else
|
||||
%error Unknown OS
|
||||
%endif
|
||||
|
||||
;---------------------------------------
|
||||
; general purpose macros
|
||||
;---------------------------------------
|
||||
%macro extrn 1-2 0
|
||||
%if (XOS == XOS_WIN32) && STDCALL && (%2 > 0)
|
||||
%define %1 %1@%2
|
||||
%endif
|
||||
extern %1
|
||||
%endmacro
|
||||
|
||||
%macro globl 1-2 0
|
||||
%if (XOS == XOS_WIN32) && STDCALL && (%2 > 0)
|
||||
%define %1 %1@%2
|
||||
%endif
|
||||
global %1
|
||||
%endmacro
|
||||
|
||||
%macro proc 1-2 0
|
||||
%push proc
|
||||
%if STDCALL && (%2 > 0)
|
||||
%define %$ret RET %2
|
||||
%else
|
||||
%define %$ret RET
|
||||
%endif
|
||||
globl %1, %2
|
||||
%1:
|
||||
%endmacro
|
||||
|
||||
%macro endp 0
|
||||
%ifnctx proc
|
||||
%error Mismatched `endp'/`proc'
|
||||
%else
|
||||
%pop
|
||||
%endif
|
||||
%endmacro
|
||||
|
||||
%macro ret 0
|
||||
%ifnctx proc
|
||||
RET
|
||||
%else
|
||||
%$ret
|
||||
%endif
|
||||
%endmacro
|
||||
|
||||
%macro invoke 1-*
|
||||
%rep %0 - 1
|
||||
%rotate -1
|
||||
push %1
|
||||
%endrep
|
||||
%rotate -1
|
||||
call %1
|
||||
%if (STDCALL == 0) && (%0 > 1)
|
||||
add esp, 4 * (%0 - 1)
|
||||
%endif
|
||||
%endmacro
|
||||
|
||||
;---------------------------------------
|
||||
; Windows
|
||||
;---------------------------------------
|
||||
%if XOS == XOS_WIN32
|
||||
|
||||
%define TEXT .text align=32
|
||||
%define DATA .data align=32
|
||||
%define CONST .rdata align=32
|
||||
|
||||
%macro SET_TLSBASE 1
|
||||
mov %1, dword [fs:18h] ; get thread local storage base pointer
|
||||
%endmacro
|
||||
|
||||
%macro SET_TLSOFFSET 1
|
||||
mov %1, [_GlideRoot+tlsOffset] ; offset of GC into tls
|
||||
%endmacro
|
||||
|
||||
%macro GET_GC 2
|
||||
mov gc, [%1 + %2]
|
||||
%endmacro
|
||||
|
||||
%endif
|
||||
|
||||
;---------------------------------------
|
||||
; DJGPP
|
||||
;---------------------------------------
|
||||
%if XOS == XOS_DJGPP
|
||||
|
||||
%define TEXT .text
|
||||
%define DATA .data
|
||||
%define CONST .rodata
|
||||
|
||||
extrn threadValueDJGPP
|
||||
|
||||
%macro SET_TLSBASE 1
|
||||
%endmacro
|
||||
|
||||
%macro SET_TLSOFFSET 1
|
||||
%endmacro
|
||||
|
||||
%macro GET_GC 2
|
||||
mov gc, [threadValueDJGPP]
|
||||
%endmacro
|
||||
|
||||
%endif
|
||||
|
||||
;---------------------------------------
|
||||
; Linux
|
||||
;---------------------------------------
|
||||
%if XOS == XOS_LINUX
|
||||
|
||||
%define TEXT .text align=32
|
||||
%define DATA .data align=32
|
||||
%define CONST .rodata align=32
|
||||
|
||||
extrn threadValueLinux
|
||||
|
||||
%macro SET_TLSBASE 1
|
||||
%endmacro
|
||||
|
||||
%macro SET_TLSOFFSET 1
|
||||
%endmacro
|
||||
|
||||
%macro GET_GC 2
|
||||
mov gc, [threadValueLinux]
|
||||
%endmacro
|
||||
|
||||
%endif
|
||||
@@ -19,9 +19,18 @@
|
||||
;; $Header$
|
||||
;; $Revision$
|
||||
;; $Log$
|
||||
;; Revision 1.1.8.7 2003/09/12 05:08:35 koolsmoky
|
||||
;; preparing for graphic context checks
|
||||
;;
|
||||
;; Revision 1.1.8.6 2003/07/07 23:29:06 koolsmoky
|
||||
;; cleaned logs
|
||||
;;
|
||||
;;
|
||||
;; Revision 1.1 2000/06/15 00:27:43 joseph
|
||||
;; Initial checkin into SourceForge.
|
||||
;;
|
||||
;; 5 4/08/99 6:21p Atai
|
||||
;; added contect check for _grTexDownload_3DNow_MMX
|
||||
;; 10 8/17/99 6:35p Atai
|
||||
;; fixed amd debug mode
|
||||
;;
|
||||
;; 9 4/08/99 1:22p Atai
|
||||
;; added contect check for _grTexDownload_3DNow_MMX
|
||||
@@ -45,7 +54,7 @@
|
||||
;; added #ifdefs for hwc
|
||||
;;
|
||||
;; 2 10/14/98 12:05p Peter
|
||||
;; fixed my f*cked up assumption about non-volatile regs
|
||||
;; fixed my effed up assumption about non-volatile regs
|
||||
;;
|
||||
;; 1 10/09/98 6:48p Peter
|
||||
;; 3DNow!(tm) version of wide texture downloads
|
||||
@@ -60,54 +69,55 @@
|
||||
;; mmx stuff for 3DNow!(tm) capable processors
|
||||
;;
|
||||
|
||||
TITLE xtexdl.asm
|
||||
OPTION OLDSTRUCTS
|
||||
%include "xos.inc"
|
||||
|
||||
.586P
|
||||
.MMX
|
||||
.K3D
|
||||
|
||||
ifdef USE_PACKET_FIFO
|
||||
EXTRN __grCommandTransportMakeRoom@12: NEAR
|
||||
endif
|
||||
%ifdef USE_PACKET_FIFO
|
||||
extrn _grCommandTransportMakeRoom, 12
|
||||
%endif
|
||||
|
||||
;;; Definitions of cvg regs and glide root structures.
|
||||
INCLUDE fxgasm.h
|
||||
%INCLUDE "fxgasm.h"
|
||||
|
||||
; Arguments (STKOFF = 16 from 4 dword pushes)
|
||||
STACKOFFSET = 16
|
||||
_gc$ = 4 + STACKOFFSET
|
||||
_baseAddr$ = 8 + STACKOFFSET
|
||||
_maxS$ = 12 + STACKOFFSET
|
||||
_minT$ = 16 + STACKOFFSET
|
||||
_maxT$ = 20 + STACKOFFSET
|
||||
_texData$ = 24 + STACKOFFSET
|
||||
STACKOFFSET equ 16
|
||||
_gc$ equ 4 + STACKOFFSET
|
||||
_baseAddr$ equ 8 + STACKOFFSET
|
||||
_maxS$ equ 12 + STACKOFFSET
|
||||
_minT$ equ 16 + STACKOFFSET
|
||||
_maxT$ equ 20 + STACKOFFSET
|
||||
_texData$ equ 24 + STACKOFFSET
|
||||
|
||||
;; NB: The first set of registers (eax, ecx, and edx) are volatile across
|
||||
;; function calls. The remaining registers are supposedly non-volatile
|
||||
;; so they only store things that are non-volatile across the call.
|
||||
|
||||
fifo TEXTEQU <ebp> ; fifo ptr in inner loop
|
||||
gc TEXTEQU <esi> ; graphics context
|
||||
dataPtr TEXTEQU <edi> ; pointer to exture data to be downloaded
|
||||
curT TEXTEQU <ebx> ; counter for texture scan lines (t-coordinate)
|
||||
curS TEXTEQU <ecx> ; texture s-coordinate
|
||||
fRoom TEXTEQU <edx> ; room available in fifo (in bytes)
|
||||
|
||||
GR_FIFO_WRITE MACRO __addr, __offset, __data
|
||||
mov [__addr + __offset], __data
|
||||
ENDM ; GR_FIFO_WRITE
|
||||
%define fifo ebp ; fifo ptr in inner loop
|
||||
%define gc esi ; graphics context
|
||||
%define dataPtr edi ; pointer to exture data to be downloaded
|
||||
%define curT ebx ; counter for texture scan lines (t-coordinate)
|
||||
%define curS ecx ; texture s-coordinate
|
||||
%define fRoom edx ; room available in fifo (in bytes)
|
||||
|
||||
;--------------------------------------------------------------------------
|
||||
|
||||
_TEXT SEGMENT PAGE PUBLIC USE32 'CODE'
|
||||
ASSUME DS: FLAT, SS: FLAT
|
||||
%IFNDEF GL_SSE2
|
||||
|
||||
;--------------------------------------------------------------------------
|
||||
;
|
||||
; GL_AMD3D, GL_MMX
|
||||
;
|
||||
;--------------------------------------------------------------------------
|
||||
|
||||
segment TEXT
|
||||
|
||||
ALIGN 32
|
||||
|
||||
PUBLIC __grTexDownload_3DNow_MMX@24
|
||||
|
||||
__grTexDownload_3DNow_MMX@24 PROC NEAR
|
||||
%IFDEF GL_AMD3D
|
||||
proc _grTexDownload_3DNow_MMX, 24
|
||||
%ENDIF
|
||||
%IFDEF GL_MMX
|
||||
proc _grTexDownload_MMX, 24
|
||||
%ENDIF
|
||||
|
||||
push ebx ; save caller's register variable
|
||||
mov curT, [esp + _maxT$ - 12] ; curT = maxT
|
||||
@@ -121,14 +131,18 @@ __grTexDownload_3DNow_MMX@24 PROC NEAR
|
||||
push ebp ; save caller's register variable
|
||||
mov dataPtr, [esp + _texData$]; dataPtr
|
||||
|
||||
IFDEF GLIDE_ALT_TAB
|
||||
%IFDEF GLIDE_ALT_TAB
|
||||
test gc, gc
|
||||
je __dlDone
|
||||
mov edx, DWORD PTR [gc+lostContext]
|
||||
je .dlDone
|
||||
; mov edx, [gc + windowed]
|
||||
; test edx, 1
|
||||
; jnz .pastContextTest
|
||||
mov edx, DWORD [gc+lostContext]
|
||||
mov ecx, [edx]
|
||||
test ecx, 1
|
||||
jnz __dlDone
|
||||
ENDIF
|
||||
jnz .dlDone
|
||||
;.pastContextTest:
|
||||
%ENDIF
|
||||
|
||||
sub curT, eax ; curT = maxT - minT
|
||||
mov fifo, [gc + fifoPtr] ; fifoPtr
|
||||
@@ -136,7 +150,12 @@ ENDIF
|
||||
mov curS, [esp + _maxS$] ; curS = maxS
|
||||
add curT, 1 ; curT = maxT - minT + 1
|
||||
|
||||
%IFDEF GL_AMD3D
|
||||
femms ; we'll use MMX/3DNow!, make sure FPU register cleared
|
||||
%ENDIF
|
||||
%IFDEF GL_MMX
|
||||
emms ; we'll use MMX
|
||||
%ENDIF
|
||||
|
||||
mov edx, curS ; curS = maxS = scanline width in DWORDs
|
||||
movd mm3, [esp + _baseAddr$] ; 0 | address of texture to download
|
||||
@@ -167,18 +186,14 @@ ENDIF
|
||||
;; edx = fifoRoom, mm1 = texAddr|packetHdr, mm2 = TEX_ROW_ADDR_INCR(1)|0
|
||||
|
||||
test fifo, 4 ; is fifo QWORD aligned ?
|
||||
jz __startDownload ; yup, start texture download
|
||||
jz .startDownload ; yup, start texture download
|
||||
|
||||
cmp fRoom, 4 ; enough room for NULL packet in fifo?
|
||||
jge __mmxAlignFifo ; yes, write NULL packet to align fifo
|
||||
jge .mmxAlignFifo ; yes, write NULL packet to align fifo
|
||||
|
||||
ifdef USE_PACKET_FIFO
|
||||
push @Line ; Line # inside this function
|
||||
push 0 ; NULL file name
|
||||
|
||||
push 4 ; fifo space required (bytes)
|
||||
call __grCommandTransportMakeRoom@12 ; make fifo room
|
||||
endif
|
||||
%ifdef USE_PACKET_FIFO
|
||||
invoke _grCommandTransportMakeRoom, 4, 0, __LINE__; make fifo room
|
||||
%endif
|
||||
|
||||
mov fifo, [gc + fifoPtr] ; fifoPtr modified by _grCommandTransportMakeRoom, reload
|
||||
|
||||
@@ -186,37 +201,41 @@ endif
|
||||
mov curS, [esp + _maxS$] ; reload maxS (destroyed by call to _grCommandTransportMakeRoom)
|
||||
|
||||
test fifo, 4 ; new fifoPtr QWORD aligned ?
|
||||
jz __startDownload ; yup, start texture download
|
||||
jz .startDownload ; yup, start texture download
|
||||
|
||||
__mmxAlignFifo:
|
||||
.mmxAlignFifo:
|
||||
|
||||
mov DWORD PTR [fifo], 0 ; write NULL packet
|
||||
mov DWORD [fifo], 0 ; write NULL packet
|
||||
sub fRoom, 4 ; fifoRoom -= 4
|
||||
|
||||
mov [gc + fifoRoom], fRoom ; store new fifoRoom
|
||||
add fifo, 4 ; fifoPtr += 4
|
||||
|
||||
%IFDEF GLIDE_DEBUG
|
||||
mov [gc + checkPtr], fifo ; checkPtr
|
||||
%ENDIF
|
||||
|
||||
mov [gc + fifoPtr], fifo ; store new fifoPtr
|
||||
jmp __startDownload ; fifo aligned, download texture now
|
||||
jmp .startDownload ; fifo aligned, download texture now
|
||||
|
||||
align 32
|
||||
|
||||
;; ebx = curT, edi = dataPtr, esi = gc, ebp = fifo, ecx = maxS = curS
|
||||
;; edx=fifoRoom, mm1 = texAddr|packetHdr, mm2 = TEX_ROW_ADDR_INCR(1)|0
|
||||
|
||||
__loopT:
|
||||
.loopT:
|
||||
|
||||
IFDEF GLIDE_DEBUG
|
||||
%IFDEF GLIDE_DEBUG
|
||||
|
||||
;; Make sure that we have a QWORD aligned fifoPtr; force GP if not aligned
|
||||
|
||||
test fifo, 4 ; is fifoPtr QWORD aligned ?
|
||||
jz __alignmentOK ; yup, continue
|
||||
jz .alignmentOK ; yup, continue
|
||||
|
||||
xor eax, eax ; create 0
|
||||
mov [eax], eax ; move to DS:[0] forces GP
|
||||
__alignmentOK:
|
||||
ENDIF ; GLIDE_DEBUG
|
||||
.alignmentOK:
|
||||
%ENDIF ; GLIDE_DEBUG
|
||||
|
||||
;; Compute packet header words
|
||||
;; hdr1: downloadSpace[31:30] numWords[21:3] packetType[2:0]
|
||||
@@ -227,7 +246,7 @@ ENDIF ; GLIDE_DEBUG
|
||||
|
||||
;; S coordinate inner loop unrolled for 8 texels a write
|
||||
|
||||
__loopS:
|
||||
.loopS:
|
||||
|
||||
movq mm0, [dataPtr] ; load 64 bit data (8 texels)
|
||||
add fifo, 8 ; pre-increment fifoPtr += 2 * sizeof(FxU32)
|
||||
@@ -236,7 +255,7 @@ __loopS:
|
||||
sub curS, 8 ; curS -= 2 * sizeof(FxU32)
|
||||
|
||||
movq [fifo - 8], mm0 ; *fifoPtr = texelData[64 bits]
|
||||
jnz __loopS ; loop while curS > 0
|
||||
jnz .loopS ; loop while curS > 0
|
||||
|
||||
mov ecx, [gc + fifoPtr] ; old fifo ptr
|
||||
nop ; filler
|
||||
@@ -244,6 +263,10 @@ __loopS:
|
||||
mov eax, fifo ; new fifo ptr
|
||||
mov [gc + fifoPtr], fifo ; save new fifo ptr
|
||||
|
||||
%IFDEF GLIDE_DEBUG
|
||||
mov [gc + checkPtr], fifo ; checkPtr
|
||||
%ENDIF
|
||||
|
||||
sub eax, ecx ; new fifo ptr - old fifo ptr = fifo space used up
|
||||
mov curS, [esp + _maxS$] ; curS = maxS = width of scanline (bytes)
|
||||
|
||||
@@ -251,7 +274,7 @@ __loopS:
|
||||
sub curT, 1 ; curT--
|
||||
|
||||
mov [gc + fifoRoom], fRoom ; save new fifo space available
|
||||
jz __dlDone ; loop while curT > 0
|
||||
jz .dlDone ; loop while curT > 0
|
||||
|
||||
;; Check for room to write the next texture scanline
|
||||
|
||||
@@ -260,40 +283,426 @@ __loopS:
|
||||
|
||||
paddd mm1, mm2 ; texAddr+=TEX_ROW_ADDR_INCR(1) | packetHdr
|
||||
mov esp, esp ; filler
|
||||
__startDownload:
|
||||
.startDownload:
|
||||
lea eax, [curS+8] ; fifo space needed = scan line width + header size
|
||||
|
||||
cmp fRoom, eax ; fifo space available >= fifo space required ?
|
||||
jge __loopT ; yup, write next scan line
|
||||
jge .loopT ; yup, write next scan line
|
||||
|
||||
ifdef USE_PACKET_FIFO
|
||||
push @Line ; Line # inside this function
|
||||
push 0h ; NULL file name
|
||||
|
||||
push eax ; fifo space required
|
||||
call __grCommandTransportMakeRoom@12 ; make fifo room (if fifoPtr QWORD aligned before
|
||||
endif
|
||||
%ifdef USE_PACKET_FIFO
|
||||
invoke _grCommandTransportMakeRoom, eax, 0, __LINE__; make fifo room (if fifoPtr QWORD aligned before
|
||||
%endif
|
||||
|
||||
mov fifo, [gc + fifoPtr] ; fifoPtr was modified by _grCommandTransportMakeRoom, reload
|
||||
|
||||
mov fRoom, [gc + fifoRoom] ; fifoRoom was modified by _grCommandTransportMakeRoom, reload
|
||||
mov curS, [esp + _maxS$] ; curS = maxS = width of scanline (bytes)
|
||||
jmp __loopT ; we now have enough fifo room, write next scanline
|
||||
|
||||
__dlDone:
|
||||
jmp .loopT ; we now have enough fifo room, write next scanline
|
||||
|
||||
.dlDone:
|
||||
%IFDEF GL_AMD3D
|
||||
femms ; exit 3DNow!(tm) state
|
||||
|
||||
%ENDIF
|
||||
%IFDEF GL_MMX
|
||||
emms ; exit MMX state
|
||||
%ENDIF
|
||||
|
||||
pop ebp ; restore caller's register variable
|
||||
pop edi ; restore caller's register variable
|
||||
|
||||
pop esi ; restore caller's register variable
|
||||
pop ebx ; restore caller's register variable
|
||||
|
||||
ret 24 ; pop 6 DWORD parameters and return
|
||||
ret ; pop 6 DWORD parameters and return
|
||||
endp
|
||||
|
||||
__grTexDownload_3DNow_MMX@24 ENDP
|
||||
%ELSE ; !GL_SSE2
|
||||
|
||||
_TEXT ENDS
|
||||
;--------------------------------------------------------------------------
|
||||
;
|
||||
; GL_SSE2
|
||||
;
|
||||
;--------------------------------------------------------------------------
|
||||
|
||||
END
|
||||
segment TEXT
|
||||
|
||||
ALIGN 32
|
||||
|
||||
proc _grTexDownload_SSE2_64, 24
|
||||
|
||||
push ebx ; save caller's register variable
|
||||
mov curT, [esp + _maxT$ - 12] ; curT = maxT
|
||||
|
||||
push esi ; save caller's register variable
|
||||
mov eax, [esp + _minT$ - 8] ; minT
|
||||
|
||||
push edi ; save caller's register variable
|
||||
mov gc, [esp + _gc$ - 4] ; gc
|
||||
|
||||
push ebp ; save caller's register variable
|
||||
mov dataPtr, [esp + _texData$]; dataPtr
|
||||
|
||||
%IFDEF GLIDE_ALT_TAB
|
||||
test gc, gc
|
||||
je .dlDone
|
||||
; mov edx, [gc + windowed]
|
||||
; test edx, 1
|
||||
; jnz .pastContextTest
|
||||
mov edx, DWORD [gc+lostContext]
|
||||
mov ecx, [edx]
|
||||
test ecx, 1
|
||||
jnz .dlDone
|
||||
;.pastContextTest:
|
||||
%ENDIF
|
||||
|
||||
sub curT, eax ; curT = maxT - minT
|
||||
mov fifo, [gc + fifoPtr] ; fifoPtr
|
||||
|
||||
mov curS, [esp + _maxS$] ; curS = maxS
|
||||
add curT, 1 ; curT = maxT - minT + 1
|
||||
|
||||
mov edx, curS ; curS = maxS = scanline width in DWORDs
|
||||
movd xmm3,[esp + _baseAddr$] ; 0 | 0 | 0 | address of texture to download
|
||||
|
||||
shl curS, 2 ; scan line width (in bytes)
|
||||
mov eax, [esp + _minT$] ; 0 | 0 | 0 | minT
|
||||
|
||||
mov [esp + _maxS$], curS ; save scan line width (in bytes)
|
||||
shl edx, 3 ; packetHdr<21:3> = maxS = scanline width in DWORDs
|
||||
|
||||
imul eax, curS ; TEX_ROW_ADDR_INCR(minT) = minT * TEX_ROW_ADDR_INCR(1)
|
||||
|
||||
movd xmm2,curS ; 0 | 0 | TEX_ROW_ADDR_INCR(1)
|
||||
or edx, 00000005h ; packetHdr<31:30> = lfb port
|
||||
; packetHdr<21:3> = maxS
|
||||
; packetHdr<2:0> = packetType 5
|
||||
|
||||
movd xmm1,edx ; 0 | 0 | packetHdr
|
||||
movd xmm4,eax ; 0 | 0 | TEX_ROW_ADDR_INCR(minT)
|
||||
|
||||
psllq xmm2,32 ; 0 | 0 | TEX_ROW_ADDR_INCR(1) | 0
|
||||
paddd xmm3,xmm4 ; 0 | 0 | texAddr = texBaseAddr + TEX_ROW_ADDR_INCR(minT)
|
||||
|
||||
mov fRoom, [gc + fifoRoom] ; get available fifoRoom (in bytes)
|
||||
punpckldq xmm1,xmm3 ; 0 | 0 | hdr2 = texAddr | hdr1 = packetHdr
|
||||
|
||||
;; ebx = curT, edi = dataPtr, esi = gc, ebp = fifo, ecx = curS = maxS
|
||||
;; edx = fifoRoom, xmm1 = texAddr|packetHdr, xmm2 = TEX_ROW_ADDR_INCR(1)|0
|
||||
|
||||
test fifo, 4 ; is fifo QWORD aligned ?
|
||||
jz .startDownload ; yup, start texture download
|
||||
|
||||
cmp fRoom, 4 ; enough room for NULL packet in fifo?
|
||||
jge .xmmAlignFifo ; yes, write NULL packet to align fifo
|
||||
|
||||
%ifdef USE_PACKET_FIFO
|
||||
invoke _grCommandTransportMakeRoom, 4, 0, __LINE__; make fifo room
|
||||
%endif
|
||||
|
||||
mov fifo, [gc + fifoPtr] ; fifoPtr modified by _grCommandTransportMakeRoom, reload
|
||||
|
||||
mov fRoom, [gc + fifoRoom] ; fifoRoom modified by _grCommandTransportMakeRoom, reload
|
||||
mov curS, [esp + _maxS$] ; reload maxS (destroyed by call to _grCommandTransportMakeRoom)
|
||||
|
||||
test fifo, 4 ; new fifoPtr QWORD aligned ?
|
||||
jz .startDownload ; yup, start texture download
|
||||
|
||||
.xmmAlignFifo:
|
||||
|
||||
mov DWORD [fifo], 0 ; write NULL packet
|
||||
sub fRoom, 4 ; fifoRoom -= 4
|
||||
|
||||
mov [gc + fifoRoom], fRoom ; store new fifoRoom
|
||||
add fifo, 4 ; fifoPtr += 4
|
||||
|
||||
%IFDEF GLIDE_DEBUG
|
||||
mov [gc + checkPtr], fifo ; checkPtr
|
||||
%ENDIF
|
||||
|
||||
mov [gc + fifoPtr], fifo ; store new fifoPtr
|
||||
jmp .startDownload ; fifo aligned, download texture now
|
||||
|
||||
align 32
|
||||
|
||||
;; ebx = curT, edi = dataPtr, esi = gc, ebp = fifo, ecx = maxS = curS
|
||||
;; edx=fifoRoom, xmm1 = texAddr|packetHdr, xmm2 = TEX_ROW_ADDR_INCR(1)|0
|
||||
|
||||
.loopT:
|
||||
|
||||
%IFDEF GLIDE_DEBUG
|
||||
|
||||
;; Make sure that we have a QWORD aligned fifoPtr; force GP if not aligned
|
||||
|
||||
test fifo, 4 ; is fifoPtr QWORD aligned ?
|
||||
jz .alignmentOK ; yup, continue
|
||||
|
||||
xor eax, eax ; create 0
|
||||
mov [eax], eax ; move to DS:[0] forces GP
|
||||
.alignmentOK:
|
||||
%ENDIF ; GLIDE_DEBUG
|
||||
|
||||
;; Compute packet header words
|
||||
;; hdr1: downloadSpace[31:30] numWords[21:3] packetType[2:0]
|
||||
;; hdr2: download address[29:0]
|
||||
|
||||
movq [fifo],xmm1 ; store hdr2 | hdr1
|
||||
add fifo, 8 ; increment fifo ptr (hdr1 + hdr2)
|
||||
|
||||
;; S coordinate inner loop unrolled for 8 texels a write
|
||||
|
||||
.loopS:
|
||||
|
||||
movq xmm0,[dataPtr] ; load 64 bit data (8 texels)
|
||||
add fifo, 8 ; pre-increment fifoPtr += 2 * sizeof(FxU32)
|
||||
|
||||
add dataPtr, 8 ; dataPtr += 2 * sizeof(FxU32)
|
||||
sub curS, 8 ; curS -= 2 * sizeof(FxU32)
|
||||
|
||||
movq [fifo - 8],xmm0 ; *fifoPtr = texelData[64 bits]
|
||||
jnz .loopS ; loop while curS > 0
|
||||
|
||||
mov ecx, [gc + fifoPtr] ; old fifo ptr
|
||||
nop ; filler
|
||||
|
||||
mov eax, fifo ; new fifo ptr
|
||||
mov [gc + fifoPtr], fifo ; save new fifo ptr
|
||||
|
||||
%IFDEF GLIDE_DEBUG
|
||||
mov [gc + checkPtr], fifo ; checkPtr
|
||||
%ENDIF
|
||||
|
||||
sub eax, ecx ; new fifo ptr - old fifo ptr = fifo space used up
|
||||
mov curS, [esp + _maxS$] ; curS = maxS = width of scanline (bytes)
|
||||
|
||||
sub fRoom, eax ; new fifo space available = old fifo space available - fifo space used up = new fifo space available
|
||||
sub curT, 1 ; curT--
|
||||
|
||||
mov [gc + fifoRoom], fRoom ; save new fifo space available
|
||||
jz .dlDone ; loop while curT > 0
|
||||
|
||||
;; Check for room to write the next texture scanline
|
||||
|
||||
;; ebx = curT, edi = dataPtr, esi = gc, ebp = fifo
|
||||
;; edx = fifoRoom, xmm1 = texAddr|packetHdr, xmm2 = TEX_ROW_ADDR_INCR(1)|0
|
||||
|
||||
paddd xmm1,xmm2 ; 0 | 0 | texAddr+=TEX_ROW_ADDR_INCR(1) | packetHdr
|
||||
mov esp, esp ; filler
|
||||
.startDownload:
|
||||
lea eax, [curS+8] ; fifo space needed = scan line width + header size
|
||||
|
||||
cmp fRoom, eax ; fifo space available >= fifo space required ?
|
||||
jge .loopT ; yup, write next scan line
|
||||
|
||||
%ifdef USE_PACKET_FIFO
|
||||
invoke _grCommandTransportMakeRoom, eax, 0, __LINE__; make fifo room (if fifoPtr QWORD aligned before
|
||||
%endif
|
||||
|
||||
mov fifo, [gc + fifoPtr] ; fifoPtr was modified by _grCommandTransportMakeRoom, reload
|
||||
|
||||
mov fRoom, [gc + fifoRoom] ; fifoRoom was modified by _grCommandTransportMakeRoom, reload
|
||||
mov curS, [esp + _maxS$] ; curS = maxS = width of scanline (bytes)
|
||||
jmp .loopT ; we now have enough fifo room, write next scanline
|
||||
|
||||
.dlDone:
|
||||
pop ebp ; restore caller's register variable
|
||||
pop edi ; restore caller's register variable
|
||||
|
||||
pop esi ; restore caller's register variable
|
||||
pop ebx ; restore caller's register variable
|
||||
|
||||
ret ; pop 6 DWORD parameters and return
|
||||
endp
|
||||
|
||||
|
||||
|
||||
segment TEXT
|
||||
|
||||
ALIGN 32
|
||||
|
||||
proc _grTexDownload_SSE2_128, 24
|
||||
|
||||
push ebx ; save caller's register variable
|
||||
mov curT, [esp + _maxT$ - 12] ; curT = maxT
|
||||
|
||||
push esi ; save caller's register variable
|
||||
mov eax, [esp + _minT$ - 8] ; minT
|
||||
|
||||
push edi ; save caller's register variable
|
||||
mov gc, [esp + _gc$ - 4] ; gc
|
||||
|
||||
push ebp ; save caller's register variable
|
||||
mov dataPtr, [esp + _texData$]; dataPtr
|
||||
|
||||
%IFDEF GLIDE_ALT_TAB
|
||||
test gc, gc
|
||||
je .dlDone
|
||||
; mov edx, [gc + windowed]
|
||||
; test edx, 1
|
||||
; jnz .pastContextTest
|
||||
mov edx, DWORD [gc+lostContext]
|
||||
mov ecx, [edx]
|
||||
test ecx, 1
|
||||
jnz .dlDone
|
||||
;.pastContextTest:
|
||||
%ENDIF
|
||||
|
||||
sub curT, eax ; curT = maxT - minT
|
||||
mov fifo, [gc + fifoPtr] ; fifoPtr
|
||||
|
||||
mov curS, [esp + _maxS$] ; curS = maxS
|
||||
add curT, 1 ; curT = maxT - minT + 1
|
||||
|
||||
mov edx, curS ; curS = maxS = scanline width in DWORDs
|
||||
movd xmm3,[esp + _baseAddr$] ; 0 | 0 | 0 | address of texture to download
|
||||
|
||||
shl curS, 2 ; scan line width (in bytes)
|
||||
mov eax, [esp + _minT$] ; 0 | minT
|
||||
|
||||
mov [esp + _maxS$], curS ; save scan line width (in bytes)
|
||||
shl edx, 3 ; packetHdr<21:3> = maxS = scanline width in DWORDs
|
||||
|
||||
imul eax, curS ; TEX_ROW_ADDR_INCR(minT) = minT * TEX_ROW_ADDR_INCR(1)
|
||||
|
||||
movd xmm2,curS ; 0 | 0 | 0 | TEX_ROW_ADDR_INCR(1)
|
||||
or edx, 00000005h ; packetHdr<31:30> = lfb port
|
||||
; packetHdr<21:3> = maxS
|
||||
; packetHdr<2:0> = packetType 5
|
||||
|
||||
movd xmm1,edx ; 0 | 0 | 0 | packetHdr
|
||||
movd xmm4,eax ; 0 | 0 | 0 | TEX_ROW_ADDR_INCR(minT)
|
||||
|
||||
psllq xmm2,32 ; 0 | 0 | TEX_ROW_ADDR_INCR(1) | 0
|
||||
paddd xmm3,xmm4 ; 0 | 0 | 0 | texAddr = texBaseAddr + TEX_ROW_ADDR_INCR(minT)
|
||||
|
||||
mov fRoom, [gc + fifoRoom] ; get available fifoRoom (in bytes)
|
||||
punpckldq xmm1,xmm3 ; 0 | 0 | hdr2 = texAddr | hdr1 = packetHdr
|
||||
|
||||
;; ebx = curT, edi = dataPtr, esi = gc, ebp = fifo, ecx = curS = maxS
|
||||
;; edx = fifoRoom, xmm1 = texAddr|packetHdr, xmm2 = TEX_ROW_ADDR_INCR(1)|0
|
||||
|
||||
test fifo, 4 ; is fifo QWORD aligned ?
|
||||
jz .startDownload ; yup, start texture download
|
||||
|
||||
cmp fRoom, 4 ; enough room for NULL packet in fifo?
|
||||
jge .xmmAlignFifo ; yes, write NULL packet to align fifo
|
||||
|
||||
%ifdef USE_PACKET_FIFO
|
||||
invoke _grCommandTransportMakeRoom, 4, 0, __LINE__; make fifo room
|
||||
%endif
|
||||
|
||||
mov fifo, [gc + fifoPtr] ; fifoPtr modified by _grCommandTransportMakeRoom, reload
|
||||
|
||||
mov fRoom, [gc + fifoRoom] ; fifoRoom modified by _grCommandTransportMakeRoom, reload
|
||||
mov curS, [esp + _maxS$] ; reload maxS (destroyed by call to _grCommandTransportMakeRoom)
|
||||
|
||||
test fifo, 4 ; new fifoPtr QWORD aligned ?
|
||||
jz .startDownload ; yup, start texture download
|
||||
|
||||
.xmmAlignFifo:
|
||||
|
||||
mov DWORD [fifo], 0 ; write NULL packet
|
||||
sub fRoom, 4 ; fifoRoom -= 4
|
||||
|
||||
mov [gc + fifoRoom], fRoom ; store new fifoRoom
|
||||
add fifo, 4 ; fifoPtr += 4
|
||||
|
||||
%IFDEF GLIDE_DEBUG
|
||||
mov [gc + checkPtr], fifo ; checkPtr
|
||||
%ENDIF
|
||||
|
||||
mov [gc + fifoPtr], fifo ; store new fifoPtr
|
||||
jmp .startDownload ; fifo aligned, download texture now
|
||||
|
||||
align 32
|
||||
|
||||
;; ebx = curT, edi = dataPtr, esi = gc, ebp = fifo, ecx = maxS = curS
|
||||
;; edx=fifoRoom, xmm1 = texAddr|packetHdr, xmm2 = TEX_ROW_ADDR_INCR(1)|0
|
||||
|
||||
.loopT:
|
||||
|
||||
%IFDEF GLIDE_DEBUG
|
||||
|
||||
;; Make sure that we have a QWORD aligned fifoPtr; force GP if not aligned
|
||||
|
||||
test fifo, 4 ; is fifoPtr QWORD aligned ?
|
||||
jz .alignmentOK ; yup, continue
|
||||
|
||||
xor eax, eax ; create 0
|
||||
mov [eax], eax ; move to DS:[0] forces GP
|
||||
.alignmentOK:
|
||||
%ENDIF ; GLIDE_DEBUG
|
||||
|
||||
;; Compute packet header words
|
||||
;; hdr1: downloadSpace[31:30] numWords[21:3] packetType[2:0]
|
||||
;; hdr2: download address[29:0]
|
||||
|
||||
movq [fifo],xmm1 ; store hdr2 | hdr1
|
||||
add fifo, 8 ; increment fifo ptr (hdr1 + hdr2)
|
||||
|
||||
;; S coordinate inner loop unrolled for 8 texels a write
|
||||
|
||||
.loopS:
|
||||
|
||||
movdqu xmm0, [dataPtr] ; load 128 bit data (8 texels) ; isn't 16 bytes aligned?
|
||||
add fifo, 16 ; pre-increment fifoPtr += 4 * sizeof(FxU32)
|
||||
|
||||
add dataPtr, 16 ; dataPtr += 4 * sizeof(FxU32)
|
||||
sub curS, 16 ; curS -= 4 * sizeof(FxU32)
|
||||
|
||||
movdqu [fifo - 16], xmm0 ; *fifoPtr = texelData[128 bits] ; isn't 16 bytes aligned?
|
||||
jnz .loopS ; loop while curS > 0
|
||||
|
||||
mov ecx, [gc + fifoPtr] ; old fifo ptr
|
||||
nop ; filler
|
||||
|
||||
mov eax, fifo ; new fifo ptr
|
||||
mov [gc + fifoPtr], fifo ; save new fifo ptr
|
||||
|
||||
%IFDEF GLIDE_DEBUG
|
||||
mov [gc + checkPtr], fifo ; checkPtr
|
||||
%ENDIF
|
||||
|
||||
sub eax, ecx ; new fifo ptr - old fifo ptr = fifo space used up
|
||||
mov curS, [esp + _maxS$] ; curS = maxS = width of scanline (bytes)
|
||||
|
||||
sub fRoom, eax ; new fifo space available = old fifo space available - fifo space used up = new fifo space available
|
||||
sub curT, 1 ; curT--
|
||||
|
||||
mov [gc + fifoRoom], fRoom ; save new fifo space available
|
||||
jz .dlDone ; loop while curT > 0
|
||||
|
||||
;; Check for room to write the next texture scanline
|
||||
|
||||
;; ebx = curT, edi = dataPtr, esi = gc, ebp = fifo
|
||||
;; edx = fifoRoom, xmm1 = texAddr|packetHdr, xmm2 = TEX_ROW_ADDR_INCR(1)|0
|
||||
|
||||
paddd xmm1,xmm2 ; 0 | 0 | texAddr+=TEX_ROW_ADDR_INCR(1) | packetHdr
|
||||
mov esp, esp ; filler
|
||||
.startDownload:
|
||||
lea eax, [curS+8] ; fifo space needed = scan line width + header size
|
||||
|
||||
cmp fRoom, eax ; fifo space available >= fifo space required ?
|
||||
jge .loopT ; yup, write next scan line
|
||||
|
||||
%ifdef USE_PACKET_FIFO
|
||||
invoke _grCommandTransportMakeRoom, eax, 0, __LINE__; make fifo room (if fifoPtr QWORD aligned before
|
||||
%endif
|
||||
|
||||
mov fifo, [gc + fifoPtr] ; fifoPtr was modified by _grCommandTransportMakeRoom, reload
|
||||
|
||||
mov fRoom, [gc + fifoRoom] ; fifoRoom was modified by _grCommandTransportMakeRoom, reload
|
||||
mov curS, [esp + _maxS$] ; curS = maxS = width of scanline (bytes)
|
||||
jmp .loopT ; we now have enough fifo room, write next scanline
|
||||
|
||||
.dlDone:
|
||||
pop ebp ; restore caller's register variable
|
||||
pop edi ; restore caller's register variable
|
||||
|
||||
pop esi ; restore caller's register variable
|
||||
pop ebx ; restore caller's register variable
|
||||
|
||||
ret ; pop 6 DWORD parameters and return
|
||||
endp
|
||||
|
||||
|
||||
%ENDIF ; GL_SSE2
|
||||
|
||||
238
glide3x/h3/minihwc/lin_mode.c
Normal file
238
glide3x/h3/minihwc/lin_mode.c
Normal file
@@ -0,0 +1,238 @@
|
||||
/*
|
||||
** 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$
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#if USE_XDGA_SWITCH
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/extensions/xf86dga.h>
|
||||
#include <X11/extensions/xf86vmode.h>
|
||||
static Display *dpy = 0;
|
||||
static XDGADevice *dev = 0;
|
||||
static XDGAMode *vidModes = 0;
|
||||
#endif
|
||||
|
||||
#include <minihwc.h>
|
||||
#include <hwcio.h>
|
||||
#include "h3cinit.h"
|
||||
#include "glide.h"
|
||||
#include "fxglide.h"
|
||||
|
||||
|
||||
#define CFG_FILE "/etc/conf.3dfx/voodoo3"
|
||||
|
||||
#if 1
|
||||
#define LOG(x)
|
||||
#else
|
||||
#define LOG(x) \
|
||||
do { \
|
||||
FILE *dbg = fopen("debug.txt","a"); \
|
||||
fprintf x ; \
|
||||
fclose(dbg); \
|
||||
} while(0);
|
||||
#endif
|
||||
|
||||
static struct envitem_t {
|
||||
char *env;
|
||||
char *val;
|
||||
struct envitem_t *next;
|
||||
} *first = NULL;
|
||||
|
||||
|
||||
static FxU32 saveVidProcCfg;
|
||||
static FxU32 saveLfbMemoryConfig;
|
||||
static FxU32 saveMiscInit0;
|
||||
|
||||
|
||||
FxBool setVideoMode(void *hwnd,
|
||||
int xRes,
|
||||
int yRes,
|
||||
int h3pixelSize,
|
||||
int refresh,
|
||||
void *hmon,
|
||||
char *regpath,
|
||||
char *devicename)
|
||||
{
|
||||
GR_DCL_GC;
|
||||
hwcBoardInfo *bInfo = gc->bInfo;
|
||||
|
||||
#if USE_XDGA_SWITCH
|
||||
int eventbase, errorbase;
|
||||
int i, numModes;
|
||||
|
||||
dpy=XOpenDisplay("");
|
||||
if (!dpy) {
|
||||
GDBG_INFO(80, "Failed to open X display\n");
|
||||
return FXFALSE;
|
||||
}
|
||||
|
||||
if (XDGAQueryExtension(dpy, &eventbase, &errorbase)) {
|
||||
int major, minor;
|
||||
XDGAQueryVersion(dpy, &major, &minor);
|
||||
if (major>1 && minor<0) {
|
||||
XCloseDisplay(dpy);
|
||||
GDBG_INFO(80, "Banshee/V3 requires DGA version 1.x\n");
|
||||
return FXFALSE;
|
||||
}
|
||||
}
|
||||
|
||||
vidModes = XDGAQueryModes(dpy, DefaultScreen(dpy), &numModes);
|
||||
|
||||
for (i=0; i<numModes; i++)
|
||||
if ((vidModes[i].viewportWidth==xRes) &&
|
||||
(vidModes[i].viewportHeight==yRes))
|
||||
break;
|
||||
if (i==numModes) {
|
||||
GDBG_INFO(80, "Server doesn't support requested resolution\n");
|
||||
vidModes=0;
|
||||
return FXFALSE;
|
||||
}
|
||||
if ((dev = XDGASetMode(dpy, DefaultScreen(dpy), vidModes[i].num)) == NULL) {
|
||||
GDBG_INFO(80, "Failed to set required video mode\n");
|
||||
return FXFALSE;
|
||||
}
|
||||
XDGASync(dpy, False);
|
||||
#else
|
||||
if (!h3InitSetVideoMode(bInfo->regInfo.ioPortBase, xRes, yRes, refresh, FXTRUE)) {
|
||||
GDBG_INFO(80, "Setmode failed -- unimplemented resolution\n");
|
||||
return FXFALSE;
|
||||
}
|
||||
#endif
|
||||
|
||||
HWC_IO_LOAD(bInfo->regInfo, vidProcCfg, saveVidProcCfg);
|
||||
HWC_IO_LOAD(bInfo->regInfo, lfbMemoryConfig, saveLfbMemoryConfig);
|
||||
HWC_IO_LOAD(bInfo->regInfo, miscInit0, saveMiscInit0);
|
||||
|
||||
return FXTRUE;
|
||||
} /* setVideoMode */
|
||||
|
||||
|
||||
void resetVideo (void)
|
||||
{
|
||||
GR_DCL_GC;
|
||||
hwcBoardInfo *bInfo = gc->bInfo;
|
||||
|
||||
HWC_IO_STORE(bInfo->regInfo, lfbMemoryConfig, saveLfbMemoryConfig);
|
||||
HWC_IO_STORE(bInfo->regInfo, vidProcCfg, saveVidProcCfg);
|
||||
HWC_IO_STORE(bInfo->regInfo, miscInit0, saveMiscInit0);
|
||||
|
||||
#if USE_XDGA_SWITCH
|
||||
if (dpy) {
|
||||
if (!XDGASetMode(dpy, DefaultScreen(dpy), 0)) {
|
||||
GDBG_INFO(80, "Failed to return to previous video mode\n");
|
||||
}
|
||||
vidModes = NULL;
|
||||
XCloseDisplay(dpy);
|
||||
dpy = NULL;
|
||||
XFree(dev);
|
||||
}
|
||||
#else
|
||||
/* XXX to do */
|
||||
#endif
|
||||
|
||||
GDBG_INFO(80, "resetVideo(): \n");
|
||||
} /* resetVideo */
|
||||
|
||||
|
||||
static void loadEnvFile (void)
|
||||
{
|
||||
FILE *file;
|
||||
char data[256];
|
||||
char *env, *val;
|
||||
struct envitem_t *item;
|
||||
FxBool sawError = FXFALSE;
|
||||
static FxBool envinit = FXFALSE;
|
||||
|
||||
if (envinit) {
|
||||
return;
|
||||
}
|
||||
envinit = FXTRUE;
|
||||
if ((file = fopen(CFG_FILE, "r")) == NULL) {
|
||||
return;
|
||||
}
|
||||
while (fgets(data, 255, file) != NULL) {
|
||||
if ((*data=='#') || (*data=='\n')) {
|
||||
continue;
|
||||
}
|
||||
if ((val = strchr(data, '=')) == NULL) {
|
||||
if (!sawError) {
|
||||
sawError = FXTRUE;
|
||||
fprintf(stderr, "In config file " CFG_FILE ":\n");
|
||||
}
|
||||
fprintf(stderr, "Malformed line: %s\n", data);
|
||||
continue;
|
||||
}
|
||||
*val++ = '\0';
|
||||
env = data;
|
||||
item = malloc(sizeof(struct envitem_t));
|
||||
item->env = malloc(strlen(env)+1);
|
||||
strcpy(item->env, env);
|
||||
item->val = malloc(strlen(val)+1);
|
||||
strcpy(item->val, val);
|
||||
item->next = first;
|
||||
first = item;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
char *file_getenv (const char *a)
|
||||
{
|
||||
struct envitem_t *ptr;
|
||||
char *result;
|
||||
|
||||
if ((result = getenv(a)) != NULL) {
|
||||
return result;
|
||||
}
|
||||
loadEnvFile();
|
||||
for (ptr = first; ptr != NULL; ptr = ptr->next) {
|
||||
if (!strcmp(ptr->env, a)) {
|
||||
return ptr->val;
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
#include <linutil.h>
|
||||
|
||||
/*-------------------------------------------------------------------
|
||||
Function: tlKbHit
|
||||
Date: 2/28
|
||||
Implementor(s): jdt
|
||||
Library: test library
|
||||
Description:
|
||||
Returns true if there are pending characters in the input queue
|
||||
Arguments:
|
||||
none
|
||||
Return:
|
||||
nonzero if keys in queue
|
||||
-------------------------------------------------------------------*/
|
||||
int hwcKbHit( void ) {
|
||||
return lin_kbhit();
|
||||
}
|
||||
|
||||
char hwcGetCH( void ) {
|
||||
return lin_getch();
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -19,6 +19,9 @@
|
||||
**
|
||||
** $Header$
|
||||
** $Log$
|
||||
** Revision 1.1.1.1.6.2 2003/06/21 12:43:04 dborca
|
||||
** h3cinit cleanup
|
||||
**
|
||||
** Revision 1.1.1.1.6.1 2003/05/05 07:12:47 dborca
|
||||
** no message
|
||||
**
|
||||
@@ -585,6 +588,8 @@ modify [eax];
|
||||
/* [dBorca] */
|
||||
#elif defined(__DJGPP__)
|
||||
#define P6FENCE __asm __volatile ("xchg %%eax, _fenceVar":::"%eax");
|
||||
#elif defined(__linux__)
|
||||
#define P6FENCE __asm __volatile ("xchg %%eax, fenceVar":::"%eax")
|
||||
#else
|
||||
#error "P6 Fencing in-line assembler code needs to be added for this compiler"
|
||||
#endif /* Compiler specific fence commands */
|
||||
@@ -3202,7 +3207,7 @@ hwcInitVideo(hwcBoardInfo *bInfo, FxBool tiled, FxVideoTimingInfo *vidTiming,
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef __DOS32__
|
||||
#ifndef __WIN32__ /* DOS and Linux */
|
||||
/* Now call the cinit code */
|
||||
|
||||
h3InitVideoOverlaySurface(
|
||||
@@ -3439,7 +3444,7 @@ hwcInitVideo(hwcBoardInfo *bInfo, FxBool tiled, FxVideoTimingInfo *vidTiming,
|
||||
( bInfo->buffInfo.bufStrideInTiles << 16 ) |
|
||||
bInfo->buffInfo.bufStrideInTiles );
|
||||
|
||||
#ifdef __DJGPP__
|
||||
#if defined(__DJGPP__) || defined(__linux__)
|
||||
HWC_IO_STORE(bInfo->regInfo, vidProcCfg, vidProcCfg | SST_VIDEO_PROCESSOR_EN);
|
||||
#endif
|
||||
|
||||
@@ -4083,6 +4088,9 @@ hwcGetenv(char *a)
|
||||
RegCloseKey(hKey);
|
||||
}
|
||||
return (char*)retVal;
|
||||
#elif defined(__linux__)
|
||||
extern char *file_getenv (const char *a);
|
||||
return file_getenv(a);
|
||||
#else
|
||||
return getenv(a);
|
||||
#endif
|
||||
@@ -4209,7 +4217,7 @@ hwcShareContextData(hwcBoardInfo *bInfo, FxU32 **data)
|
||||
ctxRes.optData.shareContextDWORDRes.contextDWORD);
|
||||
|
||||
/* [dBorca] that must be initialized to something... */
|
||||
#elif defined(__DJGPP__)
|
||||
#elif defined(__DJGPP__) || defined(__linux__)
|
||||
*data = &dummyContextDWORD;
|
||||
#endif
|
||||
return retVal;
|
||||
|
||||
@@ -3260,7 +3260,7 @@ static GrLOD_t g3LodXlat_base[2] = { GR_LOD_LOG2_256, GR_LOD_LOG2_2048 };
|
||||
(g3LodXlat_base[tBig] - someLOD)
|
||||
#endif
|
||||
|
||||
GR_ENTRY(grTexDownloadTableExt,
|
||||
GR_EXT_ENTRY(grTexDownloadTableExt,
|
||||
void,
|
||||
(GrChipID_t tmu, GrTexTable_t type, void *data));
|
||||
|
||||
|
||||
@@ -348,7 +348,7 @@ GR_DDFUNC(_grTexDownloadNccTableExt,
|
||||
gc->stats.palDownloads++;
|
||||
gc->stats.palBytes += (end-start+1)<<2;
|
||||
|
||||
if (gc->tmu_state[tmu].ncc_table[which] != table) {
|
||||
/*if (gc->tmu_state[tmu].ncc_table[which] != table)*/ {
|
||||
SstRegs* texHW;
|
||||
int i;
|
||||
#ifdef GLIDE_POINTCAST_PALETTE
|
||||
@@ -652,7 +652,7 @@ GR_DDFUNC(_grTexDownloadPaletteExt,
|
||||
Return:
|
||||
none
|
||||
-------------------------------------------------------------------*/
|
||||
GR_ENTRY(grTexDownloadTableExt,
|
||||
GR_EXT_ENTRY(grTexDownloadTableExt,
|
||||
void,
|
||||
(GrChipID_t tmu, GrTexTable_t type, void *data))
|
||||
{
|
||||
@@ -664,10 +664,10 @@ GR_ENTRY(grTexDownloadTableExt,
|
||||
switch(type) {
|
||||
case GR_TEXTABLE_PALETTE:
|
||||
case GR_TEXTABLE_PALETTE_6666_EXT:
|
||||
_grTexDownloadPalette(tmu, type, (GuTexPalette *)data, 0, 255);
|
||||
_grTexDownloadPaletteExt(tmu, type, (GuTexPalette *)data, 0, 255);
|
||||
break;
|
||||
default: /* Type is an ncc table */
|
||||
_grTexDownloadNccTable(tmu, type, (GuNccTable*)data, 0, 11);
|
||||
_grTexDownloadNccTableExt(tmu, type, (GuNccTable*)data, 0, 11);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -705,7 +705,7 @@ GR_DDFUNC(_grTexDownloadNccTable,
|
||||
gc->stats.palDownloads++;
|
||||
gc->stats.palBytes += (end-start+1)<<2;
|
||||
|
||||
if (gc->tmu_state[tmu].ncc_table[which] != table) {
|
||||
/*if (gc->tmu_state[tmu].ncc_table[which] != table)*/ {
|
||||
SstRegs* texHW;
|
||||
int i;
|
||||
#ifdef GLIDE_POINTCAST_PALETTE
|
||||
|
||||
@@ -19,6 +19,10 @@
|
||||
;; $Header$
|
||||
;; $Revision$
|
||||
;; $Log$
|
||||
;; Revision 1.1.8.8 2003/09/12 05:11:45 koolsmoky
|
||||
;; preparing for graphic context checks
|
||||
;; fixed jmp errors
|
||||
;;
|
||||
;; Revision 1.1.8.7 2003/07/07 23:29:06 koolsmoky
|
||||
;; cleaned logs
|
||||
;;
|
||||
@@ -223,7 +227,7 @@ Y equ 4
|
||||
%ENDM
|
||||
|
||||
;; enables/disables trisProcessed and trisDrawn counters
|
||||
STATS equ 1
|
||||
%define STATS 1
|
||||
|
||||
;; NB: All of the base triangle procs expect to have the gc
|
||||
;; passed from the caller in edx so that we can avoid
|
||||
|
||||
@@ -20,6 +20,10 @@
|
||||
;; $Header$
|
||||
;; $Revision$
|
||||
;; $Log$
|
||||
;; Revision 1.1.8.7 2003/09/12 05:11:45 koolsmoky
|
||||
;; preparing for graphic context checks
|
||||
;; fixed jmp errors
|
||||
;;
|
||||
;; Revision 1.1.8.6 2003/07/07 23:29:06 koolsmoky
|
||||
;; cleaned logs
|
||||
;;
|
||||
@@ -123,7 +127,7 @@
|
||||
;; lea eax, [esp+ _va$] ; pointer to vertex pointers
|
||||
;; test esi, esi ; window coordinates ?
|
||||
;;
|
||||
;; jz win_coordinates ; yup
|
||||
;; jz .win_coordinates ; yup
|
||||
;;
|
||||
;; invoke _grDrawTriangles, 1, 3, eax; draw the triangle in clip coordinate space
|
||||
;;
|
||||
@@ -135,7 +139,7 @@
|
||||
;;
|
||||
;; ret ; return, pop 3 DWORD arguments off stack
|
||||
;;
|
||||
;;win_coordinates:
|
||||
;;.win_coordinates:
|
||||
;;%endif ; GLIDE_CLIP_COORDS
|
||||
|
||||
%if GLIDE_VALIDATE_STATE
|
||||
@@ -260,7 +264,7 @@
|
||||
;; lea eax, [esp+ _va$] ; pointer to vertex pointers
|
||||
;; test edx, edx ; window coordinates ?
|
||||
;;
|
||||
;; jz win_coordinates ; yup
|
||||
;; jz .win_coordinates ; yup
|
||||
;;
|
||||
;; invoke _grDrawTriangles, 1, 3, eax; draw the triangle in coordinate space
|
||||
;;
|
||||
@@ -273,7 +277,7 @@
|
||||
;; ret ; return, pop 3 DWORD arguments off stack
|
||||
;;
|
||||
;; ALIGN 16
|
||||
;;win_coordinates:
|
||||
;;.win_coordinates:
|
||||
;;
|
||||
;;%endif
|
||||
|
||||
@@ -702,7 +706,7 @@
|
||||
;; lea eax, [esp+ _va$] ; pointer to vertex pointers
|
||||
;; test esi, esi ; window coordinates ?
|
||||
;;
|
||||
;; jz win_coordinates ; yup
|
||||
;; jz .win_coordinates ; yup
|
||||
;;
|
||||
;; invoke _grDrawTriangles, 1, 3, eax; draw the triangle in clip coordinate space
|
||||
;;
|
||||
@@ -714,7 +718,7 @@
|
||||
;;
|
||||
;; ret ; return, pop 3 DWORD arguments off stack
|
||||
;;
|
||||
;;win_coordinates:
|
||||
;;.win_coordinates:
|
||||
;;%endif ; GLIDE_CLIP_COORDS
|
||||
|
||||
%if GLIDE_VALIDATE_STATE
|
||||
@@ -837,7 +841,7 @@
|
||||
;; lea eax, [esp+ _va$] ; pointer to vertex pointers
|
||||
;; test edx, edx ; window coordinates ?
|
||||
;;
|
||||
;; jz win_coordinates ; yup
|
||||
;; jz .win_coordinates ; yup
|
||||
;;
|
||||
;; invoke _grDrawTriangles, 1, 3, eax; draw the triangle in coordinate space
|
||||
;;
|
||||
@@ -850,7 +854,7 @@
|
||||
;; ret ; return, pop 3 DWORD arguments off stack
|
||||
;;
|
||||
;; ALIGN 16
|
||||
;;win_coordinates:
|
||||
;;.win_coordinates:
|
||||
;;
|
||||
;;%endif
|
||||
|
||||
@@ -1249,7 +1253,7 @@
|
||||
db 00h
|
||||
db 00h
|
||||
|
||||
add eax, DWORD PTR __GlideRoot + tlsOffset
|
||||
add eax, DWORD [_GlideRoot + tlsOffset]
|
||||
mov gc, [eax]
|
||||
%ELSE
|
||||
mov gc, edx
|
||||
|
||||
@@ -35,7 +35,7 @@ extrn _grCommandTransportMakeRoom, 12
|
||||
|
||||
segment CONST
|
||||
ALIGN 8
|
||||
_F256_F256 DD 43800000h, 43800000h ; 256 | 256
|
||||
_F256_F256 DD 256.0, 256.0
|
||||
|
||||
segment DATA
|
||||
ALIGN 8
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# Linux makefile for Glide3(h5) and Texus2
|
||||
# Linux makefile for Glide3 and Texus2
|
||||
#
|
||||
# Copyright (c) 2003 - Borca Daniel
|
||||
# Email : dborca@users.sourceforge.net
|
||||
@@ -12,31 +12,45 @@
|
||||
# Available options:
|
||||
#
|
||||
# Environment variables:
|
||||
# FX_GLIDE_HW build for the given ASIC (cvg, h3, h5).
|
||||
# default = h5
|
||||
# DRI=1 Build DRI version.
|
||||
# target = h3, h5
|
||||
# default = no
|
||||
# DGA=1 Build DGA version (experimental).
|
||||
# target = h3, h5
|
||||
# default = no
|
||||
# XPATH specify X libraries path; needed by DRI and DGA.
|
||||
# target = h3, h5
|
||||
# default = /usr/X11/lib
|
||||
# H4=1 Avenger/Napalm.
|
||||
# target = h3, h5
|
||||
# default = no
|
||||
# CPU optimize for the given processor.
|
||||
# target = cvg, h3, h5
|
||||
# default = pentium
|
||||
# DEBUG=1 disable optimizations and build for debug.
|
||||
# target = cvg, h3, h5
|
||||
# default = no
|
||||
# USE_X86=1 use assembler triangle specializations.
|
||||
# USE_X86=1 use assembler triangle specializations; req by CVG
|
||||
# target = cvg, h3, h5
|
||||
# default = no
|
||||
# USE_3DNOW=1 allow 3DNow! specializations. However, the true CPU
|
||||
# capabilities are still checked at run-time to avoid
|
||||
# crashes.
|
||||
# target = cvg, h3, h5
|
||||
# default = no
|
||||
# USE_MMX=1 (see USE_3DNOW)
|
||||
# target = h5
|
||||
# default = no
|
||||
# USE_SSE=1 (see USE_3DNOW)
|
||||
# target = h5
|
||||
# default = no
|
||||
# USE_SSE2=1 (see USE_3DNOW)
|
||||
# target = h5
|
||||
# default = no
|
||||
# TEXUS2=1 embed Texus2 functions into Glide3 library.
|
||||
# TEXUS2=1 embed Texus2 functions into Glide3.
|
||||
# target = cvg, h3, h5
|
||||
# default = no
|
||||
#
|
||||
# Targets:
|
||||
@@ -62,7 +76,7 @@ GLIDE_LIB = libglide3.a
|
||||
GLIDE_SO = libglide3.so
|
||||
TEXUS_EXE = texus2
|
||||
|
||||
FX_GLIDE_HW = h5
|
||||
FX_GLIDE_HW ?= h5
|
||||
FX_GLIDE_SW = swlibs
|
||||
GLIDE_LIBDIR = $(FX_GLIDE_HW)/lib
|
||||
TEXUS_EXEDIR = $(FX_GLIDE_SW)/bin
|
||||
@@ -83,8 +97,9 @@ CP = cp
|
||||
###############################################################################
|
||||
|
||||
# platform
|
||||
XPATH ?= /usr/X11/lib
|
||||
CDEFS = -D__linux__
|
||||
ifneq ($(FX_GLIDE_HW),cvg)
|
||||
XPATH ?= /usr/X11/lib
|
||||
ifeq ($(DRI),1)
|
||||
CDEFS += -DDRI_BUILD
|
||||
LDFLAGS = -L$(XPATH)
|
||||
@@ -95,17 +110,23 @@ CDEFS += -DUSE_XDGA_SWITCH=1
|
||||
LDFLAGS = -L$(XPATH)
|
||||
LDLIBS = -lX11 -lXext -lXxf86dga
|
||||
endif
|
||||
endif
|
||||
|
||||
# general
|
||||
CDEFS += -DGLIDE3 -DGLIDE3_ALPHA -DGLIDE_HW_TRI_SETUP=1 -DGLIDE_INIT_HWC -DGLIDE_PACKED_RGB=0 -DGLIDE_PACKET3_TRI_SETUP=1 -DGLIDE_TRI_CULLING=1 -DH3 -DUSE_PACKET_FIFO=1
|
||||
CDEFS += -DGLIDE3 -DGLIDE3_ALPHA -DGLIDE_HW_TRI_SETUP=1 -DGLIDE_INIT_HWC -DGLIDE_PACKED_RGB=0 -DGLIDE_PACKET3_TRI_SETUP=1 -DGLIDE_TRI_CULLING=1 -DUSE_PACKET_FIFO=1
|
||||
|
||||
# subsystem
|
||||
ifeq ($(FX_GLIDE_HW),cvg)
|
||||
CDEFS += -DCVG
|
||||
else
|
||||
CDEFS += -DH3
|
||||
ifdef H4
|
||||
CDEFS += -DH4
|
||||
endif
|
||||
ifeq ($(FX_GLIDE_HW),h5)
|
||||
CDEFS += -DFX_GLIDE_H5_CSIM=1 -DFX_GLIDE_NAPALM=1
|
||||
endif
|
||||
endif
|
||||
|
||||
# debug
|
||||
ifdef DEBUG
|
||||
@@ -115,7 +136,14 @@ endif
|
||||
# other
|
||||
CDEFS += -DGLIDE_PLUG -DGLIDE_SPLASH
|
||||
#CDEFS += -DGLIDE_LIB
|
||||
ifeq ($(FX_GLIDE_HW),cvg)
|
||||
#CDEFS += -DGLIDE3_SCALER
|
||||
CDEFS += -DGLIDE_DISPATCH_SETUP -DGLIDE_DISPATCH_DOWNLOAD
|
||||
CDEFS += -DINIT_LINUX
|
||||
CDEFS += -D__3Dfx_PCI_CFG__
|
||||
else
|
||||
#CDEFS += -DGLIDE_CHECK_CONTEXT
|
||||
endif
|
||||
|
||||
###############################################################################
|
||||
# flags
|
||||
@@ -139,11 +167,21 @@ CPU ?= pentium
|
||||
CFLAGS += -O2 -ffast-math -mcpu=$(CPU)
|
||||
endif
|
||||
|
||||
CFLAGS += -I$(FX_GLIDE_HW)/glide3/src -I$(FX_GLIDE_HW)/incsrc -I$(FX_GLIDE_HW)/minihwc -I$(FX_GLIDE_HW)/cinit
|
||||
CFLAGS += -I$(FX_GLIDE_HW)/glide3/src -I$(FX_GLIDE_HW)/incsrc -I$(FX_GLIDE_HW)/minihwc -I$(FX_GLIDE_HW)/cinit -I$(FX_GLIDE_HW)/init
|
||||
CFLAGS += -I$(FX_GLIDE_SW)/fxmisc -I$(FX_GLIDE_SW)/newpci/pcilib -I$(FX_GLIDE_SW)/fxmemmap
|
||||
CFLAGS += -I$(FX_GLIDE_SW)/texus2/lib
|
||||
CFLAGS += $(CDEFS)
|
||||
|
||||
ifeq ($(FX_GLIDE_HW),cvg)
|
||||
override USE_X86 = 1
|
||||
else
|
||||
ifeq ($(FX_GLIDE_HW),h3)
|
||||
override USE_MMX = 0
|
||||
override USE_SSE = 0
|
||||
override USE_SSE2 = 0
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(USE_3DNOW),1)
|
||||
CFLAGS += -DGL_AMD3D
|
||||
override USE_X86 = 1
|
||||
@@ -170,10 +208,14 @@ endif
|
||||
###############################################################################
|
||||
|
||||
GLIDE_OBJECTS = \
|
||||
$(FX_GLIDE_HW)/glide3/src/fifo.o \
|
||||
$(FX_GLIDE_HW)/glide3/src/distate.o \
|
||||
$(FX_GLIDE_HW)/glide3/src/gstrip.o \
|
||||
$(FX_GLIDE_HW)/glide3/src/distrip.o \
|
||||
$(FX_GLIDE_HW)/glide3/src/diget.o \
|
||||
$(FX_GLIDE_HW)/glide3/src/gsplash.o \
|
||||
$(FX_GLIDE_HW)/glide3/src/g3df.o \
|
||||
$(FX_GLIDE_HW)/glide3/src/gu.o \
|
||||
$(FX_GLIDE_HW)/glide3/src/gthread.o \
|
||||
$(FX_GLIDE_HW)/glide3/src/gpci.o \
|
||||
$(FX_GLIDE_HW)/glide3/src/diglide.o \
|
||||
$(FX_GLIDE_HW)/glide3/src/disst.o \
|
||||
@@ -183,15 +225,15 @@ GLIDE_OBJECTS = \
|
||||
$(FX_GLIDE_HW)/glide3/src/gaa.o \
|
||||
$(FX_GLIDE_HW)/glide3/src/gdraw.o \
|
||||
$(FX_GLIDE_HW)/glide3/src/gglide.o \
|
||||
$(FX_GLIDE_HW)/glide3/src/distate.o \
|
||||
$(FX_GLIDE_HW)/glide3/src/gstrip.o \
|
||||
$(FX_GLIDE_HW)/glide3/src/distrip.o \
|
||||
$(FX_GLIDE_HW)/glide3/src/diget.o \
|
||||
$(FX_GLIDE_HW)/glide3/src/glfb.o \
|
||||
$(FX_GLIDE_HW)/glide3/src/gsst.o \
|
||||
$(FX_GLIDE_HW)/glide3/src/gtex.o \
|
||||
$(FX_GLIDE_HW)/glide3/src/gtexdl.o \
|
||||
$(FX_GLIDE_HW)/glide3/src/fifo.o
|
||||
$(FX_GLIDE_HW)/glide3/src/cpuid.o \
|
||||
$(FX_GLIDE_SW)/newpci/pcilib/fxpci.o \
|
||||
$(FX_GLIDE_SW)/newpci/pcilib/fxlinux.o \
|
||||
$(FX_GLIDE_SW)/fxmisc/linutil.o \
|
||||
$(FX_GLIDE_HW)/glide3/src/xtexdl_def.o
|
||||
|
||||
ifeq ($(USE_X86),1)
|
||||
GLIDE_OBJECTS += \
|
||||
@@ -221,25 +263,36 @@ GLIDE_OBJECTS += \
|
||||
$(FX_GLIDE_HW)/glide3/src/gxdraw.o
|
||||
endif
|
||||
|
||||
ifeq ($(FX_GLIDE_HW),cvg)
|
||||
GLIDE_OBJECTS += \
|
||||
$(FX_GLIDE_HW)/glide3/src/xtexdl_def.o
|
||||
|
||||
$(FX_GLIDE_HW)/glide3/src/digutex.o \
|
||||
$(FX_GLIDE_SW)/newpci/pcilib/fxmsr.o \
|
||||
$(FX_GLIDE_HW)/init/canopus.o \
|
||||
$(FX_GLIDE_HW)/init/dac.o \
|
||||
$(FX_GLIDE_HW)/init/gamma.o \
|
||||
$(FX_GLIDE_HW)/init/gdebug.o \
|
||||
$(FX_GLIDE_HW)/init/info.o \
|
||||
$(FX_GLIDE_HW)/init/parse.o \
|
||||
$(FX_GLIDE_HW)/init/print.o \
|
||||
$(FX_GLIDE_HW)/init/sli.o \
|
||||
$(FX_GLIDE_HW)/init/sst1init.o \
|
||||
$(FX_GLIDE_HW)/init/util.o \
|
||||
$(FX_GLIDE_HW)/init/video.o \
|
||||
$(FX_GLIDE_HW)/init/fxremap.o
|
||||
else
|
||||
GLIDE_OBJECTS += \
|
||||
$(FX_GLIDE_HW)/glide3/src/cpuid.o \
|
||||
$(FX_GLIDE_SW)/newpci/pcilib/fxpci.o \
|
||||
$(FX_GLIDE_SW)/newpci/pcilib/fxlinux.o \
|
||||
$(FX_GLIDE_SW)/fxmisc/linutil.o \
|
||||
$(FX_GLIDE_HW)/glide3/src/gthread.o \
|
||||
$(FX_GLIDE_HW)/minihwc/hwcio.o \
|
||||
$(FX_GLIDE_HW)/minihwc/gdebug.o \
|
||||
|
||||
ifeq ($(DRI),1)
|
||||
GLIDE_OBJECTS += \
|
||||
$(FX_GLIDE_HW)/minihwc/linhwc.o
|
||||
else
|
||||
GLIDE_OBJECTS += \
|
||||
$(FX_GLIDE_HW)/cinit/h3cinit.o \
|
||||
$(FX_GLIDE_HW)/minihwc/minihwc.o \
|
||||
$(FX_GLIDE_HW)/minihwc/lin_mode.o
|
||||
$(FX_GLIDE_HW)/minihwc/lin_mode.o \
|
||||
h5/cinit/h3cinit.o
|
||||
endif
|
||||
endif
|
||||
|
||||
TEXUS_SOURCES = \
|
||||
@@ -277,6 +330,10 @@ endif
|
||||
|
||||
.c.o:
|
||||
$(CC) -o $@ $(CFLAGS) -c $<
|
||||
.S.o:
|
||||
$(CC) -o $@ $(CFLAGS) -c $<
|
||||
.s.o:
|
||||
$(CC) -o $@ $(CFLAGS) -x assembler-with-cpp -c $<
|
||||
.c.lo:
|
||||
$(CC) -o $@ $(CFLAGS) -DPIC -fPIC -c $<
|
||||
|
||||
@@ -304,6 +361,13 @@ endif
|
||||
# rules(2)
|
||||
###############################################################################
|
||||
|
||||
cvg/glide3/src/xtexdl_def.o: cvg/glide3/src/xtexdl.c
|
||||
$(CC) -o $@ $(CFLAGS) -c $<
|
||||
cvg/glide3/src/cpuid.o: cvg/glide3/src/cpudtect.asm
|
||||
$(AS) -o $@ $(ASFLAGS) $<
|
||||
h3/glide3/src/cpuid.o: h3/glide3/src/cpudtect.asm
|
||||
$(AS) -o $@ $(ASFLAGS) $<
|
||||
|
||||
$(FX_GLIDE_HW)/glide3/src/xdraw2_def.o: $(FX_GLIDE_HW)/glide3/src/xdraw2.asm
|
||||
$(AS) -o $@ $(ASFLAGS) $<
|
||||
$(FX_GLIDE_HW)/glide3/src/xdraw3_def.o: $(FX_GLIDE_HW)/glide3/src/xdraw3.asm
|
||||
@@ -323,6 +387,13 @@ $(FX_GLIDE_HW)/glide3/src/xdraw3_sse.o: $(FX_GLIDE_HW)/glide3/src/xdraw3.asm
|
||||
$(FX_GLIDE_HW)/glide3/src/xtexdl_sse2.o: $(FX_GLIDE_HW)/glide3/src/xtexdl.asm
|
||||
$(AS) -o $@ $(ASFLAGS) -DGL_SSE2=1 $<
|
||||
|
||||
cvg/glide3/src/xtexdl_def.lo: cvg/glide3/src/xtexdl.c
|
||||
$(CC) -o $@ $(CFLAGS) -DPIC -fPIC -c $<
|
||||
cvg/glide3/src/cpuid.lo: cvg/glide3/src/cpuid.o
|
||||
$(CP) $< $@
|
||||
h3/glide3/src/cpuid.lo: h3/glide3/src/cpuid.o
|
||||
$(CP) $< $@
|
||||
|
||||
$(FX_GLIDE_HW)/glide3/src/xdraw2_def.lo: $(FX_GLIDE_HW)/glide3/src/xdraw2_def.o
|
||||
$(CP) $< $@
|
||||
$(FX_GLIDE_HW)/glide3/src/xdraw3_def.lo: $(FX_GLIDE_HW)/glide3/src/xdraw3_def.o
|
||||
@@ -342,8 +413,10 @@ $(FX_GLIDE_HW)/glide3/src/xdraw3_sse.lo: $(FX_GLIDE_HW)/glide3/src/xdraw3_sse.o
|
||||
$(FX_GLIDE_HW)/glide3/src/xtexdl_sse2.lo: $(FX_GLIDE_HW)/glide3/src/xtexdl_sse2.o
|
||||
$(CP) $< $@
|
||||
|
||||
ifeq ($(FX_GLIDE_HW),h5)
|
||||
GENDATE = $(FX_GLIDE_HW)/incsrc/gendate.h
|
||||
FXBLDNO = $(FX_GLIDE_HW)/glide3/src/fxbldno.h
|
||||
endif
|
||||
|
||||
$(GLIDE_OBJECTS): $(FX_GLIDE_HW)/glide3/src/fxinline.h $(FX_GLIDE_HW)/glide3/src/fxgasm.h $(FXBLDNO)
|
||||
|
||||
@@ -373,22 +446,17 @@ fxbldno: $(FXBLDNO:.h=.c)
|
||||
###############################################################################
|
||||
|
||||
clean:
|
||||
-$(RM) $(FX_GLIDE_HW)/cinit/*.o
|
||||
-$(RM) $(FX_GLIDE_HW)/cinit/*.lo
|
||||
-$(RM) $(FX_GLIDE_HW)/glide3/src/*.o
|
||||
-$(RM) $(FX_GLIDE_HW)/glide3/src/*.lo
|
||||
-$(RM) $(FX_GLIDE_HW)/minihwc/*.o
|
||||
-$(RM) $(FX_GLIDE_HW)/minihwc/*.lo
|
||||
-$(RM) $(FX_GLIDE_SW)/newpci/pcilib/*.o
|
||||
-$(RM) $(FX_GLIDE_SW)/newpci/pcilib/*.lo
|
||||
-$(RM) $(FX_GLIDE_SW)/fxmisc/*.o
|
||||
-$(RM) $(FX_GLIDE_SW)/fxmisc/*.lo
|
||||
-$(RM) cvg/init/*.[l]o
|
||||
-$(RM) h5/cinit/*.[l]o
|
||||
-$(RM) $(FX_GLIDE_HW)/glide3/src/*.[l]o
|
||||
-$(RM) $(FX_GLIDE_HW)/minihwc/*.[l]o
|
||||
-$(RM) $(FX_GLIDE_SW)/newpci/pcilib/*.[l]o
|
||||
-$(RM) $(FX_GLIDE_HW)/glide3/src/fxinline.h
|
||||
-$(RM) $(FX_GLIDE_HW)/glide3/src/fxgasm.h
|
||||
-$(RM) $(GENDATE)
|
||||
-$(RM) $(FXBLDNO)
|
||||
-$(RM) $(FX_GLIDE_SW)/texus2/lib/*.o)
|
||||
-$(RM) $(FX_GLIDE_SW)/texus2/lib/*.lo)
|
||||
-$(RM) $(FX_GLIDE_SW)/fxmisc/*.[l]o
|
||||
-$(RM) $(FX_GLIDE_SW)/texus2/lib/*.[l]o)
|
||||
|
||||
realclean: clean
|
||||
-$(RM) $(GLIDE_LIBDIR)/$(GLIDE_LIB)
|
||||
|
||||
Reference in New Issue
Block a user