mirror of
https://github.com/id-Software/DOOM-3-BFG.git
synced 2025-03-14 22:50:45 +00:00
Update RenderBackend to select OPTICK_GPU_CONTEXT graphics API at runtime
This commit is contained in:
parent
7c4f41bfd5
commit
0b510de3e9
3 changed files with 24 additions and 31 deletions
|
@ -792,13 +792,13 @@ void idRenderBackend::FillDepthBufferFast( drawSurf_t** drawSurfs, int numDrawSu
|
|||
{
|
||||
OPTICK_EVENT( "Render_FillDepthBufferFast" );
|
||||
|
||||
#if USE_DX12 && OPTICK_ENABLE_GPU_D3D12
|
||||
OPTICK_GPU_CONTEXT( ( ID3D12GraphicsCommandList* ) commandList->getNativeObject( nvrhi::ObjectTypes::D3D12_GraphicsCommandList ) );
|
||||
nvrhi::ObjectType commandObject = nvrhi::ObjectTypes::D3D12_GraphicsCommandList;
|
||||
if( deviceManager->GetGraphicsAPI() == nvrhi::GraphicsAPI::VULKAN )
|
||||
{
|
||||
commandObject = nvrhi::ObjectTypes::VK_CommandBuffer;
|
||||
}
|
||||
OPTICK_GPU_CONTEXT( ( void* ) commandList->getNativeObject( commandObject ) );
|
||||
OPTICK_GPU_EVENT( "Render_FillDepthBufferFast" );
|
||||
#elif USE_VK && OPTICK_ENABLE_GPU_VULKAN
|
||||
OPTICK_GPU_CONTEXT( ( VkCommandBuffer ) commandList->getNativeObject( nvrhi::ObjectTypes::VK_CommandBuffer ) );
|
||||
OPTICK_GPU_EVENT( "Render_FillDepthBufferFast" );
|
||||
#endif
|
||||
|
||||
if( numDrawSurfs == 0 )
|
||||
{
|
||||
|
@ -3360,13 +3360,13 @@ void idRenderBackend::ShadowAtlasPass( const viewDef_t* _viewDef )
|
|||
|
||||
OPTICK_EVENT( "Render_ShadowAtlas" );
|
||||
|
||||
#if USE_DX12 && OPTICK_ENABLE_GPU_D3D12
|
||||
OPTICK_GPU_CONTEXT( ( ID3D12GraphicsCommandList* ) commandList->getNativeObject( nvrhi::ObjectTypes::D3D12_GraphicsCommandList ) );
|
||||
nvrhi::ObjectType commandObject = nvrhi::ObjectTypes::D3D12_GraphicsCommandList;
|
||||
if( deviceManager->GetGraphicsAPI() == nvrhi::GraphicsAPI::VULKAN )
|
||||
{
|
||||
commandObject = nvrhi::ObjectTypes::VK_CommandBuffer;
|
||||
}
|
||||
OPTICK_GPU_CONTEXT( ( void* ) commandList->getNativeObject( commandObject ) );
|
||||
OPTICK_GPU_EVENT( "Render_ShadowAtlas" );
|
||||
#elif USE_VK && OPTICK_ENABLE_GPU_VULKAN
|
||||
OPTICK_GPU_CONTEXT( ( VkCommandBuffer ) commandList->getNativeObject( nvrhi::ObjectTypes::VK_CommandBuffer ) );
|
||||
OPTICK_GPU_EVENT( "Render_ShadowAtlas" );
|
||||
#endif
|
||||
|
||||
renderLog.OpenMainBlock( MRB_SHADOW_ATLAS_PASS );
|
||||
renderLog.OpenBlock( "Render_ShadowAtlas", colorYellow );
|
||||
|
@ -3676,13 +3676,13 @@ void idRenderBackend::DrawInteractions( const viewDef_t* _viewDef )
|
|||
|
||||
OPTICK_EVENT( "Render_Interactions" );
|
||||
|
||||
#if USE_DX12 && OPTICK_ENABLE_GPU_D3D12
|
||||
OPTICK_GPU_CONTEXT( ( ID3D12GraphicsCommandList* ) commandList->getNativeObject( nvrhi::ObjectTypes::D3D12_GraphicsCommandList ) );
|
||||
nvrhi::ObjectType commandObject = nvrhi::ObjectTypes::D3D12_GraphicsCommandList;
|
||||
if( deviceManager->GetGraphicsAPI() == nvrhi::GraphicsAPI::VULKAN )
|
||||
{
|
||||
commandObject = nvrhi::ObjectTypes::VK_CommandBuffer;
|
||||
}
|
||||
OPTICK_GPU_CONTEXT( ( void* ) commandList->getNativeObject( commandObject ) );
|
||||
OPTICK_GPU_EVENT( "Render_Interactions" );
|
||||
#elif USE_VK && OPTICK_ENABLE_GPU_VULKAN
|
||||
OPTICK_GPU_CONTEXT( ( VkCommandBuffer ) commandList->getNativeObject( nvrhi::ObjectTypes::VK_CommandBuffer ) );
|
||||
OPTICK_GPU_EVENT( "Render_Interactions" );
|
||||
#endif
|
||||
|
||||
renderLog.OpenMainBlock( MRB_DRAW_INTERACTIONS );
|
||||
renderLog.OpenBlock( "Render_Interactions", colorYellow );
|
||||
|
@ -5398,16 +5398,13 @@ void idRenderBackend::DrawViewInternal( const viewDef_t* _viewDef, const int ste
|
|||
OPTICK_EVENT( "Backend_DrawViewInternal" );
|
||||
OPTICK_TAG( "stereoEye", stereoEye );
|
||||
|
||||
#if USE_DX12 && OPTICK_ENABLE_GPU_D3D12
|
||||
//uint32_t swapIndex = deviceManager->GetCurrentBackBufferIndex();
|
||||
//idStr eventLabel;
|
||||
//eventLabel.Format( "DrawView( frameIndex = %i, swapIndex = %i ) ", taaPass->GetFrameIndex(), swapIndex );
|
||||
OPTICK_GPU_CONTEXT( ( ID3D12GraphicsCommandList* ) commandList->getNativeObject( nvrhi::ObjectTypes::D3D12_GraphicsCommandList ) );
|
||||
nvrhi::ObjectType commandObject = nvrhi::ObjectTypes::D3D12_GraphicsCommandList;
|
||||
if( deviceManager->GetGraphicsAPI() == nvrhi::GraphicsAPI::VULKAN )
|
||||
{
|
||||
commandObject = nvrhi::ObjectTypes::VK_CommandBuffer;
|
||||
}
|
||||
OPTICK_GPU_CONTEXT( ( void* ) commandList->getNativeObject( commandObject ) );
|
||||
OPTICK_GPU_EVENT( "DrawView" );
|
||||
#elif USE_VK && OPTICK_ENABLE_GPU_VULKAN
|
||||
OPTICK_GPU_CONTEXT( ( VkCommandBuffer ) commandList->getNativeObject( nvrhi::ObjectTypes::VK_CommandBuffer ) );
|
||||
OPTICK_GPU_EVENT( "DrawView" );
|
||||
#endif
|
||||
|
||||
renderLog.OpenBlock( "Render_DrawViewInternal", colorRed );
|
||||
|
||||
|
|
|
@ -452,9 +452,7 @@ bool DeviceManager_DX12::CreateDeviceAndSwapChain()
|
|||
m_FrameWaitQuery = m_NvrhiDevice->createEventQuery();
|
||||
m_NvrhiDevice->setEventQuery( m_FrameWaitQuery, nvrhi::CommandQueue::Graphics );
|
||||
|
||||
#if OPTICK_ENABLE_GPU_D3D12
|
||||
OPTICK_GPU_INIT_D3D12( m_Device12, &m_GraphicsQueue, 1 );
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -1220,9 +1220,7 @@ bool DeviceManager_VK::CreateDeviceAndSwapChain()
|
|||
|
||||
#undef CHECK
|
||||
|
||||
#if OPTICK_ENABLE_GPU_VULKAN
|
||||
OPTICK_GPU_INIT_VULKAN( ( VkDevice* )&m_VulkanDevice, ( VkPhysicalDevice* )&m_VulkanPhysicalDevice, ( VkQueue* )&m_GraphicsQueue, ( uint32_t* )&m_GraphicsQueueFamily, 1, nullptr );
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue