mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-01-29 12:10:48 +00:00
lots of code cleanup. Merge Mod_LoadAllSkins, merge the sw32 model loading
code into the sw model loading code, remove all refs to r_pixbytes from the sw renderer (it was never anything but 1), kill libQFmodels_sw32, remove all the 16 bit code from the 8 bit sw renderer.
This commit is contained in:
parent
9c92717c15
commit
0be2a31f2e
28 changed files with 240 additions and 2326 deletions
|
@ -1542,7 +1542,9 @@ if test "x$BUILD_SW" = xyes; then
|
|||
fi
|
||||
if test "x$BUILD_SW32" = xyes; then
|
||||
VID_REND_TARGETS="$VID_REND_TARGETS libQFrenderer_sw32.la"
|
||||
VID_MODEL_TARGETS="$VID_MODEL_TARGETS libQFmodels_sw32.la"
|
||||
if test "x$BUILD_SW" != xyes; then
|
||||
VID_MODEL_TARGETS="$VID_MODEL_TARGETS libQFmodels_sw.la"
|
||||
fi
|
||||
fi
|
||||
if test "x$BUILD_GL" = xyes; then
|
||||
VID_REND_TARGETS="$VID_REND_TARGETS libQFrenderer_gl.la"
|
||||
|
@ -1681,6 +1683,7 @@ AC_SUBST(VID_TARGETS)
|
|||
AM_CONDITIONAL(BUILD_GL, test "$BUILD_GL" = "yes")
|
||||
AM_CONDITIONAL(BUILD_SW, test "$BUILD_SW" = "yes")
|
||||
AM_CONDITIONAL(BUILD_SW_ASM, test "$BUILD_SW" = "yes" -a "$ASM_ARCH" = "yes")
|
||||
AM_CONDITIONAL(BUILD_SW_MOD, test "$BUILD_SW" = "yes" -o "$BUILD_SW32" = "yes")
|
||||
AM_CONDITIONAL(BUILD_SW32, test "$BUILD_SW32" = "yes")
|
||||
|
||||
dnl Finalization of CFLAGS, LDFLAGS, and LIBS
|
||||
|
|
|
@ -464,8 +464,8 @@ int Mod_Fullbright (byte * skin, int width, int height, char *name);
|
|||
|
||||
void *Mod_LoadAliasFrame (void *pin, int *posenum, maliasframedesc_t *frame);
|
||||
void *Mod_LoadAliasGroup (void *pin, int *posenum, maliasframedesc_t *frame);
|
||||
void *Mod_LoadAllSkins (int numskins, daliasskintype_t *pskintype,
|
||||
int *pskinindex);
|
||||
void *Mod_LoadSkin (byte *skin, int skinsize, int snum, int gnum,
|
||||
qboolean group, maliasskindesc_t *skindesc);
|
||||
void Mod_MakeAliasModelDisplayLists (model_t *m, aliashdr_t *hdr, void *_m,
|
||||
int _s);
|
||||
void Mod_FinalizeAliasModel (model_t *m, aliashdr_t *hdr);
|
||||
|
|
|
@ -160,8 +160,7 @@ void R_RenderBmodelFace (bedge_t *pedges, msurface_t *psurf);
|
|||
void R_TransformPlane (mplane_t *p, float *normal, float *dist);
|
||||
void R_TransformFrustum (void);
|
||||
void R_SetSkyFrame (void);
|
||||
void R_DrawSurfaceBlock16 (void);
|
||||
void R_DrawSurfaceBlock8 (void);
|
||||
void R_DrawSurfaceBlock (void);
|
||||
texture_t *R_TextureAnimation (texture_t *base);
|
||||
|
||||
#ifdef USE_INTEL_ASM
|
||||
|
@ -174,9 +173,7 @@ void R_DrawSurfaceBlock8_mip3 (void);
|
|||
#endif
|
||||
|
||||
void R_GenSkyTile (void *pdest);
|
||||
void R_GenSkyTile16 (void *pdest);
|
||||
void R_Surf8Patch (void);
|
||||
void R_Surf16Patch (void);
|
||||
void R_SurfPatch (void);
|
||||
void R_DrawSubmodelPolygons (model_t *pmodel, int clipflags);
|
||||
void R_DrawSolidClippedSubmodelPolygons (model_t *pmodel);
|
||||
|
||||
|
@ -192,8 +189,6 @@ void R_RemoveEdges (edge_t *pedge);
|
|||
|
||||
extern void R_Surf8Start (void);
|
||||
extern void R_Surf8End (void);
|
||||
extern void R_Surf16Start (void);
|
||||
extern void R_Surf16End (void);
|
||||
extern void R_EdgeCodeStart (void);
|
||||
extern void R_EdgeCodeEnd (void);
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ INCLUDES= -I$(top_srcdir)/include
|
|||
|
||||
lib_LTLIBRARIES= libQFmodels.la @VID_MODEL_TARGETS@
|
||||
EXTRA_LTLIBRARIES= \
|
||||
libQFmodels_gl.la libQFmodels_sw.la libQFmodels_sw32.la
|
||||
libQFmodels_gl.la libQFmodels_sw.la
|
||||
|
||||
models_sources = clip_hull.c model.c
|
||||
|
||||
|
@ -27,10 +27,3 @@ libQFmodels_sw_la_LDFLAGS= -version-info 1:0:0 -rpath $(libdir)
|
|||
libQFmodels_sw_la_LIBADD= $(sw_LIBS)
|
||||
libQFmodels_sw_la_SOURCES= $(models_sources)
|
||||
libQFmodels_sw_la_DEPENDENCIES= $(sw_LIBS)
|
||||
|
||||
sw32_LIBS= \
|
||||
alias/libalias_sw32.la brush/libbrush_sw32.la sprite/libsprite_sw32.la
|
||||
libQFmodels_sw32_la_LDFLAGS= -version-info 1:0:0 -rpath $(libdir)
|
||||
libQFmodels_sw32_la_LIBADD= $(sw32_LIBS)
|
||||
libQFmodels_sw32_la_SOURCES= $(models_sources)
|
||||
libQFmodels_sw32_la_DEPENDENCIES=$(sw32_LIBS)
|
||||
|
|
|
@ -8,29 +8,20 @@ else
|
|||
gl=
|
||||
endif
|
||||
|
||||
if BUILD_SW
|
||||
if BUILD_SW_MOD
|
||||
sw= libalias_sw.la
|
||||
else
|
||||
sw=
|
||||
endif
|
||||
|
||||
if BUILD_SW32
|
||||
sw32= libalias_sw32.la
|
||||
else
|
||||
sw32=
|
||||
endif
|
||||
|
||||
noinst_LTLIBRARIES= $(gl) $(sw) $(sw32)
|
||||
noinst_LTLIBRARIES= $(gl) $(sw)
|
||||
|
||||
alias_src= model_alias.c
|
||||
gl_src= gl_mesh.c gl_model_alias.c
|
||||
sw_src= sw_model_alias.c
|
||||
sw32_src= sw32_model_alias.c
|
||||
|
||||
libalias_gl_la_SOURCES= $(gl_src) $(alias_src)
|
||||
|
||||
libalias_sw_la_SOURCES= $(sw_src) $(alias_src)
|
||||
|
||||
libalias_sw32_la_SOURCES= $(sw32_src) $(alias_src)
|
||||
|
||||
EXTRA_DIST= $(gl_src) $(sw_src) $(sw32_src) $(alias_src)
|
||||
EXTRA_DIST= $(gl_src) $(sw_src) $(alias_src)
|
||||
|
|
|
@ -135,7 +135,7 @@ Mod_FloodFillSkin (byte * skin, int skinwidth, int skinheight)
|
|||
}
|
||||
}
|
||||
|
||||
void *
|
||||
void *
|
||||
Mod_LoadSkin (byte * skin, int skinsize, int snum, int gnum, qboolean group,
|
||||
maliasskindesc_t *skindesc)
|
||||
{
|
||||
|
@ -181,74 +181,6 @@ Mod_LoadSkin (byte * skin, int skinsize, int snum, int gnum, qboolean group,
|
|||
return skin + skinsize;
|
||||
}
|
||||
|
||||
void *
|
||||
Mod_LoadAllSkins (int numskins, daliasskintype_t *pskintype, int *pskinindex)
|
||||
{
|
||||
int snum, gnum, t;
|
||||
int skinsize;
|
||||
byte *skin;
|
||||
int groupskins;
|
||||
daliasskingroup_t *pinskingroup;
|
||||
daliasskininterval_t *pinskinintervals;
|
||||
maliasskindesc_t *pskindesc;
|
||||
maliasskingroup_t *paliasskingroup;
|
||||
float *poutskinintervals;
|
||||
|
||||
if (numskins < 1 || numskins > MAX_SKINS)
|
||||
Sys_Error ("Mod_LoadAliasModel: Invalid # of skins: %d\n", numskins);
|
||||
|
||||
skinsize = pheader->mdl.skinwidth * pheader->mdl.skinheight;
|
||||
pskindesc = Hunk_AllocName (numskins * sizeof (maliasskindesc_t),
|
||||
loadname);
|
||||
|
||||
*pskinindex = (byte *) pskindesc - (byte *) pheader;
|
||||
|
||||
for (snum = 0; snum < numskins; snum++) {
|
||||
pskindesc[snum].type = pskintype->type;
|
||||
if (pskintype->type == ALIAS_SKIN_SINGLE) {
|
||||
skin = (byte *) (pskintype + 1);
|
||||
skin = Mod_LoadSkin (skin, skinsize, snum, 0, false,
|
||||
&pskindesc[snum]);
|
||||
} else {
|
||||
pskintype++;
|
||||
pinskingroup = (daliasskingroup_t *) pskintype;
|
||||
groupskins = LittleLong (pinskingroup->numskins);
|
||||
|
||||
t = field_offset (maliasskingroup_t, skindescs[groupskins]);
|
||||
paliasskingroup = Hunk_AllocName (t, loadname);
|
||||
paliasskingroup->numskins = groupskins;
|
||||
|
||||
pskindesc[snum].skin = (byte *) paliasskingroup - (byte *) pheader;
|
||||
|
||||
pinskinintervals = (daliasskininterval_t *) (pinskingroup + 1);
|
||||
poutskinintervals = Hunk_AllocName (groupskins * sizeof (float),
|
||||
loadname);
|
||||
paliasskingroup->intervals =
|
||||
(byte *) poutskinintervals - (byte *) pheader;
|
||||
for (gnum = 0; gnum < groupskins; gnum++) {
|
||||
*poutskinintervals = LittleFloat (pinskinintervals->interval);
|
||||
if (*poutskinintervals <= 0)
|
||||
Sys_Error ("Mod_LoadAliasSkinGroup: interval<=0");
|
||||
|
||||
poutskinintervals++;
|
||||
pinskinintervals++;
|
||||
}
|
||||
|
||||
pskintype = (void *) pinskinintervals;
|
||||
skin = (byte *) pskintype;
|
||||
|
||||
for (gnum = 0; gnum < groupskins; gnum++) {
|
||||
paliasskingroup->skindescs[gnum].type = ALIAS_SKIN_SINGLE;
|
||||
skin = Mod_LoadSkin (skin, skinsize, snum, gnum, true,
|
||||
&paliasskingroup->skindescs[gnum]);
|
||||
}
|
||||
}
|
||||
pskintype = (daliasskintype_t *) skin;
|
||||
}
|
||||
|
||||
return pskintype;
|
||||
}
|
||||
|
||||
void *
|
||||
Mod_LoadAliasFrame (void *pin, int *posenum, maliasframedesc_t *frame)
|
||||
{
|
||||
|
|
|
@ -66,8 +66,73 @@ mtriangle_t triangles[MAXALIASTRIS];
|
|||
trivertx_t *poseverts[MAXALIASFRAMES];
|
||||
int posenum = 0;
|
||||
|
||||
void *
|
||||
Mod_LoadAllSkins (int numskins, daliasskintype_t *pskintype, int *pskinindex)
|
||||
{
|
||||
int snum, gnum, t;
|
||||
int skinsize;
|
||||
byte *skin;
|
||||
int groupskins;
|
||||
daliasskingroup_t *pinskingroup;
|
||||
daliasskininterval_t *pinskinintervals;
|
||||
maliasskindesc_t *pskindesc;
|
||||
maliasskingroup_t *paliasskingroup;
|
||||
float *poutskinintervals;
|
||||
|
||||
//=========================================================================
|
||||
if (numskins < 1 || numskins > MAX_SKINS)
|
||||
Sys_Error ("Mod_LoadAliasModel: Invalid # of skins: %d\n", numskins);
|
||||
|
||||
skinsize = pheader->mdl.skinwidth * pheader->mdl.skinheight;
|
||||
pskindesc = Hunk_AllocName (numskins * sizeof (maliasskindesc_t),
|
||||
loadname);
|
||||
|
||||
*pskinindex = (byte *) pskindesc - (byte *) pheader;
|
||||
|
||||
for (snum = 0; snum < numskins; snum++) {
|
||||
pskindesc[snum].type = pskintype->type;
|
||||
if (pskintype->type == ALIAS_SKIN_SINGLE) {
|
||||
skin = (byte *) (pskintype + 1);
|
||||
skin = Mod_LoadSkin (skin, skinsize, snum, 0, false,
|
||||
&pskindesc[snum]);
|
||||
} else {
|
||||
pskintype++;
|
||||
pinskingroup = (daliasskingroup_t *) pskintype;
|
||||
groupskins = LittleLong (pinskingroup->numskins);
|
||||
|
||||
t = field_offset (maliasskingroup_t, skindescs[groupskins]);
|
||||
paliasskingroup = Hunk_AllocName (t, loadname);
|
||||
paliasskingroup->numskins = groupskins;
|
||||
|
||||
pskindesc[snum].skin = (byte *) paliasskingroup - (byte *) pheader;
|
||||
|
||||
pinskinintervals = (daliasskininterval_t *) (pinskingroup + 1);
|
||||
poutskinintervals = Hunk_AllocName (groupskins * sizeof (float),
|
||||
loadname);
|
||||
paliasskingroup->intervals =
|
||||
(byte *) poutskinintervals - (byte *) pheader;
|
||||
for (gnum = 0; gnum < groupskins; gnum++) {
|
||||
*poutskinintervals = LittleFloat (pinskinintervals->interval);
|
||||
if (*poutskinintervals <= 0)
|
||||
Sys_Error ("Mod_LoadAliasSkinGroup: interval<=0");
|
||||
|
||||
poutskinintervals++;
|
||||
pinskinintervals++;
|
||||
}
|
||||
|
||||
pskintype = (void *) pinskinintervals;
|
||||
skin = (byte *) pskintype;
|
||||
|
||||
for (gnum = 0; gnum < groupskins; gnum++) {
|
||||
paliasskingroup->skindescs[gnum].type = ALIAS_SKIN_SINGLE;
|
||||
skin = Mod_LoadSkin (skin, skinsize, snum, gnum, true,
|
||||
&paliasskingroup->skindescs[gnum]);
|
||||
}
|
||||
}
|
||||
pskintype = (daliasskintype_t *) skin;
|
||||
}
|
||||
|
||||
return pskintype;
|
||||
}
|
||||
|
||||
void
|
||||
Mod_LoadAliasModel (model_t *mod, void *buffer, cache_allocator_t allocator)
|
||||
|
|
|
@ -1,267 +0,0 @@
|
|||
/*
|
||||
sw32_model_alias.c
|
||||
|
||||
model loading and caching
|
||||
|
||||
Copyright (C) 1996-1997 Id Software, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 2
|
||||
of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to:
|
||||
|
||||
Free Software Foundation, Inc.
|
||||
59 Temple Place - Suite 330
|
||||
Boston, MA 02111-1307, USA
|
||||
|
||||
*/
|
||||
static const char rcsid[] =
|
||||
"$Id$";
|
||||
|
||||
// models are the only shared resource between a client and server running
|
||||
// on the same machine.
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include "config.h"
|
||||
#endif
|
||||
#ifdef HAVE_STRING_H
|
||||
# include <string.h>
|
||||
#endif
|
||||
#ifdef HAVE_STRINGS_H
|
||||
# include <strings.h>
|
||||
#endif
|
||||
|
||||
#include "QF/model.h"
|
||||
#include "QF/qendian.h"
|
||||
#include "QF/sys.h"
|
||||
|
||||
#include "compat.h"
|
||||
#include "d_iface.h"
|
||||
|
||||
|
||||
/*
|
||||
ALIAS MODELS
|
||||
*/
|
||||
|
||||
|
||||
|
||||
// a pose is a single set of vertexes. a frame may be
|
||||
// an animating sequence of poses
|
||||
|
||||
|
||||
void *
|
||||
Mod_LoadSkin (byte * skin, int skinsize, maliasskindesc_t *skindesc)
|
||||
{
|
||||
byte *pskin;
|
||||
|
||||
// LordHavoc: model rendering expects skin in 8bit always
|
||||
pskin = Hunk_AllocName (skinsize, loadname);
|
||||
skindesc->skin = (byte *) pskin - (byte *) pheader;
|
||||
|
||||
memcpy (pskin, skin, skinsize);
|
||||
|
||||
return skin + skinsize;
|
||||
}
|
||||
|
||||
void *
|
||||
Mod_LoadAllSkins (int numskins, daliasskintype_t *pskintype, int *pskinindex)
|
||||
{
|
||||
int snum, gnum, t;
|
||||
int skinsize;
|
||||
byte *skin;
|
||||
int groupskins;
|
||||
daliasskingroup_t *pinskingroup;
|
||||
daliasskininterval_t *pinskinintervals;
|
||||
maliasskindesc_t *pskindesc;
|
||||
maliasskingroup_t *paliasskingroup;
|
||||
float *poutskinintervals;
|
||||
|
||||
if (numskins < 1 || numskins > MAX_SKINS)
|
||||
Sys_Error ("Mod_LoadAliasModel: Invalid # of skins: %d\n", numskins);
|
||||
|
||||
skinsize = pheader->mdl.skinwidth * pheader->mdl.skinheight;
|
||||
pskindesc = Hunk_AllocName (numskins * sizeof (maliasskindesc_t),
|
||||
loadname);
|
||||
|
||||
*pskinindex = (byte *) pskindesc - (byte *) pheader;
|
||||
|
||||
for (snum = 0; snum < numskins; snum++) {
|
||||
pskindesc[snum].type = pskintype->type;
|
||||
if (pskintype->type == ALIAS_SKIN_SINGLE) {
|
||||
skin = (byte *) (pskintype + 1);
|
||||
skin = Mod_LoadSkin (skin, skinsize, &pskindesc[snum]);
|
||||
} else {
|
||||
pskintype++;
|
||||
pinskingroup = (daliasskingroup_t *) pskintype;
|
||||
groupskins = LittleLong (pinskingroup->numskins);
|
||||
|
||||
t = field_offset (maliasskingroup_t, skindescs[groupskins]);
|
||||
paliasskingroup = Hunk_AllocName (t, loadname);
|
||||
paliasskingroup->numskins = groupskins;
|
||||
|
||||
pskindesc[snum].skin = (byte *) paliasskingroup - (byte *) pheader;
|
||||
|
||||
pinskinintervals = (daliasskininterval_t *) (pinskingroup + 1);
|
||||
poutskinintervals = Hunk_AllocName (groupskins * sizeof (float),
|
||||
loadname);
|
||||
paliasskingroup->intervals =
|
||||
(byte *) poutskinintervals - (byte *) pheader;
|
||||
for (gnum = 0; gnum < groupskins; gnum++) {
|
||||
*poutskinintervals = LittleFloat (pinskinintervals->interval);
|
||||
if (*poutskinintervals <= 0)
|
||||
Sys_Error ("Mod_LoadAliasSkinGroup: interval<=0");
|
||||
|
||||
poutskinintervals++;
|
||||
pinskinintervals++;
|
||||
}
|
||||
|
||||
pskintype = (void *) pinskinintervals;
|
||||
skin = (byte *) pskintype;
|
||||
|
||||
for (gnum = 0; gnum < groupskins; gnum++) {
|
||||
paliasskingroup->skindescs[gnum].type = ALIAS_SKIN_SINGLE;
|
||||
skin = Mod_LoadSkin (skin, skinsize,
|
||||
&paliasskingroup->skindescs[gnum]);
|
||||
}
|
||||
}
|
||||
pskintype = (daliasskintype_t *) skin;
|
||||
}
|
||||
|
||||
return pskintype;
|
||||
}
|
||||
|
||||
void
|
||||
Mod_MakeAliasModelDisplayLists (model_t *m, aliashdr_t *hdr, void *_m, int _s)
|
||||
{
|
||||
int i, j;
|
||||
stvert_t *pstverts;
|
||||
mtriangle_t *ptri;
|
||||
int numv = hdr->mdl.numverts;
|
||||
int numt = hdr->mdl.numtris;
|
||||
|
||||
pstverts = (stvert_t *) Hunk_AllocName (numv * sizeof (stvert_t),
|
||||
loadname);
|
||||
ptri = (mtriangle_t *) Hunk_AllocName (numt * sizeof (mtriangle_t),
|
||||
loadname);
|
||||
|
||||
hdr->stverts = (byte *) pstverts - (byte *) hdr;
|
||||
hdr->triangles = (byte *) ptri - (byte *) hdr;
|
||||
|
||||
for (i = 0; i < numv; i++) {
|
||||
pstverts[i].onseam = stverts[i].onseam;
|
||||
pstverts[i].s = stverts[i].s << 16;
|
||||
pstverts[i].t = stverts[i].t << 16;
|
||||
}
|
||||
|
||||
for (i = 0; i < numt; i++) {
|
||||
ptri[i].facesfront = triangles[i].facesfront;
|
||||
for (j = 0; j < 3; j++) {
|
||||
ptri[i].vertindex[j] = triangles[i].vertindex[j];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void *
|
||||
Mod_LoadAliasFrame (void *pin, int *posenum, maliasframedesc_t *frame)
|
||||
{
|
||||
trivertx_t *pframe, *pinframe;
|
||||
int i, j;
|
||||
daliasframe_t *pdaliasframe;
|
||||
|
||||
pdaliasframe = (daliasframe_t *) pin;
|
||||
|
||||
strcpy (frame->name, pdaliasframe->name);
|
||||
|
||||
for (i = 0; i < 3; i++) { // byte values, don't worry about endianness
|
||||
frame->bboxmin.v[i] = pdaliasframe->bboxmin.v[i];
|
||||
frame->bboxmax.v[i] = pdaliasframe->bboxmax.v[i];
|
||||
}
|
||||
|
||||
pinframe = (trivertx_t *) (pdaliasframe + 1);
|
||||
pframe = Hunk_AllocName (pheader->mdl.numverts * sizeof (*pframe),
|
||||
loadname);
|
||||
|
||||
frame->frame = (byte *) pframe - (byte *) pheader;
|
||||
|
||||
for (j = 0; j < pheader->mdl.numverts; j++) {
|
||||
int k;
|
||||
|
||||
// these are all byte values, so no need to deal with endianness
|
||||
pframe[j].lightnormalindex = pinframe[j].lightnormalindex;
|
||||
|
||||
for (k = 0; k < 3; k++) {
|
||||
pframe[j].v[k] = pinframe[j].v[k];
|
||||
}
|
||||
}
|
||||
|
||||
pinframe += pheader->mdl.numverts;
|
||||
|
||||
return (void *) pinframe;
|
||||
}
|
||||
|
||||
void *
|
||||
Mod_LoadAliasGroup (void *pin, int *posenum, maliasframedesc_t *frame)
|
||||
{
|
||||
daliasgroup_t *pingroup;
|
||||
maliasgroup_t *paliasgroup;
|
||||
int i, numframes;
|
||||
daliasinterval_t *pin_intervals;
|
||||
float *poutintervals;
|
||||
void *ptemp;
|
||||
|
||||
pingroup = (daliasgroup_t *) pin;
|
||||
|
||||
numframes = LittleLong (pingroup->numframes);
|
||||
|
||||
paliasgroup = Hunk_AllocName (sizeof (maliasgroup_t) + (numframes - 1) *
|
||||
sizeof (paliasgroup->frames[0]), loadname);
|
||||
paliasgroup->numframes = numframes;
|
||||
|
||||
for (i = 0; i < 3; i++) {
|
||||
// these are byte values, so we don't have to worry about endianness
|
||||
frame->bboxmin.v[i] = pingroup->bboxmin.v[i];
|
||||
frame->bboxmax.v[i] = pingroup->bboxmax.v[i];
|
||||
}
|
||||
|
||||
frame->frame = (byte *) paliasgroup - (byte *) pheader;
|
||||
|
||||
pin_intervals = (daliasinterval_t *) (pingroup + 1);
|
||||
|
||||
poutintervals = Hunk_AllocName (numframes * sizeof (float), loadname);
|
||||
|
||||
paliasgroup->intervals = (byte *) poutintervals - (byte *) pheader;
|
||||
|
||||
for (i = 0; i < numframes; i++) {
|
||||
*poutintervals = LittleFloat (pin_intervals->interval);
|
||||
if (*poutintervals <= 0.0)
|
||||
Sys_Error ("Mod_LoadAliasGroup: interval<=0");
|
||||
|
||||
poutintervals++;
|
||||
pin_intervals++;
|
||||
}
|
||||
|
||||
ptemp = (void *) pin_intervals;
|
||||
|
||||
for (i = 0; i < numframes; i++) {
|
||||
maliasframedesc_t temp_frame;
|
||||
ptemp = Mod_LoadAliasFrame (ptemp, &i, &temp_frame);
|
||||
memcpy (&paliasgroup->frames[i], &temp_frame,
|
||||
sizeof(paliasgroup->frames[i]));
|
||||
}
|
||||
|
||||
return ptemp;
|
||||
}
|
||||
|
||||
void
|
||||
Mod_FinalizeAliasModel (model_t *m, aliashdr_t *hdr)
|
||||
{
|
||||
}
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
cl_model.c
|
||||
sw_model_alias.c
|
||||
|
||||
model loading and caching
|
||||
|
||||
|
@ -40,7 +40,6 @@ static const char rcsid[] =
|
|||
# include <strings.h>
|
||||
#endif
|
||||
|
||||
#include "QF/checksum.h"
|
||||
#include "QF/model.h"
|
||||
#include "QF/qendian.h"
|
||||
#include "QF/sys.h"
|
||||
|
@ -60,99 +59,19 @@ static const char rcsid[] =
|
|||
|
||||
|
||||
void *
|
||||
Mod_LoadSkin (byte * skin, int skinsize, maliasskindesc_t *skindesc)
|
||||
Mod_LoadSkin (byte *skin, int skinsize, int snum, int gnum,
|
||||
qboolean group, maliasskindesc_t *skindesc)
|
||||
{
|
||||
byte *pskin;
|
||||
unsigned short *pusskin;
|
||||
int i;
|
||||
|
||||
pskin = Hunk_AllocName (skinsize * r_pixbytes, loadname);
|
||||
pskin = Hunk_AllocName (skinsize, loadname);
|
||||
skindesc->skin = (byte *) pskin - (byte *) pheader;
|
||||
|
||||
switch (r_pixbytes) {
|
||||
case 1:
|
||||
memcpy (pskin, skin, skinsize);
|
||||
break;
|
||||
case 2:
|
||||
pusskin = (unsigned short *) skin;
|
||||
for (i = 0; i < skinsize; i++)
|
||||
pusskin[i] = d_8to16table[skin[i]];
|
||||
break;
|
||||
default:
|
||||
Sys_Error ("Mod_LoadAliasSkin: driver set invalid r_pixbytes: %d\n",
|
||||
r_pixbytes);
|
||||
break;
|
||||
}
|
||||
memcpy (pskin, skin, skinsize);
|
||||
|
||||
return skin + skinsize;
|
||||
}
|
||||
|
||||
void *
|
||||
Mod_LoadAllSkins (int numskins, daliasskintype_t *pskintype, int *pskinindex)
|
||||
{
|
||||
int snum, gnum, t;
|
||||
int skinsize;
|
||||
byte *skin;
|
||||
int groupskins;
|
||||
daliasskingroup_t *pinskingroup;
|
||||
daliasskininterval_t *pinskinintervals;
|
||||
maliasskindesc_t *pskindesc;
|
||||
maliasskingroup_t *paliasskingroup;
|
||||
float *poutskinintervals;
|
||||
|
||||
if (numskins < 1 || numskins > MAX_SKINS)
|
||||
Sys_Error ("Mod_LoadAliasModel: Invalid # of skins: %d\n", numskins);
|
||||
|
||||
skinsize = pheader->mdl.skinwidth * pheader->mdl.skinheight;
|
||||
pskindesc = Hunk_AllocName (numskins * sizeof (maliasskindesc_t),
|
||||
loadname);
|
||||
|
||||
*pskinindex = (byte *) pskindesc - (byte *) pheader;
|
||||
|
||||
for (snum = 0; snum < numskins; snum++) {
|
||||
pskindesc[snum].type = pskintype->type;
|
||||
if (pskintype->type == ALIAS_SKIN_SINGLE) {
|
||||
skin = (byte *) (pskintype + 1);
|
||||
skin = Mod_LoadSkin (skin, skinsize, &pskindesc[snum]);
|
||||
} else {
|
||||
pskintype++;
|
||||
pinskingroup = (daliasskingroup_t *) pskintype;
|
||||
groupskins = LittleLong (pinskingroup->numskins);
|
||||
|
||||
t = field_offset (maliasskingroup_t, skindescs[groupskins]);
|
||||
paliasskingroup = Hunk_AllocName (t, loadname);
|
||||
paliasskingroup->numskins = groupskins;
|
||||
|
||||
pskindesc[snum].skin = (byte *) paliasskingroup - (byte *) pheader;
|
||||
|
||||
pinskinintervals = (daliasskininterval_t *) (pinskingroup + 1);
|
||||
poutskinintervals = Hunk_AllocName (groupskins * sizeof (float),
|
||||
loadname);
|
||||
paliasskingroup->intervals =
|
||||
(byte *) poutskinintervals - (byte *) pheader;
|
||||
for (gnum = 0; gnum < groupskins; gnum++) {
|
||||
*poutskinintervals = LittleFloat (pinskinintervals->interval);
|
||||
if (*poutskinintervals <= 0)
|
||||
Sys_Error ("Mod_LoadAliasSkinGroup: interval<=0");
|
||||
|
||||
poutskinintervals++;
|
||||
pinskinintervals++;
|
||||
}
|
||||
|
||||
pskintype = (void *) pinskinintervals;
|
||||
skin = (byte *) pskintype;
|
||||
|
||||
for (gnum = 0; gnum < groupskins; gnum++) {
|
||||
paliasskingroup->skindescs[gnum].type = ALIAS_SKIN_SINGLE;
|
||||
skin = Mod_LoadSkin (skin, skinsize,
|
||||
&paliasskingroup->skindescs[gnum]);
|
||||
}
|
||||
}
|
||||
pskintype = (daliasskintype_t *) skin;
|
||||
}
|
||||
|
||||
return pskintype;
|
||||
}
|
||||
|
||||
void
|
||||
Mod_MakeAliasModelDisplayLists (model_t *m, aliashdr_t *hdr, void *_m, int _s)
|
||||
{
|
||||
|
@ -162,8 +81,10 @@ Mod_MakeAliasModelDisplayLists (model_t *m, aliashdr_t *hdr, void *_m, int _s)
|
|||
int numv = hdr->mdl.numverts;
|
||||
int numt = hdr->mdl.numtris;
|
||||
|
||||
pstverts = (stvert_t *) Hunk_AllocName (numv * sizeof (stvert_t), loadname);
|
||||
ptri = (mtriangle_t *) Hunk_AllocName (numt * sizeof (mtriangle_t), loadname);
|
||||
pstverts = (stvert_t *) Hunk_AllocName (numv * sizeof (stvert_t),
|
||||
loadname);
|
||||
ptri = (mtriangle_t *) Hunk_AllocName (numt * sizeof (mtriangle_t),
|
||||
loadname);
|
||||
|
||||
hdr->stverts = (byte *) pstverts - (byte *) hdr;
|
||||
hdr->triangles = (byte *) ptri - (byte *) hdr;
|
||||
|
|
|
@ -8,24 +8,17 @@ else
|
|||
gl=
|
||||
endif
|
||||
|
||||
if BUILD_SW
|
||||
if BUILD_SW_MOD
|
||||
sw= libbrush_sw.la
|
||||
else
|
||||
sw=
|
||||
endif
|
||||
|
||||
if BUILD_SW32
|
||||
sw32= libbrush_sw32.la
|
||||
else
|
||||
sw32=
|
||||
endif
|
||||
|
||||
noinst_LTLIBRARIES= libbrush.la $(gl) $(sw) $(sw32)
|
||||
noinst_LTLIBRARIES= libbrush.la $(gl) $(sw)
|
||||
|
||||
brush_src= model_brush.c
|
||||
gl_src= gl_model_brush.c
|
||||
sw_src= sw_model_brush.c
|
||||
sw32_src= sw32_model_brush.c
|
||||
|
||||
libbrush_la_SOURCES= $(brush_src)
|
||||
|
||||
|
@ -33,6 +26,4 @@ libbrush_gl_la_SOURCES= $(gl_src) $(brush_src)
|
|||
|
||||
libbrush_sw_la_SOURCES= $(sw_src) $(brush_src)
|
||||
|
||||
libbrush_sw32_la_SOURCES= $(sw32_src) $(brush_src)
|
||||
|
||||
EXTRA_DIST= $(gl_src) $(sw_src) $(sw32_src) $(brush_src)
|
||||
EXTRA_DIST= $(gl_src) $(sw_src) $(brush_src)
|
||||
|
|
|
@ -1,68 +0,0 @@
|
|||
/*
|
||||
model_bursh.c
|
||||
|
||||
model loading and caching
|
||||
|
||||
Copyright (C) 1996-1997 Id Software, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 2
|
||||
of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to:
|
||||
|
||||
Free Software Foundation, Inc.
|
||||
59 Temple Place - Suite 330
|
||||
Boston, MA 02111-1307, USA
|
||||
|
||||
*/
|
||||
static const char rcsid[] =
|
||||
"$Id$";
|
||||
|
||||
// models are the only shared resource between a client and server running
|
||||
// on the same machine.
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include "config.h"
|
||||
#endif
|
||||
#ifdef HAVE_STRING_H
|
||||
# include <string.h>
|
||||
#endif
|
||||
#ifdef HAVE_STRINGS_H
|
||||
# include <strings.h>
|
||||
#endif
|
||||
|
||||
#include "QF/model.h"
|
||||
|
||||
|
||||
const int mod_lightmap_bytes = 1;
|
||||
|
||||
|
||||
void
|
||||
GL_SubdivideSurface (msurface_t *fa)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
Mod_ProcessTexture (miptex_t *mt, texture_t *tx)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
Mod_LoadLighting (lump_t *l)
|
||||
{
|
||||
if (!l->filelen) {
|
||||
loadmodel->lightdata = NULL;
|
||||
return;
|
||||
}
|
||||
loadmodel->lightdata = Hunk_AllocName (l->filelen, loadname);
|
||||
memcpy (loadmodel->lightdata, mod_base + l->fileofs, l->filelen);
|
||||
}
|
|
@ -8,29 +8,20 @@ else
|
|||
gl=
|
||||
endif
|
||||
|
||||
if BUILD_SW
|
||||
if BUILD_SW_MOD
|
||||
sw= libsprite_sw.la
|
||||
else
|
||||
sw=
|
||||
endif
|
||||
|
||||
if BUILD_SW32
|
||||
sw32= libsprite_sw32.la
|
||||
else
|
||||
sw32=
|
||||
endif
|
||||
|
||||
noinst_LTLIBRARIES= $(gl) $(sw) $(sw32)
|
||||
noinst_LTLIBRARIES= $(gl) $(sw)
|
||||
|
||||
sprite_src= model_sprite.c
|
||||
gl_src= gl_model_sprite.c
|
||||
sw_src= sw_model_sprite.c
|
||||
sw32_src= sw32_model_sprite.c
|
||||
|
||||
libsprite_gl_la_SOURCES= $(gl_src) $(sprite_src)
|
||||
|
||||
libsprite_sw_la_SOURCES= $(sw_src) $(sprite_src)
|
||||
|
||||
libsprite_sw32_la_SOURCES= $(sw32_src) $(sprite_src)
|
||||
|
||||
EXTRA_DIST= $(gl_src) $(sw_src) $(sw32_src) $(sprite_src)
|
||||
EXTRA_DIST= $(gl_src) $(sw_src) $(sprite_src)
|
||||
|
|
|
@ -1,115 +0,0 @@
|
|||
/*
|
||||
sw_model_sprite.c
|
||||
|
||||
model loading and caching
|
||||
|
||||
Copyright (C) 1996-1997 Id Software, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 2
|
||||
of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to:
|
||||
|
||||
Free Software Foundation, Inc.
|
||||
59 Temple Place - Suite 330
|
||||
Boston, MA 02111-1307, USA
|
||||
|
||||
*/
|
||||
static const char rcsid[] =
|
||||
"$Id$";
|
||||
|
||||
// models are the only shared resource between a client and server running
|
||||
// on the same machine.
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include "config.h"
|
||||
#endif
|
||||
#ifdef HAVE_STRING_H
|
||||
# include <string.h>
|
||||
#endif
|
||||
#ifdef HAVE_STRINGS_H
|
||||
# include <strings.h>
|
||||
#endif
|
||||
|
||||
#include "QF/model.h"
|
||||
#include "QF/qendian.h"
|
||||
#include "QF/sys.h"
|
||||
|
||||
#include "d_iface.h"
|
||||
|
||||
|
||||
|
||||
void *
|
||||
Mod_LoadSpriteFrame (void *pin, mspriteframe_t **ppframe, int framenum)
|
||||
{
|
||||
dspriteframe_t *pinframe;
|
||||
mspriteframe_t *pspriteframe;
|
||||
int width, height, size, origin[2];
|
||||
// int i;
|
||||
|
||||
pinframe = (dspriteframe_t *) pin;
|
||||
|
||||
width = LittleLong (pinframe->width);
|
||||
height = LittleLong (pinframe->height);
|
||||
size = width * height;
|
||||
|
||||
// LordHavoc: sprite renderer uses 8bit pixels regardless of output
|
||||
// (see note below)
|
||||
pspriteframe = Hunk_AllocName (sizeof (mspriteframe_t) + size, loadname);
|
||||
// pspriteframe = Hunk_AllocName (sizeof (mspriteframe_t) + size * r_pixbytes, loadname);
|
||||
|
||||
memset (pspriteframe, 0, sizeof (mspriteframe_t) + size);
|
||||
|
||||
*ppframe = pspriteframe;
|
||||
|
||||
pspriteframe->width = width;
|
||||
pspriteframe->height = height;
|
||||
origin[0] = LittleLong (pinframe->origin[0]);
|
||||
origin[1] = LittleLong (pinframe->origin[1]);
|
||||
|
||||
pspriteframe->up = origin[1];
|
||||
pspriteframe->down = origin[1] - height;
|
||||
pspriteframe->left = origin[0];
|
||||
pspriteframe->right = width + origin[0];
|
||||
|
||||
// LordHavoc: rewrote this and then realized that the sprite renderer uses
|
||||
// pixel conversion anyway
|
||||
memcpy (&pspriteframe->pixels[0], (byte *) (pinframe + 1), size);
|
||||
/*
|
||||
switch(r_pixbytes) {
|
||||
case 1:
|
||||
memcpy (&pspriteframe->pixels[0], (byte *) (pinframe + 1), size);
|
||||
break;
|
||||
case 2:
|
||||
{
|
||||
byte *ppixin = (byte *) (pinframe + 1);
|
||||
unsigned short *ppixout = (unsigned short *) &pspriteframe->pixels[0];
|
||||
for (i = 0; i < size; i++)
|
||||
ppixout[i] = d_8to16table[ppixin[i]];
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
{
|
||||
byte *ppixin = (byte *) (pinframe + 1);
|
||||
unsigned int *ppixout = (int short *) &pspriteframe->pixels[0];
|
||||
for (i = 0; i < size; i++)
|
||||
ppixout[i] = d_8to24table[ppixin[i]];
|
||||
}
|
||||
break;
|
||||
default:
|
||||
Sys_Error("Mod_LoadSpriteFrame: unsupported r_pixbytes %i\n",
|
||||
r_pixbytes);
|
||||
}
|
||||
*/
|
||||
|
||||
return (void *) ((byte *) pinframe + sizeof (dspriteframe_t) + size);
|
||||
}
|
|
@ -27,8 +27,8 @@
|
|||
static const char rcsid[] =
|
||||
"$Id$";
|
||||
|
||||
// models are the only shared resource between a client and server running
|
||||
// on the same machine.
|
||||
// models are the only shared resource between a client and server running
|
||||
// on the same machine.
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include "config.h"
|
||||
|
@ -53,9 +53,7 @@ Mod_LoadSpriteFrame (void *pin, mspriteframe_t **ppframe, int framenum)
|
|||
{
|
||||
dspriteframe_t *pinframe;
|
||||
mspriteframe_t *pspriteframe;
|
||||
int i, width, height, size, origin[2];
|
||||
unsigned short *ppixout;
|
||||
byte *ppixin;
|
||||
int width, height, size, origin[2];
|
||||
|
||||
pinframe = (dspriteframe_t *) pin;
|
||||
|
||||
|
@ -63,8 +61,7 @@ Mod_LoadSpriteFrame (void *pin, mspriteframe_t **ppframe, int framenum)
|
|||
height = LittleLong (pinframe->height);
|
||||
size = width * height;
|
||||
|
||||
pspriteframe = Hunk_AllocName (sizeof (mspriteframe_t) + size * r_pixbytes,
|
||||
loadname);
|
||||
pspriteframe = Hunk_AllocName (sizeof (mspriteframe_t) + size, loadname);
|
||||
|
||||
memset (pspriteframe, 0, sizeof (mspriteframe_t) + size);
|
||||
|
||||
|
@ -80,18 +77,7 @@ Mod_LoadSpriteFrame (void *pin, mspriteframe_t **ppframe, int framenum)
|
|||
pspriteframe->left = origin[0];
|
||||
pspriteframe->right = width + origin[0];
|
||||
|
||||
if (r_pixbytes == 1) {
|
||||
memcpy (&pspriteframe->pixels[0], (byte *) (pinframe + 1), size);
|
||||
} else if (r_pixbytes == 2) {
|
||||
ppixin = (byte *) (pinframe + 1);
|
||||
ppixout = (unsigned short *) &pspriteframe->pixels[0];
|
||||
|
||||
for (i = 0; i < size; i++)
|
||||
ppixout[i] = d_8to16table[ppixin[i]];
|
||||
} else {
|
||||
Sys_Error ("Mod_LoadSpriteFrame: driver set invalid r_pixbytes: %d\n",
|
||||
r_pixbytes);
|
||||
}
|
||||
memcpy (&pspriteframe->pixels[0], (byte *) (pinframe + 1), size);
|
||||
|
||||
return (void *) ((byte *) pinframe + sizeof (dspriteframe_t) + size);
|
||||
}
|
||||
|
|
|
@ -15,8 +15,8 @@ noinst_LTLIBRARIES=
|
|||
endif
|
||||
|
||||
asm_src= \
|
||||
d_draw.S d_draw16.S d_parta.S d_polysa.S d_scana.S d_spr8.S d_varsa.S \
|
||||
surf16.S surf8.S sw_raclipa.S sw_raliasa.S sw_rdrawa.S sw_redgea.S \
|
||||
d_draw.S d_parta.S d_polysa.S d_scana.S d_spr8.S d_varsa.S \
|
||||
surf8.S sw_raclipa.S sw_raliasa.S sw_rdrawa.S sw_redgea.S \
|
||||
sw_rvarsa.S transform.S
|
||||
|
||||
sw_src= \
|
||||
|
|
|
@ -1,985 +0,0 @@
|
|||
/*
|
||||
d_draw16.S
|
||||
|
||||
x86 assembly-language horizontal 8-bpp span-drawing code, with
|
||||
16-pixel subdivision.
|
||||
|
||||
Copyright (C) 1996-1997 Id Software, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 2
|
||||
of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to:
|
||||
|
||||
Free Software Foundation, Inc.
|
||||
59 Temple Place - Suite 330
|
||||
Boston, MA 02111-1307, USA
|
||||
|
||||
$Id$
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
#include "asm_i386.h"
|
||||
#include "quakeasm.h"
|
||||
#include "asm_draw.h"
|
||||
#include "d_ifacea.h"
|
||||
|
||||
#ifdef PIC
|
||||
#undef USE_INTEL_ASM //XXX asm pic hack
|
||||
#endif
|
||||
|
||||
#ifdef USE_INTEL_ASM
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// 8-bpp horizontal span drawing code for polygons, with no transparency and
|
||||
// 16-pixel subdivision.
|
||||
//
|
||||
// Assumes there is at least one span in pspans, and that every span
|
||||
// contains at least one pixel
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
.data
|
||||
|
||||
.text
|
||||
|
||||
// out-of-line, rarely-needed clamping code
|
||||
|
||||
LClampHigh0:
|
||||
movl C(bbextents),%esi
|
||||
jmp LClampReentry0
|
||||
LClampHighOrLow0:
|
||||
jg LClampHigh0
|
||||
xorl %esi,%esi
|
||||
jmp LClampReentry0
|
||||
|
||||
LClampHigh1:
|
||||
movl C(bbextentt),%edx
|
||||
jmp LClampReentry1
|
||||
LClampHighOrLow1:
|
||||
jg LClampHigh1
|
||||
xorl %edx,%edx
|
||||
jmp LClampReentry1
|
||||
|
||||
LClampLow2:
|
||||
movl $4096,%ebp
|
||||
jmp LClampReentry2
|
||||
LClampHigh2:
|
||||
movl C(bbextents),%ebp
|
||||
jmp LClampReentry2
|
||||
|
||||
LClampLow3:
|
||||
movl $4096,%ecx
|
||||
jmp LClampReentry3
|
||||
LClampHigh3:
|
||||
movl C(bbextentt),%ecx
|
||||
jmp LClampReentry3
|
||||
|
||||
LClampLow4:
|
||||
movl $4096,%eax
|
||||
jmp LClampReentry4
|
||||
LClampHigh4:
|
||||
movl C(bbextents),%eax
|
||||
jmp LClampReentry4
|
||||
|
||||
LClampLow5:
|
||||
movl $4096,%ebx
|
||||
jmp LClampReentry5
|
||||
LClampHigh5:
|
||||
movl C(bbextentt),%ebx
|
||||
jmp LClampReentry5
|
||||
|
||||
|
||||
#define pspans 4+16
|
||||
|
||||
.align 4
|
||||
.globl C(D_DrawSpans16)
|
||||
C(D_DrawSpans16):
|
||||
pushl %ebp // preserve caller's stack frame
|
||||
pushl %edi
|
||||
pushl %esi // preserve register variables
|
||||
pushl %ebx
|
||||
|
||||
//
|
||||
// set up scaled-by-16 steps, for 16-long segments; also set up cacheblock
|
||||
// and span list pointers
|
||||
//
|
||||
// TODO: any overlap from rearranging?
|
||||
flds C(d_sdivzstepu)
|
||||
fmuls fp_16
|
||||
movl C(cacheblock),%edx
|
||||
flds C(d_tdivzstepu)
|
||||
fmuls fp_16
|
||||
movl pspans(%esp),%ebx // point to the first span descriptor
|
||||
flds C(d_zistepu)
|
||||
fmuls fp_16
|
||||
movl %edx,pbase // pbase = cacheblock
|
||||
fstps zi16stepu
|
||||
fstps tdivz16stepu
|
||||
fstps sdivz16stepu
|
||||
|
||||
LSpanLoop:
|
||||
//
|
||||
// set up the initial s/z, t/z, and 1/z on the FP stack, and generate the
|
||||
// initial s and t values
|
||||
//
|
||||
// FIXME: pipeline FILD?
|
||||
fildl espan_t_v(%ebx)
|
||||
fildl espan_t_u(%ebx)
|
||||
|
||||
fld %st(1) // dv | du | dv
|
||||
fmuls C(d_sdivzstepv) // dv*d_sdivzstepv | du | dv
|
||||
fld %st(1) // du | dv*d_sdivzstepv | du | dv
|
||||
fmuls C(d_sdivzstepu) // du*d_sdivzstepu | dv*d_sdivzstepv | du | dv
|
||||
fld %st(2) // du | du*d_sdivzstepu | dv*d_sdivzstepv | du | dv
|
||||
fmuls C(d_tdivzstepu) // du*d_tdivzstepu | du*d_sdivzstepu |
|
||||
// dv*d_sdivzstepv | du | dv
|
||||
fxch %st(1) // du*d_sdivzstepu | du*d_tdivzstepu |
|
||||
// dv*d_sdivzstepv | du | dv
|
||||
faddp %st(0),%st(2) // du*d_tdivzstepu |
|
||||
// du*d_sdivzstepu + dv*d_sdivzstepv | du | dv
|
||||
fxch %st(1) // du*d_sdivzstepu + dv*d_sdivzstepv |
|
||||
// du*d_tdivzstepu | du | dv
|
||||
fld %st(3) // dv | du*d_sdivzstepu + dv*d_sdivzstepv |
|
||||
// du*d_tdivzstepu | du | dv
|
||||
fmuls C(d_tdivzstepv) // dv*d_tdivzstepv |
|
||||
// du*d_sdivzstepu + dv*d_sdivzstepv |
|
||||
// du*d_tdivzstepu | du | dv
|
||||
fxch %st(1) // du*d_sdivzstepu + dv*d_sdivzstepv |
|
||||
// dv*d_tdivzstepv | du*d_tdivzstepu | du | dv
|
||||
fadds C(d_sdivzorigin) // sdivz = d_sdivzorigin + dv*d_sdivzstepv +
|
||||
// du*d_sdivzstepu; stays in %st(2) at end
|
||||
fxch %st(4) // dv | dv*d_tdivzstepv | du*d_tdivzstepu | du |
|
||||
// s/z
|
||||
fmuls C(d_zistepv) // dv*d_zistepv | dv*d_tdivzstepv |
|
||||
// du*d_tdivzstepu | du | s/z
|
||||
fxch %st(1) // dv*d_tdivzstepv | dv*d_zistepv |
|
||||
// du*d_tdivzstepu | du | s/z
|
||||
faddp %st(0),%st(2) // dv*d_zistepv |
|
||||
// dv*d_tdivzstepv + du*d_tdivzstepu | du | s/z
|
||||
fxch %st(2) // du | dv*d_tdivzstepv + du*d_tdivzstepu |
|
||||
// dv*d_zistepv | s/z
|
||||
fmuls C(d_zistepu) // du*d_zistepu |
|
||||
// dv*d_tdivzstepv + du*d_tdivzstepu |
|
||||
// dv*d_zistepv | s/z
|
||||
fxch %st(1) // dv*d_tdivzstepv + du*d_tdivzstepu |
|
||||
// du*d_zistepu | dv*d_zistepv | s/z
|
||||
fadds C(d_tdivzorigin) // tdivz = d_tdivzorigin + dv*d_tdivzstepv +
|
||||
// du*d_tdivzstepu; stays in %st(1) at end
|
||||
fxch %st(2) // dv*d_zistepv | du*d_zistepu | t/z | s/z
|
||||
faddp %st(0),%st(1) // dv*d_zistepv + du*d_zistepu | t/z | s/z
|
||||
|
||||
flds fp_64k // fp_64k | dv*d_zistepv + du*d_zistepu | t/z | s/z
|
||||
fxch %st(1) // dv*d_zistepv + du*d_zistepu | fp_64k | t/z | s/z
|
||||
fadds C(d_ziorigin) // zi = d_ziorigin + dv*d_zistepv +
|
||||
// du*d_zistepu; stays in %st(0) at end
|
||||
// 1/z | fp_64k | t/z | s/z
|
||||
//
|
||||
// calculate and clamp s & t
|
||||
//
|
||||
fdivr %st(0),%st(1) // 1/z | z*64k | t/z | s/z
|
||||
|
||||
//
|
||||
// point %edi to the first pixel in the span
|
||||
//
|
||||
movl C(d_viewbuffer),%ecx
|
||||
movl espan_t_v(%ebx),%eax
|
||||
movl %ebx,pspantemp // preserve spans pointer
|
||||
|
||||
movl C(tadjust),%edx
|
||||
movl C(sadjust),%esi
|
||||
movl C(d_scantable)(,%eax,4),%edi // v * screenwidth
|
||||
addl %ecx,%edi
|
||||
movl espan_t_u(%ebx),%ecx
|
||||
addl %ecx,%edi // pdest = &pdestspan[scans->u];
|
||||
movl espan_t_count(%ebx),%ecx
|
||||
|
||||
//
|
||||
// now start the FDIV for the end of the span
|
||||
//
|
||||
cmpl $16,%ecx
|
||||
ja LSetupNotLast1
|
||||
|
||||
decl %ecx
|
||||
jz LCleanup1 // if only one pixel, no need to start an FDIV
|
||||
movl %ecx,spancountminus1
|
||||
|
||||
// finish up the s and t calcs
|
||||
fxch %st(1) // z*64k | 1/z | t/z | s/z
|
||||
|
||||
fld %st(0) // z*64k | z*64k | 1/z | t/z | s/z
|
||||
fmul %st(4),%st(0) // s | z*64k | 1/z | t/z | s/z
|
||||
fxch %st(1) // z*64k | s | 1/z | t/z | s/z
|
||||
fmul %st(3),%st(0) // t | s | 1/z | t/z | s/z
|
||||
fxch %st(1) // s | t | 1/z | t/z | s/z
|
||||
fistpl s // 1/z | t | t/z | s/z
|
||||
fistpl t // 1/z | t/z | s/z
|
||||
|
||||
fildl spancountminus1
|
||||
|
||||
flds C(d_tdivzstepu) // C(d_tdivzstepu) | spancountminus1
|
||||
flds C(d_zistepu) // C(d_zistepu) | C(d_tdivzstepu) | spancountminus1
|
||||
fmul %st(2),%st(0) // C(d_zistepu)*scm1 | C(d_tdivzstepu) | scm1
|
||||
fxch %st(1) // C(d_tdivzstepu) | C(d_zistepu)*scm1 | scm1
|
||||
fmul %st(2),%st(0) // C(d_tdivzstepu)*scm1 | C(d_zistepu)*scm1 | scm1
|
||||
fxch %st(2) // scm1 | C(d_zistepu)*scm1 | C(d_tdivzstepu)*scm1
|
||||
fmuls C(d_sdivzstepu) // C(d_sdivzstepu)*scm1 | C(d_zistepu)*scm1 |
|
||||
// C(d_tdivzstepu)*scm1
|
||||
fxch %st(1) // C(d_zistepu)*scm1 | C(d_sdivzstepu)*scm1 |
|
||||
// C(d_tdivzstepu)*scm1
|
||||
faddp %st(0),%st(3) // C(d_sdivzstepu)*scm1 | C(d_tdivzstepu)*scm1
|
||||
fxch %st(1) // C(d_tdivzstepu)*scm1 | C(d_sdivzstepu)*scm1
|
||||
faddp %st(0),%st(3) // C(d_sdivzstepu)*scm1
|
||||
faddp %st(0),%st(3)
|
||||
|
||||
flds fp_64k
|
||||
fdiv %st(1),%st(0) // this is what we've gone to all this trouble to
|
||||
// overlap
|
||||
jmp LFDIVInFlight1
|
||||
|
||||
LCleanup1:
|
||||
// finish up the s and t calcs
|
||||
fxch %st(1) // z*64k | 1/z | t/z | s/z
|
||||
|
||||
fld %st(0) // z*64k | z*64k | 1/z | t/z | s/z
|
||||
fmul %st(4),%st(0) // s | z*64k | 1/z | t/z | s/z
|
||||
fxch %st(1) // z*64k | s | 1/z | t/z | s/z
|
||||
fmul %st(3),%st(0) // t | s | 1/z | t/z | s/z
|
||||
fxch %st(1) // s | t | 1/z | t/z | s/z
|
||||
fistpl s // 1/z | t | t/z | s/z
|
||||
fistpl t // 1/z | t/z | s/z
|
||||
jmp LFDIVInFlight1
|
||||
|
||||
.align 4
|
||||
LSetupNotLast1:
|
||||
// finish up the s and t calcs
|
||||
fxch %st(1) // z*64k | 1/z | t/z | s/z
|
||||
|
||||
fld %st(0) // z*64k | z*64k | 1/z | t/z | s/z
|
||||
fmul %st(4),%st(0) // s | z*64k | 1/z | t/z | s/z
|
||||
fxch %st(1) // z*64k | s | 1/z | t/z | s/z
|
||||
fmul %st(3),%st(0) // t | s | 1/z | t/z | s/z
|
||||
fxch %st(1) // s | t | 1/z | t/z | s/z
|
||||
fistpl s // 1/z | t | t/z | s/z
|
||||
fistpl t // 1/z | t/z | s/z
|
||||
|
||||
fadds zi16stepu
|
||||
fxch %st(2)
|
||||
fadds sdivz16stepu
|
||||
fxch %st(2)
|
||||
flds tdivz16stepu
|
||||
faddp %st(0),%st(2)
|
||||
flds fp_64k
|
||||
fdiv %st(1),%st(0) // z = 1/1/z
|
||||
// this is what we've gone to all this trouble to
|
||||
// overlap
|
||||
LFDIVInFlight1:
|
||||
|
||||
addl s,%esi
|
||||
addl t,%edx
|
||||
movl C(bbextents),%ebx
|
||||
movl C(bbextentt),%ebp
|
||||
cmpl %ebx,%esi
|
||||
ja LClampHighOrLow0
|
||||
LClampReentry0:
|
||||
movl %esi,s
|
||||
movl pbase,%ebx
|
||||
shll $16,%esi
|
||||
cmpl %ebp,%edx
|
||||
movl %esi,sfracf
|
||||
ja LClampHighOrLow1
|
||||
LClampReentry1:
|
||||
movl %edx,t
|
||||
movl s,%esi // sfrac = scans->sfrac;
|
||||
shll $16,%edx
|
||||
movl t,%eax // tfrac = scans->tfrac;
|
||||
sarl $16,%esi
|
||||
movl %edx,tfracf
|
||||
|
||||
//
|
||||
// calculate the texture starting address
|
||||
//
|
||||
sarl $16,%eax
|
||||
movl C(cachewidth),%edx
|
||||
imull %edx,%eax // (tfrac >> 16) * cachewidth
|
||||
addl %ebx,%esi
|
||||
addl %eax,%esi // psource = pbase + (sfrac >> 16) +
|
||||
// ((tfrac >> 16) * cachewidth);
|
||||
//
|
||||
// determine whether last span or not
|
||||
//
|
||||
cmpl $16,%ecx
|
||||
jna LLastSegment
|
||||
|
||||
//
|
||||
// not the last segment; do full 16-wide segment
|
||||
//
|
||||
LNotLastSegment:
|
||||
|
||||
//
|
||||
// advance s/z, t/z, and 1/z, and calculate s & t at end of span and steps to
|
||||
// get there
|
||||
//
|
||||
|
||||
// pick up after the FDIV that was left in flight previously
|
||||
|
||||
fld %st(0) // duplicate it
|
||||
fmul %st(4),%st(0) // s = s/z * z
|
||||
fxch %st(1)
|
||||
fmul %st(3),%st(0) // t = t/z * z
|
||||
fxch %st(1)
|
||||
fistpl snext
|
||||
fistpl tnext
|
||||
movl snext,%eax
|
||||
movl tnext,%edx
|
||||
|
||||
movb (%esi),%bl // get first source texel
|
||||
subl $16,%ecx // count off this segments' pixels
|
||||
movl C(sadjust),%ebp
|
||||
movl %ecx,counttemp // remember count of remaining pixels
|
||||
|
||||
movl C(tadjust),%ecx
|
||||
movb %bl,(%edi) // store first dest pixel
|
||||
|
||||
addl %eax,%ebp
|
||||
addl %edx,%ecx
|
||||
|
||||
movl C(bbextents),%eax
|
||||
movl C(bbextentt),%edx
|
||||
|
||||
cmpl $4096,%ebp
|
||||
jl LClampLow2
|
||||
cmpl %eax,%ebp
|
||||
ja LClampHigh2
|
||||
LClampReentry2:
|
||||
|
||||
cmpl $4096,%ecx
|
||||
jl LClampLow3
|
||||
cmpl %edx,%ecx
|
||||
ja LClampHigh3
|
||||
LClampReentry3:
|
||||
|
||||
movl %ebp,snext
|
||||
movl %ecx,tnext
|
||||
|
||||
subl s,%ebp
|
||||
subl t,%ecx
|
||||
|
||||
//
|
||||
// set up advancetable
|
||||
//
|
||||
movl %ecx,%eax
|
||||
movl %ebp,%edx
|
||||
sarl $20,%eax // tstep >>= 16;
|
||||
jz LZero
|
||||
sarl $20,%edx // sstep >>= 16;
|
||||
movl C(cachewidth),%ebx
|
||||
imull %ebx,%eax
|
||||
jmp LSetUp1
|
||||
|
||||
LZero:
|
||||
sarl $20,%edx // sstep >>= 16;
|
||||
movl C(cachewidth),%ebx
|
||||
|
||||
LSetUp1:
|
||||
|
||||
addl %edx,%eax // add in sstep
|
||||
// (tstep >> 16) * cachewidth + (sstep >> 16);
|
||||
movl tfracf,%edx
|
||||
movl %eax,advancetable+4 // advance base in t
|
||||
addl %ebx,%eax // ((tstep >> 16) + 1) * cachewidth +
|
||||
// (sstep >> 16);
|
||||
shll $12,%ebp // left-justify sstep fractional part
|
||||
movl sfracf,%ebx
|
||||
shll $12,%ecx // left-justify tstep fractional part
|
||||
movl %eax,advancetable // advance extra in t
|
||||
|
||||
movl %ecx,tstep
|
||||
addl %ecx,%edx // advance tfrac fractional part by tstep frac
|
||||
|
||||
sbbl %ecx,%ecx // turn tstep carry into -1 (0 if none)
|
||||
addl %ebp,%ebx // advance sfrac fractional part by sstep frac
|
||||
adcl advancetable+4(,%ecx,4),%esi // point to next source texel
|
||||
|
||||
addl tstep,%edx
|
||||
sbbl %ecx,%ecx
|
||||
movb (%esi),%al
|
||||
addl %ebp,%ebx
|
||||
movb %al,1(%edi)
|
||||
adcl advancetable+4(,%ecx,4),%esi
|
||||
|
||||
addl tstep,%edx
|
||||
sbbl %ecx,%ecx
|
||||
addl %ebp,%ebx
|
||||
movb (%esi),%al
|
||||
adcl advancetable+4(,%ecx,4),%esi
|
||||
|
||||
addl tstep,%edx
|
||||
sbbl %ecx,%ecx
|
||||
movb %al,2(%edi)
|
||||
addl %ebp,%ebx
|
||||
movb (%esi),%al
|
||||
adcl advancetable+4(,%ecx,4),%esi
|
||||
|
||||
addl tstep,%edx
|
||||
sbbl %ecx,%ecx
|
||||
movb %al,3(%edi)
|
||||
addl %ebp,%ebx
|
||||
movb (%esi),%al
|
||||
adcl advancetable+4(,%ecx,4),%esi
|
||||
|
||||
addl tstep,%edx
|
||||
sbbl %ecx,%ecx
|
||||
movb %al,4(%edi)
|
||||
addl %ebp,%ebx
|
||||
movb (%esi),%al
|
||||
adcl advancetable+4(,%ecx,4),%esi
|
||||
|
||||
addl tstep,%edx
|
||||
sbbl %ecx,%ecx
|
||||
movb %al,5(%edi)
|
||||
addl %ebp,%ebx
|
||||
movb (%esi),%al
|
||||
adcl advancetable+4(,%ecx,4),%esi
|
||||
|
||||
addl tstep,%edx
|
||||
sbbl %ecx,%ecx
|
||||
movb %al,6(%edi)
|
||||
addl %ebp,%ebx
|
||||
movb (%esi),%al
|
||||
adcl advancetable+4(,%ecx,4),%esi
|
||||
|
||||
addl tstep,%edx
|
||||
sbbl %ecx,%ecx
|
||||
movb %al,7(%edi)
|
||||
addl %ebp,%ebx
|
||||
movb (%esi),%al
|
||||
adcl advancetable+4(,%ecx,4),%esi
|
||||
|
||||
|
||||
//
|
||||
// start FDIV for end of next segment in flight, so it can overlap
|
||||
//
|
||||
movl counttemp,%ecx
|
||||
cmpl $16,%ecx // more than one segment after this?
|
||||
ja LSetupNotLast2 // yes
|
||||
|
||||
decl %ecx
|
||||
jz LFDIVInFlight2 // if only one pixel, no need to start an FDIV
|
||||
movl %ecx,spancountminus1
|
||||
fildl spancountminus1
|
||||
|
||||
flds C(d_zistepu) // C(d_zistepu) | spancountminus1
|
||||
fmul %st(1),%st(0) // C(d_zistepu)*scm1 | scm1
|
||||
flds C(d_tdivzstepu) // C(d_tdivzstepu) | C(d_zistepu)*scm1 | scm1
|
||||
fmul %st(2),%st(0) // C(d_tdivzstepu)*scm1 | C(d_zistepu)*scm1 | scm1
|
||||
fxch %st(1) // C(d_zistepu)*scm1 | C(d_tdivzstepu)*scm1 | scm1
|
||||
faddp %st(0),%st(3) // C(d_tdivzstepu)*scm1 | scm1
|
||||
fxch %st(1) // scm1 | C(d_tdivzstepu)*scm1
|
||||
fmuls C(d_sdivzstepu) // C(d_sdivzstepu)*scm1 | C(d_tdivzstepu)*scm1
|
||||
fxch %st(1) // C(d_tdivzstepu)*scm1 | C(d_sdivzstepu)*scm1
|
||||
faddp %st(0),%st(3) // C(d_sdivzstepu)*scm1
|
||||
flds fp_64k // 64k | C(d_sdivzstepu)*scm1
|
||||
fxch %st(1) // C(d_sdivzstepu)*scm1 | 64k
|
||||
faddp %st(0),%st(4) // 64k
|
||||
|
||||
fdiv %st(1),%st(0) // this is what we've gone to all this trouble to
|
||||
// overlap
|
||||
jmp LFDIVInFlight2
|
||||
|
||||
.align 4
|
||||
LSetupNotLast2:
|
||||
fadds zi16stepu
|
||||
fxch %st(2)
|
||||
fadds sdivz16stepu
|
||||
fxch %st(2)
|
||||
flds tdivz16stepu
|
||||
faddp %st(0),%st(2)
|
||||
flds fp_64k
|
||||
fdiv %st(1),%st(0) // z = 1/1/z
|
||||
// this is what we've gone to all this trouble to
|
||||
// overlap
|
||||
LFDIVInFlight2:
|
||||
movl %ecx,counttemp
|
||||
|
||||
addl tstep,%edx
|
||||
sbbl %ecx,%ecx
|
||||
movb %al,8(%edi)
|
||||
addl %ebp,%ebx
|
||||
movb (%esi),%al
|
||||
adcl advancetable+4(,%ecx,4),%esi
|
||||
|
||||
addl tstep,%edx
|
||||
sbbl %ecx,%ecx
|
||||
movb %al,9(%edi)
|
||||
addl %ebp,%ebx
|
||||
movb (%esi),%al
|
||||
adcl advancetable+4(,%ecx,4),%esi
|
||||
|
||||
addl tstep,%edx
|
||||
sbbl %ecx,%ecx
|
||||
movb %al,10(%edi)
|
||||
addl %ebp,%ebx
|
||||
movb (%esi),%al
|
||||
adcl advancetable+4(,%ecx,4),%esi
|
||||
|
||||
addl tstep,%edx
|
||||
sbbl %ecx,%ecx
|
||||
movb %al,11(%edi)
|
||||
addl %ebp,%ebx
|
||||
movb (%esi),%al
|
||||
adcl advancetable+4(,%ecx,4),%esi
|
||||
|
||||
addl tstep,%edx
|
||||
sbbl %ecx,%ecx
|
||||
movb %al,12(%edi)
|
||||
addl %ebp,%ebx
|
||||
movb (%esi),%al
|
||||
adcl advancetable+4(,%ecx,4),%esi
|
||||
|
||||
addl tstep,%edx
|
||||
sbbl %ecx,%ecx
|
||||
movb %al,13(%edi)
|
||||
addl %ebp,%ebx
|
||||
movb (%esi),%al
|
||||
adcl advancetable+4(,%ecx,4),%esi
|
||||
|
||||
addl tstep,%edx
|
||||
sbbl %ecx,%ecx
|
||||
movb %al,14(%edi)
|
||||
addl %ebp,%ebx
|
||||
movb (%esi),%al
|
||||
adcl advancetable+4(,%ecx,4),%esi
|
||||
|
||||
addl $16,%edi
|
||||
movl %edx,tfracf
|
||||
movl snext,%edx
|
||||
movl %ebx,sfracf
|
||||
movl tnext,%ebx
|
||||
movl %edx,s
|
||||
movl %ebx,t
|
||||
|
||||
movl counttemp,%ecx // retrieve count
|
||||
|
||||
//
|
||||
// determine whether last span or not
|
||||
//
|
||||
cmpl $16,%ecx // are there multiple segments remaining?
|
||||
movb %al,-1(%edi)
|
||||
ja LNotLastSegment // yes
|
||||
|
||||
//
|
||||
// last segment of scan
|
||||
//
|
||||
LLastSegment:
|
||||
|
||||
//
|
||||
// advance s/z, t/z, and 1/z, and calculate s & t at end of span and steps to
|
||||
// get there. The number of pixels left is variable, and we want to land on the
|
||||
// last pixel, not step one past it, so we can't run into arithmetic problems
|
||||
//
|
||||
testl %ecx,%ecx
|
||||
jz LNoSteps // just draw the last pixel and we're done
|
||||
|
||||
// pick up after the FDIV that was left in flight previously
|
||||
|
||||
|
||||
fld %st(0) // duplicate it
|
||||
fmul %st(4),%st(0) // s = s/z * z
|
||||
fxch %st(1)
|
||||
fmul %st(3),%st(0) // t = t/z * z
|
||||
fxch %st(1)
|
||||
fistpl snext
|
||||
fistpl tnext
|
||||
|
||||
movb (%esi),%al // load first texel in segment
|
||||
movl C(tadjust),%ebx
|
||||
movb %al,(%edi) // store first pixel in segment
|
||||
movl C(sadjust),%eax
|
||||
|
||||
addl snext,%eax
|
||||
addl tnext,%ebx
|
||||
|
||||
movl C(bbextents),%ebp
|
||||
movl C(bbextentt),%edx
|
||||
|
||||
cmpl $4096,%eax
|
||||
jl LClampLow4
|
||||
cmpl %ebp,%eax
|
||||
ja LClampHigh4
|
||||
LClampReentry4:
|
||||
movl %eax,snext
|
||||
|
||||
cmpl $4096,%ebx
|
||||
jl LClampLow5
|
||||
cmpl %edx,%ebx
|
||||
ja LClampHigh5
|
||||
LClampReentry5:
|
||||
|
||||
cmpl $1,%ecx // don't bother
|
||||
je LOnlyOneStep // if two pixels in segment, there's only one step,
|
||||
// of the segment length
|
||||
subl s,%eax
|
||||
subl t,%ebx
|
||||
|
||||
addl %eax,%eax // convert to 15.17 format so multiply by 1.31
|
||||
addl %ebx,%ebx // reciprocal yields 16.48
|
||||
|
||||
imull reciprocal_table_16-8(,%ecx,4) // sstep = (snext - s) /
|
||||
// (spancount-1)
|
||||
movl %edx,%ebp
|
||||
|
||||
movl %ebx,%eax
|
||||
imull reciprocal_table_16-8(,%ecx,4) // tstep = (tnext - t) /
|
||||
// (spancount-1)
|
||||
LSetEntryvec:
|
||||
//
|
||||
// set up advancetable
|
||||
//
|
||||
movl entryvec_table_16(,%ecx,4),%ebx
|
||||
movl %edx,%eax
|
||||
movl %ebx,jumptemp // entry point into code for RET later
|
||||
movl %ebp,%ecx
|
||||
sarl $16,%edx // tstep >>= 16;
|
||||
movl C(cachewidth),%ebx
|
||||
sarl $16,%ecx // sstep >>= 16;
|
||||
imull %ebx,%edx
|
||||
|
||||
addl %ecx,%edx // add in sstep
|
||||
// (tstep >> 16) * cachewidth + (sstep >> 16);
|
||||
movl tfracf,%ecx
|
||||
movl %edx,advancetable+4 // advance base in t
|
||||
addl %ebx,%edx // ((tstep >> 16) + 1) * cachewidth +
|
||||
// (sstep >> 16);
|
||||
shll $16,%ebp // left-justify sstep fractional part
|
||||
movl sfracf,%ebx
|
||||
shll $16,%eax // left-justify tstep fractional part
|
||||
movl %edx,advancetable // advance extra in t
|
||||
|
||||
movl %eax,tstep
|
||||
movl %ecx,%edx
|
||||
addl %eax,%edx
|
||||
sbbl %ecx,%ecx
|
||||
addl %ebp,%ebx
|
||||
adcl advancetable+4(,%ecx,4),%esi
|
||||
|
||||
jmp *jumptemp // jump to the number-of-pixels handler
|
||||
|
||||
//----------------------------------------
|
||||
|
||||
LNoSteps:
|
||||
movb (%esi),%al // load first texel in segment
|
||||
subl $15,%edi // adjust for hardwired offset
|
||||
jmp LEndSpan
|
||||
|
||||
|
||||
LOnlyOneStep:
|
||||
subl s,%eax
|
||||
subl t,%ebx
|
||||
movl %eax,%ebp
|
||||
movl %ebx,%edx
|
||||
jmp LSetEntryvec
|
||||
|
||||
//----------------------------------------
|
||||
|
||||
.globl Entry2_16, Entry3_16, Entry4_16, Entry5_16
|
||||
.globl Entry6_16, Entry7_16, Entry8_16, Entry9_16
|
||||
.globl Entry10_16, Entry11_16, Entry12_16, Entry13_16
|
||||
.globl Entry14_16, Entry15_16, Entry16_16
|
||||
|
||||
Entry2_16:
|
||||
subl $14,%edi // adjust for hardwired offsets
|
||||
movb (%esi),%al
|
||||
jmp LEntry2_16
|
||||
|
||||
//----------------------------------------
|
||||
|
||||
Entry3_16:
|
||||
subl $13,%edi // adjust for hardwired offsets
|
||||
addl %eax,%edx
|
||||
movb (%esi),%al
|
||||
sbbl %ecx,%ecx
|
||||
addl %ebp,%ebx
|
||||
adcl advancetable+4(,%ecx,4),%esi
|
||||
jmp LEntry3_16
|
||||
|
||||
//----------------------------------------
|
||||
|
||||
Entry4_16:
|
||||
subl $12,%edi // adjust for hardwired offsets
|
||||
addl %eax,%edx
|
||||
movb (%esi),%al
|
||||
sbbl %ecx,%ecx
|
||||
addl %ebp,%ebx
|
||||
adcl advancetable+4(,%ecx,4),%esi
|
||||
addl tstep,%edx
|
||||
jmp LEntry4_16
|
||||
|
||||
//----------------------------------------
|
||||
|
||||
Entry5_16:
|
||||
subl $11,%edi // adjust for hardwired offsets
|
||||
addl %eax,%edx
|
||||
movb (%esi),%al
|
||||
sbbl %ecx,%ecx
|
||||
addl %ebp,%ebx
|
||||
adcl advancetable+4(,%ecx,4),%esi
|
||||
addl tstep,%edx
|
||||
jmp LEntry5_16
|
||||
|
||||
//----------------------------------------
|
||||
|
||||
Entry6_16:
|
||||
subl $10,%edi // adjust for hardwired offsets
|
||||
addl %eax,%edx
|
||||
movb (%esi),%al
|
||||
sbbl %ecx,%ecx
|
||||
addl %ebp,%ebx
|
||||
adcl advancetable+4(,%ecx,4),%esi
|
||||
addl tstep,%edx
|
||||
jmp LEntry6_16
|
||||
|
||||
//----------------------------------------
|
||||
|
||||
Entry7_16:
|
||||
subl $9,%edi // adjust for hardwired offsets
|
||||
addl %eax,%edx
|
||||
movb (%esi),%al
|
||||
sbbl %ecx,%ecx
|
||||
addl %ebp,%ebx
|
||||
adcl advancetable+4(,%ecx,4),%esi
|
||||
addl tstep,%edx
|
||||
jmp LEntry7_16
|
||||
|
||||
//----------------------------------------
|
||||
|
||||
Entry8_16:
|
||||
subl $8,%edi // adjust for hardwired offsets
|
||||
addl %eax,%edx
|
||||
movb (%esi),%al
|
||||
sbbl %ecx,%ecx
|
||||
addl %ebp,%ebx
|
||||
adcl advancetable+4(,%ecx,4),%esi
|
||||
addl tstep,%edx
|
||||
jmp LEntry8_16
|
||||
|
||||
//----------------------------------------
|
||||
|
||||
Entry9_16:
|
||||
subl $7,%edi // adjust for hardwired offsets
|
||||
addl %eax,%edx
|
||||
movb (%esi),%al
|
||||
sbbl %ecx,%ecx
|
||||
addl %ebp,%ebx
|
||||
adcl advancetable+4(,%ecx,4),%esi
|
||||
addl tstep,%edx
|
||||
jmp LEntry9_16
|
||||
|
||||
//----------------------------------------
|
||||
|
||||
Entry10_16:
|
||||
subl $6,%edi // adjust for hardwired offsets
|
||||
addl %eax,%edx
|
||||
movb (%esi),%al
|
||||
sbbl %ecx,%ecx
|
||||
addl %ebp,%ebx
|
||||
adcl advancetable+4(,%ecx,4),%esi
|
||||
addl tstep,%edx
|
||||
jmp LEntry10_16
|
||||
|
||||
//----------------------------------------
|
||||
|
||||
Entry11_16:
|
||||
subl $5,%edi // adjust for hardwired offsets
|
||||
addl %eax,%edx
|
||||
movb (%esi),%al
|
||||
sbbl %ecx,%ecx
|
||||
addl %ebp,%ebx
|
||||
adcl advancetable+4(,%ecx,4),%esi
|
||||
addl tstep,%edx
|
||||
jmp LEntry11_16
|
||||
|
||||
//----------------------------------------
|
||||
|
||||
Entry12_16:
|
||||
subl $4,%edi // adjust for hardwired offsets
|
||||
addl %eax,%edx
|
||||
movb (%esi),%al
|
||||
sbbl %ecx,%ecx
|
||||
addl %ebp,%ebx
|
||||
adcl advancetable+4(,%ecx,4),%esi
|
||||
addl tstep,%edx
|
||||
jmp LEntry12_16
|
||||
|
||||
//----------------------------------------
|
||||
|
||||
Entry13_16:
|
||||
subl $3,%edi // adjust for hardwired offsets
|
||||
addl %eax,%edx
|
||||
movb (%esi),%al
|
||||
sbbl %ecx,%ecx
|
||||
addl %ebp,%ebx
|
||||
adcl advancetable+4(,%ecx,4),%esi
|
||||
addl tstep,%edx
|
||||
jmp LEntry13_16
|
||||
|
||||
//----------------------------------------
|
||||
|
||||
Entry14_16:
|
||||
subl $2,%edi // adjust for hardwired offsets
|
||||
addl %eax,%edx
|
||||
movb (%esi),%al
|
||||
sbbl %ecx,%ecx
|
||||
addl %ebp,%ebx
|
||||
adcl advancetable+4(,%ecx,4),%esi
|
||||
addl tstep,%edx
|
||||
jmp LEntry14_16
|
||||
|
||||
//----------------------------------------
|
||||
|
||||
Entry15_16:
|
||||
decl %edi // adjust for hardwired offsets
|
||||
addl %eax,%edx
|
||||
movb (%esi),%al
|
||||
sbbl %ecx,%ecx
|
||||
addl %ebp,%ebx
|
||||
adcl advancetable+4(,%ecx,4),%esi
|
||||
addl tstep,%edx
|
||||
jmp LEntry15_16
|
||||
|
||||
//----------------------------------------
|
||||
|
||||
Entry16_16:
|
||||
addl %eax,%edx
|
||||
movb (%esi),%al
|
||||
sbbl %ecx,%ecx
|
||||
addl %ebp,%ebx
|
||||
adcl advancetable+4(,%ecx,4),%esi
|
||||
|
||||
addl tstep,%edx
|
||||
sbbl %ecx,%ecx
|
||||
movb %al,1(%edi)
|
||||
addl %ebp,%ebx
|
||||
movb (%esi),%al
|
||||
adcl advancetable+4(,%ecx,4),%esi
|
||||
addl tstep,%edx
|
||||
LEntry15_16:
|
||||
sbbl %ecx,%ecx
|
||||
movb %al,2(%edi)
|
||||
addl %ebp,%ebx
|
||||
movb (%esi),%al
|
||||
adcl advancetable+4(,%ecx,4),%esi
|
||||
addl tstep,%edx
|
||||
LEntry14_16:
|
||||
sbbl %ecx,%ecx
|
||||
movb %al,3(%edi)
|
||||
addl %ebp,%ebx
|
||||
movb (%esi),%al
|
||||
adcl advancetable+4(,%ecx,4),%esi
|
||||
addl tstep,%edx
|
||||
LEntry13_16:
|
||||
sbbl %ecx,%ecx
|
||||
movb %al,4(%edi)
|
||||
addl %ebp,%ebx
|
||||
movb (%esi),%al
|
||||
adcl advancetable+4(,%ecx,4),%esi
|
||||
addl tstep,%edx
|
||||
LEntry12_16:
|
||||
sbbl %ecx,%ecx
|
||||
movb %al,5(%edi)
|
||||
addl %ebp,%ebx
|
||||
movb (%esi),%al
|
||||
adcl advancetable+4(,%ecx,4),%esi
|
||||
addl tstep,%edx
|
||||
LEntry11_16:
|
||||
sbbl %ecx,%ecx
|
||||
movb %al,6(%edi)
|
||||
addl %ebp,%ebx
|
||||
movb (%esi),%al
|
||||
adcl advancetable+4(,%ecx,4),%esi
|
||||
addl tstep,%edx
|
||||
LEntry10_16:
|
||||
sbbl %ecx,%ecx
|
||||
movb %al,7(%edi)
|
||||
addl %ebp,%ebx
|
||||
movb (%esi),%al
|
||||
adcl advancetable+4(,%ecx,4),%esi
|
||||
addl tstep,%edx
|
||||
LEntry9_16:
|
||||
sbbl %ecx,%ecx
|
||||
movb %al,8(%edi)
|
||||
addl %ebp,%ebx
|
||||
movb (%esi),%al
|
||||
adcl advancetable+4(,%ecx,4),%esi
|
||||
addl tstep,%edx
|
||||
LEntry8_16:
|
||||
sbbl %ecx,%ecx
|
||||
movb %al,9(%edi)
|
||||
addl %ebp,%ebx
|
||||
movb (%esi),%al
|
||||
adcl advancetable+4(,%ecx,4),%esi
|
||||
addl tstep,%edx
|
||||
LEntry7_16:
|
||||
sbbl %ecx,%ecx
|
||||
movb %al,10(%edi)
|
||||
addl %ebp,%ebx
|
||||
movb (%esi),%al
|
||||
adcl advancetable+4(,%ecx,4),%esi
|
||||
addl tstep,%edx
|
||||
LEntry6_16:
|
||||
sbbl %ecx,%ecx
|
||||
movb %al,11(%edi)
|
||||
addl %ebp,%ebx
|
||||
movb (%esi),%al
|
||||
adcl advancetable+4(,%ecx,4),%esi
|
||||
addl tstep,%edx
|
||||
LEntry5_16:
|
||||
sbbl %ecx,%ecx
|
||||
movb %al,12(%edi)
|
||||
addl %ebp,%ebx
|
||||
movb (%esi),%al
|
||||
adcl advancetable+4(,%ecx,4),%esi
|
||||
addl tstep,%edx
|
||||
LEntry4_16:
|
||||
sbbl %ecx,%ecx
|
||||
movb %al,13(%edi)
|
||||
addl %ebp,%ebx
|
||||
movb (%esi),%al
|
||||
adcl advancetable+4(,%ecx,4),%esi
|
||||
LEntry3_16:
|
||||
movb %al,14(%edi)
|
||||
movb (%esi),%al
|
||||
LEntry2_16:
|
||||
|
||||
LEndSpan:
|
||||
|
||||
//
|
||||
// clear s/z, t/z, 1/z from FP stack
|
||||
//
|
||||
fstp %st(0)
|
||||
fstp %st(0)
|
||||
fstp %st(0)
|
||||
|
||||
movl pspantemp,%ebx // restore spans pointer
|
||||
movl espan_t_pnext(%ebx),%ebx // point to next span
|
||||
testl %ebx,%ebx // any more spans?
|
||||
movb %al,15(%edi)
|
||||
jnz LSpanLoop // more spans
|
||||
|
||||
popl %ebx // restore register variables
|
||||
popl %esi
|
||||
popl %edi
|
||||
popl %ebp // restore the caller's stack frame
|
||||
ret
|
||||
|
||||
#endif // USE_INTEL_ASM
|
|
@ -59,7 +59,6 @@ D_Init (void)
|
|||
r_drawpolys = false;
|
||||
r_worldpolysbacktofront = false;
|
||||
r_recursiveaffinetriangles = true;
|
||||
r_pixbytes = 1;
|
||||
r_aliasuvscale = 1.0;
|
||||
|
||||
vid.surf_cache_size = D_SurfaceCacheForRes;
|
||||
|
@ -122,18 +121,7 @@ D_SetupFrame (void)
|
|||
for (i = 0; i < (NUM_MIPS - 1); i++)
|
||||
d_scalemip[i] = basemip[i] * d_mipscale->value;
|
||||
|
||||
#ifdef PIC
|
||||
#undef USE_INTEL_ASM //XXX asm pic hack
|
||||
#endif
|
||||
|
||||
#ifdef USE_INTEL_ASM
|
||||
if (d_subdiv16->int_val)
|
||||
d_drawspans = D_DrawSpans16;
|
||||
else
|
||||
d_drawspans = D_DrawSpans8;
|
||||
#else
|
||||
d_drawspans = D_DrawSpans8;
|
||||
#endif
|
||||
|
||||
d_aflatcolor = 0;
|
||||
}
|
||||
|
|
|
@ -72,7 +72,7 @@ D_ViewChanged (void)
|
|||
if (r_dowarp)
|
||||
rowpixels = WARP_WIDTH;
|
||||
else
|
||||
rowpixels = vid.rowbytes / r_pixbytes;
|
||||
rowpixels = vid.rowbytes;
|
||||
|
||||
scale_for_mip = xscale;
|
||||
if (yscale > xscale)
|
||||
|
|
|
@ -124,7 +124,7 @@ izistep: .long 0
|
|||
// local variables for d_draw16.s
|
||||
//-------------------------------------------------------
|
||||
|
||||
.globl reciprocal_table_16, entryvec_table_16
|
||||
.globl reciprocal_table_16
|
||||
// 1/2, 1/3, 1/4, 1/5, 1/6, 1/7, 1/8, 1/9, 1/10, 1/11, 1/12, 1/13,
|
||||
// 1/14, and 1/15 in 0.32 form
|
||||
reciprocal_table_16: .long 0x40000000, 0x2aaaaaaa, 0x20000000
|
||||
|
@ -132,28 +132,6 @@ reciprocal_table_16: .long 0x40000000, 0x2aaaaaaa, 0x20000000
|
|||
.long 0x10000000, 0xe38e38e, 0xccccccc, 0xba2e8ba
|
||||
.long 0xaaaaaaa, 0x9d89d89, 0x9249249, 0x8888888
|
||||
|
||||
#ifndef NeXT
|
||||
.extern Entry2_16
|
||||
.extern Entry3_16
|
||||
.extern Entry4_16
|
||||
.extern Entry5_16
|
||||
.extern Entry6_16
|
||||
.extern Entry7_16
|
||||
.extern Entry8_16
|
||||
.extern Entry9_16
|
||||
.extern Entry10_16
|
||||
.extern Entry11_16
|
||||
.extern Entry12_16
|
||||
.extern Entry13_16
|
||||
.extern Entry14_16
|
||||
.extern Entry15_16
|
||||
.extern Entry16_16
|
||||
#endif
|
||||
|
||||
entryvec_table_16: .long 0, Entry2_16, Entry3_16, Entry4_16
|
||||
.long Entry5_16, Entry6_16, Entry7_16, Entry8_16
|
||||
.long Entry9_16, Entry10_16, Entry11_16, Entry12_16
|
||||
.long Entry13_16, Entry14_16, Entry15_16, Entry16_16
|
||||
|
||||
//-------------------------------------------------------
|
||||
// local variables for d_parta.s
|
||||
|
|
|
@ -203,7 +203,6 @@ Draw_Character (int x, int y, int num)
|
|||
{
|
||||
byte *dest;
|
||||
byte *source;
|
||||
byte *pusdest;
|
||||
int drawline;
|
||||
int row, col;
|
||||
|
||||
|
@ -228,56 +227,27 @@ Draw_Character (int x, int y, int num)
|
|||
} else
|
||||
drawline = 8;
|
||||
|
||||
dest = vid.conbuffer + y * vid.conrowbytes + x;
|
||||
|
||||
if (r_pixbytes == 1) {
|
||||
dest = vid.conbuffer + y * vid.conrowbytes + x;
|
||||
|
||||
while (drawline--) {
|
||||
if (source[0])
|
||||
dest[0] = source[0];
|
||||
if (source[1])
|
||||
dest[1] = source[1];
|
||||
if (source[2])
|
||||
dest[2] = source[2];
|
||||
if (source[3])
|
||||
dest[3] = source[3];
|
||||
if (source[4])
|
||||
dest[4] = source[4];
|
||||
if (source[5])
|
||||
dest[5] = source[5];
|
||||
if (source[6])
|
||||
dest[6] = source[6];
|
||||
if (source[7])
|
||||
dest[7] = source[7];
|
||||
source += 128;
|
||||
dest += vid.conrowbytes;
|
||||
}
|
||||
} else {
|
||||
// FIXME: pre-expand to native format?
|
||||
pusdest = (byte *)
|
||||
((byte *) vid.conbuffer + y * vid.conrowbytes + (x << 1));
|
||||
|
||||
while (drawline--) {
|
||||
if (source[0])
|
||||
pusdest[0] = d_8to16table[source[0]];
|
||||
if (source[1])
|
||||
pusdest[1] = d_8to16table[source[1]];
|
||||
if (source[2])
|
||||
pusdest[2] = d_8to16table[source[2]];
|
||||
if (source[3])
|
||||
pusdest[3] = d_8to16table[source[3]];
|
||||
if (source[4])
|
||||
pusdest[4] = d_8to16table[source[4]];
|
||||
if (source[5])
|
||||
pusdest[5] = d_8to16table[source[5]];
|
||||
if (source[6])
|
||||
pusdest[6] = d_8to16table[source[6]];
|
||||
if (source[7])
|
||||
pusdest[7] = d_8to16table[source[7]];
|
||||
|
||||
source += 128;
|
||||
pusdest += (vid.conrowbytes >> 1);
|
||||
}
|
||||
while (drawline--) {
|
||||
if (source[0])
|
||||
dest[0] = source[0];
|
||||
if (source[1])
|
||||
dest[1] = source[1];
|
||||
if (source[2])
|
||||
dest[2] = source[2];
|
||||
if (source[3])
|
||||
dest[3] = source[3];
|
||||
if (source[4])
|
||||
dest[4] = source[4];
|
||||
if (source[5])
|
||||
dest[5] = source[5];
|
||||
if (source[6])
|
||||
dest[6] = source[6];
|
||||
if (source[7])
|
||||
dest[7] = source[7];
|
||||
source += 128;
|
||||
dest += vid.conrowbytes;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -306,17 +276,9 @@ void
|
|||
Draw_Pixel (int x, int y, byte color)
|
||||
{
|
||||
byte *dest;
|
||||
byte *pusdest;
|
||||
|
||||
if (r_pixbytes == 1) {
|
||||
dest = vid.conbuffer + y * vid.conrowbytes + x;
|
||||
*dest = color;
|
||||
} else {
|
||||
// FIXME: pre-expand to native format?
|
||||
pusdest = (byte *)
|
||||
((byte *) vid.conbuffer + y * vid.conrowbytes + (x << 1));
|
||||
*pusdest = d_8to16table[color];
|
||||
}
|
||||
dest = vid.conbuffer + y * vid.conrowbytes + x;
|
||||
*dest = color;
|
||||
}
|
||||
|
||||
|
||||
|
@ -349,7 +311,6 @@ void
|
|||
Draw_Pic (int x, int y, qpic_t *pic)
|
||||
{
|
||||
byte *dest, *source, tbyte;
|
||||
byte *pusdest;
|
||||
int v, u;
|
||||
|
||||
if (x < 0 || (unsigned int) (x + pic->width) > vid.width || y < 0 ||
|
||||
|
@ -359,56 +320,38 @@ Draw_Pic (int x, int y, qpic_t *pic)
|
|||
|
||||
source = pic->data;
|
||||
|
||||
if (r_pixbytes == 1) {
|
||||
dest = vid.buffer + y * vid.rowbytes + x;
|
||||
|
||||
if (pic->width & 7) { // general
|
||||
for (v = 0; v < pic->height; v++) {
|
||||
for (u = 0; u < pic->width; u++)
|
||||
if ((tbyte = source[u]) != TRANSPARENT_COLOR)
|
||||
dest[u] = tbyte;
|
||||
|
||||
dest += vid.rowbytes;
|
||||
source += pic->width;
|
||||
}
|
||||
} else { // unwound
|
||||
for (v = 0; v < pic->height; v++) {
|
||||
for (u = 0; u < pic->width; u += 8) {
|
||||
if ((tbyte = source[u]) != TRANSPARENT_COLOR)
|
||||
dest[u] = tbyte;
|
||||
if ((tbyte = source[u + 1]) != TRANSPARENT_COLOR)
|
||||
dest[u + 1] = tbyte;
|
||||
if ((tbyte = source[u + 2]) != TRANSPARENT_COLOR)
|
||||
dest[u + 2] = tbyte;
|
||||
if ((tbyte = source[u + 3]) != TRANSPARENT_COLOR)
|
||||
dest[u + 3] = tbyte;
|
||||
if ((tbyte = source[u + 4]) != TRANSPARENT_COLOR)
|
||||
dest[u + 4] = tbyte;
|
||||
if ((tbyte = source[u + 5]) != TRANSPARENT_COLOR)
|
||||
dest[u + 5] = tbyte;
|
||||
if ((tbyte = source[u + 6]) != TRANSPARENT_COLOR)
|
||||
dest[u + 6] = tbyte;
|
||||
if ((tbyte = source[u + 7]) != TRANSPARENT_COLOR)
|
||||
dest[u + 7] = tbyte;
|
||||
}
|
||||
dest += vid.rowbytes;
|
||||
source += pic->width;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// FIXME: pretranslate at load time?
|
||||
pusdest = (byte *) vid.buffer + y * (vid.rowbytes >> 1) + x;
|
||||
dest = vid.buffer + y * vid.rowbytes + x;
|
||||
|
||||
if (pic->width & 7) { // general
|
||||
for (v = 0; v < pic->height; v++) {
|
||||
for (u = 0; u < pic->width; u++) {
|
||||
tbyte = source[u];
|
||||
for (u = 0; u < pic->width; u++)
|
||||
if ((tbyte = source[u]) != TRANSPARENT_COLOR)
|
||||
dest[u] = tbyte;
|
||||
|
||||
if (tbyte != TRANSPARENT_COLOR) {
|
||||
pusdest[u] = d_8to16table[tbyte];
|
||||
}
|
||||
dest += vid.rowbytes;
|
||||
source += pic->width;
|
||||
}
|
||||
} else { // unwound
|
||||
for (v = 0; v < pic->height; v++) {
|
||||
for (u = 0; u < pic->width; u += 8) {
|
||||
if ((tbyte = source[u]) != TRANSPARENT_COLOR)
|
||||
dest[u] = tbyte;
|
||||
if ((tbyte = source[u + 1]) != TRANSPARENT_COLOR)
|
||||
dest[u + 1] = tbyte;
|
||||
if ((tbyte = source[u + 2]) != TRANSPARENT_COLOR)
|
||||
dest[u + 2] = tbyte;
|
||||
if ((tbyte = source[u + 3]) != TRANSPARENT_COLOR)
|
||||
dest[u + 3] = tbyte;
|
||||
if ((tbyte = source[u + 4]) != TRANSPARENT_COLOR)
|
||||
dest[u + 4] = tbyte;
|
||||
if ((tbyte = source[u + 5]) != TRANSPARENT_COLOR)
|
||||
dest[u + 5] = tbyte;
|
||||
if ((tbyte = source[u + 6]) != TRANSPARENT_COLOR)
|
||||
dest[u + 6] = tbyte;
|
||||
if ((tbyte = source[u + 7]) != TRANSPARENT_COLOR)
|
||||
dest[u + 7] = tbyte;
|
||||
}
|
||||
|
||||
pusdest += vid.rowbytes >> 1;
|
||||
dest += vid.rowbytes;
|
||||
source += pic->width;
|
||||
}
|
||||
}
|
||||
|
@ -420,8 +363,7 @@ Draw_SubPic (int x, int y, qpic_t *pic, int srcx, int srcy, int width,
|
|||
int height)
|
||||
{
|
||||
byte *dest, *source;
|
||||
byte *pusdest;
|
||||
int v, u;
|
||||
int v;
|
||||
|
||||
if ((x < 0) ||
|
||||
(x + width > vid.width) || (y < 0) || (y + height > vid.height)) {
|
||||
|
@ -430,26 +372,12 @@ Draw_SubPic (int x, int y, qpic_t *pic, int srcx, int srcy, int width,
|
|||
|
||||
source = pic->data + srcy * pic->width + srcx;
|
||||
|
||||
if (r_pixbytes == 1) {
|
||||
dest = vid.buffer + y * vid.rowbytes + x;
|
||||
dest = vid.buffer + y * vid.rowbytes + x;
|
||||
|
||||
for (v = 0; v < height; v++) {
|
||||
memcpy (dest, source, width);
|
||||
dest += vid.rowbytes;
|
||||
source += pic->width;
|
||||
}
|
||||
} else {
|
||||
// FIXME: pretranslate at load time?
|
||||
pusdest = (byte *) vid.buffer + y * (vid.rowbytes >> 1) + x;
|
||||
|
||||
for (v = 0; v < height; v++) {
|
||||
for (u = srcx; u < (srcx + width); u++) {
|
||||
pusdest[u] = d_8to16table[source[u]];
|
||||
}
|
||||
|
||||
pusdest += vid.rowbytes >> 1;
|
||||
source += pic->width;
|
||||
}
|
||||
for (v = 0; v < height; v++) {
|
||||
memcpy (dest, source, width);
|
||||
dest += vid.rowbytes;
|
||||
source += pic->width;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -458,7 +386,6 @@ void
|
|||
Draw_TransPicTranslate (int x, int y, qpic_t *pic, byte * translation)
|
||||
{
|
||||
byte *dest, *source, tbyte;
|
||||
byte *pusdest;
|
||||
int v, u;
|
||||
|
||||
if (x < 0 || (unsigned int) (x + pic->width) > vid.width || y < 0 ||
|
||||
|
@ -468,56 +395,38 @@ Draw_TransPicTranslate (int x, int y, qpic_t *pic, byte * translation)
|
|||
|
||||
source = pic->data;
|
||||
|
||||
if (r_pixbytes == 1) {
|
||||
dest = vid.buffer + y * vid.rowbytes + x;
|
||||
|
||||
if (pic->width & 7) { // general
|
||||
for (v = 0; v < pic->height; v++) {
|
||||
for (u = 0; u < pic->width; u++)
|
||||
if ((tbyte = source[u]) != TRANSPARENT_COLOR)
|
||||
dest[u] = translation[tbyte];
|
||||
|
||||
dest += vid.rowbytes;
|
||||
source += pic->width;
|
||||
}
|
||||
} else { // unwound
|
||||
for (v = 0; v < pic->height; v++) {
|
||||
for (u = 0; u < pic->width; u += 8) {
|
||||
if ((tbyte = source[u]) != TRANSPARENT_COLOR)
|
||||
dest[u] = translation[tbyte];
|
||||
if ((tbyte = source[u + 1]) != TRANSPARENT_COLOR)
|
||||
dest[u + 1] = translation[tbyte];
|
||||
if ((tbyte = source[u + 2]) != TRANSPARENT_COLOR)
|
||||
dest[u + 2] = translation[tbyte];
|
||||
if ((tbyte = source[u + 3]) != TRANSPARENT_COLOR)
|
||||
dest[u + 3] = translation[tbyte];
|
||||
if ((tbyte = source[u + 4]) != TRANSPARENT_COLOR)
|
||||
dest[u + 4] = translation[tbyte];
|
||||
if ((tbyte = source[u + 5]) != TRANSPARENT_COLOR)
|
||||
dest[u + 5] = translation[tbyte];
|
||||
if ((tbyte = source[u + 6]) != TRANSPARENT_COLOR)
|
||||
dest[u + 6] = translation[tbyte];
|
||||
if ((tbyte = source[u + 7]) != TRANSPARENT_COLOR)
|
||||
dest[u + 7] = translation[tbyte];
|
||||
}
|
||||
dest += vid.rowbytes;
|
||||
source += pic->width;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// FIXME: pretranslate at load time?
|
||||
pusdest = (byte *) vid.buffer + y * (vid.rowbytes >> 1) + x;
|
||||
dest = vid.buffer + y * vid.rowbytes + x;
|
||||
|
||||
if (pic->width & 7) { // general
|
||||
for (v = 0; v < pic->height; v++) {
|
||||
for (u = 0; u < pic->width; u++) {
|
||||
tbyte = source[u];
|
||||
for (u = 0; u < pic->width; u++)
|
||||
if ((tbyte = source[u]) != TRANSPARENT_COLOR)
|
||||
dest[u] = translation[tbyte];
|
||||
|
||||
if (tbyte != TRANSPARENT_COLOR) {
|
||||
pusdest[u] = d_8to16table[tbyte];
|
||||
}
|
||||
dest += vid.rowbytes;
|
||||
source += pic->width;
|
||||
}
|
||||
} else { // unwound
|
||||
for (v = 0; v < pic->height; v++) {
|
||||
for (u = 0; u < pic->width; u += 8) {
|
||||
if ((tbyte = source[u]) != TRANSPARENT_COLOR)
|
||||
dest[u] = translation[tbyte];
|
||||
if ((tbyte = source[u + 1]) != TRANSPARENT_COLOR)
|
||||
dest[u + 1] = translation[tbyte];
|
||||
if ((tbyte = source[u + 2]) != TRANSPARENT_COLOR)
|
||||
dest[u + 2] = translation[tbyte];
|
||||
if ((tbyte = source[u + 3]) != TRANSPARENT_COLOR)
|
||||
dest[u + 3] = translation[tbyte];
|
||||
if ((tbyte = source[u + 4]) != TRANSPARENT_COLOR)
|
||||
dest[u + 4] = translation[tbyte];
|
||||
if ((tbyte = source[u + 5]) != TRANSPARENT_COLOR)
|
||||
dest[u + 5] = translation[tbyte];
|
||||
if ((tbyte = source[u + 6]) != TRANSPARENT_COLOR)
|
||||
dest[u + 6] = translation[tbyte];
|
||||
if ((tbyte = source[u + 7]) != TRANSPARENT_COLOR)
|
||||
dest[u + 7] = translation[tbyte];
|
||||
}
|
||||
|
||||
pusdest += vid.rowbytes >> 1;
|
||||
dest += vid.rowbytes;
|
||||
source += pic->width;
|
||||
}
|
||||
}
|
||||
|
@ -529,54 +438,30 @@ Draw_ConsoleBackground (int lines)
|
|||
{
|
||||
int x, y, v;
|
||||
byte *src, *dest;
|
||||
byte *pusdest;
|
||||
int f, fstep;
|
||||
qpic_t *conback;
|
||||
|
||||
conback = Draw_CachePic ("gfx/conback.lmp", false);
|
||||
|
||||
// draw the pic
|
||||
if (r_pixbytes == 1) {
|
||||
dest = vid.conbuffer;
|
||||
dest = vid.conbuffer;
|
||||
|
||||
for (y = 0; y < lines; y++, dest += vid.conrowbytes) {
|
||||
v = (vid.conheight - lines + y) * 200 / vid.conheight;
|
||||
src = conback->data + v * 320;
|
||||
if (vid.conwidth == 320)
|
||||
memcpy (dest, src, vid.conwidth);
|
||||
else {
|
||||
f = 0;
|
||||
fstep = 320 * 0x10000 / vid.conwidth;
|
||||
for (x = 0; x < vid.conwidth; x += 4) {
|
||||
dest[x] = src[f >> 16];
|
||||
f += fstep;
|
||||
dest[x + 1] = src[f >> 16];
|
||||
f += fstep;
|
||||
dest[x + 2] = src[f >> 16];
|
||||
f += fstep;
|
||||
dest[x + 3] = src[f >> 16];
|
||||
f += fstep;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
pusdest = (byte *) vid.conbuffer;
|
||||
|
||||
for (y = 0; y < lines; y++, pusdest += (vid.conrowbytes >> 1)) {
|
||||
// FIXME: pre-expand to native format?
|
||||
// FIXME: does the endian switching go away in production?
|
||||
v = (vid.conheight - lines + y) * 200 / vid.conheight;
|
||||
src = conback->data + v * 320;
|
||||
for (y = 0; y < lines; y++, dest += vid.conrowbytes) {
|
||||
v = (vid.conheight - lines + y) * 200 / vid.conheight;
|
||||
src = conback->data + v * 320;
|
||||
if (vid.conwidth == 320)
|
||||
memcpy (dest, src, vid.conwidth);
|
||||
else {
|
||||
f = 0;
|
||||
fstep = 320 * 0x10000 / vid.conwidth;
|
||||
for (x = 0; x < vid.conwidth; x += 4) {
|
||||
pusdest[x] = d_8to16table[src[f >> 16]];
|
||||
dest[x] = src[f >> 16];
|
||||
f += fstep;
|
||||
pusdest[x + 1] = d_8to16table[src[f >> 16]];
|
||||
dest[x + 1] = src[f >> 16];
|
||||
f += fstep;
|
||||
pusdest[x + 2] = d_8to16table[src[f >> 16]];
|
||||
dest[x + 2] = src[f >> 16];
|
||||
f += fstep;
|
||||
pusdest[x + 3] = d_8to16table[src[f >> 16]];
|
||||
dest[x + 3] = src[f >> 16];
|
||||
f += fstep;
|
||||
}
|
||||
}
|
||||
|
@ -587,7 +472,7 @@ Draw_ConsoleBackground (int lines)
|
|||
}
|
||||
|
||||
void
|
||||
R_DrawRect8 (vrect_t *prect, int rowbytes, byte * psrc, int transparent)
|
||||
R_DrawRect (vrect_t *prect, int rowbytes, byte * psrc, int transparent)
|
||||
{
|
||||
byte t;
|
||||
int i, j, srcdelta, destdelta;
|
||||
|
@ -623,51 +508,6 @@ R_DrawRect8 (vrect_t *prect, int rowbytes, byte * psrc, int transparent)
|
|||
}
|
||||
|
||||
|
||||
void
|
||||
R_DrawRect16 (vrect_t *prect, int rowbytes, byte * psrc, int transparent)
|
||||
{
|
||||
byte t;
|
||||
int i, j, srcdelta, destdelta;
|
||||
byte *pdest;
|
||||
|
||||
// FIXME: would it be better to pre-expand native-format versions?
|
||||
|
||||
pdest = (byte *) vid.buffer +
|
||||
(prect->y * (vid.rowbytes >> 1)) + prect->x;
|
||||
|
||||
srcdelta = rowbytes - prect->width;
|
||||
destdelta = (vid.rowbytes >> 1) - prect->width;
|
||||
|
||||
if (transparent) {
|
||||
for (i = 0; i < prect->height; i++) {
|
||||
for (j = 0; j < prect->width; j++) {
|
||||
t = *psrc;
|
||||
if (t != TRANSPARENT_COLOR) {
|
||||
*pdest = d_8to16table[t];
|
||||
}
|
||||
|
||||
psrc++;
|
||||
pdest++;
|
||||
}
|
||||
|
||||
psrc += srcdelta;
|
||||
pdest += destdelta;
|
||||
}
|
||||
} else {
|
||||
for (i = 0; i < prect->height; i++) {
|
||||
for (j = 0; j < prect->width; j++) {
|
||||
*pdest = d_8to16table[*psrc];
|
||||
psrc++;
|
||||
pdest++;
|
||||
}
|
||||
|
||||
psrc += srcdelta;
|
||||
pdest += destdelta;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
Draw_TileClear
|
||||
|
||||
|
@ -717,11 +557,7 @@ Draw_TileClear (int x, int y, int w, int h)
|
|||
psrc = r_rectdesc.ptexbytes +
|
||||
(tileoffsety * r_rectdesc.rowbytes) + tileoffsetx;
|
||||
|
||||
if (r_pixbytes == 1) {
|
||||
R_DrawRect8 (&vr, r_rectdesc.rowbytes, psrc, 0);
|
||||
} else {
|
||||
R_DrawRect16 (&vr, r_rectdesc.rowbytes, psrc, 0);
|
||||
}
|
||||
R_DrawRect (&vr, r_rectdesc.rowbytes, psrc, 0);
|
||||
|
||||
vr.x += vr.width;
|
||||
width -= vr.width;
|
||||
|
@ -744,8 +580,6 @@ void
|
|||
Draw_Fill (int x, int y, int w, int h, int c)
|
||||
{
|
||||
byte *dest;
|
||||
byte *pusdest;
|
||||
unsigned int uc;
|
||||
int u, v;
|
||||
|
||||
if (x < 0 || x + w > vid.width || y < 0 || y + h > vid.height) {
|
||||
|
@ -753,19 +587,10 @@ Draw_Fill (int x, int y, int w, int h, int c)
|
|||
return;
|
||||
}
|
||||
|
||||
if (r_pixbytes == 1) {
|
||||
dest = vid.buffer + y * vid.rowbytes + x;
|
||||
for (v = 0; v < h; v++, dest += vid.rowbytes)
|
||||
for (u = 0; u < w; u++)
|
||||
dest[u] = c;
|
||||
} else {
|
||||
uc = d_8to16table[c];
|
||||
|
||||
pusdest = (byte *) vid.buffer + y * (vid.rowbytes >> 1) + x;
|
||||
for (v = 0; v < h; v++, pusdest += (vid.rowbytes >> 1))
|
||||
for (u = 0; u < w; u++)
|
||||
pusdest[u] = uc;
|
||||
}
|
||||
dest = vid.buffer + y * vid.rowbytes + x;
|
||||
for (v = 0; v < h; v++, dest += vid.rowbytes)
|
||||
for (u = 0; u < w; u++)
|
||||
dest[u] = c;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -41,14 +41,7 @@ int r_bmodelactive;
|
|||
|
||||
|
||||
void
|
||||
R_Surf8Patch (void)
|
||||
{
|
||||
// we only patch code on Intel
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
R_Surf16Patch (void)
|
||||
R_SurfPatch (void)
|
||||
{
|
||||
// we only patch code on Intel
|
||||
}
|
||||
|
|
|
@ -1,183 +0,0 @@
|
|||
/*
|
||||
surf16.S
|
||||
|
||||
x86 assembly-language 16 bpp surface block drawing code.
|
||||
|
||||
Copyright (C) 1996-1997 Id Software, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 2
|
||||
of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to:
|
||||
|
||||
Free Software Foundation, Inc.
|
||||
59 Temple Place - Suite 330
|
||||
Boston, MA 02111-1307, USA
|
||||
|
||||
$Id$
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
#include "asm_i386.h"
|
||||
#include "quakeasm.h"
|
||||
#include "asm_draw.h"
|
||||
|
||||
#ifdef PIC
|
||||
#undef USE_INTEL_ASM //XXX asm pic hack
|
||||
#endif
|
||||
|
||||
#ifdef USE_INTEL_ASM
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Surface block drawer
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
.data
|
||||
|
||||
k: .long 0
|
||||
loopentry: .long 0
|
||||
|
||||
.align 4
|
||||
blockjumptable16:
|
||||
.long LEnter2_16
|
||||
.long LEnter4_16
|
||||
.long 0, LEnter8_16
|
||||
.long 0, 0, 0, LEnter16_16
|
||||
|
||||
|
||||
.text
|
||||
|
||||
.align 4
|
||||
.globl C(R_Surf16Start)
|
||||
C(R_Surf16Start):
|
||||
|
||||
.align 4
|
||||
.globl C(R_DrawSurfaceBlock16)
|
||||
C(R_DrawSurfaceBlock16):
|
||||
pushl %ebp // preserve caller's stack frame
|
||||
pushl %edi
|
||||
pushl %esi // preserve register variables
|
||||
pushl %ebx
|
||||
|
||||
movl C(blocksize),%eax
|
||||
movl C(prowdestbase),%edi
|
||||
movl C(pbasesource),%esi
|
||||
movl C(sourcesstep),%ebx
|
||||
movl blockjumptable16-4(,%eax,2),%ecx
|
||||
movl %eax,k
|
||||
movl %ecx,loopentry
|
||||
movl C(lightleft),%edx
|
||||
movl C(lightright),%ebp
|
||||
|
||||
Lblockloop16:
|
||||
|
||||
subl %edx,%ebp
|
||||
movb C(blockdivshift),%cl
|
||||
sarl %cl,%ebp
|
||||
jns Lp1_16
|
||||
testl C(blockdivmask),%ebp
|
||||
jz Lp1_16
|
||||
incl %ebp
|
||||
Lp1_16:
|
||||
|
||||
subl %eax,%eax
|
||||
subl %ecx,%ecx // high words must be 0 in loop for addressing
|
||||
|
||||
jmp *loopentry
|
||||
|
||||
.align 4
|
||||
|
||||
#include "block16.h"
|
||||
|
||||
movl C(pbasesource),%esi
|
||||
movl C(lightleft),%edx
|
||||
movl C(lightright),%ebp
|
||||
movl C(sourcetstep),%eax
|
||||
movl C(lightrightstep),%ecx
|
||||
movl C(prowdestbase),%edi
|
||||
|
||||
addl %eax,%esi
|
||||
addl %ecx,%ebp
|
||||
|
||||
movl C(lightleftstep),%eax
|
||||
movl C(surfrowbytes),%ecx
|
||||
|
||||
addl %eax,%edx
|
||||
addl %ecx,%edi
|
||||
|
||||
movl %esi,C(pbasesource)
|
||||
movl %ebp,C(lightright)
|
||||
movl k,%eax
|
||||
movl %edx,C(lightleft)
|
||||
decl %eax
|
||||
movl %edi,C(prowdestbase)
|
||||
movl %eax,k
|
||||
jnz Lblockloop16
|
||||
|
||||
popl %ebx // restore register variables
|
||||
popl %esi
|
||||
popl %edi
|
||||
popl %ebp // restore the caller's stack frame
|
||||
ret
|
||||
|
||||
.globl C(R_Surf16End)
|
||||
C(R_Surf16End):
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Code patching routines
|
||||
//----------------------------------------------------------------------
|
||||
.data
|
||||
|
||||
.align 4
|
||||
LPatchTable16:
|
||||
.long LBPatch0-4
|
||||
.long LBPatch1-4
|
||||
.long LBPatch2-4
|
||||
.long LBPatch3-4
|
||||
.long LBPatch4-4
|
||||
.long LBPatch5-4
|
||||
.long LBPatch6-4
|
||||
.long LBPatch7-4
|
||||
.long LBPatch8-4
|
||||
.long LBPatch9-4
|
||||
.long LBPatch10-4
|
||||
.long LBPatch11-4
|
||||
.long LBPatch12-4
|
||||
.long LBPatch13-4
|
||||
.long LBPatch14-4
|
||||
.long LBPatch15-4
|
||||
|
||||
.text
|
||||
|
||||
.align 4
|
||||
.globl C(R_Surf16Patch)
|
||||
C(R_Surf16Patch):
|
||||
pushl %ebx
|
||||
|
||||
movl C(colormap),%eax
|
||||
movl $LPatchTable16,%ebx
|
||||
movl $16,%ecx
|
||||
LPatchLoop16:
|
||||
movl (%ebx),%edx
|
||||
addl $4,%ebx
|
||||
movl %eax,(%edx)
|
||||
decl %ecx
|
||||
jnz LPatchLoop16
|
||||
|
||||
popl %ebx
|
||||
|
||||
ret
|
||||
|
||||
|
||||
#endif // USE_INTEL_ASM
|
|
@ -55,8 +55,8 @@ C(R_Surf8Start):
|
|||
//----------------------------------------------------------------------
|
||||
|
||||
.align 4
|
||||
.globl C(R_DrawSurfaceBlock8_mip0)
|
||||
C(R_DrawSurfaceBlock8_mip0):
|
||||
.globl C(R_DrawSurfaceBlock_mip0)
|
||||
C(R_DrawSurfaceBlock_mip0):
|
||||
pushl %ebp // preserve caller's stack frame
|
||||
pushl %edi
|
||||
pushl %esi // preserve register variables
|
||||
|
@ -281,8 +281,8 @@ LSkip_mip0:
|
|||
//----------------------------------------------------------------------
|
||||
|
||||
.align 4
|
||||
.globl C(R_DrawSurfaceBlock8_mip1)
|
||||
C(R_DrawSurfaceBlock8_mip1):
|
||||
.globl C(R_DrawSurfaceBlock_mip1)
|
||||
C(R_DrawSurfaceBlock_mip1):
|
||||
pushl %ebp // preserve caller's stack frame
|
||||
pushl %edi
|
||||
pushl %esi // preserve register variables
|
||||
|
@ -451,8 +451,8 @@ LSkip_mip1:
|
|||
//----------------------------------------------------------------------
|
||||
|
||||
.align 4
|
||||
.globl C(R_DrawSurfaceBlock8_mip2)
|
||||
C(R_DrawSurfaceBlock8_mip2):
|
||||
.globl C(R_DrawSurfaceBlock_mip2)
|
||||
C(R_DrawSurfaceBlock_mip2):
|
||||
pushl %ebp // preserve caller's stack frame
|
||||
pushl %edi
|
||||
pushl %esi // preserve register variables
|
||||
|
@ -591,8 +591,8 @@ LSkip_mip2:
|
|||
//----------------------------------------------------------------------
|
||||
|
||||
.align 4
|
||||
.globl C(R_DrawSurfaceBlock8_mip3)
|
||||
C(R_DrawSurfaceBlock8_mip3):
|
||||
.globl C(R_DrawSurfaceBlock_mip3)
|
||||
C(R_DrawSurfaceBlock_mip3):
|
||||
pushl %ebp // preserve caller's stack frame
|
||||
pushl %edi
|
||||
pushl %esi // preserve register variables
|
||||
|
@ -774,8 +774,8 @@ LPatchTable8:
|
|||
.text
|
||||
|
||||
.align 4
|
||||
.globl C(R_Surf8Patch)
|
||||
C(R_Surf8Patch):
|
||||
.globl C(R_SurfPatch)
|
||||
C(R_SurfPatch):
|
||||
pushl %ebx
|
||||
|
||||
movl C(colormap),%eax
|
||||
|
|
|
@ -398,17 +398,10 @@ R_ViewChanged (vrect_t *pvrect, int lineadj, float aspect)
|
|||
|
||||
// TODO: collect 386-specific code in one place
|
||||
#ifdef USE_INTEL_ASM
|
||||
if (r_pixbytes == 1) {
|
||||
Sys_MakeCodeWriteable ((long) R_Surf8Start,
|
||||
(long) R_Surf8End - (long) R_Surf8Start);
|
||||
colormap = vid.colormap8;
|
||||
R_Surf8Patch ();
|
||||
} else {
|
||||
Sys_MakeCodeWriteable ((long) R_Surf16Start,
|
||||
(long) R_Surf16End - (long) R_Surf16Start);
|
||||
colormap = vid.colormap16;
|
||||
R_Surf16Patch ();
|
||||
}
|
||||
Sys_MakeCodeWriteable ((long) R_Surf8Start,
|
||||
(long) R_Surf8End - (long) R_Surf8Start);
|
||||
colormap = vid.colormap8;
|
||||
R_SurfPatch ();
|
||||
#endif // USE_INTEL_ASM
|
||||
|
||||
D_ViewChanged ();
|
||||
|
|
|
@ -192,41 +192,6 @@ R_GenSkyTile (void *pdest)
|
|||
}
|
||||
|
||||
|
||||
void
|
||||
R_GenSkyTile16 (void *pdest)
|
||||
{
|
||||
int x, y;
|
||||
int ofs, baseofs;
|
||||
int xshift, yshift;
|
||||
byte *pnewsky;
|
||||
unsigned short *pd;
|
||||
|
||||
xshift = skytime * skyspeed;
|
||||
yshift = skytime * skyspeed;
|
||||
|
||||
pnewsky = (byte *) & newsky[0];
|
||||
pd = (unsigned short *) pdest;
|
||||
|
||||
for (y = 0; y < SKYSIZE; y++) {
|
||||
baseofs = ((y + yshift) & SKYMASK) * 131;
|
||||
|
||||
// FIXME: clean this up
|
||||
// FIXME: do faster unaligned version?
|
||||
for (x = 0; x < SKYSIZE; x++) {
|
||||
ofs = baseofs + ((x + xshift) & SKYMASK);
|
||||
|
||||
*pd = d_8to16table[(*(pnewsky + 128) &
|
||||
*(byte *) & bottommask[ofs]) |
|
||||
*(byte *) & bottomsky[ofs]];
|
||||
pnewsky++;
|
||||
pd++;
|
||||
}
|
||||
|
||||
pnewsky += TILE_SIZE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
R_SetSkyFrame (void)
|
||||
{
|
||||
|
|
|
@ -51,14 +51,14 @@ int r_lightwidth;
|
|||
int r_numhblocks, r_numvblocks;
|
||||
unsigned char *r_source, *r_sourcemax;
|
||||
|
||||
void R_DrawSurfaceBlock8_mip0 (void);
|
||||
void R_DrawSurfaceBlock8_mip1 (void);
|
||||
void R_DrawSurfaceBlock8_mip2 (void);
|
||||
void R_DrawSurfaceBlock8_mip3 (void);
|
||||
void R_DrawSurfaceBlock_mip0 (void);
|
||||
void R_DrawSurfaceBlock_mip1 (void);
|
||||
void R_DrawSurfaceBlock_mip2 (void);
|
||||
void R_DrawSurfaceBlock_mip3 (void);
|
||||
|
||||
static void (*surfmiptable[4]) (void) = {
|
||||
R_DrawSurfaceBlock8_mip0, R_DrawSurfaceBlock8_mip1,
|
||||
R_DrawSurfaceBlock8_mip2, R_DrawSurfaceBlock8_mip3};
|
||||
R_DrawSurfaceBlock_mip0, R_DrawSurfaceBlock_mip1,
|
||||
R_DrawSurfaceBlock_mip2, R_DrawSurfaceBlock_mip3};
|
||||
|
||||
unsigned int blocklights[18 * 18];
|
||||
|
||||
|
@ -249,15 +249,9 @@ R_DrawSurface (void)
|
|||
|
||||
//==============================
|
||||
|
||||
if (r_pixbytes == 1) {
|
||||
pblockdrawer = surfmiptable[r_drawsurf.surfmip];
|
||||
// TODO: only needs to be set when there is a display settings change
|
||||
horzblockstep = blocksize;
|
||||
} else {
|
||||
pblockdrawer = R_DrawSurfaceBlock16;
|
||||
// TODO: only needs to be set when there is a display settings change
|
||||
horzblockstep = blocksize << 1;
|
||||
}
|
||||
pblockdrawer = surfmiptable[r_drawsurf.surfmip];
|
||||
// TODO: only needs to be set when there is a display settings change
|
||||
horzblockstep = blocksize;
|
||||
|
||||
smax = mt->width >> r_drawsurf.surfmip;
|
||||
twidth = texwidth;
|
||||
|
@ -301,7 +295,7 @@ R_DrawSurface (void)
|
|||
#ifndef USE_INTEL_ASM
|
||||
|
||||
void
|
||||
R_DrawSurfaceBlock8_mip0 (void)
|
||||
R_DrawSurfaceBlock_mip0 (void)
|
||||
{
|
||||
int v, i, b, lightstep, lighttemp, light;
|
||||
unsigned char pix, *psource, *prowdest;
|
||||
|
@ -343,7 +337,7 @@ R_DrawSurfaceBlock8_mip0 (void)
|
|||
}
|
||||
|
||||
void
|
||||
R_DrawSurfaceBlock8_mip1 (void)
|
||||
R_DrawSurfaceBlock_mip1 (void)
|
||||
{
|
||||
int v, i, b, lightstep, lighttemp, light;
|
||||
unsigned char pix, *psource, *prowdest;
|
||||
|
@ -385,7 +379,7 @@ R_DrawSurfaceBlock8_mip1 (void)
|
|||
}
|
||||
|
||||
void
|
||||
R_DrawSurfaceBlock8_mip2 (void)
|
||||
R_DrawSurfaceBlock_mip2 (void)
|
||||
{
|
||||
int v, i, b, lightstep, lighttemp, light;
|
||||
unsigned char pix, *psource, *prowdest;
|
||||
|
@ -427,7 +421,7 @@ R_DrawSurfaceBlock8_mip2 (void)
|
|||
}
|
||||
|
||||
void
|
||||
R_DrawSurfaceBlock8_mip3 (void)
|
||||
R_DrawSurfaceBlock_mip3 (void)
|
||||
{
|
||||
int v, i, b, lightstep, lighttemp, light;
|
||||
unsigned char pix, *psource, *prowdest;
|
||||
|
@ -468,50 +462,6 @@ R_DrawSurfaceBlock8_mip3 (void)
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
R_DrawSurfaceBlock16
|
||||
|
||||
FIXME: make this work
|
||||
*/
|
||||
void
|
||||
R_DrawSurfaceBlock16 (void)
|
||||
{
|
||||
int k;
|
||||
unsigned char *psource;
|
||||
int lighttemp, lightstep, light;
|
||||
unsigned short *prowdest;
|
||||
|
||||
prowdest = (unsigned short *) prowdestbase;
|
||||
|
||||
for (k = 0; k < blocksize; k++) {
|
||||
unsigned short *pdest;
|
||||
unsigned char pix;
|
||||
int b;
|
||||
|
||||
psource = pbasesource;
|
||||
lighttemp = lightright - lightleft;
|
||||
lightstep = lighttemp >> blockdivshift;
|
||||
|
||||
light = lightleft;
|
||||
pdest = prowdest;
|
||||
|
||||
for (b = 0; b < blocksize; b++) {
|
||||
pix = *psource;
|
||||
*pdest = vid.colormap16[(light & 0xFF00) + pix];
|
||||
psource += sourcesstep;
|
||||
pdest++;
|
||||
light += lightstep;
|
||||
}
|
||||
|
||||
pbasesource += sourcetstep;
|
||||
lightright += lightrightstep;
|
||||
lightleft += lightleftstep;
|
||||
prowdest = (unsigned short *) ((long) prowdest + surfrowbytes);
|
||||
}
|
||||
|
||||
prowdestbase = prowdest;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
void
|
||||
|
@ -533,42 +483,14 @@ R_GenTurbTile (byte *pbasetex, void *pdest)
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
R_GenTurbTile16 (byte *pbasetex, void *pdest)
|
||||
{
|
||||
int *turb;
|
||||
int i, j, s, t;
|
||||
unsigned short *pd;
|
||||
|
||||
turb = sintable + ((int) (r_realtime * SPEED) & (CYCLE - 1));
|
||||
pd = (unsigned short *) pdest;
|
||||
|
||||
for (i = 0; i < TILE_SIZE; i++) {
|
||||
for (j = 0; j < TILE_SIZE; j++) {
|
||||
s = (((j << 16) + turb[i & (CYCLE - 1)]) >> 16) & 63;
|
||||
t = (((i << 16) + turb[j & (CYCLE - 1)]) >> 16) & 63;
|
||||
*pd++ = d_8to16table[*(pbasetex + (t << 6) + s)];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
R_GenTile (msurface_t *psurf, void *pdest)
|
||||
{
|
||||
if (psurf->flags & SURF_DRAWTURB) {
|
||||
if (r_pixbytes == 1) {
|
||||
R_GenTurbTile (((byte *) psurf->texinfo->texture +
|
||||
psurf->texinfo->texture->offsets[0]), pdest);
|
||||
} else {
|
||||
R_GenTurbTile16 (((byte *) psurf->texinfo->texture +
|
||||
psurf->texinfo->texture->offsets[0]), pdest);
|
||||
}
|
||||
R_GenTurbTile (((byte *) psurf->texinfo->texture +
|
||||
psurf->texinfo->texture->offsets[0]), pdest);
|
||||
} else if (psurf->flags & SURF_DRAWSKY) {
|
||||
if (r_pixbytes == 1) {
|
||||
R_GenSkyTile (pdest);
|
||||
} else {
|
||||
R_GenSkyTile16 (pdest);
|
||||
}
|
||||
R_GenSkyTile (pdest);
|
||||
} else {
|
||||
Sys_Error ("Unknown tile type");
|
||||
}
|
||||
|
|
|
@ -133,12 +133,12 @@ nq_sdl_DEPENDENCIES= $(soft_QFLIBS) \
|
|||
# ... 32-bit software, SDL
|
||||
nq_sdl32_SOURCES= $(combined_sources) sys_sdl.c
|
||||
nq_sdl32_LDADD= $(top_builddir)/libs/video/renderer/libQFrenderer_sw32.la \
|
||||
$(top_builddir)/libs/models/libQFmodels_sw32.la \
|
||||
$(top_builddir)/libs/models/libQFmodels_sw.la \
|
||||
$(top_builddir)/libs/video/targets/libQFsdl32.la \
|
||||
$(client_LIBS) $(SDL_LIBS)
|
||||
nq_sdl32_LDFLAGS= $(common_ldflags)
|
||||
nq_sdl32_DEPENDENCIES= $(top_builddir)/libs/video/renderer/libQFrenderer_sw32.la \
|
||||
$(top_builddir)/libs/models/libQFmodels_sw32.la \
|
||||
$(top_builddir)/libs/models/libQFmodels_sw.la \
|
||||
$(top_builddir)/libs/video/targets/libQFsdl32.la \
|
||||
$(client_LIB_DEPS)
|
||||
|
||||
|
|
|
@ -157,13 +157,13 @@ qw_client_sdl_DEPENDENCIES= \
|
|||
# ... 32-bit software, SDL
|
||||
qw_client_sdl32_SOURCES=$(qw_client_sdl_SOURCES)
|
||||
qw_client_sdl32_LDADD= $(top_builddir)/libs/video/renderer/libQFrenderer_sw32.la \
|
||||
$(top_builddir)/libs/models/libQFmodels_sw32.la \
|
||||
$(top_builddir)/libs/models/libQFmodels_sw.la \
|
||||
$(top_builddir)/libs/video/targets/libQFsdl32.la \
|
||||
$(client_LIBS) $(SDL_LIBS)
|
||||
qw_client_sdl32_LDFLAGS=$(common_ldflags)
|
||||
qw_client_sdl32_DEPENDENCIES= \
|
||||
$(top_builddir)/libs/video/renderer/libQFrenderer_sw32.la \
|
||||
$(top_builddir)/libs/models/libQFmodels_sw32.la \
|
||||
$(top_builddir)/libs/models/libQFmodels_sw.la \
|
||||
$(top_builddir)/libs/video/targets/libQFsdl32.la \
|
||||
$(client_LIB_DEPS)
|
||||
|
||||
|
|
Loading…
Reference in a new issue