Added ugly hack, which forces srgb-capable framebuffer creation for intel drivers on linux

This commit is contained in:
Deve 2015-12-11 00:21:26 +01:00
parent b91bcaf554
commit 80d36208f1
4 changed files with 28 additions and 4 deletions

View File

@ -4,6 +4,7 @@
<card is="Intel(R) HD Graphics 3000" os="windows" disable="AdvancedPipeline"/>
<card is="Intel(R) HD Graphics 3000" os="windows" disable="FramebufferSRGBWorking"/>
<card contains="Intel" os="osx" disable="GI"/>
<card contains="Intel" os="linux" version="<12.0" disable="FramebufferSRGBCapable"/>
<card contains="Intel" disable="TextureCompressionS3TC"/>
<card contains="Intel" os="windows" disable="HighDefinitionTextures"/>
<card contains="NVIDIA" os="windows" version="<344.65" disable="BufferStorage"/>

View File

@ -59,6 +59,7 @@ namespace GraphicsRestrictions
"HighDefinitionTextures",
"AdvancedPipeline",
"FramebufferSRGBWorking",
"FramebufferSRGBCapable",
"GI",
};
} // namespace Private

View File

@ -53,6 +53,7 @@ namespace GraphicsRestrictions
GR_HIGHDEFINITION_TEXTURES,
GR_ADVANCED_PIPELINE,
GR_FRAMEBUFFER_SRGB_WORKING,
GR_FRAMEBUFFER_SRGB_CAPABLE,
GR_GI,
GR_COUNT /** MUST be last entry. */
} ;

View File

@ -346,6 +346,8 @@ void IrrDriver::createListOfVideoModes()
*/
void IrrDriver::initDevice()
{
SIrrlichtCreationParameters params;
// If --no-graphics option was used, the null device can still be used.
if (!ProfileWorld::isNoGraphics())
{
@ -428,7 +430,6 @@ void IrrDriver::initDevice()
m_device->drop();
m_device = NULL;
SIrrlichtCreationParameters params;
params.ForceLegacyDevice = (UserConfigParams::m_force_legacy_device ||
UserConfigParams::m_gamepad_visualisation);
@ -509,6 +510,28 @@ void IrrDriver::initDevice()
Log::fatal("irr_driver", "Couldn't initialise irrlicht device. Quitting.\n");
}
CVS->init();
// This is the ugly hack for intel driver on linux, which doesn't
// use sRGB-capable visual, even if we request it. This causes
// the screen to be darker than expected. Setting WithAlphaChannel
// to true forces using the proper format on mesa side.
if (!ProfileWorld::isNoGraphics() && GraphicsRestrictions::isDisabled(
GraphicsRestrictions::GR_FRAMEBUFFER_SRGB_CAPABLE))
{
m_device->closeDevice();
m_device->drop();
params.WithAlphaChannel = true;
m_device = createDeviceEx(params);
if(!m_device)
{
Log::fatal("irr_driver", "Couldn't initialise irrlicht device. Quitting.\n");
}
}
m_scene_manager = m_device->getSceneManager();
m_gui_env = m_device->getGUIEnvironment();
m_video_driver = m_device->getVideoDriver();
@ -516,8 +539,6 @@ void IrrDriver::initDevice()
m_actual_screen_size = m_video_driver->getCurrentRenderTargetSize();
CVS->init();
m_spherical_harmonics = new SphericalHarmonics(m_scene_manager->getAmbientLight().toSColor());
if (UserConfigParams::m_shadows_resolution != 0 &&