Skip to content

Commit 2d93187

Browse files
committed
Added WARP option while in debug mode.
1 parent 86661e4 commit 2d93187

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

loader_core/loader_core.cpp

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#include "stdafx.h"
1+
#include "stdafx.h"
22
#include "build_version.h"
33

44
loader_core loader_core::instance;
@@ -199,6 +199,14 @@ IDirect3D9 * loader_core::OnD3DCreate(UINT sdkVer)
199199
return RouteD3DCreate(sdkVer);
200200
}
201201

202+
enum class WarpSelection
203+
{
204+
ASK = 0,
205+
ON = 1,
206+
OFF = 2
207+
};
208+
WarpSelection g_warpSelection;
209+
202210
HRESULT loader_core::RouteD3D11CreateDeviceAndSwapChain(DX11_CREATE_FDEF)
203211
{
204212
typedef HRESULT (WINAPI* D3D11CreateDeviceAndSwapChainFunc)(DX11_CREATE_FDEF);
@@ -207,6 +215,14 @@ HRESULT loader_core::RouteD3D11CreateDeviceAndSwapChain(DX11_CREATE_FDEF)
207215

208216
#ifdef _DEBUG
209217
Flags |= D3D11_CREATE_DEVICE_DEBUG;
218+
if (g_warpSelection == WarpSelection::ASK)
219+
g_warpSelection = MessageBoxA(nullptr, "Debug addon loader active. Enable WARP?", "WARP", MB_YESNO | MB_ICONQUESTION | MB_DEFBUTTON2 | MB_TASKMODAL) == IDYES ? WarpSelection::ON : WarpSelection::OFF;
220+
221+
if (g_warpSelection == WarpSelection::ON)
222+
{
223+
DriverType = D3D_DRIVER_TYPE_WARP;
224+
pAdapter = nullptr;
225+
}
210226
#endif
211227

212228
if (d3d11_create_hook)

0 commit comments

Comments
 (0)