{"record":{"id":"3efcdccc91bea438","repo":"unoplatform/uno","slug":"type-compile-failed-infolog-3efcdc","errorCode":null,"errorMessage":"{type} compile failed: {infoLog}","messagePattern":"(.+?) compile failed: (.+?)","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"critical","filePath":"src/SamplesApp/SamplesApp.Samples/Windows_UI_Composition/QuerySyncGlCanvasElement.cs","lineNumber":296,"sourceCode":"\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}\n\t\t\treturn sh;\n\t\t}\n\t}\n}\n#endif\n","sourceCodeStart":278,"sourceCodeEnd":303,"githubUrl":"https://github.com/unoplatform/uno/blob/04183404888ea21b4e5bfa3493e8d5f15e972c3a/src/SamplesApp/SamplesApp.Samples/Windows_UI_Composition/QuerySyncGlCanvasElement.cs#L278-L303","documentation":"CompileShader in QuerySyncGlCanvasElement throws when a stage fails to compile, before linking. Applies to the bars vertex/fragment sources (with uWave[8], uPalette[4], gl_InstanceID-based instancing) and the probe vertex/fragment sources (uRect, uColor).","triggerScenarios":"Inside CompileShader after CompileShader, gl.GetShader(CompileStatus) != True (lines 290-296). The bars VS uses `float i = float(gl_InstanceID);` and dynamically indexes uWave[gl_InstanceID], which requires GLSL ES 3.00 / desktop 1.50+.","commonSituations":"versionDef selected `#version 300 es` but the context is GLES 2.0 / WebGL1 where gl_InstanceID and dynamic array indexing in the vertex shader are unavailable; `precision highp float` rejected on the vertex stage of a context that lacks highp in the vertex shader; the modulo arithmetic `gl_InstanceID - (gl_InstanceID / 4) * 4` triggers an integer-division precision warning that escalates to an error under strict compilation; layout(location=0) qualifiers rejected on GLSL ES 1.00.","solutions":["Read the appended infoLog for line-precise diagnostics.","Confirm gl.GetStringS(StringName.ShadingLanguageVersion) reports a version that supports gl_InstanceID (GLES 3.00+ / WebGL2 / desktop 1.50+); on older contexts the bars instancing shader cannot compile and needs a different instancing strategy or attribute-based indexing.","For contexts lacking gl_InstanceID, pass the instance index as a vertex attribute or use gl_VertexID-based derivation where supported.","Move `precision highp float` declarations to the fragment stage only, or declare vertex-stage precision explicitly per-float-type as the driver requires.","Validate offline with glslangValidator targeting the matching GLSL version."],"exampleFix":"// before\nif (status != (int)GLEnum.True)\n    throw new Exception($\"{type} compile failed: \" + gl.GetShaderInfoLog(sh));\n\n// after — guard version capabilities before compiling and surface source\nif (versionDef == \"#version 300 es\" && !slVersion.Contains(\"3.0\"))\n    throw new Exception($\"Context does not support GLSL ES 3.00 (has {slVersion}); instancing shader requires it.\");\nif (status != (int)GLEnum.True)\n{\n    var log = gl.GetShaderInfoLog(sh);\n    throw new Exception($\"{type} compile failed (versionDef={versionDef}): {log}\");\n}","handlingStrategy":"validation","validationCode":"// Confirm the context supports instancing (gl_InstanceID) before compiling the bars VS\nvar sl = gl.GetStringS(StringName.ShadingLanguageVersion);\nif (sl.Contains(\"OpenGL ES\") && !sl.Contains(\"3.\")) return; // #version 300 es unsupported; cannot use gl_InstanceID\nif (!source.StartsWith(\"#version 300 es\") && source.Contains(\"gl_InstanceID\")) return;","typeGuard":null,"tryCatchPattern":"try { sh = CompileShader(gl, type, source); }\ncatch (Exception ex) when (ex.Message.Contains(\"compile failed\"))\n{\n    App.MainWindow?.LogError($\"{type} compile failed (QuerySync): {ex.Message}\");\n    sh = 0;\n}","preventionTips":["Confirm ShadingLanguageVersion supports gl_InstanceID (GLES 3.00+ / WebGL2 / desktop 1.50+).","On older contexts, pass the instance index as a vertex attribute instead of gl_InstanceID.","Move precision declarations off the vertex stage where rejected.","Validate offline with glslangValidator targeting the matching GLSL version."],"tags":["opengl","silk-net","glsl","shader-compile","glsl-es","instancing","shader"],"backgroundTag":null,"analyzedSha":"04183404888ea21b4e5bfa3493e8d5f15e972c3a","analyzedAt":"2026-08-13T21:08:11.651Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}