mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-07 07:21:25 +12:00
d3d12: Load dll at runtime
This commit is contained in:
parent
006d989304
commit
f55bb7165c
3 changed files with 26 additions and 7 deletions
|
@ -7,6 +7,7 @@
|
||||||
#include "Emu/Memory/vm.h"
|
#include "Emu/Memory/vm.h"
|
||||||
#include "Emu/RSX/GCM.h"
|
#include "Emu/RSX/GCM.h"
|
||||||
|
|
||||||
|
#pragma comment (lib, "dxgi.lib")
|
||||||
|
|
||||||
#define SAFE_RELEASE(x) if (x) x->Release();
|
#define SAFE_RELEASE(x) if (x) x->Release();
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,25 @@
|
||||||
#include <thread>
|
#include <thread>
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
|
|
||||||
|
PFN_D3D12_CREATE_DEVICE wrapD3D12CreateDevice;
|
||||||
|
PFN_D3D12_GET_DEBUG_INTERFACE wrapD3D12GetDebugInterface;
|
||||||
|
PFN_D3D12_SERIALIZE_ROOT_SIGNATURE wrapD3D12SerializeRootSignature;
|
||||||
|
|
||||||
|
static HMODULE D3D12Module;
|
||||||
|
|
||||||
|
static void loadD3D12FunctionPointers()
|
||||||
|
{
|
||||||
|
D3D12Module = LoadLibrary(L"d3d12.dll");
|
||||||
|
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");
|
||||||
|
}
|
||||||
|
|
||||||
|
static void unloadD3D12FunctionPointers()
|
||||||
|
{
|
||||||
|
FreeLibrary(D3D12Module);
|
||||||
|
}
|
||||||
|
|
||||||
GetGSFrameCb2 GetGSFrame = nullptr;
|
GetGSFrameCb2 GetGSFrame = nullptr;
|
||||||
|
|
||||||
void SetGetD3DGSFrameCallback(GetGSFrameCb2 value)
|
void SetGetD3DGSFrameCallback(GetGSFrameCb2 value)
|
||||||
|
@ -194,7 +213,7 @@ std::pair<ID3DBlob *, ID3DBlob *> compileF32toU8CS()
|
||||||
|
|
||||||
ID3DBlob *rootSignatureBlob;
|
ID3DBlob *rootSignatureBlob;
|
||||||
|
|
||||||
hr = D3D12SerializeRootSignature(&rootSignatureDesc, D3D_ROOT_SIGNATURE_VERSION_1, &rootSignatureBlob, &errorBlob);
|
hr = wrapD3D12SerializeRootSignature(&rootSignatureDesc, D3D_ROOT_SIGNATURE_VERSION_1, &rootSignatureBlob, &errorBlob);
|
||||||
if (hr != S_OK)
|
if (hr != S_OK)
|
||||||
{
|
{
|
||||||
const char *tmp = (const char*)errorBlob->GetBufferPointer();
|
const char *tmp = (const char*)errorBlob->GetBufferPointer();
|
||||||
|
@ -207,10 +226,11 @@ std::pair<ID3DBlob *, ID3DBlob *> compileF32toU8CS()
|
||||||
D3D12GSRender::D3D12GSRender()
|
D3D12GSRender::D3D12GSRender()
|
||||||
: GSRender(), m_PSO(nullptr)
|
: GSRender(), m_PSO(nullptr)
|
||||||
{
|
{
|
||||||
|
loadD3D12FunctionPointers();
|
||||||
if (Ini.GSDebugOutputEnable.GetValue())
|
if (Ini.GSDebugOutputEnable.GetValue())
|
||||||
{
|
{
|
||||||
Microsoft::WRL::ComPtr<ID3D12Debug> debugInterface;
|
Microsoft::WRL::ComPtr<ID3D12Debug> debugInterface;
|
||||||
D3D12GetDebugInterface(IID_PPV_ARGS(&debugInterface));
|
wrapD3D12GetDebugInterface(IID_PPV_ARGS(&debugInterface));
|
||||||
debugInterface->EnableDebugLayer();
|
debugInterface->EnableDebugLayer();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -230,7 +250,7 @@ D3D12GSRender::D3D12GSRender()
|
||||||
dxgiFactory->EnumAdapters(Ini.GSD3DAdaptater.GetValue() - 2,&adaptater);
|
dxgiFactory->EnumAdapters(Ini.GSD3DAdaptater.GetValue() - 2,&adaptater);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
check(D3D12CreateDevice(adaptater, D3D_FEATURE_LEVEL_11_0, IID_PPV_ARGS(&m_device)));
|
check(wrapD3D12CreateDevice(adaptater, D3D_FEATURE_LEVEL_11_0, IID_PPV_ARGS(&m_device)));
|
||||||
|
|
||||||
// Queues
|
// Queues
|
||||||
D3D12_COMMAND_QUEUE_DESC copyQueueDesc = {}, graphicQueueDesc = {};
|
D3D12_COMMAND_QUEUE_DESC copyQueueDesc = {}, graphicQueueDesc = {};
|
||||||
|
@ -315,7 +335,7 @@ D3D12GSRender::D3D12GSRender()
|
||||||
|
|
||||||
Microsoft::WRL::ComPtr<ID3DBlob> rootSignatureBlob;
|
Microsoft::WRL::ComPtr<ID3DBlob> rootSignatureBlob;
|
||||||
Microsoft::WRL::ComPtr<ID3DBlob> errorBlob;
|
Microsoft::WRL::ComPtr<ID3DBlob> errorBlob;
|
||||||
check(D3D12SerializeRootSignature(&rootSignatureDesc, D3D_ROOT_SIGNATURE_VERSION_1, &rootSignatureBlob, &errorBlob));
|
check(wrapD3D12SerializeRootSignature(&rootSignatureDesc, D3D_ROOT_SIGNATURE_VERSION_1, &rootSignatureBlob, &errorBlob));
|
||||||
|
|
||||||
m_device->CreateRootSignature(0,
|
m_device->CreateRootSignature(0,
|
||||||
rootSignatureBlob->GetBufferPointer(),
|
rootSignatureBlob->GetBufferPointer(),
|
||||||
|
@ -408,6 +428,7 @@ D3D12GSRender::~D3D12GSRender()
|
||||||
m_swapChain->Release();
|
m_swapChain->Release();
|
||||||
m_device->Release();
|
m_device->Release();
|
||||||
delete[] vertexConstantShadowCopy;
|
delete[] vertexConstantShadowCopy;
|
||||||
|
unloadD3D12FunctionPointers();
|
||||||
}
|
}
|
||||||
|
|
||||||
void D3D12GSRender::Close()
|
void D3D12GSRender::Close()
|
||||||
|
|
|
@ -17,9 +17,6 @@
|
||||||
// Some constants are the same between RSX and GL
|
// Some constants are the same between RSX and GL
|
||||||
#include <GL\GL.h>
|
#include <GL\GL.h>
|
||||||
|
|
||||||
#pragma comment (lib, "d3d12.lib")
|
|
||||||
#pragma comment (lib, "dxgi.lib")
|
|
||||||
|
|
||||||
class GSFrameBase2
|
class GSFrameBase2
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue