doom3-bfg/neo/renderer/RenderLog.h

117 lines
3.5 KiB
C++
Raw Normal View History

2012-11-26 18:58:24 +00:00
/*
===========================================================================
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
Copyright (C) 2013-2020 Robert Beckebans
2012-11-26 18:58:24 +00:00
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
2012-11-26 18:58:24 +00:00
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
===========================================================================
*/
#ifndef __RENDERLOG_H__
#define __RENDERLOG_H__
/*
================================================================================================
Contains the RenderLog declaration.
================================================================================================
*/
enum renderLogMainBlock_t
{
2020-05-04 23:21:29 +00:00
// each block will require to allocate 2 GPU query timestamps
MRB_GPU_TIME,
2012-11-26 18:58:24 +00:00
MRB_BEGIN_DRAWING_VIEW,
MRB_FILL_DEPTH_BUFFER,
MRB_FILL_GEOMETRY_BUFFER,
MRB_SSAO_PASS,
MRB_AMBIENT_PASS,
2022-03-30 09:22:58 +00:00
MRB_SHADOW_ATLAS_PASS,
2012-11-26 18:58:24 +00:00
MRB_DRAW_INTERACTIONS,
MRB_DRAW_SHADER_PASSES,
MRB_FOG_ALL_LIGHTS,
2022-02-21 15:29:53 +00:00
MRB_BLOOM,
2012-11-26 18:58:24 +00:00
MRB_DRAW_SHADER_PASSES_POST,
MRB_DRAW_DEBUG_TOOLS,
MRB_CAPTURE_COLORBUFFER,
MRB_MOTION_VECTORS,
MRB_TAA,
MRB_TONE_MAP_PASS,
2012-11-26 18:58:24 +00:00
MRB_POSTPROCESS,
2021-09-28 07:58:48 +00:00
MRB_DRAW_GUI,
MRB_CRT_POSTPROCESS,
2012-11-26 18:58:24 +00:00
MRB_TOTAL,
2020-05-04 23:21:29 +00:00
MRB_TOTAL_QUERIES = MRB_TOTAL * 2,
2012-11-26 18:58:24 +00:00
};
2019-11-11 19:27:44 +00:00
2012-11-26 18:58:24 +00:00
/*
================================================
2022-04-19 19:56:30 +00:00
idRenderLog
// Performance Events abstraction layer for OpenGL, Vulkan, DX12
// see https://devblogs.nvidia.com/best-practices-gpu-performance-events/
2012-11-26 18:58:24 +00:00
================================================
*/
class idRenderLog
{
2020-05-04 23:21:29 +00:00
private:
renderLogMainBlock_t mainBlock;
2022-02-21 21:08:04 +00:00
nvrhi::CommandListHandle commandList;
uint64 frameCounter;
uint32 frameParity;
2022-03-24 17:22:41 +00:00
2022-11-18 15:47:29 +00:00
idStaticList<nvrhi::TimerQueryHandle, MRB_TOTAL* NUM_FRAME_DATA> timerQueries;
idStaticList<bool, MRB_TOTAL* NUM_FRAME_DATA> timerUsed;
2022-02-21 21:08:04 +00:00
2012-11-26 18:58:24 +00:00
public:
idRenderLog();
2019-11-11 19:27:44 +00:00
2022-03-24 17:22:41 +00:00
void Init();
void Shutdown();
2022-03-24 17:22:41 +00:00
void StartFrame( nvrhi::ICommandList* _commandList );
void EndFrame();
2012-11-26 18:58:24 +00:00
void Close() {}
int Active()
{
return 0;
}
2019-11-11 19:27:44 +00:00
void OpenBlock( const char* label, const idVec4& color = colorBlack );
2012-11-26 18:58:24 +00:00
void CloseBlock();
2022-03-24 17:22:41 +00:00
void OpenMainBlock( renderLogMainBlock_t block );
2022-03-24 18:28:10 +00:00
void CloseMainBlock( int block = -1 );
2019-11-11 19:27:44 +00:00
void Printf( VERIFY_FORMAT_STRING const char* fmt, ... ) {}
2019-11-11 19:27:44 +00:00
2022-03-24 17:22:41 +00:00
void FetchGPUTimers( backEndCounters_t& pc );
2012-11-26 18:58:24 +00:00
};
extern idRenderLog renderLog;
#endif // !__RENDERLOG_H__