Implement timestamp query support
This change set VkQueueFamilyProperties::timestampValidBits to non-zero
(64) to indicate support for timestamps.
It also enables the timestampComputeAndGraphics feature to indicate that
all graphics and compute queues (we only have a single one at the
moment) support timestamp queries. Note that applications often check
this aggregate flag instead of the individual queue family properties.
timestampPeriod was lowered from 60 to 1, since we're writing timestamps
with nanosecond granularity. Actually obtaining the time was already in
place, see QueryPool::writeTimestamp(), but it didn't put the query in
the 'available' state.
The clock was replaced with std::chrono::steady_clock, which typically
provides higher resolution than system_clock [1]. While it doesn't offer
wall clock related time, this is not a requirement of Vulkan timestamps.
Query::INVALID_TYPE was eliminated. Queries belong to a query pool which
takes a valid type at construction. This also allowed to eliminate
Query::prepare().
[1] https://www.modernescpp.com/index.php/the-three-clocks
Bug: b/142643809
Tests: dEQP-VK.pipeline.timestamp.*
Change-Id: Icb7c8c5ed78052eba9df630a4c1cb450bda7f85b
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/53488
Presubmit-Ready: Nicolas Capens <nicolascapens@google.com>
Kokoro-Result: kokoro <noreply+kokoro@google.com>
Tested-by:
Nicolas Capens <nicolascapens@google.com>
Reviewed-by:
Alexis Hétu <sugoi@google.com>
Showing
Please
register
or
sign in
to comment