mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-16 00:17:03 +00:00
D3D12: Implement the backend connection and adapter.
BUG=dawn:29 Change-Id: Id4497b4a91ba58b79d1cd976a52df5a0fa5d60a8 Reviewed-on: https://dawn-review.googlesource.com/c/3844 Commit-Queue: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Kai Ninomiya <kainino@chromium.org>
This commit is contained in:
committed by
Commit Bot service account
parent
45da8c0115
commit
d77fd5f889
@@ -30,8 +30,18 @@ namespace utils {
|
||||
}
|
||||
|
||||
dawnDevice CreateDevice() override {
|
||||
mBackendDevice = dawn_native::d3d12::CreateDevice();
|
||||
return mBackendDevice;
|
||||
// Make an instance and find a D3D12 adapter
|
||||
mInstance = std::make_unique<dawn_native::Instance>();
|
||||
mInstance->DiscoverDefaultAdapters();
|
||||
|
||||
std::vector<dawn_native::Adapter> adapters = mInstance->GetAdapters();
|
||||
for (dawn_native::Adapter adapter : adapters) {
|
||||
if (adapter.GetBackendType() == dawn_native::BackendType::D3D12) {
|
||||
mBackendDevice = adapter.CreateDevice();
|
||||
return mBackendDevice;
|
||||
}
|
||||
}
|
||||
UNREACHABLE();
|
||||
}
|
||||
|
||||
uint64_t GetSwapChainImplementation() override {
|
||||
@@ -49,6 +59,7 @@ namespace utils {
|
||||
}
|
||||
|
||||
private:
|
||||
std::unique_ptr<dawn_native::Instance> mInstance;
|
||||
dawnDevice mBackendDevice = nullptr;
|
||||
dawnSwapChainImplementation mSwapchainImpl = {};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user