mirror of
https://github.com/ZDoom/Raze.git
synced 2025-05-30 08:51:08 +00:00
- Backend update from GZDoom - mainly for GLES2 support.
This commit is contained in:
parent
11aea1c5d4
commit
a3d9cd9a68
66 changed files with 9558 additions and 126 deletions
|
@ -71,7 +71,7 @@ PFNWGLSWAPINTERVALEXTPROC myWglSwapIntervalExtProc;
|
|||
|
||||
SystemGLFrameBuffer::SystemGLFrameBuffer(void *hMonitor, bool fullscreen) : SystemBaseFrameBuffer(hMonitor, fullscreen)
|
||||
{
|
||||
if (!static_cast<Win32GLVideo *>(Video)->InitHardware(Window, 0))
|
||||
if (!static_cast<Win32GLVideo*>(Video)->InitHardware(Window, 0))
|
||||
{
|
||||
I_FatalError("Unable to initialize OpenGL");
|
||||
return;
|
||||
|
|
|
@ -74,16 +74,36 @@ bool UseKnownFolders()
|
|||
{
|
||||
return !iswritable;
|
||||
}
|
||||
std::wstring testpath = progdir.WideString() + L"writest";
|
||||
file = CreateFile(testpath.c_str(), GENERIC_READ | GENERIC_WRITE, 0, NULL,
|
||||
CREATE_ALWAYS,
|
||||
FILE_ATTRIBUTE_TEMPORARY | FILE_FLAG_DELETE_ON_CLOSE, NULL);
|
||||
if (file != INVALID_HANDLE_VALUE)
|
||||
// Consider 'Program Files' read only without actually checking.
|
||||
bool found = false;
|
||||
for (auto p : { L"ProgramFiles", L"ProgramFiles(x86)" })
|
||||
{
|
||||
CloseHandle(file);
|
||||
if (!batchrun) Printf("Using program directory for storage\n");
|
||||
iswritable = true;
|
||||
return false;
|
||||
wchar_t buffer1[256];
|
||||
if (GetEnvironmentVariable(p, buffer1, 256))
|
||||
{
|
||||
FString envpath(buffer1);
|
||||
FixPathSeperator(envpath);
|
||||
if (progdir.MakeLower().IndexOf(envpath.MakeLower()) == 0)
|
||||
{
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!found)
|
||||
{
|
||||
std::wstring testpath = progdir.WideString() + L"writest";
|
||||
file = CreateFile(testpath.c_str(), GENERIC_READ | GENERIC_WRITE, 0, NULL,
|
||||
CREATE_ALWAYS,
|
||||
FILE_ATTRIBUTE_TEMPORARY | FILE_FLAG_DELETE_ON_CLOSE, NULL);
|
||||
if (file != INVALID_HANDLE_VALUE)
|
||||
{
|
||||
CloseHandle(file);
|
||||
if (!batchrun) Printf("Using program directory for storage\n");
|
||||
iswritable = true;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (!batchrun) Printf("Using known folders for storage\n");
|
||||
iswritable = false;
|
||||
|
|
|
@ -510,7 +510,6 @@ BOOL CALLBACK IWADBoxCallback(HWND hDlg, UINT message, WPARAM wParam, LPARAM lPa
|
|||
char szString[256];
|
||||
|
||||
// Check the current video settings.
|
||||
//SendDlgItemMessage( hDlg, vid_renderer ? IDC_WELCOME_OPENGL : IDC_WELCOME_SOFTWARE, BM_SETCHECK, BST_CHECKED, 0 );
|
||||
SendDlgItemMessage( hDlg, IDC_WELCOME_FULLSCREEN, BM_SETCHECK, vid_fullscreen ? BST_CHECKED : BST_UNCHECKED, 0 );
|
||||
switch (vid_preferbackend)
|
||||
{
|
||||
|
@ -520,6 +519,11 @@ BOOL CALLBACK IWADBoxCallback(HWND hDlg, UINT message, WPARAM wParam, LPARAM lPa
|
|||
case 2:
|
||||
SendDlgItemMessage( hDlg, IDC_WELCOME_VULKAN3, BM_SETCHECK, BST_CHECKED, 0 );
|
||||
break;
|
||||
#ifdef HAVE_GLES2
|
||||
case 3:
|
||||
SendDlgItemMessage( hDlg, IDC_WELCOME_VULKAN4, BM_SETCHECK, BST_CHECKED, 0 );
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
SendDlgItemMessage( hDlg, IDC_WELCOME_VULKAN1, BM_SETCHECK, BST_CHECKED, 0 );
|
||||
break;
|
||||
|
@ -574,6 +578,11 @@ BOOL CALLBACK IWADBoxCallback(HWND hDlg, UINT message, WPARAM wParam, LPARAM lPa
|
|||
SetQueryIWad(hDlg);
|
||||
// [SP] Upstreamed from Zandronum
|
||||
vid_fullscreen = SendDlgItemMessage( hDlg, IDC_WELCOME_FULLSCREEN, BM_GETCHECK, 0, 0 ) == BST_CHECKED;
|
||||
#ifdef HAVE_GLES2
|
||||
if (SendDlgItemMessage(hDlg, IDC_WELCOME_VULKAN4, BM_GETCHECK, 0, 0) == BST_CHECKED)
|
||||
vid_preferbackend = 3;
|
||||
else
|
||||
#endif
|
||||
if (SendDlgItemMessage(hDlg, IDC_WELCOME_VULKAN3, BM_GETCHECK, 0, 0) == BST_CHECKED)
|
||||
vid_preferbackend = 2;
|
||||
else if (SendDlgItemMessage(hDlg, IDC_WELCOME_VULKAN2, BM_GETCHECK, 0, 0) == BST_CHECKED)
|
||||
|
|
|
@ -97,6 +97,7 @@
|
|||
#define IDC_RADIO3 1086
|
||||
#define IDC_WELCOME_VULKAN3 1086
|
||||
#define IDCE_ROOM 1087
|
||||
#define IDC_WELCOME_VULKAN4 1187
|
||||
#define IDCS_ROOM 1088
|
||||
#define IDCE_ROOMHF 1089
|
||||
#define IDCS_ROOMHF 1090
|
||||
|
|
|
@ -48,7 +48,7 @@
|
|||
#include "win32basevideo.h"
|
||||
#include "cmdlib.h"
|
||||
|
||||
CVAR(Int, vid_adapter, 1, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
|
||||
CVAR(Int, vid_adapter, 0, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
|
@ -69,6 +69,12 @@ Win32BaseVideo::Win32BaseVideo()
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
HMONITOR GetPrimaryMonitorHandle()
|
||||
{
|
||||
const POINT ptZero = { 0, 0 };
|
||||
return MonitorFromPoint(ptZero, MONITOR_DEFAULTTOPRIMARY);
|
||||
}
|
||||
|
||||
struct MonitorEnumState
|
||||
{
|
||||
int curIdx;
|
||||
|
@ -116,24 +122,29 @@ void Win32BaseVideo::GetDisplayDeviceName()
|
|||
mes.curIdx = 1;
|
||||
mes.hFoundMonitor = nullptr;
|
||||
|
||||
// Could also use EnumDisplayDevices, I guess. That might work.
|
||||
if (EnumDisplayMonitors(0, 0, &GetDisplayDeviceNameMonitorEnumProc, LPARAM(&mes)))
|
||||
if (vid_adapter == 0)
|
||||
{
|
||||
if (mes.hFoundMonitor)
|
||||
mes.hFoundMonitor = GetPrimaryMonitorHandle();
|
||||
}
|
||||
|
||||
// Could also use EnumDisplayDevices, I guess. That might work.
|
||||
else EnumDisplayMonitors(0, 0, &GetDisplayDeviceNameMonitorEnumProc, LPARAM(&mes));
|
||||
|
||||
if (mes.hFoundMonitor)
|
||||
{
|
||||
MONITORINFOEXA mi;
|
||||
|
||||
mi.cbSize = sizeof mi;
|
||||
|
||||
if (GetMonitorInfoA(mes.hFoundMonitor, &mi))
|
||||
{
|
||||
MONITORINFOEXA mi;
|
||||
strcpy(m_DisplayDeviceBuffer, mi.szDevice);
|
||||
m_DisplayDeviceName = m_DisplayDeviceBuffer;
|
||||
|
||||
mi.cbSize = sizeof mi;
|
||||
|
||||
if (GetMonitorInfoA(mes.hFoundMonitor, &mi))
|
||||
{
|
||||
strcpy(m_DisplayDeviceBuffer, mi.szDevice);
|
||||
m_DisplayDeviceName = m_DisplayDeviceBuffer;
|
||||
|
||||
m_hMonitor = mes.hFoundMonitor;
|
||||
}
|
||||
m_hMonitor = mes.hFoundMonitor;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
|
|
|
@ -53,6 +53,9 @@
|
|||
#include "win32glvideo.h"
|
||||
|
||||
#include "gl_framebuffer.h"
|
||||
#ifdef HAVE_GLES2
|
||||
#include "gles_framebuffer.h"
|
||||
#endif
|
||||
|
||||
extern "C" {
|
||||
HGLRC zd_wglCreateContext(HDC Arg1);
|
||||
|
@ -62,6 +65,7 @@ PROC zd_wglGetProcAddress(LPCSTR name);
|
|||
}
|
||||
|
||||
EXTERN_CVAR(Int, vid_adapter)
|
||||
EXTERN_CVAR(Int, vid_preferbackend)
|
||||
EXTERN_CVAR(Bool, vid_hdr)
|
||||
|
||||
CUSTOM_CVAR(Bool, gl_debug, false, CVAR_ARCHIVE | CVAR_GLOBALCONFIG | CVAR_NOINITCALL)
|
||||
|
@ -105,7 +109,13 @@ DFrameBuffer *Win32GLVideo::CreateFrameBuffer()
|
|||
{
|
||||
SystemGLFrameBuffer *fb;
|
||||
|
||||
fb = new OpenGLRenderer::OpenGLFrameBuffer(m_hMonitor, vid_fullscreen);
|
||||
#ifdef HAVE_GLES2
|
||||
if ((Args->CheckParm("-gles2_renderer")) || (vid_preferbackend == 3) )
|
||||
fb = new OpenGLESRenderer::OpenGLFrameBuffer(m_hMonitor, vid_fullscreen);
|
||||
else
|
||||
#endif
|
||||
fb = new OpenGLRenderer::OpenGLFrameBuffer(m_hMonitor, vid_fullscreen);
|
||||
|
||||
return fb;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue