removed version macros from shaders and add automatically in compile step
This commit is contained in:
@@ -82,9 +82,7 @@ ShaderCode MathNodeBase::GetShaderCodeInternal(const QString &shader_id, NodeInp
|
||||
GetShaderVariableCall(param_b_in->id(), type_b));
|
||||
}
|
||||
|
||||
frag = QStringLiteral("#version 150\n"
|
||||
"\n"
|
||||
"uniform %1 %3;\n"
|
||||
frag = QStringLiteral("uniform %1 %3;\n"
|
||||
"uniform %2 %4;\n"
|
||||
"\n"
|
||||
"in vec2 ove_texcoord;\n"
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
#version 150
|
||||
|
||||
uniform sampler2D base_in;
|
||||
uniform sampler2D blend_in;
|
||||
uniform bool base_in_enabled;
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
#version 150
|
||||
|
||||
uniform sampler2D tex_in;
|
||||
uniform int method_in;
|
||||
uniform float radius_in;
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
#version 150
|
||||
|
||||
// Inputs
|
||||
uniform int orientation;
|
||||
uniform vec3 color_a;
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
#version 150
|
||||
|
||||
// Custom inputs
|
||||
uniform float hsv_value;
|
||||
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
#version 150
|
||||
|
||||
#define LINEAR_CURVE 0
|
||||
#define EXPONENTIAL_CURVE 1
|
||||
#define LOGARITHMIC_CURVE 2
|
||||
|
||||
@@ -1,10 +1,3 @@
|
||||
#version 150
|
||||
|
||||
#ifdef GL_ES
|
||||
precision highp int;
|
||||
precision highp float;
|
||||
#endif
|
||||
|
||||
// Input texture
|
||||
uniform sampler2D ove_maintex;
|
||||
|
||||
|
||||
@@ -1,10 +1,3 @@
|
||||
#version 150
|
||||
|
||||
#ifdef GL_ES
|
||||
precision highp int;
|
||||
precision highp float;
|
||||
#endif
|
||||
|
||||
uniform mat4 ove_mvpmat;
|
||||
|
||||
in vec4 a_position;
|
||||
|
||||
@@ -1,10 +1,3 @@
|
||||
#version 150
|
||||
|
||||
#ifdef GL_ES
|
||||
precision highp int;
|
||||
precision highp float;
|
||||
#endif
|
||||
|
||||
uniform sampler2D ove_maintex;
|
||||
uniform vec2 ove_resolution;
|
||||
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
#version 150
|
||||
|
||||
uniform sampler2D out_block_in;
|
||||
uniform sampler2D in_block_in;
|
||||
uniform bool out_block_in_enabled;
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
#version 150
|
||||
|
||||
uniform mat4 %1;
|
||||
|
||||
uniform vec2 %2_resolution;
|
||||
|
||||
@@ -1,10 +1,3 @@
|
||||
#version 150
|
||||
|
||||
#ifdef GL_ES
|
||||
precision highp int;
|
||||
precision highp float;
|
||||
#endif
|
||||
|
||||
// Input texture
|
||||
uniform sampler2D tex_in;
|
||||
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
#version 150
|
||||
|
||||
uniform vec2[256] points_in;
|
||||
uniform int points_in_count;
|
||||
uniform vec4 color_in;
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
#version 150
|
||||
|
||||
uniform sampler2D ove_maintex;
|
||||
uniform vec2 viewport;
|
||||
uniform float histogram_scale;
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
#version 150
|
||||
|
||||
uniform float histogram_scale;
|
||||
|
||||
in vec4 a_position;
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
#version 150
|
||||
|
||||
uniform sampler2D ove_maintex;
|
||||
uniform vec2 viewport;
|
||||
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
#version 150
|
||||
|
||||
uniform sampler2D ove_maintex;
|
||||
|
||||
uniform vec2 viewport;
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
#version 150
|
||||
|
||||
uniform float waveform_scale;
|
||||
uniform vec2 ove_resolution;
|
||||
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
#version 150
|
||||
|
||||
uniform vec4 color_in;
|
||||
|
||||
out vec4 fragColor;
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
#version 150
|
||||
|
||||
// Node parameter inputs
|
||||
uniform sampler2D tex_in;
|
||||
uniform vec4 color_in;
|
||||
|
||||
Reference in New Issue
Block a user