MCPcopy Create free account
hub / github.com/dhewm/dhewm3 / EndFrame

Method EndFrame

neo/renderer/RenderSystem.cpp:675–732  ·  view source on GitHub ↗

============= EndFrame Returns the number of msec spent in the back end ============= */

Source from the content-addressed store, hash-verified

673=============
674*/
675void idRenderSystemLocal::EndFrame( int *frontEndMsec, int *backEndMsec ) {
676 emptyCommand_t *cmd;
677
678 if ( !glConfig.isInitialized ) {
679 return;
680 }
681
682 // close any gui drawing
683 guiModel->EmitFullScreen();
684 guiModel->Clear();
685
686 // save out timing information
687 if ( frontEndMsec ) {
688 *frontEndMsec = pc.frontEndMsec;
689 }
690 if ( backEndMsec ) {
691 *backEndMsec = backEnd.pc.msec;
692 }
693
694 // print any other statistics and clear all of them
695 R_PerformanceCounters();
696
697 // check for dynamic changes that require some initialization
698 R_CheckCvars();
699
700 // check for errors
701 GL_CheckErrors();
702
703 // add the swapbuffers command
704 cmd = (emptyCommand_t *)R_GetCommandBuffer( sizeof( *cmd ) );
705 cmd->commandId = RC_SWAP_BUFFERS;
706
707 // start the back end up again with the new command list
708 R_IssueRenderCommands();
709
710 // use the other buffers next frame, because another CPU
711 // may still be rendering into the current buffers
712
713 R_ToggleSmpFrame();
714
715 // we can now release the vertexes used this frame
716 vertexCache.EndFrame();
717
718 if ( session->writeDemo ) {
719 session->writeDemo->WriteInt( DS_RENDER );
720 session->writeDemo->WriteInt( DC_END_FRAME );
721 if ( r_showDemo.GetBool() ) {
722 common->Printf( "write DC_END_FRAME\n" );
723 }
724 }
725
726 // DG: restore the original size that was set before BeginFrame() overwrote it
727 // with its function-arguments, so editors don't mess up our viewport.
728 // (unsure why/how this at least *kinda* worked in original Doom3,
729 // maybe glConfig.vidWidth/Height was reset if the window gained focus or sth)
730 glConfig.vidWidth = origWidth;
731 glConfig.vidHeight = origHeight;
732}

Callers

nothing calls this directly

Calls 11

R_PerformanceCountersFunction · 0.85
R_CheckCvarsFunction · 0.85
GL_CheckErrorsFunction · 0.85
R_GetCommandBufferFunction · 0.85
R_IssueRenderCommandsFunction · 0.85
R_ToggleSmpFrameFunction · 0.85
EmitFullScreenMethod · 0.80
ClearMethod · 0.45
WriteIntMethod · 0.45
GetBoolMethod · 0.45
PrintfMethod · 0.45

Tested by

no test coverage detected