Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-62070

QOpenGLDebugLogger::startLogging crashes on ANGLE

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P1: Critical
    • 5.12.4, 5.14.0 Alpha
    • 5.8.0, 5.9.1
    • GUI: OpenGL
    • None
    • This is on Windows 10, 64-bit, Qt downloaded from Website
    • c9002ab7eec1649d700865eac418f1f5d3b0d1a2 (qt/qtbase/5.12)

    Description

      The following code forces Qt to use ANGLE. It will crash in the call to logger.startLogging. If ANGLE is not used, it will run without problems:

      #include <QApplication>
      #include <QDebug>
      #include <QOffscreenSurface>
      #include <QOpenGLContext>
      #include <QOpenGLDebugLogger>
      
      int main(int argc, char **argv)
      {
          // Start application
          QApplication application{argc, argv};
          
          //force use of ANGLE:
          QCoreApplication::setAttribute(Qt::AA_UseOpenGLES);  
      
          QSurfaceFormat format;
          format.setOption(QSurfaceFormat::DebugContext);
      
          QOffscreenSurface surface;
          surface.setFormat(format);
          surface.create();
          qDebug() << surface.isValid();
      
          QOpenGLContext context;
          context.setFormat(format);
          qDebug() << context.create();
          qDebug() << context.isValid();
      
          context.makeCurrent(&surface);
      
          QOpenGLDebugLogger logger;
          qDebug() << logger.initialize();
          
          //the following call will crash if ANGLE is enabled
          logger.startLogging(QOpenGLDebugLogger::SynchronousLogging);
      
          return 0;
      }
      
      
      
      

      The problem seems to be in this code in qopengldebug.cpp:

          GET_DEBUG_PROC_ADDRESS(glDebugMessageControl);
          GET_DEBUG_PROC_ADDRESS(glDebugMessageInsert);
          GET_DEBUG_PROC_ADDRESS(glDebugMessageCallback);
          GET_DEBUG_PROC_ADDRESS(glGetDebugMessageLog);
          GET_DEBUG_PROC_ADDRESS(glPushDebugGroup);
          GET_DEBUG_PROC_ADDRESS(glPopDebugGroup);
          GET_DEBUG_PROC_ADDRESS(glGetPointerv)
      

      The code attempts to bind those functions from libGLESv2.dll. However, in the dll, these functions are all named with "KHR" at the end. For example, the dll does not export the function glGetPointerv. Instead, it exports glGetPointervKHR. Therefore all those function pointers are zero, which will cause the crash in the call to startLogging.

      So a fix would be to check if ANGLE is enabled, and add the suffix "KHR" to the function names when the QOpenGLDebugLogger is initialized.

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            peppe Giuseppe D'Angelo
            karlwolfram Karl Wolfram
            Votes:
            3 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes