Replies: 4 comments
|
agreed! let's do it ^^ |
|
I'm a bit late to the party here. While I don't disagree with the name being less applicable, I don't think 'ValueOf' is a better alternative. I would argue that what we are doing is closer to "parsing" the WGSL schemas to get the TS counterparts, than it is to getting a value from them since we are in type land. |
|
Okay, lets try and workshop this. From an I/O standpoint, For example, from the perspective of the GPU (in TGSL shaders), the import tgpu from 'typegpu';
import * as d from 'typegpu/data';
const rgb = d.vec3f; // alias
const Gradient = d.struct({
from: rgb,
to: rgb,
});
type Gradient = tgpu.infer<typeof Gradient>; // => { from: vec3f, to: vec3f } |
|
Let's do a quick poll, should we do:
|
Uh oh!
There was an error while loading. Please reload this page.
The current way to get the type of value that a schema describes is via the
Parsed<T>generic type, meaning:This made sense from the perspective of
typed-binary, as the resulting type is what you got from parsing a sequence of bytes. In the context of TypeGPU, this parallel is a bit less applicable. I propose we change this API to reflect its current purpose toValueOf<T>instead.All reactions