Merge remote-tracking branch 'origin/master' into i18n

This commit is contained in:
Benau 2015-12-14 03:00:07 +08:00
commit 9d1c9fac5a
9 changed files with 75 additions and 32 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

@ -653,11 +653,11 @@ bool CIrrDeviceLinux::createWindow()
GLX_SAMPLE_BUFFERS_SGIS, 1,
GLX_SAMPLES_SGIS, CreationParams.AntiAlias, // 18,19
#endif
//#ifdef GL_ARB_framebuffer_sRGB
// GLX_FRAMEBUFFER_SRGB_CAPABLE_ARB, CreationParams.HandleSRGB,
//#elif defined(GL_EXT_framebuffer_sRGB)
// GLX_FRAMEBUFFER_SRGB_CAPABLE_EXT, CreationParams.HandleSRGB,
//#endif
#ifdef GLX_ARB_framebuffer_sRGB
GLX_FRAMEBUFFER_SRGB_CAPABLE_ARB, CreationParams.HandleSRGB,
#elif defined(GLX_EXT_framebuffer_sRGB)
GLX_FRAMEBUFFER_SRGB_CAPABLE_EXT, CreationParams.HandleSRGB,
#endif
GLX_STEREO, CreationParams.Stereobuffer?True:False,
None
};
@ -804,11 +804,11 @@ bool CIrrDeviceLinux::createWindow()
// GLX_USE_GL, which is silently ignored by glXChooseVisual
CreationParams.Doublebuffer?GLX_DOUBLEBUFFER:GLX_USE_GL, // 14
CreationParams.Stereobuffer?GLX_STEREO:GLX_USE_GL, // 15
//#ifdef GL_ARB_framebuffer_sRGB
// CreationParams.HandleSRGB?GLX_FRAMEBUFFER_SRGB_CAPABLE_ARB:GLX_USE_GL,
//#elif defined(GL_EXT_framebuffer_sRGB)
// CreationParams.HandleSRGB?GLX_FRAMEBUFFER_SRGB_CAPABLE_EXT:GLX_USE_GL,
//#endif
#ifdef GLX_ARB_framebuffer_sRGB
CreationParams.HandleSRGB?GLX_FRAMEBUFFER_SRGB_CAPABLE_ARB:GLX_USE_GL,
#elif defined(GLX_EXT_framebuffer_sRGB)
CreationParams.HandleSRGB?GLX_FRAMEBUFFER_SRGB_CAPABLE_EXT:GLX_USE_GL,
#endif
None
};

View File

@ -805,13 +805,15 @@ bool COpenGLDriver::genericDriverInit()
Params.HandleSRGB &= ((FeatureAvailable[IRR_ARB_framebuffer_sRGB] || FeatureAvailable[IRR_EXT_framebuffer_sRGB]) &&
FeatureAvailable[IRR_EXT_texture_sRGB]);
#if defined(GL_ARB_framebuffer_sRGB)
if (Params.HandleSRGB)
glEnable(GL_FRAMEBUFFER_SRGB);
#elif defined(GL_EXT_framebuffer_sRGB)
if (Params.HandleSRGB)
glEnable(GL_FRAMEBUFFER_SRGB_EXT);
#endif
glDisable(GL_FRAMEBUFFER_SRGB);
//#if defined(GL_ARB_framebuffer_sRGB)
// if (Params.HandleSRGB)
// glEnable(GL_FRAMEBUFFER_SRGB);
//#elif defined(GL_EXT_framebuffer_sRGB)
// if (Params.HandleSRGB)
// glEnable(GL_FRAMEBUFFER_SRGB_EXT);
//#endif
// This is a fast replacement for NORMALIZE_NORMALS
// if ((Version>101) || FeatureAvailable[IRR_EXT_rescale_normal])

View File

@ -274,15 +274,15 @@ GLint COpenGLTexture::getOpenGLFormatAndParametersFromColorFormat(ECOLOR_FORMAT
internalformat = GL_RGBA8;
}
}
#if defined(GL_ARB_framebuffer_sRGB) || defined(GL_EXT_framebuffer_sRGB)
if (Driver->Params.HandleSRGB)
{
if (internalformat==GL_RGBA)
internalformat=GL_SRGB_ALPHA_EXT;
else if (internalformat==GL_RGB)
internalformat=GL_SRGB_EXT;
}
#endif
//#if defined(GL_ARB_framebuffer_sRGB) || defined(GL_EXT_framebuffer_sRGB)
// if (Driver->Params.HandleSRGB)
// {
// if (internalformat==GL_RGBA)
// internalformat=GL_SRGB_ALPHA_EXT;
// else if (internalformat==GL_RGB)
// internalformat=GL_SRGB_EXT;
// }
//#endif
return internalformat;
}

View File

@ -46,6 +46,7 @@ void CentralVideoSettings::init()
hasTextureCompression = false;
hasUBO = false;
hasGS = false;
hasSRGBCapableVisual = false;
m_GI_has_artifact = false;
m_need_rh_workaround = false;
@ -179,6 +180,12 @@ void CentralVideoSettings::init()
// Bindless textures are all treated RGB even sRGB one
m_need_srgb_workaround = true;
}
// Check if visual is sRGB-capable
GLint param;
glGetFramebufferAttachmentParameteriv(GL_DRAW_FRAMEBUFFER, GL_BACK_LEFT,
GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING, &param);
hasSRGBCapableVisual = (param == GL_SRGB);
}
}
@ -207,6 +214,11 @@ bool CentralVideoSettings::needsRGBBindlessWorkaround() const
return m_need_srgb_workaround;
}
bool CentralVideoSettings::needsSRGBCapableVisualWorkaround() const
{
return !hasSRGBCapableVisual && GraphicsRestrictions::isDisabled(GraphicsRestrictions::GR_FRAMEBUFFER_SRGB_CAPABLE);
}
bool CentralVideoSettings::isARBGeometryShader4Usable() const
{
return hasGS;

View File

@ -40,6 +40,7 @@ private:
bool hasSSBO;
bool hasImageLoadStore;
bool hasMultiDrawIndirect;
bool hasSRGBCapableVisual;
bool m_need_rh_workaround;
bool m_need_srgb_workaround;
@ -52,6 +53,7 @@ public:
// Needs special handle ?
bool needRHWorkaround() const;
bool needsRGBBindlessWorkaround() const;
bool needsSRGBCapableVisualWorkaround() const;
// Extension is available and safe to use
bool isARBUniformBufferObjectUsable() const;

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);
@ -449,7 +450,8 @@ void IrrDriver::initDevice()
params.WindowSize =
core::dimension2du(UserConfigParams::m_width,
UserConfigParams::m_height);
params.HandleSRGB = true;
/*
switch ((int)UserConfigParams::m_antialiasing)
{
@ -507,6 +509,30 @@ 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. It affects mesa 10.6 and newer.
// Though we are able to force to use the proper format on mesa side by
// setting WithAlphaChannel parameter.
if (!ProfileWorld::isNoGraphics() && CVS->needsSRGBCapableVisualWorkaround())
{
Log::warn("irr_driver", "Created visual is not sRGB-capable. "
"Re-creating device to workaround the issue.");
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();
@ -515,15 +541,13 @@ 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 &&
(UserConfigParams::m_shadows_resolution < 512 ||
UserConfigParams::m_shadows_resolution > 2048))
{
Log::warn("IrrDriver",
Log::warn("irr_driver",
"Invalid value for UserConfigParams::m_shadows_resolution : %i",
(int)UserConfigParams::m_shadows_resolution);
UserConfigParams::m_shadows_resolution = 0;
@ -2074,7 +2098,7 @@ void IrrDriver::doScreenShot()
video::IImage* image = m_video_driver->createScreenShot();
if(!image)
{
Log::error("IrrDriver", "Could not create screen shot.");
Log::error("irr_driver", "Could not create screen shot.");
return;
}