From 934a6d14fae3659ec9fed913961537ed45fdc600 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sat, 6 Jan 2024 13:14:56 +0100 Subject: [PATCH] removed legacy OpenGL context creation code. This has been obsolete for 20 years and any driver not supporting the modern API needs to be considered broken by default by now. --- source/common/platform/win32/win32glvideo.cpp | 51 +++---------------- 1 file changed, 6 insertions(+), 45 deletions(-) diff --git a/source/common/platform/win32/win32glvideo.cpp b/source/common/platform/win32/win32glvideo.cpp index c972940a5a..80516f0b16 100644 --- a/source/common/platform/win32/win32glvideo.cpp +++ b/source/common/platform/win32/win32glvideo.cpp @@ -326,8 +326,7 @@ bool Win32GLVideo::SetupPixelFormat(int multisample) if (!myWglChoosePixelFormatARB(m_hDC, attributes.data(), attribsFloat, 1, &pixelFormat, &numFormats)) { - Printf("R_OPENGL: Couldn't choose pixel format. Retrying in compatibility mode\n"); - goto oldmethod; + I_FatalError("R_OPENGL: Couldn't choose pixel format. Retrying in compatibility mode\n"); } if (vid_hdr && numFormats == 0) // This card/driver doesn't support the rgb16f pixel format. Fall back to 8bpc @@ -343,8 +342,7 @@ bool Win32GLVideo::SetupPixelFormat(int multisample) if (!myWglChoosePixelFormatARB(m_hDC, attributes.data(), attribsFloat, 1, &pixelFormat, &numFormats)) { - Printf("R_OPENGL: Couldn't choose pixel format. Retrying in compatibility mode\n"); - goto oldmethod; + I_FatalError("R_OPENGL: Couldn't choose pixel format."); } } else if (vid_hdr) @@ -360,49 +358,13 @@ bool Win32GLVideo::SetupPixelFormat(int multisample) vr_enable_quadbuffered = false; goto again; } - Printf("R_OPENGL: No valid pixel formats found. Retrying in compatibility mode\n"); - goto oldmethod; + I_FatalError("R_OPENGL: No valid pixel formats found."); } } else { - oldmethod: - // If wglChoosePixelFormatARB is not found we have to do it the old fashioned way. - static PIXELFORMATDESCRIPTOR pfd = { - sizeof(PIXELFORMATDESCRIPTOR), - 1, - PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER, - PFD_TYPE_RGBA, - 32, // color depth - 0, 0, 0, 0, 0, 0, - 0, - 0, - 0, - 0, 0, 0, 0, - 32, // z depth - 8, // stencil buffer - 0, - PFD_MAIN_PLANE, - 0, - 0, 0, 0 - }; - - pixelFormat = ChoosePixelFormat(m_hDC, &pfd); - DescribePixelFormat(m_hDC, pixelFormat, sizeof(pfd), &pfd); - - if (pfd.dwFlags & PFD_GENERIC_FORMAT) - { - I_Error("R_OPENGL: OpenGL driver not accelerated!"); - return false; - } + I_FatalError("R_OPENGL: Unable to create an OpenGL render context. Insufficient driver support for context creation\n"); } - - if (!::SetPixelFormat(m_hDC, pixelFormat, NULL)) - { - I_Error("R_OPENGL: Couldn't set pixel format.\n"); - return false; - } - return true; } //========================================================================== @@ -452,8 +414,7 @@ bool Win32GLVideo::InitHardware(HWND Window, int multisample) m_hRC = zd_wglCreateContext(m_hDC); if (m_hRC == NULL) { - I_Error("R_OPENGL: Unable to create an OpenGL render context.\n"); - return false; + I_FatalError("R_OPENGL: Unable to create an OpenGL render context.\n"); } } @@ -464,7 +425,7 @@ bool Win32GLVideo::InitHardware(HWND Window, int multisample) } } // We get here if the driver doesn't support the modern context creation API which always means an old driver. - I_Error("R_OPENGL: Unable to create an OpenGL render context. Insufficient driver support for context creation\n"); + I_FatalError("R_OPENGL: Unable to create an OpenGL render context. Insufficient driver support for context creation\n"); return false; }