d3d12: Wrap D3D11On12CreateDevice to avoid linking against D3D12 dll

This commit is contained in:
Vincent Lejeune 2015-09-28 21:46:58 +02:00
parent c7b7d1f71f
commit 442abcc6f1
2 changed files with 9 additions and 2 deletions

View file

@ -7,12 +7,15 @@
#include <thread>
#include <chrono>
#include "d3dx12.h"
#include <d3d11on12.h>
PFN_D3D12_CREATE_DEVICE wrapD3D12CreateDevice;
PFN_D3D12_GET_DEBUG_INTERFACE wrapD3D12GetDebugInterface;
PFN_D3D12_SERIALIZE_ROOT_SIGNATURE wrapD3D12SerializeRootSignature;
PFN_D3D11ON12_CREATE_DEVICE wrapD3D11On12CreateDevice;
static HMODULE D3D12Module;
static HMODULE D3D11Module;
static void loadD3D12FunctionPointers()
{
@ -20,11 +23,14 @@ static void loadD3D12FunctionPointers()
wrapD3D12CreateDevice = (PFN_D3D12_CREATE_DEVICE)GetProcAddress(D3D12Module, "D3D12CreateDevice");
wrapD3D12GetDebugInterface = (PFN_D3D12_GET_DEBUG_INTERFACE)GetProcAddress(D3D12Module, "D3D12GetDebugInterface");
wrapD3D12SerializeRootSignature = (PFN_D3D12_SERIALIZE_ROOT_SIGNATURE)GetProcAddress(D3D12Module, "D3D12SerializeRootSignature");
D3D11Module = LoadLibrary(L"d3d11.dll");
wrapD3D11On12CreateDevice = (PFN_D3D11ON12_CREATE_DEVICE)GetProcAddress(D3D11Module, "D3D11On12CreateDevice");
}
static void unloadD3D12FunctionPointers()
{
FreeLibrary(D3D12Module);
FreeLibrary(D3D11Module);
}
GetGSFrameCb2 GetGSFrame = nullptr;

View file

@ -22,11 +22,12 @@ ComPtr<ID2D1SolidColorBrush> m_textBrush;
#pragma comment (lib, "d2d1.lib")
#pragma comment (lib, "dwrite.lib")
#pragma comment (lib, "d3d11.lib")
extern PFN_D3D11ON12_CREATE_DEVICE wrapD3D11On12CreateDevice;
void D3D12GSRender::InitD2DStructures()
{
D3D11On12CreateDevice(
wrapD3D11On12CreateDevice(
m_device.Get(),
D3D11_CREATE_DEVICE_BGRA_SUPPORT,
nullptr,