Add comments, remove redundant call to Vulkan getProperties, enable Khronos sync2 layer based on macOS SDK version

(cherry picked from commit 18769ecce66ce75b8bb8609c71194146464786e7)
This commit is contained in:
Stephen Saunders 2023-10-27 13:26:13 -04:00
parent bc658e4203
commit 48381ec0b9
3 changed files with 16 additions and 6 deletions

View file

@ -1600,6 +1600,7 @@ void idRenderBackend::GL_EndFrame()
// required for Vulkan: transition our swap image to present
deviceManager->EndFrame();
// SRS - execute after EndFrame() to avoid need for barrier command list on Vulkan
deviceManager->GetDevice()->executeCommandList( commandList );
// update jitter for perspective matrix

View file

@ -5386,6 +5386,7 @@ void idRenderBackend::ExecuteBackEndCommands( const emptyCommand_t* cmds )
uint64 backEndFinishTime = Sys_Microseconds();
pc.cpuTotalMicroSec = backEndFinishTime - backEndStartTime;
// SRS - capture backend timing before GL_EndFrame() since it can block when r_mvkSynchronousQueueSubmits is enabled on macOS/MoltenVK
GL_EndFrame();
if( r_debugRenderToTexture.GetInteger() == 1 )

View file

@ -209,12 +209,7 @@ private:
VK_EXT_DEBUG_UTILS_EXTENSION_NAME
},
// layers
{
#if defined(__APPLE__) && !defined( USE_MoltenVK )
// SRS - Enable synchronization2 layer when using Vulkan loader and MoltenVK version unknown
"VK_LAYER_KHRONOS_synchronization2"
#endif
},
{ },
// device
{
VK_EXT_DEBUG_MARKER_EXTENSION_NAME,
@ -436,6 +431,13 @@ bool DeviceManager_VK::createInstance()
{
enabledExtensions.layers.insert( name );
}
#if defined(__APPLE__)
// SRS - Vulkan SDK < 1.3.268.1 does not have native VK_KHR_synchronization2 support on macOS, add Khronos layer to emulate
else if( name == "VK_LAYER_KHRONOS_synchronization2" && VK_HEADER_VERSION_COMPLETE < VK_MAKE_API_VERSION( 0, 1, 3, 268 ) )
{
enabledExtensions.layers.insert( name );
}
#endif
requiredLayers.erase( name );
}
@ -938,6 +940,12 @@ bool DeviceManager_VK::createDevice()
auto prop = m_VulkanPhysicalDevice.getProperties();
m_RendererString = std::string( prop.deviceName.data() );
// SRS - Determine maxPushConstantSize for Vulkan device
if( r_useVulkanPushConstants.GetBool() )
{
m_DeviceParams.maxPushConstantSize = Min( prop.limits.maxPushConstantsSize, nvrhi::c_MaxPushConstantSize );
}
#if defined( USE_AMD_ALLOCATOR )
// SRS - initialize the vma allocator
VmaVulkanFunctions vulkanFunctions = {};