Closed Zyko0 closed 7 months ago
To be fair, this currently works as advertised on https://ebitengine.org/en/documents/shader.html#Built-in_functions_(mathematics). The main offenders would be only min/max, as they don't work like Go1.21 built-in functions if ints are not supported. But then, if you support ints for min/max, it seems weird to not also support them for the few other functions mentioned.
The difference from Go's min/max is that Kage's min/max takes only two arguments. So, I cannot move min/max to the Go's builtin function section yet.
Note to myself:
https://registry.khronos.org/OpenGL/specs/gl/GLSLangSpec.4.60.pdf
Some functions like sin
takes only floats and ths is represented as genFType.
So the build-in functions that can take integers are:
abs
sign
min
max
clamp
Ebitengine Version
v2.7.0-alpha.2
Operating System
Go Version (
go version
)1.21
What steps will reproduce the problem?
Kage shader compilation:
abs, sign, min/max and clamp functions with integer types (int, ivec2, ivec3, ivec4) (noticed by @tinne26)
What is the expected result?
no error
What happens instead?
compilation error:
cannot use int as float, vec2, vec3, or vec4 value in argument to sign
Anything else you feel useful to add?
No response