Skip to content

Commit 3ea7958

Browse files
committed
(Almost) NUKE glDriverType_t
Almost because until 0.56 it's still there in the glconfig_t IPC struct. Also nuke accompanying logspam which provides no new information and falsely suggests that there are discrete "modes" depending on the OpenGL version number.
1 parent e233638 commit 3ea7958

File tree

3 files changed

+8
-69
lines changed

3 files changed

+8
-69
lines changed

src/engine/renderer/tr_init.cpp

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -968,10 +968,8 @@ ScreenshotCmd screenshotPNGRegistration("screenshotPNG", ssFormat_t::SSF_PNG, "p
968968
Log::Notice("Using OpenGL version %d.%d, requested: %d.%d", glConfig2.glMajor, glConfig2.glMinor, glConfig2.glRequestedMajor, glConfig2.glRequestedMinor );
969969
}
970970

971-
if ( glConfig.driverType == glDriverType_t::GLDRV_OPENGL3 )
971+
if ( std::make_pair( glConfig2.glMajor, glConfig2.glMinor ) >= std::make_pair( 3, 2 ) )
972972
{
973-
Log::Notice("%sUsing OpenGL 3.x context.", Color::ToString( Color::Green ) );
974-
975973
/* See https://www.khronos.org/opengl/wiki/OpenGL_Context
976974
for information about core, compatibility and forward context. */
977975

@@ -984,10 +982,6 @@ ScreenshotCmd screenshotPNGRegistration("screenshotPNG", ssFormat_t::SSF_PNG, "p
984982
Log::Notice("%sUsing an OpenGL compatibility profile.", Color::ToString( Color::Red ) );
985983
}
986984
}
987-
else
988-
{
989-
Log::Notice("%sUsing OpenGL 2.x context.", Color::ToString( Color::Red ) );
990-
}
991985

992986
if ( glConfig2.glForwardCompatibleContext )
993987
{

src/engine/renderer/tr_types.h

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -251,20 +251,13 @@ enum class textureCompression_t
251251
TC_EXT_COMP_S3TC
252252
};
253253

254-
// Keep the list in sdl_glimp.c:reportDriverType in sync with this
254+
// TODO(0.56): remove.
255255
enum class glDriverType_t
256256
{
257257
GLDRV_UNKNOWN = -1,
258-
GLDRV_ICD, // driver is integrated with window system
259-
// WARNING: there are tests that check for
260-
// > GLDRV_ICD for minidriverness, so this
261-
// should always be the lowest value in this
262-
// enum set
263-
GLDRV_STANDALONE, // driver is a non-3Dfx standalone driver
264-
265-
// XreaL BEGIN
266-
GLDRV_OPENGL3, // new driver system
267-
// XreaL END
258+
GLDRV_ICD,
259+
GLDRV_STANDALONE,
260+
GLDRV_OPENGL3,
268261
};
269262

270263
// Keep the list in sdl_glimp.c:reportHardwareType in sync with this

src/engine/sys/sdl_glimp.cpp

Lines changed: 3 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,6 @@ static Cvar::Modified<Cvar::Cvar<bool>> r_noBorder(
4646
static Cvar::Modified<Cvar::Range<Cvar::Cvar<int>>> r_swapInterval(
4747
"r_swapInterval", "enable vsync on every Nth frame, negative for apdative", Cvar::ARCHIVE, 0, -5, 5 );
4848

49-
static Cvar::Cvar<std::string> r_glForceDriver(
50-
"r_glForceDriver", "treat the OpenGL driver type as: 'icd' 'standalone' or 'opengl3'", Cvar::NONE, "");
5149
static Cvar::Cvar<std::string> r_glForceHardware(
5250
"r_glForceHardware", "treat the GPU type as: 'r300' or 'generic'", Cvar::NONE, "");
5351

@@ -1467,17 +1465,6 @@ static rserr_t GLimp_CheckOpenGLVersion( const glConfiguration &requestedConfigu
14671465
return rserr_t::RSERR_OLD_GL;
14681466
}
14691467

1470-
if ( glConfig2.glMajor < 3 || ( glConfig2.glMajor == 3 && glConfig2.glMinor < 2 ) )
1471-
{
1472-
// Shaders are supported, but not all OpenGL 3.x features
1473-
logger.Notice("Using GL3 Renderer in OpenGL 2.x mode..." );
1474-
}
1475-
else
1476-
{
1477-
logger.Notice("Using GL3 Renderer in OpenGL 3.x mode..." );
1478-
glConfig.driverType = glDriverType_t::GLDRV_OPENGL3;
1479-
}
1480-
14811468
return rserr_t::RSERR_OK;
14821469
}
14831470

@@ -2594,19 +2581,6 @@ static const int R_MODE_FALLBACK = 3; // 640 * 480
25942581

25952582
/* Support code for GLimp_Init */
25962583

2597-
static void reportDriverType( bool force )
2598-
{
2599-
static const char *const drivers[] = {
2600-
"integrated", "stand-alone", "OpenGL 3+", "Mesa"
2601-
};
2602-
if (glConfig.driverType > glDriverType_t::GLDRV_UNKNOWN && (unsigned) glConfig.driverType < ARRAY_LEN( drivers ) )
2603-
{
2604-
logger.Notice("%s graphics driver class '%s'",
2605-
force ? "User has forced" : "Detected",
2606-
drivers[Util::ordinal(glConfig.driverType)] );
2607-
}
2608-
}
2609-
26102584
static void reportHardwareType( bool force )
26112585
{
26122586
static const char *const hardware[] = {
@@ -2630,7 +2604,7 @@ of OpenGL
26302604
*/
26312605
bool GLimp_Init()
26322606
{
2633-
glConfig.driverType = glDriverType_t::GLDRV_ICD;
2607+
glConfig.driverType = glDriverType_t::GLDRV_OPENGL3;
26342608

26352609
r_sdlDriver = Cvar_Get( "r_sdlDriver", "", CVAR_ROM );
26362610
r_allowResize = Cvar_Get( "r_allowResize", "0", CVAR_LATCH );
@@ -2821,34 +2795,18 @@ bool GLimp_Init()
28212795
}
28222796
}
28232797

2824-
if ( glConfig2.hardwareVendor == glHardwareVendor_t::ATI
2825-
&& glConfig.driverType != glDriverType_t::GLDRV_OPENGL3 )
2798+
if ( glConfig2.hardwareVendor == glHardwareVendor_t::ATI &&
2799+
std::make_pair( glConfig2.glMajor, glConfig2.glMinor ) < std::make_pair( 3, 2 ) )
28262800
{
28272801
glConfig.hardwareType = glHardwareType_t::GLHW_R300;
28282802
}
28292803

2830-
reportDriverType( false );
28312804
reportHardwareType( false );
28322805

28332806
{ // allow overriding where the user really does know better
2834-
Cvar::Latch( r_glForceDriver );
28352807
Cvar::Latch( r_glForceHardware );
2836-
glDriverType_t driverType = glDriverType_t::GLDRV_UNKNOWN;
28372808
glHardwareType_t hardwareType = glHardwareType_t::GLHW_UNKNOWN;
28382809

2839-
if ( Str::IsIEqual( r_glForceDriver.Get(), "icd" ) )
2840-
{
2841-
driverType = glDriverType_t::GLDRV_ICD;
2842-
}
2843-
else if ( Str::IsIEqual( r_glForceDriver.Get(), "standalone" ) )
2844-
{
2845-
driverType = glDriverType_t::GLDRV_STANDALONE;
2846-
}
2847-
else if ( Str::IsIEqual( r_glForceDriver.Get(), "opengl3" ) )
2848-
{
2849-
driverType = glDriverType_t::GLDRV_OPENGL3;
2850-
}
2851-
28522810
if ( Str::IsIEqual( r_glForceHardware.Get(), "generic" ) )
28532811
{
28542812
hardwareType = glHardwareType_t::GLHW_GENERIC;
@@ -2858,12 +2816,6 @@ bool GLimp_Init()
28582816
hardwareType = glHardwareType_t::GLHW_R300;
28592817
}
28602818

2861-
if ( driverType != glDriverType_t::GLDRV_UNKNOWN )
2862-
{
2863-
glConfig.driverType = driverType;
2864-
reportDriverType( true );
2865-
}
2866-
28672819
if ( hardwareType != glHardwareType_t::GLHW_UNKNOWN )
28682820
{
28692821
glConfig.hardwareType = hardwareType;

0 commit comments

Comments
 (0)