SPIR-V Cross - The War Stories
summary
A cross-compiler for SPIR-V called SPIR-V Cross is described being used to emit readable GLSL, HLSL and Metal, with loop recovery took four months to turn low-level structured blocks into sane for/while loops so drivers can unroll them. It implements combined image samplers remapped across call graph, flattens UBOs to work on mobile, handles HLSL matrix/layout quirks, and accumulates ~302 closed PRs; it runs in production (games shipping) though many driver and opt-induced bugs required lengthy workarounds.
AI-written summary · about
chapters (24)
- 0:00Introduction to SPIR-V Cross
- 1:08Tool's origins and early challenges
- 2:53GLSL readability and debugging
- 5:00Loop translation and driver crashes
- 7:30Control flow analysis for loops
- 8:31Single static assignment pain
- 10:19Variable scoping and dominance
- 12:50Combined image samplers dilemma
- 14:21Flattening uniforms for mobile
- 16:28Shadow sampler compatibility issues
- 17:56Metal backend's global resource model
- 19:43Array value types in shading languages
- 21:12HLSL support and matrix madness
- 23:45Storage buffer type incompatibilities
- 25:30SPIR-V opt's optimization pitfalls
- 26:37Continue block abuse in loops
- 28:23Phi node ordering bugs
- 29:25Inlining and control flow escape
- 31:10Optimization and code sanity
- 32:37Buffer packing and layout hell
- 34:44Metal's struct layout limitations
- 35:46SPIR-V's structured advantages
- 37:09Development status and future
- 38:56Q&A session
