From 105fe47bf3f5e3fb0ed8e693fabcbec8bbbe4194 Mon Sep 17 00:00:00 2001 From: ts-korhonen Date: Sat, 12 Mar 2022 15:38:44 +0200 Subject: [PATCH 1/2] qt: GL core; use safe version of strcpy --- src/qt/qt_opengloptions.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/qt/qt_opengloptions.cpp b/src/qt/qt_opengloptions.cpp index 04ca16234..c18eaaedb 100644 --- a/src/qt/qt_opengloptions.cpp +++ b/src/qt/qt_opengloptions.cpp @@ -14,6 +14,7 @@ * Copyright 2022 Teemu Korhonen */ +#include #include #include #include @@ -89,7 +90,7 @@ OpenGLOptions::save() const auto path = m_shaders.first().path().toLocal8Bit(); if (!path.isEmpty()) - strcpy(video_shader, path.constData()); + qstrncpy(video_shader, path.constData(), sizeof(video_shader)); else video_shader[0] = '\0'; } From b1eeef7527d262cee2614a3d77a756cdfff90d1f Mon Sep 17 00:00:00 2001 From: ts-korhonen Date: Sat, 12 Mar 2022 15:39:39 +0200 Subject: [PATCH 2/2] qt: Remove pragma parameters from shaders. Fixes Intel HD4000 crashing on windows when selecting shaders, probably also fixes Intel HD4400 shader errors. --- src/qt/qt_opengloptions.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/qt/qt_opengloptions.cpp b/src/qt/qt_opengloptions.cpp index c18eaaedb..f90ba37c0 100644 --- a/src/qt/qt_opengloptions.cpp +++ b/src/qt/qt_opengloptions.cpp @@ -145,6 +145,9 @@ OpenGLOptions::addShader(const QString &path) shader_file.close(); + /* Remove parameter lines */ + shader_text.remove(QRegularExpression("^\\s*#pragma parameter.*?\\n", QRegularExpression::MultilineOption)); + QRegularExpression version("^\\s*(#version\\s+\\w+)", QRegularExpression::MultilineOption); auto match = version.match(shader_text);