Rename AdapterD3D* -> PhysicalDeviceD3D*.
Bug: dawn:1774 Change-Id: I9eca75c75c1ec162112915af3bd8371e808c2d60 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/130421 Commit-Queue: Stephen White <senorblanco@chromium.org> Reviewed-by: Austin Eng <enga@chromium.org> Kokoro: Kokoro <noreply+kokoro@google.com>
This commit is contained in:
parent
5c2f1678be
commit
9091b46278
|
@ -398,8 +398,6 @@ source_set("sources") {
|
|||
|
||||
if (dawn_enable_d3d11 || dawn_enable_d3d12) {
|
||||
sources += [
|
||||
"d3d/AdapterD3D.cpp",
|
||||
"d3d/AdapterD3D.h",
|
||||
"d3d/BackendD3D.cpp",
|
||||
"d3d/BackendD3D.h",
|
||||
"d3d/BlobD3D.cpp",
|
||||
|
@ -412,6 +410,8 @@ source_set("sources") {
|
|||
"d3d/ExternalImageDXGIImpl.cpp",
|
||||
"d3d/ExternalImageDXGIImpl.h",
|
||||
"d3d/Forward.h",
|
||||
"d3d/PhysicalDeviceD3D.cpp",
|
||||
"d3d/PhysicalDeviceD3D.h",
|
||||
"d3d/PlatformFunctions.cpp",
|
||||
"d3d/PlatformFunctions.h",
|
||||
"d3d/ShaderUtils.cpp",
|
||||
|
@ -427,8 +427,6 @@ source_set("sources") {
|
|||
if (dawn_enable_d3d11) {
|
||||
libs += [ "dxguid.lib" ]
|
||||
sources += [
|
||||
"d3d11/AdapterD3D11.cpp",
|
||||
"d3d11/AdapterD3D11.h",
|
||||
"d3d11/BackendD3D11.cpp",
|
||||
"d3d11/BackendD3D11.h",
|
||||
"d3d11/BindGroupD3D11.cpp",
|
||||
|
@ -448,6 +446,8 @@ source_set("sources") {
|
|||
"d3d11/DeviceInfoD3D11.cpp",
|
||||
"d3d11/DeviceInfoD3D11.h",
|
||||
"d3d11/Forward.h",
|
||||
"d3d11/PhysicalDeviceD3D11.cpp",
|
||||
"d3d11/PhysicalDeviceD3D11.h",
|
||||
"d3d11/PipelineLayoutD3D11.cpp",
|
||||
"d3d11/PipelineLayoutD3D11.h",
|
||||
"d3d11/PlatformFunctionsD3D11.cpp",
|
||||
|
@ -472,8 +472,6 @@ source_set("sources") {
|
|||
if (dawn_enable_d3d12) {
|
||||
libs += [ "dxguid.lib" ]
|
||||
sources += [
|
||||
"d3d12/AdapterD3D12.cpp",
|
||||
"d3d12/AdapterD3D12.h",
|
||||
"d3d12/BackendD3D12.cpp",
|
||||
"d3d12/BackendD3D12.h",
|
||||
"d3d12/BindGroupD3D12.cpp",
|
||||
|
@ -510,6 +508,8 @@ source_set("sources") {
|
|||
"d3d12/IntegerTypes.h",
|
||||
"d3d12/PageableD3D12.cpp",
|
||||
"d3d12/PageableD3D12.h",
|
||||
"d3d12/PhysicalDeviceD3D12.cpp",
|
||||
"d3d12/PhysicalDeviceD3D12.h",
|
||||
"d3d12/PipelineLayoutD3D12.cpp",
|
||||
"d3d12/PipelineLayoutD3D12.h",
|
||||
"d3d12/PlatformFunctionsD3D12.cpp",
|
||||
|
|
|
@ -255,8 +255,6 @@ endif()
|
|||
if (DAWN_ENABLE_D3D11 OR DAWN_ENABLE_D3D12)
|
||||
target_sources(dawn_native PRIVATE
|
||||
"${DAWN_INCLUDE_DIR}/dawn/native/D3DBackend.h"
|
||||
"d3d/AdapterD3D.cpp"
|
||||
"d3d/AdapterD3D.h"
|
||||
"d3d/BackendD3D.cpp"
|
||||
"d3d/BackendD3D.h"
|
||||
"d3d/BlobD3D.cpp"
|
||||
|
@ -269,6 +267,8 @@ if (DAWN_ENABLE_D3D11 OR DAWN_ENABLE_D3D12)
|
|||
"d3d/ExternalImageDXGIImpl.cpp"
|
||||
"d3d/ExternalImageDXGIImpl.h"
|
||||
"d3d/Forward.h"
|
||||
"d3d/PhysicalDeviceD3D.cpp"
|
||||
"d3d/PhysicalDeviceD3D.h"
|
||||
"d3d/PlatformFunctions.cpp"
|
||||
"d3d/PlatformFunctions.h"
|
||||
"d3d/ShaderUtils.cpp"
|
||||
|
@ -284,8 +284,6 @@ endif()
|
|||
if (DAWN_ENABLE_D3D11)
|
||||
target_sources(dawn_native PRIVATE
|
||||
"${DAWN_INCLUDE_DIR}/dawn/native/D3D11Backend.h"
|
||||
"d3d11/AdapterD3D11.cpp"
|
||||
"d3d11/AdapterD3D11.h"
|
||||
"d3d11/BackendD3D11.cpp"
|
||||
"d3d11/BackendD3D11.h"
|
||||
"d3d11/BindGroupD3D11.cpp"
|
||||
|
@ -305,6 +303,8 @@ if (DAWN_ENABLE_D3D11)
|
|||
"d3d11/DeviceInfoD3D11.cpp"
|
||||
"d3d11/DeviceInfoD3D11.h"
|
||||
"d3d11/Forward.h"
|
||||
"d3d11/PhysicalDeviceD3D11.cpp"
|
||||
"d3d11/PhysicalDeviceD3D11.h"
|
||||
"d3d11/PipelineLayoutD3D11.cpp"
|
||||
"d3d11/PipelineLayoutD3D11.h"
|
||||
"d3d11/PlatformFunctionsD3D11.cpp"
|
||||
|
@ -329,8 +329,6 @@ endif()
|
|||
if (DAWN_ENABLE_D3D12)
|
||||
target_sources(dawn_native PRIVATE
|
||||
"${DAWN_INCLUDE_DIR}/dawn/native/D3D12Backend.h"
|
||||
"d3d12/AdapterD3D12.cpp"
|
||||
"d3d12/AdapterD3D12.h"
|
||||
"d3d12/BackendD3D12.cpp"
|
||||
"d3d12/BackendD3D12.h"
|
||||
"d3d12/BindGroupD3D12.cpp"
|
||||
|
@ -367,6 +365,8 @@ if (DAWN_ENABLE_D3D12)
|
|||
"d3d12/IntegerTypes.h"
|
||||
"d3d12/PageableD3D12.cpp"
|
||||
"d3d12/PageableD3D12.h"
|
||||
"d3d12/PhysicalDeviceD3D12.cpp"
|
||||
"d3d12/PhysicalDeviceD3D12.h"
|
||||
"d3d12/PipelineLayoutD3D12.cpp"
|
||||
"d3d12/PipelineLayoutD3D12.h"
|
||||
"d3d12/PlatformFunctionsD3D12.cpp"
|
||||
|
|
|
@ -715,10 +715,15 @@ ApiObjectList* DeviceBase::GetObjectTrackingList(ObjectType type) {
|
|||
return &mObjectLists[type];
|
||||
}
|
||||
|
||||
PhysicalDeviceBase* DeviceBase::GetAdapter() const {
|
||||
AdapterBase* DeviceBase::GetAdapter() const {
|
||||
return mAdapter.Get();
|
||||
}
|
||||
|
||||
PhysicalDeviceBase* DeviceBase::GetPhysicalDevice() const {
|
||||
return mAdapter
|
||||
.Get(); // TODO(dawn:1774): This will retrieve the PhysicalDevice from the AdapterBase.
|
||||
}
|
||||
|
||||
dawn::platform::Platform* DeviceBase::GetPlatform() const {
|
||||
return GetAdapter()->GetInstance()->GetPlatform();
|
||||
}
|
||||
|
|
|
@ -155,6 +155,7 @@ class DeviceBase : public RefCountedWithExternalCount {
|
|||
MaybeError ValidateObject(const ApiObjectBase* object) const;
|
||||
|
||||
AdapterBase* GetAdapter() const;
|
||||
PhysicalDeviceBase* GetPhysicalDevice() const;
|
||||
virtual dawn::platform::Platform* GetPlatform() const;
|
||||
|
||||
// Returns the Format corresponding to the wgpu::TextureFormat or an error if the format
|
||||
|
|
|
@ -25,7 +25,7 @@ struct ToBackendTraits;
|
|||
|
||||
template <typename BackendTraits>
|
||||
struct ToBackendTraits<PhysicalDeviceBase, BackendTraits> {
|
||||
using BackendType = typename BackendTraits::AdapterType;
|
||||
using BackendType = typename BackendTraits::PhysicalDeviceType;
|
||||
};
|
||||
|
||||
template <typename BackendTraits>
|
||||
|
|
|
@ -260,7 +260,7 @@ ResultOrError<std::vector<Ref<PhysicalDeviceBase>>> Backend::DiscoverAdapters(
|
|||
// |dxgiAdapter| was provided. Discover just that adapter.
|
||||
Ref<PhysicalDeviceBase> adapter;
|
||||
DAWN_TRY_ASSIGN(adapter,
|
||||
CreateAdapterFromIDXGIAdapter(options->dxgiAdapter, adapterToggles));
|
||||
CreatePhysicalDeviceFromIDXGIAdapter(options->dxgiAdapter, adapterToggles));
|
||||
adapters.push_back(std::move(adapter));
|
||||
return std::move(adapters);
|
||||
}
|
||||
|
@ -274,8 +274,8 @@ ResultOrError<std::vector<Ref<PhysicalDeviceBase>>> Backend::DiscoverAdapters(
|
|||
|
||||
ASSERT(dxgiAdapter != nullptr);
|
||||
Ref<PhysicalDeviceBase> adapter;
|
||||
if (GetInstance()->ConsumedError(CreateAdapterFromIDXGIAdapter(dxgiAdapter, adapterToggles),
|
||||
&adapter)) {
|
||||
if (GetInstance()->ConsumedError(
|
||||
CreatePhysicalDeviceFromIDXGIAdapter(dxgiAdapter, adapterToggles), &adapter)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
|
@ -82,7 +82,7 @@ class Backend : public BackendConnection {
|
|||
const TogglesState& adapterToggles) override;
|
||||
|
||||
protected:
|
||||
virtual ResultOrError<Ref<PhysicalDeviceBase>> CreateAdapterFromIDXGIAdapter(
|
||||
virtual ResultOrError<Ref<PhysicalDeviceBase>> CreatePhysicalDeviceFromIDXGIAdapter(
|
||||
ComPtr<IDXGIAdapter> dxgiAdapter,
|
||||
const TogglesState& adapterToggles) = 0;
|
||||
|
||||
|
|
|
@ -14,9 +14,9 @@
|
|||
|
||||
#include "dawn/native/d3d/DeviceD3D.h"
|
||||
|
||||
#include "dawn/native/d3d/AdapterD3D.h"
|
||||
#include "dawn/native/d3d/BackendD3D.h"
|
||||
#include "dawn/native/d3d/Forward.h"
|
||||
#include "dawn/native/d3d/PhysicalDeviceD3D.h"
|
||||
|
||||
namespace dawn::native::d3d {
|
||||
|
||||
|
@ -35,23 +35,23 @@ ResultOrError<wgpu::TextureUsage> Device::GetSupportedSurfaceUsageImpl(
|
|||
}
|
||||
|
||||
const PlatformFunctions* Device::GetFunctions() const {
|
||||
return ToBackend(GetAdapter())->GetBackend()->GetFunctions();
|
||||
return ToBackend(GetPhysicalDevice())->GetBackend()->GetFunctions();
|
||||
}
|
||||
|
||||
ComPtr<IDXGIFactory4> Device::GetFactory() const {
|
||||
return ToBackend(GetAdapter())->GetBackend()->GetFactory();
|
||||
return ToBackend(GetPhysicalDevice())->GetBackend()->GetFactory();
|
||||
}
|
||||
|
||||
ComPtr<IDxcLibrary> Device::GetDxcLibrary() const {
|
||||
return ToBackend(GetAdapter())->GetBackend()->GetDxcLibrary();
|
||||
return ToBackend(GetPhysicalDevice())->GetBackend()->GetDxcLibrary();
|
||||
}
|
||||
|
||||
ComPtr<IDxcCompiler> Device::GetDxcCompiler() const {
|
||||
return ToBackend(GetAdapter())->GetBackend()->GetDxcCompiler();
|
||||
return ToBackend(GetPhysicalDevice())->GetBackend()->GetDxcCompiler();
|
||||
}
|
||||
|
||||
ComPtr<IDxcValidator> Device::GetDxcValidator() const {
|
||||
return ToBackend(GetAdapter())->GetBackend()->GetDxcValidator();
|
||||
return ToBackend(GetPhysicalDevice())->GetBackend()->GetDxcValidator();
|
||||
}
|
||||
|
||||
} // namespace dawn::native::d3d
|
||||
|
|
|
@ -19,13 +19,13 @@
|
|||
|
||||
namespace dawn::native::d3d {
|
||||
|
||||
class Adapter;
|
||||
class PhysicalDevice;
|
||||
class Device;
|
||||
class SwapChain;
|
||||
|
||||
struct D3DBackendTraits {
|
||||
using AdapterType = Adapter;
|
||||
using DeviceType = Device;
|
||||
using PhysicalDeviceType = PhysicalDevice;
|
||||
using SwapChainType = SwapChain;
|
||||
};
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#include "dawn/native/d3d/AdapterD3D.h"
|
||||
#include "dawn/native/d3d/PhysicalDeviceD3D.h"
|
||||
|
||||
#include <string>
|
||||
#include <utility>
|
||||
|
@ -22,25 +22,25 @@
|
|||
|
||||
namespace dawn::native::d3d {
|
||||
|
||||
Adapter::Adapter(Backend* backend,
|
||||
ComPtr<IDXGIAdapter3> hardwareAdapter,
|
||||
wgpu::BackendType backendType,
|
||||
const TogglesState& adapterToggles)
|
||||
PhysicalDevice::PhysicalDevice(Backend* backend,
|
||||
ComPtr<IDXGIAdapter3> hardwareAdapter,
|
||||
wgpu::BackendType backendType,
|
||||
const TogglesState& adapterToggles)
|
||||
: PhysicalDeviceBase(backend->GetInstance(), backendType, adapterToggles),
|
||||
mHardwareAdapter(std::move(hardwareAdapter)),
|
||||
mBackend(backend) {}
|
||||
|
||||
Adapter::~Adapter() = default;
|
||||
PhysicalDevice::~PhysicalDevice() = default;
|
||||
|
||||
IDXGIAdapter3* Adapter::GetHardwareAdapter() const {
|
||||
IDXGIAdapter3* PhysicalDevice::GetHardwareAdapter() const {
|
||||
return mHardwareAdapter.Get();
|
||||
}
|
||||
|
||||
Backend* Adapter::GetBackend() const {
|
||||
Backend* PhysicalDevice::GetBackend() const {
|
||||
return mBackend;
|
||||
}
|
||||
|
||||
MaybeError Adapter::InitializeImpl() {
|
||||
MaybeError PhysicalDevice::InitializeImpl() {
|
||||
DXGI_ADAPTER_DESC1 adapterDesc;
|
||||
GetHardwareAdapter()->GetDesc1(&adapterDesc);
|
||||
|
|
@ -12,8 +12,8 @@
|
|||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#ifndef SRC_DAWN_NATIVE_D3D_ADAPTERD3D_H_
|
||||
#define SRC_DAWN_NATIVE_D3D_ADAPTERD3D_H_
|
||||
#ifndef SRC_DAWN_NATIVE_D3D_PHYSICALDEVICED3D_H_
|
||||
#define SRC_DAWN_NATIVE_D3D_PHYSICALDEVICED3D_H_
|
||||
|
||||
#include "dawn/native/PhysicalDevice.h"
|
||||
|
||||
|
@ -23,13 +23,13 @@ namespace dawn::native::d3d {
|
|||
|
||||
class Backend;
|
||||
|
||||
class Adapter : public PhysicalDeviceBase {
|
||||
class PhysicalDevice : public PhysicalDeviceBase {
|
||||
public:
|
||||
Adapter(Backend* backend,
|
||||
ComPtr<IDXGIAdapter3> hardwareAdapter,
|
||||
wgpu::BackendType backendType,
|
||||
const TogglesState& adapterToggles);
|
||||
~Adapter() override;
|
||||
PhysicalDevice(Backend* backend,
|
||||
ComPtr<IDXGIAdapter3> hardwareAdapter,
|
||||
wgpu::BackendType backendType,
|
||||
const TogglesState& adapterToggles);
|
||||
~PhysicalDevice() override;
|
||||
|
||||
IDXGIAdapter3* GetHardwareAdapter() const;
|
||||
Backend* GetBackend() const;
|
||||
|
@ -44,4 +44,4 @@ class Adapter : public PhysicalDeviceBase {
|
|||
|
||||
} // namespace dawn::native::d3d
|
||||
|
||||
#endif // SRC_DAWN_NATIVE_D3D_ADAPTERD3D_H_
|
||||
#endif // SRC_DAWN_NATIVE_D3D_PHYSICALDEVICED3D_H_
|
|
@ -21,7 +21,7 @@
|
|||
#include "dawn/native/D3D11Backend.h"
|
||||
#include "dawn/native/Instance.h"
|
||||
#include "dawn/native/d3d/D3DError.h"
|
||||
#include "dawn/native/d3d11/AdapterD3D11.h"
|
||||
#include "dawn/native/d3d11/PhysicalDeviceD3D11.h"
|
||||
#include "dawn/native/d3d11/PlatformFunctionsD3D11.h"
|
||||
|
||||
namespace dawn::native::d3d11 {
|
||||
|
@ -41,15 +41,16 @@ const PlatformFunctions* Backend::GetFunctions() const {
|
|||
return static_cast<const PlatformFunctions*>(Base::GetFunctions());
|
||||
}
|
||||
|
||||
ResultOrError<Ref<PhysicalDeviceBase>> Backend::CreateAdapterFromIDXGIAdapter(
|
||||
ResultOrError<Ref<PhysicalDeviceBase>> Backend::CreatePhysicalDeviceFromIDXGIAdapter(
|
||||
ComPtr<IDXGIAdapter> dxgiAdapter,
|
||||
const TogglesState& adapterToggles) {
|
||||
ComPtr<IDXGIAdapter3> dxgiAdapter3;
|
||||
DAWN_TRY(CheckHRESULT(dxgiAdapter.As(&dxgiAdapter3), "DXGIAdapter retrieval"));
|
||||
Ref<Adapter> adapter = AcquireRef(new Adapter(this, std::move(dxgiAdapter3), adapterToggles));
|
||||
DAWN_TRY(adapter->Initialize());
|
||||
Ref<PhysicalDevice> physicalDevice =
|
||||
AcquireRef(new PhysicalDevice(this, std::move(dxgiAdapter3), adapterToggles));
|
||||
DAWN_TRY(physicalDevice->Initialize());
|
||||
|
||||
return {std::move(adapter)};
|
||||
return {std::move(physicalDevice)};
|
||||
}
|
||||
|
||||
BackendConnection* Connect(InstanceBase* instance) {
|
||||
|
|
|
@ -31,7 +31,7 @@ class Backend : public d3d::Backend {
|
|||
const PlatformFunctions* GetFunctions() const;
|
||||
|
||||
protected:
|
||||
ResultOrError<Ref<PhysicalDeviceBase>> CreateAdapterFromIDXGIAdapter(
|
||||
ResultOrError<Ref<PhysicalDeviceBase>> CreatePhysicalDeviceFromIDXGIAdapter(
|
||||
ComPtr<IDXGIAdapter> dxgiAdapter,
|
||||
const TogglesState& adapterToggles) override;
|
||||
|
||||
|
|
|
@ -25,13 +25,13 @@
|
|||
#include "dawn/native/Instance.h"
|
||||
#include "dawn/native/d3d/D3DError.h"
|
||||
#include "dawn/native/d3d/ExternalImageDXGIImpl.h"
|
||||
#include "dawn/native/d3d11/AdapterD3D11.h"
|
||||
#include "dawn/native/d3d11/BackendD3D11.h"
|
||||
#include "dawn/native/d3d11/BindGroupD3D11.h"
|
||||
#include "dawn/native/d3d11/BindGroupLayoutD3D11.h"
|
||||
#include "dawn/native/d3d11/BufferD3D11.h"
|
||||
#include "dawn/native/d3d11/CommandBufferD3D11.h"
|
||||
#include "dawn/native/d3d11/ComputePipelineD3D11.h"
|
||||
#include "dawn/native/d3d11/PhysicalDeviceD3D11.h"
|
||||
#include "dawn/native/d3d11/PipelineLayoutD3D11.h"
|
||||
#include "dawn/native/d3d11/PlatformFunctionsD3D11.h"
|
||||
#include "dawn/native/d3d11/QueueD3D11.h"
|
||||
|
@ -90,7 +90,7 @@ void AppendDebugLayerMessagesToError(ID3D11InfoQueue* infoQueue,
|
|||
} // namespace
|
||||
|
||||
// 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));
|
||||
|
@ -99,7 +99,7 @@ ResultOrError<Ref<Device>> Device::Create(Adapter* adapter,
|
|||
}
|
||||
|
||||
MaybeError Device::Initialize(const DeviceDescriptor* descriptor) {
|
||||
DAWN_TRY_ASSIGN(mD3d11Device, ToBackend(GetAdapter())->CreateD3D11Device());
|
||||
DAWN_TRY_ASSIGN(mD3d11Device, ToBackend(GetPhysicalDevice())->CreateD3D11Device());
|
||||
ASSERT(mD3d11Device != nullptr);
|
||||
|
||||
DAWN_TRY(DeviceBase::Initialize(Queue::Create(this, &descriptor->defaultQueue)));
|
||||
|
@ -334,7 +334,7 @@ MaybeError Device::CopyFromStagingToTextureImpl(const BufferBase* source,
|
|||
}
|
||||
|
||||
const DeviceInfo& Device::GetDeviceInfo() const {
|
||||
return ToBackend(GetAdapter())->GetDeviceInfo();
|
||||
return ToBackend(GetPhysicalDevice())->GetDeviceInfo();
|
||||
}
|
||||
|
||||
MaybeError Device::WaitForIdleForDestruction() {
|
||||
|
@ -346,7 +346,7 @@ MaybeError Device::WaitForIdleForDestruction() {
|
|||
}
|
||||
|
||||
MaybeError Device::CheckDebugLayerAndGenerateErrors() {
|
||||
if (!GetAdapter()->GetInstance()->IsBackendValidationEnabled()) {
|
||||
if (!GetPhysicalDevice()->GetInstance()->IsBackendValidationEnabled()) {
|
||||
return {};
|
||||
}
|
||||
|
||||
|
@ -370,7 +370,7 @@ MaybeError Device::CheckDebugLayerAndGenerateErrors() {
|
|||
}
|
||||
|
||||
void Device::AppendDebugLayerMessages(ErrorData* error) {
|
||||
if (!GetAdapter()->GetInstance()->IsBackendValidationEnabled()) {
|
||||
if (!GetPhysicalDevice()->GetInstance()->IsBackendValidationEnabled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ class Fence;
|
|||
// Definition of backend types
|
||||
class Device final : public d3d::Device {
|
||||
public:
|
||||
static ResultOrError<Ref<Device>> Create(Adapter* adapter,
|
||||
static ResultOrError<Ref<Device>> Create(AdapterBase* adapter,
|
||||
const DeviceDescriptor* descriptor,
|
||||
const TogglesState& deviceToggles);
|
||||
~Device() override;
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
|
||||
namespace dawn::native::d3d11 {
|
||||
|
||||
class Adapter;
|
||||
class PhysicalDevice;
|
||||
|
||||
struct DeviceInfo {
|
||||
bool isUMA;
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
|
||||
namespace dawn::native::d3d11 {
|
||||
|
||||
class Adapter;
|
||||
class BindGroup;
|
||||
class BindGroupLayout;
|
||||
class Buffer;
|
||||
|
@ -27,6 +26,7 @@ class CommandBuffer;
|
|||
class ComputePipeline;
|
||||
class Device;
|
||||
class Heap;
|
||||
class PhysicalDevice;
|
||||
class PipelineCache;
|
||||
class PipelineLayout;
|
||||
class QuerySet;
|
||||
|
@ -39,13 +39,13 @@ class Texture;
|
|||
class TextureView;
|
||||
|
||||
struct D3D11BackendTraits {
|
||||
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 PipelineCacheType = PipelineCache;
|
||||
using PipelineLayoutType = PipelineLayout;
|
||||
using QuerySetType = QuerySet;
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#include "dawn/native/d3d11/AdapterD3D11.h"
|
||||
#include "dawn/native/d3d11/PhysicalDeviceD3D11.h"
|
||||
|
||||
#include <string>
|
||||
#include <utility>
|
||||
|
@ -61,23 +61,23 @@ MaybeError InitializeDebugLayerFilters(ComPtr<ID3D11Device> d3d11Device) {
|
|||
|
||||
} // namespace
|
||||
|
||||
Adapter::Adapter(Backend* backend,
|
||||
ComPtr<IDXGIAdapter3> hardwareAdapter,
|
||||
const TogglesState& adapterToggles)
|
||||
PhysicalDevice::PhysicalDevice(Backend* backend,
|
||||
ComPtr<IDXGIAdapter3> hardwareAdapter,
|
||||
const TogglesState& adapterToggles)
|
||||
: Base(backend, std::move(hardwareAdapter), wgpu::BackendType::D3D11, adapterToggles) {}
|
||||
|
||||
Adapter::~Adapter() = default;
|
||||
PhysicalDevice::~PhysicalDevice() = default;
|
||||
|
||||
bool Adapter::SupportsExternalImages() const {
|
||||
bool PhysicalDevice::SupportsExternalImages() const {
|
||||
// TODO(dawn:1724): Implement external images on D3D11.
|
||||
return false;
|
||||
}
|
||||
|
||||
const DeviceInfo& Adapter::GetDeviceInfo() const {
|
||||
const DeviceInfo& PhysicalDevice::GetDeviceInfo() const {
|
||||
return mDeviceInfo;
|
||||
}
|
||||
|
||||
ResultOrError<ComPtr<ID3D11Device>> Adapter::CreateD3D11Device() {
|
||||
ResultOrError<ComPtr<ID3D11Device>> PhysicalDevice::CreateD3D11Device() {
|
||||
ComPtr<ID3D11Device> device = std::move(mD3d11Device);
|
||||
if (!device) {
|
||||
const PlatformFunctions* functions = static_cast<Backend*>(GetBackend())->GetFunctions();
|
||||
|
@ -102,7 +102,7 @@ ResultOrError<ComPtr<ID3D11Device>> Adapter::CreateD3D11Device() {
|
|||
return device;
|
||||
}
|
||||
|
||||
MaybeError Adapter::InitializeImpl() {
|
||||
MaybeError PhysicalDevice::InitializeImpl() {
|
||||
DAWN_TRY(Base::InitializeImpl());
|
||||
// D3D11 cannot check for feature support without a device.
|
||||
// Create the device to populate the adapter properties then reuse it when needed for actual
|
||||
|
@ -121,12 +121,12 @@ MaybeError Adapter::InitializeImpl() {
|
|||
return {};
|
||||
}
|
||||
|
||||
void Adapter::InitializeSupportedFeaturesImpl() {
|
||||
void PhysicalDevice::InitializeSupportedFeaturesImpl() {
|
||||
EnableFeature(Feature::TextureCompressionBC);
|
||||
EnableFeature(Feature::SurfaceCapabilities);
|
||||
}
|
||||
|
||||
MaybeError Adapter::InitializeSupportedLimitsImpl(CombinedLimits* limits) {
|
||||
MaybeError PhysicalDevice::InitializeSupportedLimitsImpl(CombinedLimits* limits) {
|
||||
GetDefaultLimits(&limits->v1);
|
||||
|
||||
// // https://docs.microsoft.com/en-us/windows/win32/direct3d12/hardware-feature-levels
|
||||
|
@ -188,18 +188,19 @@ MaybeError Adapter::InitializeSupportedLimitsImpl(CombinedLimits* limits) {
|
|||
return {};
|
||||
}
|
||||
|
||||
MaybeError Adapter::ValidateFeatureSupportedWithTogglesImpl(wgpu::FeatureName feature,
|
||||
const TogglesState& toggles) const {
|
||||
MaybeError PhysicalDevice::ValidateFeatureSupportedWithTogglesImpl(
|
||||
wgpu::FeatureName feature,
|
||||
const TogglesState& toggles) const {
|
||||
return {};
|
||||
}
|
||||
|
||||
void Adapter::SetupBackendDeviceToggles(TogglesState* deviceToggles) const {
|
||||
void PhysicalDevice::SetupBackendDeviceToggles(TogglesState* deviceToggles) const {
|
||||
// D3D11 can only clear RTV with float values.
|
||||
deviceToggles->Default(Toggle::ApplyClearBigIntegerColorValueWithDraw, true);
|
||||
}
|
||||
|
||||
ResultOrError<Ref<DeviceBase>> Adapter::CreateDeviceImpl(const DeviceDescriptor* descriptor,
|
||||
const TogglesState& deviceToggles) {
|
||||
ResultOrError<Ref<DeviceBase>> PhysicalDevice::CreateDeviceImpl(const DeviceDescriptor* descriptor,
|
||||
const TogglesState& deviceToggles) {
|
||||
return Device::Create(this, descriptor, deviceToggles);
|
||||
}
|
||||
|
||||
|
@ -207,7 +208,7 @@ ResultOrError<Ref<DeviceBase>> Adapter::CreateDeviceImpl(const DeviceDescriptor*
|
|||
// current ID3D11Device have not been destroyed, a non-zero value will be returned upon Reset()
|
||||
// and the subequent call to CreateDevice will return a handle the existing device instead of
|
||||
// creating a new one.
|
||||
MaybeError Adapter::ResetInternalDeviceForTestingImpl() {
|
||||
MaybeError PhysicalDevice::ResetInternalDeviceForTestingImpl() {
|
||||
[[maybe_unused]] auto refCount = mD3d11Device.Reset();
|
||||
ASSERT(refCount == 0);
|
||||
DAWN_TRY(Initialize());
|
|
@ -12,10 +12,10 @@
|
|||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#ifndef SRC_DAWN_NATIVE_D3D11_ADAPTERD3D11_H_
|
||||
#define SRC_DAWN_NATIVE_D3D11_ADAPTERD3D11_H_
|
||||
#ifndef SRC_DAWN_NATIVE_D3D11_PHYSICALDEVICED3D11_H_
|
||||
#define SRC_DAWN_NATIVE_D3D11_PHYSICALDEVICED3D11_H_
|
||||
|
||||
#include "dawn/native/d3d/AdapterD3D.h"
|
||||
#include "dawn/native/d3d/PhysicalDeviceD3D.h"
|
||||
|
||||
#include "dawn/native/d3d/d3d_platform.h"
|
||||
#include "dawn/native/d3d11/DeviceInfoD3D11.h"
|
||||
|
@ -24,12 +24,12 @@ namespace dawn::native::d3d11 {
|
|||
|
||||
class Backend;
|
||||
|
||||
class Adapter : public d3d::Adapter {
|
||||
class PhysicalDevice : public d3d::PhysicalDevice {
|
||||
public:
|
||||
Adapter(Backend* backend,
|
||||
ComPtr<IDXGIAdapter3> hardwareAdapter,
|
||||
const TogglesState& adapterToggles);
|
||||
~Adapter() override;
|
||||
PhysicalDevice(Backend* backend,
|
||||
ComPtr<IDXGIAdapter3> hardwareAdapter,
|
||||
const TogglesState& adapterToggles);
|
||||
~PhysicalDevice() override;
|
||||
|
||||
// PhysicalDeviceBase Implementation
|
||||
bool SupportsExternalImages() const override;
|
||||
|
@ -38,7 +38,7 @@ class Adapter : public d3d::Adapter {
|
|||
ResultOrError<ComPtr<ID3D11Device>> CreateD3D11Device();
|
||||
|
||||
private:
|
||||
using Base = d3d::Adapter;
|
||||
using Base = d3d::PhysicalDevice;
|
||||
|
||||
void SetupBackendDeviceToggles(TogglesState* deviceToggles) const override;
|
||||
|
||||
|
@ -60,4 +60,4 @@ class Adapter : public d3d::Adapter {
|
|||
|
||||
} // namespace dawn::native::d3d11
|
||||
|
||||
#endif // SRC_DAWN_NATIVE_D3D11_ADAPTERD3D11_H_
|
||||
#endif // SRC_DAWN_NATIVE_D3D11_PHYSICALDEVICED3D11_H_
|
|
@ -24,10 +24,10 @@
|
|||
#include "dawn/native/TintUtils.h"
|
||||
#include "dawn/native/d3d/D3DCompilationRequest.h"
|
||||
#include "dawn/native/d3d/D3DError.h"
|
||||
#include "dawn/native/d3d11/AdapterD3D11.h"
|
||||
#include "dawn/native/d3d11/BackendD3D11.h"
|
||||
#include "dawn/native/d3d11/BindGroupLayoutD3D11.h"
|
||||
#include "dawn/native/d3d11/DeviceD3D11.h"
|
||||
#include "dawn/native/d3d11/PhysicalDeviceD3D11.h"
|
||||
#include "dawn/native/d3d11/PipelineLayoutD3D11.h"
|
||||
#include "dawn/native/d3d11/PlatformFunctionsD3D11.h"
|
||||
#include "dawn/native/d3d11/UtilsD3D11.h"
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
#include "dawn/native/D3D12Backend.h"
|
||||
#include "dawn/native/Instance.h"
|
||||
#include "dawn/native/d3d/D3DError.h"
|
||||
#include "dawn/native/d3d12/AdapterD3D12.h"
|
||||
#include "dawn/native/d3d12/PhysicalDeviceD3D12.h"
|
||||
#include "dawn/native/d3d12/PlatformFunctionsD3D12.h"
|
||||
#include "dawn/native/d3d12/UtilsD3D12.h"
|
||||
|
||||
|
@ -63,15 +63,16 @@ const PlatformFunctions* Backend::GetFunctions() const {
|
|||
return static_cast<const PlatformFunctions*>(Base::GetFunctions());
|
||||
}
|
||||
|
||||
ResultOrError<Ref<PhysicalDeviceBase>> Backend::CreateAdapterFromIDXGIAdapter(
|
||||
ResultOrError<Ref<PhysicalDeviceBase>> Backend::CreatePhysicalDeviceFromIDXGIAdapter(
|
||||
ComPtr<IDXGIAdapter> dxgiAdapter,
|
||||
const TogglesState& adapterToggles) {
|
||||
ComPtr<IDXGIAdapter3> dxgiAdapter3;
|
||||
DAWN_TRY(CheckHRESULT(dxgiAdapter.As(&dxgiAdapter3), "DXGIAdapter retrieval"));
|
||||
Ref<Adapter> adapter = AcquireRef(new Adapter(this, std::move(dxgiAdapter3), adapterToggles));
|
||||
DAWN_TRY(adapter->Initialize());
|
||||
Ref<PhysicalDevice> physicalDevice =
|
||||
AcquireRef(new PhysicalDevice(this, std::move(dxgiAdapter3), adapterToggles));
|
||||
DAWN_TRY(physicalDevice->Initialize());
|
||||
|
||||
return {std::move(adapter)};
|
||||
return {std::move(physicalDevice)};
|
||||
}
|
||||
|
||||
BackendConnection* Connect(InstanceBase* instance) {
|
||||
|
|
|
@ -35,7 +35,7 @@ class Backend final : public d3d::Backend {
|
|||
const PlatformFunctions* GetFunctions() const;
|
||||
|
||||
protected:
|
||||
ResultOrError<Ref<PhysicalDeviceBase>> CreateAdapterFromIDXGIAdapter(
|
||||
ResultOrError<Ref<PhysicalDeviceBase>> CreatePhysicalDeviceFromIDXGIAdapter(
|
||||
ComPtr<IDXGIAdapter> dxgiAdapter,
|
||||
const TogglesState& adapterToggles) override;
|
||||
|
||||
|
|
|
@ -18,13 +18,13 @@
|
|||
|
||||
#include "dawn/common/GPUInfo.h"
|
||||
#include "dawn/native/d3d/D3DError.h"
|
||||
#include "dawn/native/d3d12/AdapterD3D12.h"
|
||||
#include "dawn/native/d3d12/BackendD3D12.h"
|
||||
#include "dawn/native/d3d12/PhysicalDeviceD3D12.h"
|
||||
#include "dawn/native/d3d12/PlatformFunctionsD3D12.h"
|
||||
|
||||
namespace dawn::native::d3d12 {
|
||||
|
||||
ResultOrError<D3D12DeviceInfo> GatherDeviceInfo(const Adapter& adapter) {
|
||||
ResultOrError<D3D12DeviceInfo> GatherDeviceInfo(const PhysicalDevice& physicalDevice) {
|
||||
D3D12DeviceInfo info = {};
|
||||
|
||||
// Newer builds replace D3D_FEATURE_DATA_ARCHITECTURE with
|
||||
|
@ -32,26 +32,26 @@ ResultOrError<D3D12DeviceInfo> GatherDeviceInfo(const Adapter& adapter) {
|
|||
// for backwards compat.
|
||||
// https://docs.microsoft.com/en-us/windows/desktop/api/d3d12/ne-d3d12-d3d12_feature
|
||||
D3D12_FEATURE_DATA_ARCHITECTURE arch = {};
|
||||
DAWN_TRY(CheckHRESULT(
|
||||
adapter.GetDevice()->CheckFeatureSupport(D3D12_FEATURE_ARCHITECTURE, &arch, sizeof(arch)),
|
||||
"ID3D12Device::CheckFeatureSupport"));
|
||||
DAWN_TRY(CheckHRESULT(physicalDevice.GetDevice()->CheckFeatureSupport(
|
||||
D3D12_FEATURE_ARCHITECTURE, &arch, sizeof(arch)),
|
||||
"ID3D12Device::CheckFeatureSupport"));
|
||||
|
||||
info.isUMA = arch.UMA;
|
||||
|
||||
D3D12_FEATURE_DATA_D3D12_OPTIONS featureOptions = {};
|
||||
DAWN_TRY(CheckHRESULT(adapter.GetDevice()->CheckFeatureSupport(
|
||||
DAWN_TRY(CheckHRESULT(physicalDevice.GetDevice()->CheckFeatureSupport(
|
||||
D3D12_FEATURE_D3D12_OPTIONS, &featureOptions, sizeof(featureOptions)),
|
||||
"ID3D12Device::CheckFeatureSupport"));
|
||||
info.resourceHeapTier = featureOptions.ResourceHeapTier;
|
||||
|
||||
D3D12_FEATURE_DATA_D3D12_OPTIONS2 featureOptions2 = {};
|
||||
if (SUCCEEDED(adapter.GetDevice()->CheckFeatureSupport(
|
||||
if (SUCCEEDED(physicalDevice.GetDevice()->CheckFeatureSupport(
|
||||
D3D12_FEATURE_D3D12_OPTIONS2, &featureOptions2, sizeof(featureOptions2)))) {
|
||||
info.programmableSamplePositionsTier = featureOptions2.ProgrammableSamplePositionsTier;
|
||||
}
|
||||
|
||||
D3D12_FEATURE_DATA_D3D12_OPTIONS3 featureOptions3 = {};
|
||||
if (SUCCEEDED(adapter.GetDevice()->CheckFeatureSupport(
|
||||
if (SUCCEEDED(physicalDevice.GetDevice()->CheckFeatureSupport(
|
||||
D3D12_FEATURE_D3D12_OPTIONS3, &featureOptions3, sizeof(featureOptions3)))) {
|
||||
info.supportsCastingFullyTypedFormat = featureOptions3.CastingFullyTypedFormatSupported;
|
||||
}
|
||||
|
@ -60,7 +60,7 @@ ResultOrError<D3D12DeviceInfo> GatherDeviceInfo(const Adapter& adapter) {
|
|||
// D3D12_FEATURE_D3D12_OPTIONS4 successfully, then we can use cross-API sharing.
|
||||
info.supportsSharedResourceCapabilityTier1 = false;
|
||||
D3D12_FEATURE_DATA_D3D12_OPTIONS4 featureOptions4 = {};
|
||||
if (SUCCEEDED(adapter.GetDevice()->CheckFeatureSupport(
|
||||
if (SUCCEEDED(physicalDevice.GetDevice()->CheckFeatureSupport(
|
||||
D3D12_FEATURE_D3D12_OPTIONS4, &featureOptions4, sizeof(featureOptions4)))) {
|
||||
// Tier 1 support additionally enables the NV12 format. Since only the NV12 format
|
||||
// is used by Dawn, check for Tier 1.
|
||||
|
@ -75,13 +75,13 @@ ResultOrError<D3D12DeviceInfo> GatherDeviceInfo(const Adapter& adapter) {
|
|||
// the render pass API.
|
||||
info.supportsRenderPass = false;
|
||||
D3D12_FEATURE_DATA_D3D12_OPTIONS5 featureOptions5 = {};
|
||||
if (SUCCEEDED(adapter.GetDevice()->CheckFeatureSupport(
|
||||
if (SUCCEEDED(physicalDevice.GetDevice()->CheckFeatureSupport(
|
||||
D3D12_FEATURE_D3D12_OPTIONS5, &featureOptions5, sizeof(featureOptions5)))) {
|
||||
// Performance regressions been observed when using a render pass on Intel graphics
|
||||
// with RENDER_PASS_TIER_1 available, so fall back to a software emulated render
|
||||
// pass on these platforms.
|
||||
if (featureOptions5.RenderPassesTier < D3D12_RENDER_PASS_TIER_1 ||
|
||||
!gpu_info::IsIntel(adapter.GetVendorId())) {
|
||||
!gpu_info::IsIntel(physicalDevice.GetVendorId())) {
|
||||
info.supportsRenderPass = true;
|
||||
}
|
||||
}
|
||||
|
@ -91,7 +91,7 @@ ResultOrError<D3D12DeviceInfo> GatherDeviceInfo(const Adapter& adapter) {
|
|||
{D3D_SHADER_MODEL_6_1}, {D3D_SHADER_MODEL_6_0}, {D3D_SHADER_MODEL_5_1}};
|
||||
uint32_t driverShaderModel = 0;
|
||||
for (D3D12_FEATURE_DATA_SHADER_MODEL shaderModel : knownShaderModels) {
|
||||
if (SUCCEEDED(adapter.GetDevice()->CheckFeatureSupport(
|
||||
if (SUCCEEDED(physicalDevice.GetDevice()->CheckFeatureSupport(
|
||||
D3D12_FEATURE_SHADER_MODEL, &shaderModel, sizeof(shaderModel)))) {
|
||||
driverShaderModel = shaderModel.HighestShaderModel;
|
||||
break;
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
|
||||
namespace dawn::native::d3d12 {
|
||||
|
||||
class Adapter;
|
||||
class PhysicalDevice;
|
||||
|
||||
struct D3D12DeviceInfo {
|
||||
bool isUMA;
|
||||
|
@ -38,7 +38,7 @@ struct D3D12DeviceInfo {
|
|||
uint32_t programmableSamplePositionsTier;
|
||||
};
|
||||
|
||||
ResultOrError<D3D12DeviceInfo> GatherDeviceInfo(const Adapter& adapter);
|
||||
ResultOrError<D3D12DeviceInfo> GatherDeviceInfo(const PhysicalDevice& physicalDevice);
|
||||
} // namespace dawn::native::d3d12
|
||||
|
||||
#endif // SRC_DAWN_NATIVE_D3D12_D3D12INFO_H_
|
||||
|
|
|
@ -24,7 +24,6 @@
|
|||
#include "dawn/native/DynamicUploader.h"
|
||||
#include "dawn/native/Instance.h"
|
||||
#include "dawn/native/d3d/D3DError.h"
|
||||
#include "dawn/native/d3d12/AdapterD3D12.h"
|
||||
#include "dawn/native/d3d12/BackendD3D12.h"
|
||||
#include "dawn/native/d3d12/BindGroupD3D12.h"
|
||||
#include "dawn/native/d3d12/BindGroupLayoutD3D12.h"
|
||||
|
@ -32,6 +31,7 @@
|
|||
#include "dawn/native/d3d12/CommandBufferD3D12.h"
|
||||
#include "dawn/native/d3d12/ComputePipelineD3D12.h"
|
||||
#include "dawn/native/d3d12/ExternalImageDXGIImplD3D12.h"
|
||||
#include "dawn/native/d3d12/PhysicalDeviceD3D12.h"
|
||||
#include "dawn/native/d3d12/PipelineLayoutD3D12.h"
|
||||
#include "dawn/native/d3d12/PlatformFunctionsD3D12.h"
|
||||
#include "dawn/native/d3d12/QuerySetD3D12.h"
|
||||
|
@ -61,7 +61,7 @@ static constexpr uint64_t kZeroBufferSize = 1024 * 1024 * 4; // 4 Mb
|
|||
static constexpr uint64_t kMaxDebugMessagesToPrint = 5;
|
||||
|
||||
// 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));
|
||||
|
@ -70,7 +70,7 @@ ResultOrError<Ref<Device>> Device::Create(Adapter* adapter,
|
|||
}
|
||||
|
||||
MaybeError Device::Initialize(const DeviceDescriptor* descriptor) {
|
||||
mD3d12Device = ToBackend(GetAdapter())->GetDevice();
|
||||
mD3d12Device = ToBackend(GetPhysicalDevice())->GetDevice();
|
||||
|
||||
ASSERT(mD3d12Device != nullptr);
|
||||
|
||||
|
@ -233,17 +233,17 @@ ComPtr<ID3D12CommandSignature> Device::GetDrawIndexedIndirectSignature() const {
|
|||
// Ensure DXC if use_dxc toggles are set and validated.
|
||||
MaybeError Device::EnsureDXCIfRequired() {
|
||||
if (IsToggleEnabled(Toggle::UseDXC)) {
|
||||
ASSERT(ToBackend(GetAdapter())->GetBackend()->IsDXCAvailable());
|
||||
DAWN_TRY(ToBackend(GetAdapter())->GetBackend()->EnsureDxcCompiler());
|
||||
DAWN_TRY(ToBackend(GetAdapter())->GetBackend()->EnsureDxcLibrary());
|
||||
DAWN_TRY(ToBackend(GetAdapter())->GetBackend()->EnsureDxcValidator());
|
||||
ASSERT(ToBackend(GetPhysicalDevice())->GetBackend()->IsDXCAvailable());
|
||||
DAWN_TRY(ToBackend(GetPhysicalDevice())->GetBackend()->EnsureDxcCompiler());
|
||||
DAWN_TRY(ToBackend(GetPhysicalDevice())->GetBackend()->EnsureDxcLibrary());
|
||||
DAWN_TRY(ToBackend(GetPhysicalDevice())->GetBackend()->EnsureDxcValidator());
|
||||
}
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
const PlatformFunctions* Device::GetFunctions() const {
|
||||
return ToBackend(GetAdapter())->GetBackend()->GetFunctions();
|
||||
return ToBackend(GetPhysicalDevice())->GetBackend()->GetFunctions();
|
||||
}
|
||||
|
||||
CommandAllocatorManager* Device::GetCommandAllocatorManager() const {
|
||||
|
@ -608,7 +608,7 @@ Ref<TextureBase> Device::CreateD3D12ExternalTexture(const TextureDescriptor* des
|
|||
}
|
||||
|
||||
const D3D12DeviceInfo& Device::GetDeviceInfo() const {
|
||||
return ToBackend(GetAdapter())->GetDeviceInfo();
|
||||
return ToBackend(GetPhysicalDevice())->GetDeviceInfo();
|
||||
}
|
||||
|
||||
MaybeError Device::WaitForIdleForDestruction() {
|
||||
|
@ -662,7 +662,7 @@ void AppendDebugLayerMessagesToError(ID3D12InfoQueue* infoQueue,
|
|||
}
|
||||
|
||||
MaybeError Device::CheckDebugLayerAndGenerateErrors() {
|
||||
if (!GetAdapter()->GetInstance()->IsBackendValidationEnabled()) {
|
||||
if (!GetPhysicalDevice()->GetInstance()->IsBackendValidationEnabled()) {
|
||||
return {};
|
||||
}
|
||||
|
||||
|
@ -686,7 +686,7 @@ MaybeError Device::CheckDebugLayerAndGenerateErrors() {
|
|||
}
|
||||
|
||||
void Device::AppendDebugLayerMessages(ErrorData* error) {
|
||||
if (!GetAdapter()->GetInstance()->IsBackendValidationEnabled()) {
|
||||
if (!GetPhysicalDevice()->GetInstance()->IsBackendValidationEnabled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -49,7 +49,7 @@ class StagingDescriptorAllocator;
|
|||
// Definition of backend types
|
||||
class Device final : public d3d::Device {
|
||||
public:
|
||||
static ResultOrError<Ref<Device>> Create(Adapter* adapter,
|
||||
static ResultOrError<Ref<Device>> Create(AdapterBase* adapter,
|
||||
const DeviceDescriptor* descriptor,
|
||||
const TogglesState& deviceToggles);
|
||||
~Device() override;
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
|
||||
namespace dawn::native::d3d12 {
|
||||
|
||||
class Adapter;
|
||||
class BindGroup;
|
||||
class BindGroupLayout;
|
||||
class Buffer;
|
||||
|
@ -27,6 +26,7 @@ class CommandBuffer;
|
|||
class ComputePipeline;
|
||||
class Device;
|
||||
class Heap;
|
||||
class PhysicalDevice;
|
||||
class PipelineCache;
|
||||
class PipelineLayout;
|
||||
class QuerySet;
|
||||
|
@ -39,13 +39,13 @@ class Texture;
|
|||
class TextureView;
|
||||
|
||||
struct D3D12BackendTraits {
|
||||
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 PipelineCacheType = PipelineCache;
|
||||
using PipelineLayoutType = PipelineLayout;
|
||||
using QuerySetType = QuerySet;
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#include "dawn/native/d3d12/AdapterD3D12.h"
|
||||
#include "dawn/native/d3d12/PhysicalDeviceD3D12.h"
|
||||
|
||||
#include <string>
|
||||
#include <utility>
|
||||
|
@ -29,33 +29,33 @@
|
|||
|
||||
namespace dawn::native::d3d12 {
|
||||
|
||||
Adapter::Adapter(Backend* backend,
|
||||
ComPtr<IDXGIAdapter3> hardwareAdapter,
|
||||
const TogglesState& adapterToggles)
|
||||
PhysicalDevice::PhysicalDevice(Backend* backend,
|
||||
ComPtr<IDXGIAdapter3> hardwareAdapter,
|
||||
const TogglesState& adapterToggles)
|
||||
: Base(backend, std::move(hardwareAdapter), wgpu::BackendType::D3D12, adapterToggles) {}
|
||||
|
||||
Adapter::~Adapter() {
|
||||
PhysicalDevice::~PhysicalDevice() {
|
||||
CleanUpDebugLayerFilters();
|
||||
}
|
||||
|
||||
bool Adapter::SupportsExternalImages() const {
|
||||
bool PhysicalDevice::SupportsExternalImages() const {
|
||||
// Via dawn::native::d3d12::ExternalImageDXGI::Create
|
||||
return true;
|
||||
}
|
||||
|
||||
const D3D12DeviceInfo& Adapter::GetDeviceInfo() const {
|
||||
const D3D12DeviceInfo& PhysicalDevice::GetDeviceInfo() const {
|
||||
return mDeviceInfo;
|
||||
}
|
||||
|
||||
Backend* Adapter::GetBackend() const {
|
||||
Backend* PhysicalDevice::GetBackend() const {
|
||||
return static_cast<Backend*>(Base::GetBackend());
|
||||
}
|
||||
|
||||
ComPtr<ID3D12Device> Adapter::GetDevice() const {
|
||||
ComPtr<ID3D12Device> PhysicalDevice::GetDevice() const {
|
||||
return mD3d12Device;
|
||||
}
|
||||
|
||||
MaybeError Adapter::InitializeImpl() {
|
||||
MaybeError PhysicalDevice::InitializeImpl() {
|
||||
DAWN_TRY(Base::InitializeImpl());
|
||||
// D3D12 cannot check for feature support without a device.
|
||||
// Create the device to populate the adapter properties then reuse it when needed for actual
|
||||
|
@ -93,7 +93,7 @@ MaybeError Adapter::InitializeImpl() {
|
|||
return {};
|
||||
}
|
||||
|
||||
bool Adapter::AreTimestampQueriesSupported() const {
|
||||
bool PhysicalDevice::AreTimestampQueriesSupported() const {
|
||||
D3D12_COMMAND_QUEUE_DESC queueDesc = {};
|
||||
queueDesc.Flags = D3D12_COMMAND_QUEUE_FLAG_NONE;
|
||||
queueDesc.Type = D3D12_COMMAND_LIST_TYPE_DIRECT;
|
||||
|
@ -114,7 +114,7 @@ bool Adapter::AreTimestampQueriesSupported() const {
|
|||
return true;
|
||||
}
|
||||
|
||||
void Adapter::InitializeSupportedFeaturesImpl() {
|
||||
void PhysicalDevice::InitializeSupportedFeaturesImpl() {
|
||||
EnableFeature(Feature::TextureCompressionBC);
|
||||
EnableFeature(Feature::MultiPlanarFormats);
|
||||
EnableFeature(Feature::Depth32FloatStencil8);
|
||||
|
@ -149,7 +149,7 @@ void Adapter::InitializeSupportedFeaturesImpl() {
|
|||
}
|
||||
}
|
||||
|
||||
MaybeError Adapter::InitializeSupportedLimitsImpl(CombinedLimits* limits) {
|
||||
MaybeError PhysicalDevice::InitializeSupportedLimitsImpl(CombinedLimits* limits) {
|
||||
D3D12_FEATURE_DATA_D3D12_OPTIONS featureData = {};
|
||||
|
||||
DAWN_TRY(CheckHRESULT(mD3d12Device->CheckFeatureSupport(D3D12_FEATURE_D3D12_OPTIONS,
|
||||
|
@ -320,8 +320,9 @@ MaybeError Adapter::InitializeSupportedLimitsImpl(CombinedLimits* limits) {
|
|||
return {};
|
||||
}
|
||||
|
||||
MaybeError Adapter::ValidateFeatureSupportedWithTogglesImpl(wgpu::FeatureName feature,
|
||||
const TogglesState& toggles) const {
|
||||
MaybeError PhysicalDevice::ValidateFeatureSupportedWithTogglesImpl(
|
||||
wgpu::FeatureName feature,
|
||||
const TogglesState& toggles) const {
|
||||
// shader-f16 feature and chromium-experimental-dp4a feature require DXC 1.4 or higher for
|
||||
// D3D12. Note that DXC version is checked in InitializeSupportedFeaturesImpl.
|
||||
if (feature == wgpu::FeatureName::ShaderF16 ||
|
||||
|
@ -332,7 +333,7 @@ MaybeError Adapter::ValidateFeatureSupportedWithTogglesImpl(wgpu::FeatureName fe
|
|||
return {};
|
||||
}
|
||||
|
||||
MaybeError Adapter::InitializeDebugLayerFilters() {
|
||||
MaybeError PhysicalDevice::InitializeDebugLayerFilters() {
|
||||
if (!GetInstance()->IsBackendValidationEnabled()) {
|
||||
return {};
|
||||
}
|
||||
|
@ -423,7 +424,7 @@ MaybeError Adapter::InitializeDebugLayerFilters() {
|
|||
return {};
|
||||
}
|
||||
|
||||
void Adapter::CleanUpDebugLayerFilters() {
|
||||
void PhysicalDevice::CleanUpDebugLayerFilters() {
|
||||
if (!GetInstance()->IsBackendValidationEnabled()) {
|
||||
return;
|
||||
}
|
||||
|
@ -443,7 +444,7 @@ void Adapter::CleanUpDebugLayerFilters() {
|
|||
infoQueue->PopStorageFilter();
|
||||
}
|
||||
|
||||
void Adapter::SetupBackendDeviceToggles(TogglesState* deviceToggles) const {
|
||||
void PhysicalDevice::SetupBackendDeviceToggles(TogglesState* deviceToggles) const {
|
||||
const bool useResourceHeapTier2 = (GetDeviceInfo().resourceHeapTier >= 2);
|
||||
deviceToggles->Default(Toggle::UseD3D12ResourceHeapTier2, useResourceHeapTier2);
|
||||
deviceToggles->Default(Toggle::UseD3D12RenderPass, GetDeviceInfo().supportsRenderPass);
|
||||
|
@ -578,8 +579,8 @@ void Adapter::SetupBackendDeviceToggles(TogglesState* deviceToggles) const {
|
|||
}
|
||||
}
|
||||
|
||||
ResultOrError<Ref<DeviceBase>> Adapter::CreateDeviceImpl(const DeviceDescriptor* descriptor,
|
||||
const TogglesState& deviceToggles) {
|
||||
ResultOrError<Ref<DeviceBase>> PhysicalDevice::CreateDeviceImpl(const DeviceDescriptor* descriptor,
|
||||
const TogglesState& deviceToggles) {
|
||||
return Device::Create(this, descriptor, deviceToggles);
|
||||
}
|
||||
|
||||
|
@ -587,7 +588,7 @@ ResultOrError<Ref<DeviceBase>> Adapter::CreateDeviceImpl(const DeviceDescriptor*
|
|||
// current ID3D12Device have not been destroyed, a non-zero value will be returned upon Reset()
|
||||
// and the subequent call to CreateDevice will return a handle the existing device instead of
|
||||
// creating a new one.
|
||||
MaybeError Adapter::ResetInternalDeviceForTestingImpl() {
|
||||
MaybeError PhysicalDevice::ResetInternalDeviceForTestingImpl() {
|
||||
[[maybe_unused]] auto refCount = mD3d12Device.Reset();
|
||||
ASSERT(refCount == 0);
|
||||
DAWN_TRY(Initialize());
|
|
@ -12,12 +12,12 @@
|
|||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#ifndef SRC_DAWN_NATIVE_D3D12_ADAPTERD3D12_H_
|
||||
#define SRC_DAWN_NATIVE_D3D12_ADAPTERD3D12_H_
|
||||
#ifndef SRC_DAWN_NATIVE_D3D12_PHYSICALDEVICED3D12_H_
|
||||
#define SRC_DAWN_NATIVE_D3D12_PHYSICALDEVICED3D12_H_
|
||||
|
||||
#include "dawn/native/PhysicalDevice.h"
|
||||
|
||||
#include "dawn/native/d3d/AdapterD3D.h"
|
||||
#include "dawn/native/d3d/PhysicalDeviceD3D.h"
|
||||
#include "dawn/native/d3d12/D3D12Info.h"
|
||||
#include "dawn/native/d3d12/d3d12_platform.h"
|
||||
|
||||
|
@ -25,12 +25,12 @@ namespace dawn::native::d3d12 {
|
|||
|
||||
class Backend;
|
||||
|
||||
class Adapter : public d3d::Adapter {
|
||||
class PhysicalDevice : public d3d::PhysicalDevice {
|
||||
public:
|
||||
Adapter(Backend* backend,
|
||||
ComPtr<IDXGIAdapter3> hardwareAdapter,
|
||||
const TogglesState& adapterToggles);
|
||||
~Adapter() override;
|
||||
PhysicalDevice(Backend* backend,
|
||||
ComPtr<IDXGIAdapter3> hardwareAdapter,
|
||||
const TogglesState& adapterToggles);
|
||||
~PhysicalDevice() override;
|
||||
|
||||
// PhysicalDeviceBase Implementation
|
||||
bool SupportsExternalImages() const override;
|
||||
|
@ -40,7 +40,7 @@ class Adapter : public d3d::Adapter {
|
|||
ComPtr<ID3D12Device> GetDevice() const;
|
||||
|
||||
private:
|
||||
using Base = d3d::Adapter;
|
||||
using Base = d3d::PhysicalDevice;
|
||||
|
||||
void SetupBackendDeviceToggles(TogglesState* deviceToggles) const override;
|
||||
|
||||
|
@ -68,4 +68,4 @@ class Adapter : public d3d::Adapter {
|
|||
|
||||
} // namespace dawn::native::d3d12
|
||||
|
||||
#endif // SRC_DAWN_NATIVE_D3D12_ADAPTERD3D12_H_
|
||||
#endif // SRC_DAWN_NATIVE_D3D12_PHYSICALDEVICED3D12_H_
|
|
@ -18,10 +18,10 @@
|
|||
#include <vector>
|
||||
|
||||
#include "dawn/native/d3d/D3DError.h"
|
||||
#include "dawn/native/d3d12/AdapterD3D12.h"
|
||||
#include "dawn/native/d3d12/DeviceD3D12.h"
|
||||
#include "dawn/native/d3d12/Forward.h"
|
||||
#include "dawn/native/d3d12/HeapD3D12.h"
|
||||
#include "dawn/native/d3d12/PhysicalDeviceD3D12.h"
|
||||
|
||||
namespace dawn::native::d3d12 {
|
||||
|
||||
|
|
|
@ -24,10 +24,10 @@
|
|||
#include "dawn/native/TintUtils.h"
|
||||
#include "dawn/native/d3d/D3DCompilationRequest.h"
|
||||
#include "dawn/native/d3d/D3DError.h"
|
||||
#include "dawn/native/d3d12/AdapterD3D12.h"
|
||||
#include "dawn/native/d3d12/BackendD3D12.h"
|
||||
#include "dawn/native/d3d12/BindGroupLayoutD3D12.h"
|
||||
#include "dawn/native/d3d12/DeviceD3D12.h"
|
||||
#include "dawn/native/d3d12/PhysicalDeviceD3D12.h"
|
||||
#include "dawn/native/d3d12/PipelineLayoutD3D12.h"
|
||||
#include "dawn/native/d3d12/PlatformFunctionsD3D12.h"
|
||||
#include "dawn/native/d3d12/UtilsD3D12.h"
|
||||
|
|
|
@ -39,13 +39,13 @@ class Texture;
|
|||
class TextureView;
|
||||
|
||||
struct VulkanBackendTraits {
|
||||
using AdapterType = Adapter;
|
||||
using BindGroupType = BindGroup;
|
||||
using BindGroupLayoutType = BindGroupLayout;
|
||||
using BufferType = Buffer;
|
||||
using CommandBufferType = CommandBuffer;
|
||||
using ComputePipelineType = ComputePipeline;
|
||||
using DeviceType = Device;
|
||||
using PhysicalDeviceType = Adapter;
|
||||
using PipelineCacheType = PipelineCache;
|
||||
using PipelineLayoutType = PipelineLayout;
|
||||
using QuerySetType = QuerySet;
|
||||
|
|
Loading…
Reference in New Issue