Vulkan-Samples
Vulkan-Samples copied to clipboard
calibrated_timestamps example error in vkGetCalibratedTimestampsEXT parameters
While working on testing calibrated timestamps I came across the timestamps example and on code review spotted a inconsistency in the code vs the specs for the VK_EXT_calibrated_timestamps docs.
The problem lines of code are (https://github.com/KhronosGroup/Vulkan-Samples/blob/main/samples/extensions/calibrated_timestamps/calibrated_timestamps.cpp#L827) :
// Get calibrated timestamps:
return vkGetCalibratedTimestampsEXT(get_device().get_handle(), static_cast<uint32_t>(time_domains.size()), timestamps_info.data(), timestamps.data(), max_deviations.data());
The max_deviations is initialized like it's a vector that is the same size of timestamps and as if it'll all be filled in, but the docs for vkGetCalibratedTimestampsEXT suggest a pointer to a uin64_t is required, not a vector<uint64_t>, docs on method:
https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/vkGetCalibratedTimestampsEXT.html
// Provided by VK_EXT_calibrated_timestamps
VkResult vkGetCalibratedTimestampsEXT(
VkDevice device,
uint32_t timestampCount,
const VkCalibratedTimestampInfoKHR* pTimestampInfos,
uint64_t* pTimestamps,
uint64_t*
Later parameters is described as:
pMaxDeviation is a pointer to a 64-bit unsigned integer value in which the strictly positive maximum deviation, in nanoseconds, of the calibrated timestamp values is returned.
It looks to me like the code needs to be reorganized a little to pass a pointer to a single value rather than a vector.