mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-23 04:42:32 +00:00
99% merge of d_*.[cS]. just d_polyse to look at
This commit is contained in:
parent
664c640e42
commit
69ab5c981c
10 changed files with 76 additions and 117 deletions
|
@ -33,7 +33,7 @@
|
|||
#include "quakeasm.h"
|
||||
#include "asm_draw.h"
|
||||
|
||||
//#ifdef USE_INTEL_ASM
|
||||
#ifdef USE_INTEL_ASM
|
||||
.data
|
||||
|
||||
LCopyWidth: .long 0
|
||||
|
@ -173,4 +173,4 @@ LLRowLoop:
|
|||
popl %ebp // restore the caller's stack frame
|
||||
|
||||
ret
|
||||
//#endif /* USE_INTEL_ASM */
|
||||
#endif /* USE_INTEL_ASM */
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
d_edge.c
|
||||
|
||||
@description@
|
||||
(description)
|
||||
|
||||
Copyright (C) 1996-1997 Id Software, Inc.
|
||||
|
||||
|
@ -31,19 +31,16 @@
|
|||
#endif
|
||||
|
||||
#include "d_local.h"
|
||||
#include "client.h"
|
||||
#include "r_local.h"
|
||||
#include "render.h"
|
||||
|
||||
static int miplevel;
|
||||
|
||||
float scale_for_mip;
|
||||
int screenwidth;
|
||||
extern int screenwidth;
|
||||
int ubasestep, errorterm, erroradjustup, erroradjustdown;
|
||||
int vstartscan;
|
||||
|
||||
// FIXME: should go away
|
||||
extern void R_RotateBmodel (void);
|
||||
extern void R_TransformFrustum (void);
|
||||
|
||||
vec3_t transformed_modelorg;
|
||||
|
||||
|
||||
|
@ -162,11 +159,11 @@ D_DrawSurfaces (void)
|
|||
vec3_t world_transformed_modelorg;
|
||||
vec3_t local_modelorg;
|
||||
|
||||
currententity = &cl_entities[0];
|
||||
currententity = &r_worldentity;
|
||||
TransformVector (modelorg, transformed_modelorg);
|
||||
VectorCopy (transformed_modelorg, world_transformed_modelorg);
|
||||
|
||||
// TODO: could preset a lot of this at mode set time
|
||||
// TODO: could preset a lot of this at mode set time
|
||||
if (r_drawflat->int_val) {
|
||||
for (s = &surfaces[1]; s < surface_p; s++) {
|
||||
if (!s->spans)
|
||||
|
@ -176,7 +173,7 @@ D_DrawSurfaces (void)
|
|||
d_zistepv = s->d_zistepv;
|
||||
d_ziorigin = s->d_ziorigin;
|
||||
|
||||
D_DrawSolidSurface (s, (int) s->data & 0xFF);
|
||||
D_DrawSolidSurface (s, (int) ((long) s->data & 0xFF));
|
||||
D_DrawZSpans (s->spans);
|
||||
}
|
||||
} else {
|
||||
|
@ -229,6 +226,7 @@ D_DrawSurfaces (void)
|
|||
}
|
||||
|
||||
D_CalcGradients (pface);
|
||||
|
||||
Turbulent8 (s->spans);
|
||||
D_DrawZSpans (s->spans);
|
||||
|
||||
|
@ -237,7 +235,7 @@ D_DrawSurfaces (void)
|
|||
// FIXME: we don't want to do this every time!
|
||||
// TODO: speed up
|
||||
|
||||
currententity = &cl_entities[0];
|
||||
currententity = &r_worldentity;
|
||||
VectorCopy (world_transformed_modelorg,
|
||||
transformed_modelorg);
|
||||
VectorCopy (base_vpn, vpn);
|
||||
|
@ -281,7 +279,6 @@ D_DrawSurfaces (void)
|
|||
// FIXME: we don't want to do this every time!
|
||||
// TODO: speed up
|
||||
|
||||
currententity = &cl_entities[0];
|
||||
VectorCopy (world_transformed_modelorg,
|
||||
transformed_modelorg);
|
||||
VectorCopy (base_vpn, vpn);
|
||||
|
@ -289,6 +286,7 @@ D_DrawSurfaces (void)
|
|||
VectorCopy (base_vright, vright);
|
||||
VectorCopy (base_modelorg, modelorg);
|
||||
R_TransformFrustum ();
|
||||
currententity = &r_worldentity;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
d_init.c
|
||||
|
||||
@description@
|
||||
rasterization driver initialization
|
||||
|
||||
Copyright (C) 1996-1997 Id Software, Inc.
|
||||
|
||||
|
@ -30,7 +30,9 @@
|
|||
# include "config.h"
|
||||
#endif
|
||||
|
||||
#include "QF/compat.h"
|
||||
#include "QF/cvar.h"
|
||||
#include "QF/vid.h"
|
||||
|
||||
#include "d_local.h"
|
||||
#include "r_cvar.h"
|
||||
|
@ -50,15 +52,9 @@ extern int d_aflatcolor;
|
|||
void (*d_drawspans) (espan_t *pspan);
|
||||
|
||||
|
||||
/*
|
||||
===============
|
||||
D_Init
|
||||
===============
|
||||
*/
|
||||
void
|
||||
D_Init (void)
|
||||
{
|
||||
|
||||
r_skydirect = 1;
|
||||
|
||||
r_drawpolys = false;
|
||||
|
@ -75,11 +71,6 @@ D_Init (void)
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
===============
|
||||
D_CopyRects
|
||||
===============
|
||||
*/
|
||||
void
|
||||
D_CopyRects (vrect_t *prects, int transparent)
|
||||
{
|
||||
|
@ -93,23 +84,14 @@ D_CopyRects (vrect_t *prects, int transparent)
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
===============
|
||||
D_EnableBackBufferAccess
|
||||
===============
|
||||
*/
|
||||
void
|
||||
D_EnableBackBufferAccess (void)
|
||||
{
|
||||
|
||||
VID_LockBuffer ();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
===============
|
||||
D_TurnZOn
|
||||
===============
|
||||
*/
|
||||
void
|
||||
D_TurnZOn (void)
|
||||
{
|
||||
|
@ -117,11 +99,6 @@ D_TurnZOn (void)
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
===============
|
||||
D_DisableBackBufferAccess
|
||||
===============
|
||||
*/
|
||||
void
|
||||
D_DisableBackBufferAccess (void)
|
||||
{
|
||||
|
@ -129,11 +106,6 @@ D_DisableBackBufferAccess (void)
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
===============
|
||||
D_SetupFrame
|
||||
===============
|
||||
*/
|
||||
void
|
||||
D_SetupFrame (void)
|
||||
{
|
||||
|
@ -152,16 +124,12 @@ D_SetupFrame (void)
|
|||
d_roverwrapped = false;
|
||||
d_initial_rover = sc_rover;
|
||||
|
||||
d_minmip = d_mipcap->int_val;
|
||||
if (d_minmip > 3)
|
||||
d_minmip = 3;
|
||||
else if (d_minmip < 0)
|
||||
d_minmip = 0;
|
||||
d_minmip = bound (0, d_mipcap->value, 3);
|
||||
|
||||
for (i = 0; i < (NUM_MIPS - 1); i++)
|
||||
d_scalemip[i] = basemip[i] * d_mipscale->value;
|
||||
|
||||
#ifdef USE_INTEL_ASM
|
||||
#ifdef USE_INTEL_ASM
|
||||
if (d_subdiv16->int_val)
|
||||
d_drawspans = D_DrawSpans16;
|
||||
else
|
||||
|
@ -174,15 +142,8 @@ D_SetupFrame (void)
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
===============
|
||||
D_UpdateRects
|
||||
===============
|
||||
*/
|
||||
void
|
||||
D_UpdateRects (vrect_t *prect)
|
||||
{
|
||||
|
||||
// the software driver draws these directly to the vid buffer
|
||||
|
||||
// the software driver draws these directly to the vid buffer
|
||||
}
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
|
||||
/*
|
||||
d_modech.c
|
||||
|
||||
@description@
|
||||
called when mode has just changed
|
||||
|
||||
Copyright (C) 1996-1997 Id Software, Inc.
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
d_scan.c
|
||||
|
||||
@description@
|
||||
Portable C scan-level rasterization code, all pixel depths.
|
||||
|
||||
Copyright (C) 1996-1997 Id Software, Inc.
|
||||
|
||||
|
@ -58,8 +58,8 @@ D_WarpScreen (void)
|
|||
int *turb;
|
||||
int *col;
|
||||
byte **row;
|
||||
byte *rowptr[MAXHEIGHT + (AMP2 * 2)];
|
||||
int column[MAXWIDTH + (AMP2 * 2)];
|
||||
byte *rowptr[1024];
|
||||
int column[1280];
|
||||
float wratio, hratio;
|
||||
|
||||
w = r_refdef.vrect.width;
|
||||
|
@ -84,7 +84,6 @@ D_WarpScreen (void)
|
|||
for (v = 0; v < scr_vrect.height; v++, dest += vid.rowbytes) {
|
||||
col = &column[turb[v]];
|
||||
row = &rowptr[v];
|
||||
|
||||
for (u = 0; u < scr_vrect.width; u += 4) {
|
||||
dest[u + 0] = row[turb[u + 0]][col[u + 0]];
|
||||
dest[u + 1] = row[turb[u + 1]][col[u + 1]];
|
||||
|
@ -95,7 +94,7 @@ D_WarpScreen (void)
|
|||
}
|
||||
|
||||
|
||||
#ifndef USE_INTEL_ASM
|
||||
#ifndef USE_INTEL_ASM
|
||||
void
|
||||
D_DrawTurbulent8Span (void)
|
||||
{
|
||||
|
@ -113,7 +112,7 @@ D_DrawTurbulent8Span (void)
|
|||
r_turb_t += r_turb_tstep;
|
||||
} while (--r_turb_spancount > 0);
|
||||
}
|
||||
#endif // USE_INTEL_ASM
|
||||
#endif // !USE_INTEL_ASM
|
||||
|
||||
|
||||
void
|
||||
|
@ -183,9 +182,10 @@ Turbulent8 (espan_t *pspan)
|
|||
if (snext > bbextents)
|
||||
snext = bbextents;
|
||||
else if (snext < 16)
|
||||
snext = 16; // prevent round-off error on <0 steps
|
||||
// from from causing overstepping &
|
||||
// running off the edge of the texture
|
||||
snext = 16; // prevent round-off error on <0
|
||||
// steps from
|
||||
// from causing overstepping & running off the
|
||||
// edge of the texture
|
||||
|
||||
tnext = (int) (tdivz * z) + tadjust;
|
||||
if (tnext > bbextentt)
|
||||
|
@ -197,10 +197,10 @@ Turbulent8 (espan_t *pspan)
|
|||
r_turb_sstep = (snext - r_turb_s) >> 4;
|
||||
r_turb_tstep = (tnext - r_turb_t) >> 4;
|
||||
} else {
|
||||
// calculate s/z, t/z, zi->fixed s and t at last pixel in span
|
||||
// (so can't step off polygon), clamp, calculate s and t steps
|
||||
// across span by division, biasing steps low so we don't run
|
||||
// off the texture
|
||||
// calculate s/z, t/z, zi->fixed s and t at last pixel in
|
||||
// span (so can't step off polygon), clamp, calculate s and t
|
||||
// steps across span by division, biasing steps low so we
|
||||
// don't run off the texture
|
||||
spancountminus1 = (float) (r_turb_spancount - 1);
|
||||
sdivz += d_sdivzstepu * spancountminus1;
|
||||
tdivz += d_tdivzstepu * spancountminus1;
|
||||
|
@ -241,7 +241,7 @@ Turbulent8 (espan_t *pspan)
|
|||
}
|
||||
|
||||
|
||||
#ifndef USE_INTEL_ASM
|
||||
#ifndef USE_INTEL_ASM
|
||||
void
|
||||
D_DrawSpans8 (espan_t *pspan)
|
||||
{
|
||||
|
@ -308,9 +308,10 @@ D_DrawSpans8 (espan_t *pspan)
|
|||
if (snext > bbextents)
|
||||
snext = bbextents;
|
||||
else if (snext < 8)
|
||||
snext = 8; // prevent round-off error on <0 steps
|
||||
// from causing overstepping & running
|
||||
// off the edge of the texture
|
||||
snext = 8; // prevent round-off error on <0
|
||||
// steps from
|
||||
// from causing overstepping & running off the
|
||||
// edge of the texture
|
||||
|
||||
tnext = (int) (tdivz * z) + tadjust;
|
||||
if (tnext > bbextentt)
|
||||
|
@ -336,8 +337,8 @@ D_DrawSpans8 (espan_t *pspan)
|
|||
snext = bbextents;
|
||||
else if (snext < 8)
|
||||
snext = 8; // prevent round-off error on <0 steps
|
||||
// from causing overstepping & running
|
||||
// off the edge of the texture
|
||||
// from from causing overstepping &
|
||||
// running off the edge of the texture
|
||||
|
||||
tnext = (int) (tdivz * z) + tadjust;
|
||||
if (tnext > bbextentt)
|
||||
|
@ -368,14 +369,14 @@ D_DrawSpans8 (espan_t *pspan)
|
|||
#endif
|
||||
|
||||
|
||||
#ifndef USE_INTEL_ASM
|
||||
#ifndef USE_INTEL_ASM
|
||||
void
|
||||
D_DrawZSpans (espan_t *pspan)
|
||||
{
|
||||
int count, doublecount, izistep;
|
||||
int izi;
|
||||
short *pdest;
|
||||
unsigned ltemp;
|
||||
unsigned int ltemp;
|
||||
double zi;
|
||||
float du, dv;
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
d_sprite.c
|
||||
|
||||
@description@
|
||||
software top-level rasterization driver module for drawing sprites
|
||||
|
||||
Copyright (C) 1996-1997 Id Software, Inc.
|
||||
|
||||
|
@ -38,7 +38,8 @@ static int minindex, maxindex;
|
|||
static sspan_t *sprite_spans;
|
||||
|
||||
|
||||
#ifndef USE_INTEL_ASM
|
||||
#ifndef USE_INTEL_ASM
|
||||
|
||||
void
|
||||
D_SpriteDrawSpans (sspan_t *pspan)
|
||||
{
|
||||
|
@ -116,9 +117,10 @@ D_SpriteDrawSpans (sspan_t *pspan)
|
|||
if (snext > bbextents)
|
||||
snext = bbextents;
|
||||
else if (snext < 8)
|
||||
snext = 8; // prevent round-off error on <0 steps
|
||||
// from causing overstepping & running
|
||||
// off the edge of the texture
|
||||
snext = 8; // prevent round-off error on <0
|
||||
// steps from
|
||||
// from causing overstepping & running off the
|
||||
// edge of the texture
|
||||
|
||||
tnext = (int) (tdivz * z) + tadjust;
|
||||
if (tnext > bbextentt)
|
||||
|
@ -130,10 +132,10 @@ D_SpriteDrawSpans (sspan_t *pspan)
|
|||
sstep = (snext - s) >> 3;
|
||||
tstep = (tnext - t) >> 3;
|
||||
} else {
|
||||
// calculate s/z, t/z, zi->fixed s and t at last pixel in span
|
||||
// (so can't step off polygon), clamp, calculate s and t steps
|
||||
// across span by division, biasing steps low so we don't run
|
||||
// off the texture
|
||||
// calculate s/z, t/z, zi->fixed s and t at last pixel in
|
||||
// span (so can't step off polygon), clamp, calculate s and t
|
||||
// steps across span by division, biasing steps low so we
|
||||
// don't run off the texture
|
||||
spancountminus1 = (float) (spancount - 1);
|
||||
sdivz += d_sdivzstepu * spancountminus1;
|
||||
tdivz += d_tdivzstepu * spancountminus1;
|
||||
|
@ -144,8 +146,8 @@ D_SpriteDrawSpans (sspan_t *pspan)
|
|||
snext = bbextents;
|
||||
else if (snext < 8)
|
||||
snext = 8; // prevent round-off error on <0 steps
|
||||
// from causing overstepping & running
|
||||
// off the edge of the texture
|
||||
// from from causing overstepping &
|
||||
// running off the edge of the texture
|
||||
|
||||
tnext = (int) (tdivz * z) + tadjust;
|
||||
if (tnext > bbextentt)
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
d_surf.c
|
||||
|
||||
@description@
|
||||
rasterization driver surface heap manager
|
||||
|
||||
Copyright (C) 1996-1997 Id Software, Inc.
|
||||
|
||||
|
@ -30,17 +30,12 @@
|
|||
# include "config.h"
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "game.h"
|
||||
#include "QF/sys.h"
|
||||
#include "QF/qargs.h"
|
||||
#include "QF/console.h"
|
||||
#include "d_local.h"
|
||||
#include "QF/qargs.h"
|
||||
#include "r_local.h"
|
||||
#include "d_iface.h"
|
||||
#include "render.h"
|
||||
#include "QF/sys.h"
|
||||
|
||||
float surfscale;
|
||||
qboolean r_cache_thrash; // set if surface cache is thrashing
|
||||
|
@ -74,6 +69,7 @@ D_SurfaceCacheForRes (int width, int height)
|
|||
if (pix > 64000)
|
||||
size += (pix - 64000) * 3;
|
||||
|
||||
|
||||
return size;
|
||||
}
|
||||
|
||||
|
@ -106,9 +102,8 @@ D_ClearCacheGuard (void)
|
|||
void
|
||||
D_InitCaches (void *buffer, int size)
|
||||
{
|
||||
|
||||
if (!msg_suppress_1)
|
||||
Con_Printf ("%ik surface cache\n", size / 1024);
|
||||
// if (!msg_suppress_1)
|
||||
// Con_Printf ("%ik surface cache\n", size/1024);
|
||||
|
||||
sc_size = size - GUARDSIZE;
|
||||
sc_base = (surfcache_t *) buffer;
|
||||
|
@ -156,7 +151,12 @@ D_SCAlloc (int width, int size)
|
|||
if ((size <= 0) || (size > 0x10000))
|
||||
Sys_Error ("D_SCAlloc: bad cache size %d\n", size);
|
||||
|
||||
size = (int) &((surfcache_t *) 0)->data[size];
|
||||
/* This adds the offset of data[0] in the surfcache_t struct. */
|
||||
size += (int) ((surfcache_t *) 0)->data;
|
||||
|
||||
#define SIZE_ALIGN (sizeof(surfcache_t*)-1)
|
||||
size = (size + SIZE_ALIGN) & ~SIZE_ALIGN;
|
||||
#undef SIZE_ALIGN
|
||||
size = (size + 3) & ~3;
|
||||
if (size > sc_size)
|
||||
Sys_Error ("D_SCAlloc: %i > cache size", size);
|
||||
|
@ -226,7 +226,8 @@ D_SCDump (void)
|
|||
for (test = sc_base; test; test = test->next) {
|
||||
if (test == sc_rover)
|
||||
Sys_Printf ("ROVER:\n");
|
||||
printf ("%p : %i bytes %i width\n", test, test->size, test->width);
|
||||
Sys_Printf ("%p : %i bytes %i width\n", test, test->size,
|
||||
test->width);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
d_vars.c
|
||||
|
||||
@description@
|
||||
global refresh variables
|
||||
|
||||
Copyright (C) 1996-1997 Id Software, Inc.
|
||||
|
||||
|
@ -26,18 +26,18 @@
|
|||
$Id$
|
||||
*/
|
||||
|
||||
#ifndef USE_INTEL_ASM
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include "config.h"
|
||||
#endif
|
||||
|
||||
#ifndef USE_INTEL_ASM
|
||||
|
||||
#include "QF/qtypes.h"
|
||||
#include "host.h"
|
||||
|
||||
// all global and static refresh variables are collected in a contiguous block
|
||||
// to avoid cache conflicts.
|
||||
|
||||
// global refresh variables ----------------------------
|
||||
// global refresh variables -----------------------------
|
||||
|
||||
// FIXME: make into one big structure, like cl or sv
|
||||
// FIXME: do separately for refresh engine and driver
|
||||
|
@ -55,4 +55,4 @@ short *d_pzbuffer;
|
|||
unsigned int d_zrowbytes;
|
||||
unsigned int d_zwidth;
|
||||
|
||||
#endif // USE_INTEL_ASM
|
||||
#endif // !USE_INTEL_ASM
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
d_zpoint.c
|
||||
|
||||
@description@
|
||||
software driver module for drawing z-buffered points
|
||||
|
||||
Copyright (C) 1996-1997 Id Software, Inc.
|
||||
|
||||
|
|
|
@ -82,8 +82,6 @@ D_CopyRects (vrect_t *prects, int transparent)
|
|||
// console); Quake will then draw into wherever the driver points vid.buffer
|
||||
// and will call this function before swapping buffers
|
||||
|
||||
UNUSED (prects);
|
||||
UNUSED (transparent);
|
||||
}
|
||||
|
||||
|
||||
|
@ -149,5 +147,4 @@ void
|
|||
D_UpdateRects (vrect_t *prect)
|
||||
{
|
||||
// the software driver draws these directly to the vid buffer
|
||||
UNUSED (prect);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue