Fix issue with menu M_Popup

Menu popup can be called without initial run FrameBegin.

 #0  0x0000007ff406bea8 in R_EndWorldRenderpass () at src/client/refresh/vk/vk_rmain.c:937
 #1  0x0000007ff4060b5c in Draw_CharScaled (x=12, y=66, num=num@entry=1, scale=1) at src/client/refresh/vk/vk_draw.c:61
 #2  0x0000005555581900 in M_DrawCharacter (cx=cx@entry=12, cy=cy@entry=66, num=num@entry=1) at src/client/menu/menu.c:410
 #3  0x0000005555581964 in M_DrawTextBox (x=x@entry=12, y=y@entry=66, width=35, lines=3) at src/client/menu/menu.c:487
 #4  0x0000005555581fa0 in M_Popup () at src/client/menu/menu.c:580
 #5  0x0000005555583ad0 in SearchLocalGames () at src/client/menu/menu.c:2771
 #6  0x0000005555583c94 in JoinServer_MenuInit () at src/client/menu/menu.c:2838
 #7  0x0000005555585d2c in M_Menu_JoinServer_f () at src/client/menu/menu.c:2863
 #8  JoinNetworkServerFunc (unused=<optimized out>) at src/client/menu/menu.c:737
 #9  0x0000005555588724 in Action_DoEnter (a=<optimized out>) at src/client/menu/qmenu.c:55
 #10 Menu_SelectItem (s=s@entry=0x5555611148 <s_multiplayer_menu>) at src/client/menu/qmenu.c:566
 #11 0x0000005555586338 in Default_MenuKey (m=0x5555611148 <s_multiplayer_menu>, key=13) at src/client/menu/menu.c:393
 #12 0x00000055555873fc in M_Keydown (key=key@entry=13) at src/client/menu/menu.c:4682
 #13 0x000000555556f194 in Key_Event (key=<optimized out>, down=true, special=special@entry=true) at src/client/cl_keyboard.c:1331
 #14 0x000000555557f078 in IN_Update () at src/client/input/sdl.c:641
 #15 0x0000005555570e64 in CL_Frame (packetdelta=96239, renderdelta=<optimized out>, timedelta=<optimized out>,
    packetframe=packetframe@entry=true, renderframe=renderframe@entry=true) at src/client/cl_main.c:802
 #16 0x00000055555a8a78 in Qcommon_Frame (usec=96239) at src/common/frame.c:626
 #17 0x00000055555a8c98 in Qcommon_Mainloop () at src/common/frame.c:163
 #18 0x00000055555a92f0 in Qcommon_Init (argc=1, argv=0x7ffffff358) at src/common/frame.c:377
 #19 0x0000005555561e44 in main (argc=1, argv=0x7ffffff358) at src/backends/unix/main.c:123
This commit is contained in:
Denis Pauk 2020-02-05 08:16:40 +02:00 committed by Yamagi
parent 400562cd2e
commit bf4a7f9ee6
4 changed files with 42 additions and 16 deletions

View file

@ -229,7 +229,7 @@ void Draw_Fill (int x, int y, int w, int h, int c);
void Draw_FadeScreen (void);
void Draw_StretchRaw (int x, int y, int w, int h, int cols, int rows, byte *data);
void R_EndWorldRenderpass( void );
qboolean R_EndWorldRenderpass( void );
void Vk_ResampleTexture (unsigned *in, int inwidth, int inheight, unsigned *out, int outwidth, int outheight);

View file

@ -1886,7 +1886,9 @@ VkResult QVk_EndFrame(qboolean force)
// this may happen if Sys_Error is issued mid-frame, so we need to properly advance the draw pipeline
if (force)
{
R_EndWorldRenderpass();
if(!R_EndWorldRenderpass())
// buffers is not initialized
return VK_NOT_READY;
}
// submit

View file

@ -58,7 +58,9 @@ void Draw_CharScaled (int x, int y, int num, float scale)
int row, col;
float frow, fcol, size;
R_EndWorldRenderpass();
if(!R_EndWorldRenderpass())
// buffers is not initialized
return;
num &= 255;
@ -131,7 +133,9 @@ void Draw_StretchPic (int x, int y, int w, int h, char *pic)
{
image_t *vk;
R_EndWorldRenderpass();
if(!R_EndWorldRenderpass())
// buffers is not initialized
return;
vk = Draw_FindPic(pic);
if (!vk)
@ -157,7 +161,9 @@ void Draw_PicScaled (int x, int y, char *pic, float scale)
{
image_t *vk;
R_EndWorldRenderpass();
if(!R_EndWorldRenderpass())
// buffers is not initialized
return;
vk = Draw_FindPic(pic);
if (!vk)
@ -181,7 +187,9 @@ void Draw_TileClear (int x, int y, int w, int h, char *pic)
{
image_t *image;
R_EndWorldRenderpass();
if(!R_EndWorldRenderpass())
// buffers is not initialized
return;
image = Draw_FindPic(pic);
if (!image)
@ -213,7 +221,9 @@ void Draw_Fill (int x, int y, int w, int h, int c)
byte v[4];
} color;
R_EndWorldRenderpass();
if(!R_EndWorldRenderpass())
// buffers is not initialized
return;
if ((unsigned)c > 255)
ri.Sys_Error(ERR_FATAL, "%s: bad color", __func__);
@ -238,7 +248,9 @@ void Draw_FadeScreen (void)
{
float imgTransform[] = { 0.f, 0.f, vid.width, vid.height, 0.f, 0.f, 0.f, .8f };
R_EndWorldRenderpass();
if(!R_EndWorldRenderpass())
// buffers is not initialized
return;
QVk_DrawColorRect(imgTransform, sizeof(imgTransform), RP_UI);
}
@ -265,7 +277,9 @@ void Draw_StretchRaw (int x, int y, int w, int h, int cols, int rows, byte *data
int row;
float t;
R_EndWorldRenderpass();
if(!R_EndWorldRenderpass())
// buffers is not initialized
return;
if (rows <= 256)
{

View file

@ -926,20 +926,24 @@ void R_RenderView (refdef_t *fd)
}
}
void R_EndWorldRenderpass(void)
qboolean R_EndWorldRenderpass(void)
{
// still some issues?
if (!vk_frameStarted)
{
R_Printf(PRINT_ALL, "\nSwapchain issue?\n");
// we can't start 2d rendering
return false;
}
// 3d world has alredy rendered and 2d already initialized
if (world_rendered)
{
return;
return true;
}
world_rendered = true;
// this may happen if swapchain image acquisition fails
if (!vk_frameStarted)
return;
// finish rendering world view to offsceen buffer
vkCmdEndRenderPass(vk_activeCmdbuffer);
@ -954,13 +958,17 @@ void R_EndWorldRenderpass(void)
// start drawing UI
QVk_BeginRenderpass(RP_UI);
return true;
}
void R_SetVulkan2D (void)
{
// player configuration screen renders a model using the UI renderpass, so skip finishing RP_WORLD twice
if (!(r_newrefdef.rdflags & RDF_NOWORLDMODEL))
R_EndWorldRenderpass();
if(!R_EndWorldRenderpass())
// buffers is not initialized
return;
extern VkViewport vk_viewport;
extern VkRect2D vk_scissor;
@ -1327,6 +1335,8 @@ static void
RE_EndFrame( void )
{
QVk_EndFrame(false);
// world has not rendered yet
world_rendered = false;
}
/*