Commit 2a8e5cf
authored
fix: SPIR-V compute shader bug fixes (v0.14.3)
* fix: SPIR-V deferred store with multiple call results in init expression
findCallResultInTree returned only the first ExprCallResult in an
expression tree. When a local var init contained two different call
results (e.g. span(a,b) + span(c,d)), the deferred store triggered
on the first call — before the second result was cached.
Renamed to findLastCallResultInTree: explores all branches and returns
the highest-handle CallResult. Since StmtCalls emit in handle order,
the last call result is the last to complete, ensuring all earlier
results are already in callResultIDs.
Fixes path_count.wgsl compilation failure in Vello compute pipeline.
* fix: SPIR-V deferred store for var x = atomicOp() initialization
ExprAtomicResult was not handled in the local variable init loop,
causing 'atomic result expression not found' when compiling patterns
like var seg_ix = atomicAdd(&bump.counter, 1u).
Fix: treat ExprAtomicResult the same as ExprCallResult — defer the
store until emitAtomic caches the result, then execute it via
processDeferredStores. Also added ExprAtomicResult to the renamed
findLastDeferredResultInTree for complex init expressions.
Added 7 Vello workaround validation tests confirming all 6 previously
discovered SPIR-V codegen bugs are now fixed.
* fix: SPIR-V OpLogicalEqual for bool comparisons, transitive deferred stores
- Bool == / != now emits OpLogicalEqual/OpLogicalNotEqual (was OpIEqual)
- Bool & / | now emits OpLogicalAnd/OpLogicalOr (was OpBitwiseAnd/Or)
- Transitive deferred store: var X = Y correctly deferred when Y depends
on a function call result (3-pass: classify, propagate, emit)
- Fixes span() function call producing wrong results in compute shaders
* fix: SPIR-V atomic result type for atomic<i32> struct fields
- resolveAtomicScalarKind now handles AtomicType returned directly
by ResolveExpressionType (not wrapped in PointerType)
- Fixes spirv-val error: AtomicIAdd expected Pointer to point to
value of type Result Type
- Affects struct field atomics: tiles[i].backdrop (atomic<i32>)
* fix: split var init to StmtStore when referencing local variables (NAGA-SPV-007)
Frontend init splitting in WGSL lowerer: var inits that reference
local variables are emitted as LocalVariable{Init: nil} + StmtStore
at declaration position instead of being pre-computed in prologue.
This prevents stale values when a var's init reads a local variable
that is modified by preceding control flow (if/else blocks).
Approach matches Rust naga (src/front/wgsl/lower/mod.rs:1737-1801).
New: initReferencesLocalVariable() expression tree walker.
Tests: 3 regression tests + 1 span() diagnostic test.
* docs: update changelog for v0.14.3
* test: use t.TempDir() for SPIR-V test output files
* test: skip spirv-val when not installed in CI1 parent 7d94d37 commit 2a8e5cf
File tree
8 files changed
+1865
-47
lines changed- spirv
- wgsl
8 files changed
+1865
-47
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
8 | 19 | | |
9 | 20 | | |
10 | 21 | | |
| |||
840 | 851 | | |
841 | 852 | | |
842 | 853 | | |
843 | | - | |
| 854 | + | |
| 855 | + | |
| 856 | + | |
| 857 | + | |
844 | 858 | | |
845 | 859 | | |
846 | 860 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
0 commit comments