What problem does it solve?
Building SPIR-V binaries by hand is error-prone and verbose; this Skill provides a complete reference for the glslang SpvBuilder API so you can programmatically generate types, instructions, control flow, and decorations for shader modules inside LuisaCompute.
Core Features & Use Cases
- Module and Type Construction: Create canonicalized scalar, vector, matrix, struct, image, and cooperative matrix types, plus constants and variables.
- Structured Control Flow: Generate if-then-else, switch, and loop constructs with helpers like
Builder::If, makeSwitch, and LoopBlocks.
- Traverser Patterns: Apply proven
GlslangToSpv visitor patterns (visitSymbol, visitBinary, visitSelection, visitLoop) for AST-to-SPIR-V lowering, including access-chain management and debug info emission.
- Use Case: When adding a new backend or extending LuisaCompute's SPIR-V codegen, use this Skill to correctly emit an entry point, declare descriptor bindings, build arithmetic expressions, and serialize the module with
builder.dump().
Quick Start
Ask the AI to generate a SPIR-V fragment shader entry point with a float uniform and an OpFAdd computation using the glslang SpvBuilder API.