diff --git a/src/dawn_native/Adapter.cpp b/src/dawn_native/Adapter.cpp index 5c0d87364c..7cdd1f2e98 100644 --- a/src/dawn_native/Adapter.cpp +++ b/src/dawn_native/Adapter.cpp @@ -82,7 +82,14 @@ namespace dawn_native { if (limits->nextInChain != nullptr) { return false; } - limits->limits = mLimits.v1; + if (mUseTieredLimits) { + // TODO(crbug.com/dawn/685): Apply limit tiers. + // For now, set all limits to the defaults until tiers are + // defined. + GetDefaultLimits(&limits->limits); + } else { + limits->limits = mLimits.v1; + } return true; } @@ -136,6 +143,10 @@ namespace dawn_native { return {}; } + void AdapterBase::SetUseTieredLimits(bool useTieredLimits) { + mUseTieredLimits = useTieredLimits; + } + void AdapterBase::ResetInternalDeviceForTesting() { mInstance->ConsumedError(ResetInternalDeviceForTestingImpl()); } diff --git a/src/dawn_native/Adapter.h b/src/dawn_native/Adapter.h index 32cdd719ee..b8ba82a4a3 100644 --- a/src/dawn_native/Adapter.h +++ b/src/dawn_native/Adapter.h @@ -54,6 +54,8 @@ namespace dawn_native { bool GetLimits(SupportedLimits* limits) const; + void SetUseTieredLimits(bool useTieredLimits); + virtual bool SupportsExternalImages() const = 0; protected: @@ -71,6 +73,7 @@ namespace dawn_native { InstanceBase* mInstance = nullptr; wgpu::BackendType mBackend; CombinedLimits mLimits; + bool mUseTieredLimits = false; }; } // namespace dawn_native diff --git a/src/dawn_native/DawnNative.cpp b/src/dawn_native/DawnNative.cpp index 8cbda6fe02..73d238e4ca 100644 --- a/src/dawn_native/DawnNative.cpp +++ b/src/dawn_native/DawnNative.cpp @@ -110,6 +110,10 @@ namespace dawn_native { return mImpl->GetLimits(reinterpret_cast(limits)); } + void Adapter::SetUseTieredLimits(bool useTieredLimits) { + mImpl->SetUseTieredLimits(useTieredLimits); + } + bool Adapter::SupportsExternalImages() const { return mImpl->SupportsExternalImages(); } diff --git a/src/include/dawn_native/DawnNative.h b/src/include/dawn_native/DawnNative.h index b0700301c0..2d8968774e 100644 --- a/src/include/dawn_native/DawnNative.h +++ b/src/include/dawn_native/DawnNative.h @@ -112,6 +112,8 @@ namespace dawn_native { WGPUDeviceProperties GetAdapterProperties() const; bool GetLimits(WGPUSupportedLimits* limits) const; + void SetUseTieredLimits(bool useTieredLimits); + // Check that the Adapter is able to support importing external images. This is necessary // to implement the swapchain and interop APIs in Chromium. bool SupportsExternalImages() const;