use __func__ in R_Printf if required

This commit is contained in:
Denis Pauk 2020-01-18 12:10:26 +02:00 committed by Yamagi
parent 65c76776ec
commit b558407423
7 changed files with 46 additions and 50 deletions

View file

@ -247,7 +247,7 @@ void R_EndFrame( void );
void R_EndWorldRenderpass( void );
void R_SetPalette ( const unsigned char *palette);
int Draw_GetPalette (void);
int Draw_GetPalette (void);
void Vk_ResampleTexture (unsigned *in, int inwidth, int inheight, unsigned *out, int outwidth, int outheight);

View file

@ -402,7 +402,7 @@ static VkResult CreateFramebuffers()
if (res != VK_SUCCESS)
{
R_Printf(PRINT_ALL, "CreateFramebuffers(): framebuffer #%d create error: %s\n", j, QVk_GetError(res));
R_Printf(PRINT_ALL, "%s(): framebuffer #%d create error: %s\n", __func__, j, QVk_GetError(res));
DestroyFramebuffers();
return res;
}
@ -680,7 +680,7 @@ static VkResult CreateRenderpasses()
VkResult res = vkCreateRenderPass(vk_device.logical, &rpCreateInfos[i], NULL, &vk_renderpasses[i].rp);
if (res != VK_SUCCESS)
{
R_Printf(PRINT_ALL, "CreateRenderpasses(): renderpass #%d create error: %s\n", i, QVk_GetError(res));
R_Printf(PRINT_ALL, "%s(): renderpass #%d create error: %s\n", __func__, i, QVk_GetError(res));
return res;
}
}
@ -1602,7 +1602,7 @@ qboolean QVk_Init()
if (res != VK_SUCCESS)
{
R_Printf(PRINT_ALL, "QVk_Init(): Could not create Vulkan instance: %s\n", QVk_GetError(res));
R_Printf(PRINT_ALL, "%s(): Could not create Vulkan instance: %s\n", __func__, QVk_GetError(res));
return false;
}
R_Printf(PRINT_ALL, "...created Vulkan instance\n");
@ -1622,7 +1622,7 @@ qboolean QVk_Init()
res = Vkimp_CreateSurface();
if (res != VK_SUCCESS)
{
R_Printf(PRINT_ALL, "QVk_Init(): Could not create Vulkan surface: %s\n", QVk_GetError(res));
R_Printf(PRINT_ALL, "%s(): Could not create Vulkan surface: %s\n", __func__, QVk_GetError(res));
return false;
}
R_Printf(PRINT_ALL, "...created Vulkan surface\n");
@ -1648,7 +1648,7 @@ qboolean QVk_Init()
res = vmaCreateAllocator(&allocInfo, &vk_malloc);
if (res != VK_SUCCESS)
{
R_Printf(PRINT_ALL, "QVk_Init(): Could not create Vulkan memory allocator: %s\n", QVk_GetError(res));
R_Printf(PRINT_ALL, "%s(): Could not create Vulkan memory allocator: %s\n", __func__, QVk_GetError(res));
return false;
}
R_Printf(PRINT_ALL, "...created Vulkan memory allocator\n");
@ -1657,7 +1657,7 @@ qboolean QVk_Init()
res = QVk_CreateSwapchain();
if (res != VK_SUCCESS)
{
R_Printf(PRINT_ALL, "QVk_Init(): Could not create Vulkan swapchain: %s\n", QVk_GetError(res));
R_Printf(PRINT_ALL, "%s(): Could not create Vulkan swapchain: %s\n", __func__, QVk_GetError(res));
return false;
}
R_Printf(PRINT_ALL, "...created Vulkan swapchain\n");
@ -1719,7 +1719,7 @@ qboolean QVk_Init()
res = CreateRenderpasses();
if (res != VK_SUCCESS)
{
R_Printf(PRINT_ALL, "QVk_Init(): Could not create Vulkan render passes: %s\n", QVk_GetError(res));
R_Printf(PRINT_ALL, "%s(): Could not create Vulkan render passes: %s\n", __func__, QVk_GetError(res));
return false;
}
R_Printf(PRINT_ALL, "...created %d Vulkan render passes\n", RP_COUNT);
@ -1728,13 +1728,13 @@ qboolean QVk_Init()
res = QVk_CreateCommandPool(&vk_commandPool, vk_device.gfxFamilyIndex);
if (res != VK_SUCCESS)
{
R_Printf(PRINT_ALL, "QVk_Init(): Could not create Vulkan command pool for graphics: %s\n", QVk_GetError(res));
R_Printf(PRINT_ALL, "%s(): Could not create Vulkan command pool for graphics: %s\n", __func__, QVk_GetError(res));
return false;
}
res = QVk_CreateCommandPool(&vk_transferCommandPool, vk_device.transferFamilyIndex);
if (res != VK_SUCCESS)
{
R_Printf(PRINT_ALL, "QVk_Init(): Could not create Vulkan command pool for transfer: %s\n", QVk_GetError(res));
R_Printf(PRINT_ALL, "%s(): Could not create Vulkan command pool for transfer: %s\n", __func__, QVk_GetError(res));
return false;
}
@ -1749,7 +1749,7 @@ qboolean QVk_Init()
res = CreateImageViews();
if (res != VK_SUCCESS)
{
R_Printf(PRINT_ALL, "QVk_Init(): Could not create Vulkan image views: %s\n", QVk_GetError(res));
R_Printf(PRINT_ALL, "%s(): Could not create Vulkan image views: %s\n", __func__, QVk_GetError(res));
return false;
}
R_Printf(PRINT_ALL, "...created %d Vulkan image view(s)\n", vk_swapchain.imageCount);
@ -1758,7 +1758,7 @@ qboolean QVk_Init()
res = CreateFramebuffers();
if (res != VK_SUCCESS)
{
R_Printf(PRINT_ALL, "QVk_Init(): Could not create Vulkan framebuffers: %s\n", QVk_GetError(res));
R_Printf(PRINT_ALL, "%s(): Could not create Vulkan framebuffers: %s\n", __func__, QVk_GetError(res));
return false;
}
R_Printf(PRINT_ALL, "...created %d Vulkan framebuffers\n", vk_swapchain.imageCount);
@ -1777,7 +1777,7 @@ qboolean QVk_Init()
res = vkAllocateCommandBuffers(vk_device.logical, &cbInfo, vk_commandbuffers);
if (res != VK_SUCCESS)
{
R_Printf(PRINT_ALL, "QVk_Init(): Could not create Vulkan commandbuffers: %s\n", QVk_GetError(res));
R_Printf(PRINT_ALL, "%s(): Could not create Vulkan commandbuffers: %s\n", __func__, QVk_GetError(res));
free(vk_commandbuffers);
vk_commandbuffers = NULL;
return false;
@ -1847,12 +1847,12 @@ VkResult QVk_BeginFrame()
// for VK_OUT_OF_DATE_KHR and VK_SUBOPTIMAL_KHR it'd be fine to just rebuild the swapchain but let's take the easy way out and restart video system
if (result == VK_ERROR_OUT_OF_DATE_KHR || result == VK_SUBOPTIMAL_KHR || result == VK_ERROR_SURFACE_LOST_KHR)
{
R_Printf(PRINT_ALL, "QVk_BeginFrame(): received %s after vkAcquireNextImageKHR - restarting video!\n", QVk_GetError(result));
R_Printf(PRINT_ALL, "%s(): received %s after vkAcquireNextImageKHR - restarting video!\n", __func__, QVk_GetError(result));
return result;
}
else if (result != VK_SUCCESS)
{
Sys_Error("QVk_BeginFrame(): unexpected error after vkAcquireNextImageKHR: %s", QVk_GetError(result));
Sys_Error("%s(): unexpected error after vkAcquireNextImageKHR: %s", __func__, QVk_GetError(result));
}
VK_VERIFY(vkWaitForFences(vk_device.logical, 1, &vk_fences[vk_activeBufferIdx], VK_TRUE, UINT32_MAX));
@ -1926,12 +1926,12 @@ VkResult QVk_EndFrame(qboolean force)
// for VK_OUT_OF_DATE_KHR and VK_SUBOPTIMAL_KHR it'd be fine to just rebuild the swapchain but let's take the easy way out and restart video system
if (renderResult == VK_ERROR_OUT_OF_DATE_KHR || renderResult == VK_SUBOPTIMAL_KHR || renderResult == VK_ERROR_SURFACE_LOST_KHR)
{
R_Printf(PRINT_ALL, "QVk_EndFrame(): received %s after vkQueuePresentKHR - restarting video!\n", QVk_GetError(renderResult));
R_Printf(PRINT_ALL, "%s(): received %s after vkQueuePresentKHR - restarting video!\n", __func__, QVk_GetError(renderResult));
vid_fullscreen->modified = true;
}
else if (renderResult != VK_SUCCESS)
{
Sys_Error("QVk_EndFrame(): unexpected error after vkQueuePresentKHR: %s", QVk_GetError(renderResult));
Sys_Error("%s(): unexpected error after vkQueuePresentKHR: %s", __func__, QVk_GetError(renderResult));
}
vk_activeBufferIdx = (vk_activeBufferIdx + 1) % NUM_CMDBUFFERS;

View file

@ -131,7 +131,7 @@ void Draw_StretchPic (int x, int y, int w, int h, char *pic)
vk = Draw_FindPic(pic);
if (!vk)
{
R_Printf(PRINT_ALL, "Can't find pic: %s\n", pic);
R_Printf(PRINT_ALL, "%s(): Can't find pic: %s\n", __func__, pic);
return;
}
@ -157,7 +157,7 @@ void Draw_PicScaled (int x, int y, char *pic, float scale)
vk = Draw_FindPic(pic);
if (!vk)
{
R_Printf(PRINT_ALL, "Can't find pic: %s\n", pic);
R_Printf(PRINT_ALL, "%s(): Can't find pic: %s\n", __func__, pic);
return;
}
@ -181,7 +181,7 @@ void Draw_TileClear (int x, int y, int w, int h, char *pic)
image = Draw_FindPic(pic);
if (!image)
{
R_Printf(PRINT_ALL, "Can't find pic: %s\n", pic);
R_Printf(PRINT_ALL, "%s(): Can't find pic: %s\n", __func__, pic);
return;
}

View file

@ -775,7 +775,7 @@ void LoadTGA (char *name, byte **pic, int *width, int *height)
length = ri.FS_LoadFile (name, (void **)&buffer);
if (!length || !buffer)
{
R_Printf(PRINT_DEVELOPER, "Bad tga file %s\n", name);
R_Printf(PRINT_DEVELOPER, "%s(): Bad tga file %s\n", __func__, name);
return;
}
@ -1291,7 +1291,7 @@ image_t *Vk_LoadPic (char *name, byte *pic, int width, int height, imagetype_t t
if (image->type == it_pic && bits == 8
&& image->width < 64 && image->height < 64)
{
int x, y;
int x = 0, y = 0;
int i, j, k;
int texnum;
@ -1372,7 +1372,7 @@ image_t *Vk_LoadWal (char *name)
ri.FS_LoadFile (name, (void **)&mt);
if (!mt)
{
R_Printf(PRINT_ALL, "Vk_FindImage: can't load %s\n", name);
R_Printf(PRINT_ALL, "%s: can't load %s\n", __func__, name);
return r_notexture;
}

View file

@ -413,14 +413,14 @@ static qboolean R_CullAliasModel( vec3_t bbox[8], entity_t *e )
if ( ( e->frame >= paliashdr->num_frames ) || ( e->frame < 0 ) )
{
R_Printf(PRINT_ALL, "R_CullAliasModel %s: no such frame %d\n",
currentmodel->name, e->frame);
R_Printf(PRINT_ALL, "%s %s: no such frame %d\n",
__func__, currentmodel->name, e->frame);
e->frame = 0;
}
if ( ( e->oldframe >= paliashdr->num_frames ) || ( e->oldframe < 0 ) )
{
R_Printf(PRINT_ALL, "R_CullAliasModel %s: no such oldframe %d\n",
currentmodel->name, e->oldframe);
R_Printf(PRINT_ALL, "%s %s: no such oldframe %d\n",
__func__, currentmodel->name, e->oldframe);
e->oldframe = 0;
}
@ -730,8 +730,8 @@ void R_DrawAliasModel (entity_t *e)
if ( (currententity->frame >= paliashdr->num_frames)
|| (currententity->frame < 0) )
{
R_Printf(PRINT_ALL, "R_DrawAliasModel %s: no such frame %d\n",
currentmodel->name, currententity->frame);
R_Printf(PRINT_ALL, "%s %s: no such frame %d\n",
__func__, currentmodel->name, currententity->frame);
currententity->frame = 0;
currententity->oldframe = 0;
}
@ -739,8 +739,8 @@ void R_DrawAliasModel (entity_t *e)
if ( (currententity->oldframe >= paliashdr->num_frames)
|| (currententity->oldframe < 0))
{
R_Printf(PRINT_ALL, "R_DrawAliasModel %s: no such oldframe %d\n",
currentmodel->name, currententity->oldframe);
R_Printf(PRINT_ALL, "%s %s: no such oldframe %d\n",
__func__, currentmodel->name, currententity->oldframe);
currententity->frame = 0;
currententity->oldframe = 0;
}

View file

@ -406,7 +406,7 @@ void Mod_LoadTexinfo (lump_t *l)
in = (void *)(mod_base + l->fileofs);
if (l->filelen % sizeof(*in))
ri.Sys_Error (ERR_DROP, "MOD_LoadBmodel: funny lump size in %s",loadmodel->name);
ri.Sys_Error (ERR_DROP, "%s: funny lump size in %s", __func__, loadmodel->name);
count = l->filelen / sizeof(*in);
out = Hunk_Alloc ( count*sizeof(*out));

View file

@ -1171,7 +1171,7 @@ qboolean R_SetMode (void)
{
ri.Cvar_SetValue("vid_fullscreen", 0);
vid_fullscreen->modified = false;
R_Printf(PRINT_ALL, "ref_vk::R_SetMode() - fullscreen unavailable in this mode\n");
R_Printf(PRINT_ALL, "%s() - fullscreen unavailable in this mode\n", __func__);
if ((err = Vkimp_SetMode((int*)&vid.width, (int*)&vid.height, r_mode->value, false)) == rserr_ok)
return true;
}
@ -1179,13 +1179,13 @@ qboolean R_SetMode (void)
{
ri.Cvar_SetValue("r_mode", vk_state.prev_mode);
r_mode->modified = false;
R_Printf(PRINT_ALL, "ref_vk::R_SetMode() - invalid mode\n");
R_Printf(PRINT_ALL, "%s() - invalid mode\n", __func__);
}
// try setting it back to something safe
if ((err = Vkimp_SetMode((int*)&vid.width, (int*)&vid.height, vk_state.prev_mode, false)) != rserr_ok)
{
R_Printf(PRINT_ALL, "ref_vk::R_SetMode() - could not revert to safe mode\n");
R_Printf(PRINT_ALL, "%s() - could not revert to safe mode\n", __func__);
return false;
}
}
@ -1209,7 +1209,7 @@ qboolean R_Init( void )
// set video mode/screen resolution
if (!R_SetMode())
{
R_Printf(PRINT_ALL, "ref_vk::R_Init() - could not R_SetMode()\n");
R_Printf(PRINT_ALL, "%s() - could not R_SetMode()\n", __func__);
return false;
}
ri.Vid_MenuInit();
@ -1217,7 +1217,7 @@ qboolean R_Init( void )
// window is ready, initialize Vulkan now
if (!QVk_Init())
{
R_Printf(PRINT_ALL, "ref_vk::R_Init() - could not initialize Vulkan!\n");
R_Printf(PRINT_ALL, "%s() - could not initialize Vulkan!\n", __func__);
return false;
}
@ -1605,24 +1605,20 @@ void
Sys_Error (char *error, ...)
{
va_list argptr;
char text[1024];
char text[4096]; // MAXPRINTMSG == 4096
va_start (argptr, error);
vsprintf (text, error, argptr);
va_end (argptr);
va_start(argptr, error);
vsnprintf(text, sizeof(text), error, argptr);
va_end(argptr);
ri.Sys_Error (ERR_FATAL, "%s", text);
}
void
Com_Printf (char *fmt, ...)
Com_Printf (char *msg, ...)
{
va_list argptr;
char text[1024];
va_start (argptr, fmt);
vsprintf (text, fmt, argptr);
va_end (argptr);
R_Printf(PRINT_ALL, "%s", text);
va_list argptr;
va_start(argptr, msg);
ri.Com_VPrintf(PRINT_ALL, msg, argptr);
va_end(argptr);
}