pygfx.renderers.wgpu.register_wgsl_loader

pygfx.renderers.wgpu.register_wgsl_loader(context, loader)

Register a source for shader snippets.

When code is encountered that looks like:

{$ include 'some_context.name.wgsl' $}

The loader for “some_context” is looked up and used to load the wgsl to include. This function allows registering a loader for your downstream package or application.

Parameters:
  • context (str) – The context of the loader.

  • loader (jinja2.BaseLoader | callable | dict) – The loader to use for this context. If a function is given, it must accept one positional argument (the name to include).