Commit Graph
812 Commits
Author SHA1 Message Date
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 MarquartandConnor Fitzgerald 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::back::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
Sludge 723abcb1d3 Move changelog entry to the right version (#7145) 2025-02-14 23:38:55 +00:00
Connor Fitzgerald 7e119968ce Properly Deal with Timeouts (#7030) 2025-02-14 23:19:51 +00:00
Connor Fitzgerald 106b709798 Remove HashMaps from wgpu API (#7133)
* Remove HashMaps from Surface API

* Fix Comments and Errors
2025-02-14 14:36:22 -05:00
Kevin Reid fd896695d5 Expose StagingBelt allocation directly.
This allows using `StagingBelt` for copying to textures or any other
operation where copying to an existing buffer is not the desired outcome.

One unfortunate feature of the API is that `allocate()` returns the entire
buffer and an offset, so applications could accidentally touch parts of
the belt buffer outside the intended allocation. It might make more sense
to return `wgpu::BufferSlice`, but that struct cannot be used in
operations like `copy_buffer_to_texture` and does not have getters, so it
is not currently suitable for that purpose.

I also moved `Exclusive` into a module so that its unsafe-to-access field
is properly private, and made various improvements to the `StagingBelt`
documentation, such as acknowledging that `write_buffer_with()` exists.
2025-02-13 12:46:29 -05:00
Kevin Reid c4b25b8794 Duplicate BufferSlice methods onto Buffer and vice versa. (#7123)
This allows users to skip creation of `BufferSlice` if they have no use
for it, and brings `wgpu` closer to the WebGPU API without removing any
Rust convenience. New functions:

* `BufferSlice::slice()`
* `Buffer::map_async()`
* `Buffer::get_mapped_range()`
* `Buffer::get_mapped_range_mut()`
* `Buffer::get_mapped_range()`
2025-02-13 14:40:09 +01:00
Kevin Reid 118a985ccd Allow creating Noop backend through the normal mechanisms. 2025-02-12 22:31:47 -05:00
richerfuandConnor Fitzgerald ff907736ef feat(gles): support gles backend on openharmony (#7085)
* fix(gles): fix gles backend crash on openharmony

* docs: add changelog

* ci: add OpenHarmony to CI

* Update .github/workflows/ci.yml

---------

Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
2025-02-13 03:01:50 +00:00
Adrian WielgosikandAndreas Reich 0f5d575ef3 Lower max_color_attachments limit for GL to 4 (#6994)
Co-authored-by: Andreas Reich <r_andreas2@web.de>
2025-02-13 00:37:34 +00:00
Amr Bashir 2f607d3e64 fix(dx12): map composite alpha mode (#7117)
* fix(dx12): map composite alpha mode

closes #7108

* changelog entry

* add composite modes based on surface target

* fix missing `in` in change log entry
2025-02-12 23:02:50 +00:00
Vecvec 5af9e30009 Fix HLSL single scalar loads (#7104) 2025-02-12 18:05:32 +00:00
Dzmitry Malyshau 189c97c88a Implement ray query candidate intersection generation and confirmation (#7047) 2025-02-12 16:23:29 +01:00
Vecvec 3a4a40aae4 [wgpu-hal] Blas compaction (#7101) 2025-02-12 13:19:07 +00:00
Shaye Garg d7a42933a5 [naga] Error on duplicate fields in structs (#7088)
* error in wgsl-in

* changelog

* add test
2025-02-12 03:27:55 +00:00
VecvecandNicolas Silva 0922631125 Fix transform buffer when building blas (#7062)
Co-authored-by: Nicolas Silva <nical@fastmail.com>
2025-02-10 20:18:41 -05:00
Kamil Jarosz 43eb6c99b0 examples: Call pre_present_notify before presenting (#7074)
According to winit docs, pre_present_notify() should be called right
before calling present().

This actually prevents some issues on Wayland, like freezing the whole
application when the window is not visible (ask me how I know).
2025-02-10 08:19:54 +00:00
Andreas Reich e5e7138169 Expose FeaturesWGPU & FeaturesWebGPU via wgpu crate & implement From (#7086)
* move tests into conditionally compiled mod and place them at the end. add some whitespace for readability

* allow creation of `Features` from `FeaturesWGPU` & `FeaturesWebGPU`
2025-02-10 09:19:14 +01:00
Vecvec 6558deb204 Split up features. (#6905)
Splits up features into wgpu & webgpu features.
2025-02-08 17:38:06 +01:00
Jamie Nicol c07fab2c12 [naga wgsl-in] Allow abstract literals to be used as return values
When lowering a return statement, call expression_for_abstract()
rather than expression() to avoid concretizing the return value. Then,
if the function has a return type, call try_automatic_conversions() to
attempt to convert our return value to the correct type.

This has the unfortunate side effect that some errors that would have
been caught by the validator are instead encountered as conversion
errors by the parser. This may result in a slightly less descriptive
error message in some cases. (See the change to the invalid_functions()
test, for example.)
2025-02-07 11:44:03 -08:00
Shaye Garg dad9d0b577 Fix 3D Texture Views on Dx12 (#7071)
* use all w slices

* update changelog
2025-02-06 22:29:06 +00:00
Vecvec d34707ec3f Rename instance_id & instance_custom_index to instance_index & instance_custom_data (#6780) 2025-02-05 18:23:22 +01:00
Vecvec 7cde4707ec Fix hlsl storage format generation (#6993) 2025-01-31 16:31:03 +01:00
@brody4hire - C. Jonathan Brody a8cc83e17a avoid default features in many dependencies (etc.) (#7031) 2025-01-30 10:30:42 -05:00
@brody4hire - C. Jonathan BrodyandErich Gubler b8a5efc2f2 cleanup: CHANGELOG.md - resolve minor issues (#7024)
Co-authored-by: Erich Gubler <erichdongubler@gmail.com>
2025-01-29 15:34:19 -05:00
Jamie Nicol 6c8d0b061c [naga] Restore return statement at end of functions without return types (#7021) 2025-01-29 13:54:49 -05:00
Kevin Reid 321ee42771 Don’t copy buffer data back to JS if unnecessary, in WebGPU backend. (#7007) 2025-01-27 12:14:09 -05:00
metamuffin 33e8df0f44 Fix deadlock between snatchable_lock and trackers in Queue::write_texture (#7004)
* Fix deadlock between snatchable_lock and trackers in Queue::write_texture

* Fix another deadlock in write_texture between pending_writes and snatchable_lock.
2025-01-27 18:01:57 +01:00
@brody4hire - C. Jonathan BrodyandConnor Fitzgerald df54acc05d use hashbrown in more crates (etc.) (#6938)
Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
2025-01-27 11:50:33 -05:00
Daniel McNab fcbadc9529 Link to TextureBlitterBuilder from TextureBlitter::new (#7003) 2025-01-27 11:30:26 +01:00
ed-2100andConnor Fitzgerald 36ccc9fc1d Fix surface drop order. (#6997)
* Fix surface drop order.

* Add changes to changelog.

* Update SAFETY note.

Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>

---------

Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
2025-01-26 22:23:51 -05:00
Dennis LonoshchukandConnor Fitzgerald 0e7d93ed92 Adds hello window example (#6992)
Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
2025-01-27 02:08:52 +00:00
0fc0b35899 Transition resources (#6678)
* WIP

* Fix typo

* WIP: Implement structure of  command_encoder_transition_resources

* WIP

* More work

* Clippy

* Fix web build

* Use new types for API, more docs

* Add very basic test

* Try to fix test cfg

* Fix merge

* Missed commit

* Use wgt types instead of hal types

* Implement `Clone` for `ShaderModule` (#6939)

* Move to dispatch trait, move more things to wgt

* Move existing code to use new wgt types

* Fixes

* Format import

* Format another file

* Fixes

* Make module private

* Fix imports

* Fix test imports

* Rexport types

* Fix imports

* Fix import

---------

Co-authored-by: Alphyr <47725341+a1phyr@users.noreply.github.com>
Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
2025-01-24 00:54:19 -05:00
SamsonandErich Gubler 04aff59a14 [naga] implement pointer_composite_access WGSL language extension (#6913)
Co-authored-by: Erich Gubler <erichdongubler@gmail.com>
2025-01-23 13:29:17 -05:00
Kent Slaney 3cd2e7caf0 [naga] Remove unused types and global expressions in a single pass.
In compaction, correctly identify unused types and global expressions,
rather than treating all global expressions referred to by
`PendingArraySize::Expression` array lengths as used even if the array
type itself is not.

This is tested by checking that going from expression to type and
back, along with the opposite, is correctly marked as used. It also
checks that adding an unused type using an expression gets compacted
out.

See the comments on `ModuleTracer::type_expression_tandem` for
details.

Fixes #6788.
2025-01-23 08:11:18 -08:00
Daniel McNab 5e2bcc9191 Improve the docs of PipelineCache and friends (#6978) 2025-01-23 11:56:05 +01:00
Connor Fitzgerald 4ed5021996 Ban Dynamic Offsets and Binding Arrays in the Same Bind Group (#6811)
* Ban Dynamic Offsets and Binding Arrays in the Same Bind Group

* Add Tests and Uniform Buffer Restriction
2025-01-20 13:28:32 -05:00
b626020769 [naga] parse and validate @must_use attribute (#6801)
* feat: parse and enforce `@must_use` attribute

* feat: refuse `@must_use` of void function

* generated naga/tests/out/ir

* revert extraneous changes

* fix clippy

* update repeated attribute error to trunk format

* struct members can't have `@must_use`

* review fixes

* Remove must_use from FunctionResult and revert the related changes

---------

Co-authored-by: turbocrime <turbocrime@users.noreply.github.com>
Co-authored-by: Jamie Nicol <jnicol@mozilla.com>
2025-01-20 18:09:36 +00:00
Andreas Reich 426c1d364f Fix missing wgt re-export on wgpu for CopyExternalImageDestInfo (#6962) 2025-01-20 18:00:34 +00:00
@brody4hire - C. Jonathan Brody 68a6f3bf8c update & clean up recent changes in CHANGELOG.md (#6948) 2025-01-19 09:16:07 +01:00
Andreas Reich e2d14c677a Fix building wgpu with --no-default-feautures on web (wasm32-unknown-unknown) (#6946)
* Fix wasm build without features

* silence unused warnings if wgc & webgpu are disabled

* add no-features check for web ci

* add changelog entry
2025-01-18 15:05:57 -05:00
Erich Gubler 3b3e1939f9 Eliminate overflow in query set bounds checks (#6933) 2025-01-17 16:36:22 +00:00
VecvecandConnor Fitzgerald bdef8c0407 [spirv] Stop naga causing undefined behavior in rayQueryGet*Intersection (#6752)
Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
2025-01-17 00:04:33 +00:00
Andreas Reich d5d5157b5d Add "Most objects in wgpu are now Clone" to highlight section (#6930) 2025-01-16 11:13:04 -05:00
@brodycj - C. Jonathan BrodyandConnor Fitzgerald beb33414c7 trace directory path updates (#6924)
Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
2025-01-16 14:50:15 +00:00