From 0ad1d2c9652e185dc8f5b07f90419babbd2416ab Mon Sep 17 00:00:00 2001 From: John Preston Date: Sat, 17 Jul 2021 12:43:35 +0300 Subject: [PATCH] Check shader compiling/linking in detection. --- ui/gl/gl_detection.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/ui/gl/gl_detection.cpp b/ui/gl/gl_detection.cpp index 195f2bc..10a47ed 100644 --- a/ui/gl/gl_detection.cpp +++ b/ui/gl/gl_detection.cpp @@ -6,6 +6,7 @@ // #include "ui/gl/gl_detection.h" +#include "ui/gl/gl_shader.h" #include "ui/integration.h" #include "base/debug_log.h" @@ -87,6 +88,22 @@ Capabilities CheckCapabilities(QWidget *widget) { LOG_ONCE(("OpenGL: Shaders not supported.")); return {}; } + { + auto program = QOpenGLShaderProgram(); + LinkProgram( + &program, + VertexShader({ + VertexViewportTransform(), + VertexPassTextureCoord(), + }), + FragmentShader({ + FragmentSampleARGB32Texture(), + })); + if (!program.isLinked()) { + LOG_ONCE(("OpenGL: Could not link simple shader.")); + return {}; + } + } const auto supported = context->format(); switch (supported.profile()) { case QSurfaceFormat::NoProfile: {