Rename null::Adapter -> null::PhysicalDevice.
Bug: dawn:1774 Change-Id: I05f4578e08175c4ce5703c5555689ba517b4590d Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/130780 Reviewed-by: Austin Eng <enga@chromium.org> Kokoro: Kokoro <noreply+kokoro@google.com> Commit-Queue: Stephen White <senorblanco@chromium.org>
This commit is contained in:
parent
be4b208ab6
commit
556147c333
|
@ -28,13 +28,14 @@
|
|||
|
||||
namespace dawn::native::null {
|
||||
|
||||
// Implementation of pre-Device objects: the null adapter, null backend connection and Connect()
|
||||
// Implementation of pre-Device objects: the null physical device, null backend connection and
|
||||
// Connect()
|
||||
|
||||
Adapter::Adapter(InstanceBase* instance)
|
||||
: Adapter(instance,
|
||||
PhysicalDevice::PhysicalDevice(InstanceBase* instance)
|
||||
: PhysicalDevice(instance,
|
||||
TogglesState(ToggleStage::Adapter).InheritFrom(instance->GetTogglesState())) {}
|
||||
|
||||
Adapter::Adapter(InstanceBase* instance, const TogglesState& adapterToggles)
|
||||
PhysicalDevice::PhysicalDevice(InstanceBase* instance, const TogglesState& adapterToggles)
|
||||
: PhysicalDeviceBase(instance, wgpu::BackendType::Null, adapterToggles) {
|
||||
mVendorId = 0;
|
||||
mDeviceId = 0;
|
||||
|
@ -44,36 +45,37 @@ Adapter::Adapter(InstanceBase* instance, const TogglesState& adapterToggles)
|
|||
ASSERT(err.IsSuccess());
|
||||
}
|
||||
|
||||
Adapter::~Adapter() = default;
|
||||
PhysicalDevice::~PhysicalDevice() = default;
|
||||
|
||||
bool Adapter::SupportsExternalImages() const {
|
||||
bool PhysicalDevice::SupportsExternalImages() const {
|
||||
return false;
|
||||
}
|
||||
|
||||
MaybeError Adapter::InitializeImpl() {
|
||||
MaybeError PhysicalDevice::InitializeImpl() {
|
||||
return {};
|
||||
}
|
||||
|
||||
void Adapter::InitializeSupportedFeaturesImpl() {
|
||||
void PhysicalDevice::InitializeSupportedFeaturesImpl() {
|
||||
// Enable all features by default for the convenience of tests.
|
||||
for (uint32_t i = 0; i < static_cast<uint32_t>(Feature::EnumCount); i++) {
|
||||
EnableFeature(static_cast<Feature>(i));
|
||||
}
|
||||
}
|
||||
|
||||
MaybeError Adapter::InitializeSupportedLimitsImpl(CombinedLimits* limits) {
|
||||
MaybeError PhysicalDevice::InitializeSupportedLimitsImpl(CombinedLimits* limits) {
|
||||
GetDefaultLimits(&limits->v1);
|
||||
return {};
|
||||
}
|
||||
|
||||
void Adapter::SetupBackendDeviceToggles(TogglesState* deviceToggles) const {}
|
||||
void PhysicalDevice::SetupBackendDeviceToggles(TogglesState* deviceToggles) const {}
|
||||
|
||||
ResultOrError<Ref<DeviceBase>> Adapter::CreateDeviceImpl(const DeviceDescriptor* descriptor,
|
||||
ResultOrError<Ref<DeviceBase>> PhysicalDevice::CreateDeviceImpl(const DeviceDescriptor* descriptor,
|
||||
const TogglesState& deviceToggles) {
|
||||
return Device::Create(this, descriptor, deviceToggles);
|
||||
}
|
||||
|
||||
MaybeError Adapter::ValidateFeatureSupportedWithTogglesImpl(wgpu::FeatureName feature,
|
||||
MaybeError PhysicalDevice::ValidateFeatureSupportedWithTogglesImpl(
|
||||
wgpu::FeatureName feature,
|
||||
const TogglesState& toggles) const {
|
||||
return {};
|
||||
}
|
||||
|
@ -87,10 +89,11 @@ class Backend : public BackendConnection {
|
|||
const TogglesState& adapterToggles) override {
|
||||
// There is always a single Null adapter because it is purely CPU based and doesn't
|
||||
// depend on the system.
|
||||
std::vector<Ref<PhysicalDeviceBase>> adapters;
|
||||
Ref<Adapter> adapter = AcquireRef(new Adapter(GetInstance(), adapterToggles));
|
||||
adapters.push_back(std::move(adapter));
|
||||
return adapters;
|
||||
std::vector<Ref<PhysicalDeviceBase>> physicalDevices;
|
||||
Ref<PhysicalDevice> physicalDevice =
|
||||
AcquireRef(new PhysicalDevice(GetInstance(), adapterToggles));
|
||||
physicalDevices.push_back(std::move(physicalDevice));
|
||||
return physicalDevices;
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -113,7 +116,7 @@ struct CopyFromStagingToBufferOperation : PendingOperation {
|
|||
// Device
|
||||
|
||||
// static
|
||||
ResultOrError<Ref<Device>> Device::Create(Adapter* adapter,
|
||||
ResultOrError<Ref<Device>> Device::Create(AdapterBase* adapter,
|
||||
const DeviceDescriptor* descriptor,
|
||||
const TogglesState& deviceToggles) {
|
||||
Ref<Device> device = AcquireRef(new Device(adapter, descriptor, deviceToggles));
|
||||
|
|
|
@ -40,13 +40,13 @@
|
|||
|
||||
namespace dawn::native::null {
|
||||
|
||||
class Adapter;
|
||||
class BindGroup;
|
||||
class BindGroupLayout;
|
||||
class Buffer;
|
||||
class CommandBuffer;
|
||||
class ComputePipeline;
|
||||
class Device;
|
||||
class PhysicalDevice;
|
||||
using PipelineLayout = PipelineLayoutBase;
|
||||
class QuerySet;
|
||||
class Queue;
|
||||
|
@ -58,13 +58,13 @@ class Texture;
|
|||
using TextureView = TextureViewBase;
|
||||
|
||||
struct NullBackendTraits {
|
||||
using AdapterType = Adapter;
|
||||
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;
|
||||
|
@ -88,7 +88,7 @@ struct PendingOperation {
|
|||
|
||||
class Device final : public DeviceBase {
|
||||
public:
|
||||
static ResultOrError<Ref<Device>> Create(Adapter* adapter,
|
||||
static ResultOrError<Ref<Device>> Create(AdapterBase* adapter,
|
||||
const DeviceDescriptor* descriptor,
|
||||
const TogglesState& deviceToggles);
|
||||
~Device() override;
|
||||
|
@ -170,13 +170,13 @@ class Device final : public DeviceBase {
|
|||
size_t mMemoryUsage = 0;
|
||||
};
|
||||
|
||||
class Adapter : public PhysicalDeviceBase {
|
||||
class PhysicalDevice : public PhysicalDeviceBase {
|
||||
public:
|
||||
// Create null adapter without providing toggles state for testing, only inherit instance's
|
||||
// toggles state
|
||||
explicit Adapter(InstanceBase* instance);
|
||||
Adapter(InstanceBase* instance, const TogglesState& adapterToggles);
|
||||
~Adapter() override;
|
||||
explicit PhysicalDevice(InstanceBase* instance);
|
||||
PhysicalDevice(InstanceBase* instance, const TogglesState& adapterToggles);
|
||||
~PhysicalDevice() override;
|
||||
|
||||
// PhysicalDeviceBase Implementation
|
||||
bool SupportsExternalImages() const override;
|
||||
|
|
|
@ -47,9 +47,9 @@ class FeatureTests : public testing::Test {
|
|||
Ref<dawn::native::InstanceBase> mInstanceBase;
|
||||
// The adapter that inherit toggles states from the instance, also have DisallowUnsafeAPIs
|
||||
// enabled.
|
||||
dawn::native::null::Adapter mAdapterBase;
|
||||
dawn::native::null::PhysicalDevice mAdapterBase;
|
||||
// The adapter that override DisallowUnsafeAPIs to disabled in toggles state.
|
||||
dawn::native::null::Adapter mUnsafeAdapterBase;
|
||||
dawn::native::null::PhysicalDevice mUnsafeAdapterBase;
|
||||
};
|
||||
|
||||
// Test the creation of a device will fail if the requested feature is not supported on the
|
||||
|
|
|
@ -94,7 +94,7 @@ class GetProcAddressTests : public testing::TestWithParam<DawnFlavor> {
|
|||
|
||||
protected:
|
||||
Ref<dawn::native::InstanceBase> mNativeInstance;
|
||||
dawn::native::null::Adapter mNativeAdapter;
|
||||
dawn::native::null::PhysicalDevice mNativeAdapter;
|
||||
|
||||
std::unique_ptr<utils::TerribleCommandBuffer> mC2sBuf;
|
||||
std::unique_ptr<dawn::wire::WireClient> mWireClient;
|
||||
|
|
|
@ -32,7 +32,7 @@ class PerThreadProcTests : public testing::Test {
|
|||
|
||||
protected:
|
||||
Ref<dawn::native::InstanceBase> mNativeInstance;
|
||||
dawn::native::null::Adapter mNativeAdapter;
|
||||
dawn::native::null::PhysicalDevice mNativeAdapter;
|
||||
};
|
||||
|
||||
// Test that procs can be set per thread. This test overrides deviceCreateBuffer with a placeholder
|
||||
|
|
Loading…
Reference in New Issue