From 919d48fda487b42828fbe23eadf59ea5bb806ae2 Mon Sep 17 00:00:00 2001 From: Peng Huang Date: Fri, 19 May 2023 21:41:33 +0000 Subject: [PATCH] d3d11: Add GetD3D11Device() for querying ID3D11Device from WGPUDevice Chrome needs to get a ID3D11Device for DComp Bug: dawn:1705 Change-Id: Ia6a586a38f381b7fddcbc94fe41a7011af59b333 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/133780 Kokoro: Kokoro Reviewed-by: Austin Eng Commit-Queue: Peng Huang --- include/dawn/native/D3D11Backend.h | 4 +++- src/dawn/native/d3d11/D3D11Backend.cpp | 6 ++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/include/dawn/native/D3D11Backend.h b/include/dawn/native/D3D11Backend.h index c2a03d946a..b090071799 100644 --- a/include/dawn/native/D3D11Backend.h +++ b/include/dawn/native/D3D11Backend.h @@ -15,7 +15,7 @@ #ifndef INCLUDE_DAWN_NATIVE_D3D11BACKEND_H_ #define INCLUDE_DAWN_NATIVE_D3D11BACKEND_H_ -#include +#include #include #include @@ -30,6 +30,8 @@ struct DAWN_NATIVE_EXPORT AdapterDiscoveryOptions : public d3d::AdapterDiscovery explicit AdapterDiscoveryOptions(Microsoft::WRL::ComPtr adapter); }; +DAWN_NATIVE_EXPORT Microsoft::WRL::ComPtr GetD3D11Device(WGPUDevice device); + } // namespace dawn::native::d3d11 #endif // INCLUDE_DAWN_NATIVE_D3D11BACKEND_H_ diff --git a/src/dawn/native/d3d11/D3D11Backend.cpp b/src/dawn/native/d3d11/D3D11Backend.cpp index e166e6a2f2..f4d4c0811e 100644 --- a/src/dawn/native/d3d11/D3D11Backend.cpp +++ b/src/dawn/native/d3d11/D3D11Backend.cpp @@ -20,6 +20,8 @@ #include #include "dawn/native/d3d/d3d_platform.h" +#include "dawn/native/d3d11/DeviceD3D11.h" +#include "dawn/native/d3d11/Forward.h" namespace dawn::native::d3d11 { @@ -28,4 +30,8 @@ AdapterDiscoveryOptions::AdapterDiscoveryOptions() : AdapterDiscoveryOptions(nul AdapterDiscoveryOptions::AdapterDiscoveryOptions(ComPtr adapter) : d3d::AdapterDiscoveryOptions(WGPUBackendType_D3D11, std::move(adapter)) {} +Microsoft::WRL::ComPtr GetD3D11Device(WGPUDevice device) { + return ToBackend(FromAPI(device))->GetD3D11Device(); +} + } // namespace dawn::native::d3d11