unoplatform/uno · error · Exception
Program link failed: {infoLog}
Error message
Program link failed: {infoLog} What it means
CreateProgram in IntegerTexturesGlCanvasElement links the integer-texture sample's shaders and throws the info log on link failure. Because the fragment shader writes to integer render targets (`layout(location=0) out uvec4`), link failures often come from integer-output or integer-sampler interface mismatches.
Source
Thrown at src/SamplesApp/SamplesApp.Samples/Windows_UI_Composition/IntegerTexturesGlCanvasElement.cs:251
gl.BindVertexArray(_quadVao);
gl.DrawArrays(PrimitiveType.Triangles, 0, 6);
gl.ActiveTexture(TextureUnit.Texture0);
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 offending output/sampler.
- Match fragment output types to the framebuffer's integer color attachment types.
- Use usampler2D/isampler2D only with integer-format textures, and sampler2D only with normalized formats.
- Target #version 300 es / GL 330+ for integer fragment outputs.
Example fix
// before — integer output to a float FBO, or float sampler on integer tex out vec4 fragColor; // mismatched with RGBA32UI attachment uniform sampler2D uTex; // mismatched with RGBA32UI texture // after layout(location=0) out uvec4 fragColor; uniform usampler2D uTex;
Defensive patterns
Strategy: validation
Validate before calling
// Ensure fragment output types match the integer framebuffer attachment
if (!fragmentSource.Contains("uvec4") && !fragmentSource.Contains("ivec4"))
throw new InvalidOperationException("Integer FBO requires integer fragment outputs (uvec4/ivec4)."); Try / catch
try { return CreateProgram(gl, vert, frag); }
catch (Exception ex) { Log.Error($"IntegerTextures link failed: {ex.Message}"); throw; } Prevention
- Match fragment output types (uvec4/ivec4) to the integer color attachment format.
- Use usampler2D/isampler2D only with integer-format textures.
- Keep #version 300 es / GL 330 for integer fragment outputs.
When it happens
Trigger: Fragment output declared `uvec4`/`ivec4` but the framebuffer attachment is a float texture (or vice-versa); usampler2D declared but the bound texture isn't integer format; varying mismatch between stages; #version too low for integer fragment outputs.
Common situations: Mixing integer fragment outputs with a non-integer FBO; ES2/WebGL1 context lacking integer render targets; sampler type (sampler2D vs usampler2D) not matching the texture's internal format.
Related errors
- {type} compile failed: {infoLog}
- Program link failed: {infoLog}
- Program link failed: {infoLog}
- {type} compile failed: {infoLog}
- {type} compile failed: {infoLog}
AI-assisted analysis of unoplatform/uno@0418340488 (2026-08-13).
Data as JSON: /api/errors/760d67e62f5a758c.
Report an issue: GitHub.