{"record":{"id":"5c2add03ea5520bc","repo":"unoplatform/uno","slug":"program-link-failed-infolog-5c2add","errorCode":null,"errorMessage":"Program link failed: {infoLog}","messagePattern":"Program link failed: (.+?)","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"src/SamplesApp/SamplesApp.Samples/Windows_UI_Composition/MRTBlitGlCanvasElement.cs","lineNumber":293,"sourceCode":"\t\t\tgl.BindVertexArray(_quadVao);\n\t\t\tgl.DrawArrays(PrimitiveType.Triangles, 0, 6);\n\t\t\tgl.ActiveTexture(TextureUnit.Texture0);\n\n\t\t\tInvalidate();\n\t\t}\n\n\t\tprivate static uint CreateProgram(GL gl, string vertexSource, string fragmentSource)\n\t\t{\n\t\t\tvar vs = CompileShader(gl, ShaderType.VertexShader, vertexSource);\n\t\t\tvar fs = CompileShader(gl, ShaderType.FragmentShader, fragmentSource);\n\t\t\tvar prog = gl.CreateProgram();\n\t\t\tgl.AttachShader(prog, vs);\n\t\t\tgl.AttachShader(prog, fs);\n\t\t\tgl.LinkProgram(prog);\n\t\t\tgl.GetProgram(prog, ProgramPropertyARB.LinkStatus, out int linkStatus);\n\t\t\tif (linkStatus != (int)GLEnum.True)\n\t\t\t{\n\t\t\t\tthrow new Exception(\"Program link failed: \" + gl.GetProgramInfoLog(prog));\n\t\t\t}\n\t\t\tgl.DetachShader(prog, vs);\n\t\t\tgl.DetachShader(prog, fs);\n\t\t\tgl.DeleteShader(vs);\n\t\t\tgl.DeleteShader(fs);\n\t\t\treturn prog;\n\t\t}\n\n\t\tprivate static uint CompileShader(GL gl, ShaderType type, string source)\n\t\t{\n\t\t\tvar sh = gl.CreateShader(type);\n\t\t\tgl.ShaderSource(sh, source);\n\t\t\tgl.CompileShader(sh);\n\t\t\tgl.GetShader(sh, ShaderParameterName.CompileStatus, out int status);\n\t\t\tif (status != (int)GLEnum.True)\n\t\t\t{\n\t\t\t\tthrow new Exception($\"{type} compile failed: \" + gl.GetShaderInfoLog(sh));\n\t\t\t}","sourceCodeStart":275,"sourceCodeEnd":311,"githubUrl":"https://github.com/unoplatform/uno/blob/04183404888ea21b4e5bfa3493e8d5f15e972c3a/src/SamplesApp/SamplesApp.Samples/Windows_UI_Composition/MRTBlitGlCanvasElement.cs#L275-L311","documentation":"CreateProgram in MRTBlitGlCanvasElement links the MRT/MSAA/resolve sample's shaders and throws the info log on link failure. Because this sample renders to MRT and blits MSAA, link failures commonly come from MRT fragment-output declarations not matching the framebuffer's color attachment count or types.","triggerScenarios":"Fragment shader declares one output but the FBO has two color attachments (or vice-versa); output location qualifiers collide; varying mismatch between stages; #version too low for MRT (gl_FragData vs location outputs); sampler/uniform mismatch.","commonSituations":"Refactor added a second MRT target but the fragment shader wasn't updated to two outputs; ES2 using gl_FragData where only one slot exists; location qualifier typo.","solutions":["Read the info log for the unresolved output or varying.","Declare exactly as many `layout(location=N) out` fragment outputs as the FBO has color attachments.","Match vertex `out` / fragment `in` varyings exactly.","Use #version 300 es / GL 330 for explicit MRT output locations."],"exampleFix":"// before — one output, two-attachment MRT FBO\nout vec4 fragColor;\n\n// after — match both attachments\nlayout(location = 0) out vec4 fragColor0;\nlayout(location = 1) out vec4 fragColor1;","handlingStrategy":"validation","validationCode":"// Confirm fragment output count matches MRT color attachment count\nint outputCount = CountFragmentOutputs(fragmentSource);\nif (outputCount < 2) throw new InvalidOperationException(\"MRT FBO has 2 color attachments; fragment shader must declare 2 outputs.\");","typeGuard":null,"tryCatchPattern":"try { return CreateProgram(gl, vert, frag); }\ncatch (Exception ex) { Log.Error($\"MRT link failed: {ex.Message}\"); throw; }","preventionTips":["Declare exactly as many `layout(location=N) out` outputs as the FBO has color attachments.","Keep #version 300 es / GL 330 for explicit MRT output locations.","Sync vertex `out` / fragment `in` varyings exactly."],"tags":["opengl","shader","glsl","mrt","framebuffer"],"backgroundTag":null,"analyzedSha":"04183404888ea21b4e5bfa3493e8d5f15e972c3a","analyzedAt":"2026-08-13T21:08:11.651Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}