saharan/HGSL

Using uniforms and prototype declaration causes `gl.INVALID_OPERATION` in Safari

Closed this issue · 0 comments

The following shader does not work in Safari (both PC and iOS)

vertex shader

#version 300 es

layout(location = 0) in vec4 pos;
uniform float t;

void main(); // prototype declaration

void main() {
	gl_Position = pos + t; // using uniform
}

fragment shader

#version 300 es
precision highp float;
precision highp int;

layout(location = 0) out vec4 col;

void main() {
	col = vec4(1);
}

REALLY don't know why, but this can be avoided anyway by sorting functions in some order (since no recursion is allowed).