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 <noreply+kokoro@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Peng Huang <penghuang@chromium.org>
This commit is contained in:
Peng Huang 2023-05-19 21:41:33 +00:00 committed by Dawn LUCI CQ
parent ba073b7e09
commit 919d48fda4
2 changed files with 9 additions and 1 deletions

View File

@ -15,7 +15,7 @@
#ifndef INCLUDE_DAWN_NATIVE_D3D11BACKEND_H_ #ifndef INCLUDE_DAWN_NATIVE_D3D11BACKEND_H_
#define INCLUDE_DAWN_NATIVE_D3D11BACKEND_H_ #define INCLUDE_DAWN_NATIVE_D3D11BACKEND_H_
#include <dxgi1_4.h> #include <d3d11_1.h>
#include <windows.h> #include <windows.h>
#include <wrl/client.h> #include <wrl/client.h>
@ -30,6 +30,8 @@ struct DAWN_NATIVE_EXPORT AdapterDiscoveryOptions : public d3d::AdapterDiscovery
explicit AdapterDiscoveryOptions(Microsoft::WRL::ComPtr<IDXGIAdapter> adapter); explicit AdapterDiscoveryOptions(Microsoft::WRL::ComPtr<IDXGIAdapter> adapter);
}; };
DAWN_NATIVE_EXPORT Microsoft::WRL::ComPtr<ID3D11Device> GetD3D11Device(WGPUDevice device);
} // namespace dawn::native::d3d11 } // namespace dawn::native::d3d11
#endif // INCLUDE_DAWN_NATIVE_D3D11BACKEND_H_ #endif // INCLUDE_DAWN_NATIVE_D3D11BACKEND_H_

View File

@ -20,6 +20,8 @@
#include <utility> #include <utility>
#include "dawn/native/d3d/d3d_platform.h" #include "dawn/native/d3d/d3d_platform.h"
#include "dawn/native/d3d11/DeviceD3D11.h"
#include "dawn/native/d3d11/Forward.h"
namespace dawn::native::d3d11 { namespace dawn::native::d3d11 {
@ -28,4 +30,8 @@ AdapterDiscoveryOptions::AdapterDiscoveryOptions() : AdapterDiscoveryOptions(nul
AdapterDiscoveryOptions::AdapterDiscoveryOptions(ComPtr<IDXGIAdapter> adapter) AdapterDiscoveryOptions::AdapterDiscoveryOptions(ComPtr<IDXGIAdapter> adapter)
: d3d::AdapterDiscoveryOptions(WGPUBackendType_D3D11, std::move(adapter)) {} : d3d::AdapterDiscoveryOptions(WGPUBackendType_D3D11, std::move(adapter)) {}
Microsoft::WRL::ComPtr<ID3D11Device> GetD3D11Device(WGPUDevice device) {
return ToBackend(FromAPI(device))->GetD3D11Device();
}
} // namespace dawn::native::d3d11 } // namespace dawn::native::d3d11