Changed: #1275 Enable OpenGL ES driver in Ryzom client

This commit is contained in:
kervala 2012-05-13 17:14:34 +02:00
parent 0f85a895e8
commit 72b4500c84
3 changed files with 24 additions and 13 deletions

View file

@ -841,6 +841,7 @@ void CClientConfig::setValues()
if (nlstricmp(varPtr->asString(), "Auto") == 0 || nlstricmp(varPtr->asString(), "0") == 0) ClientCfg.Driver3D = CClientConfig::DrvAuto; if (nlstricmp(varPtr->asString(), "Auto") == 0 || nlstricmp(varPtr->asString(), "0") == 0) ClientCfg.Driver3D = CClientConfig::DrvAuto;
else if (nlstricmp(varPtr->asString(), "OpenGL") == 0 || nlstricmp(varPtr->asString(), "1") == 0) ClientCfg.Driver3D = CClientConfig::OpenGL; else if (nlstricmp(varPtr->asString(), "OpenGL") == 0 || nlstricmp(varPtr->asString(), "1") == 0) ClientCfg.Driver3D = CClientConfig::OpenGL;
else if (nlstricmp(varPtr->asString(), "Direct3D") == 0 || nlstricmp(varPtr->asString(), "2") == 0) ClientCfg.Driver3D = CClientConfig::Direct3D; else if (nlstricmp(varPtr->asString(), "Direct3D") == 0 || nlstricmp(varPtr->asString(), "2") == 0) ClientCfg.Driver3D = CClientConfig::Direct3D;
else if (nlstricmp(varPtr->asString(), "OpenGLES") == 0 || nlstricmp(varPtr->asString(), "3") == 0) ClientCfg.Driver3D = CClientConfig::OpenGLES;
} }
else else
cfgWarning ("Default value used for 'Driver3D' !!!"); cfgWarning ("Default value used for 'Driver3D' !!!");

View file

@ -53,7 +53,7 @@ using std::string;
//--------------------------------------------------- //---------------------------------------------------
struct CClientConfig struct CClientConfig
{ {
enum TDriver3D { DrvAuto = 0, OpenGL, Direct3D }; enum TDriver3D { DrvAuto = 0, OpenGL, Direct3D, OpenGLES };
enum TDriverSound { SoundDrvAuto = 0, SoundDrvFMod, SoundDrvOpenAL, SoundDrvDirectSound, SoundDrvXAudio2 }; enum TDriverSound { SoundDrvAuto = 0, SoundDrvFMod, SoundDrvOpenAL, SoundDrvDirectSound, SoundDrvXAudio2 };
enum TStageLCTUsage { StageUseNoLCT = 0, StageUseAllLCT, StageUsePosOnlyLCT }; enum TStageLCTUsage { StageUseNoLCT = 0, StageUseAllLCT, StageUsePosOnlyLCT };

View file

@ -819,33 +819,43 @@ void prelogInit()
nmsg = "Creating 3d driver..."; nmsg = "Creating 3d driver...";
ProgressBar.newMessage ( ClientCfg.buildLoadingString(nmsg) ); ProgressBar.newMessage ( ClientCfg.buildLoadingString(nmsg) );
bool direct3D = false; UDriver::TDriver driver = UDriver::OpenGl;
#ifdef NL_OS_WINDOWS #ifdef NL_OS_WINDOWS
uint icon = (uint)LoadIcon(HInstance, MAKEINTRESOURCE(IDI_MAIN_ICON));
#else
uint icon = 0;
#endif // NL_OS_WINDOWS
switch(ClientCfg.Driver3D) switch(ClientCfg.Driver3D)
{ {
case CClientConfig::DrvAuto: case CClientConfig::DrvAuto:
#ifdef NL_OS_WINDOWS
{ {
// Fallback to D3D for card other than nVidia // Fallback to D3D for card other than nVidia
std::string deviceName; std::string deviceName;
uint64 drvVersion; uint64 drvVersion;
CSystemInfo::getVideoInfo(deviceName, drvVersion); CSystemInfo::getVideoInfo(deviceName, drvVersion);
strlwr(deviceName); strlwr(deviceName);
direct3D = strstr(deviceName.c_str(), NVIDIA_RECOMMANDED_DRIVERS_STRING_TEST) == NULL; driver = strstr(deviceName.c_str(), NVIDIA_RECOMMANDED_DRIVERS_STRING_TEST) == NULL ? UDriver::Direct3d:UDriver::OpenGl;
} }
break; break;
case CClientConfig::OpenGL:
direct3D = false;
break;
case CClientConfig::Direct3D: case CClientConfig::Direct3D:
direct3D = true; driver = UDriver::Direct3d;
break;
#endif // NL_OS_WINDOWS
case CClientConfig::OpenGL:
driver = UDriver::OpenGl;
break;
case CClientConfig::OpenGLES:
driver = UDriver::OpenGlEs;
break;
default:
break; break;
} }
Driver = UDriver::createDriver ((uint)LoadIcon (HInstance, MAKEINTRESOURCE(IDI_MAIN_ICON)), direct3D);
#else // NL_OS_WINDOWS Driver = UDriver::createDriver(icon, driver);
Driver = UDriver::createDriver ();
#endif // NL_OS_WINDOWS
if(Driver == NULL) if(Driver == NULL)
{ {
ExitClientError (CI18N::get ("Can_t_load_the_display_driver").toUtf8().c_str ()); ExitClientError (CI18N::get ("Can_t_load_the_display_driver").toUtf8().c_str ());
@ -1111,7 +1121,7 @@ void prelogInit()
CBloomEffect::getInstance().setDriver(Driver); CBloomEffect::getInstance().setDriver(Driver);
// init bloom effect // init bloom effect
CBloomEffect::getInstance().init(!direct3D); CBloomEffect::getInstance().init(driver != UDriver::Direct3d);
nlinfo ("PROFILE: %d seconds for prelogInit", (uint32)(ryzomGetLocalTime ()-initStart)/1000); nlinfo ("PROFILE: %d seconds for prelogInit", (uint32)(ryzomGetLocalTime ()-initStart)/1000);