Add an option for the Adapter to use tiered limits
Does nothing right now since Dawn always exposes the default limits. In the future, setting useTieredLimits to true will bucket the exposed adapter limits to minimize fingerprinting surface. Disabled by default for native applications, but Chrome will always enable it. Bug: dawn:685 Change-Id: I0ecfefc93f7a554f8f8be7906cef9fa8d4745ac2 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/64524 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Austin Eng <enga@chromium.org>
This commit is contained in:
parent
c389182758
commit
2e48f011b0
|
@ -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());
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -110,6 +110,10 @@ namespace dawn_native {
|
|||
return mImpl->GetLimits(reinterpret_cast<SupportedLimits*>(limits));
|
||||
}
|
||||
|
||||
void Adapter::SetUseTieredLimits(bool useTieredLimits) {
|
||||
mImpl->SetUseTieredLimits(useTieredLimits);
|
||||
}
|
||||
|
||||
bool Adapter::SupportsExternalImages() const {
|
||||
return mImpl->SupportsExternalImages();
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue