Rename metal::Adapter -> metal::PhysicalDevice.
Change-Id: I558b7a22359437dd2a54f05a55a4128a806c7783 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/130760 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
b15d853239
commit
be4b208ab6
|
@ -251,11 +251,13 @@ DAWN_NOINLINE bool IsGPUCounterSupported(id<MTLDevice> device,
|
||||||
|
|
||||||
} // anonymous namespace
|
} // anonymous namespace
|
||||||
|
|
||||||
// The Metal backend's Adapter.
|
// The Metal backend's PhysicalDevice.
|
||||||
|
|
||||||
class Adapter : public PhysicalDeviceBase {
|
class PhysicalDevice : public PhysicalDeviceBase {
|
||||||
public:
|
public:
|
||||||
Adapter(InstanceBase* instance, id<MTLDevice> device, const TogglesState& requiredAdapterToggle)
|
PhysicalDevice(InstanceBase* instance,
|
||||||
|
id<MTLDevice> device,
|
||||||
|
const TogglesState& requiredAdapterToggle)
|
||||||
: PhysicalDeviceBase(instance, wgpu::BackendType::Metal, requiredAdapterToggle),
|
: PhysicalDeviceBase(instance, wgpu::BackendType::Metal, requiredAdapterToggle),
|
||||||
mDevice(device) {
|
mDevice(device) {
|
||||||
mName = std::string([[*mDevice name] UTF8String]);
|
mName = std::string([[*mDevice name] UTF8String]);
|
||||||
|
@ -803,28 +805,29 @@ ResultOrError<std::vector<Ref<PhysicalDeviceBase>>> Backend::DiscoverAdapters(
|
||||||
const TogglesState& adapterToggles) {
|
const TogglesState& adapterToggles) {
|
||||||
ASSERT(optionsBase->backendType == WGPUBackendType_Metal);
|
ASSERT(optionsBase->backendType == WGPUBackendType_Metal);
|
||||||
|
|
||||||
std::vector<Ref<PhysicalDeviceBase>> adapters;
|
std::vector<Ref<PhysicalDeviceBase>> physicalDevices;
|
||||||
#if DAWN_PLATFORM_IS(MACOS)
|
#if DAWN_PLATFORM_IS(MACOS)
|
||||||
NSRef<NSArray<id<MTLDevice>>> devices = AcquireNSRef(MTLCopyAllDevices());
|
NSRef<NSArray<id<MTLDevice>>> devices = AcquireNSRef(MTLCopyAllDevices());
|
||||||
|
|
||||||
for (id<MTLDevice> device in devices.Get()) {
|
for (id<MTLDevice> device in devices.Get()) {
|
||||||
Ref<Adapter> adapter = AcquireRef(new Adapter(GetInstance(), device, adapterToggles));
|
Ref<PhysicalDevice> physicalDevice =
|
||||||
if (!GetInstance()->ConsumedError(adapter->Initialize())) {
|
AcquireRef(new PhysicalDevice(GetInstance(), device, adapterToggles));
|
||||||
adapters.push_back(std::move(adapter));
|
if (!GetInstance()->ConsumedError(physicalDevice->Initialize())) {
|
||||||
|
physicalDevices.push_back(std::move(physicalDevice));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// iOS only has a single device so MTLCopyAllDevices doesn't exist there.
|
// iOS only has a single device so MTLCopyAllDevices doesn't exist there.
|
||||||
#if defined(DAWN_PLATFORM_IOS)
|
#if defined(DAWN_PLATFORM_IOS)
|
||||||
Ref<Adapter> adapter =
|
Ref<PhysicalDevice> physicalDevice = AcquireRef(
|
||||||
AcquireRef(new Adapter(GetInstance(), MTLCreateSystemDefaultDevice(), adapterToggles));
|
new PhysicalDevice(GetInstance(), MTLCreateSystemDefaultDevice(), adapterToggles));
|
||||||
if (!GetInstance()->ConsumedError(adapter->Initialize())) {
|
if (!GetInstance()->ConsumedError(physicalDevice->Initialize())) {
|
||||||
adapters.push_back(std::move(adapter));
|
physicalDevices.push_back(std::move(physicalDevice));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return adapters;
|
return physicalDevices;
|
||||||
}
|
}
|
||||||
|
|
||||||
BackendConnection* Connect(InstanceBase* instance) {
|
BackendConnection* Connect(InstanceBase* instance) {
|
||||||
|
|
|
@ -19,7 +19,6 @@
|
||||||
|
|
||||||
namespace dawn::native::metal {
|
namespace dawn::native::metal {
|
||||||
|
|
||||||
class Adapter;
|
|
||||||
class BindGroup;
|
class BindGroup;
|
||||||
class BindGroupLayout;
|
class BindGroupLayout;
|
||||||
class Buffer;
|
class Buffer;
|
||||||
|
@ -27,6 +26,7 @@ class CommandBuffer;
|
||||||
class ComputePipeline;
|
class ComputePipeline;
|
||||||
class Device;
|
class Device;
|
||||||
class Framebuffer;
|
class Framebuffer;
|
||||||
|
class PhysicalDevice;
|
||||||
class PipelineLayout;
|
class PipelineLayout;
|
||||||
class QuerySet;
|
class QuerySet;
|
||||||
class Queue;
|
class Queue;
|
||||||
|
@ -38,13 +38,13 @@ class Texture;
|
||||||
class TextureView;
|
class TextureView;
|
||||||
|
|
||||||
struct MetalBackendTraits {
|
struct MetalBackendTraits {
|
||||||
using AdapterType = Adapter;
|
|
||||||
using BindGroupType = BindGroup;
|
using BindGroupType = BindGroup;
|
||||||
using BindGroupLayoutType = BindGroupLayout;
|
using BindGroupLayoutType = BindGroupLayout;
|
||||||
using BufferType = Buffer;
|
using BufferType = Buffer;
|
||||||
using CommandBufferType = CommandBuffer;
|
using CommandBufferType = CommandBuffer;
|
||||||
using ComputePipelineType = ComputePipeline;
|
using ComputePipelineType = ComputePipeline;
|
||||||
using DeviceType = Device;
|
using DeviceType = Device;
|
||||||
|
using PhysicalDeviceType = PhysicalDevice;
|
||||||
using PipelineLayoutType = PipelineLayout;
|
using PipelineLayoutType = PipelineLayout;
|
||||||
using QuerySetType = QuerySet;
|
using QuerySetType = QuerySet;
|
||||||
using QueueType = Queue;
|
using QueueType = Queue;
|
||||||
|
|
Loading…
Reference in New Issue