Disable DSA on Radeon

Try to prevent crashes on Windows and broken textures on Linux.

Task-number: QTBUG-40653
Task-number: QTBUG-44988
Change-Id: I1fd259ba5ca3980c3087411e1dae1ae56bb2c2e4
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
This commit is contained in:
Laszlo Agocs 2015-03-13 14:33:47 +01:00
parent dc6d353a29
commit 12e88e486b

View File

@ -40,8 +40,16 @@ QT_BEGIN_NAMESPACE
QOpenGLTextureHelper::QOpenGLTextureHelper(QOpenGLContext *context)
{
// Resolve EXT_direct_state_access entry points if present
if (!context->isOpenGLES()
// Resolve EXT_direct_state_access entry points if present.
// However, disable it on some systems where DSA is known to be unreliable.
bool allowDSA = true;
const char *renderer = reinterpret_cast<const char *>(context->functions()->glGetString(GL_RENDERER));
// QTBUG-40653, QTBUG-44988
if (renderer && strstr(renderer, "AMD Radeon HD"))
allowDSA = false;
if (allowDSA && !context->isOpenGLES()
&& context->hasExtension(QByteArrayLiteral("GL_EXT_direct_state_access"))) {
TextureParameteriEXT = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLuint , GLenum , GLenum , GLint )>(context->getProcAddress(QByteArrayLiteral("glTextureParameteriEXT")));
TextureParameterivEXT = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLuint , GLenum , GLenum , const GLint *)>(context->getProcAddress(QByteArrayLiteral("glTextureParameterivEXT")));