Skip to content

Commit

Permalink
removed legacy Windows OpenGL init code.
Browse files Browse the repository at this point in the history
  • Loading branch information
coelckers committed Jan 6, 2024
1 parent a496332 commit 218a617
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 41 deletions.
3 changes: 1 addition & 2 deletions source/common/filesystem/source/fs_stringpool.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class StringPool
friend class FileSystem;
friend class FResourceFile;
private:
StringPool(bool _shared, size_t blocksize = 10*1024) : TopBlock(nullptr), FreeBlocks(nullptr), BlockSize(blocksize), shared(_shared) {}
StringPool(bool _shared, size_t blocksize = 10*1024) : TopBlock(nullptr), BlockSize(blocksize), shared(_shared) {}
public:
~StringPool();
const char* Strdup(const char*);
Expand All @@ -20,7 +20,6 @@ class StringPool
Block *AddBlock(size_t size);

Block *TopBlock;
Block *FreeBlocks;
size_t BlockSize;
public:
bool shared;
Expand Down
44 changes: 6 additions & 38 deletions source/common/platform/win32/win32glvideo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
Expand All @@ -360,41 +358,12 @@ 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))
Expand Down Expand Up @@ -452,8 +421,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");
}
}

Expand All @@ -464,7 +432,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;
}

Expand Down
2 changes: 1 addition & 1 deletion source/common/scripting/core/types.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ void DumpTypeTable()
}
Printf("\n");
}
Printf("Used buckets: %d/%lu (%.2f%%) for %d entries\n", used, countof(TypeTable.TypeHash), double(used)/countof(TypeTable.TypeHash)*100, all);
Printf("Used buckets: %d/%zu (%.2f%%) for %d entries\n", used, countof(TypeTable.TypeHash), double(used)/countof(TypeTable.TypeHash)*100, all);
Printf("Min bucket size: %d\n", min);
Printf("Max bucket size: %d\n", max);
Printf("Avg bucket size: %.2f\n", double(all) / used);
Expand Down

0 comments on commit 218a617

Please sign in to comment.