[D3D12] Load D3D dynamically
This commit is contained in:
@@ -70,10 +70,47 @@ class D3D12Provider : public GraphicsProvider {
|
||||
return programmable_sample_positions_tier_;
|
||||
}
|
||||
|
||||
// Proxies for Direct3D 12 functions since they are loaded dynamically.
|
||||
inline HRESULT SerializeRootSignature(const D3D12_ROOT_SIGNATURE_DESC* desc,
|
||||
D3D_ROOT_SIGNATURE_VERSION version,
|
||||
ID3DBlob** blob_out,
|
||||
ID3DBlob** error_blob_out) const {
|
||||
return pfn_d3d12_serialize_root_signature_(desc, version, blob_out,
|
||||
error_blob_out);
|
||||
}
|
||||
inline HRESULT Disassemble(const void* src_data, size_t src_data_size,
|
||||
UINT flags, const char* comments,
|
||||
ID3DBlob** disassembly_out) const {
|
||||
return pfn_d3d_disassemble_(src_data, src_data_size, flags, comments,
|
||||
disassembly_out);
|
||||
}
|
||||
|
||||
private:
|
||||
explicit D3D12Provider(Window* main_window);
|
||||
|
||||
bool Initialize();
|
||||
enum InitializationResult : uint32_t {
|
||||
kSucceeded,
|
||||
kDeviceInitializationFailed,
|
||||
kLibraryLoadFailed,
|
||||
};
|
||||
|
||||
InitializationResult Initialize();
|
||||
|
||||
HMODULE library_dxgi_ = nullptr;
|
||||
HMODULE library_d3d12_ = nullptr;
|
||||
HMODULE library_d3dcompiler_ = nullptr;
|
||||
|
||||
typedef HRESULT(WINAPI* PFNCreateDXGIFactory2)(UINT Flags, REFIID riid,
|
||||
_COM_Outptr_ void** ppFactory);
|
||||
typedef HRESULT(WINAPI* PFNDXGIGetDebugInterface1)(
|
||||
UINT Flags, REFIID riid, _COM_Outptr_ void** pDebug);
|
||||
|
||||
PFNCreateDXGIFactory2 pfn_create_dxgi_factory2_;
|
||||
PFNDXGIGetDebugInterface1 pfn_dxgi_get_debug_interface1_;
|
||||
PFN_D3D12_GET_DEBUG_INTERFACE pfn_d3d12_get_debug_interface_;
|
||||
PFN_D3D12_CREATE_DEVICE pfn_d3d12_create_device_;
|
||||
PFN_D3D12_SERIALIZE_ROOT_SIGNATURE pfn_d3d12_serialize_root_signature_;
|
||||
pD3DDisassemble pfn_d3d_disassemble_;
|
||||
|
||||
IDXGIFactory2* dxgi_factory_ = nullptr;
|
||||
IDXGraphicsAnalysis* graphics_analysis_ = nullptr;
|
||||
|
||||
Reference in New Issue
Block a user