pygfx.renderers.wgpu.register_wgsl_loader

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

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.

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

  • func (callable) – The function that will be called when a shader is loaded for the given context. The function must accept one positional argument (the name to include).