add VK_RenderDebugLabelBegin/End calls; fix studio model labeling

This commit is contained in:
Ivan Avdeev 2021-02-20 12:35:04 -08:00
parent e66810a05b
commit 8dc0d4256d
7 changed files with 44 additions and 41 deletions

View File

@ -2,18 +2,17 @@
- [ ] refactor vk_render interface:
- [x] move uniform_data_t to global render state ~inside render_draw_t, remove any mentions of uniform/slots from api; alt: global render state?~
- [x] rename RenderDraw to SubmitDraw
- [x] ~add debug label to render_draw_t?;~ alt: VK_RenderDebugNameBegin/End
# Next
- [ ] refactor vk_render interface:
- [ ] make projection matrix independent render global/current/static state
- [ ] add debug label to render_draw_t?; alt: VK_RenderDebugNameBegin/End
- [ ] make 2nd commad buffer for resource upload
- [ ] start building command buffers in beginframe
- [ ] perform 3d rendering on corresponding refapi calls, not endframe
- [ ] fix sprite blending
- [ ] wrap viewmodel in vk debug label
# Planned
- [ ] RTX: make projection matrix independent render global/current/static state
- [ ] fix projection matrix differences w/ gl render
- [ ] bad condition for temp vs map-permanent buffer error message
- [ ] draw more types of beams

View File

@ -1109,13 +1109,7 @@ void R_BeamDraw( BEAM *pbeam, float frametime )
// TODO gl renderer has per-vertex color that is updated using brightness and whatever
VK_RenderStateSetColor( color[0], color[1], color[2], color[3] );
if (vk_core.debug) {
VkDebugUtilsLabelEXT label = {
.sType = VK_STRUCTURE_TYPE_DEBUG_UTILS_LABEL_EXT,
.pLabelName = "beam",
};
vkCmdBeginDebugUtilsLabelEXT(vk_core.cb, &label);
}
VK_RenderDebugLabelBegin( "beam" );
switch( pbeam->type )
{
@ -1145,8 +1139,7 @@ void R_BeamDraw( BEAM *pbeam, float frametime )
break;
}
if (vk_core.debug)
vkCmdEndDebugUtilsLabelEXT(vk_core.cb);
VK_RenderDebugLabelEnd();
// FIXME VK r_stats.c_view_beams_count++;
}

View File

@ -146,13 +146,7 @@ void VK_BrushDrawModel( const cl_entity_t *ent, int render_mode )
return;
}
if (vk_core.debug) {
VkDebugUtilsLabelEXT label = {
.sType = VK_STRUCTURE_TYPE_DEBUG_UTILS_LABEL_EXT,
.pLabelName = mod->name,
};
vkCmdBeginDebugUtilsLabelEXT(vk_core.cb, &label);
}
VK_RenderDebugLabelBegin( mod->name );
for (int i = 0; i < bmodel->num_surfaces; ++i) {
const vk_brush_model_surface_t *bsurf = bmodel->surfaces + i;
@ -201,8 +195,7 @@ void VK_BrushDrawModel( const cl_entity_t *ent, int render_mode )
VK_RenderScheduleDraw( &draw );
}
if (vk_core.debug)
vkCmdEndDebugUtilsLabelEXT(vk_core.cb);
VK_RenderDebugLabelEnd();
}
static int loadBrushSurfaces( const model_t *mod, vk_brush_model_surface_t *out_surfaces) {

View File

@ -449,3 +449,20 @@ void VK_RenderScheduleDraw( const render_draw_t *draw )
void VK_RenderEnd( void )
{
}
void VK_RenderDebugLabelBegin( const char *name )
{
if (vk_core.debug) {
VkDebugUtilsLabelEXT label = {
.sType = VK_STRUCTURE_TYPE_DEBUG_UTILS_LABEL_EXT,
.pLabelName = name,
};
vkCmdBeginDebugUtilsLabelEXT(vk_core.cb, &label);
}
}
void VK_RenderDebugLabelEnd( void )
{
if (vk_core.debug)
vkCmdEndDebugUtilsLabelEXT(vk_core.cb);
}

View File

@ -47,3 +47,6 @@ typedef struct render_draw_s {
void VK_RenderBegin( void );
void VK_RenderScheduleDraw( const render_draw_t *draw );
void VK_RenderEnd( void );
void VK_RenderDebugLabelBegin( const char *label );
void VK_RenderDebugLabelEnd( void );

View File

@ -618,6 +618,8 @@ void VK_SceneRender( void )
prepareMatrix( &fixme_rvp, worldview, projection, mvp );
VK_RenderDebugLabelBegin( "opaque" );
// Draw view model
{
VK_RenderStateSetMatrix( mvp );
@ -647,15 +649,11 @@ void VK_SceneRender( void )
// Draw opaque beams
gEngine.CL_DrawEFX( g_frametime, false );
{
if (vk_core.debug) {
VkDebugUtilsLabelEXT label = {
.sType = VK_STRUCTURE_TYPE_DEBUG_UTILS_LABEL_EXT,
.pLabelName = "transparent",
};
vkCmdBeginDebugUtilsLabelEXT(vk_core.cb, &label);
}
VK_RenderDebugLabelEnd();
VK_RenderDebugLabelBegin( "tranparent" );
{
// sort translucents entities by rendermode and distance
VectorCopy( fixme_rvp.vieworigin, R_TransEntityCompare_vieworg );
qsort( g_lists.draw_list->trans_entities, g_lists.draw_list->num_trans_entities, sizeof( vk_trans_entity_t ), R_TransEntityCompare );
@ -667,13 +665,13 @@ void VK_SceneRender( void )
drawEntity(ent->entity, ent->render_mode, mvp);
}
if (vk_core.debug)
vkCmdEndDebugUtilsLabelEXT(vk_core.cb);
}
// Draw transparent beams
gEngine.CL_DrawEFX( g_frametime, true );
VK_RenderDebugLabelEnd();
VK_RenderEnd();
VK_RenderTempBufferEnd();

View File

@ -2110,11 +2110,12 @@ static void R_StudioDrawPoints( void )
if( !m_pStudioHeader ) return;
VK_RenderDebugLabelBegin( m_pSubModel->name );
g_studio.numverts = g_studio.numelems = 0;
// safety bounding the skinnum
m_skinnum = bound( 0, RI.currententity->curstate.skin, ( m_pStudioHeader->numskinfamilies - 1 ));
m_skinnum = bound( 0, RI.currententity->curstate.skin, ( m_pStudioHeader->numskinfamilies - 1 ));
ptexture = (mstudiotexture_t *)((byte *)m_pStudioHeader + m_pStudioHeader->textureindex);
pvertbone = ((byte *)m_pStudioHeader + m_pSubModel->vertinfoindex);
pnormbone = ((byte *)m_pStudioHeader + m_pSubModel->norminfoindex);
@ -2275,6 +2276,8 @@ static void R_StudioDrawPoints( void )
tr.blend = oldblend;
*/
}
VK_RenderDebugLabelEnd();
}
static void R_StudioSetRemapColors( int newTop, int newBottom )
@ -2684,13 +2687,7 @@ void R_StudioRenderFinal( void )
rendermode = R_StudioGetForceFaceFlags() ? kRenderTransAdd : RI.currententity->curstate.rendermode;
R_StudioSetupRenderer( rendermode );
if (vk_core.debug) {
VkDebugUtilsLabelEXT label = {
.sType = VK_STRUCTURE_TYPE_DEBUG_UTILS_LABEL_EXT,
.pLabelName = RI.currentmodel->name,
};
vkCmdBeginDebugUtilsLabelEXT(vk_core.cb, &label);
}
VK_RenderDebugLabelBegin( RI.currentmodel->name );
for( i = 0; i < m_pStudioHeader->numbodyparts; i++ )
{
@ -2703,8 +2700,7 @@ void R_StudioRenderFinal( void )
R_StudioRestoreRenderer();
if (vk_core.debug)
vkCmdEndDebugUtilsLabelEXT(vk_core.cb);
VK_RenderDebugLabelEnd();
}
void R_StudioRenderModel( void )
@ -3079,6 +3075,8 @@ static int R_StudioDrawModel( int flags )
void R_StudioDrawModelInternal( cl_entity_t *e, int flags )
{
VK_RenderDebugLabelBegin( e->model->name );
if( !RI.drawWorld )
{
if( e->player )
@ -3092,6 +3090,8 @@ void R_StudioDrawModelInternal( cl_entity_t *e, int flags )
pStudioDraw->StudioDrawPlayer( flags, R_StudioGetPlayerState( e->index - 1 ));
else pStudioDraw->StudioDrawModel( flags );
}
VK_RenderDebugLabelEnd();
}
void R_DrawStudioModel( cl_entity_t *e )