-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
@link annotations for host directed linking #48
Comments
Had a thought that generics kind of fulfill a similar role to link (if we allow specialisation externally to the source code). In which case having both feels redundant |
I had an experimental feature in the legacy version of the typescript wgsl-linker kind of like that. |
I was thinking more about being able to specialise at link time by passing in a path expression as the entry point but your approach is also an interesting angle, @mighdoll |
Yeah, the The basic idea of generic parameters being settable from host code seems interesting in that it's another path toward unifying host directed linking with WESL directed linking. i.e. rather than a module saying it expects host code to fill in an I'm not sure if overloading generic arguments to do |
@link
is intended to give host application code (e.g. TypeScript or Rust) fine grained control of the WESL linking process at the level of e.g.fn
elements. Host applications gain the power to flexibly assemble a shader from parts based on user settings, runtime environment, or other application specific runtime considerations.By comparison, WESL
import
statements specify shader module assembly from WESL code, with limited control by the host application, e.g. via@if
conditions.Use.GPU makes extensive use of
@link
annotations (see below) and has demonstrated a number of examples of the flexibility from pervasive app controlled linking.@link
is also potential enabler for a data abstraction layer (issue TBD).The idea is to declare wgsl elements like functions without implementation, e.g.
Then several WESL modules might implement functions matching the signature of
getVertColor
, and use a runtime linker option to assign one of them.e.g.
See also issue TBD about providing host code handles to WGSL elements to supply to the linker.
In some scenarios, the linker might generate WGSL to fulfill the
@link
, see for example issue TBD describing how to use@link
as a polymorphic data get abstraction.We should consider how
@link
might be useful for specific needs expressed by community projects, e.g. perhaps for bevy's materials extension points (issue TBD).Related work we've discussed in WESL includes @ncthbrt module function signatures as part of her 5 WESL proposals and @k2d222's generics proposal for generic function signatures with @override.
It is tempting to see if we can allow fulfilling
@link
entries statically as well as dynamically.Use.GPU also includes a
@optional @link
variation that provides a default implementation along with the declaration.Some background on Use.GPU:
. Use.GPU WESL discussion slides
. Use.GPU WGSL language extensions
. Using extended shaders in Use.GPU
. video see: 47:00+
. extended WGSL in use in Use.GPU
. also: general docs, blog
The text was updated successfully, but these errors were encountered: