diff --git a/include/dawn/native/DawnNative.h b/include/dawn/native/DawnNative.h index d7362a53d4..06e3f1182e 100644 --- a/include/dawn/native/DawnNative.h +++ b/include/dawn/native/DawnNative.h @@ -34,7 +34,8 @@ struct DeviceDescriptor; namespace dawn::native { class InstanceBase; -class PhysicalDeviceBase; +class AdapterBase; + // An optional parameter of Adapter::CreateDevice() to send additional information when creating // a Device. For example, we can use it to enable a workaround, optimization or feature. struct DAWN_NATIVE_EXPORT DawnDeviceDescriptor { @@ -84,10 +85,8 @@ struct FeatureInfo { class DAWN_NATIVE_EXPORT Adapter { public: Adapter(); - // TODO(dawn:1774): all references to PhysicalDeviceBase in this class will go back to - // using AdapterBase once the latter becomes a real class again. // NOLINTNEXTLINE(runtime/explicit) - Adapter(PhysicalDeviceBase* impl); + Adapter(AdapterBase* impl); ~Adapter(); Adapter(const Adapter& other); @@ -132,7 +131,7 @@ class DAWN_NATIVE_EXPORT Adapter { void ResetInternalDeviceForTesting(); private: - PhysicalDeviceBase* mImpl = nullptr; + AdapterBase* mImpl = nullptr; }; // Base class for options passed to Instance::DiscoverAdapters. diff --git a/src/dawn/native/Adapter.cpp b/src/dawn/native/Adapter.cpp new file mode 100644 index 0000000000..6b494505a1 --- /dev/null +++ b/src/dawn/native/Adapter.cpp @@ -0,0 +1,66 @@ +// Copyright 2023 The Dawn Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include "dawn/native/Adapter.h" + +#include + +#include "dawn/native/PhysicalDevice.h" + +namespace dawn::native { + +AdapterBase::AdapterBase(const Ref& physicalDevice) + : mPhysicalDevice(std::move(physicalDevice)) {} + +AdapterBase::~AdapterBase() = default; + +PhysicalDeviceBase* AdapterBase::GetPhysicalDevice() { + return mPhysicalDevice.Get(); +} + +InstanceBase* AdapterBase::APIGetInstance() const { + return mPhysicalDevice->APIGetInstance(); +} + +bool AdapterBase::APIGetLimits(SupportedLimits* limits) const { + return mPhysicalDevice->APIGetLimits(limits); +} + +void AdapterBase::APIGetProperties(AdapterProperties* properties) const { + mPhysicalDevice->APIGetProperties(properties); +} + +bool AdapterBase::APIHasFeature(wgpu::FeatureName feature) const { + return mPhysicalDevice->APIHasFeature(feature); +} + +size_t AdapterBase::APIEnumerateFeatures(wgpu::FeatureName* features) const { + return mPhysicalDevice->APIEnumerateFeatures(features); +} + +DeviceBase* AdapterBase::APICreateDevice(const DeviceDescriptor* descriptor) { + return mPhysicalDevice->CreateDevice(this, descriptor); +} + +void AdapterBase::APIRequestDevice(const DeviceDescriptor* descriptor, + WGPURequestDeviceCallback callback, + void* userdata) { + return mPhysicalDevice->RequestDevice(this, descriptor, callback, userdata); +} + +const TogglesState& AdapterBase::GetTogglesState() const { + return mPhysicalDevice->GetTogglesState(); +} + +} // namespace dawn::native diff --git a/src/dawn/native/Adapter.h b/src/dawn/native/Adapter.h index 04af41ea45..b9b03c2caf 100644 --- a/src/dawn/native/Adapter.h +++ b/src/dawn/native/Adapter.h @@ -15,12 +15,43 @@ #ifndef SRC_DAWN_NATIVE_ADAPTER_H_ #define SRC_DAWN_NATIVE_ADAPTER_H_ -#include "dawn/native/PhysicalDevice.h" +#include "dawn/native/DawnNative.h" + +#include "dawn/common/RefCounted.h" +#include "dawn/native/dawn_platform.h" namespace dawn::native { -using AdapterBase = PhysicalDeviceBase; +class DeviceBase; +class TogglesState; +struct SupportedLimits; -} +class AdapterBase : public RefCounted { + public: + explicit AdapterBase(const Ref& physicalDevice); + ~AdapterBase() override; + + // WebGPU API + InstanceBase* APIGetInstance() const; + bool APIGetLimits(SupportedLimits* limits) const; + void APIGetProperties(AdapterProperties* properties) const; + bool APIHasFeature(wgpu::FeatureName feature) const; + size_t APIEnumerateFeatures(wgpu::FeatureName* features) const; + void APIRequestDevice(const DeviceDescriptor* descriptor, + WGPURequestDeviceCallback callback, + void* userdata); + DeviceBase* APICreateDevice(const DeviceDescriptor* descriptor = nullptr); + + // Return the underlying PhysicalDevice. + PhysicalDeviceBase* GetPhysicalDevice(); + + // Get the actual toggles state of the adapter. + const TogglesState& GetTogglesState() const; + + private: + Ref mPhysicalDevice; +}; + +} // namespace dawn::native #endif // SRC_DAWN_NATIVE_ADAPTER_H_ diff --git a/src/dawn/native/BUILD.gn b/src/dawn/native/BUILD.gn index 143a7b590e..dbfb01628b 100644 --- a/src/dawn/native/BUILD.gn +++ b/src/dawn/native/BUILD.gn @@ -184,6 +184,7 @@ source_set("sources") { sources = get_target_outputs(":utils_gen") sources += [ + "Adapter.cpp", "Adapter.h", "ApplyClearColorValueWithDrawHelper.cpp", "ApplyClearColorValueWithDrawHelper.h", diff --git a/src/dawn/native/CMakeLists.txt b/src/dawn/native/CMakeLists.txt index 3a97810ee7..683f072f29 100644 --- a/src/dawn/native/CMakeLists.txt +++ b/src/dawn/native/CMakeLists.txt @@ -31,6 +31,7 @@ target_sources(dawn_native PRIVATE "${DAWN_INCLUDE_DIR}/dawn/native/dawn_native_export.h" ${DAWN_NATIVE_UTILS_GEN_SOURCES} "Adapter.h" + "Adapter.cpp" "ApplyClearColorValueWithDrawHelper.cpp" "ApplyClearColorValueWithDrawHelper.h" "AsyncTask.cpp" diff --git a/src/dawn/native/CommandValidation.cpp b/src/dawn/native/CommandValidation.cpp index f420b85fb3..7d5a34a1cd 100644 --- a/src/dawn/native/CommandValidation.cpp +++ b/src/dawn/native/CommandValidation.cpp @@ -79,7 +79,7 @@ MaybeError ValidateTimestampQuery(const DeviceBase* device, DAWN_INVALID_IF(!device->HasFeature(requiredFeature), "Timestamp queries used without the %s feature enabled.", - device->GetAdapter() + device->GetPhysicalDevice() ->GetInstance() ->GetFeatureInfo(FeatureEnumToAPIFeature(requiredFeature)) ->name); diff --git a/src/dawn/native/DawnNative.cpp b/src/dawn/native/DawnNative.cpp index 1ff26894e0..2a827ef983 100644 --- a/src/dawn/native/DawnNative.cpp +++ b/src/dawn/native/DawnNative.cpp @@ -81,7 +81,7 @@ DawnDeviceDescriptor::~DawnDeviceDescriptor() = default; Adapter::Adapter() = default; -Adapter::Adapter(PhysicalDeviceBase* impl) : mImpl(impl) { +Adapter::Adapter(AdapterBase* impl) : mImpl(impl) { if (mImpl != nullptr) { mImpl->Reference(); } @@ -122,20 +122,20 @@ WGPUAdapter Adapter::Get() const { } std::vector Adapter::GetSupportedFeatures() const { - FeaturesSet supportedFeaturesSet = mImpl->GetSupportedFeatures(); + FeaturesSet supportedFeaturesSet = mImpl->GetPhysicalDevice()->GetSupportedFeatures(); return supportedFeaturesSet.GetEnabledFeatureNames(); } bool Adapter::GetLimits(WGPUSupportedLimits* limits) const { - return mImpl->GetLimits(FromAPI(limits)); + return mImpl->GetPhysicalDevice()->GetLimits(FromAPI(limits)); } void Adapter::SetUseTieredLimits(bool useTieredLimits) { - mImpl->SetUseTieredLimits(useTieredLimits); + mImpl->GetPhysicalDevice()->SetUseTieredLimits(useTieredLimits); } bool Adapter::SupportsExternalImages() const { - return mImpl->SupportsExternalImages(); + return mImpl->GetPhysicalDevice()->SupportsExternalImages(); } Adapter::operator bool() const { @@ -177,7 +177,7 @@ void Adapter::RequestDevice(const WGPUDeviceDescriptor* descriptor, } void Adapter::ResetInternalDeviceForTesting() { - mImpl->ResetInternalDeviceForTesting(); + mImpl->GetPhysicalDevice()->ResetInternalDeviceForTesting(); } // AdapterDiscoverOptionsBase @@ -210,7 +210,7 @@ bool Instance::DiscoverAdapters(const AdapterDiscoveryOptionsBase* options) { std::vector Instance::GetAdapters() const { // Adapters are owned by mImpl so it is safe to return non RAII pointers to them std::vector adapters; - for (const Ref& adapter : mImpl->GetAdapters()) { + for (const Ref& adapter : mImpl->GetAdapters()) { adapters.push_back(Adapter(adapter.Get())); } return adapters; diff --git a/src/dawn/native/Device.cpp b/src/dawn/native/Device.cpp index e40dd5d744..4a79454b22 100644 --- a/src/dawn/native/Device.cpp +++ b/src/dawn/native/Device.cpp @@ -286,7 +286,7 @@ MaybeError DeviceBase::Initialize(Ref defaultQueue) { // mAdapter is not set for mock test devices. // TODO(crbug.com/dawn/1702): using a mock adapter could avoid the null checking. if (mAdapter != nullptr) { - mAdapter->GetInstance()->AddDevice(this); + mAdapter->GetPhysicalDevice()->GetInstance()->AddDevice(this); } return {}; @@ -344,11 +344,12 @@ void DeviceBase::WillDropLastExternalRef() { // mAdapter is not set for mock test devices. // TODO(crbug.com/dawn/1702): using a mock adapter could avoid the null checking. if (mAdapter != nullptr) { - mAdapter->GetInstance()->RemoveDevice(this); + mAdapter->GetPhysicalDevice()->GetInstance()->RemoveDevice(this); // Once last external ref dropped, all callbacks should be forwarded to Instance's callback // queue instead. - mCallbackTaskManager = mAdapter->GetInstance()->GetCallbackTaskManager(); + mCallbackTaskManager = + mAdapter->GetPhysicalDevice()->GetInstance()->GetCallbackTaskManager(); } } @@ -659,9 +660,10 @@ BlobCache* DeviceBase::GetBlobCache() { // TODO(crbug.com/dawn/1481): Shader caching currently has a dependency on the WGSL writer to // generate cache keys. We can lift the dependency once we also cache frontend parsing, // transformations, and reflection. - return mAdapter->GetInstance()->GetBlobCache(!IsToggleEnabled(Toggle::DisableBlobCache)); + return mAdapter->GetPhysicalDevice()->GetInstance()->GetBlobCache( + !IsToggleEnabled(Toggle::DisableBlobCache)); #else - return mAdapter->GetInstance()->GetBlobCache(false); + return mAdapter->GetPhysicalDevice()->GetInstance()->GetBlobCache(false); #endif } @@ -720,12 +722,11 @@ AdapterBase* DeviceBase::GetAdapter() const { } PhysicalDeviceBase* DeviceBase::GetPhysicalDevice() const { - return mAdapter - .Get(); // TODO(dawn:1774): This will retrieve the PhysicalDevice from the AdapterBase. + return mAdapter->GetPhysicalDevice(); } dawn::platform::Platform* DeviceBase::GetPlatform() const { - return GetAdapter()->GetInstance()->GetPlatform(); + return GetPhysicalDevice()->GetInstance()->GetPlatform(); } ExecutionSerial DeviceBase::GetCompletedCommandSerial() const { @@ -1346,7 +1347,7 @@ MaybeError DeviceBase::Tick() { return {}; } -PhysicalDeviceBase* DeviceBase::APIGetAdapter() { +AdapterBase* DeviceBase::APIGetAdapter() { mAdapter->Reference(); return mAdapter.Get(); } @@ -1373,7 +1374,7 @@ ExternalTextureBase* DeviceBase::APICreateExternalTexture( void DeviceBase::ApplyFeatures(const DeviceDescriptor* deviceDescriptor) { ASSERT(deviceDescriptor); - ASSERT(GetAdapter()->SupportsAllRequiredFeatures( + ASSERT(GetPhysicalDevice()->SupportsAllRequiredFeatures( {deviceDescriptor->requiredFeatures, deviceDescriptor->requiredFeaturesCount})); for (uint32_t i = 0; i < deviceDescriptor->requiredFeaturesCount; ++i) { diff --git a/src/dawn/native/Forward.h b/src/dawn/native/Forward.h index f280785acf..2537d2d322 100644 --- a/src/dawn/native/Forward.h +++ b/src/dawn/native/Forward.h @@ -24,6 +24,7 @@ namespace dawn::native { enum class ObjectType : uint32_t; +class AdapterBase; class BindGroupBase; class BindGroupLayoutBase; class BufferBase; @@ -51,8 +52,6 @@ class SwapChainBase; class TextureBase; class TextureViewBase; -using AdapterBase = PhysicalDeviceBase; - class DeviceBase; template diff --git a/src/dawn/native/Instance.cpp b/src/dawn/native/Instance.cpp index 0db04bcd08..7bfad4d2d8 100644 --- a/src/dawn/native/Instance.cpp +++ b/src/dawn/native/Instance.cpp @@ -313,13 +313,13 @@ void InstanceBase::DiscoverDefaultAdapters() { TogglesState adapterToggles = TogglesState(ToggleStage::Adapter); adapterToggles.InheritFrom(mToggles); - std::vector> backendAdapters = + std::vector> physicalDevices = backend->DiscoverDefaultAdapters(adapterToggles); - for (Ref& adapter : backendAdapters) { - ASSERT(adapter->GetBackendType() == backend->GetType()); - ASSERT(adapter->GetInstance() == this); - mAdapters.push_back(std::move(adapter)); + for (Ref& physicalDevice : physicalDevices) { + ASSERT(physicalDevice->GetBackendType() == backend->GetType()); + ASSERT(physicalDevice->GetInstance() == this); + mAdapters.push_back(AcquireRef(new AdapterBase(std::move(physicalDevice)))); } } @@ -447,13 +447,13 @@ MaybeError InstanceBase::DiscoverAdaptersInternal(const AdapterDiscoveryOptionsB TogglesState adapterToggles = TogglesState(ToggleStage::Adapter); adapterToggles.InheritFrom(mToggles); - std::vector> newAdapters; - DAWN_TRY_ASSIGN(newAdapters, backend->DiscoverAdapters(options, adapterToggles)); + std::vector> newPhysicalDevices; + DAWN_TRY_ASSIGN(newPhysicalDevices, backend->DiscoverAdapters(options, adapterToggles)); - for (Ref& adapter : newAdapters) { - ASSERT(adapter->GetBackendType() == backend->GetType()); - ASSERT(adapter->GetInstance() == this); - mAdapters.push_back(std::move(adapter)); + for (Ref& physicalDevice : newPhysicalDevices) { + ASSERT(physicalDevice->GetBackendType() == backend->GetType()); + ASSERT(physicalDevice->GetInstance() == this); + mAdapters.push_back(AcquireRef(new AdapterBase(std::move(physicalDevice)))); } } diff --git a/src/dawn/native/PhysicalDevice.cpp b/src/dawn/native/PhysicalDevice.cpp index 54e318a4f0..c69318a09d 100644 --- a/src/dawn/native/PhysicalDevice.cpp +++ b/src/dawn/native/PhysicalDevice.cpp @@ -127,12 +127,13 @@ size_t PhysicalDeviceBase::APIEnumerateFeatures(wgpu::FeatureName* features) con return mSupportedFeatures.EnumerateFeatures(features); } -DeviceBase* PhysicalDeviceBase::APICreateDevice(const DeviceDescriptor* descriptor) { +DeviceBase* PhysicalDeviceBase::CreateDevice(AdapterBase* adapter, + const DeviceDescriptor* descriptor) { DeviceDescriptor defaultDesc = {}; if (descriptor == nullptr) { descriptor = &defaultDesc; } - auto result = CreateDeviceInternal(descriptor); + auto result = CreateDeviceInternal(adapter, descriptor); if (result.IsError()) { mInstance->ConsumedError(result.AcquireError()); return nullptr; @@ -140,14 +141,15 @@ DeviceBase* PhysicalDeviceBase::APICreateDevice(const DeviceDescriptor* descript return result.AcquireSuccess().Detach(); } -void PhysicalDeviceBase::APIRequestDevice(const DeviceDescriptor* descriptor, - WGPURequestDeviceCallback callback, - void* userdata) { +void PhysicalDeviceBase::RequestDevice(AdapterBase* adapter, + const DeviceDescriptor* descriptor, + WGPURequestDeviceCallback callback, + void* userdata) { static constexpr DeviceDescriptor kDefaultDescriptor = {}; if (descriptor == nullptr) { descriptor = &kDefaultDescriptor; } - auto result = CreateDeviceInternal(descriptor); + auto result = CreateDeviceInternal(adapter, descriptor); if (result.IsError()) { std::unique_ptr errorData = result.AcquireError(); @@ -253,6 +255,7 @@ void PhysicalDeviceBase::SetSupportedFeaturesForTesting( } ResultOrError> PhysicalDeviceBase::CreateDeviceInternal( + AdapterBase* adapter, const DeviceDescriptor* descriptor) { ASSERT(descriptor != nullptr); @@ -289,7 +292,7 @@ ResultOrError> PhysicalDeviceBase::CreateDeviceInternal( DAWN_INVALID_IF(descriptor->requiredLimits->nextInChain != nullptr, "nextInChain is not nullptr."); } - return CreateDeviceImpl(descriptor, deviceToggles); + return CreateDeviceImpl(adapter, descriptor, deviceToggles); } void PhysicalDeviceBase::SetUseTieredLimits(bool useTieredLimits) { diff --git a/src/dawn/native/PhysicalDevice.h b/src/dawn/native/PhysicalDevice.h index 009de1b859..1d9af42d53 100644 --- a/src/dawn/native/PhysicalDevice.h +++ b/src/dawn/native/PhysicalDevice.h @@ -48,10 +48,11 @@ class PhysicalDeviceBase : public RefCounted { void APIGetProperties(AdapterProperties* properties) const; bool APIHasFeature(wgpu::FeatureName feature) const; size_t APIEnumerateFeatures(wgpu::FeatureName* features) const; - void APIRequestDevice(const DeviceDescriptor* descriptor, - WGPURequestDeviceCallback callback, - void* userdata); - DeviceBase* APICreateDevice(const DeviceDescriptor* descriptor = nullptr); + void RequestDevice(AdapterBase* adapter, + const DeviceDescriptor* descriptor, + WGPURequestDeviceCallback callback, + void* userdata); + DeviceBase* CreateDevice(AdapterBase* adapter, const DeviceDescriptor* descriptor = nullptr); uint32_t GetVendorId() const; uint32_t GetDeviceId() const; @@ -101,7 +102,8 @@ class PhysicalDeviceBase : public RefCounted { // Backend-specific force-setting and defaulting device toggles virtual void SetupBackendDeviceToggles(TogglesState* deviceToggles) const = 0; - virtual ResultOrError> CreateDeviceImpl(const DeviceDescriptor* descriptor, + virtual ResultOrError> CreateDeviceImpl(AdapterBase* adapter, + const DeviceDescriptor* descriptor, const TogglesState& deviceToggles) = 0; virtual MaybeError InitializeImpl() = 0; @@ -118,7 +120,8 @@ class PhysicalDeviceBase : public RefCounted { wgpu::FeatureName feature, const TogglesState& toggles) const = 0; - ResultOrError> CreateDeviceInternal(const DeviceDescriptor* descriptor); + ResultOrError> CreateDeviceInternal(AdapterBase* adapter, + const DeviceDescriptor* descriptor); virtual MaybeError ResetInternalDeviceForTestingImpl(); Ref mInstance; diff --git a/src/dawn/native/SwapChain.cpp b/src/dawn/native/SwapChain.cpp index da06e3ac73..841c31fd83 100644 --- a/src/dawn/native/SwapChain.cpp +++ b/src/dawn/native/SwapChain.cpp @@ -233,7 +233,7 @@ bool SwapChainBase::IsAttached() const { } wgpu::BackendType SwapChainBase::GetBackendType() const { - return GetDevice()->GetAdapter()->GetBackendType(); + return GetDevice()->GetPhysicalDevice()->GetBackendType(); } MaybeError SwapChainBase::ValidatePresent() const { diff --git a/src/dawn/native/d3d11/PhysicalDeviceD3D11.cpp b/src/dawn/native/d3d11/PhysicalDeviceD3D11.cpp index c39d47f580..a961236583 100644 --- a/src/dawn/native/d3d11/PhysicalDeviceD3D11.cpp +++ b/src/dawn/native/d3d11/PhysicalDeviceD3D11.cpp @@ -199,9 +199,10 @@ void PhysicalDevice::SetupBackendDeviceToggles(TogglesState* deviceToggles) cons deviceToggles->Default(Toggle::ApplyClearBigIntegerColorValueWithDraw, true); } -ResultOrError> PhysicalDevice::CreateDeviceImpl(const DeviceDescriptor* descriptor, +ResultOrError> PhysicalDevice::CreateDeviceImpl(AdapterBase* adapter, + const DeviceDescriptor* descriptor, const TogglesState& deviceToggles) { - return Device::Create(this, descriptor, deviceToggles); + return Device::Create(adapter, descriptor, deviceToggles); } // Resets the backend device and creates a new one. If any D3D11 objects belonging to the diff --git a/src/dawn/native/d3d11/PhysicalDeviceD3D11.h b/src/dawn/native/d3d11/PhysicalDeviceD3D11.h index 9c3a7458a0..356d4bdd7f 100644 --- a/src/dawn/native/d3d11/PhysicalDeviceD3D11.h +++ b/src/dawn/native/d3d11/PhysicalDeviceD3D11.h @@ -42,7 +42,8 @@ class PhysicalDevice : public d3d::PhysicalDevice { void SetupBackendDeviceToggles(TogglesState* deviceToggles) const override; - ResultOrError> CreateDeviceImpl(const DeviceDescriptor* descriptor, + ResultOrError> CreateDeviceImpl(AdapterBase* adapter, + const DeviceDescriptor* descriptor, const TogglesState& deviceToggles) override; MaybeError ResetInternalDeviceForTestingImpl() override; diff --git a/src/dawn/native/d3d12/PhysicalDeviceD3D12.cpp b/src/dawn/native/d3d12/PhysicalDeviceD3D12.cpp index 3aa00da2aa..a7bfa9ac04 100644 --- a/src/dawn/native/d3d12/PhysicalDeviceD3D12.cpp +++ b/src/dawn/native/d3d12/PhysicalDeviceD3D12.cpp @@ -579,9 +579,10 @@ void PhysicalDevice::SetupBackendDeviceToggles(TogglesState* deviceToggles) cons } } -ResultOrError> PhysicalDevice::CreateDeviceImpl(const DeviceDescriptor* descriptor, +ResultOrError> PhysicalDevice::CreateDeviceImpl(AdapterBase* adapter, + const DeviceDescriptor* descriptor, const TogglesState& deviceToggles) { - return Device::Create(this, descriptor, deviceToggles); + return Device::Create(adapter, descriptor, deviceToggles); } // Resets the backend device and creates a new one. If any D3D12 objects belonging to the diff --git a/src/dawn/native/d3d12/PhysicalDeviceD3D12.h b/src/dawn/native/d3d12/PhysicalDeviceD3D12.h index 8fdf76f33b..611c85e69d 100644 --- a/src/dawn/native/d3d12/PhysicalDeviceD3D12.h +++ b/src/dawn/native/d3d12/PhysicalDeviceD3D12.h @@ -44,7 +44,8 @@ class PhysicalDevice : public d3d::PhysicalDevice { void SetupBackendDeviceToggles(TogglesState* deviceToggles) const override; - ResultOrError> CreateDeviceImpl(const DeviceDescriptor* descriptor, + ResultOrError> CreateDeviceImpl(AdapterBase* adapter, + const DeviceDescriptor* descriptor, const TogglesState& deviceToggles) override; MaybeError ResetInternalDeviceForTestingImpl() override; diff --git a/src/dawn/native/d3d12/ResidencyManagerD3D12.cpp b/src/dawn/native/d3d12/ResidencyManagerD3D12.cpp index 97a062d2d9..00b3a99233 100644 --- a/src/dawn/native/d3d12/ResidencyManagerD3D12.cpp +++ b/src/dawn/native/d3d12/ResidencyManagerD3D12.cpp @@ -115,7 +115,7 @@ void ResidencyManager::UpdateVideoMemoryInfo() { void ResidencyManager::UpdateMemorySegmentInfo(MemorySegmentInfo* segmentInfo) { DXGI_QUERY_VIDEO_MEMORY_INFO queryVideoMemoryInfo; - ToBackend(mDevice->GetAdapter()) + ToBackend(mDevice->GetPhysicalDevice()) ->GetHardwareAdapter() ->QueryVideoMemoryInfo(0, segmentInfo->dxgiSegment, &queryVideoMemoryInfo); diff --git a/src/dawn/native/d3d12/ShaderModuleD3D12.cpp b/src/dawn/native/d3d12/ShaderModuleD3D12.cpp index 851d420d83..beeddb852a 100644 --- a/src/dawn/native/d3d12/ShaderModuleD3D12.cpp +++ b/src/dawn/native/d3d12/ShaderModuleD3D12.cpp @@ -89,10 +89,10 @@ ResultOrError ShaderModule::Compile( if (device->IsToggleEnabled(Toggle::UseDXC)) { // If UseDXC toggle are not forced to be disable, DXC should have been validated to be // available. - ASSERT(ToBackend(device->GetAdapter())->GetBackend()->IsDXCAvailable()); + ASSERT(ToBackend(device->GetPhysicalDevice())->GetBackend()->IsDXCAvailable()); // We can get the DXC version information since IsDXCAvailable() is true. d3d::DxcVersionInfo dxcVersionInfo = - ToBackend(device->GetAdapter())->GetBackend()->GetDxcVersion(); + ToBackend(device->GetPhysicalDevice())->GetBackend()->GetDxcVersion(); req.bytecode.compiler = d3d::Compiler::DXC; req.bytecode.dxcLibrary = device->GetDxcLibrary().Get(); diff --git a/src/dawn/native/metal/BackendMTL.mm b/src/dawn/native/metal/BackendMTL.mm index 0459dcc99c..a21254be3b 100644 --- a/src/dawn/native/metal/BackendMTL.mm +++ b/src/dawn/native/metal/BackendMTL.mm @@ -293,9 +293,10 @@ class PhysicalDevice : public PhysicalDeviceBase { } private: - ResultOrError> CreateDeviceImpl(const DeviceDescriptor* descriptor, + ResultOrError> CreateDeviceImpl(AdapterBase* adapter, + const DeviceDescriptor* descriptor, const TogglesState& deviceToggles) override { - return Device::Create(this, mDevice, descriptor, deviceToggles); + return Device::Create(adapter, mDevice, descriptor, deviceToggles); } void SetupBackendDeviceToggles(TogglesState* deviceToggles) const override { diff --git a/src/dawn/native/metal/ComputePipelineMTL.mm b/src/dawn/native/metal/ComputePipelineMTL.mm index 9d48e6eb9a..863924dc33 100644 --- a/src/dawn/native/metal/ComputePipelineMTL.mm +++ b/src/dawn/native/metal/ComputePipelineMTL.mm @@ -86,14 +86,14 @@ bool ComputePipeline::RequiresStorageBufferLength() const { void ComputePipeline::InitializeAsync(Ref computePipeline, WGPUCreateComputePipelineAsyncCallback callback, void* userdata) { - AdapterBase* adapter = computePipeline->GetDevice()->GetAdapter(); + PhysicalDeviceBase* physicalDevice = computePipeline->GetDevice()->GetPhysicalDevice(); std::unique_ptr asyncTask = std::make_unique(std::move(computePipeline), callback, userdata); // Workaround a crash where the validation layers on AMD crash with partition alloc. // See crbug.com/dawn/1200. - if (adapter->GetInstance()->IsBackendValidationEnabled() && - gpu_info::IsAMD(adapter->GetVendorId())) { + if (physicalDevice->GetInstance()->IsBackendValidationEnabled() && + gpu_info::IsAMD(physicalDevice->GetVendorId())) { asyncTask->Run(); return; } diff --git a/src/dawn/native/metal/DeviceMTL.mm b/src/dawn/native/metal/DeviceMTL.mm index fdcf4d2c6a..7223e1a282 100644 --- a/src/dawn/native/metal/DeviceMTL.mm +++ b/src/dawn/native/metal/DeviceMTL.mm @@ -16,6 +16,7 @@ #include "dawn/common/GPUInfo.h" #include "dawn/common/Platform.h" +#include "dawn/native/Adapter.h" #include "dawn/native/BackendConnection.h" #include "dawn/native/BindGroupLayout.h" #include "dawn/native/Commands.h" @@ -155,7 +156,7 @@ MaybeError Device::Initialize(const DeviceDescriptor* descriptor) { if (mIsTimestampQueryEnabled && !IsToggleEnabled(Toggle::DisableTimestampQueryConversion)) { // Make a best guess of timestamp period based on device vendor info, and converge it to // an accurate value by the following calculations. - mTimestampPeriod = gpu_info::IsIntel(GetAdapter()->GetVendorId()) ? 83.333f : 1.0f; + mTimestampPeriod = gpu_info::IsIntel(GetPhysicalDevice()->GetVendorId()) ? 83.333f : 1.0f; // Initialize kalman filter parameters mKalmanInfo = std::make_unique(); diff --git a/src/dawn/native/metal/RenderPipelineMTL.mm b/src/dawn/native/metal/RenderPipelineMTL.mm index 62d3735ff3..faaf906bac 100644 --- a/src/dawn/native/metal/RenderPipelineMTL.mm +++ b/src/dawn/native/metal/RenderPipelineMTL.mm @@ -513,14 +513,14 @@ NSRef RenderPipeline::MakeVertexDesc() const { void RenderPipeline::InitializeAsync(Ref renderPipeline, WGPUCreateRenderPipelineAsyncCallback callback, void* userdata) { - AdapterBase* adapter = renderPipeline->GetDevice()->GetAdapter(); + PhysicalDeviceBase* physicalDevice = renderPipeline->GetDevice()->GetPhysicalDevice(); std::unique_ptr asyncTask = std::make_unique(std::move(renderPipeline), callback, userdata); // Workaround a crash where the validation layers on AMD crash with partition alloc. // See crbug.com/dawn/1200. - if (adapter->GetInstance()->IsBackendValidationEnabled() && - gpu_info::IsAMD(adapter->GetVendorId())) { + if (physicalDevice->GetInstance()->IsBackendValidationEnabled() && + gpu_info::IsAMD(physicalDevice->GetVendorId())) { asyncTask->Run(); return; } diff --git a/src/dawn/native/null/DeviceNull.cpp b/src/dawn/native/null/DeviceNull.cpp index 9e2e4b425f..cb2c5fa591 100644 --- a/src/dawn/native/null/DeviceNull.cpp +++ b/src/dawn/native/null/DeviceNull.cpp @@ -69,9 +69,10 @@ MaybeError PhysicalDevice::InitializeSupportedLimitsImpl(CombinedLimits* limits) void PhysicalDevice::SetupBackendDeviceToggles(TogglesState* deviceToggles) const {} -ResultOrError> PhysicalDevice::CreateDeviceImpl(const DeviceDescriptor* descriptor, +ResultOrError> PhysicalDevice::CreateDeviceImpl(AdapterBase* adapter, + const DeviceDescriptor* descriptor, const TogglesState& deviceToggles) { - return Device::Create(this, descriptor, deviceToggles); + return Device::Create(adapter, descriptor, deviceToggles); } MaybeError PhysicalDevice::ValidateFeatureSupportedWithTogglesImpl( diff --git a/src/dawn/native/null/DeviceNull.h b/src/dawn/native/null/DeviceNull.h index 263f82e9e8..abdad48d7d 100644 --- a/src/dawn/native/null/DeviceNull.h +++ b/src/dawn/native/null/DeviceNull.h @@ -193,7 +193,8 @@ class PhysicalDevice : public PhysicalDeviceBase { const TogglesState& toggles) const override; void SetupBackendDeviceToggles(TogglesState* deviceToggles) const override; - ResultOrError> CreateDeviceImpl(const DeviceDescriptor* descriptor, + ResultOrError> CreateDeviceImpl(AdapterBase* adapter, + const DeviceDescriptor* descriptor, const TogglesState& deviceToggles) override; }; diff --git a/src/dawn/native/opengl/DeviceGL.cpp b/src/dawn/native/opengl/DeviceGL.cpp index 45346a6866..356d9c2f17 100644 --- a/src/dawn/native/opengl/DeviceGL.cpp +++ b/src/dawn/native/opengl/DeviceGL.cpp @@ -137,7 +137,7 @@ MaybeError Device::Initialize(const DeviceDescriptor* descriptor) { // extensions bool hasDebugOutput = gl.IsAtLeastGL(4, 3) || gl.IsAtLeastGLES(3, 2); - if (GetAdapter()->GetInstance()->IsBackendValidationEnabled() && hasDebugOutput) { + if (GetPhysicalDevice()->GetInstance()->IsBackendValidationEnabled() && hasDebugOutput) { gl.Enable(GL_DEBUG_OUTPUT); gl.Enable(GL_DEBUG_OUTPUT_SYNCHRONOUS); diff --git a/src/dawn/native/opengl/Forward.h b/src/dawn/native/opengl/Forward.h index b037e0c102..7a3965b48c 100644 --- a/src/dawn/native/opengl/Forward.h +++ b/src/dawn/native/opengl/Forward.h @@ -38,13 +38,13 @@ class Texture; class TextureView; struct OpenGLBackendTraits { - using PhysicalDeviceType = PhysicalDevice; using BindGroupType = BindGroup; using BindGroupLayoutType = BindGroupLayout; using BufferType = Buffer; using CommandBufferType = CommandBuffer; using ComputePipelineType = ComputePipeline; using DeviceType = Device; + using PhysicalDeviceType = PhysicalDevice; using PipelineLayoutType = PipelineLayout; using QuerySetType = QuerySet; using QueueType = Queue; diff --git a/src/dawn/native/opengl/PhysicalDeviceGL.cpp b/src/dawn/native/opengl/PhysicalDeviceGL.cpp index bbf4af71ef..9222058589 100644 --- a/src/dawn/native/opengl/PhysicalDeviceGL.cpp +++ b/src/dawn/native/opengl/PhysicalDeviceGL.cpp @@ -217,13 +217,14 @@ void PhysicalDevice::SetupBackendDeviceToggles(TogglesState* deviceToggles) cons gl.GetVersion().IsES()); } -ResultOrError> PhysicalDevice::CreateDeviceImpl(const DeviceDescriptor* descriptor, +ResultOrError> PhysicalDevice::CreateDeviceImpl(AdapterBase* adapter, + const DeviceDescriptor* descriptor, const TogglesState& deviceToggles) { EGLenum api = GetBackendType() == wgpu::BackendType::OpenGL ? EGL_OPENGL_API : EGL_OPENGL_ES_API; std::unique_ptr context; DAWN_TRY_ASSIGN(context, ContextEGL::Create(mEGLFunctions, api)); - return Device::Create(this, descriptor, mFunctions, std::move(context), deviceToggles); + return Device::Create(adapter, descriptor, mFunctions, std::move(context), deviceToggles); } MaybeError PhysicalDevice::ValidateFeatureSupportedWithTogglesImpl( diff --git a/src/dawn/native/opengl/PhysicalDeviceGL.h b/src/dawn/native/opengl/PhysicalDeviceGL.h index 7fe5f838d1..d53f39e243 100644 --- a/src/dawn/native/opengl/PhysicalDeviceGL.h +++ b/src/dawn/native/opengl/PhysicalDeviceGL.h @@ -43,7 +43,8 @@ class PhysicalDevice : public PhysicalDeviceBase { const TogglesState& toggles) const override; void SetupBackendDeviceToggles(TogglesState* deviceToggles) const override; - ResultOrError> CreateDeviceImpl(const DeviceDescriptor* descriptor, + ResultOrError> CreateDeviceImpl(AdapterBase* adapter, + const DeviceDescriptor* descriptor, const TogglesState& deviceToggles) override; OpenGLFunctions mFunctions; diff --git a/src/dawn/native/vulkan/PhysicalDeviceVk.cpp b/src/dawn/native/vulkan/PhysicalDeviceVk.cpp index ac5fea9cf6..07feed89f7 100644 --- a/src/dawn/native/vulkan/PhysicalDeviceVk.cpp +++ b/src/dawn/native/vulkan/PhysicalDeviceVk.cpp @@ -504,9 +504,10 @@ void PhysicalDevice::SetupBackendDeviceToggles(TogglesState* deviceToggles) cons deviceToggles->Default(Toggle::UsePlaceholderFragmentInVertexOnlyPipeline, true); } -ResultOrError> PhysicalDevice::CreateDeviceImpl(const DeviceDescriptor* descriptor, +ResultOrError> PhysicalDevice::CreateDeviceImpl(AdapterBase* adapter, + const DeviceDescriptor* descriptor, const TogglesState& deviceToggles) { - return Device::Create(this, descriptor, deviceToggles); + return Device::Create(adapter, descriptor, deviceToggles); } MaybeError PhysicalDevice::ValidateFeatureSupportedWithTogglesImpl( diff --git a/src/dawn/native/vulkan/PhysicalDeviceVk.h b/src/dawn/native/vulkan/PhysicalDeviceVk.h index c7be683d2a..5c420725a2 100644 --- a/src/dawn/native/vulkan/PhysicalDeviceVk.h +++ b/src/dawn/native/vulkan/PhysicalDeviceVk.h @@ -54,7 +54,8 @@ class PhysicalDevice : public PhysicalDeviceBase { const TogglesState& toggles) const override; void SetupBackendDeviceToggles(TogglesState* deviceToggles) const override; - ResultOrError> CreateDeviceImpl(const DeviceDescriptor* descriptor, + ResultOrError> CreateDeviceImpl(AdapterBase* adapter, + const DeviceDescriptor* descriptor, const TogglesState& deviceToggles) override; VkPhysicalDevice mVkPhysicalDevice; diff --git a/src/dawn/native/vulkan/TextureVk.cpp b/src/dawn/native/vulkan/TextureVk.cpp index d9b4a5fb91..ebd138c6a0 100644 --- a/src/dawn/native/vulkan/TextureVk.cpp +++ b/src/dawn/native/vulkan/TextureVk.cpp @@ -621,7 +621,8 @@ bool IsSampleCountSupported(const dawn::native::vulkan::Device* device, const VkImageCreateInfo& imageCreateInfo) { ASSERT(device); - VkPhysicalDevice vkPhysicalDevice = ToBackend(device->GetAdapter())->GetVkPhysicalDevice(); + VkPhysicalDevice vkPhysicalDevice = + ToBackend(device->GetPhysicalDevice())->GetVkPhysicalDevice(); VkImageFormatProperties properties; if (device->fn.GetPhysicalDeviceImageFormatProperties( vkPhysicalDevice, imageCreateInfo.format, imageCreateInfo.imageType, diff --git a/src/dawn/native/vulkan/external_memory/MemoryServiceImplementationDmaBuf.cpp b/src/dawn/native/vulkan/external_memory/MemoryServiceImplementationDmaBuf.cpp index ffad717e85..85b355dad8 100644 --- a/src/dawn/native/vulkan/external_memory/MemoryServiceImplementationDmaBuf.cpp +++ b/src/dawn/native/vulkan/external_memory/MemoryServiceImplementationDmaBuf.cpp @@ -153,7 +153,8 @@ class ServiceImplementationDmaBuf : public ServiceImplementation { static_cast(descriptor); // Verify plane count for the modifier. - VkPhysicalDevice vkPhysicalDevice = ToBackend(mDevice->GetAdapter())->GetVkPhysicalDevice(); + VkPhysicalDevice vkPhysicalDevice = + ToBackend(mDevice->GetPhysicalDevice())->GetVkPhysicalDevice(); uint32_t planeCount = 0; if (mDevice->ConsumedError(GetModifierPlaneCount(mDevice->fn, vkPhysicalDevice, format, dmaBufDescriptor->drmModifier), @@ -303,7 +304,8 @@ class ServiceImplementationDmaBuf : public ServiceImplementation { const ExternalImageDescriptorDmaBuf* dmaBufDescriptor = static_cast(descriptor); - VkPhysicalDevice vkPhysicalDevice = ToBackend(mDevice->GetAdapter())->GetVkPhysicalDevice(); + VkPhysicalDevice vkPhysicalDevice = + ToBackend(mDevice->GetPhysicalDevice())->GetVkPhysicalDevice(); VkDevice device = mDevice->GetVkDevice(); uint32_t planeCount; diff --git a/src/dawn/native/vulkan/external_semaphore/SemaphoreServiceImplementationZirconHandle.cpp b/src/dawn/native/vulkan/external_semaphore/SemaphoreServiceImplementationZirconHandle.cpp index 46da902435..55aa69f440 100644 --- a/src/dawn/native/vulkan/external_semaphore/SemaphoreServiceImplementationZirconHandle.cpp +++ b/src/dawn/native/vulkan/external_semaphore/SemaphoreServiceImplementationZirconHandle.cpp @@ -29,7 +29,7 @@ class ServiceImplementationZirconHandle : public ServiceImplementation { explicit ServiceImplementationZirconHandle(Device* device) : ServiceImplementation(device), mSupported(CheckSupport(device->GetDeviceInfo(), - ToBackend(device->GetAdapter())->GetVkPhysicalDevice(), + ToBackend(device->GetPhysicalDevice())->GetVkPhysicalDevice(), device->fn)) {} ~ServiceImplementationZirconHandle() override = default; diff --git a/src/dawn/tests/unittests/FeatureTests.cpp b/src/dawn/tests/unittests/FeatureTests.cpp index 477119692f..34c7b2efea 100644 --- a/src/dawn/tests/unittests/FeatureTests.cpp +++ b/src/dawn/tests/unittests/FeatureTests.cpp @@ -25,11 +25,13 @@ class FeatureTests : public testing::Test { FeatureTests() : testing::Test(), mInstanceBase(dawn::native::InstanceBase::Create()), - mAdapterBase(mInstanceBase.Get()), - mUnsafeAdapterBase( + mPhysicalDevice(mInstanceBase.Get()), + mUnsafePhysicalDevice( mInstanceBase.Get(), dawn::native::TogglesState(dawn::native::ToggleStage::Adapter) - .SetForTesting(dawn::native::Toggle::DisallowUnsafeAPIs, false, false)) {} + .SetForTesting(dawn::native::Toggle::DisallowUnsafeAPIs, false, false)), + mAdapterBase(&mPhysicalDevice), + mUnsafeAdapterBase(&mUnsafePhysicalDevice) {} std::vector GetAllFeatureNames() { std::vector allFeatureNames(kTotalFeaturesCount); @@ -45,11 +47,13 @@ class FeatureTests : public testing::Test { protected: // By default DisallowUnsafeAPIs is enabled in this instance. Ref mInstanceBase; + dawn::native::null::PhysicalDevice mPhysicalDevice; + dawn::native::null::PhysicalDevice mUnsafePhysicalDevice; // The adapter that inherit toggles states from the instance, also have DisallowUnsafeAPIs // enabled. - dawn::native::null::PhysicalDevice mAdapterBase; + dawn::native::AdapterBase mAdapterBase; // The adapter that override DisallowUnsafeAPIs to disabled in toggles state. - dawn::native::null::PhysicalDevice mUnsafeAdapterBase; + dawn::native::AdapterBase mUnsafeAdapterBase; }; // Test the creation of a device will fail if the requested feature is not supported on the @@ -64,7 +68,7 @@ TEST_F(FeatureTests, AdapterWithRequiredFeatureDisabled) { // Test that the adapter with unsafe apis disallowed validate features as expected. { - mAdapterBase.SetSupportedFeaturesForTesting(featureNamesWithoutOne); + mPhysicalDevice.SetSupportedFeaturesForTesting(featureNamesWithoutOne); dawn::native::Adapter adapterWithoutFeature(&mAdapterBase); wgpu::DeviceDescriptor deviceDescriptor; @@ -79,7 +83,7 @@ TEST_F(FeatureTests, AdapterWithRequiredFeatureDisabled) { // Test that the adapter with unsafe apis allowed validate features as expected. { - mUnsafeAdapterBase.SetSupportedFeaturesForTesting(featureNamesWithoutOne); + mUnsafePhysicalDevice.SetSupportedFeaturesForTesting(featureNamesWithoutOne); dawn::native::Adapter adapterWithoutFeature(&mUnsafeAdapterBase); wgpu::DeviceDescriptor deviceDescriptor; diff --git a/src/dawn/tests/unittests/GetProcAddressTests.cpp b/src/dawn/tests/unittests/GetProcAddressTests.cpp index b04cf777c4..0893ff46ef 100644 --- a/src/dawn/tests/unittests/GetProcAddressTests.cpp +++ b/src/dawn/tests/unittests/GetProcAddressTests.cpp @@ -56,13 +56,13 @@ class GetProcAddressTests : public testing::TestWithParam { GetProcAddressTests() : testing::TestWithParam(), mNativeInstance(dawn::native::InstanceBase::Create()), - mNativeAdapter(mNativeInstance.Get()) {} + mAdapterBase(AcquireRef(new dawn::native::null::PhysicalDevice(mNativeInstance.Get()))) {} void SetUp() override { switch (GetParam()) { case DawnFlavor::Native: { mDevice = wgpu::Device::Acquire( - reinterpret_cast(mNativeAdapter.APICreateDevice())); + reinterpret_cast(mAdapterBase.APICreateDevice())); mProcs = dawn::native::GetProcs(); break; } @@ -94,7 +94,7 @@ class GetProcAddressTests : public testing::TestWithParam { protected: Ref mNativeInstance; - dawn::native::null::PhysicalDevice mNativeAdapter; + dawn::native::AdapterBase mAdapterBase; std::unique_ptr mC2sBuf; std::unique_ptr mWireClient; diff --git a/src/dawn/tests/unittests/PerThreadProcTests.cpp b/src/dawn/tests/unittests/PerThreadProcTests.cpp index 690fa4d545..d9bafdf208 100644 --- a/src/dawn/tests/unittests/PerThreadProcTests.cpp +++ b/src/dawn/tests/unittests/PerThreadProcTests.cpp @@ -27,12 +27,12 @@ class PerThreadProcTests : public testing::Test { public: PerThreadProcTests() : mNativeInstance(dawn::native::InstanceBase::Create()), - mNativeAdapter(mNativeInstance.Get()) {} + mAdapterBase(AcquireRef(new dawn::native::null::PhysicalDevice(mNativeInstance.Get()))) {} ~PerThreadProcTests() override = default; protected: Ref mNativeInstance; - dawn::native::null::PhysicalDevice mNativeAdapter; + dawn::native::AdapterBase mAdapterBase; }; // Test that procs can be set per thread. This test overrides deviceCreateBuffer with a placeholder @@ -57,10 +57,10 @@ TEST_F(PerThreadProcTests, DispatchesPerThread) { // Note: Acquire doesn't call reference or release. wgpu::Device deviceA = - wgpu::Device::Acquire(reinterpret_cast(mNativeAdapter.APICreateDevice())); + wgpu::Device::Acquire(reinterpret_cast(mAdapterBase.APICreateDevice())); wgpu::Device deviceB = - wgpu::Device::Acquire(reinterpret_cast(mNativeAdapter.APICreateDevice())); + wgpu::Device::Acquire(reinterpret_cast(mAdapterBase.APICreateDevice())); std::thread threadA([&]() { DawnProcTable procs = dawn::native::GetProcs(); diff --git a/src/dawn/tests/unittests/ToggleTests.cpp b/src/dawn/tests/unittests/ToggleTests.cpp index 51578055e9..cc333b7e71 100644 --- a/src/dawn/tests/unittests/ToggleTests.cpp +++ b/src/dawn/tests/unittests/ToggleTests.cpp @@ -135,7 +135,7 @@ TEST_F(InstanceToggleTest, InstanceTogglesInheritToAdapterAndDevice) { // Get the adapter created by instance with default toggles. dawn::native::AdapterBase* nullAdapter = nullptr; for (auto& adapter : instance->GetAdapters()) { - if (adapter->GetBackendType() == wgpu::BackendType::Null) { + if (adapter->GetPhysicalDevice()->GetBackendType() == wgpu::BackendType::Null) { nullAdapter = adapter.Get(); break; } diff --git a/src/dawn/tests/white_box/VulkanImageWrappingTests.cpp b/src/dawn/tests/white_box/VulkanImageWrappingTests.cpp index c0528dbc18..6cdd6dbaa1 100644 --- a/src/dawn/tests/white_box/VulkanImageWrappingTests.cpp +++ b/src/dawn/tests/white_box/VulkanImageWrappingTests.cpp @@ -15,8 +15,8 @@ #include #include "dawn/common/Math.h" +#include "dawn/native/Adapter.h" #include "dawn/native/vulkan/DeviceVk.h" -#include "dawn/native/vulkan/PhysicalDeviceVk.h" #include "dawn/tests/DawnTest.h" #include "dawn/tests/white_box/VulkanImageWrappingTests.h" #include "dawn/utils/ComboRenderPipelineDescriptor.h"