Asm rendering of alias models is back in now - and it works

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@833 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Spoike 2005-01-26 17:16:08 +00:00
parent 8233e58472
commit 7dfa8ee86c
10 changed files with 43 additions and 63 deletions

View file

@ -396,8 +396,8 @@ ifeq ($(USEASM),true)
else else
SWCL_OBJS=$(SOFTWARE_OBJS) vid_x.o snd_linux.o cd_linux.o sys_linux.o SWCL_OBJS=$(SOFTWARE_OBJS) vid_x.o snd_linux.o cd_linux.o sys_linux.o
endif endif
SW_EXE_NAME=../fteswqw.exe SW_EXE_NAME=../fteqw.sw
SWCL_EXE_NAME=../fteswqwcl.exe SWCL_EXE_NAME=../fteqwcl.sw
SW_LDFLAGS=$(SWLDFLAGS) $(XLDFLAGS) SW_LDFLAGS=$(SWLDFLAGS) $(XLDFLAGS)
SW_CFLAGS=$(SWCFLAGS) SW_CFLAGS=$(SWCFLAGS)
SWB_DIR=sw_linux SWB_DIR=sw_linux
@ -431,7 +431,7 @@ $(OUT_DIR)/%.o : %.c
$(DO_CC) $(DO_CC)
ifeq ($(USEASM),true) ifeq ($(USEASM),true)
$(OUT_DIR)/%.o : %.s $(OUT_DIR)/%.o : %.s sw/*.h
$(DO_AS) $(DO_AS)
endif endif

View file

@ -256,7 +256,7 @@ void R_StoreEfrags (efrag_t **ppefrag)
entity_t *pent; entity_t *pent;
model_t *clmodel; model_t *clmodel;
efrag_t *pefrag; efrag_t *pefrag;
return;
while ((pefrag = *ppefrag) != NULL) while ((pefrag = *ppefrag) != NULL)
{ {

View file

@ -23,6 +23,10 @@
#error "nodraw isn't constant" #error "nodraw isn't constant"
#endif #endif
#ifdef SWQUAKE
extern qboolean r_usinglits;
#endif
//these are in model.c (or gl_model.c) //these are in model.c (or gl_model.c)
void GLMod_LoadVertexes (lump_t *l); void GLMod_LoadVertexes (lump_t *l);

View file

@ -456,7 +456,8 @@ typedef struct
typedef struct mtriangle_s { typedef struct mtriangle_s {
int xyz_index[3]; int xyz_index[3];
int st_index[3]; int st_index[3];
int neighbors[3];
int pad[2];
} mtriangle_t; } mtriangle_t;

View file

@ -138,17 +138,17 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define rd_yOrigin 108 #define rd_yOrigin 108
#define rd_vieworg 112 #define rd_vieworg 112
#define rd_viewangles 124 #define rd_viewangles 124
#define rd_ambientlight 136 //fox x, fov y
#define rd_flags 140 #define rd_ambientlight 144
#define rd_currentplayernum 144 #define rd_flags 148
#define rd_size 148 #define rd_currentplayernum 152
#define rd_size 156
// mtriangle_t structure // mtriangle_t structure
// !!! if this is changed, it must be changed in model.h too !!! // !!! if this is changed, it must be changed in model.h too !!!
#define mtri_facesfront 0 #define mtri_vertindex 0
#define mtri_vertindex 4 #define mtri_stindex 12
#define mtri_stindex 16 #define mtri_size 32 // !!! if this changes, array indexing in !!!
#define mtri_size 28 // !!! if this changes, array indexing in !!!
// !!! d_polysa.s must be changed to match !!! // !!! d_polysa.s must be changed to match !!!
#define mtri_shift 4 #define mtri_shift 5

View file

@ -71,9 +71,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
// stvert_t structure // stvert_t structure
// !!! if this is changed, it must be changed in modelgen.h too !!! // !!! if this is changed, it must be changed in modelgen.h too !!!
#define stv_s 4 #define stv_s 0
#define stv_t 8 #define stv_t 4
#define stv_size 12 #define stv_size 8
// trivertx_t structure // trivertx_t structure
@ -92,6 +92,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define atd_pfinalverts 20 #define atd_pfinalverts 20
#define atd_numtriangles 24 #define atd_numtriangles 24
#define atd_drawtype 28 #define atd_drawtype 28
#define atd_seamfixupX16 32 #define atd_pstverts 32
//#define atd_seamfixupX16 32
#define atd_size 36 #define atd_size 36

View file

@ -22,11 +22,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
// x86 assembly-language polygon model drawing code // x86 assembly-language polygon model drawing code
// //
//the id made assembler cannot cope with the changes made to the triangle data type.
#ifndef NOASM
#define NOASM
#endif
#include "asm_i386.h" #include "asm_i386.h"
#include "quakeasm.h" #include "quakeasm.h"
#include "asm_draw.h" #include "asm_draw.h"
@ -1190,15 +1185,15 @@ Llooptop:
subl $0x80000001,%eax subl $0x80000001,%eax
jc Lskip jc Lskip
#if 0 #ifdef ONSEAMSTUFF
// if (ptri[i].facesfront) // if (ptri[i].facesfront)
// { // {
// D_PolysetRecursiveTriangle(index0->v, index1->v, index2->v); // D_PolysetRecursiveTriangle(index0->v, index1->v, index2->v);
movl mtri_facesfront-16(%ebx,%ebp,),%eax movl mtri_facesfront-16(%ebx,%ebp,),%eax
testl %eax,%eax testl %eax,%eax
jz Lfacesback jz Lfacesback
#endif #endif
pushl %edx pushl %edx
pushl %esi pushl %esi
pushl %ecx pushl %ecx
@ -1207,7 +1202,8 @@ Llooptop:
subl $16,%ebp subl $16,%ebp
jnz Llooptop jnz Llooptop
jmp Ldone2 jmp Ldone2
#if 0
#ifdef ONSEAMSTUFF
// } // }
// else // else
// { // {
@ -1266,10 +1262,8 @@ Lp13:
movl %eax,fv_v+8(%ecx) movl %eax,fv_v+8(%ecx)
// } // }
#endif
// } // }
#endif
Lskip: Lskip:
subl $16,%ebp subl $16,%ebp
jnz Llooptop jnz Llooptop
@ -1575,7 +1569,7 @@ C(D_DrawNonSubdiv):
pushl %ebp // preserve caller stack frame pointer pushl %ebp // preserve caller stack frame pointer
movl C(r_affinetridesc)+atd_numtriangles,%ebp movl C(r_affinetridesc)+atd_numtriangles,%ebp
pushl %ebx pushl %ebx
shll $(mtri_shift),%ebp shll $(mtri_shift), %ebp
pushl %esi // preserve register variables pushl %esi // preserve register variables
movl C(r_affinetridesc)+atd_ptriangles,%esi movl C(r_affinetridesc)+atd_ptriangles,%esi
pushl %edi pushl %edi
@ -1689,12 +1683,10 @@ LNDLoop:
movl fv_v+16(%ebx),%eax movl fv_v+16(%ebx),%eax
movl fv_v+20(%ebx),%esi movl fv_v+20(%ebx),%esi
movl %eax,C(r_p2)+16 movl %eax,C(r_p2)+16
#if 0
movl C(r_affinetridesc)+atd_ptriangles,%edi movl C(r_affinetridesc)+atd_ptriangles,%edi
#endif
movl %esi,C(r_p2)+20 movl %esi,C(r_p2)+20
#if 0 #ifdef ONSEAMSTUFF
movl mtri_facesfront-mtri_size(%edi,%ebp,1),%eax movl mtri_facesfront-mtri_size(%edi,%ebp,1),%eax
// if (!ptri->facesfront) // if (!ptri->facesfront)
@ -1726,10 +1718,10 @@ LOnseamDone1:
jz LOnseamDone2 jz LOnseamDone2
addl %eax,C(r_p2)+8 addl %eax,C(r_p2)+8
LOnseamDone2: LOnseamDone2:
// } // }
LFacesFront: LFacesFront:
#endif #endif
fstps C(d_xdenom) fstps C(d_xdenom)
@ -1741,7 +1733,7 @@ LFacesFront:
LNextTri: LNextTri:
movl C(r_affinetridesc)+atd_ptriangles,%esi movl C(r_affinetridesc)+atd_ptriangles,%esi
subl $16,%ebp subl $(mtri_size),%ebp
jnz LNDLoop jnz LNDLoop
// } // }

View file

@ -22,10 +22,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
//changes include stvertexes now being seperatly number from the triangles. //changes include stvertexes now being seperatly number from the triangles.
//this allows q2 models to be supported. //this allows q2 models to be supported.
#ifndef NOASM
#define NOASM
#endif
#include "quakedef.h" #include "quakedef.h"
#include "r_local.h" #include "r_local.h"
#include "d_local.h" #include "d_local.h"

View file

@ -26,9 +26,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
//future aims include better skin management. //future aims include better skin management.
//the asm code cannot handle alias models anymore. //the asm code cannot handle alias models anymore.
#ifndef NOASM
#define NOASM
#endif
#include "quakedef.h" #include "quakedef.h"
#include "r_local.h" #include "r_local.h"
@ -513,7 +510,7 @@ void R_AliasTransformFinalVert (finalvert_t *fv, auxvert_t *av,
} }
#if 1 //!id386 since stvert_t was changed. #if !id386 //since stvert_t was changed.
/* /*
================ ================

View file

@ -27,8 +27,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "asm_draw.h" #include "asm_draw.h"
#include "d_ifacea.h" #include "d_ifacea.h"
//FIXME: rework the changes to stvert_t in. #if id386
#if 0//id386
.data .data
@ -39,15 +38,11 @@ Lcoords: .long 0, 0, 0
.text .text
#define fv 12+4 #define fv 12+4
#if 0
#define pstverts 12+8 #define pstverts 12+8
#endif
.globl C(R_AliasTransformAndProjectFinalVerts) .globl C(R_AliasTransformAndProjectFinalVerts)
C(R_AliasTransformAndProjectFinalVerts): C(R_AliasTransformAndProjectFinalVerts):
#if 0
pushl %ebp // preserve caller's stack frame pushl %ebp // preserve caller's stack frame
#endif
pushl %edi pushl %edi
pushl %esi // preserve register variables pushl %esi // preserve register variables
@ -55,14 +50,12 @@ C(R_AliasTransformAndProjectFinalVerts):
// float lightcos, *plightnormal, zi; // float lightcos, *plightnormal, zi;
// trivertx_t *pverts; // trivertx_t *pverts;
// pverts = r_apverts; // pverts = r_apnewverts;
movl C(r_apnewverts),%esi movl C(r_apnewverts),%esi
// for (i=0 ; i<r_anumverts ; i++, fv++, pverts++) // for (i=0 ; i<r_anumverts ; i++, fv++, pverts++, pstverts++)
// { // {
#if 0
movl pstverts(%esp),%ebp movl pstverts(%esp),%ebp
#endif
movl fv(%esp),%edi movl fv(%esp),%edi
movl C(r_anumverts),%ecx movl C(r_anumverts),%ecx
subl %edx,%edx subl %edx,%edx
@ -106,12 +99,11 @@ Lloop:
fdivrs Lfloat_1 // zi | v[2] | v[1] | v[0] fdivrs Lfloat_1 // zi | v[2] | v[1] | v[0]
#if 0
// fv->v[2] = pstverts->s; // fv->v[2] = pstverts->s;
// fv->v[3] = pstverts->t; // fv->v[3] = pstverts->t;
// fv->flags = pstverts->onseam; // fv->flags = pstverts->onseam;
movl stv_onseam(%ebp),%eax // movl stv_onseam(%ebp),%eax
movl %eax,fv_flags(%edi) // movl %eax,fv_flags(%edi)
movl fv_size(%edi),%eax movl fv_size(%edi),%eax
movl stv_size(%ebp),%eax movl stv_size(%ebp),%eax
@ -120,7 +112,7 @@ Lloop:
leal (%edx,%edx,2),%eax // index*3 leal (%edx,%edx,2),%eax // index*3
fxch %st(3) // v[0] | v[2] | v[1] | zi fxch %st(3) // v[0] | v[2] | v[1] | zi
#endif
// lightcos = DotProduct (plightnormal, r_plightvec); // lightcos = DotProduct (plightnormal, r_plightvec);
flds C(r_avertexnormals)(,%eax,4) flds C(r_avertexnormals)(,%eax,4)
fmuls C(r_plightvec) fmuls C(r_plightvec)
@ -234,9 +226,7 @@ Lp1:
popl %esi // restore register variables popl %esi // restore register variables
popl %edi popl %edi
#if 0 popl %ebp // restore the caller's stack frame
// popl %ebp // restore the caller's stack frame
#endif
ret ret
Lsavelight: Lsavelight: