simvx.graphics.materials.shader_compiler¶
GLSL to SPIR-V compilation via glslc, with include resolution and optional reflection.
Module Contents¶
Functions¶
Recursively resolve |
|
Compile a GLSL file to SPIR-V using glslc. Returns the output path. |
Data¶
API¶
- simvx.graphics.materials.shader_compiler.__all__¶
[‘compile_shader’, ‘resolve_includes’]
- simvx.graphics.materials.shader_compiler.resolve_includes(source: str, base_dir: pathlib.Path, _seen: set[str] | None = None) str[source]¶
Recursively resolve
#include "file.glsl"directives in GLSL source.Args: source: GLSL source text. base_dir: Directory to resolve relative include paths against. _seen: Internal set tracking already-included files to prevent cycles.
Returns: Processed GLSL source with all includes inlined.
Raises: FileNotFoundError: If an included file does not exist. RuntimeError: If a circular include is detected.
- simvx.graphics.materials.shader_compiler.compile_shader(src: pathlib.Path, out: pathlib.Path | None = None, *, force: bool = False) pathlib.Path[source]¶
Compile a GLSL file to SPIR-V using glslc. Returns the output path.
Skips recompilation when the cached
.spvis newer than the source and all its#includedependencies. Passforce=Trueto always recompile.Args: src: Path to the GLSL source file. out: Optional output path for the SPIR-V binary. Defaults to
src.spv. force: Always recompile, ignoring the cache.Returns: Path to the compiled SPIR-V file.
Raises: RuntimeError: If glslc compilation fails, with annotated error details.