-
-
Notifications
You must be signed in to change notification settings - Fork 21.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add missing shader built-in overloads #53066
Conversation
7f181e5
to
3680742
Compare
dot
and distance
to shader language
dot
and distance
to shader language3680742
to
2eb5cc9
Compare
2d4e2c1
to
e125b58
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I dont think all of the overloads you added are supported.
Here is what the spec has to say:
When the built-in functions are specified below, where the input arguments (and corresponding output) can be float, vec2, vec3, or vec4, genType is used as the argument. Where the input arguments (and corresponding output) can be int, ivec2, ivec3, or ivec4, genIType is used as the argument. Where the input arguments (and corresponding output) can be uint, uvec2, uvec3, or uvec4, genUType is used as the argument. Where the input arguments (or corresponding output) can be bool, bvec2, bvec3, or bvec4, genBType is used as the argument. For any specific use of a function, the actual types substituted for genType, genIType, genUType, or genBType have to have the same number of components for all arguments and for the return type. Similarly for mat, which can be any matrix basic type.
(pg 80 https://www.khronos.org/registry/OpenGL/specs/gl/GLSLangSpec.3.30.pdf)
step()
for example has two overloads:
genType step (genType edge, genType x)
genType step (float edge, genType x)
So I don't think that the overloads added are valid.
@clayjohn Strange, they are working when testing with SHADERed and the Godot itself, this seems like a non-standard extension then? Ok, I will clean up this PR, and add some missing stuff like texture functions with Offset which GLES3 is supported. |
I wonder if GLSL does an implicit type-conversion of the arguments passed into the functions. In which case, maybe we should allow them... And for reference: GLSL 330 spec at section 4.1.10 "implicit conversions" and section 6.1 "function definitions" |
I see, then I will remove that conversion overload stuff and for the future, I should probably implement that conversion implicitly. |
Added packing/unpacking functions (supersedes #52767) and added functions described in https://www.khronos.org/registry/OpenGL/specs/es/3.1/GLSL_ES_Specification_3.10.withchanges.pdf (bitfieldExtract, bitfieldInsert, bitfieldReverse, bitCount, findLSB, findMSB, uaddCarry, usubBorrow) |
Thanks! |
No description provided.