unoplatform/uno · error · Exception

{type} compile failed: {infoLog}

Error message

{type} compile failed: {infoLog}

What it means

CompileShader in IntAttribsBlendGlCanvasElement throws the shader info log when glCompileShader reports failure. Given this sample uses integer attributes and instancing, compile failures are usually an integer/instancing GLSL construct the current shader version rejects.

Source

Thrown at src/SamplesApp/SamplesApp.Samples/Windows_UI_Composition/IntAttribsBlendGlCanvasElement.cs:264

			{
				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

  1. Read the info log line/column and fix the flagged construct.
  2. Target #version 300 es for integer attributes, instancing, and `flat`.
  3. Add `flat out`/`flat in` for integer varyings.
  4. Add precision qualifiers for fragment-stage ints/floats.

Example fix

// before — integer varying without flat interpolation qualifier
out ivec4 vCell;

// after
flat out ivec4 vCell;   // integer varyings must be 'flat'
Defensive patterns

Strategy: try-catch

Validate before calling

if (source.Contains("in ivec") && !source.Contains("#version 300"))
    throw new InvalidOperationException("Integer attributes 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

When it happens

Trigger: `in ivec4` or `gl_VertexID`/`gl_InstanceID` under #version 100; `layout(location=)` qualifier unsupported in the declared version; `flat` interpolation qualifier missing on an integer varying; precision qualifier missing in fragment.

Common situations: Sample auto-targeting WebGL1 where ES 1.00 has no integer attributes; shader copied from a desktop sample into an ES context; missing `flat` on integer varying causing a strict-driver compile error.

Related errors


AI-assisted analysis of unoplatform/uno@0418340488 (2026-08-13). Data as JSON: /api/errors/40b19d74ed62270e. Report an issue: GitHub.