mirror of
https://gitlab.com/Mr_Goldberg/goldberg_emulator.git
synced 2025-04-21 21:52:06 +02:00
HACK: Wine DX10 and DX11 Detection.
Wine doesn't implement the NULL renderer, and tries to fallback to the REFERENCE renderer. Which then also fails when we try to create a 1x1 DXGI_USAGE_RENDER_TARGET_OUTPUT swapchain. Until Wine manages to get a NULL renderer working, just use the WARP renderer instead. (Which Wine also doesn't implement and falls back to the hardware renderer for, but at least it works properly.)
This commit is contained in:
parent
9f4cc05f2a
commit
f3ac8485ed
1 changed files with 38 additions and 4 deletions
|
@ -583,6 +583,23 @@ private:
|
|||
{
|
||||
if (!dx10_hooked)
|
||||
{
|
||||
//HACK: Remove when wine _finally_ implements the NULL renderer....
|
||||
bool found_wine = false;
|
||||
std::string ntdll_path = FindPreferedModulePath("ntdll.dll");
|
||||
if (!ntdll_path.empty())
|
||||
{
|
||||
HMODULE hNTdll = GetModuleHandleA(ntdll_path.c_str());
|
||||
if (hNTdll != nullptr)
|
||||
{
|
||||
auto wine_get_version = (const char*(*)())GetProcAddress(hNTdll, "wine_get_version");
|
||||
if (wine_get_version != nullptr)
|
||||
{
|
||||
found_wine = true;
|
||||
SPDLOG_WARN("Found WINE version: %s.\n", wine_get_version());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
System::Library::Library libD3d10;
|
||||
if (!libD3d10.OpenLibrary(library_path, false))
|
||||
{
|
||||
|
@ -607,7 +624,7 @@ private:
|
|||
|
||||
if (D3D10CreateDevice != nullptr && CreateDXGIFactory1 != nullptr)
|
||||
{
|
||||
D3D10CreateDevice(NULL, D3D10_DRIVER_TYPE_NULL, NULL, 0, D3D10_SDK_VERSION, &pDevice);
|
||||
D3D10CreateDevice(NULL, (found_wine) ? D3D10_DRIVER_TYPE_WARP : D3D10_DRIVER_TYPE_NULL, NULL, 0, D3D10_SDK_VERSION, &pDevice);
|
||||
if (pDevice != nullptr)
|
||||
{
|
||||
CreateDXGIFactory1(IID_PPV_ARGS(&pDXGIFactory));
|
||||
|
@ -660,7 +677,7 @@ private:
|
|||
SwapChainDesc.SampleDesc.Quality = 0;
|
||||
SwapChainDesc.Windowed = TRUE;
|
||||
|
||||
D3D10CreateDeviceAndSwapChain(NULL, D3D10_DRIVER_TYPE_NULL, NULL, 0, D3D10_SDK_VERSION, &SwapChainDesc, &pSwapChain, &pDevice);
|
||||
D3D10CreateDeviceAndSwapChain(NULL, (found_wine) ? D3D10_DRIVER_TYPE_WARP : D3D10_DRIVER_TYPE_NULL, NULL, 0, D3D10_SDK_VERSION, &SwapChainDesc, &pSwapChain, &pDevice);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -698,6 +715,23 @@ private:
|
|||
{
|
||||
if (!dx11_hooked)
|
||||
{
|
||||
//HACK: Remove when wine _finally_ implements the NULL renderer....
|
||||
bool found_wine = false;
|
||||
std::string ntdll_path = FindPreferedModulePath("ntdll.dll");
|
||||
if (!ntdll_path.empty())
|
||||
{
|
||||
HMODULE hNTdll = GetModuleHandleA(ntdll_path.c_str());
|
||||
if (hNTdll != nullptr)
|
||||
{
|
||||
auto wine_get_version = (const char*(*)())GetProcAddress(hNTdll, "wine_get_version");
|
||||
if (wine_get_version != nullptr)
|
||||
{
|
||||
found_wine = true;
|
||||
SPDLOG_WARN("Found WINE version: %s.\n", wine_get_version());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
System::Library::Library libD3d11;
|
||||
if (!libD3d11.OpenLibrary(library_path, false))
|
||||
{
|
||||
|
@ -722,7 +756,7 @@ private:
|
|||
|
||||
if (D3D11CreateDevice != nullptr && CreateDXGIFactory1 != nullptr)
|
||||
{
|
||||
D3D11CreateDevice(NULL, D3D_DRIVER_TYPE_NULL, NULL, 0, NULL, 0, D3D11_SDK_VERSION, &pDevice, NULL, NULL);
|
||||
D3D11CreateDevice(NULL, (found_wine) ? D3D_DRIVER_TYPE_WARP : D3D_DRIVER_TYPE_NULL, NULL, 0, NULL, 0, D3D11_SDK_VERSION, &pDevice, NULL, NULL);
|
||||
if (pDevice != nullptr)
|
||||
{
|
||||
CreateDXGIFactory1(IID_PPV_ARGS(&pDXGIFactory));
|
||||
|
@ -775,7 +809,7 @@ private:
|
|||
SwapChainDesc.SampleDesc.Quality = 0;
|
||||
SwapChainDesc.Windowed = TRUE;
|
||||
|
||||
D3D11CreateDeviceAndSwapChain(NULL, D3D_DRIVER_TYPE_NULL, NULL, 0, NULL, NULL, D3D11_SDK_VERSION, &SwapChainDesc, &pSwapChain, &pDevice, NULL, NULL);
|
||||
D3D11CreateDeviceAndSwapChain(NULL, (found_wine) ? D3D_DRIVER_TYPE_WARP : D3D_DRIVER_TYPE_NULL, NULL, 0, NULL, NULL, D3D11_SDK_VERSION, &SwapChainDesc, &pSwapChain, &pDevice, NULL, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue