mirror of
https://github.com/doitsujin/dxvk.git
synced 2024-12-05 01:24:14 +01:00
[d3d11] Rework D3D11CoreCreateDevice
FiveM calls this directly and apparently our signature wasn't quite what they expect it to be.
This commit is contained in:
parent
dfbebba6b5
commit
228615b639
@ -9,10 +9,14 @@ extern "C" {
|
|||||||
HRESULT __stdcall D3D11CoreCreateDevice(
|
HRESULT __stdcall D3D11CoreCreateDevice(
|
||||||
IDXGIFactory* pFactory,
|
IDXGIFactory* pFactory,
|
||||||
IDXGIAdapter* pAdapter,
|
IDXGIAdapter* pAdapter,
|
||||||
|
D3D_DRIVER_TYPE DriverType,
|
||||||
|
HMODULE Software,
|
||||||
UINT Flags,
|
UINT Flags,
|
||||||
const D3D_FEATURE_LEVEL* pFeatureLevels,
|
const D3D_FEATURE_LEVEL* pFeatureLevels,
|
||||||
UINT FeatureLevels,
|
UINT FeatureLevels,
|
||||||
ID3D11Device** ppDevice);
|
UINT SDKVersion,
|
||||||
|
ID3D11Device** ppDevice,
|
||||||
|
D3D_FEATURE_LEVEL* pFeatureLevel);
|
||||||
|
|
||||||
|
|
||||||
DLLEXPORT HRESULT __stdcall D3D10CoreCreateDevice(
|
DLLEXPORT HRESULT __stdcall D3D10CoreCreateDevice(
|
||||||
@ -31,8 +35,8 @@ extern "C" {
|
|||||||
if (FAILED(hr))
|
if (FAILED(hr))
|
||||||
return hr;
|
return hr;
|
||||||
|
|
||||||
hr = D3D11CoreCreateDevice(pFactory, pAdapter,
|
hr = D3D11CoreCreateDevice(pFactory, pAdapter, D3D_DRIVER_TYPE_UNKNOWN,
|
||||||
Flags, &FeatureLevel, 1, &d3d11Device);
|
nullptr, Flags, &FeatureLevel, 1, D3D11_SDK_VERSION, &d3d11Device, nullptr);
|
||||||
|
|
||||||
if (FAILED(hr))
|
if (FAILED(hr))
|
||||||
return hr;
|
return hr;
|
||||||
|
@ -15,7 +15,7 @@ namespace dxvk {
|
|||||||
extern "C" {
|
extern "C" {
|
||||||
using namespace dxvk;
|
using namespace dxvk;
|
||||||
|
|
||||||
DLLEXPORT HRESULT __stdcall D3D11CoreCreateDevice(
|
HRESULT D3D11InternalCreateDevice(
|
||||||
IDXGIFactory* pFactory,
|
IDXGIFactory* pFactory,
|
||||||
IDXGIAdapter* pAdapter,
|
IDXGIAdapter* pAdapter,
|
||||||
UINT Flags,
|
UINT Flags,
|
||||||
@ -34,7 +34,7 @@ extern "C" {
|
|||||||
dxvkAdapter = dxgiVkAdapter->GetDXVKAdapter();
|
dxvkAdapter = dxgiVkAdapter->GetDXVKAdapter();
|
||||||
dxvkInstance = dxgiVkAdapter->GetDXVKInstance();
|
dxvkInstance = dxgiVkAdapter->GetDXVKInstance();
|
||||||
} else {
|
} else {
|
||||||
Logger::warn("D3D11CoreCreateDevice: Adapter is not a DXVK adapter");
|
Logger::warn("D3D11InternalCreateDevice: Adapter is not a DXVK adapter");
|
||||||
DXGI_ADAPTER_DESC desc;
|
DXGI_ADAPTER_DESC desc;
|
||||||
pAdapter->GetDesc(&desc);
|
pAdapter->GetDesc(&desc);
|
||||||
|
|
||||||
@ -70,7 +70,7 @@ extern "C" {
|
|||||||
D3D_FEATURE_LEVEL minFeatureLevel = D3D_FEATURE_LEVEL();
|
D3D_FEATURE_LEVEL minFeatureLevel = D3D_FEATURE_LEVEL();
|
||||||
D3D_FEATURE_LEVEL devFeatureLevel = D3D_FEATURE_LEVEL();
|
D3D_FEATURE_LEVEL devFeatureLevel = D3D_FEATURE_LEVEL();
|
||||||
|
|
||||||
Logger::info(str::format("D3D11CoreCreateDevice: Maximum supported feature level: ", maxFeatureLevel));
|
Logger::info(str::format("D3D11InternalCreateDevice: Maximum supported feature level: ", maxFeatureLevel));
|
||||||
|
|
||||||
for (uint32_t flId = 0 ; flId < FeatureLevels; flId++) {
|
for (uint32_t flId = 0 ; flId < FeatureLevels; flId++) {
|
||||||
minFeatureLevel = pFeatureLevels[flId];
|
minFeatureLevel = pFeatureLevels[flId];
|
||||||
@ -82,12 +82,12 @@ extern "C" {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!devFeatureLevel) {
|
if (!devFeatureLevel) {
|
||||||
Logger::err(str::format("D3D11CoreCreateDevice: Minimum required feature level ", minFeatureLevel, " not supported"));
|
Logger::err(str::format("D3D11InternalCreateDevice: Minimum required feature level ", minFeatureLevel, " not supported"));
|
||||||
return E_INVALIDARG;
|
return E_INVALIDARG;
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Logger::info(str::format("D3D11CoreCreateDevice: Using feature level ", devFeatureLevel));
|
Logger::info(str::format("D3D11InternalCreateDevice: Using feature level ", devFeatureLevel));
|
||||||
|
|
||||||
DxvkDeviceFeatures deviceFeatures = D3D11Device::GetDeviceFeatures(dxvkAdapter);
|
DxvkDeviceFeatures deviceFeatures = D3D11Device::GetDeviceFeatures(dxvkAdapter);
|
||||||
Rc<DxvkDevice> dxvkDevice = dxvkAdapter->createDevice(dxvkInstance, deviceFeatures);
|
Rc<DxvkDevice> dxvkDevice = dxvkAdapter->createDevice(dxvkInstance, deviceFeatures);
|
||||||
@ -101,7 +101,7 @@ extern "C" {
|
|||||||
__uuidof(ID3D11Device),
|
__uuidof(ID3D11Device),
|
||||||
reinterpret_cast<void**>(ppDevice));
|
reinterpret_cast<void**>(ppDevice));
|
||||||
} catch (const DxvkError& e) {
|
} catch (const DxvkError& e) {
|
||||||
Logger::err("D3D11CoreCreateDevice: Failed to create D3D11 device");
|
Logger::err("D3D11InternalCreateDevice: Failed to create D3D11 device");
|
||||||
return E_FAIL;
|
return E_FAIL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -173,7 +173,7 @@ extern "C" {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Create the actual device
|
// Create the actual device
|
||||||
hr = D3D11CoreCreateDevice(
|
hr = D3D11InternalCreateDevice(
|
||||||
dxgiFactory.ptr(), dxgiAdapter.ptr(),
|
dxgiFactory.ptr(), dxgiAdapter.ptr(),
|
||||||
Flags, pFeatureLevels, FeatureLevels,
|
Flags, pFeatureLevels, FeatureLevels,
|
||||||
&device);
|
&device);
|
||||||
@ -212,6 +212,25 @@ extern "C" {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
DLLEXPORT HRESULT __stdcall D3D11CoreCreateDevice(
|
||||||
|
IDXGIFactory* pFactory,
|
||||||
|
IDXGIAdapter* pAdapter,
|
||||||
|
D3D_DRIVER_TYPE DriverType,
|
||||||
|
HMODULE Software,
|
||||||
|
UINT Flags,
|
||||||
|
const D3D_FEATURE_LEVEL* pFeatureLevels,
|
||||||
|
UINT FeatureLevels,
|
||||||
|
UINT SDKVersion,
|
||||||
|
ID3D11Device** ppDevice,
|
||||||
|
D3D_FEATURE_LEVEL* pFeatureLevel) {
|
||||||
|
return D3D11InternalCreateDeviceAndSwapChain(
|
||||||
|
pAdapter, DriverType, Software, Flags,
|
||||||
|
pFeatureLevels, FeatureLevels, SDKVersion,
|
||||||
|
nullptr, nullptr,
|
||||||
|
ppDevice, pFeatureLevel, nullptr);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
DLLEXPORT HRESULT __stdcall D3D11CreateDevice(
|
DLLEXPORT HRESULT __stdcall D3D11CreateDevice(
|
||||||
IDXGIAdapter* pAdapter,
|
IDXGIAdapter* pAdapter,
|
||||||
D3D_DRIVER_TYPE DriverType,
|
D3D_DRIVER_TYPE DriverType,
|
||||||
|
Loading…
Reference in New Issue
Block a user