Skip to content
This repository was archived by the owner on Sep 10, 2023. It is now read-only.

Commit c587418

Browse files
committed
Only link shaders after compiling vertex shaders
This fixes a linking error that seems to affect machines with integrated graphics
1 parent fa2ec07 commit c587418

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

src/display/rb_shader.cpp

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -101,14 +101,18 @@ void CompiledShader::compileShader(const char *contents, GLuint shader, GLuint p
101101
gl.BindAttribLocation(program, TexCoord, "texCoord");
102102
gl.BindAttribLocation(program, Color, "color");
103103

104-
gl.LinkProgram(program);
105-
106-
gl.GetProgramiv(program, GL_LINK_STATUS, &success);
107-
108-
if (!success)
109-
{
110-
rb_raise(rb_eRuntimeError, "Shader linking failed with: \n%s", getShaderLog(program).c_str());
111-
return;
104+
// This conditional assumes that vertex shaders are handled after fragment shaders.
105+
// Alternatively, one may call LinkProgram() and do the error checking in every place where this compileShader()
106+
// method is called.
107+
if (vert) {
108+
gl.LinkProgram(program);
109+
gl.GetProgramiv(program, GL_LINK_STATUS, &success);
110+
111+
if (!success)
112+
{
113+
rb_raise(rb_eRuntimeError, "Shader linking failed with: \n%s", getShaderLog(program).c_str());
114+
return;
115+
}
112116
}
113117
}
114118

0 commit comments

Comments
 (0)