mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-20 13:50:11 +01:00
vulkan: add common GetPhysicalDeviceCalibrateableTimeDomainsKHR
VK_TIME_DOMAIN_DEVICE_KHR is always supported. Host time domains are
checked by vk_device_get_timestamp.
This is not used when the driver does not advertise
VK_{KHR,EXT}_calibrated_timestamps.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32689>
This commit is contained in:
parent
3bc7564bb0
commit
f7791e1901
1 changed files with 28 additions and 0 deletions
|
|
@ -24,6 +24,7 @@
|
|||
#include "vk_physical_device.h"
|
||||
|
||||
#include "vk_common_entrypoints.h"
|
||||
#include "vk_device.h"
|
||||
#include "vk_util.h"
|
||||
|
||||
VkResult
|
||||
|
|
@ -281,6 +282,33 @@ vk_common_GetPhysicalDeviceSparseImageFormatProperties(VkPhysicalDevice physical
|
|||
STACK_ARRAY_FINISH(props2);
|
||||
}
|
||||
|
||||
/* VK_KHR_calibrated_timestamps */
|
||||
VKAPI_ATTR VkResult VKAPI_CALL
|
||||
vk_common_GetPhysicalDeviceCalibrateableTimeDomainsKHR(
|
||||
VkPhysicalDevice physicalDevice, uint32_t *pTimeDomainCount,
|
||||
VkTimeDomainKHR *pTimeDomains)
|
||||
{
|
||||
VK_OUTARRAY_MAKE_TYPED(VkTimeDomainKHR, out, pTimeDomains, pTimeDomainCount);
|
||||
|
||||
vk_outarray_append_typed(VkTimeDomainKHR, &out, p)
|
||||
*p = VK_TIME_DOMAIN_DEVICE_KHR;
|
||||
|
||||
const VkTimeDomainKHR host_time_domains[] = {
|
||||
VK_TIME_DOMAIN_CLOCK_MONOTONIC_KHR,
|
||||
VK_TIME_DOMAIN_CLOCK_MONOTONIC_RAW_KHR,
|
||||
};
|
||||
for (uint32_t i = 0; i < ARRAY_SIZE(host_time_domains); i++) {
|
||||
const VkTimeDomainKHR domain = host_time_domains[i];
|
||||
uint64_t ts;
|
||||
if (vk_device_get_timestamp(NULL, domain, &ts) == VK_SUCCESS) {
|
||||
vk_outarray_append_typed(VkTimeDomainKHR, &out, p)
|
||||
*p = domain;
|
||||
}
|
||||
}
|
||||
|
||||
return vk_outarray_status(&out);
|
||||
}
|
||||
|
||||
/* VK_EXT_tooling_info */
|
||||
VKAPI_ATTR VkResult VKAPI_CALL
|
||||
vk_common_GetPhysicalDeviceToolProperties(VkPhysicalDevice physicalDevice,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue