TSL: Added type conversions to WGSLNodeFunction and fleshed out precision. #28577
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Added conversions between WGSL types and their equivalent Threejs in the WGSLNodeFunction.js file. This commit should help resolve particular parsing and conversion issues when creating shaders using wgslFn blocks.
For instance, in the existing code, let's say we wanted to define an argument with this function signature...
The generated WGSL code to invoke this function might look something like this.
While this behavior might be acceptable if we're only passing in arguments to be used in numerical operations, it prevents particular inputs from being used in scenarios where u32s or integers may be required for instance, indexing into a storage buffer.
When this code is implemented, the function will instead pass the parameters as the programmer might expect them to be passed.
This change should only apply to the types already represented in WGSLNodeBuilder's wgslTypeLib (such as primitive data types, vector types, and matrix types). This should not in anyway affect how other data types like textures or arrays are parsed.