API Reference¶
Package manager¶
- class spm_slang.package_manager.DeviceConfiguration¶
Bases:
TypedDict- adapter_luid: Sequence[int] | None¶
- bindless_options: slangpy.core.utils.BindlessDesc | None¶
- enable_compilation_reports: bool¶
- enable_cuda_interop: bool¶
- enable_debug_layers: bool¶
- enable_hot_reload: bool¶
- enable_print: bool¶
- existing_device_handles: Sequence[slangpy.core.utils.NativeHandle] | None¶
- include_paths: <class 'str'>]¶
- type: slangpy.DeviceType¶
- class spm_slang.package_manager.SlangPackageManager(device_config=None)¶
Bases:
object- Parameters:
device_config (DeviceConfiguration | None)
- property device: slangpy.Device¶
Get the Slang device used by this package manager.
- Returns:
The Slang device instance.
- property module_map: Dict[str, slangpy.Module]¶
Get the module map containing the built Slang modules for each registered package.
- Returns:
A dictionary mapping package names to their corresponding Slang modules.
- static register_package(package_cls)¶
Register a Slang package class.
- Parameters:
package_cls (type[SlangPackage]) – The SlangPackage class to register
- Raises:
ValueError – If a package with the same name is already registered.
- Return type:
None
Package base class¶
- class spm_slang.package.SlangPackage(device, dependencies)¶
Bases:
objectBase class for Slang packages.
- Parameters:
device (spy.Device)
dependencies (List[spy.Module])
- build()¶
Build the Slang module for this package.
- Returns:
A Slang module that represents the package. This method should be implemented by subclasses to define the contents of the package.
- Return type:
slangpy.Module
- static dependencies()¶
The dependencies of this package.
- Returns:
A list of SlangPackage classes that this package depends on. This method should be implemented by subclasses to specify the dependencies of the package.
- Return type:
List[type[SlangPackage]]
- static name()¶
The unique name of the package.
- Returns:
The name of the package. This method should be implemented by subclasses to return the name of the package.
- Return type:
str
- static shader_paths()¶
The shader_paths device should include.
- Returns:
A list of file paths to the shader files that should be included in the package.
- Return type:
List[str]