Commit Graph
1214 Commits
Author SHA1 Message Date
teoxoy 5dfcef2ade [naga] add name_reuse test case 2026-10-27 11:30:28 +00:00
teoxoy 2b206a0321 [msl] Hoist body temporaries used by continuing blocks
The MSL backend emits a loop's `continuing` block at the top of the
`while` loop, above the body. Values the body computed and `continuing`
referenced were then either re-evaluated in place, reading whatever
state the body had left behind, or, for statement results such as call
results, hit an `unreachable!` panic.

Now, when a loop has a `continuing` block or `break_if`, the
temporaries it needs from the body are declared ahead of the loop, and
the body assigns to them instead of declaring them.
2026-10-27 11:30:28 +00:00
teoxoy f788839ec1 [naga] add loop continuing block tests 2026-10-27 11:30:28 +00:00
teoxoy f0c49fbe8e [msl] use expression index as name for statement results in remaining
places
2026-10-27 11:30:28 +00:00
Jim Blandy ad5a70aea1 [core] Validate shader stages after applying pipeline overrides.
The WebGPU specification requires pipeline creation to validate
properties of shader stages, like workgroup sizes, that may depend on
the values of pipeline-overridable constants. Previously, wgpu-core
validated stages using an `Interface` built from the module before
overrides were applied, with results contrary to spec. Override
processing was then carried out by `wgpu_hal`, after all validation
had supposedly been taken care of.

This commit has `create_shader_module` save the validated Naga module
instead of creating a `wgpu_hal` shader module. At pipeline creation
time, `StageCompiler::compile` now applies the stage's override values
with `process_overrides`, validates the stage using an `Interface`
built from the result, and, if that validation succeeds, returns a
`CompiledStage` holding the `wgpu_hal` `ShaderModule` created from it.
Dropping the `CompiledStage` destroys that module once the pipeline
has been created.

Since the override values have already been applied, we pass
`wgpu_hal` empty sets of constants for these modules.

Since the `naga::back::pipeline_constants` module is now used by
`wgpu_core` rather than `wgpu_hal` backends, it can't be conditionally
available based on Naga's backend features. Include it
unconditionally.

This change removes `Interface::finalize_entry_point_name`, since we
no longer build an `Interface` at shader module creation. Instead, we
choose entry points from the `naga::Module` directly.

Add new tests: `tests/tests/wgpu-validation/api/overrides.rs`

Fixes #9774.
2026-10-26 23:42:33 +00:00
Abir Deol e084b66aab [naga spv-out] Declare LocalInvocationIndex once in mesh entry points (#10497) 2026-10-18 19:01:10 +00:00
Ilyas Mallah 304a72dca8 naga: Fix build with only arbitrary feature (used for fuzzing) (#10637) 2026-10-17 00:12:27 +00:00
Yilmaz Kiymaz 7f29aa4b57 [naga spv-in] Accept a signed integer ViewIndex input (#10568) 2026-10-16 13:29:15 +00:00
Kevin Reid 60036cdc0a Fix Cargo lint from Rust 1.100 (#10576) 2026-10-14 00:35:08 +00:00
Andy Leiserson eb4678dd08 refactor(naga): Expose indices of ExternalTextureParams members 2026-10-13 19:34:06 +00:00
Andy Leiserson 0ce78c5d0c refactor(naga): Create TypeInner::is_external_image helper 2026-10-13 19:34:06 +00:00
Kevin Reid 20a17523e2 Fix Clippy lint from Rust versions newer than 1.96 (#10575) 2026-10-13 17:06:07 +00:00
Erich Gubler 5422372917 fix(spv-out): panic if instruction word count > u16::MAX in Instruction::to_words (#10537) 2026-10-12 20:05:50 +00:00
Younes BerianeandErich Gubler 03017a1aba [naga wgsl-in] Reject loads of types that contain atomics (#10458)
Co-authored-by: Erich Gubler <erichdongubler@gmail.com>
2026-10-07 21:06:23 +00:00
Erich Gubler ae19a4708b fix(hlsl-out): cast float types back from sign's output 2026-10-05 12:08:36 +00:00
Erich Gubler 24cee9e495 test(naga): add runtime_{f,i}32 to math-functions' sign cvg. 2026-10-05 12:08:36 +00:00
Erich Gubler 3a227342f2 test(naga): add float-sign snapshot 2026-10-05 12:08:36 +00:00
FerdonandFerdon 5a7601baf4 Reject unsigned inputs to sign (#10451)
Co-authored-by: Ferdon <notferdon@users.noreply.github.com>
2026-09-28 05:18:12 +00:00
Jim Blandy d8548d5991 [naga] Include path in HLSL validation error messages. (#10404) 2026-09-25 05:12:39 +00:00
Erich GublerandAndy Leiserson b8bfc58e81 fix(const_eval): handle non-vector Compose select args. (#10350)
Co-authored-by: Andy Leiserson <aleiserson@mozilla.com>
2026-09-23 10:04:22 +00:00
MinerSheepandTeodor Tanasoaia 103a70e581 [naga] const_evaluator: insertBits, extractBits, faceForward, reflect, and refract (#10258)
Co-authored-by: Teodor Tanasoaia <28601907+teoxoy@users.noreply.github.com>
2026-09-22 20:17:45 +00:00
Connor Fitzgerald 35332d2114 Update agent tooling (#10202) 2026-09-18 15:06:10 +00:00
sagudev a072eea89d Move language_extension into naga-types
Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
2026-09-17 10:45:20 +00:00
f365d54803 implement debugPrintf in msl & spv (#9389)
Co-authored-by: atlv <email@atlasdostal.com>
Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
2026-09-15 18:49:35 +00:00
renovate[bot]andConnor Fitzgerald 7dcf5c1820 Update Rust to 1.95 (#10207)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
2026-09-15 16:52:45 +00:00
Atirna 8ef593b61d Fix doc_comments struct_member indices for undocumented members (#10273) 2026-09-14 08:07:06 -04:00
Andy Leiserson 10fe6409d4 Partial snorm10-10-10-2 vertex format support (#10226) 2026-09-11 10:53:31 -04:00
Andy Leiserson aed6771a20 fix(naga): Fix compilation error when glsl-in enabled in isolation (#10297) 2026-09-09 16:00:02 +00:00
Emil Ernerfeldt 9fa0644916 [wgsl-in] Better WGSL error reporting (#9973) 2026-09-05 19:50:59 +02:00
JMS55 dd5c40b474 Support raytracing barycentrics for spirv, and fix spirv 1.4 handling for mesh and raytracing shaders (#10193) 2026-09-04 20:58:29 +00:00
Luo Zhihao 8c1b137be2 Disallow array types in var<immediate> (#10081) 2026-09-02 14:25:31 +00:00
Connor Fitzgerald 9dfc677068 Unbreak trunk: zizmor permissions and stale WGSL snapshots (#10235) 2026-09-01 10:50:23 -07:00
Nazar Mokrynskyi bd54ab2c0e naga: don't emit trailing whitespace after own-line WGSL attributes (#10131) 2026-09-01 06:07:47 -04:00
Connor Fitzgerald 7bcd2125ff ci: Update Vulkan SDK to 1.4.357 (#10213) 2026-08-31 23:57:44 -04:00
Vecvec ef0a0a230f Prevent ray queries hoisted out of loops from generating invalid code (#9945) 2026-08-29 17:32:42 -04:00
JMS55 e9a873e5d2 [SPIR-V out] Correctly lower instance_index in raytracing shaders (#10154) 2026-08-29 14:24:11 +12:00
JMS55 a49c1e1e1d [SPIR-V out] Handle primitive_index in mesh and raytracing shaders (#10153) 2026-08-28 17:34:46 -04:00
Benjamin Brienen 1de9071060 fix spelling of wgpu_ray_tracing_pipeline internal field to match actual spelling (#10183) 2026-08-27 21:20:03 +02:00
Erich Gubler f28f1bf49f fix(naga): reject @location(…)s for input in compute shaders 2026-08-19 20:04:16 +02:00
Erich Gubler 468e9da9a5 fix(naga): disallow result types in compute shaders 2026-08-19 20:04:16 +02:00
Erich Gubler 0b5a96dbd8 refactor(naga): use match for exhaustive stage checks in entry point validation 2026-08-19 20:04:16 +02:00
Benjamin BrienenandErich Gubler 0e47071fbd Validate unary ops in WGSL lowerer (#10036)
Co-authored-by: Erich Gubler <erichdongubler@gmail.com>
2026-08-18 10:50:08 -04:00
Emil Ernerfeldt a6caee7084 Gate @interpolate(linear) behind a downlevel flag (#9972) 2026-08-16 12:11:15 +00:00
Erich Gubler 41bac0dffb diag(naga): add missing end backtick to InvalidInterpolationForInteger msg. (#10023) 2026-08-07 09:39:21 -07:00
Erich Gubler cdc9d0c4dd fix(glsl-out): avoid accidental predecrement in atomicSub negation (#9924) 2026-08-04 09:41:42 +00:00
bolshoytoster fa6d834891 Reduce bloat from wgsl::Error::as_parse_error (#9944) 2026-08-03 10:55:45 -07:00
Jim Blandy c2d5fa49da [naga] Test validation of function/entry point name collision.
Unlike WGSL, Naga IR permits functions to have conflicting names, and
entry points must only have distinct names if they are for the same
shader stage. Document and test this.
2026-08-03 08:22:34 -07:00
Jim Blandy faac3bb16b [naga] Document entry_point argument to process_overrides. 2026-08-03 07:40:24 -07:00
c079e55f53 fix: emit dimension-correct HLSL texture sample offsets (#9951)
Co-authored-by: Matt Van Horn <455140+mvanhorn@users.noreply.github.com>
Co-authored-by: Erich Gubler <erichdongubler@gmail.com>
2026-07-30 12:58:50 +00:00
Jim Blandy 5205d3d1e5 [naga] Update Emit documentation. (#9968) 2026-07-30 06:33:39 -04:00