unoplatform/uno · error · Exception
{type} compile failed: {infoLog}
Error message
{type} compile failed: {infoLog} What it means
CompileShader in MRTBlitGlCanvasElement throws the shader info log when glCompileShader fails. For this MRT/MSAA sample, compile errors are usually the multi-output or blit-related GLSL constructs under a too-low shader version.
Source
Thrown at src/SamplesApp/SamplesApp.Samples/Windows_UI_Composition/MRTBlitGlCanvasElement.cs:310
{
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));
}
return sh;
}
}
}
#endif
View on GitHub (pinned to 0418340488)
Solutions
- Read the info log line/column and fix the flagged construct.
- Target #version 300 es / GL 330 for explicit MRT output locations.
- Add precision qualifiers and ES built-ins.
- Verify the shader source constant is complete.
Example fix
// before — ES2 single output, MRT needs explicit locations #version 100 gl_FragData[0] = vec4(1); // after #version 300 es precision mediump float; layout(location=0) out vec4 fragColor0; layout(location=1) out vec4 fragColor1;
Defensive patterns
Strategy: try-catch
Validate before calling
if (fragmentSource.Contains("layout(location=") && !fragmentSource.Contains("#version 300"))
throw new InvalidOperationException("Explicit MRT output locations require #version 300 es / GL 330."); Try / catch
try { return CompileShader(gl, type, source); }
catch (Exception ex) { throw new InvalidOperationException($"{type} compile failed: {ex.Message}\n{source}", ex); } Prevention
- Use #version 300 es / GL 330 for explicit MRT output locations.
- Replace gl_FragData usage with explicit `layout(location=N) out` for ES3.
- Echo source into the exception for faster triage.
When it happens
Trigger: `layout(location=0) out vec4` under #version 100 (ES2); gl_FragData indexing on a context with one slot; missing precision qualifier; unknown built-in used in the blit/resolve shader.
Common situations: Sample on WebGL1 where explicit output locations are unsupported; shader copied from desktop GL into ES; truncated source string.
Related errors
- Program link failed: {infoLog}
- Program link failed: {infoLog}
- {type} compile failed: {infoLog}
- Program link failed: {infoLog}
- {type} compile failed: {infoLog}
AI-assisted analysis of unoplatform/uno@0418340488 (2026-08-13).
Data as JSON: /api/errors/d053c080b4507917.
Report an issue: GitHub.