I'm working on an iOS project, using GPUImage framework. I cannot get my shader complied.
There's a function in my fragment shader:
const vec2 boundMin = vec2(0.0, 0.0);
const vec2 boundMax = vec2(1.0, 1.0);
bool inBounds (vec2 p) {
return all(lessThan(boundMin, p)) && all(lessThan(p, boundMax));
}
Shader compile log:
ERROR: 0:1: '_Bool' : syntax error syntax error
When I replace all the calls to function
inBounds(vec2 p)
with
all(lessThan(boundMin, p)) && all(lessThan(p, boundMax))
it works great!
Questions:
Is bool function supported in OpenGL ES 2.0 Fragment Shader? If so, where did I go wrong? If not, why there're functions like all()
, lessThan()
, etc.
Environment: iPad mini, iOS 7, OpenGL ES 2.0, Xcode 5.0.2
inBounds
function, it works fine. I believe it's the function itself that causes the problem. Do you use GPUImage? I don't think GPUImage's shader compile log can give the exact location of an error. – YuAoprecision highp float;
... – YuAohighp
, I know that, and I'm usinghighp
in other fragment shaders, it's fine. – YuAo