-
Notifications
You must be signed in to change notification settings - Fork 329
Closed
Labels
wgslWebGPU Shading Language IssuesWebGPU Shading Language Issueswgsl resolvedResolved - waiting for a change to the WGSL specificationResolved - waiting for a change to the WGSL specification
Description
In SPIR-V, local variables inside functions are loaded (with OpLoad
) and stored (with OpStore
). In WGSL, however, the semantics of "load" is lost. For example:
var x = 1.0;
const y = x * x + x + 1;
This would translate to 3 OpLoad
instructions for x
instead of one. It would be unfortunate to recommend people to have temporary const
variables, since nothing visually indicates whether an access to something is an actual operation, or just a use of an SSA value.
One way to address this would be to have a syntax for "load" of a variable, e.g. *x
.
Another way is to rely on drivers doing this optimization, if they always do.
grovesNL
Metadata
Metadata
Assignees
Labels
wgslWebGPU Shading Language IssuesWebGPU Shading Language Issueswgsl resolvedResolved - waiting for a change to the WGSL specificationResolved - waiting for a change to the WGSL specification