KhronosGroup / MoltenVK

MoltenVK is a Vulkan Portability implementation. It layers a subset of the high-performance, industry-standard Vulkan graphics and compute API over Apple's Metal graphics framework, enabling Vulkan applications to run on macOS, iOS and tvOS.
Apache License 2.0
4.74k stars 418 forks source link

Move CPU/GPU timestamp correlation to vkGetPhysicalDeviceProperties() #1983

Open billhollings opened 1 year ago

billhollings commented 1 year ago

It turns out that MTLDevice sampleTimestamps:gpuTimestamp: executes synchronously with other queue activities, and can block GPU execution if it is called frequently.

Move timestamp correlation to the execution of vkGetPhysicalDeviceProperties() so it is called only on demand by the app.

Furthermore, MTLDevice sampleTimestamps:gpuTimestamp: should only be invoked if all of these conditions are met (otherwise the VkPhysicalDeviceLimits::timestampPeriod should be set to 1.0):

billhollings commented 1 year ago

PR #1992 fixes this issue. Please retest to verify, and close this issue if it fixes the problem you encountered.