Hi,
I have a very simple vertex / fragment shader:
#version 330
uniform mat4 view_proj_matrix;
layout(location = 0) in vec2 in_vertex;
layout(location = 1) in vec2 in_tex_coord;
layout(location = 2) in vec4 in_colour;
out Data {
vec4 colour;
vec2 tex_coord;
} DataOut;
void main(void) {
gl_Position = view_proj_matrix * vec4(in_vertex, 0, 1);
DataOut.colour = in_colour;
DataOut.tex_coord = in_tex_coord;
}
#version 330
uniform sampler2D tex;
uniform bool use_override_colour;
uniform vec3 override_colour;
in Data {
vec4 colour;
vec2 tex_coord;
} DataIn;
out vec4 frag_colour;
void main(void) {
vec4 tex_colour = texture(tex, DataIn.tex_coord);
if (use_override_colour) {
frag_colour = vec4(override_colour.r, override_colour.g, override_colour.b, tex_colour.a);
} else {
frag_colour = DataIn.colour * tex_colour;
}
}
On Windows all is fine, but on MacOS I get an error after validating the program, with an empty error log, e.g. "Error validating shader program: ".
public Builder linkAndValidate() throws ShaderException {
glLinkProgram(programId);
int success = glGetProgrami(programId, GL_LINK_STATUS);
if (success != GL_TRUE) {
glDeleteProgram(programId);
throw new ShaderException("Error linking shader program: "
+ glGetProgramInfoLog(programId));
}
// Now that we have our program, we can safely delete the shader
// objects
glDeleteShader(vsId);
glDeleteShader(fsId);
glValidateProgram(programId);
success = glGetProgrami(programId, GL_VALIDATE_STATUS);
if (success != GL_TRUE) {
glDeleteProgram(programId);
throw new ShaderException("Error validating shader program: "
+ glGetProgramInfoLog(programId));
}
return this;
}
I am not sure how to debug this further given I have no information about why it failed. Does anyone have any suggestions?
Thanks,
Dan