Merge pull request #2217 from ts-korhonen/qt-opengl

qt: Fix shaders on HD4000/4400
This commit is contained in:
Miran Grča
2022-03-13 01:01:43 +01:00
committed by GitHub

View File

@@ -14,6 +14,7 @@
* Copyright 2022 Teemu Korhonen
*/
#include <QByteArray>
#include <QFile>
#include <QRegularExpression>
#include <QStringBuilder>
@@ -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';
}
@@ -144,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);