Only the GL driver is supported.

DX hasn't worked in months, SW are not worth their LOC, and NULL is pointless with 
--no-graphics.


git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@12825 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
curaga 2013-05-31 14:07:43 +00:00
parent 366f8cd6b1
commit ef9a1e78eb
4 changed files with 35 additions and 119 deletions

View File

@ -428,11 +428,6 @@ namespace UserConfigParams
PARAM_DEFAULT( IntUserConfigParam(120, "max_fps",
&m_video_group, "Maximum fps, should be at least 60") );
// Renderer type (OpenGL, Direct3D9, Direct3D8, Software, etc)
PARAM_PREFIX IntUserConfigParam m_renderer
PARAM_DEFAULT( IntUserConfigParam(0, "renderer", &m_video_group,
"Type of the renderer.") );
// ---- Debug - not saved to config file
/** If gamepad debugging is enabled. */
PARAM_PREFIX bool m_gamepad_debug PARAM_DEFAULT( false );

View File

@ -311,66 +311,46 @@ void IrrDriver::initDevice()
m_device->drop();
m_device = NULL;
int num_drivers = 5;
SIrrlichtCreationParameters params;
// Test if user has chosen a driver or if we should try all to find
// a working one.
if( UserConfigParams::m_renderer != 0 ) num_drivers = 1;
// ---- open device
// Try different drivers: start with opengl, then DirectX
for(int driver_type=0; driver_type<num_drivers; driver_type++)
// Try 32 and, upon failure, 24 then 16 bit per pixels
for (int bits=32; bits>15; bits -=8)
{
if(UserConfigParams::logMisc())
Log::verbose("irr_driver", "Trying to create device with "
"%i bits\n", bits);
video::E_DRIVER_TYPE type;
// Test if user has chosen a driver or if we should try all to find a
// woring one.
type = getEngineDriverType(
UserConfigParams::m_renderer ? UserConfigParams::m_renderer
: driver_type );
// Try 32 and, upon failure, 24 then 16 bit per pixels
for (int bits=32; bits>15; bits -=8)
params.DriverType = EDT_OPENGL;
params.Stencilbuffer = false;
params.Bits = bits;
params.EventReceiver = this;
params.Fullscreen = UserConfigParams::m_fullscreen;
params.Vsync = UserConfigParams::m_vsync;
params.WindowSize =
core::dimension2du(UserConfigParams::m_width,
UserConfigParams::m_height);
switch ((int)UserConfigParams::m_antialiasing)
{
if(UserConfigParams::logMisc())
Log::verbose("irr_driver", "Trying to create device with "
"%i bits\n", bits);
SIrrlichtCreationParameters params;
params.DriverType = type;
params.Stencilbuffer = false;
params.Bits = bits;
params.EventReceiver = this;
params.Fullscreen = UserConfigParams::m_fullscreen;
params.Vsync = UserConfigParams::m_vsync;
params.WindowSize =
core::dimension2du(UserConfigParams::m_width,
UserConfigParams::m_height);
switch ((int)UserConfigParams::m_antialiasing)
{
case 0:
break;
case 1:
params.AntiAlias = 2;
break;
case 2:
params.AntiAlias = 4;
break;
case 3:
params.AntiAlias = 8;
break;
default:
Log::error("irr_driver",
"[IrrDriver] WARNING: Invalid value for "
"anti-alias setting : %i\n",
(int)UserConfigParams::m_antialiasing);
}
case 0:
break;
case 1:
params.AntiAlias = 2;
break;
case 2:
params.AntiAlias = 4;
break;
case 3:
params.AntiAlias = 8;
break;
default:
Log::error("irr_driver",
"[IrrDriver] WARNING: Invalid value for "
"anti-alias setting : %i\n",
(int)UserConfigParams::m_antialiasing);
}
} // for bits=32, 24, 16
m_device = createDeviceEx(params);
if(m_device) break;
} // for bits=32, 24, 16
if(m_device) break;
} // for edt_types
m_device = createDeviceEx(params);
// if still no device, try with a standard 800x600 window size, maybe
// size is the problem
@ -478,53 +458,6 @@ void IrrDriver::initDevice()
m_pointer_shown = true;
} // initDevice
//-----------------------------------------------------------------------------
video::E_DRIVER_TYPE IrrDriver::getEngineDriverType( int index )
{
video::E_DRIVER_TYPE type;
std::string rendererName = "";
// Choose the driver type.
switch(index)
{
// TODO Change default renderer dependen on operating system?
// Direct3D9 for Windows and OpenGL for Unix like systems?
case 0:
type = video::EDT_OPENGL;
rendererName = "OpenGL";
break;
case 1:
type = video::EDT_OPENGL;
rendererName = "OpenGL";
break;
case 2:
type = video::EDT_DIRECT3D9;
rendererName = "Direct3D9";
break;
case 3:
type = video::EDT_DIRECT3D8;
rendererName = "Direct3D8";
break;
case 4:
type = video::EDT_SOFTWARE;
rendererName = "Software";
break;
case 5:
type = video::EDT_BURNINGSVIDEO;
rendererName = "Burning's Video Software";
break;
default:
type = video::EDT_NULL;
rendererName = "Null Device";
}
// Ouput which render will be tried.
Log::verbose("irr_driver", "Trying %s rendering.", rendererName.c_str());
return type;
}
//-----------------------------------------------------------------------------
void IrrDriver::showPointer()
{

View File

@ -99,7 +99,6 @@ private:
std::vector<VideoMode> m_modes;
void setupViewports();
video::E_DRIVER_TYPE getEngineDriverType(int index);
/** Whether the mouse cursor is currently shown */
bool m_pointer_shown;

View File

@ -374,10 +374,6 @@ void cmdLineHelp (char* invocation)
" -v, --version Show version of SuperTuxKart.\n"
" --trackdir DIR A directory from which additional tracks are "
"loaded.\n"
" --renderer NUM Choose the renderer. Valid renderers are:\n"
" Default: 0, OpenGL: 1, Direct3D9: 2, \n"
" Direct3D8: 3, Software: 4, \n"
" Burning's Software: 5, Null device: 6\n"
" --animations=n Play karts' animations (All: 2, Humans only: 1,"
" Nobody: 0).\n"
" --gfx=n Play other graphical effects like impact stars "
@ -544,12 +540,6 @@ int handleCmdLinePreliminary(int argc, char **argv)
UserConfigParams::m_fullscreen = false;
}
#endif
else if( !strcmp(argv[i], "--renderer") && (i+1 < argc) )
{
Log::verbose("main", "You chose renderer %i\n", atoi(argv[i+1]));
UserConfigParams::m_renderer = atoi(argv[i+1]);
i++;
}
else if ( (!strcmp(argv[i], "--screensize") || !strcmp(argv[i], "-s") )
&& i+1<argc)
{
@ -1037,7 +1027,6 @@ int handleCmdLine(int argc, char **argv)
else if( !strcmp(argv[i], "--stk-config")&& i+1<argc ) { i++; }
else if( !strcmp(argv[i], "--trackdir") && i+1<argc ) { i++; }
else if( !strcmp(argv[i], "--kartdir") && i+1<argc ) { i++; }
else if( !strcmp(argv[i], "--renderer") && i+1<argc ) { i++; }
else if( !strcmp(argv[i], "--debug=memory" ) ) {}
else if( !strcmp(argv[i], "--debug=addons" ) ) {}
else if( !strcmp(argv[i], "--debug=gui" ) ) {}