Remove need for barrier command list on Vulkan, simplifies code and enables macOS previous command statistics

(cherry picked from commit 9956923ee656f1294446cadd692ca61edfe9ba6a)
This commit is contained in:
Stephen Saunders 2023-10-04 12:24:49 -04:00
parent a40b30d861
commit 7bd543f699
3 changed files with 11 additions and 10 deletions

View file

@ -1597,11 +1597,11 @@ void idRenderBackend::GL_EndFrame()
commandList->close(); commandList->close();
deviceManager->GetDevice()->executeCommandList( commandList );
// required for Vulkan: transition our swap image to present // required for Vulkan: transition our swap image to present
deviceManager->EndFrame(); deviceManager->EndFrame();
deviceManager->GetDevice()->executeCommandList( commandList );
// update jitter for perspective matrix // update jitter for perspective matrix
taaPass->AdvanceFrame(); taaPass->AdvanceFrame();
} }

View file

@ -5382,12 +5382,12 @@ void idRenderBackend::ExecuteBackEndCommands( const emptyCommand_t* cmds )
DrawFlickerBox(); DrawFlickerBox();
GL_EndFrame();
// stop rendering on this thread // stop rendering on this thread
uint64 backEndFinishTime = Sys_Microseconds(); uint64 backEndFinishTime = Sys_Microseconds();
pc.cpuTotalMicroSec = backEndFinishTime - backEndStartTime; pc.cpuTotalMicroSec = backEndFinishTime - backEndStartTime;
GL_EndFrame();
if( r_debugRenderToTexture.GetInteger() == 1 ) if( r_debugRenderToTexture.GetInteger() == 1 )
{ {
common->Printf( "3d: %i, 2d: %i, SetBuf: %i, CpyRenders: %i, CpyFrameBuf: %i\n", c_draw3d, c_draw2d, c_setBuffers, c_copyRenders, pc.c_copyFrameBuffer ); common->Printf( "3d: %i, 2d: %i, SetBuf: %i, CpyRenders: %i, CpyFrameBuf: %i\n", c_draw3d, c_draw2d, c_setBuffers, c_copyRenders, pc.c_copyFrameBuffer );

View file

@ -272,7 +272,7 @@ private:
nvrhi::vulkan::DeviceHandle m_NvrhiDevice; nvrhi::vulkan::DeviceHandle m_NvrhiDevice;
nvrhi::DeviceHandle m_ValidationLayer; nvrhi::DeviceHandle m_ValidationLayer;
nvrhi::CommandListHandle m_BarrierCommandList; //nvrhi::CommandListHandle m_BarrierCommandList; // SRS - no longer needed
std::queue<vk::Semaphore> m_PresentSemaphoreQueue; std::queue<vk::Semaphore> m_PresentSemaphoreQueue;
vk::Semaphore m_PresentSemaphore; vk::Semaphore m_PresentSemaphore;
@ -1220,7 +1220,7 @@ bool DeviceManager_VK::CreateDeviceAndSwapChain()
CHECK( createSwapChain() ); CHECK( createSwapChain() );
m_BarrierCommandList = m_NvrhiDevice->createCommandList(); //m_BarrierCommandList = m_NvrhiDevice->createCommandList(); // SRS - no longer needed
// SRS - Give each swapchain image its own semaphore in case of overlap (e.g. MoltenVK async queue submit) // SRS - Give each swapchain image its own semaphore in case of overlap (e.g. MoltenVK async queue submit)
for( int i = 0; i < m_SwapChainImages.size(); i++ ) for( int i = 0; i < m_SwapChainImages.size(); i++ )
@ -1257,7 +1257,7 @@ void DeviceManager_VK::DestroyDeviceAndSwapChain()
} }
m_PresentSemaphore = vk::Semaphore(); m_PresentSemaphore = vk::Semaphore();
m_BarrierCommandList = nullptr; //m_BarrierCommandList = nullptr; // SRS - no longer needed
destroySwapChain(); destroySwapChain();
@ -1320,9 +1320,10 @@ void DeviceManager_VK::EndFrame()
{ {
m_NvrhiDevice->queueSignalSemaphore( nvrhi::CommandQueue::Graphics, m_PresentSemaphore, 0 ); m_NvrhiDevice->queueSignalSemaphore( nvrhi::CommandQueue::Graphics, m_PresentSemaphore, 0 );
m_BarrierCommandList->open(); // umm... // SRS - Don't need barrier commandlist if EndFrame() is called before executeCommandList() in idRenderBackend::GL_EndFrame()
m_BarrierCommandList->close(); //m_BarrierCommandList->open(); // umm...
m_NvrhiDevice->executeCommandList( m_BarrierCommandList ); //m_BarrierCommandList->close();
//m_NvrhiDevice->executeCommandList( m_BarrierCommandList );
} }
void DeviceManager_VK::Present() void DeviceManager_VK::Present()