Add timestamp period calculation for timestamp-query-inside-passes
Timestamp period is also needed by the timestamp-query-inside-passes
feature, which is enabled separately from the timestamp-query feature.
Bug: dawn:1193
Change-Id: I8a1f87f8d7931261b87608306820daefc4c3dc55
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/107880
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Hao Li <hao.x.li@intel.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
diff --git a/src/dawn/native/d3d12/DeviceD3D12.cpp b/src/dawn/native/d3d12/DeviceD3D12.cpp
index 23f2f48..73bb13b 100644
--- a/src/dawn/native/d3d12/DeviceD3D12.cpp
+++ b/src/dawn/native/d3d12/DeviceD3D12.cpp
@@ -86,7 +86,7 @@
CheckHRESULT(mD3d12Device->CreateCommandQueue(&queueDesc, IID_PPV_ARGS(&mCommandQueue)),
"D3D12 create command queue"));
- if (HasFeature(Feature::TimestampQuery) &&
+ if ((HasFeature(Feature::TimestampQuery) || HasFeature(Feature::TimestampQueryInsidePasses)) &&
!IsToggleEnabled(Toggle::DisableTimestampQueryConversion)) {
// Get GPU timestamp counter frequency (in ticks/second). This fails if the specified
// command queue doesn't support timestamps. D3D12_COMMAND_LIST_TYPE_DIRECT queues
diff --git a/src/dawn/native/metal/DeviceMTL.mm b/src/dawn/native/metal/DeviceMTL.mm
index 4c766033..5adfefb 100644
--- a/src/dawn/native/metal/DeviceMTL.mm
+++ b/src/dawn/native/metal/DeviceMTL.mm
@@ -345,8 +345,10 @@
MaybeError Device::TickImpl() {
DAWN_TRY(SubmitPendingCommandBuffer());
- // Just run timestamp period calculation when timestamp feature is enabled.
- if (HasFeature(Feature::TimestampQuery)) {
+ // Just run timestamp period calculation when timestamp feature is enabled and timestamp
+ // conversion is not disabled.
+ if ((HasFeature(Feature::TimestampQuery) || HasFeature(Feature::TimestampQueryInsidePasses)) &&
+ !IsToggleEnabled(Toggle::DisableTimestampQueryConversion)) {
if (@available(macos 10.15, iOS 14.0, *)) {
UpdateTimestampPeriod(GetMTLDevice(), mKalmanInfo.get(), &mCpuTimestamp, &mGpuTimestamp,
&mTimestampPeriod);