From dc25c987276698a6a4b879c4e42a4405b9450895 Mon Sep 17 00:00:00 2001 From: dan sinclair Date: Thu, 28 Jan 2021 15:02:35 +0000 Subject: [PATCH] Combine tint toggles. This CL combines the use tint inspector and use tint generator toggles. Change-Id: Idcfe0ffa1ddbdf0e240dd8d502d0a164018a6e1b Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/39142 Auto-Submit: dan sinclair Reviewed-by: Ryan Harrison Reviewed-by: Austin Eng Reviewed-by: Corentin Wallez Commit-Queue: dan sinclair --- src/dawn_native/ShaderModule.cpp | 2 +- src/dawn_native/Toggles.cpp | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/dawn_native/ShaderModule.cpp b/src/dawn_native/ShaderModule.cpp index 141a219fd7..ddb3f3fea0 100644 --- a/src/dawn_native/ShaderModule.cpp +++ b/src/dawn_native/ShaderModule.cpp @@ -1160,7 +1160,7 @@ namespace dawn_native { #endif } - if (GetDevice()->IsToggleEnabled(Toggle::UseTintInspector)) { + if (GetDevice()->IsToggleEnabled(Toggle::UseTintGenerator)) { #ifdef DAWN_ENABLE_WGSL tint::Program localProgram; diff --git a/src/dawn_native/Toggles.cpp b/src/dawn_native/Toggles.cpp index 034eabf128..23506698d1 100644 --- a/src/dawn_native/Toggles.cpp +++ b/src/dawn_native/Toggles.cpp @@ -163,12 +163,20 @@ namespace dawn_native { void TogglesSet::Set(Toggle toggle, bool enabled) { ASSERT(toggle != Toggle::InvalidEnum); + + if (toggle == Toggle::UseTintInspector) + toggle = Toggle::UseTintGenerator; + const size_t toggleIndex = static_cast(toggle); toggleBitset.set(toggleIndex, enabled); } bool TogglesSet::Has(Toggle toggle) const { ASSERT(toggle != Toggle::InvalidEnum); + + if (toggle == Toggle::UseTintInspector) + toggle = Toggle::UseTintGenerator; + const size_t toggleIndex = static_cast(toggle); return toggleBitset.test(toggleIndex); }