mirror of
https://github.com/yquake2/yquake2remaster.git
synced 2024-11-23 13:02:07 +00:00
soft: add warning if is already flushed
This commit is contained in:
parent
30ecd8ac57
commit
fa3ec83253
1 changed files with 33 additions and 2 deletions
|
@ -43,7 +43,8 @@ pixel_t *vid_alphamap = NULL;
|
||||||
light_t vid_lightthreshold = 0;
|
light_t vid_lightthreshold = 0;
|
||||||
static int vid_minu, vid_minv, vid_maxu, vid_maxv;
|
static int vid_minu, vid_minv, vid_maxu, vid_maxv;
|
||||||
static int vid_zminu, vid_zminv, vid_zmaxu, vid_zmaxv;
|
static int vid_zminu, vid_zminv, vid_zmaxu, vid_zmaxv;
|
||||||
static qboolean IsHighDPIaware;
|
static qboolean IsHighDPIaware = false;
|
||||||
|
static qboolean is_render_flushed = false;
|
||||||
|
|
||||||
// last position on map
|
// last position on map
|
||||||
static vec3_t lastvieworg;
|
static vec3_t lastvieworg;
|
||||||
|
@ -1484,6 +1485,8 @@ RE_BeginFrame( float camera_separation )
|
||||||
palette_changed = false;
|
palette_changed = false;
|
||||||
// run without speed optimization
|
// run without speed optimization
|
||||||
fastmoving = false;
|
fastmoving = false;
|
||||||
|
/* window could redraw */
|
||||||
|
is_render_flushed = false;
|
||||||
|
|
||||||
while (r_vsync->modified)
|
while (r_vsync->modified)
|
||||||
{
|
{
|
||||||
|
@ -2166,11 +2169,24 @@ RE_FlushFrame(int vmin, int vmax)
|
||||||
int pitch;
|
int pitch;
|
||||||
Uint32 *pixels;
|
Uint32 *pixels;
|
||||||
|
|
||||||
|
if (vmin > vmax)
|
||||||
|
{
|
||||||
|
/* Looks like we already updated everything */
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (is_render_flushed)
|
||||||
|
{
|
||||||
|
Com_Printf("%s: Render is already flushed\n", __func__);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (SDL_LockTexture(texture, NULL, (void**)&pixels, &pitch))
|
if (SDL_LockTexture(texture, NULL, (void**)&pixels, &pitch))
|
||||||
{
|
{
|
||||||
Com_Printf("Can't lock texture: %s\n", SDL_GetError());
|
Com_Printf("Can't lock texture: %s\n", SDL_GetError());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sw_partialrefresh->value)
|
if (sw_partialrefresh->value)
|
||||||
{
|
{
|
||||||
RE_CopyFrame (pixels, pitch / sizeof(Uint32), vmin, vmax);
|
RE_CopyFrame (pixels, pitch / sizeof(Uint32), vmin, vmax);
|
||||||
|
@ -2196,8 +2212,11 @@ RE_FlushFrame(int vmin, int vmax)
|
||||||
swap_current ++;
|
swap_current ++;
|
||||||
vid_buffer = swap_frames[swap_current&1];
|
vid_buffer = swap_frames[swap_current&1];
|
||||||
|
|
||||||
// All changes flushed
|
/* All changes flushed */
|
||||||
VID_NoDamageBuffer();
|
VID_NoDamageBuffer();
|
||||||
|
|
||||||
|
/* new draw is not required */
|
||||||
|
is_render_flushed = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -2215,6 +2234,13 @@ RE_Draw_StretchDirectRaw(int x, int y, int w, int h, int cols, int rows, const b
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (is_render_flushed)
|
||||||
|
{
|
||||||
|
/* TODO: fix show fps */
|
||||||
|
Com_Printf("%s: Render is already flushed\n", __func__);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
/* Full screen update should be faster */
|
/* Full screen update should be faster */
|
||||||
if (SDL_LockTexture(texture, NULL, (void**)&pixels, &pitch))
|
if (SDL_LockTexture(texture, NULL, (void**)&pixels, &pitch))
|
||||||
{
|
{
|
||||||
|
@ -2237,6 +2263,8 @@ RE_Draw_StretchDirectRaw(int x, int y, int w, int h, int cols, int rows, const b
|
||||||
|
|
||||||
SDL_RenderCopy(renderer, texture, NULL, NULL);
|
SDL_RenderCopy(renderer, texture, NULL, NULL);
|
||||||
SDL_RenderPresent(renderer);
|
SDL_RenderPresent(renderer);
|
||||||
|
|
||||||
|
is_render_flushed = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -2255,14 +2283,17 @@ RE_EndFrame (void)
|
||||||
{
|
{
|
||||||
vid_minu = 0;
|
vid_minu = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (vid_minv < 0)
|
if (vid_minv < 0)
|
||||||
{
|
{
|
||||||
vid_minv = 0;
|
vid_minv = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (vid_maxu > vid_buffer_width)
|
if (vid_maxu > vid_buffer_width)
|
||||||
{
|
{
|
||||||
vid_maxu = vid_buffer_width;
|
vid_maxu = vid_buffer_width;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (vid_maxv > vid_buffer_height)
|
if (vid_maxv > vid_buffer_height)
|
||||||
{
|
{
|
||||||
vid_maxv = vid_buffer_height;
|
vid_maxv = vid_buffer_height;
|
||||||
|
|
Loading…
Reference in a new issue