Repository navigation
release: v0.34.12 - #391
Merged
Merged
Conversation
naga v0.21.8 rejects WGSL the spec never allowed (function-scope var outside the function address space, const-expression division by zero and over-wide shifts; no shader in this module is affected), lets DXIL read 32-bit storage elements without shader model 6.2, and drops the four stale gogpu/wgpu:P1-SW-013 known failures from its readback corpus. gpucontext v0.32.0 carries the new IME contract, which wgpu does not use. TestDXILShaderModelRefusal followed the old DXIL rule: a five-component 32-bit storage element now compiles at every shader model from 6.0, as DXC writes it (naga P1-DXIL-072), so the test asserts that, and checks the refusal path with a 64-bit element, which still needs SM 6.3.
…orpus) naga's testdata/readback holds compute shaders and the exact words a GPU must write. Until now wgpu ran it only through throwaway gate runners and hand copies (flow/short-circuit-or-rt), so a corpus case never ran in this repo's tests. TestReadbackCorpus finds the corpus through go list -m (go.work locally, the go.mod pin in CI), reads formats 1 and 2 strictly, opens each adapter with the features its cases require, and reports PASS, FAIL, XFAIL(card), XPASS(close card) or SKIP per backend, adapter and case. A known failure that passes fails the test; on Vulkan a validation message during a case fails that case. halRunner now takes a dispatch of any binding kinds, entry point and workgroup count; TestOverridesAllAdapters shares forEachHALAdapter and so runs Vulkan under the validation layer too. Self-tests cover the reader's rejections and prove a corrupted expectation fails on the software device. The hand copy of flow/short-circuit-or-rt is gone: the corpus has the case.
…ifies The interpreter ended a lane at discard (OpKill), so a fine derivative taken later in its quad row or column came from the other row: wrong for any value not linear in the other coordinate (P3-SW-035). The software device now asks naga for OpDemoteToHelperInvocation, and the interpreter runs the demoted lane to the end of the shader as a helper: no storage, atomic or color writes, values still feeding the quad's derivatives. A demotion inside a called function marks every frame of the invocation, so the caller's stores after the call are dropped too. When the lane ends, the entry point still reports ErrDiscarded, so the rasterizer's discard handling is unchanged. TestDerivativesAfterDiscard now also takes fine derivatives of x*y, the case that tells a helper feeding its own row from a difference taken in the other row; it failed on the software backend before this change. TestDiscardStorageWrites covers a discard in a called function, which fails when the demotion marks only the callee's frame.
…lds consistently Nineteen files of hal/software, hal/software/shader and hal/software/raster had no build constraint while every other file of these packages excludes js/wasm, so a wasm build or vet of them failed to compile instead of reporting them as not built there, as hal/allbackends does. The package doc now says so: in a browser wgpu uses the browser's WebGPU. stats.go also drops a comment that cited an internal document path.
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
naga v0.21.9 names the five SPIR-V capabilities the Vulkan backend passes it and carries the Metal Paravirtual known failure for vars/workgroup-split-rt. Its compiler output is unchanged from v0.21.8.
naga v0.21.9 exports StorageImageWriteWithoutFormat, DrawParameters, RayQueryKHR, DotProductInputAll and DotProductInput4x8Bit, so the local copies of their values go.
The hal/allbackends tests compared and keyed maps by backend names written as literals ("vulkan", "gles", "dx12-fxc"...), and the corpus known failures matched on them: a misspelled one compiled and silently matched nothing. They are now a backendName type with one constant per backend, which the corpus format also decodes into. The Vulkan capability test names its rows after the requested features (Feature.String) and runs each as a subtest.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Release v0.34.12.
A Vulkan shader-feature patch: shaders use only what the device enabled,
discardfollows WGSL, and naga's GPUreadback corpus runs on every adapter in the test suite.
Fixed
dot4I8Packedanddot4U8Packedno longer emit instructions the device never enabled (P2-VK-014). naga got no capability set, treated every capability as available and wrote the native packed dot product, which needsshaderIntegerDotProduct; the validation layer reportedVUID-VkShaderModuleCreateInfo-pCode-08740on Intel and NVIDIA. The device now gives naga its SPIR-V capabilities as Rust wgpu-hal does, so naga polyfills the dot product where the feature is missing, andVK_KHR_shader_integer_dot_productis enabled wherever it is supported.discard, so a fine derivative taken afterwards in its row or column came from the other row instead — wrong for any value that is not linear in the other coordinate. WGSLdiscardnow compiles toOpDemoteToHelperInvocationon the software backend, and the interpreter runs the lane on as a helper (no storage, atomic or color writes) to the end of the shader, including when thediscardsits in a called function. The README's known gap is gone.hal/softwareand itsshaderandrasterpackages are consistently excluded from js/wasm builds. Nineteen files had no build constraint, so a wasm build of these packages failed to compile instead of reporting them as not built for wasm, ashal/allbackendsdoes; in a browser, wgpu uses the browser's WebGPU.Changed
discardnow demotes the fragment to a helper invocation instead of terminating it (P2-VK-018). On Vulkan devices withVK_EXT_shader_demote_to_helper_invocation(promoted to Vulkan 1.3),discardfollows WGSL's semantics: a discarded fragment keeps running until the end of the shader, writing nothing to storage or to its color targets, so derivatives in the rest of its quad stay defined. A shader that does heavy work after adiscardnow pays for it on the discarded fragments too. It used to be lowered toOpKill, which ends the invocation and leaves the quad's later derivatives undefined. Devices without the extension keepOpKill; the choice matches Dawn on Vulkan. New readback tests pin, on every backend, that a store beforediscardlands while one after it does not (also when thediscardis in a called function), and that the quad's fine derivatives stay exact after a lane discards, including for a value that depends on both coordinates.varoutside the function address space (var<workgroup>in a function body was silently lowered to a function variable), and an integer division, remainder or shift by a const-expression zero or past the bit width. No shader in this module was affected. DXIL reads a 32-bit storage element of more than four components withdx.op.bufferLoad, as DXC does, so it no longer needs shader model 6.2.IMEControllerfollow gpucontext's migration notes.Added
TestReadbackCorpusruns naga's GPU readback corpus on every adapter of every backend (P1-INFRA-001). The corpus holds compute shaders and the exact words a GPU must write; static validators accept miscompiles that only a readback catches. The test finds the corpus through the naga version the module resolves (itstestdata/readback), reads the corpus format strictly, opens each adapter with the features its cases require, and reports each case as PASS, FAIL, an expected failure with its card, an unexpected pass (which fails the test) or a skip. On Vulkan a validation-layer message during a case fails that case. The hand copy offlow/short-circuit-or-rtis gone: the corpus has the case.Checked before this PR:
go test ./...with the Vulkan validation layer (30/30 packages), golangci-lint on windows, linux and darwin, builds for js/wasm,-tags rustand 386, and naga's readback corpus on every adapter here (664 pass, one listed expected failure). gg, gogpu, g3d and ui ran their suites against this tree before the PR.