Add a Toggle that can be disallowed for timestamp tick->ns conversion.

Bug: dawn:686
Change-Id: If017922ece2d98e95dedc922994807b85ca07397
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/41940
Reviewed-by: Stephen White <senorblanco@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Auto-Submit: Corentin Wallez <cwallez@chromium.org>
This commit is contained in:
Corentin Wallez 2021-02-18 18:06:28 +00:00 committed by Commit Bot service account
parent da70024b08
commit 8c82acd778
4 changed files with 10 additions and 1 deletions

View File

@ -850,7 +850,8 @@ namespace dawn_native {
cmd->destinationOffset = destinationOffset;
// Encode internal compute pipeline for timestamp query
if (querySet->GetQueryType() == wgpu::QueryType::Timestamp) {
if (querySet->GetQueryType() == wgpu::QueryType::Timestamp &&
GetDevice()->IsToggleEnabled(Toggle::ConvertTimestampsToNanoseconds)) {
EncodeTimestampsToNanosecondsConversion(this, querySet, queryCount, destination,
destinationOffset);
}

View File

@ -1191,6 +1191,7 @@ namespace dawn_native {
void DeviceBase::SetDefaultToggles() {
SetToggle(Toggle::LazyClearResourceOnFirstUse, true);
SetToggle(Toggle::DisallowUnsafeAPIs, true);
SetToggle(Toggle::ConvertTimestampsToNanoseconds, true);
}
void DeviceBase::ApplyToggleOverrides(const DeviceDescriptor* deviceDescriptor) {

View File

@ -167,6 +167,12 @@ namespace dawn_native {
{"flush_before_client_wait_sync",
"Call glFlush before glClientWaitSync to work around bugs in the latter",
"https://crbug.com/dawn/633"}},
{Toggle::ConvertTimestampsToNanoseconds,
{"convert_timestamps_to_nanoseconds",
"If needed, use a compute shader to transform timestamp queries from ticks to "
"nanoseconds. This is temporarily needed to avoid requiring Tint to use timestamp "
"queries",
"https://crbug.com/dawn/686"}}
// Dummy comment to separate the }} so it is clearer what to copy-paste to add a toggle.
}};

View File

@ -50,6 +50,7 @@ namespace dawn_native {
DisallowUnsafeAPIs,
UseTintGenerator,
FlushBeforeClientWaitSync,
ConvertTimestampsToNanoseconds,
EnumCount,
InvalidEnum = EnumCount,