gpuweb / gpuweb

Where the GPU for the Web work happens!
http://webgpu.io
Other
4.76k stars 314 forks source link

Allow modf() for scalar-vector and vector-scalar #4097

Open wrightwriter opened 1 year ago

wrightwriter commented 1 year ago

% works, but modf() doesn't Related: https://github.com/gpuweb/gpuweb/issues/2450

kdashg commented 1 year ago
WGSL 2023-05-23 Minutes * KG: Works with % but not a builtin. **Suggest post-v1.** * BC: Similar vein to the next thing (4111). Larger theme is implicit scalar to vector promotion. To match other shader languages. * JB: **Slightly worried that implicit conversions have history of hiding bugs**. If lots of shader authors want this then it’s just a nice helper. Weakly concerned but willing to go along. Seems post-v1. This is not minimum viable product territory. * MM: I’m more worried about implicit conversions that lose data. E.g. float to int and backward. These don’t do that. Not worried about that. * JB: concern comes from experience with C++ and Rust where things get too magical. * BC: If we allow scalar to vector generally, does this apply elsewhere. E.g. `var a: vec3i = 1;` Is that supposed to work? * MM: Would take guidance from other shading languages. * KG: Are you asking it to do more than you wanted. * KG: Can get different meaning when vec3 to vec4 homogeneous coordinates and back. * MM: Person asking scalar to vector not small vector ot big vectors. * KG: Yes. I’m providing a landmark/ point of concern for saying generally promoting to vectors. E.g. if you ever have a type error, promoting t to t,n does an implicit conversion you don’t want. * JB: Homogenous coordinates are tricky to work with. Can’t just add them. Have to be cautious about them. * KG: Rays vs points. * MM: To Jim’s points, it’s meaningless to add two points anyway. * KG: Am interested in general direction of automatically expanding scalars to vectors, but have to do more investigation. We can continue to approximate it by adding one by one, until we have bandwidth to do the general. To this point and next issue, would like to expand automatically. * MM: Do we want to make more one-offs in the short term? Or pursue the larger feature instead. * KG: Can do both in parallel, but post-v1. Think we should focus on the general issue. * JB: ECMAScript adopted principle that proposals for medium-major changes to the languages (this would be medium-scale), they have to evaluate it by actually building it, releasing to population of users that are informed, and get use experience with it. They caught many bad choices with this process. This committee doesn’t have an established process for this kind of experiment process. * MM: [https://tc39.es/process-document/](https://tc39.es/process-document/) is that stage4? New proposals ship at stage3. * JB: I need to look at that again.