fix world disconnect

This commit is contained in:
Denis Pauk 2020-01-18 11:36:26 +02:00 committed by Yamagi
parent 5270cce1a1
commit 65c76776ec
2 changed files with 29 additions and 5 deletions

View file

@ -53,6 +53,8 @@ void Draw_CharScaled (int x, int y, int num, float scale)
int row, col;
float frow, fcol, size;
R_EndWorldRenderpass();
num &= 255;
if ((num & 127) == 32)
@ -124,6 +126,8 @@ void Draw_StretchPic (int x, int y, int w, int h, char *pic)
{
image_t *vk;
R_EndWorldRenderpass();
vk = Draw_FindPic(pic);
if (!vk)
{
@ -148,6 +152,8 @@ void Draw_PicScaled (int x, int y, char *pic, float scale)
{
image_t *vk;
R_EndWorldRenderpass();
vk = Draw_FindPic(pic);
if (!vk)
{
@ -170,6 +176,8 @@ void Draw_TileClear (int x, int y, int w, int h, char *pic)
{
image_t *image;
R_EndWorldRenderpass();
image = Draw_FindPic(pic);
if (!image)
{
@ -200,6 +208,8 @@ void Draw_Fill (int x, int y, int w, int h, int c)
byte v[4];
} color;
R_EndWorldRenderpass();
if ((unsigned)c > 255)
ri.Sys_Error(ERR_FATAL, "Draw_Fill: bad color");
@ -222,6 +232,9 @@ Draw_FadeScreen
void Draw_FadeScreen (void)
{
float imgTransform[] = { 0.f, 0.f, vid.width, vid.height, 0.f, 0.f, 0.f, .8f };
R_EndWorldRenderpass();
QVk_DrawColorRect(imgTransform, sizeof(imgTransform), RP_UI);
}
@ -247,6 +260,8 @@ void Draw_StretchRaw (int x, int y, int w, int h, int cols, int rows, byte *data
int row;
float t;
R_EndWorldRenderpass();
if (rows <= 256)
{
hscale = 1;

View file

@ -25,6 +25,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "header/vk_local.h"
// world rendered readdy to render 2d elements
static qboolean world_rendered;
viddef_t vid;
refimport_t ri;
@ -928,6 +931,14 @@ void R_RenderView (refdef_t *fd)
void R_EndWorldRenderpass(void)
{
// 3d world has alredy rendered and 2d already initialized
if (world_rendered)
{
return;
}
world_rendered = true;
// this may happen if swapchain image acquisition fails
if (!vk_frameStarted)
return;
@ -1259,6 +1270,9 @@ R_BeginFrame
*/
void R_BeginFrame( float camera_separation )
{
// world has not rendered yet
world_rendered = false;
// if ri.Sys_Error() had been issued mid-frame, we might end up here without properly submitting the image, so call QVk_EndFrame to be safe
QVk_EndFrame(true);
/*
@ -1303,11 +1317,6 @@ void R_BeginFrame( float camera_separation )
{
QVk_BeginRenderpass(RP_WORLD);
}
if (!r_worldmodel && !(r_newrefdef.rdflags & RDF_NOWORLDMODEL))
{
R_EndWorldRenderpass();
}
}
/*