removed version macros from shaders and add automatically in compile step

This commit is contained in:
itsmattkc
2020-11-19 14:36:05 +11:00
parent 8c3f0ac64e
commit dcf56781b4
22 changed files with 18 additions and 71 deletions
+16 -2
View File
@@ -199,12 +199,26 @@ QVariant OpenGLRenderer::CreateNativeShader(ShaderCode code)
{
QOpenGLShaderProgram* program = new QOpenGLShaderProgram(context_);
if (!program->addShaderFromSourceCode(QOpenGLShader::Vertex, code.vert_code())) {
QString vert_code = code.vert_code();
QString frag_code = code.frag_code();
const QString shader_preamble = QStringLiteral("#version 300 es\n"
"\n"
"#ifdef GL_ES\n"
"precision highp int;\n"
"precision highp float;\n"
"#endif\n"
"\n");
vert_code.prepend(shader_preamble);
frag_code.prepend(shader_preamble);
if (!program->addShaderFromSourceCode(QOpenGLShader::Vertex, vert_code)) {
qCritical() << "Failed to add vertex code to shader";
goto error;
}
if (!program->addShaderFromSourceCode(QOpenGLShader::Fragment, code.frag_code())) {
if (!program->addShaderFromSourceCode(QOpenGLShader::Fragment, frag_code)) {
qCritical() << "Failed to add fragment code to shader";
goto error;
}
+1 -8
View File
@@ -92,14 +92,7 @@ bool Renderer::GetColorContext(ColorProcessorPtr color_processor, Renderer::Colo
color_processor->GetProcessor()->getDefaultGPUProcessor()->extractGpuShaderInfo(shader_desc);
QString shader_frag;
shader_frag.append(QStringLiteral("#version 150\n"
"\n"
"#ifdef GL_ES\n"
"precision highp int;\n"
"precision highp float;\n"
"#endif\n"
"\n"
"// Main texture input\n"
shader_frag.append(QStringLiteral("// Main texture input\n"
"uniform sampler2D ove_maintex;\n"
"uniform int ove_maintex_alpha;\n"
"\n"