unoplatform/uno · error · Exception
Program link failed: {infoLog}
Error message
Program link failed: {infoLog} What it means
CreateProgram in IntAttribsBlendGlCanvasElement links compiled vertex/fragment shaders and throws the program info log if LinkStatus != True. This instancing+blend sample uses integer vertex attributes, so link failures commonly stem from integer-attribute or instancing feature gaps in the active GLSL profile.
Source
Thrown at src/SamplesApp/SamplesApp.Samples/Windows_UI_Composition/IntAttribsBlendGlCanvasElement.cs:247
gl.Disable(EnableCap.Blend);
gl.BlendEquationSeparate(BlendEquationModeEXT.FuncAdd, BlendEquationModeEXT.FuncAdd);
gl.SampleCoverage(1f, false);
Invalidate();
}
private static uint CreateProgram(GL gl, string vertexSource, string fragmentSource)
{
var vs = CompileShader(gl, ShaderType.VertexShader, vertexSource);
var fs = CompileShader(gl, ShaderType.FragmentShader, fragmentSource);
var prog = gl.CreateProgram();
gl.AttachShader(prog, vs);
gl.AttachShader(prog, fs);
gl.LinkProgram(prog);
gl.GetProgram(prog, ProgramPropertyARB.LinkStatus, out int linkStatus);
if (linkStatus != (int)GLEnum.True)
{
throw new Exception("Program link failed: " + gl.GetProgramInfoLog(prog));
}
gl.DetachShader(prog, vs);
gl.DetachShader(prog, fs);
gl.DeleteShader(vs);
gl.DeleteShader(fs);
return prog;
}
private static uint CompileShader(GL gl, ShaderType type, string source)
{
var sh = gl.CreateShader(type);
gl.ShaderSource(sh, source);
gl.CompileShader(sh);
gl.GetShader(sh, ShaderParameterName.CompileStatus, out int status);
if (status != (int)GLEnum.True)
{
throw new Exception($"{type} compile failed: " + gl.GetShaderInfoLog(sh));
}View on GitHub (pinned to 0418340488)
Solutions
- Read the info log for the unresolved symbol or attribute.
- Use #version 300 es / GL 330+ for integer attributes and instancing.
- Match integer `out`/`in` varyings exactly between vertex and fragment.
- Avoid reading an integer varying as float in the fragment stage.
Example fix
// before — integer attribute declared under ES2 #version 100 attribute ivec4 aCell; // unsupported → link fail // after #version 300 es layout(location = 1) in ivec4 aCell;
Defensive patterns
Strategy: validation
Validate before calling
gl.GetInteger(GetPName.MajorVersion, out int major);
if (major < 3) throw new InvalidOperationException("Integer-attribute linking requires GL/ES 3.0+ (WebGL2)."); Try / catch
try { return CreateProgram(gl, vert, frag); }
catch (Exception ex) { Log.Error($"IntAttribs link failed: {ex.Message}"); throw; } Prevention
- Declare integer varyings as `flat` on both stages.
- Keep #version 300 es / GL 330 for integer attributes and outputs.
- Sync attribute layout/location qualifiers between C# (VertexAttribIPointer) and GLSL.
When it happens
Trigger: Vertex shader declares integer attributes (`in ivec4`) under a GLSL version that doesn't support them; varying interface mismatch between stages; `layout(location=)` collision; fragment shader reading an integer varying as float; GLSL version below 300 es rejecting integer attributes.
Common situations: Sample running on WebGL1/ES2 lacking integer attributes and instancing; refactor that changed a varying type in only one stage; driver link bug for integer varyings.
Related errors
- {type} compile failed: {infoLog}
- {type} compile failed: {infoLog}
- Program link failed: {infoLog}
- {type} compile failed: {infoLog}
- Program link failed: {infoLog}
AI-assisted analysis of unoplatform/uno@0418340488 (2026-08-13).
Data as JSON: /api/errors/fd52f95444658b87.
Report an issue: GitHub.