-
-
Notifications
You must be signed in to change notification settings - Fork 46
Labels
enhancementNew feature or requestNew feature or requestjavascriptPull requests that update javascript codePull requests that update javascript code
Milestone
Description
A new overload for tgpu.fn that accepts a shell-less callback and returns a callable that has a .with() method. This allows shell-less functions to also be provided with slot and accessor overrides.
Example
const countAccess = tgpu.accessor(d.f32);
const getDouble = () => {
'use gpu';
return countAccess.$ * 2;
};
// ^? () => number
const getDouble4 = tgpu.fn(getDouble).with(countAccess, 4);
// ^? TgpuGenericFn<() => number>
const main = () => {
'use gpu';
return getDouble4(); // should return 8
};Requirements
- If a shell-less function
foois used in code, andtgpu.fn(foo)is also used in code, it should only generate one definition.
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or requestjavascriptPull requests that update javascript codePull requests that update javascript code