Skip to content

fix(dxil): gg 61/61 — array-of-vector flattening, fine.wgsl fixed (BUG-DXIL-041)#71

Merged
kolkov merged 4 commits into
mainfrom
fix/dxil-fine-wgsl-041
May 6, 2026
Merged

fix(dxil): gg 61/61 — array-of-vector flattening, fine.wgsl fixed (BUG-DXIL-041)#71
kolkov merged 4 commits into
mainfrom
fix/dxil-fine-wgsl-041

Conversation

@kolkov

@kolkov kolkov commented May 6, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes BUG-DXIL-041: fine.wgsl "Invalid record" DXIL validation failure.

gg production: 58/59 → 61/61 (0 failures, 100%)

Root cause

array<vec4<f32>, N> locals flattened to [16 x float] had 3 bugs:

  1. GEP index not scaled by vector width (index 2 instead of 8)
  2. Single-scalar load instead of multi-scalar vector load
  3. Garbage component IDs from missing pendingComponents

Fix

  • tryLoadVectorFromFlatArray() — loads vecWidth consecutive scalars
  • scaleIndexForVecArray() — scales dynamic index by vecWidth
  • tryLocalVarAccessIndex — scales constant index by vecWidth

4 integration tests with WGSL→DXIL→IDxcValidator roundtrip.

Test plan

  • go test -run TestDxilValGGProduction61/61 (0 failures)
  • go test -run TestDxilValSummary — 161/170
  • go test -run TestDxilDxcGolden — 105 diff=0
  • go test -run TestRustReference — 100%
  • golangci-lint — clean
  • CI green

kolkov added 3 commits May 6, 2026 17:28
Add mathMinArgs() that maps MathFunction to required argument count.
dot/cross/distance/reflect/step/pow/atan2 require 2, mix/smoothstep/
clamp/fma require 3. Catches dot(v) with 1 arg at lowering time instead
of crashing in SPIR-V backend with nil pointer dereference.

Fixes gogpu/wgpu#170
…ad (BUG-DXIL-041)

fine.wgsl "Invalid record" caused by 3 bugs in flattened array<vec4,N>:
(1) GEP index not scaled by vecWidth, (2) single-scalar load instead
of vec4 load, (3) garbage component IDs from missing pendingComponents.
gg production: 58/59 → 61/61 (0 failures). Fixes BUG-DXIL-041.
@codecov

codecov Bot commented May 6, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 23.40426% with 108 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
dxil/internal/emit/expressions.go 12.28% 98 Missing and 2 partials ⚠️
dxil/internal/emit/resources.go 0.00% 3 Missing ⚠️
dxil/internal/emit/statements.go 0.00% 2 Missing ⚠️
wgsl/lower.go 80.00% 1 Missing and 1 partial ⚠️
wgsl/parser.go 87.50% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

…anup, tmp/ exclusion

Extract constants: errExpectedParameterName/MemberName/VariableName/Type
(parser.go), semPosition/semTarget (semantic.go), hlslFloat (resources.go),
samplerHeapName/comparisonSamplerHeapName (sampler_heap.go), outcomeSkip
(corpus.go). Remove 4 unused //nolint:gosec. Exclude wgsl/lexer.go and
wgsl/token.go keyword maps from goconst. Exclude tmp/ from lint.
@kolkov kolkov merged commit a2e617e into main May 6, 2026
10 of 11 checks passed
@kolkov kolkov deleted the fix/dxil-fine-wgsl-041 branch May 8, 2026 19:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant