You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This behavior differs from some other shading languages that allow scalar min/max arguments with a vector input.
The lack of such overloads for clamp complicates code porting and readability. Developers currently need to create vector versions of scalar values when using clamp with mixed vector and scalar arguments. Supporting such an overload could improve developer experience of WGSL.
The text was updated successfully, but these errors were encountered:
The suggested behavior here seems very good. It would make sense to allow splats on all three arguments. But there are two issues:
It's not just clamp; smoothstep and mix would also be reasonable to update. We should actually put together a full list of everything we want to change, and not do it piecemeal.
In that light, given that the language is usable, if awkward, we may want to treat this as a nice treat for M2, unless the list is very short.
mix already has a version that takes two scalars and vector because of a previous request.
I don't think you generally need an overload for clamp where the data is splatted. Usually it is vector data and scalar min/max arguments.
I also agree that, at this point, we should revisit splats generally before making a specific change. I'm not advocating one way or another, but it would be good to decide on the overall issue first.
JB: Mozilla’s thinking:these sound like good changes, with real improvements. Have a lot of places in the spec where it makes sense. Going through them piecemeal seems not optimal. Should review systematically. At that point it looks like a bigger project. The language is usable as-is. We feel it makes sense to treat this as M2. For now focus on shipping what we have right now. When we come to M2 and address all these issue they’ll be very happy with the improvement.
AB: We basically agree. We did do one like this, for mix. Do we want splatting in general, or in special cases. Look at it in a batch.
Issue 2 extracted from #4750 by @jacobgorm
The WGSL clamp function currently requires all arguments to be of the same type, including when used with vectors. Please see: https://gpuweb.github.io/gpuweb/wgsl/#clamp
This behavior differs from some other shading languages that allow scalar min/max arguments with a vector input.
The lack of such overloads for clamp complicates code porting and readability. Developers currently need to create vector versions of scalar values when using clamp with mixed vector and scalar arguments. Supporting such an overload could improve developer experience of WGSL.
The text was updated successfully, but these errors were encountered: