-
Notifications
You must be signed in to change notification settings - Fork 344
Description
WGSL already has multiple overloads for functions - we have vec4<f32>(f32, f32, f32, f32) and vec4<f32>(vec2<f32>, vec2<f32>) (among many others). Given that the compiler will already have to have overload resolution support to make vector constructors work, there's no reason why it should be forbidden for author-created functions.
Implementation is pretty easy because we don't have inheritance or generic types right now - we just have a sea of flat types. So the overload resolution would just be "find the overload that has the right number of parameters and the parameter types match the types of the arguments."
Entry points should be required to have unique names so they can be identified uniquely without writing a whole signature (or having to generate mangled names like C++).