diff --git a/tests/gfx/source/os/desktopos.cpp b/tests/gfx/source/os/desktopos.cpp index 7cd3d96..6ccab4e 100644 --- a/tests/gfx/source/os/desktopos.cpp +++ b/tests/gfx/source/os/desktopos.cpp @@ -5,11 +5,21 @@ #include #include +#ifdef _WIN32 +#include +#define GLFW_EXPOSE_NATIVE_WIN32 +#include +#endif + #include namespace PD { struct DesktopOS::Impl { GLFWwindow* win = nullptr; +#if WIN32 + IDirect3D9* d3d = nullptr; + IDirect3DDevice9* dx9_device = nullptr; +#endif }; void DesktopOS::Init() { @@ -45,21 +55,21 @@ void DesktopOS::Init() { } #ifdef _WIN32 if (pDriver == Driver::DirectX9) { - d3d = Direct3DCreate9(D3D_SDK_VERSION); + impl->d3d = Direct3DCreate9(D3D_SDK_VERSION); auto hwnd = glfwGetWin32Window(impl->win); D3DPRESENT_PARAMETERS d3dpp = {}; d3dpp.Windowed = TRUE; d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD; d3dpp.hDeviceWindow = hwnd; - HRESULT hr = d3d->CreateDevice(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, hwnd, + HRESULT hr = impl->d3d->CreateDevice(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, hwnd, D3DCREATE_HARDWARE_VERTEXPROCESSING, &d3dpp, - &dx9_device); + &impl->dx9_device); if (FAILED(hr)) { MessageBoxW(nullptr, L"Failed to create D3D9 device", L"Error", MB_OK); std::abort(); } - PD::Gfx::UseDriver(dx9_device); + PD::Gfx::UseDriver(impl->dx9_device); } #endif glfwSwapInterval(1);