Vulkan: Fix timestamp query units
Vulkan returns timestamps in cycles, which needs to be converted to
nanoseconds (by multiplying by limits.timestampPeriod) for GLES.
On NVidia, this multiplier seems to be 1 for a majority of their
hardware, while the timer has less and more varying granularity on AMD,
Intel and others.
Bug: angleproject:2885
Change-Id: I34e08ad386e06619170975039385ce35cab025a5
Reviewed-on: https://chromium-review.googlesource.com/c/1436835
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
diff --git a/src/libANGLE/renderer/vulkan/RendererVk.cpp b/src/libANGLE/renderer/vulkan/RendererVk.cpp
index 912a0dd..4c85f98 100644
--- a/src/libANGLE/renderer/vulkan/RendererVk.cpp
+++ b/src/libANGLE/renderer/vulkan/RendererVk.cpp
@@ -1636,6 +1636,10 @@
timestampQueryPool.get().freeQuery(context, ×tampQuery);
+ // Convert results to nanoseconds.
+ *timestampOut = static_cast<uint64_t>(
+ *timestampOut * static_cast<double>(mPhysicalDeviceProperties.limits.timestampPeriod));
+
return angle::Result::Continue;
}