0

I've taken all care to disable the ANGLE layer in my Qt app, but apparently it's not happening. When I run the app in the CodeXL debugger, the event log contains lines like:

DLL Loaded: C:\Windows\SysWOW64\d3d11.dll

So it's loading Direct3D, which in Qt only happens via ANGLE I think. Also hitting the "Break" button in CodeXL does nothing, which to me means that no real OpenGL calls are happening, they're getting translated to D3D only.

The event log also says this:

Debug String: Failed to load opengl32.dll (The specified module could not be found.)

Why might that happen, how can I fix it?

The reason I want to disable ANGLE is because otherwise I can't debug with CodeXL (it doesn't support D3D debugging).

My system:

  • Windows 10
  • First GPU: Intel HD Graphics 5500
  • Second GPU: AMD Radeon R5 M330 (I think this is the one my app uses)

My code:

main.cpp:

#include <QGuiApplication>
#include <QQmlApplicationEngine>
#include <QQuickFramebufferObject>
#include <QOpenGLShaderProgram>
#include <QOpenGLFramebufferObject>
#include <QQuickWindow>

class MyItem : public QQuickFramebufferObject {
    Q_OBJECT

public:
    Renderer* createRenderer() const;
};

class MyItemRenderer : public QQuickFramebufferObject::Renderer {
public:
    void render() {
        update();
    }

    QOpenGLFramebufferObject* createFramebufferObject(const QSize &size) {
        QOpenGLFramebufferObjectFormat format;
        format.setAttachment(QOpenGLFramebufferObject::CombinedDepthStencil);
        return new QOpenGLFramebufferObject(size, format);
    }
};

QQuickFramebufferObject::Renderer* MyItem::createRenderer() const {
    return new MyItemRenderer();
}

int main(int argc, char **argv) {
    qputenv("QT_OPENGL_BUGLIST", "Z:/disable_angle.txt");
    QGuiApplication::setAttribute(Qt::AA_UseDesktopOpenGL);

    QGuiApplication app(argc, argv);

    qmlRegisterType<MyItem>("MyItem", 1, 0, "MyItem");

    QQmlApplicationEngine engine;
    engine.load(QUrl(QStringLiteral("qrc:/main.qml")));

    return app.exec();
}

#include "main.moc"

main.qml:

import QtQuick 2.0

import MyItem 1.0
import QtQuick.Window 2.2

Window {
    visible: true
    width: 400
    height: 400

    MyItem {
        anchors.fill: parent
    }
}

Z:/disable_angle.txt:

{
    "entries": [
        {
          "id": 1,
          "description": "Disable angle",
          "os": {
            "type": "win"
          },
          "features": [
            "disable_angle"
          ]
        }
    ]
}
Stefan Monov
  • 11,332
  • 10
  • 63
  • 120

2 Answers2

0
  1. Set QT_LOGGING_RULES environment variable to 'qt.qpa.gl=true'. Thus, you will see some additional debug output that will help to understand what exactly Qt chooses (opengl/angle/software).

  2. Try changing Z:/disable_angle.txt to Z:\disable_angle.txt Note the backslash :) It's Windows, so this may be the culprit.

  3. Apart from disable_angle (your config seems correct to me), try also setting disable_d3d11 and disable_d3d9.

    "disable_angle", "disable_d3d11", "disable_d3d9"

Dalamber
  • 1,009
  • 1
  • 12
  • 32
0

If you want to completely disable Angle, you should set the application attribute Qt::AA_UseDesktopOpenGL. If this is not enough, linking against OpenGL32.lib might help.

Bim
  • 1,008
  • 1
  • 10
  • 29