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>
This commit is contained in:
Li Hao 2022-11-01 00:58:31 +00:00 committed by Dawn LUCI CQ
parent 3f24fdc447
commit dec01f1fd5
2 changed files with 5 additions and 3 deletions

View File

@ -86,7 +86,7 @@ MaybeError Device::Initialize(const DeviceDescriptor* descriptor) {
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

View File

@ -345,8 +345,10 @@ ResultOrError<ExecutionSerial> Device::CheckAndUpdateCompletedSerials() {
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);