955 Commits

Author SHA1 Message Date
Teodor Tanasoaia
6ea7962da7
[d3d12] remove the need for dxil.dll (#7566) 2025-04-17 16:21:36 +02:00
Erich Gubler
c24bf0f56f
chore(CHANGELOG): run prettier (#7556) 2025-04-16 22:34:13 -04:00
Erich Gubler
65c06c2b21 feat(naga): add pack4x{I,U}8Clamp built-ins 2025-04-16 15:07:11 -04:00
Teodor Tanasoaia
ae3241f352
add changelog entries (#7551) 2025-04-16 15:47:01 +00:00
bernhl
06ee718ddd
[naga] Allow Scalar for MathFunction::Distance (#7530)
Co-authored-by: Erich Gubler <erichdongubler@gmail.com>
2025-04-16 08:24:32 -07:00
Andy Leiserson
09178f2400
[naga] Track globals used directly by a named expression (#7540) 2025-04-15 15:01:19 -04:00
Connor Fitzgerald
700f235378 Update changelog for 25.0.1
# Conflicts:
#	CHANGELOG.md
2025-04-11 15:18:28 -04:00
Connor Fitzgerald
27115f7d57
Add bindless support to changelog (#7516) 2025-04-11 17:39:16 +00:00
Robert Bamler
c7d0af156d Implement dot4I8Packed and dot4U8Packed
Closes #7481.

This implementation roughly follows approach 2 outlined in #7481, i.e.,
it adds a polyfill for the signed and unsigned dot product of packed
vectors for each platform. It doesn't use the specialized instructions
that are available for this operation on SPIR-V (with capability
DotProductInput4x8BitPacked).
2025-04-11 13:32:10 +02:00
Vecvec
65c56fdee4
[spv-out] Prevent ray intersection functions overwriting each other. (#7497) 2025-04-11 11:18:45 +02:00
Connor Fitzgerald
e5a2e440b2 Add f16 to changelog 2025-04-10 20:41:28 -04:00
Bruce Mitchener
fec411cf2d
Remove MaintainBase (#7508) 2025-04-10 15:09:29 -04:00
Connor Fitzgerald
8c2c2ce203
Release v25 (#7505) 2025-04-10 16:13:02 +00:00
Vecvec
8010203281 Rework acceleration structure build tracking. 2025-04-09 22:27:04 -04:00
Vecvec
1c4b73c098
Implement as_hal for BLASes and TLASes (#7303) 2025-04-09 14:50:43 -04:00
Andy Leiserson
d223bb582f [naga] Disallow logical operators && and || on vectors
Fixes #6856
2025-04-09 08:15:47 -07:00
Sylvain Benner
14690470bb
[metal] Metal compute shader passthrough (#7326)
Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
2025-04-09 14:25:41 +00:00
Vecvec
e8e66afb72
Fix new acceleration structure building validation errors. (#7486) 2025-04-07 15:17:06 +02:00
Connor Fitzgerald
211d2ec0f3
Backport v24 changelogs (#7477) 2025-04-04 10:11:13 +02:00
Connor Fitzgerald
c860a2cf8c
Rename and unsafe start_capture -> start_graphics_debugger_capture (#7470)
* Improve `start_capture` docs

* Docs
2025-04-03 13:07:22 -04:00
Andy Leiserson
2c777f79f0
[naga wgsl-in] vecN() constructors and let type conversions (#7367)
* Support `vecN()` constructors (fixes #7356)
* Apply automatic conversions to the initializer for `let` bindings
2025-04-02 15:52:40 +00:00
Andy Leiserson
c7c79a0dc9
Disallow taking the address of a vector component (#7284) 2025-03-28 11:32:06 +01:00
Jer
efbfa36ded
Dealing with data too large for a single buffer (#6138)
* init files, dir structure

* wip: it's working need to suss out the readme and some of the consts...

* ok that's probably good enough for a first pass...

* chore: spelling

* chore: readme tweaks

* chore: clippy and fmt

* chore: add self and changes to changelog.md

* fix: typo and remove env_logger via cfg flag for wasm builds (which this doesn't supprot anyway)

* refactor: bring inline with newer wgpu

* refactor: bring inline with newer wgpu

* chore: work on the readme a bit...

* refactor: remove a bunch of everything, be simple

* wip: get a test going

* wip: remove unrequired pub(s)...

* refactor: remove a bunch of everything, be simple

wip: get a test going

* wip: remove unrequired pub(s)...

wip: remove unrequired pub(s)...

* chore: cleanups, typos, simplifying

* chore: reconcile changelog diffs

* fix: re-add our change to the changelog

* wip: finess the docs a bit per request...

* chore: trying to get the woring right...

* chore: trying to get the woring right...

* fix: typos

* fix: spelling

* Update mod.rs

swap all loops over to 'for' by request.

Flume's sender is already Send/Sync

chunks will already split for us

.unwraps() unwraps everywhere!

* Update CHANGELOG.md

Co-authored-by: Jim Blandy <jimb@red-bean.com>

* 1GB as the example says we'll do

- 1GB as the example says we'll do
- update readme for windows users.

* init files, dir structure

* wip: it's working need to suss out the readme and some of the consts...

* ok that's probably good enough for a first pass...

* chore: spelling

* chore: readme tweaks

* chore: clippy and fmt

* chore: add self and changes to changelog.md

* fix: typo and remove env_logger via cfg flag for wasm builds (which this doesn't supprot anyway)

* refactor: bring inline with newer wgpu

* refactor: bring inline with newer wgpu

* chore: work on the readme a bit...

* refactor: remove a bunch of everything, be simple

* wip: get a test going

* wip: remove unrequired pub(s)...

* wip: remove unrequired pub(s)...

wip: remove unrequired pub(s)...

* chore: cleanups, typos, simplifying

* fix: re-add our change to the changelog

* wip: finess the docs a bit per request...

* chore: trying to get the woring right...

* chore: trying to get the woring right...

* fix: typos

* fix: spelling

* Update mod.rs

swap all loops over to 'for' by request.

Flume's sender is already Send/Sync

chunks will already split for us

.unwraps() unwraps everywhere!

* Update CHANGELOG.md

Co-authored-by: Jim Blandy <jimb@red-bean.com>

* 1GB as the example says we'll do

- 1GB as the example says we'll do
- update readme for windows users.

* bring up to date with trunk

sync with trunk.
make more of Jim's changes

* some of the consts have changed name.

* small tweaks

* what is the flag called now?

what is the flag called now?

* Update shader.wgsl

naming things betterer

* Update README.md

reword readme

* Update README.md

simplify readme

* Update mod.rs

remove unused

* well at least it compiles again

* BUG: ... it seems to run forever and never complete.

* nicer shader module creation

* ... add logging to track down infinite hangtime...

* use 2 buffers in the test

* test and example pass (now they do the same number of buffers..

* that's better...

* fix: remove duplicate entries

* fix: whitespace

* move changelog entry to #unreleased per request

* fix: target_arch != wasm to satiate pipeline

* fix: target_arch != wasm to satiate pipeline

* pipeline want's us to allow allows...

* savage hacks to make the wasm build ignore our test

* fix: allow the allowing of allows that allow the dead_code.

* Fix: no tests on wasm

---------

Co-authored-by: Jim Blandy <jimb@red-bean.com>
2025-03-28 02:24:29 +00:00
Daniel McNab
5a583b1fb7
Polyfill unpackUnorm4x8 and friends on unsupported GLSL versions (#7408) 2025-03-27 15:55:14 +00:00
Kevin Reid
ee78d61390 Move Naga IR types from naga/src/lib.rs to naga/src/ir/mod.rs.
The types remain available at their original paths by `pub use ir::*`.
This may or may not be a temporary measure for migration.

The only changes to the moved code are:
* Fixing doc links.
* Moving `pub use block::Block` to the top.
2025-03-18 17:06:04 -07:00
Kevin Reid
fcac8a9b28 Add Device::noop().
This is a useful shortcut for tests and example code, allowing it to
create a noop device without needing to deal with nonexistent
fallibility and asynchrony.
2025-03-14 20:59:28 -04:00
Kevin Reid
fbe005f11a Make request_adapter() report which backends were tried.
This will help users determine whether the problem is:

* a backend is not statically enabled
* a backend is not dynamically enabled
* no drivers or physical adapters are present for that backend
  (further distinction would be useful here)
* no adapters met the required criteria

There are deficiencies in the reporting of WebGPU vs. WebGL support.
Those would best be fixed by also fixing the mutual exclusion of those
backends.
2025-03-14 11:45:49 +01:00
Andreas Reich
fedc80eb80
[wgsl-in, wgsl-out, glsl-in] WebGPU compliant dual source blending feature (#7146)
Makes the dual source implementation in wgpu WebGPU spec compliant.
Furthermore, makes the dual source blending extension available when targeting WebGPU.
2025-03-08 21:07:37 +01:00
Jamie Nicol
6a61e62f55
[naga wgsl-in] Handle automatic type conversions for switch selector and case expressions (#7250)
This allows abstract-typed expressions to be used for some or all of
the switch selector and case selectors. If these are all not
convertible to the same concrete scalar integer type we return an
error. If all the selector expressions are abstract then they are
concretized to i32.

The note previously provided by the relevant error message, suggesting
adding or removing the `u` suffix from case values, has been
removed. While useful for simple literal values, it was comically
incorrect for more complex case expressions. The error message should
still be useful enough to allow the user to easily identify the
problem.
2025-03-07 03:50:36 +00:00
Kent Slaney
2fac7fa954 [naga] Correct override resolution in array lengths.
When the user provides values for a module's overrides, rather than
replacing override-sized array types with ordinary array types (which
could require adjusting type handles throughout the module), instead
edit all overrides to have initializers that are fully-evaluated
constant expressions. Then, change all backends to handle
override-sized arrays by retrieving their overrides' values.

For arrays whose sizes are override expressions, not simple references
to a specific override's value, let front ends built array types that
refer to anonymous overrides whose initializers are the necessary
expression.

This means that all arrays whose sizes are override expressions are
references to some `Override`. Remove `naga::PendingArraySize`, and
let `ArraySize::Pending` hold a `Handle<Override>` in all cases.

Expand `tests/gpu-tests/shader/array_size_overrides.rs` to include the
test case that motivated this approach.
2025-03-06 14:21:40 -08:00
Kevin Reid
7319512778
Additional documentation for buffer mapping, types, and constants. (#7283)
* Additional documentation for buffer mapping, types, and constants.

* Clarify `Snorm` texture format conversion.

* Fix typo.
2025-03-06 19:08:34 +00:00
Jamie Nicol
7df6e477cf [naga wgsl-in] Do not eagerly concretize local const declarations of abstract types
Instead allow the const to be converted each time it is const
evaluated as part of another expression. This allows an abstract const
to be used as a different type depending on the context.

As a result, abstract types may now find their way in to the IR, which
we don't want. This occurs because the compact pass treats named
expressions as used, mostly so that our snapshot tests are more
useful, and therefore does not remove them. To prevent this, we avoid
adding abstract-typed local consts to the named expressions list. This
will have no functional effect on any shaders produced by the
backends, but some unused local const declarations will no longer be
present.
2025-03-05 20:39:48 -08:00
Andreas Reich
f884a4148a docs(CHANGELOG): move Features split entry to Major Features
This entry is backwards-compatible, so it can be "promoted" from
`Changes` to "just" a highlight. 🙂
2025-03-05 22:31:02 -05:00
Andreas Reich
3b84750413 docs(CHANGELOG): remove no_std trace path entry
This isn't user-facing, so there doesn't seem to be a real reason to
keep this here.
2025-03-05 22:31:02 -05:00
Vecvec
5b3266db23
Support getting hit vertex positions (#7183) 2025-03-04 20:06:44 +01:00
SupaMaggie70Incorporated
a6109bf69b
Mesh shaders - initial wgpu hal changes (#7089)
* Initial(untested commit), vulkan and gles only supported

* Maybe fixed compiles for metal and dx12

* Hopefully fixed compiles for other backends and updated to functional(?) vulkan thing

* Fixed the clippy warning

* Fixed silly documentation mistake

* Fixed issue with multiview feature

* Dummy commit for dummy CI

The CI pooped itself, hopefully this fixes that. Will probably be undone either way.

* Re trigger CI checks, to avoid #7126

* Changes based on code review

* Fixed clippy warning, broken cargo.lock

* Unfucked cargo.lock for real this time

* Switched match to if-let in accordance with review

* Updated changelog

* Fix CI error

Done from web out of impatience

* CI is very angry 😡

Made CI less angry by fixing formatting(hopefully). This commit was also done from GitHub web.

* Removed comment in following request

* Update wgpu-hal/src/vulkan/adapter.rs

---------

Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
2025-03-04 00:12:38 +00:00
Zachary Harrold
e4cc5cb9ad
Use core and alloc instead of std in naga (#7256)
* Use `core` and `alloc` instead of `std` in `naga`

* Update CHANGELOG.md

* `taplo fmt`

* Fix documentation links to refer to `hashbrown::HashMap`
2025-03-03 16:44:53 -05:00
JMS55
2764e7a399
Add wgpu_hal::vulkan::Adapter::texture_format_as_raw (#7228)
* Add wgpu_hal::vulkan::Adapter::texture_format_as_raw

* Add changelog entry
2025-02-28 20:44:09 -05:00
Devon
d6ca412732
Add textureBarrier (#7173) 2025-02-27 20:27:15 +01:00
Jamie Nicol
b7d1f4c6cf
[naga spv-out] Ensure loops generated by SPIRV backend are bounded (#7080)
If it is undefined behaviour for loops to be infinite, then, when
encountering an infinite loop, downstream compilers are able to make
certain optimizations that may be unsafe. For example, omitting bounds
checks. To prevent this, we must ensure that any loops emitted by our
backends are provably bounded. We already do this for both the MSL and
HLSL backends. This patch makes us do so for SPIRV as well.

The construct used is the same as for HLSL and MSL backends: use a
vec2<u32> to emulate a 64-bit counter, which is incremented every
iteration and breaks after 2^64 iterations.

While the implementation is fairly verbose for the SPIRV backend, the
logic is simple enough. The one point of note is that SPIRV requires
`OpVariable` instructions with a `Function` storage class to be
located at the start of the first block of the function. We therefore
remember the IDs generated for each loop counter variable in a
function whilst generating the function body's code. The instructions
to declare these variables are then emitted in `Function::to_words()`
prior to emitting the function's body.

As this may negatively impact shader performance, this workaround can
be disabled using the same mechanism as for other backends: eg calling
Device::create_shader_module_trusted() and setting the
ShaderRuntimeChecks::force_loop_bounding flag to false.
2025-02-25 15:23:44 +01:00
Jamie Nicol
dd2d53814d [naga wgsl-in] Do not eagerly concretize global const declarations of abstract types
Instead allow the const to be converted and each time it is const
evaluated as part of another expression. This allows an abstract const
to be used as a different type depending on the context.

A consequence of this is that abstract types may now find their way to
the validation stage, which we don't want. We therefore additionally
now ensure that the compact pass removes global constants of abstract
types. This will have no *functional* effect on shaders generated by
the backends, as the expressions belonging to the abstract consts in
the IR will not actually be used, as any usage in the input shader
will have been const-evaluated away. Certain unused const declarations
will now be removed, however, as can be seen by the effect on the
snapshot outputs.
2025-02-25 09:25:25 +00:00
Kent Slaney
6be5558865
[naga] allow trailing commas in template lists (#7142)
Co-authored-by: Erich Gubler <erichdongubler@gmail.com>
2025-02-25 03:02:55 +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
Alexandre Mommers
92a1702c3c
[naga wgsl-in] Add support for unsigned types when calling textureLoad with the level parameter. (#7058) 2025-02-24 21:13:06 +00:00
Kevin Reid
3447b3e7b6 Polish documentation of PresentMode.
* Link to where it is used and how to check support.
* Link from `Auto*` to the variants they refer to.
* Organize mode information into lists.
* Document which value is the default value.
* Various wording changes.

I mostly did not touch the descriptions of the individual modes.
I think that they could use some explanation of jargon (what is a
“presentation engine”, really?) but I am not the person to write that.
2025-02-24 10:15:40 +01:00
Connor Fitzgerald
ae5dc0e7cb
Target Specific Compilation (#7076) 2025-02-22 12:38:58 +01:00
Mads Marquart
7b00140b16
Add layer observer based on raw-window-metal (#7026)
Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
2025-02-20 21:30:58 +00:00
Kevin Reid
9da04c2b0b
Add getters and From implementations to BufferSlice. (#7148)
* Add getters to `BufferSlice` to obtain its parts.

* Add conversions from `BufferSlice` to `BufferBinding` and `BindingResource`.
2025-02-17 11:06:13 +01:00
Junjun Dong
98649a79a0
feat: update naga:🔙:spv::Function::to_words (#7156) 2025-02-16 21:43:24 -05:00
CrazyboyQCD
a45e2db43a
[Naga] replace unicode-xid with unicode-ident (#7135) 2025-02-14 20:58:17 -05:00