mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-14 07:36:15 +00:00
Simplify BackendBinding following adapters.
It doesn't need to care about device creation anymore, except for the GLFW window hints and creating a GL context to discover the adapter. Also remove the non-adapter GetPCIInfo. BUG=dawn:29 Change-Id: I9bc8232536a55d2f973463ae0f2e0548dfc35456 Reviewed-on: https://dawn-review.googlesource.com/c/4381 Commit-Queue: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Austin Eng <enga@chromium.org>
This commit is contained in:
committed by
Commit Bot service account
parent
5987c4e839
commit
bb5696bcd3
@@ -26,25 +26,9 @@ namespace utils {
|
||||
|
||||
class VulkanBinding : public BackendBinding {
|
||||
public:
|
||||
void SetupGLFWWindowHints() override {
|
||||
glfwWindowHint(GLFW_CLIENT_API, GLFW_NO_API);
|
||||
VulkanBinding(GLFWwindow* window, dawnDevice device) : BackendBinding(window, device) {
|
||||
}
|
||||
dawnDevice CreateDevice() override {
|
||||
// Make an instance and find a Vulkan 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::Vulkan) {
|
||||
mDevice = adapter.CreateDevice();
|
||||
return mDevice;
|
||||
}
|
||||
}
|
||||
|
||||
UNREACHABLE();
|
||||
return {};
|
||||
}
|
||||
uint64_t GetSwapChainImplementation() override {
|
||||
if (mSwapchainImpl.userData == nullptr) {
|
||||
VkSurfaceKHR surface = VK_NULL_HANDLE;
|
||||
@@ -63,13 +47,11 @@ namespace utils {
|
||||
}
|
||||
|
||||
private:
|
||||
std::unique_ptr<dawn_native::Instance> mInstance;
|
||||
dawnDevice mDevice = nullptr;
|
||||
dawnSwapChainImplementation mSwapchainImpl = {};
|
||||
};
|
||||
|
||||
BackendBinding* CreateVulkanBinding() {
|
||||
return new VulkanBinding;
|
||||
BackendBinding* CreateVulkanBinding(GLFWwindow* window, dawnDevice device) {
|
||||
return new VulkanBinding(window, device);
|
||||
}
|
||||
|
||||
} // namespace utils
|
||||
|
||||
Reference in New Issue
Block a user