Disable texture compression on Intel

This commit is contained in:
Vincent Lejeune 2014-11-29 01:27:54 +01:00
parent 53bc15ad50
commit 7a92a4a8ef
4 changed files with 19 additions and 7 deletions

View File

@ -494,10 +494,16 @@ void IrrDriver::initDevice()
m_need_rh_workaround = false;
m_need_srgb_workaround = false;
m_support_sdsm = true;
m_support_texture_compression = true;
#ifdef WIN32
// Fix for Intel Sandy Bridge on Windows which supports GL up to 3.1 only
if (strstr((const char *)glGetString(GL_VENDOR), "Intel") != NULL && (m_gl_major_version == 3 && m_gl_minor_version == 1))
m_need_ubo_workaround = true;
if (strstr((const char *)glGetString(GL_VENDOR), "Intel") != NULL)
{
// Intel on windows doesnt support srgb compressed textures properly
m_support_texture_compression = false;
// Fix for Intel Sandy Bridge on Windows which supports GL up to 3.1 only
if (m_gl_major_version == 3 && m_gl_minor_version == 1)
m_need_ubo_workaround = true;
}
#endif
// Fix for Nvidia and instanced RH
if (strstr((const char *)glGetString(GL_VENDOR), "NVIDIA") != NULL)

View File

@ -192,6 +192,7 @@ private:
bool hasTextureStorage;
bool hasTextureView;
bool m_support_sdsm;
bool m_support_texture_compression;
bool m_need_ubo_workaround;
bool m_need_rh_workaround;
bool m_need_srgb_workaround;
@ -285,6 +286,11 @@ public:
return m_support_sdsm;
}
bool usesTextureCompression() const
{
return UserConfigParams::m_texture_compression && m_support_texture_compression;
}
bool needUBOWorkaround() const
{
return m_need_ubo_workaround;

View File

@ -414,7 +414,7 @@ GLuint generateCubeMapFromTextures(const std::vector<video::ITexture *> &texture
}
glBindTexture(GL_TEXTURE_CUBE_MAP, result);
if (UserConfigParams::m_texture_compression)
if (irr_driver->usesTextureCompression())
glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X + i, 0, GL_COMPRESSED_SRGB_ALPHA, size, size, 0, GL_BGRA, GL_UNSIGNED_BYTE, (GLvoid*)rgba[i]);
else
glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X + i, 0, GL_SRGB_ALPHA, size, size, 0, GL_BGRA, GL_UNSIGNED_BYTE, (GLvoid*)rgba[i]);

View File

@ -34,7 +34,7 @@ void compressTexture(irr::video::ITexture *tex, bool srgb, bool premul_alpha)
glBindTexture(GL_TEXTURE_2D, getTextureGLuint(tex));
std::string cached_file;
if (UserConfigParams::m_texture_compression)
if (irr_driver->usesTextureCompression())
{
// Try to retrieve the compressed texture in cache
std::string tex_name = irr_driver->getTextureName(tex);
@ -70,7 +70,7 @@ void compressTexture(irr::video::ITexture *tex, bool srgb, bool premul_alpha)
}
}
if (!UserConfigParams::m_texture_compression)
if (!irr_driver->usesTextureCompression())
{
if (srgb)
internalFormat = (tex->hasAlpha()) ? GL_SRGB_ALPHA : GL_SRGB;
@ -88,7 +88,7 @@ void compressTexture(irr::video::ITexture *tex, bool srgb, bool premul_alpha)
glGenerateMipmap(GL_TEXTURE_2D);
delete[] data;
if (UserConfigParams::m_texture_compression && !cached_file.empty())
if (irr_driver->usesTextureCompression() && !cached_file.empty())
{
// Save the compressed texture in the cache for later use.
saveCompressedTexture(cached_file);