Save buffer size and use as limit for operations

This commit is contained in:
Denis Pauk 2021-02-06 23:35:02 +02:00
parent ba173e68b5
commit 791b5e1e13
10 changed files with 114 additions and 104 deletions

View file

@ -373,6 +373,10 @@ extern zvalue_t *d_pzbuffer;
extern int d_minmip;
extern float d_scalemip[NUM_MIPS-1];
extern int vid_buffer_height;
extern int vid_buffer_width;
//===================================================================
extern int cachewidth;

View file

@ -95,7 +95,7 @@ RE_Draw_CharScaled(int x, int y, int c, float scale)
if (y <= -8)
return; // totally off screen
if ( ( y + 8 ) > vid.height ) // status text was missing in sw...
if ( ( y + 8 ) > vid_buffer_height ) // status text was missing in sw...
return;
row = c>>4;
@ -111,12 +111,12 @@ RE_Draw_CharScaled(int x, int y, int c, float scale)
else
drawline = 8;
dest = vid_buffer + y * vid.width + x;
dest = vid_buffer + y * vid_buffer_width + x;
// clipped last lines
if ((y + iscale * (drawline + 1)) > vid.height)
if ((y + iscale * (drawline + 1)) > vid_buffer_height)
{
drawline = (vid.height - y) / iscale;
drawline = (vid_buffer_height - y) / iscale;
}
VID_DamageBuffer(x, y);
@ -134,7 +134,7 @@ RE_Draw_CharScaled(int x, int y, int c, float scale)
dest[u * iscale + xpos] = source[u];
}
}
dest += vid.width;
dest += vid_buffer_width;
}
source += 128;
}
@ -174,8 +174,8 @@ RE_Draw_StretchPicImplementation (int x, int y, int w, int h, const image_t *pic
int skip;
if ((x < 0) ||
(x + w > vid.width) ||
(y + h > vid.height))
(x + w > vid_buffer_width) ||
(y + h > vid_buffer_height))
{
R_Printf(PRINT_ALL, "%s: bad coordinates %dx%d[%dx%d]",
__func__, x, y, w, h);
@ -195,13 +195,13 @@ RE_Draw_StretchPicImplementation (int x, int y, int w, int h, const image_t *pic
else
skip = 0;
dest = vid_buffer + y * vid.width + x;
dest = vid_buffer + y * vid_buffer_width + x;
if (w == pic->width)
{
int v;
for (v=0 ; v<height ; v++, dest += vid.width)
for (v=0 ; v<height ; v++, dest += vid_buffer_width)
{
int sv = (skip + v)*pic->height/h;
source = pic->pixels[0] + sv*pic->width;
@ -219,7 +219,7 @@ RE_Draw_StretchPicImplementation (int x, int y, int w, int h, const image_t *pic
if (sw_retexturing->value)
{
if (pic_width < (vid.width / 3) || pic_height < (vid.height / 3))
if (pic_width < (vid_buffer_width / 3) || pic_height < (vid_buffer_height / 3))
{
image_scaled = malloc(pic_width * pic_height * 9);
@ -246,7 +246,7 @@ RE_Draw_StretchPicImplementation (int x, int y, int w, int h, const image_t *pic
// size of screen tile to pic pixel
int picupscale = h / pic_height;
for (v=0 ; v<height ; v++, dest += vid.width)
for (v=0 ; v<height ; v++, dest += vid_buffer_width)
{
int f, fstep, u;
int sv = (skip + v)*pic_height/h;
@ -267,7 +267,7 @@ RE_Draw_StretchPicImplementation (int x, int y, int w, int h, const image_t *pic
for (i=1; i < picupscale; i++)
{
// go to next line
dest += vid.width;
dest += vid_buffer_width;
memcpy (dest, dest_orig, w);
}
// skip updated lines
@ -340,8 +340,8 @@ RE_Draw_PicScaled(int x, int y, char *name, float scale)
}
if ((x < 0) ||
(x + pic->width * scale > vid.width) ||
(y + pic->height * scale > vid.height))
(x + pic->width * scale > vid_buffer_width) ||
(y + pic->height * scale > vid_buffer_height))
{
R_Printf(PRINT_ALL, "Draw_Pic: bad coordinates\n");
return;
@ -356,7 +356,7 @@ RE_Draw_PicScaled(int x, int y, char *name, float scale)
y = 0;
}
dest = vid_buffer + y * vid.width + x;
dest = vid_buffer + y * vid_buffer_width + x;
VID_DamageBuffer(x, y);
VID_DamageBuffer(x + iscale * pic->width, y + iscale * pic->height);
@ -368,7 +368,7 @@ RE_Draw_PicScaled(int x, int y, char *name, float scale)
for (v=0; v<height; v++)
{
memcpy(dest, source, pic->width);
dest += vid.width;
dest += vid_buffer_width;
source += pic->width;
}
}
@ -390,7 +390,7 @@ RE_Draw_PicScaled(int x, int y, char *name, float scale)
} while (--xpos > 0);
source_u++;
} while (--u > 0);
dest += vid.width;
dest += vid_buffer_width;
}
source += pic->width;
}
@ -407,7 +407,7 @@ RE_Draw_PicScaled(int x, int y, char *name, float scale)
if (source[u] != TRANSPARENT_COLOR)
dest[u] = source[u];
}
dest += vid.width;
dest += vid_buffer_width;
source += pic->width;
}
}
@ -425,7 +425,7 @@ RE_Draw_PicScaled(int x, int y, char *name, float scale)
dest[u * iscale + xpos] = source[u];
}
}
dest += vid.width;
dest += vid_buffer_width;
}
source += pic->width;
}
@ -460,10 +460,10 @@ RE_Draw_TileClear (int x, int y, int w, int h, char *name)
h += y;
y = 0;
}
if (x + w > vid.width)
w = vid.width - x;
if (y + h > vid.height)
h = vid.height - y;
if (x + w > vid_buffer_width)
w = vid_buffer_width - x;
if (y + h > vid_buffer_height)
h = vid_buffer_height - y;
if (w <= 0 || h <= 0)
return;
@ -477,8 +477,8 @@ RE_Draw_TileClear (int x, int y, int w, int h, char *name)
return;
}
x2 = x + w;
pdest = vid_buffer + y * vid.width;
for (i=0 ; i<h ; i++, pdest += vid.width)
pdest = vid_buffer + y * vid_buffer_width;
for (i=0 ; i<h ; i++, pdest += vid_buffer_width)
{
psrc = pic->pixels[0] + pic->width * ((i+y)&63);
for (j=x ; j<x2 ; j++)
@ -500,10 +500,10 @@ RE_Draw_Fill (int x, int y, int w, int h, int c)
pixel_t *dest;
int v;
if (x+w > vid.width)
w = vid.width - x;
if (y+h > vid.height)
h = vid.height - y;
if (x+w > vid_buffer_width)
w = vid_buffer_width - x;
if (y+h > vid_buffer_height)
h = vid_buffer_height - y;
if (x < 0)
{
@ -522,8 +522,8 @@ RE_Draw_Fill (int x, int y, int w, int h, int c)
VID_DamageBuffer(x, y);
VID_DamageBuffer(x + w, y + h);
dest = vid_buffer + y * vid.width + x;
for (v=0 ; v<h ; v++, dest += vid.width)
dest = vid_buffer + y * vid_buffer_width + x;
for (v=0 ; v<h ; v++, dest += vid_buffer_width)
memset(dest, c, w);
}
//=============================================================================
@ -540,17 +540,17 @@ RE_Draw_FadeScreen (void)
int x,y;
VID_DamageBuffer(0, 0);
VID_DamageBuffer(vid.width, vid.height);
VID_DamageBuffer(vid_buffer_width, vid_buffer_height);
for (y=0 ; y<vid.height ; y++)
for (y=0 ; y<vid_buffer_height ; y++)
{
int t;
pixel_t *pbuf;
pbuf = vid_buffer + vid.width * y;
pbuf = vid_buffer + vid_buffer_width * y;
t = (y & 1) << 1;
for (x=0 ; x<vid.width ; x++)
for (x=0 ; x<vid_buffer_width ; x++)
{
if ((x & 3) != t)
pbuf[x] = 0;

View file

@ -766,7 +766,7 @@ D_FlatFillSurface (surf_t *surf, pixel_t color)
{
pixel_t *pdest;
pdest = d_viewbuffer + vid.width*span->v + span->u;
pdest = d_viewbuffer + vid_buffer_width*span->v + span->u;
memset(pdest, color&0xFF, span->count * sizeof(pixel_t));
}
}

View file

@ -250,9 +250,9 @@ VID_DamageZBuffer(int u, int v)
static void
VID_NoDamageZBuffer(void)
{
vid_zminu = vid.width;
vid_zminu = vid_buffer_width;
vid_zmaxu = 0;
vid_zminv = vid.height;
vid_zminv = vid_buffer_height;
vid_zmaxv = 0;
}
@ -284,9 +284,9 @@ static void
VID_WholeDamageZBuffer(void)
{
vid_zminu = 0;
vid_zmaxu = vid.width;
vid_zmaxu = vid_buffer_width;
vid_zminv = 0;
vid_zmaxv = vid.height;
vid_zmaxv = vid_buffer_height;
}
/*
@ -323,9 +323,9 @@ VID_DamageBuffer(int u, int v)
static void
VID_NoDamageBuffer(void)
{
vid_minu = vid.width;
vid_minu = vid_buffer_width;
vid_maxu = 0;
vid_minv = vid.height;
vid_minv = vid_buffer_height;
vid_maxv = 0;
}
@ -334,9 +334,9 @@ static void
VID_WholeDamageBuffer(void)
{
vid_minu = 0;
vid_maxu = vid.width;
vid_maxu = vid_buffer_width;
vid_minv = 0;
vid_maxv = vid.height;
vid_maxv = vid_buffer_height;
}
/*
@ -714,8 +714,8 @@ R_ReallocateMapBuffers (void)
}
// used up to 8 * width spans for render, allocate once before use
if (r_numallocatededgebasespans < vid.width * 8)
r_numallocatededgebasespans = vid.width * 8;
if (r_numallocatededgebasespans < vid_buffer_width * 8)
r_numallocatededgebasespans = vid_buffer_width * 8;
edge_basespans = malloc(r_numallocatededgebasespans * sizeof(espan_t));
if (!edge_basespans)
@ -1311,7 +1311,7 @@ RE_RenderFrame (refdef_t *fd)
VectorCopy (fd->viewangles, r_refdef.viewangles);
// compare current position with old
if (vid.width <= 640 ||
if (vid_buffer_width <= 640 ||
!VectorCompareRound(fd->vieworg, lastvieworg) ||
!VectorCompare(fd->viewangles, lastviewangles))
{
@ -1461,7 +1461,7 @@ RE_BeginFrame( float camera_separation )
VID_WholeDamageBuffer();
// and backbuffer should be zeroed
memset(swap_buffers + ((swap_current + 1)&1), 0,
vid.height * vid.width * sizeof(pixel_t));
vid_buffer_height * vid_buffer_width * sizeof(pixel_t));
vid_gamma->modified = false;
sw_overbrightbits->modified = false;
@ -1891,6 +1891,9 @@ static SDL_Window *window = NULL;
static SDL_Texture *texture = NULL;
static SDL_Renderer *renderer = NULL;
int vid_buffer_height = 0;
int vid_buffer_width = 0;
static int
RE_InitContext(void *win)
{
@ -1927,6 +1930,9 @@ RE_InitContext(void *win)
This will show the new, black contents of the window. */
SDL_RenderPresent(renderer);
vid_buffer_height = vid.height;
vid_buffer_width = vid.width;
texture = SDL_CreateTexture(renderer,
#if SDL_BYTEORDER == SDL_BIG_ENDIAN
SDL_PIXELFORMAT_BGRA8888,
@ -1934,10 +1940,10 @@ RE_InitContext(void *win)
SDL_PIXELFORMAT_ARGB8888,
#endif
SDL_TEXTUREACCESS_STREAMING,
vid.width, vid.height);
vid_buffer_width, vid_buffer_height);
R_InitGraphics(vid.width, vid.height);
SWimp_CreateRender(vid.width, vid.height);
R_InitGraphics(vid_buffer_width, vid_buffer_height);
SWimp_CreateRender(vid_buffer_width, vid_buffer_height);
return true;
}
@ -2069,7 +2075,7 @@ RE_CopyFrame (Uint32 * pixels, int pitch, int vmin, int vmax)
Uint32 *sdl_palette = (Uint32 *)sw_state.currentpalette;
// no gaps between images rows
if (pitch == vid.width)
if (pitch == vid_buffer_width)
{
const Uint32 *max_pixels;
Uint32 *pixels_pos;
@ -2091,19 +2097,19 @@ RE_CopyFrame (Uint32 * pixels, int pitch, int vmin, int vmax)
{
int y,x, buffer_pos, ymin, ymax;
ymin = vmin / vid.width;
ymax = vmax / vid.width;
ymin = vmin / vid_buffer_width;
ymax = vmax / vid_buffer_width;
buffer_pos = ymin * vid.width;
buffer_pos = ymin * vid_buffer_width;
pixels += ymin * pitch;
for (y=ymin; y < ymax; y++)
{
for (x=0; x < vid.width; x ++)
for (x=0; x < vid_buffer_width; x ++)
{
pixels[x] = sdl_palette[vid_buffer[buffer_pos + x]];
}
pixels += pitch;
buffer_pos += vid.width;
buffer_pos += vid_buffer_width;
}
}
}
@ -2148,7 +2154,7 @@ RE_CleanFrame(void)
Uint32 *pixels;
memset(swap_buffers, 0,
vid.height * vid.width * sizeof(pixel_t) * 2);
vid_buffer_height * vid_buffer_width * sizeof(pixel_t) * 2);
if (SDL_LockTexture(texture, NULL, (void**)&pixels, &pitch))
{
@ -2157,7 +2163,7 @@ RE_CleanFrame(void)
}
// only cleanup texture without flush texture to screen
memset(pixels, 0, pitch * vid.height);
memset(pixels, 0, pitch * vid_buffer_height);
SDL_UnlockTexture(texture);
// All changes flushed
@ -2183,12 +2189,12 @@ RE_FlushFrame(int vmin, int vmax)
{
// On MacOS texture is cleaned up after render,
// code have to copy a whole screen to the texture
RE_CopyFrame (pixels, pitch / sizeof(Uint32), 0, vid.height * vid.width);
RE_CopyFrame (pixels, pitch / sizeof(Uint32), 0, vid_buffer_height * vid_buffer_width);
}
if (((int)sw_texture_filtering->value & 0x01) && !fastmoving)
{
SmoothColorImage(pixels + vmin, vmax - vmin, vid.width >> 7);
SmoothColorImage(pixels + vmin, vmax - vmin, vid_buffer_width >> 7);
}
SDL_UnlockTexture(texture);
@ -2224,22 +2230,22 @@ RE_EndFrame (void)
{
vid_minv = 0;
}
if (vid_maxu > vid.width)
if (vid_maxu > vid_buffer_width)
{
vid_maxu = vid.width;
vid_maxu = vid_buffer_width;
}
if (vid_maxv > vid.height)
if (vid_maxv > vid_buffer_height)
{
vid_maxv = vid.height;
vid_maxv = vid_buffer_height;
}
vmin = vid_minu + vid_minv * vid.width;
vmax = vid_maxu + vid_maxv * vid.width;
vmin = vid_minu + vid_minv * vid_buffer_width;
vmax = vid_maxu + vid_maxv * vid_buffer_width;
// fix to correct limit
if (vmax > (vid.height * vid.width))
if (vmax > (vid_buffer_height * vid_buffer_width))
{
vmax = vid.height * vid.width;
vmax = vid_buffer_height * vid_buffer_width;
}
// if palette changed need to flush whole buffer
@ -2256,9 +2262,9 @@ RE_EndFrame (void)
// search difference end
vmax = RE_BufferDifferenceEnd(vmin, vmax);
if (vmax > (vid.height * vid.width))
if (vmax > (vid_buffer_height * vid_buffer_width))
{
vmax = vid.height * vid.width;
vmax = vid_buffer_height * vid_buffer_width;
}
}
@ -2436,26 +2442,26 @@ static void
R_ScreenShot_f(void)
{
int x, y;
byte *buffer = malloc(vid.width * vid.height * 3);
byte *buffer = malloc(vid_buffer_width * vid_buffer_height * 3);
const unsigned char *palette = sw_state.currentpalette;
if (!buffer)
{
R_Printf(PRINT_ALL, "R_ScreenShot: Couldn't malloc %d bytes\n", vid.width * vid.height * 3);
R_Printf(PRINT_ALL, "R_ScreenShot: Couldn't malloc %d bytes\n", vid_buffer_width * vid_buffer_height * 3);
return;
}
for (x=0; x < vid.width; x ++)
for (x=0; x < vid_buffer_width; x ++)
{
for (y=0; y < vid.height; y ++) {
int buffer_pos = y * vid.width + x;
for (y=0; y < vid_buffer_height; y ++) {
int buffer_pos = y * vid_buffer_width + x;
buffer[buffer_pos * 3 + 0] = palette[vid_buffer[buffer_pos] * 4 + 2]; // red
buffer[buffer_pos * 3 + 1] = palette[vid_buffer[buffer_pos] * 4 + 1]; // green
buffer[buffer_pos * 3 + 2] = palette[vid_buffer[buffer_pos] * 4 + 0]; // blue
}
}
ri.Vid_WriteScreenshot(vid.width, vid.height, 3, buffer);
ri.Vid_WriteScreenshot(vid_buffer_width, vid_buffer_height, 3, buffer);
free(buffer);
}

View file

@ -66,7 +66,7 @@ D_ViewChanged (void)
*/
if ( r_newrefdef.rdflags & RDF_NOWORLDMODEL )
{
memset( d_pzbuffer, 0xff, vid.width * vid.height * sizeof(zvalue_t) );
memset( d_pzbuffer, 0xff, vid_buffer_width * vid_buffer_height * sizeof(zvalue_t) );
RE_Draw_Fill( r_newrefdef.x, r_newrefdef.y, r_newrefdef.width, r_newrefdef.height,( int ) sw_clearcolor->value & 0xff );
}
}

View file

@ -83,8 +83,8 @@ R_DrawParticle(particle_t *pparticle, int level)
** compute addresses of zbuffer, framebuffer, and
** compute the Z-buffer reference value.
*/
pz = d_pzbuffer + (vid.width * v) + u;
pdest = d_viewbuffer + vid.width * v + u;
pz = d_pzbuffer + (vid_buffer_width * v) + u;
pdest = d_viewbuffer + vid_buffer_width * v + u;
izi = (int)(zi * 0x8000);
/*
@ -101,7 +101,7 @@ R_DrawParticle(particle_t *pparticle, int level)
** render the appropriate pixels
*/
count = pix;
if ((pz[(vid.width * count / 2) + (count / 2)]) > izi)
if ((pz[(vid_buffer_width * count / 2) + (count / 2)]) > izi)
{
// looks like under some object
return;
@ -115,7 +115,7 @@ R_DrawParticle(particle_t *pparticle, int level)
{
switch (level) {
case PARTICLE_33 :
for ( ; count ; count--, pz += vid.width, pdest += vid.width)
for ( ; count ; count--, pz += vid_buffer_width, pdest += vid_buffer_width)
{
//FIXME--do it in blocks of 8?
for (i=0 ; i<pix ; i++)
@ -132,7 +132,7 @@ R_DrawParticle(particle_t *pparticle, int level)
case PARTICLE_66 :
{
int color_part = (color<<8);
for ( ; count ; count--, pz += vid.width, pdest += vid.width)
for ( ; count ; count--, pz += vid_buffer_width, pdest += vid_buffer_width)
{
for (i=0 ; i<pix ; i++)
{
@ -147,7 +147,7 @@ R_DrawParticle(particle_t *pparticle, int level)
}
default: //100
for ( ; count ; count--, pz += vid.width, pdest += vid.width)
for ( ; count ; count--, pz += vid_buffer_width, pdest += vid_buffer_width)
{
for (i=0 ; i<pix ; i++)
{
@ -169,7 +169,7 @@ R_DrawParticle(particle_t *pparticle, int level)
switch (level) {
case PARTICLE_33 :
for ( ; count ; count--, pz += vid.width, pdest += vid.width)
for ( ; count ; count--, pz += vid_buffer_width, pdest += vid_buffer_width)
{
//FIXME--do it in blocks of 8?
for (i=0 ; i<pix ; i++)
@ -187,7 +187,7 @@ R_DrawParticle(particle_t *pparticle, int level)
case PARTICLE_66 :
{
int color_part = (color<<8);
for ( ; count ; count--, pz += vid.width, pdest += vid.width)
for ( ; count ; count--, pz += vid_buffer_width, pdest += vid_buffer_width)
{
for (i=0 ; i<pix ; i++)
{
@ -203,7 +203,7 @@ R_DrawParticle(particle_t *pparticle, int level)
}
default: //100
for ( ; count ; count--, pz += vid.width, pdest += vid.width)
for ( ; count ; count--, pz += vid_buffer_width, pdest += vid_buffer_width)
{
for (i=0 ; i<pix ; i++)
{

View file

@ -621,8 +621,8 @@ R_PolygonDrawSpans(espan_t *pspan, int iswater, float d_ziorigin, float d_zistep
{
int count;
s_spanletvars.pdest = d_viewbuffer + (vid.width * pspan->v) + pspan->u;
s_spanletvars.pz = d_pzbuffer + (vid.width * pspan->v) + pspan->u;
s_spanletvars.pdest = d_viewbuffer + (vid_buffer_width * pspan->v) + pspan->u;
s_spanletvars.pz = d_pzbuffer + (vid_buffer_width * pspan->v) + pspan->u;
s_spanletvars.u = pspan->u;
s_spanletvars.v = pspan->v;
count = pspan->count;

View file

@ -454,7 +454,7 @@ R_PolysetDrawSpans8_33(const entity_t *currententity, spanpackage_t *pspanpackag
if (lcount > 0)
{
int pos_shift = (pspanpackage->v * vid.width) + pspanpackage->u;
int pos_shift = (pspanpackage->v * vid_buffer_width) + pspanpackage->u;
lpdest = d_viewbuffer + pos_shift;
lpz = d_pzbuffer + pos_shift;
@ -518,7 +518,7 @@ R_PolysetDrawSpansConstant8_33(const entity_t *currententity, spanpackage_t *psp
if (lcount > 0)
{
int pos_shift = (pspanpackage->v * vid.width) + pspanpackage->u;
int pos_shift = (pspanpackage->v * vid_buffer_width) + pspanpackage->u;
lpdest = d_viewbuffer + pos_shift;
lpz = d_pzbuffer + pos_shift;
@ -568,7 +568,7 @@ R_PolysetDrawSpans8_66(const entity_t *currententity, spanpackage_t *pspanpackag
if (lcount > 0)
{
int pos_shift = (pspanpackage->v * vid.width) + pspanpackage->u;
int pos_shift = (pspanpackage->v * vid_buffer_width) + pspanpackage->u;
qboolean zdamaged = false;
lpdest = d_viewbuffer + pos_shift;
@ -644,7 +644,7 @@ R_PolysetDrawSpansConstant8_66(const entity_t *currententity, spanpackage_t *psp
if (lcount > 0)
{
int pos_shift = (pspanpackage->v * vid.width) + pspanpackage->u;
int pos_shift = (pspanpackage->v * vid_buffer_width) + pspanpackage->u;
qboolean zdamaged = false;
lpdest = d_viewbuffer + pos_shift;
@ -703,7 +703,7 @@ R_PolysetDrawSpans8_Opaque (const entity_t *currententity, spanpackage_t *pspanp
int llight;
zvalue_t lzi;
zvalue_t *lpz;
int pos_shift = (pspanpackage->v * vid.width) + pspanpackage->u;
int pos_shift = (pspanpackage->v * vid_buffer_width) + pspanpackage->u;
qboolean zdamaged = false;
lpdest = d_viewbuffer + pos_shift;

View file

@ -62,7 +62,7 @@ D_WarpScreen (void)
int v2;
v2 = (int)((float)v/(h + AMP2 * 2) * r_refdef.vrect.height);
warp_rowptr[v] = r_warpbuffer + (vid.width * v2);
warp_rowptr[v] = r_warpbuffer + (vid_buffer_width * v2);
}
for (u=0 ; u<w+AMP2*2 ; u++)
@ -75,9 +75,9 @@ D_WarpScreen (void)
}
turb = intsintable + ((int)(r_newrefdef.time*SPEED)&(CYCLE-1));
dest = vid_buffer + r_newrefdef.y * vid.width + r_newrefdef.x;
dest = vid_buffer + r_newrefdef.y * vid_buffer_width + r_newrefdef.x;
for (v=0 ; v<h ; v++, dest += vid.width)
for (v=0 ; v<h ; v++, dest += vid_buffer_width)
{
int *col;
@ -127,7 +127,7 @@ D_DrawSpanGetStep(float d_zistepu, float d_zistepv)
}
}
while (spanzshift_value < vid.width);
while (spanzshift_value < vid_buffer_width);
}
return spanzshift;
}
@ -146,7 +146,7 @@ D_DrawZSpanGetStepValue(zvalue_t izistep)
// (both ends have same z value)
int count = 1;
while ((izistep * count) >> SHIFT16XYZ == 0 && count < vid.width)
while ((izistep * count) >> SHIFT16XYZ == 0 && count < vid_buffer_width)
{
count <<= 1;
}
@ -209,7 +209,7 @@ TurbulentPow2 (espan_t *pspan, float d_ziorigin, float d_zistepu, float d_zistep
float sdivz, tdivz, zi, z, du, dv;
pixel_t *r_turb_pdest;
r_turb_pdest = d_viewbuffer + (vid.width * pspan->v) + pspan->u;
r_turb_pdest = d_viewbuffer + (vid_buffer_width * pspan->v) + pspan->u;
count = pspan->count;
@ -363,7 +363,7 @@ NonTurbulentPow2 (espan_t *pspan, float d_ziorigin, float d_zistepu, float d_zis
float sdivz, tdivz, zi, z, dv, du;
pixel_t *r_turb_pdest;
r_turb_pdest = d_viewbuffer + (vid.width * pspan->v) + pspan->u;
r_turb_pdest = d_viewbuffer + (vid_buffer_width * pspan->v) + pspan->u;
count = pspan->count;
@ -616,7 +616,7 @@ D_DrawSpansPow2 (espan_t *pspan, float d_ziorigin, float d_zistepu, float d_zist
int count, s, t;
float sdivz, tdivz, zi, z, du, dv;
pdest = d_viewbuffer + (vid.width * pspan->v) + pspan->u;
pdest = d_viewbuffer + (vid_buffer_width * pspan->v) + pspan->u;
count = pspan->count;
@ -769,7 +769,7 @@ D_DrawZSpans (espan_t *pspan, float d_ziorigin, float d_zistepu, float d_zistepv
VID_DamageZBuffer(pspan->u, pspan->v);
VID_DamageZBuffer(pspan->u + pspan->count, pspan->v);
pdest = d_pzbuffer + (vid.width * pspan->v) + pspan->u;
pdest = d_pzbuffer + (vid_buffer_width * pspan->v) + pspan->u;
count = pspan->count;

View file

@ -217,7 +217,7 @@ R_InitCaches (void)
// surface cache size at 320X240
size = 1024*768;
pix = vid.width*vid.height;
pix = vid_buffer_width*vid_buffer_height;
if (pix > 64000)
size += (pix-64000)*3;