Commit Graph
27 Commits
Author SHA1 Message Date
Andy Leiserson 82fa8e2a94 [naga] Remove non-essential override references via compaction
Adds a mode to compaction that removes unused functions, global
variables, and named types and overrides. This mode is used
everywhere except the compaction at the end of lowering, where
it is important to preserve unused items for type checking and
other validation of the module.

Pruning all but the active entry point and then compacting makes
`process_overrides` tolerant of missing values for overrides that are
not used by the active entry point.

Fixes #5885
2025-06-12 14:22:18 +09:00
Andy Leiserson 850c3d4310 [naga] Write only the current entrypoint (#7626)
Changes the MSL and HLSL backends to support writing only a single entry
point, and uses them that way in wgpu-hal.

This is working towards a fix for #5885.

* Increase the limit in test_stack_size
2025-04-30 09:59:41 +02:00
Bruce Mitchener f89ede7cd8 [doc] Fix unbalanced backticks (#7385) 2025-03-21 03:03:37 +00:00
Wouter de Bruijn dfb09c260f naga-cli: forward '--keep-coordinate-space' flag to GLSL backend (#7206) 2025-02-24 23:21:48 +00:00
Erich Gubler 16f012bc93 fix(naga-cli): allow output files with --stdin-file-path 2024-10-31 16:13:48 -07:00
Erich Gubler 25f0819edd feat(naga-cli)!: init. logger to INFO by default 2024-10-30 10:25:34 -07:00
Erich Gubler 7aa00a07e1 refactor(naga-cli): inline emit_annotated_error 2024-10-22 14:42:27 -04:00
Erich Gubler 28912feb00 fix(naga-cli): reimpl. emit_annotated_error with WithSpan::emit_to_stderr_with_path 2024-10-22 14:42:27 -04:00
Hamir Mahal 8e787eb70a style: simplify string formatting for readability (#6316) 2024-09-24 23:40:53 -04:00
Dzmitry Malyshau eb18854b46 spv-out: configure source language in debug info 2024-09-13 11:37:23 -07:00
Kornel 222f1ea733 Reduce code size of error handling 2024-08-19 14:38:20 +01:00
teoxoy ccd6d2ca48 remove BoundsCheckPolicies.image_store 2024-07-26 10:44:22 -07:00
Imbris 3a6814770a Allow unconsumed inputs in fragment shaders (#5531)
* Allow unconsumed inputs in fragment shaders by removing them from vertex
outputs when generating HLSL.

Fixes https://github.com/gfx-rs/wgpu/issues/3748

* Add naga::back::hlsl::FragmentEntryPoint for providing information
  about the fragment entry point when generating vertex entry points via
  naga::back::hlsl::Writer::write. Vertex outputs not consumed by the
  fragment entry point are omitted in the final output struct.
* Add naga snapshot test for this new feature,
* Remove Features::SHADER_UNUSED_VERTEX_OUTPUT,
  StageError::InputNotConsumed, and associated validation logic.
* Make wgpu dx12 backend pass fragment shader info when generating
  vertex HLSL.
* Add wgpu regression test for allowing unconsumed inputs.

* Address review

* Add note that nesting structs for the inter-stage interface can't
  happen.
* Remove new TODO notes (some addressed and some transferred to an issue
  https://github.com/gfx-rs/wgpu/issues/5577)
* Changed issue that regression test refers to 3748 -> 5553
* Add debug_assert that binding.is_some() in hlsl writer
* Fix typos caught in CI

Also, fix compiling snapshot test when hlsl-out feature is not enabled.
2024-07-04 09:08:46 +02:00
Théo Monnom 0f6abc99ee [naga-cli] add --defines options for the glsl parser (#5859) 2024-06-23 07:21:56 +00:00
Erich Gubler f1b06f55ce chore: satisfy clippy::assigning_clones 2024-05-13 10:10:54 -04:00
matt rice e0ac24aeab [naga-cli] Add input-kind and shader-stage args (#5411) 2024-04-18 12:41:18 +02:00
ea77d5674d Subgroup Operations (#5301)
Co-authored-by: Jacob Hughes <j@distanthills.org>
Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
Co-authored-by: atlas dostal <rodol@rivalrebels.com>
2024-04-17 15:25:52 -04:00
vero 911baf3e8c Add DirectX ShaderModel 6.1-6.7 detection (#5498) 2024-04-06 11:35:59 +02:00
teoxoy 7df0aa6364 move the burden of evaluating override-expressions to users of naga's API 2024-04-05 18:07:41 +02:00
Jim Blandy 7bed9e8bce [naga-cli] Add --override option. 2024-04-05 18:07:41 +02:00
teoxoy 3bda381812 add pipeline constants plumbing 2024-04-05 18:07:41 +02:00
Patrick Cleavelin a63bec8cd6 add cli arg to choose metal version 2024-03-15 10:39:40 +01:00
wayneandAlphyr c4b5cc94ad don't panic if naga parsing of shader source fails (#5034)
* naga: glsl parser should return singular ParseError similar to wgsl

* wgpu: treat glsl the same as wgsl when creating ShaderModule

* naga: update glsl parser tests to use new ParseError type

* naga: glsl ParseError errors field should be public

* wgpu-core: add 'glsl' feature

* fix some minor bugs in glsl parse error refactor

* naga/wgpu/wgpu-core: improve spirv parse error handling

* wgpu-core: feature gate use of glsl and spv naga modules

* wgpu: enable wgpu-core glsl and spirv features when appropriate

* obey clippy

* naga: derive Clone in Type

* naga: don't feature gate Clone derivation for Type

* obey cargo fmt

* wgpu-core: use bytemuck instead of zerocopy

* wgpu-core: apply suggested edit

* wgpu-core: no need to borrow spirv code

* Update wgpu/src/backend/wgpu_core.rs

Co-authored-by: Alphyr <47725341+a1phyr@users.noreply.github.com>

---------

Co-authored-by: Alphyr <47725341+a1phyr@users.noreply.github.com>
2024-01-23 10:25:25 -05:00
Jim Blandy 9013e226c3 [naga-cli] Add --bulk-validate option. 2023-12-24 12:03:28 -08:00
Jim Blandy 79a6a4b0d2 [naga-cli] Abstract out parsing of input file. 2023-12-24 12:03:28 -08:00
Jim Blandy a820a3ffba [naga]: Make snapshot tests include paths in errors.
Following Rust convention, let `naga::front::wgsl::ParseError`'s
methods `emit_to_stderr_with_path` and `emit_to_string_with_path`
accept any `AsRef<Path>` argument as the path.

Pass input paths in snapshot tests, so that failures processing
shaders name the input file being processed.
2023-11-21 21:47:03 +01:00
Connor Fitzgerald 34e947de4b Integration of Naga into Repo (#4296) 2023-10-25 16:51:36 -04:00