Commit Graph

1991 Commits

Author SHA1 Message Date
teoxoy
90f7377cc9 introduce ResourceType trait 2024-07-02 18:06:19 +02:00
teoxoy
a422d1cba2 remove ResourceInfo.id 2024-07-02 18:06:19 +02:00
teoxoy
66777cc80d remove PassErrorScope::PassEncoder and id arg of PassErrorScope::Pass 2024-07-02 18:06:19 +02:00
teoxoy
d26aef554e use .error_ident() for log::trace! in render_pass_end 2024-07-02 18:06:19 +02:00
teoxoy
fc6fe76fce trace only render_pass_end_with_unresolved_commands 2024-07-02 18:06:19 +02:00
teoxoy
981db9be33 trace only compute_pass_end_with_unresolved_commands 2024-07-02 18:06:19 +02:00
Nicolas Silva
f25e07b984 Fix soundness issue with Snatchable
The code was written with the incorrect assumption that if no lifetime is specified in a method definition, then all lifetimes are elided to the lifetime of self. In fact only lifetimes in the returned value are elided to the lifetime of self, and other parameters get their own lifetimes.

Kudos to @teoxoy for catching the issue!
2024-07-01 18:41:12 +02:00
Andreas Reich
0a76c0fa84
Renderpass take resource ownership (#5884)
* share timestamp write struct

* Make name of set_push_constants methods consistently plural

* remove lifetime bounds of resources passed into render pass

* first render pass resource ownership test

* introduce dynrenderpass & immediately create ArcCommands and take ownership of resources passed on pass creation

* Use of dynrenderpass in deno

* Separate active occlusion & pipeline statitics query

* resolve render/compute command is now behind `replay` feature

* add vertex & index buffer to ownership test

* test for pipeline statistics query

* add occlusion query set to pass resource test

* add tests for resource ownership of render pass query timestamps

* RenderPass can now be made 'static just like ComputePass. Add respective test

* Extend encoder_operations_fail_while_pass_alive test to also check encoder locking errors with render passes

* improve changelog entry on lifetime bounds
2024-07-01 18:36:24 +02:00
Christofer Nolander
c9a2d972ad
buffer size mismatch: more detail in error message (#5858)
* buffer size mismatch: more detail in error message

* wrong buffer size: change name of fields
2024-07-01 13:10:37 +02:00
dependabot[bot]
9d12a0a122
build(deps): bump the patch-updates group across 1 directory with 27 updates (#5895)
Bumps the patch-updates group with 24 updates in the / directory:

| Package | From | To |
| --- | --- | --- |
| [bit-vec](https://github.com/contain-rs/bit-vec) | `0.6.3` | `0.7.0` |
| [bitflags](https://github.com/bitflags/bitflags) | `2.5.0` | `2.6.0` |
| [bytemuck](https://github.com/Lokathor/bytemuck) | `1.16.0` | `1.16.1` |
| [libloading](https://github.com/nagisa/rust_libloading) | `0.8.3` | `0.8.4` |
| [log](https://github.com/rust-lang/log) | `0.4.21` | `0.4.22` |
| [serde_json](https://github.com/serde-rs/json) | `1.0.117` | `1.0.119` |
| [bit-set](https://github.com/contain-rs/bit-set) | `0.5.3` | `0.6.0` |
| [syn](https://github.com/dtolnay/syn) | `2.0.66` | `2.0.68` |
| [ab_glyph](https://github.com/alexheretic/ab-glyph) | `0.2.26` | `0.2.27` |
| [backtrace](https://github.com/rust-lang/backtrace-rs) | `0.3.72` | `0.3.73` |
| [cc](https://github.com/rust-lang/cc-rs) | `1.0.99` | `1.0.103` |
| [clap](https://github.com/clap-rs/clap) | `4.5.6` | `4.5.8` |
| [deno_unsync](https://github.com/denoland/deno_unsync) | `0.3.4` | `0.3.5` |
| [derive_more](https://github.com/JelteF/derive_more) | `0.99.17` | `0.99.18` |
| [either](https://github.com/rayon-rs/either) | `1.12.0` | `1.13.0` |
| [lazy_static](https://github.com/rust-lang-nursery/lazy-static.rs) | `1.4.0` | `1.5.0` |
| [memchr](https://github.com/BurntSushi/memchr) | `2.7.2` | `2.7.4` |
| [miniz_oxide](https://github.com/Frommi/miniz_oxide) | `0.7.3` | `0.7.4` |
| [num-bigint](https://github.com/rust-num/num-bigint) | `0.4.5` | `0.4.6` |
| [polling](https://github.com/smol-rs/polling) | `3.7.1` | `3.7.2` |
| [proc-macro2](https://github.com/dtolnay/proc-macro2) | `1.0.85` | `1.0.86` |
| [tinyvec](https://github.com/Lokathor/tinyvec) | `1.6.0` | `1.6.1` |
| [url](https://github.com/servo/rust-url) | `2.5.0` | `2.5.2` |
| [uuid](https://github.com/uuid-rs/uuid) | `1.8.0` | `1.9.1` |



Updates `bit-vec` from 0.6.3 to 0.7.0
- [Commits](https://github.com/contain-rs/bit-vec/commits)

Updates `bitflags` from 2.5.0 to 2.6.0
- [Release notes](https://github.com/bitflags/bitflags/releases)
- [Changelog](https://github.com/bitflags/bitflags/blob/main/CHANGELOG.md)
- [Commits](https://github.com/bitflags/bitflags/compare/2.5.0...2.6.0)

Updates `bytemuck` from 1.16.0 to 1.16.1
- [Changelog](https://github.com/Lokathor/bytemuck/blob/main/changelog.md)
- [Commits](https://github.com/Lokathor/bytemuck/compare/v1.16.0...v1.16.1)

Updates `libloading` from 0.8.3 to 0.8.4
- [Commits](https://github.com/nagisa/rust_libloading/compare/0.8.3...0.8.4)

Updates `log` from 0.4.21 to 0.4.22
- [Release notes](https://github.com/rust-lang/log/releases)
- [Changelog](https://github.com/rust-lang/log/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rust-lang/log/compare/0.4.21...0.4.22)

Updates `serde_json` from 1.0.117 to 1.0.119
- [Release notes](https://github.com/serde-rs/json/releases)
- [Commits](https://github.com/serde-rs/json/compare/v1.0.117...v1.0.119)

Updates `bit-set` from 0.5.3 to 0.6.0
- [Release notes](https://github.com/contain-rs/bit-set/releases)
- [Commits](https://github.com/contain-rs/bit-set/commits)

Updates `syn` from 2.0.66 to 2.0.68
- [Release notes](https://github.com/dtolnay/syn/releases)
- [Commits](https://github.com/dtolnay/syn/compare/2.0.66...2.0.68)

Updates `ab_glyph` from 0.2.26 to 0.2.27
- [Release notes](https://github.com/alexheretic/ab-glyph/releases)
- [Commits](https://github.com/alexheretic/ab-glyph/compare/ab-glyph-0.2.26...ab-glyph-0.2.27)

Updates `backtrace` from 0.3.72 to 0.3.73
- [Release notes](https://github.com/rust-lang/backtrace-rs/releases)
- [Commits](https://github.com/rust-lang/backtrace-rs/compare/0.3.72...0.3.73)

Updates `cc` from 1.0.99 to 1.0.103
- [Release notes](https://github.com/rust-lang/cc-rs/releases)
- [Changelog](https://github.com/rust-lang/cc-rs/blob/main/CHANGELOG.md)
- [Commits](https://github.com/rust-lang/cc-rs/compare/1.0.99...cc-v1.0.103)

Updates `clap` from 4.5.6 to 4.5.8
- [Release notes](https://github.com/clap-rs/clap/releases)
- [Changelog](https://github.com/clap-rs/clap/blob/master/CHANGELOG.md)
- [Commits](https://github.com/clap-rs/clap/compare/clap_complete-v4.5.6...v4.5.8)

Updates `clap_builder` from 4.5.6 to 4.5.8
- [Release notes](https://github.com/clap-rs/clap/releases)
- [Changelog](https://github.com/clap-rs/clap/blob/master/CHANGELOG.md)
- [Commits](https://github.com/clap-rs/clap/compare/v4.5.6...v4.5.8)

Updates `clap_derive` from 4.5.5 to 4.5.8
- [Release notes](https://github.com/clap-rs/clap/releases)
- [Changelog](https://github.com/clap-rs/clap/blob/master/CHANGELOG.md)
- [Commits](https://github.com/clap-rs/clap/compare/v4.5.5...v4.5.8)

Updates `deno_unsync` from 0.3.4 to 0.3.5
- [Commits](https://github.com/denoland/deno_unsync/commits)

Updates `derive_more` from 0.99.17 to 0.99.18
- [Release notes](https://github.com/JelteF/derive_more/releases)
- [Changelog](https://github.com/JelteF/derive_more/blob/v0.99.18/CHANGELOG.md)
- [Commits](https://github.com/JelteF/derive_more/compare/v0.99.17...v0.99.18)

Updates `either` from 1.12.0 to 1.13.0
- [Commits](https://github.com/rayon-rs/either/compare/1.12.0...1.13.0)

Updates `lazy_static` from 1.4.0 to 1.5.0
- [Release notes](https://github.com/rust-lang-nursery/lazy-static.rs/releases)
- [Commits](https://github.com/rust-lang-nursery/lazy-static.rs/compare/1.4.0...1.5.0)

Updates `memchr` from 2.7.2 to 2.7.4
- [Commits](https://github.com/BurntSushi/memchr/compare/2.7.2...2.7.4)

Updates `miniz_oxide` from 0.7.3 to 0.7.4
- [Changelog](https://github.com/Frommi/miniz_oxide/blob/master/CHANGELOG.md)
- [Commits](https://github.com/Frommi/miniz_oxide/commits)

Updates `num-bigint` from 0.4.5 to 0.4.6
- [Changelog](https://github.com/rust-num/num-bigint/blob/master/RELEASES.md)
- [Commits](https://github.com/rust-num/num-bigint/compare/num-bigint-0.4.5...num-bigint-0.4.6)

Updates `object` from 0.35.0 to 0.36.1
- [Changelog](https://github.com/gimli-rs/object/blob/master/CHANGELOG.md)
- [Commits](https://github.com/gimli-rs/object/compare/0.35.0...0.36.1)

Updates `polling` from 3.7.1 to 3.7.2
- [Release notes](https://github.com/smol-rs/polling/releases)
- [Changelog](https://github.com/smol-rs/polling/blob/master/CHANGELOG.md)
- [Commits](https://github.com/smol-rs/polling/compare/v3.7.1...v3.7.2)

Updates `proc-macro2` from 1.0.85 to 1.0.86
- [Release notes](https://github.com/dtolnay/proc-macro2/releases)
- [Commits](https://github.com/dtolnay/proc-macro2/compare/1.0.85...1.0.86)

Updates `tinyvec` from 1.6.0 to 1.6.1
- [Changelog](https://github.com/Lokathor/tinyvec/blob/main/CHANGELOG.md)
- [Commits](https://github.com/Lokathor/tinyvec/compare/v1.6.0...v1.6.1)

Updates `url` from 2.5.0 to 2.5.2
- [Release notes](https://github.com/servo/rust-url/releases)
- [Commits](https://github.com/servo/rust-url/compare/v2.5.0...v2.5.2)

Updates `uuid` from 1.8.0 to 1.9.1
- [Release notes](https://github.com/uuid-rs/uuid/releases)
- [Commits](https://github.com/uuid-rs/uuid/compare/1.8.0...1.9.1)

---
updated-dependencies:
- dependency-name: bit-vec
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: patch-updates
- dependency-name: bitflags
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: patch-updates
- dependency-name: bytemuck
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: libloading
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: log
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: serde_json
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: bit-set
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: patch-updates
- dependency-name: syn
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: ab_glyph
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: backtrace
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: cc
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: clap
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: clap_builder
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: clap_derive
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: deno_unsync
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: derive_more
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: either
  dependency-type: indirect
  update-type: version-update:semver-minor
  dependency-group: patch-updates
- dependency-name: lazy_static
  dependency-type: indirect
  update-type: version-update:semver-minor
  dependency-group: patch-updates
- dependency-name: memchr
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: miniz_oxide
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: num-bigint
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: object
  dependency-type: indirect
  update-type: version-update:semver-minor
  dependency-group: patch-updates
- dependency-name: polling
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: proc-macro2
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: tinyvec
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: url
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: uuid
  dependency-type: indirect
  update-type: version-update:semver-minor
  dependency-group: patch-updates
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-07-01 10:51:47 +02:00
teoxoy
92c8cf415c remove bind group id from set bind group scope
and make sure that we use `ResourceErrorIdent` in all relevant inner errors
2024-06-27 10:20:11 +02:00
teoxoy
f54b354021 use .validate_dynamic_bindings() in render bundle's set_bind_group 2024-06-27 10:20:11 +02:00
teoxoy
a2c60cea4f remove render pipeline id from set render pipeline scope
and make sure that we use `ResourceErrorIdent` in all relevant inner errors
2024-06-27 10:20:11 +02:00
teoxoy
ab1fa7d96e remove compute pipeline id from set compute pipeline scope
and make sure that we use `ResourceErrorIdent` in all relevant inner errors
2024-06-27 10:20:11 +02:00
teoxoy
400372ff57 remove buffer id from set index/vertex buffer scopes
all relevant inner errors already print the label of the buffers
2024-06-27 10:20:11 +02:00
teoxoy
287d8ee414 move pipeline ident to appropriate errors 2024-06-27 10:20:11 +02:00
teoxoy
d0e63c5c05 move pipeline ident to DispatchError::IncompatibleBindGroup 2024-06-27 10:20:11 +02:00
teoxoy
1e9844af29 extract execute_bundle from render_pass_end_impl 2024-06-27 10:20:11 +02:00
teoxoy
3c389b9057 resolve occlusion query set prior to render_pass_end_impl 2024-06-27 10:20:11 +02:00
teoxoy
f7160e71ec extract write_timestamp from render_pass_end_impl 2024-06-27 10:20:11 +02:00
teoxoy
02f91167d9 extract insert_debug_marker from render_pass_end_impl 2024-06-27 10:20:11 +02:00
teoxoy
10cf23b511 extract pop_debug_group from render_pass_end_impl 2024-06-27 10:20:11 +02:00
teoxoy
4edebc6444 extract push_debug_group from render_pass_end_impl 2024-06-27 10:20:11 +02:00
teoxoy
c42c02e801 extract multi_draw_indirect_count from render_pass_end_impl 2024-06-27 10:20:11 +02:00
teoxoy
df08509306 extract multi_draw_indirect from render_pass_end_impl 2024-06-27 10:20:11 +02:00
teoxoy
e92fac087b extract draw_indexed from render_pass_end_impl 2024-06-27 10:20:11 +02:00
teoxoy
1226589f07 extract draw from render_pass_end_impl 2024-06-27 10:20:11 +02:00
teoxoy
a79ac34b15 extract set_scissor from render_pass_end_impl 2024-06-27 10:20:11 +02:00
teoxoy
b295a4578c extract set_push_constant from render_pass_end_impl 2024-06-27 10:20:11 +02:00
teoxoy
63e55cea56 extract set_viewport from render_pass_end_impl 2024-06-27 10:20:11 +02:00
teoxoy
5c941bf1f0 extract set_stencil_reference from render_pass_end_impl 2024-06-27 10:20:11 +02:00
teoxoy
49800c30de extract set_blend_constant from render_pass_end_impl 2024-06-27 10:20:11 +02:00
teoxoy
6cb18ed072 extract set_vertex_buffer from render_pass_end_impl 2024-06-27 10:20:11 +02:00
teoxoy
ae65b708fa extract set_index_buffer from render_pass_end_impl 2024-06-27 10:20:11 +02:00
teoxoy
36e5381531 extract set_pipeline from render_pass_end_impl 2024-06-27 10:20:11 +02:00
teoxoy
bc683fae3a extract set_bind_group from render_pass_end_impl 2024-06-27 10:20:11 +02:00
teoxoy
cbe4b67367 put all state in State 2024-06-27 10:20:11 +02:00
teoxoy
f0f61d9bb6 move the raw encoder in State 2024-06-27 10:20:11 +02:00
teoxoy
8ee9df9eb3 move same device check and tracker insertion inside validate_and_begin_pipeline_statistics_query 2024-06-27 10:20:11 +02:00
teoxoy
e41cfbf1c2 extract write_timestamp from compute_pass_end_impl 2024-06-27 10:20:11 +02:00
teoxoy
3ff680261d extract insert_debug_marker from compute_pass_end_impl 2024-06-27 10:20:11 +02:00
teoxoy
f609e82055 extract pop_debug_group from compute_pass_end_impl 2024-06-27 10:20:11 +02:00
teoxoy
c72af7b57f extract push_debug_group from compute_pass_end_impl 2024-06-27 10:20:11 +02:00
teoxoy
868b9cd866 extract dispatch_indirect from compute_pass_end_impl 2024-06-27 10:20:11 +02:00
teoxoy
fefb9c2453 extract dispatch from compute_pass_end_impl 2024-06-27 10:20:11 +02:00
teoxoy
5fdb663f45 extract set_push_constant from compute_pass_end_impl 2024-06-27 10:20:11 +02:00
teoxoy
3a199cf258 extract set_pipeline from compute_pass_end_impl 2024-06-27 10:20:11 +02:00
teoxoy
bc2f8edf9b extract set_bind_group from compute_pass_end_impl 2024-06-27 10:20:11 +02:00
teoxoy
9b4bb8b594 remove CommandBuffer.limits 2024-06-27 10:20:11 +02:00
teoxoy
d3eed4920b put all state in State 2024-06-27 10:20:11 +02:00
teoxoy
83a8699be7 remove multi_draw_indirect2 2024-06-27 10:20:11 +02:00
teoxoy
3dcd5ab422 move comment that was preventing fmt from running 2024-06-27 10:20:11 +02:00
teoxoy
ebb930e9fd add more fields to State and cleanup fn params 2024-06-27 10:20:11 +02:00
teoxoy
9791b6ccb9 extract render bundle command processing into their own functions 2024-06-27 10:20:11 +02:00
teoxoy
3eb387f413 simplify IndexState 2024-06-27 10:20:11 +02:00
teoxoy
6db9ceede1 inline pipeline.as_info().id() 2024-06-27 10:20:11 +02:00
teoxoy
fb60aa86c3 use .error_ident() for api_log!s in render_pass_end_impl 2024-06-27 10:20:11 +02:00
XiaoPeng
82210e1cdc remove stale weak refs before insert view/bind_groups 2024-06-26 10:18:07 +02:00
XiaoPeng
3d5d7dec02 clear refs to died texture views 2024-06-26 10:18:07 +02:00
teoxoy
bfcb5457c6 remove unnecessary unsafe block 2024-06-25 11:14:41 +02:00
teoxoy
ad2d797f81 move InvalidQueueId error variant to top level error types 2024-06-25 11:14:41 +02:00
teoxoy
3005b46a29 inline ComputePass.parent_id() 2024-06-25 11:14:41 +02:00
teoxoy
f55fa6e217 make ResourceInfo.label private 2024-06-25 11:14:41 +02:00
teoxoy
a56698cbe6 use .error_ident() in a few more places 2024-06-25 11:14:41 +02:00
teoxoy
8106028f23 remove ResourceInfo.label() 2024-06-25 11:14:41 +02:00
teoxoy
c4e067b394 use .error_ident() for resource_log! in Drop impls 2024-06-25 11:14:41 +02:00
teoxoy
5f78485f30 pass Label to ResourceInfo::new 2024-06-25 11:14:41 +02:00
teoxoy
beaa6e95e4 remove duplicate label fields 2024-06-25 11:14:41 +02:00
teoxoy
bbf824767d remove IDs from Destroyed{Buffer,Texture} 2024-06-25 11:14:41 +02:00
teoxoy
d5d806a474 pass through pipeline_id instead of getting it via .as_info().id() 2024-06-25 11:14:41 +02:00
teoxoy
1b40c8c745 replace check_valid_to_use with ParentDevice.same_device checks 2024-06-25 11:14:41 +02:00
teoxoy
06da3e88d0 remove IDs from QueryResetMap 2024-06-25 11:14:41 +02:00
teoxoy
d30c02ffa3 use .error_ident() for resource logging 2024-06-25 11:14:41 +02:00
teoxoy
eeb57e1cee pass BufferId to unmap for tracing 2024-06-25 11:14:41 +02:00
teoxoy
1a4f6aca6f trace as soon as possible 2024-06-25 11:14:41 +02:00
teoxoy
fd52ec8997 remove tracing from deferred texture view and bind group destruction
we already trace texture view and bind group drop in the corresponding `Global` methods so we might end up with double drop actions
2024-06-25 11:14:41 +02:00
teoxoy
812a562331 remove tracing from Destroyed{Buffer,Texture} drop impl
we already trace buffer drop and destroy in the corresponding `Global` methods so we might end up with double drop/destroy actions
2024-06-25 11:14:41 +02:00
teoxoy
f2ea30772c move destroy/drop tracing actions in Global's methods 2024-06-25 11:14:41 +02:00
teoxoy
e2c4348959 replace .then_some(()).ok_or_else(e) with ifs 2024-06-25 11:14:41 +02:00
Andreas Reich
b4c7987aa7
Separate renderpass arc resolve & renderpass consume on end (#5794) 2024-06-25 09:37:29 +02:00
Nicolas Silva
1de04926b1
Add infrastructure for counting and reporting internal resources (#5708)
* Add an optional system for counting and reporting internal resources and events
* Count API objects in wgpu-hal
* Expose internal counters in wgpu-core and wgpu.
2024-06-24 11:20:10 +02:00
Elabajaba
35477dff9a automatically check for subgroup support when creating a naga Validator 2024-06-21 10:20:25 +02:00
teoxoy
1e784c9c0a use TrackerIndex instead of IDs in PendingWrites's fields 2024-06-20 16:34:17 +02:00
teoxoy
2e1e1cd26e inline id getters 2024-06-20 16:34:17 +02:00
teoxoy
ef2da1a6d7 rename UsageConflict to ResourceUsageCompatibilityError 2024-06-20 16:34:17 +02:00
teoxoy
5f6848eddf remove IDs from UsageConflict variants 2024-06-20 16:34:17 +02:00
teoxoy
123a59ae7b change return type of ResourceMetadataProvider.get to &Arc<T> 2024-06-20 16:34:17 +02:00
teoxoy
26eceabe86 move body of BufferUsageScope.insert_merge_single in BufferUsageScope.merge_single 2024-06-20 16:34:17 +02:00
teoxoy
aaec1c37b9 take resource lookup out of BufferUsageScope.merge_single 2024-06-20 16:34:17 +02:00
teoxoy
f5072261c7 remove ID from QueueSubmitError::BufferStillMapped 2024-06-20 16:34:17 +02:00
teoxoy
b0d2517bf4 change BindGroup.raw to BindGroup.try_raw 2024-06-20 16:34:17 +02:00
teoxoy
08f5eb82cd introduce TextureView.try_raw 2024-06-20 16:34:17 +02:00
teoxoy
7bd9195aa2 take resource lookup out of StatelessTracker.add_single 2024-06-20 16:34:17 +02:00
teoxoy
2ec7254772 remove old comment 2024-06-20 16:34:17 +02:00
teoxoy
a024afe182 consolidate destroyed texture/buffer errors and separate them from invalid ID errors 2024-06-20 16:34:17 +02:00
teoxoy
97a038a768 make return type of TextureTracker.set_single non-optional 2024-06-20 16:34:17 +02:00
teoxoy
d2218398ff take buffer lookup out of BufferBindGroupState.add_single 2024-06-20 16:34:17 +02:00
teoxoy
6a181fa634 remove IDs from StatelessBindGroupState 2024-06-20 16:34:17 +02:00
teoxoy
a979d2ed46 simplify BufferTracker.set_single's return type 2024-06-20 16:34:17 +02:00
teoxoy
862f19524f make check_texture_usage a texture method 2024-06-20 16:34:17 +02:00
teoxoy
87382d7133 make check_buffer_usage a buffer method 2024-06-20 16:34:17 +02:00
teoxoy
068da49a4c use error_ident for log instead of ID 2024-06-20 16:34:17 +02:00
teoxoy
836f016dcd use the tracker index as key in hashmap instead of ID 2024-06-20 16:34:17 +02:00
teoxoy
0c4b449644 use Arc::ptr_eq for resource equality 2024-06-20 16:34:17 +02:00
teoxoy
a21bbdccf0 remove usage of Buffer IDs in clear code 2024-06-20 16:34:17 +02:00
teoxoy
8465a64104 remove usage of Texture IDs in clear code 2024-06-20 16:34:17 +02:00
teoxoy
2a7f09aebc make clear_texture_via_render_passes infallible (in practice it was already) 2024-06-20 16:34:17 +02:00
teoxoy
8d805c99d3 remove TextureBindGroupState.add_single's return type 2024-06-20 16:34:17 +02:00
teoxoy
43177d78d6 replace uses of Id.backend() with A::VARIANT 2024-06-20 16:34:17 +02:00
Jim Blandy
584f9e189c [core] Improve resource and api logging.
- Improve logging in `StatelessTracker::remove_abandoned` to show the
  outcome of the call.

- Add similar logging to `BufferTracker` and `TextureTracker`.

- Let `device_create_buffer`'s log only the new buffer's label, id,
  and whether it's mapped at creation. It used to show the whole
  descriptor, which is too much detail.

- Have `queue_submit` log the submission id, and have `device_poll`
  log what it was waiting for, and what actually got done.

- Have `Device::drop` log the destruction of the raw device when it
  actually happens, so it's properly ordered with respect to logging
  from other parts of the device, like `Device::command_allocator`.
2024-06-19 21:13:38 -07:00
teoxoy
284c807abc reorder map_async validation steps 2024-06-19 14:05:18 +02:00
teoxoy
cc7b2db235 move map_async body in a new buffer method 2024-06-19 14:05:18 +02:00
teoxoy
0b7a5b054b move command encoder/buffer creation in a new device method 2024-06-19 14:05:18 +02:00
teoxoy
4b5666ceff move most device validity checks inside the device's methods 2024-06-19 14:05:18 +02:00
teoxoy
edc2cd9615 introduce Device.check_is_valid 2024-06-19 14:05:18 +02:00
teoxoy
508ece312d remove device invalidity checks from property accessors
accessing those properties is always fine
2024-06-19 14:05:18 +02:00
teoxoy
3e44a98088 remove device validity checks from create_{texture,buffer}_from_hal
those resources have been created already, we don't need to make sure the device is valid
2024-06-19 14:05:18 +02:00
teoxoy
14e750205a move BGL same device check inside create_bind_group 2024-06-19 11:15:38 +02:00
teoxoy
c01a1335aa rename WrongDevice to DeviceMismatch 2024-06-19 11:15:38 +02:00
teoxoy
ce716adb5e improve device mismatch errors 2024-06-19 11:15:38 +02:00
teoxoy
adfb183dc0 move same device validation in compute_pass_end_impl 2024-06-19 11:15:38 +02:00
teoxoy
53f8477b15 validate for same device via Arc::ptr_eq rather than IDs 2024-06-19 11:15:38 +02:00
Erich Gubler
4a1174b5ed refactor: use linear flow instead of broken loop for determining fallback 2024-06-17 05:26:03 -04:00
Erich Gubler
b9e787e667 refactor: satisfy clippy::never_loop 2024-06-17 05:26:03 -04:00
Erich Gubler
702c8cb693
style: strip trailing whitespace from lock::ranked module (#5815) 2024-06-14 13:45:34 -04:00
Erich Gubler
d7a35ecda0
typo: s/StatelessBindGroupSate/StatelessBindGroupState/ (#5810) 2024-06-13 13:03:00 -04:00
Elabajaba
2eb872e6f7
Deduplicate submitted surfaces to avoid a vulkan deadlock/crash (#5799) 2024-06-12 14:39:26 -04:00
Andreas Reich
eb24be47e1
Validate for device mismatch during compute pass recording (#5779)
* compute pass recording device validation

* add changelog entry

* validate device of timestamp query set as well
2024-06-10 12:19:50 +02:00
Atlas Dostal
abba12ae4e Add support for 64 bit integer atomic operations in shaders.
Add the following flags to `wgpu_types::Features`:

- `SHADER_INT64_ATOMIC_ALL_OPS` enables all atomic operations on `atomic<i64>` and
  `atomic<u64>` values.

- `SHADER_INT64_ATOMIC_MIN_MAX` is a subset of the above, enabling only
  `AtomicFunction::Min` and `AtomicFunction::Max` operations on `atomic<i64>` and
  `atomic<u64>` values in the `Storage` address space. These are the only 64-bit
  atomic operations available on Metal as of 3.1.

Add corresponding flags to `naga::valid::Capabilities`. These are supported by the
WGSL front end, and all Naga backends.

Platform support:

- On Direct3d 12, in `D3D12_FEATURE_DATA_D3D12_OPTIONS9`, if
  `AtomicInt64OnTypedResourceSupported` and `AtomicInt64OnGroupSharedSupported` are
  both available, then both wgpu features described above are available.

- On Metal, `SHADER_INT64_ATOMIC_MIN_MAX` is available on Apple9 hardware, and on
  hardware that advertises both Apple8 and Mac2 support. This also requires Metal
  Shading Language 2.4 or later. Metal does not yet support the more general
  `SHADER_INT64_ATOMIC_ALL_OPS`.

- On Vulkan, if the `VK_KHR_shader_atomic_int64` extension is available with both the
  `shader_buffer_int64_atomics` and `shader_shared_int64_atomics` features, then both
  wgpu features described above are available.
2024-06-08 18:36:26 -07:00
Andreas Reich
9a27ba53ca
Fix QuerySet ownership of ComputePass (#5671)
* add new tests for checking on query set lifetime

* Fix ownership management of query sets on compute passes for write_timestamp, timestamp_writes (on desc) and pipeline statistic queries

* changelog entry
2024-06-04 07:47:27 +00:00
dependabot[bot]
dd86dcf8f8
build(deps): bump the patch-updates group with 19 updates (#5770)
Bumps the patch-updates group with 19 updates:

| Package | From | To |
| --- | --- | --- |
| [parking_lot](https://github.com/Amanieu/parking_lot) | `0.12.2` | `0.12.3` |
| [serde](https://github.com/serde-rs/serde) | `1.0.202` | `1.0.203` |
| [tokio](https://github.com/tokio-rs/tokio) | `1.37.0` | `1.38.0` |
| [syn](https://github.com/dtolnay/syn) | `2.0.65` | `2.0.66` |
| [backtrace](https://github.com/rust-lang/backtrace-rs) | `0.3.71` | `0.3.72` |
| [bytemuck_derive](https://github.com/Lokathor/bytemuck) | `1.6.0` | `1.7.0` |
| [crc32fast](https://github.com/srijs/rust-crc32fast) | `1.4.0` | `1.4.2` |
| [deno_unsync](https://github.com/denoland/deno_unsync) | `0.3.3` | `0.3.4` |
| [gimli](https://github.com/gimli-rs/gimli) | `0.28.1` | `0.29.0` |
| [objc-sys](https://github.com/madsmtm/objc2) | `0.3.3` | `0.3.5` |
| [object](https://github.com/gimli-rs/object) | `0.32.2` | `0.35.0` |
| [plotters](https://github.com/plotters-rs/plotters) | `0.3.5` | `0.3.6` |
| [plotters-backend](https://github.com/plotters-rs/plotters) | `0.3.5` | `0.3.6` |
| [plotters-svg](https://github.com/plotters-rs/plotters) | `0.3.5` | `0.3.6` |
| [polling](https://github.com/smol-rs/polling) | `3.7.0` | `3.7.1` |
| [proc-macro2](https://github.com/dtolnay/proc-macro2) | `1.0.83` | `1.0.85` |
| [serde_derive](https://github.com/serde-rs/serde) | `1.0.202` | `1.0.203` |
| [tokio-macros](https://github.com/tokio-rs/tokio) | `2.2.0` | `2.3.0` |
| [wayland-backend](https://github.com/smithay/wayland-rs) | `0.3.3` | `0.3.4` |


Updates `parking_lot` from 0.12.2 to 0.12.3
- [Changelog](https://github.com/Amanieu/parking_lot/blob/master/CHANGELOG.md)
- [Commits](https://github.com/Amanieu/parking_lot/compare/0.12.2...0.12.3)

Updates `serde` from 1.0.202 to 1.0.203
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.202...v1.0.203)

Updates `tokio` from 1.37.0 to 1.38.0
- [Release notes](https://github.com/tokio-rs/tokio/releases)
- [Commits](https://github.com/tokio-rs/tokio/compare/tokio-1.37.0...tokio-1.38.0)

Updates `syn` from 2.0.65 to 2.0.66
- [Release notes](https://github.com/dtolnay/syn/releases)
- [Commits](https://github.com/dtolnay/syn/compare/2.0.65...2.0.66)

Updates `backtrace` from 0.3.71 to 0.3.72
- [Release notes](https://github.com/rust-lang/backtrace-rs/releases)
- [Commits](https://github.com/rust-lang/backtrace-rs/compare/0.3.71...0.3.72)

Updates `bytemuck_derive` from 1.6.0 to 1.7.0
- [Changelog](https://github.com/Lokathor/bytemuck/blob/main/changelog.md)
- [Commits](https://github.com/Lokathor/bytemuck/compare/bytemuck_derive-v1.6.0...bytemuck_derive-v1.7.0)

Updates `crc32fast` from 1.4.0 to 1.4.2
- [Commits](https://github.com/srijs/rust-crc32fast/compare/v1.4.0...v1.4.2)

Updates `deno_unsync` from 0.3.3 to 0.3.4
- [Commits](https://github.com/denoland/deno_unsync/commits)

Updates `gimli` from 0.28.1 to 0.29.0
- [Changelog](https://github.com/gimli-rs/gimli/blob/master/CHANGELOG.md)
- [Commits](https://github.com/gimli-rs/gimli/compare/0.28.1...0.29.0)

Updates `objc-sys` from 0.3.3 to 0.3.5
- [Commits](https://github.com/madsmtm/objc2/compare/objc-sys-0.3.3...objc-sys-0.3.5)

Updates `object` from 0.32.2 to 0.35.0
- [Changelog](https://github.com/gimli-rs/object/blob/master/CHANGELOG.md)
- [Commits](https://github.com/gimli-rs/object/compare/0.32.2...0.35.0)

Updates `plotters` from 0.3.5 to 0.3.6
- [Changelog](https://github.com/plotters-rs/plotters/blob/master/CHANGELOG.md)
- [Commits](https://github.com/plotters-rs/plotters/compare/v0.3.5...v0.3.6)

Updates `plotters-backend` from 0.3.5 to 0.3.6
- [Changelog](https://github.com/plotters-rs/plotters/blob/master/CHANGELOG.md)
- [Commits](https://github.com/plotters-rs/plotters/compare/v0.3.5...v0.3.6)

Updates `plotters-svg` from 0.3.5 to 0.3.6
- [Changelog](https://github.com/plotters-rs/plotters/blob/master/CHANGELOG.md)
- [Commits](https://github.com/plotters-rs/plotters/compare/v0.3.5...v0.3.6)

Updates `polling` from 3.7.0 to 3.7.1
- [Release notes](https://github.com/smol-rs/polling/releases)
- [Changelog](https://github.com/smol-rs/polling/blob/master/CHANGELOG.md)
- [Commits](https://github.com/smol-rs/polling/compare/v3.7.0...v3.7.1)

Updates `proc-macro2` from 1.0.83 to 1.0.85
- [Release notes](https://github.com/dtolnay/proc-macro2/releases)
- [Commits](https://github.com/dtolnay/proc-macro2/compare/1.0.83...1.0.85)

Updates `serde_derive` from 1.0.202 to 1.0.203
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.202...v1.0.203)

Updates `tokio-macros` from 2.2.0 to 2.3.0
- [Release notes](https://github.com/tokio-rs/tokio/releases)
- [Commits](https://github.com/tokio-rs/tokio/compare/tokio-macros-2.2.0...tokio-macros-2.3.0)

Updates `wayland-backend` from 0.3.3 to 0.3.4
- [Release notes](https://github.com/smithay/wayland-rs/releases)
- [Changelog](https://github.com/Smithay/wayland-rs/blob/master/historical_changelog.md)
- [Commits](https://github.com/smithay/wayland-rs/commits)

---
updated-dependencies:
- dependency-name: parking_lot
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: serde
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: tokio
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: patch-updates
- dependency-name: syn
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: backtrace
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: bytemuck_derive
  dependency-type: indirect
  update-type: version-update:semver-minor
  dependency-group: patch-updates
- dependency-name: crc32fast
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: deno_unsync
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: gimli
  dependency-type: indirect
  update-type: version-update:semver-minor
  dependency-group: patch-updates
- dependency-name: objc-sys
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: object
  dependency-type: indirect
  update-type: version-update:semver-minor
  dependency-group: patch-updates
- dependency-name: plotters
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: plotters-backend
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: plotters-svg
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: polling
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: proc-macro2
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: serde_derive
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: tokio-macros
  dependency-type: indirect
  update-type: version-update:semver-minor
  dependency-group: patch-updates
- dependency-name: wayland-backend
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: patch-updates
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-06-03 09:20:29 +02:00
Connor Fitzgerald
c7458638d1
[hal/vk] Rework Submission and Surface Synchronization (#5681)
Fix two major synchronization issues in `wgpu_val::vulkan`:

- Properly order queue command buffer submissions. Due to Mesa bugs, two semaphores are required even though the Vulkan spec says that only one should be necessary.

- Properly manage surface texture acquisition and presentation:

    - Acquiring a surface texture can return while the presentation engine is still displaying the texture. Applications must wait for a semaphore to be signaled before using the acquired texture.

    - Presenting a surface texture requires a semaphore to ensure that drawing is complete before presentation occurs.

Co-authored-by: Jim Blandy <jimb@red-bean.com>
2024-05-30 13:53:34 -07:00
Brad Werth
9b7a965667 Add an experimental vertex pulling flag to Metal pipelines.
This proves a flag in msl::PipelineOptions that attempts to write all
Metal vertex entry points to use a vertex pulling technique. It does
this by:

1) Forcing the _buffer_sizes structure to be generated for all vertex
entry points. The structure has additional buffer_size members that
contain the byte sizes of the vertex buffers.
2) Adding new args to vertex entry points for the vertex id and/or
the instance id and for the bound buffers. If there is an existing
@builtin(vertex_index) or @builtin(instance_index) param, then no
duplicate arg is created.
3) Adding code at the beginning of the function for vertex entry points
to compare the vertex id or instance id against the lengths of all the
bound buffers, and force an early-exit if the bounds are violated.
4) Extracting the raw bytes from the vertex buffer(s) and unpacking
those bytes into the bound attributes with the expected types.
5) Replacing the varyings input and instead using the unpacked
attributes to fill any structs-as-args that are rebuilt in the entry
point.

A new naga test is added which exercises this flag and demonstrates the
effect of the transform. The msl generated by this test passes
validation.

Eventually this transformation will be the default, always-on behavior
for Metal pipelines, though the flag may remain so that naga
translation tests can be run with and without the tranformation.
2024-05-30 13:08:59 +02:00
Mads Marquart
60a14c67fb
Remove the link Cargo feature (#5752) 2024-05-29 15:55:33 -07:00
Andreas Reich
588950110a
Remove lifetime dependency of ComputePass to its parent command encoder (#5620)
* lift encoder->computepass lifetime constraint and add now failing test
* compute passes now take an arc to their parent command encoder, thus removing compile time dependency to it
* Command encoder goes now into locked state while compute pass is open
* changelog entry
* share most of the code between get_encoder and lock_encoder
2024-05-29 22:43:24 +00:00
Teodor Tanasoaia
b5b39f670d remove redundant code in module interface validation
`TypeInner.size()` already handles the array case
2024-05-28 14:09:56 -04:00
dependabot[bot]
d9c054c645
build(deps): bump the patch-updates group with 19 updates (#5720)
Bumps the patch-updates group with 19 updates:

| Package | From | To |
| --- | --- | --- |
| [anyhow](https://github.com/dtolnay/anyhow) | `1.0.83` | `1.0.86` |
| [bytemuck](https://github.com/Lokathor/bytemuck) | `1.15.0` | `1.16.0` |
| [libc](https://github.com/rust-lang/libc) | `0.2.154` | `0.2.155` |
| [raw-window-handle](https://github.com/rust-windowing/raw-window-handle) | `0.6.1` | `0.6.2` |
| [serde](https://github.com/serde-rs/serde) | `1.0.201` | `1.0.202` |
| [thiserror](https://github.com/dtolnay/thiserror) | `1.0.60` | `1.0.61` |
| [syn](https://github.com/dtolnay/syn) | `2.0.63` | `2.0.65` |
| [cc](https://github.com/rust-lang/cc-rs) | `1.0.97` | `1.0.98` |
| [crossbeam-utils](https://github.com/crossbeam-rs/crossbeam) | `0.8.19` | `0.8.20` |
| [either](https://github.com/rayon-rs/either) | `1.11.0` | `1.12.0` |
| [instant](https://github.com/sebcrozet/instant) | `0.1.12` | `0.1.13` |
| [linux-raw-sys](https://github.com/sunfishcode/linux-raw-sys) | `0.4.13` | `0.4.14` |
| [miniz_oxide](https://github.com/Frommi/miniz_oxide) | `0.7.2` | `0.7.3` |
| [proc-macro2](https://github.com/dtolnay/proc-macro2) | `1.0.82` | `1.0.83` |
| [rustversion](https://github.com/dtolnay/rustversion) | `1.0.16` | `1.0.17` |
| [serde_derive](https://github.com/serde-rs/serde) | `1.0.201` | `1.0.202` |
| [smol_str](https://github.com/rust-analyzer/smol_str) | `0.2.1` | `0.2.2` |
| [thiserror-impl](https://github.com/dtolnay/thiserror) | `1.0.60` | `1.0.61` |
| [toml_datetime](https://github.com/toml-rs/toml) | `0.6.5` | `0.6.6` |


Updates `anyhow` from 1.0.83 to 1.0.86
- [Release notes](https://github.com/dtolnay/anyhow/releases)
- [Commits](https://github.com/dtolnay/anyhow/compare/1.0.83...1.0.86)

Updates `bytemuck` from 1.15.0 to 1.16.0
- [Changelog](https://github.com/Lokathor/bytemuck/blob/main/changelog.md)
- [Commits](https://github.com/Lokathor/bytemuck/compare/v1.15.0...v1.16.0)

Updates `libc` from 0.2.154 to 0.2.155
- [Release notes](https://github.com/rust-lang/libc/releases)
- [Commits](https://github.com/rust-lang/libc/compare/0.2.154...0.2.155)

Updates `raw-window-handle` from 0.6.1 to 0.6.2
- [Release notes](https://github.com/rust-windowing/raw-window-handle/releases)
- [Changelog](https://github.com/rust-windowing/raw-window-handle/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rust-windowing/raw-window-handle/compare/v0.6.1...v0.6.2)

Updates `serde` from 1.0.201 to 1.0.202
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.201...v1.0.202)

Updates `thiserror` from 1.0.60 to 1.0.61
- [Release notes](https://github.com/dtolnay/thiserror/releases)
- [Commits](https://github.com/dtolnay/thiserror/compare/1.0.60...1.0.61)

Updates `syn` from 2.0.63 to 2.0.65
- [Release notes](https://github.com/dtolnay/syn/releases)
- [Commits](https://github.com/dtolnay/syn/compare/2.0.63...2.0.65)

Updates `cc` from 1.0.97 to 1.0.98
- [Release notes](https://github.com/rust-lang/cc-rs/releases)
- [Commits](https://github.com/rust-lang/cc-rs/compare/1.0.97...1.0.98)

Updates `crossbeam-utils` from 0.8.19 to 0.8.20
- [Release notes](https://github.com/crossbeam-rs/crossbeam/releases)
- [Changelog](https://github.com/crossbeam-rs/crossbeam/blob/master/CHANGELOG.md)
- [Commits](https://github.com/crossbeam-rs/crossbeam/compare/crossbeam-utils-0.8.19...crossbeam-utils-0.8.20)

Updates `either` from 1.11.0 to 1.12.0
- [Commits](https://github.com/rayon-rs/either/compare/1.11.0...1.12.0)

Updates `instant` from 0.1.12 to 0.1.13
- [Changelog](https://github.com/sebcrozet/instant/blob/master/CHANGELOG.md)
- [Commits](https://github.com/sebcrozet/instant/commits)

Updates `linux-raw-sys` from 0.4.13 to 0.4.14
- [Commits](https://github.com/sunfishcode/linux-raw-sys/compare/v0.4.13...v0.4.14)

Updates `miniz_oxide` from 0.7.2 to 0.7.3
- [Changelog](https://github.com/Frommi/miniz_oxide/blob/master/CHANGELOG.md)
- [Commits](https://github.com/Frommi/miniz_oxide/compare/0.7.2...0.7.3)

Updates `proc-macro2` from 1.0.82 to 1.0.83
- [Release notes](https://github.com/dtolnay/proc-macro2/releases)
- [Commits](https://github.com/dtolnay/proc-macro2/compare/1.0.82...1.0.83)

Updates `rustversion` from 1.0.16 to 1.0.17
- [Release notes](https://github.com/dtolnay/rustversion/releases)
- [Commits](https://github.com/dtolnay/rustversion/compare/1.0.16...1.0.17)

Updates `serde_derive` from 1.0.201 to 1.0.202
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.201...v1.0.202)

Updates `smol_str` from 0.2.1 to 0.2.2
- [Commits](https://github.com/rust-analyzer/smol_str/commits/v0.2.2)

Updates `thiserror-impl` from 1.0.60 to 1.0.61
- [Release notes](https://github.com/dtolnay/thiserror/releases)
- [Commits](https://github.com/dtolnay/thiserror/compare/1.0.60...1.0.61)

Updates `toml_datetime` from 0.6.5 to 0.6.6
- [Commits](https://github.com/toml-rs/toml/compare/toml_datetime-v0.6.5...toml_datetime-v0.6.6)

---
updated-dependencies:
- dependency-name: anyhow
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: bytemuck
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: patch-updates
- dependency-name: libc
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: raw-window-handle
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: serde
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: thiserror
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: syn
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: cc
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: crossbeam-utils
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: either
  dependency-type: indirect
  update-type: version-update:semver-minor
  dependency-group: patch-updates
- dependency-name: instant
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: linux-raw-sys
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: miniz_oxide
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: proc-macro2
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: rustversion
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: serde_derive
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: smol_str
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: thiserror-impl
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: toml_datetime
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: patch-updates
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-05-26 18:34:50 +02:00
Jason de Wolff
cd744ef68b
Buffer as hal (#5724)
* Add `as_hal` for `Buffer`

* fmt & CHANGELOG.md update

* Update CHANGELOG.md

* fixed callback name

* allow nested buffer as_hal callbacks
2024-05-26 08:58:30 +02:00
Bruce Mitchener
7368e5107c
chore: Fix legacy_numeric_constants lints (#5747)
These are being deprecated in the future in favor of the associated
constants (which are already being used in some code here), so this
consistently uses the preferred forms.
2024-05-26 08:36:19 +02:00
Bruce Mitchener
5da72a94d5
Prefer default-features instead of default_features (#5745) 2024-05-26 04:33:02 +00:00
Andreas Reich
2fd09945cd
Make compute pass end consume the pass (#5575)
* rename `command_encoder_run_*_pass` to `*_pass_end` and make it a method of compute/render pass instead of encoder

* executing a compute pass consumes it now such that it can't be executed again

* use handle_error instead of handle_error_nolabel for wgpu compute pass

* use handle_error instead of handle_error_nolabel for render_pass_end

* changelog addition

* feat: `compute_pass_set_push_constant`: move panics to error variants

Co-Authored-By: Erich Gubler <erichdongubler@gmail.com>

---------

Co-authored-by: Erich Gubler <erichdongubler@gmail.com>
2024-05-25 18:54:48 +02:00
Elabajaba
c7a16b36b1 change create_validator to a free function so it's usable 2024-05-20 11:02:23 +02:00
Erich Gubler
447e3eee8d fix: ensure render pipelines have at least 1 target 2024-05-17 17:45:03 -04:00
Daniel McNab
4902e470ce
Pipeline cache API and implementation for Vulkan (#5319)
Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
2024-05-16 13:52:56 +00:00
Connor Fitzgerald
eeb1a9d7b7
Add Benchmarks (#5694) 2024-05-16 09:05:41 -04:00
Teodor Tanasoaia
3a798859cd remove old depth and/or stencil texture copy validation
This was previously added in #2230 but I don't think it was necessary. #901 already implemented the buffer <-> texture validation for those formats. It's also not a requirement in the spec.
2024-05-15 17:24:37 +02:00
Andreas Reich
77a83fb0dd
Remove lifetime constraints from wgpu::ComputePass methods (#5570)
* basic test setup

* remove lifetime and drop resources on test - test fails now just as expected

* compute pass recording is now hub dependent (needs gfx_select)

* compute pass recording now bumps reference count of uses resources directly on recording

TODO:
* bind groups don't work because the Binder gets an id only
* wgpu level error handling is missing

* simplify compute pass state flush, compute pass execution no longer needs to lock bind_group storage

* wgpu sided error handling

* make ComputePass hal dependent, removing command cast hack. Introduce DynComputePass on wgpu side

* remove stray repr(C)

* changelog entry

* fix deno issues -> move DynComputePass into wgc

* split out resources setup from test
2024-05-14 20:05:17 +00:00
Kevin Reid
9b70254437
Reduce string allocations related to labels and logging. (#5690) 2024-05-14 04:39:28 -04:00
Jim Blandy
ffd96a0a53 [core] Use a for loop in LifetimeTracker triage code.
A `for` loop is less noisy than a `drain`, which requires:

- a `mut` qualifier for a variable whose modified value we never
  consult

- a method name appearing mid-line instead of a control structure name
  at the front of the line

- a range which is always `..`, establishing no restriction at all

- a closure instead of a block

Structured control flow syntax has a fine pedigree, originating in,
among other places, Dijkstrsa's efforts at designing languages in a
way that made it easier to formally verify programs written in
them (see "A Discipline Of Programming"). There is nothing "more
mathematical" about a method call that takes a closure than a `for`
loop. Since `for_each` is useless unless the closure has side effects,
there's nothing "more functional" about `for_each` here, either.
Obsessive use of `for_each` suggests that the author loves Haskell
without understanding it.
2024-05-14 04:38:43 -04:00
Jim Blandy
8981058ad1 [core] In LifetimeTrackers triage code, use more specific names.
Rename `LifetimeTracker::triage_resources`'s `resources_map` argument
to `suspected_resources`, since this always points to a field of
`LifetimeTracker::suspected_resources`.

In the various `triage_suspected_foo` functions, name the map
`suspected_foos`.
2024-05-14 04:38:43 -04:00
Jim Blandy
8d73e5a9cd [core] Refactor LifetimeTracker::triage_resources.
Check whether the resource is abandoned first, since none of the rest
of the work is necessary otherwise.

Rename `non_referenced_resources` to `last_resources`. This function
copes with various senses in which the resource might be referenced or
not. Instead, `last_resources` is the name of the `ActiveSubmission`
member this may point to, which is more specific.

Move the use of `last_resources` immediately after its production.
2024-05-14 04:38:43 -04:00
Jim Blandy
64777d4fd8 [core] Doc fixes for lifetime management, minor typos.
- Document `LifetimeTracker::triage_resources`.

- Fix various typos and bad grammar.
2024-05-14 04:38:43 -04:00
Erich Gubler
ca91744955 chore: apply unused_qualifications lint via cargo +1.78.0 fix && cargo fmt 2024-05-13 10:10:54 -04:00
Andreas Reich
452cf24fa1
Remove unnecessary Cargo.toml dependencies via cargo machete (#5692) 2024-05-12 19:05:00 -04:00
bjorn3
fa48562229
Avoid introducing spurious features for optional dependencies (#5691)
* Avoid introducing spurious features for optional dependencies

If a feature depends on an optional dependency without using the dep:
prefix, a feature with the same name as the optional dependency is
introduced. This feature almost certainly won't have any effect when
enabled other than increasing compile times and polutes the feature list
shown by cargo add. Consistently use dep: for all optional dependencies
to avoid this problem.

* Add changelog entry
2024-05-12 08:45:35 +02:00
Xiaopeng Li
d5d683d3c4
Clean up weak references to texture views and bind groups (#5595)
* Clean up weak references to texture views

* add change to CHANGELOG.md

* drop texture view before clean up

* cleanup weak ref to bind groups

* update changelog

* Trim weak backlinks in their holders' triage functions.

---------

Co-authored-by: Jim Blandy <jimb@red-bean.com>
2024-05-06 12:53:03 +02:00
Jim Blandy
0d70a7361d [core] Properly recycle Device::temp_suspected.
Change `Device::untrack` to properly reuse the `ResourceMap` allocated
for prior calls. The prior code tries to do this but always leaves
`Device::temp_suspected` set to a new empty `ResourceMap`, leaving the
previous value to be dropped by `ResourceMap::extend`.

Change `ResourceMap::extend` to take `other` by reference, rather than
taking it by value and dropping it.
2024-05-04 00:28:46 -04:00
Jim Blandy
5f464688e6 [core] Don't check for uniquely referenced resources at submission.
Remove unreachable code from `Global::queue_submit` that checks
whether the resources used by the command buffer have a reference
count of one, and adds them to `Device::temp_suspected` if so.

When `queue_submit` is called, all the `Arc`s processed by this code
have a reference count of at least three, even when the user has
dropped the resource:

- `Device::trackers` holds strong references to all the device's
  resources.

- `CommandBufferMutable::trackers` holds strong references to all
  resources used by the command buffer.

- The `used_resources` methods of the various members of
  `CommandBufferMutable::trackers` all return iterators of owned
  `Arc`s.

Fortunately, since the `Global::device_drop_foo` methods all add the
`foo` being dropped to `Device::suspected_resources`, and
`LifetimeTracker::triage_suspected` does an adequate job of accounting
for the uninteresting `Arc`s and leaves the resources there until
they're actually dead, things do get cleaned up without the checks in
`Global::queue_submit`.

This allows `Device::temp_suspected` to be private to
`device::resource`, with a sole remaining use in `Device::untrack`.

Fixes #5647.
2024-05-03 17:00:07 -04:00
Jim Blandy
4a07ab2b57 [core] Ensure all lock guards are properly nested.
The lock analyzers in the `wgpu_core::lock` module can be a bit
simpler if they can assume that locks are acquired and released in a
stack-like order: that a guard is only dropped when it is the most
recently acquired lock guard still held. So:

- Change `Device::maintain` to take a `RwLockReadGuard` for the device's
  hal fence, rather than just a reference to it.

- Adjust the order in which guards are dropped in `Device::maintain`
  and `Queue::submit`.

Fixes #5610.
2024-05-03 13:06:00 -04:00
Jim Blandy
7c842a3b48 [core] Implement downgrade for the lock module's RwLocks.
Implement `RwLockWriteGuard::downgrade` for `lock::vanilla` and
`lock::ranked`, to downgrade a write lock to a read lock.
2024-05-03 13:06:00 -04:00
Jim Blandy
651214ef74 [core] Refactor lock::ranked to use LockStateGuard.
Rather than implementing `Drop` for all three lock guard types to
restore the lock analysis' per-thread state, let lock guards own
values of a new type, `LockStateGuard`, with the appropriate `Drop`
implementation. This is cleaner and shorter, and helps us implement
`RwLock::downgrade` in a later commit.
2024-05-03 13:06:00 -04:00
Samson
5fa537bfd9
Cast ptr to Device not Surface (#5640) 2024-04-30 11:39:56 -04:00
Jim Blandy
b765eeb474
[core] Removed outdated safety comments from no-longer-unsafe fns. (#5633) 2024-04-29 13:34:06 -04:00
stefnotch
f874ed061c
Add get_compilation_info (#5410)
* Add get_compilation_info API

* Rename glsl ParseError to ParseErrors

* Document ParseError label order

* Update line_position to count UTF-8 bytes
2024-04-29 11:35:36 +02:00
Connor Fitzgerald
4521502da6
Release v0.20.0 (#5619) 2024-04-28 18:06:35 -04:00
vero
739905e73c
Extract a naga pub create_validator function for use in Bevy (#5606) 2024-04-26 10:19:45 +02:00
Jim Blandy
d4f30638b7 [core] Fix caller location tracking in lock::ranked.
Properly track the location of callers of `Mutex::lock`,
`RwLock::read`, and `RwLock::write`, for use in panic messages.
2024-04-25 12:46:05 -07:00
Samson
5735f85720
CreateBindGroup validation error on device mismatch (#5596)
* Fix cts_runner command invocation in readme

* Remove assertDeviceMatch from deno_webgpu in createBindGroup

This should be done as verification in wgpu-core.

* Add device mismatched check to create_buffer_binding

* Extract common logic to create_sampler_binding

* Move common logic to create_texture_binding and add device mismatch check
2024-04-25 12:17:00 +02:00
Jim Blandy
a364e566cd [core] Use lock::RwLock in RenderBundleScope.
This requires bumping the `LockRankSet` bitset from `u32` to `u64`.
2024-04-25 01:28:21 -04:00
Jim Blandy
927b7e96fe [core] Use lock::RwLock in Registry. 2024-04-25 01:28:21 -04:00
Jim Blandy
36e0a135f5 [core] Use lock::RwLock in Buffer and Texture. 2024-04-25 01:28:21 -04:00
Jim Blandy
d089b86c59 [core] Include SnatchLock in lock rankings. 2024-04-25 01:28:21 -04:00
Jim Blandy
43f2315753 [core] Add checked RwLock. 2024-04-25 01:28:21 -04:00
Jim Blandy
7d9a8beff3 [core] Abstract out checking code in lock::ranked.
Introduce two new private functions, `acquire` and `release`, to the
`lock::ranked` module, to perform validation for acquiring and
releasing locks. Change `Mutex::lock` and `MutexGuard::drop` to use
those functions, rather than writing out their contents.
2024-04-25 01:28:21 -04:00
Jim Blandy
d719373989 [core] Remove unnecessary #[inline] attributes in lock module. 2024-04-25 01:28:21 -04:00
Jim Blandy
3c21a98697 [core] Remove semicolon from lock rank macro syntax.
In `define_lock_ranks!` macro invocations, don't require a semicolon
after each rank's "followed by" list.
2024-04-25 01:28:21 -04:00
Andreas Reich
edf1a86148
Separate out ComputeCommand id->arc resolve (a step towards no lifetimes on wgpu::ComputePass) (#5432)
* move out compute command to separate module

* introduce ArcComputeCommand

* stateless tracker now returns reference to arc upon insertion

* add insert_merge_single to buffer tracker

* compute pass execution now works internally with an ArcComputeCommand

* compute pass execution now translates Command to ArcCommand ahead of time

* don't clone commands in compute pass execution

* remove doc hiding

* use option insert

* clippy fix

* fix private doc issue

* remove unnecessary copied over doc hide
2024-04-23 07:01:29 +00:00
Jim Blandy
b3c5a6fb84 [core] Enforce a deadlock-free locking order for Mutexes.
If `debug_assertions` or the `"validate-locks"` feature are enabled,
change `wgpu-core` to use a wrapper around `parking_lot::Mutex` that
checks for potential deadlocks.

At the moment, `wgpu-core` does contain deadlocks, so the ranking in
the `lock::rank` module is incomplete, in the interests of keeping it
acyclic. #5572 tracks the work needed to complete the ranking.
2024-04-22 18:49:03 -07:00
Jim Blandy
4f3d9a2af5 [core] Also trace snatch lock write guard acquisitions.
In debug builds, check for attempts to acquire snatch lock read guards
while holding write guards, not just attempts to acquire a second read
guard.
2024-04-21 21:09:48 -07:00
Daniel McNab
54d22a89d3
Fix the ordering of id freeing and deleting (#5554) 2024-04-19 12:59:09 -04:00
Jim Blandy
54740d5982 [core] Make cargo doc --document-private-items work again.
Add a CI job to check it, for the future.
2024-04-18 18:36:47 -07:00
Jim Blandy
543a746023
[core] Document deferred retention strategy for ActiveSubmission. (#5561)
* [core] Document deferred retention strategy for `ActiveSubmission`.

* Update wgpu-core/src/device/life.rs

---------

Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
2024-04-19 00:08:27 +00:00
Connor Fitzgerald
152fd0930a
Fix Buffer Mapping Deadlock (#5518) 2024-04-17 20:41:51 -04:00
Andreas Reich
ad6774f7bb
Remove exposed C symbols from renderpass/computepass recording (#5409)
Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
2024-04-17 20:48:45 +00:00
Daniel McNab
965b00c06b
Allow configuring whether workgroup memory is zero initialised (#5508) 2024-04-17 15:50:31 -04:00
Andreas Reich
cbace631ec
Fix surfaces only compatible with first enabled backend (#5535) 2024-04-17 15:32:04 -04:00
Alexander Meißner
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
Jim Blandy
2b0e3ed01c [core] Don't derive Default for ResourceMaps.
The derivation is only effective if the generic type parameter `A`
also implements `Default`, which `HalApi` implementations generally
don't, so this derivation never actually took place. (This is why
`ResourceMaps::new` is written out the way it is.)
2024-04-16 15:04:25 +02:00
teoxoy
895879b8c6 [wgpu-core] validate that all resources passed to encoder commands belong to the same device as the encoder 2024-04-16 15:02:41 +02:00
Jim Blandy
a61c872269 [core] Rename com_alloc to command_allocator in Device::new. 2024-04-15 16:37:08 -04:00
Jim Blandy
bab6f53e86 [core] Use internal locking in CommandAllocator.
Move the `Mutex` in `Device::command_allocator` inside the
`CommandAllocator` type itself, allowing it to be passed by shared
reference instead of mutable reference.

Passing `CommandAllocator` to functions like
`PendingWrites::post_submit` by mutable reference requires the caller
to acquire and hold the mutex for the entire time the callee runs, but
`CommandAllocator` is just a recycling pool, with very simple
invariants; there's no reason to hold the lock for a long time.
2024-04-15 16:37:08 -04:00
Jim Blandy
b9781ee6e2 [core] Move CommandAllocator into its own module.
No intended change in behavior.
2024-04-15 16:37:08 -04:00
Jim Blandy
c9212c6d46 [core] Document command encoding and command buffers.
Flesh out the documentation for `wgpu_core`'s `CommandBuffer`,
`CommandEncoder`, and associated types.

Allow doc links to private items. `wgpu-core` isn't entirely
user-facing, so it's useful to document internal items.
2024-04-14 20:53:15 -07:00
dependabot[bot]
6756601089
build(deps): bump crate-ci/typos from 1.19.0 to 1.20.4 (#5506)
* build(deps): bump crate-ci/typos from 1.19.0 to 1.20.4

Bumps [crate-ci/typos](https://github.com/crate-ci/typos) from 1.19.0 to 1.20.4.
- [Release notes](https://github.com/crate-ci/typos/releases)
- [Changelog](https://github.com/crate-ci/typos/blob/master/CHANGELOG.md)
- [Commits](https://github.com/crate-ci/typos/compare/v1.19.0...v1.20.4)

---
updated-dependencies:
- dependency-name: crate-ci/typos
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

* update to typoes 1.20.8 since it has a few important fixes

* typo fixes & exceptions

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Andreas Reich <r_andreas2@web.de>
2024-04-14 09:28:36 +00:00
Jim Blandy
0b7f91c4a9
[core] Make wgpu_core::command::BakedCommands pub(crate), not pub. (#5526) 2024-04-14 09:40:50 +02:00
Jim Blandy
b7519bb73b
[core] Make Hub members and related types pub(crate), not pub. (#5502) 2024-04-10 19:52:16 -04:00
Jim Blandy
8289711b65
[core] Provide an explicit type for some CommandBuffer pointers. (#5512) 2024-04-10 19:51:56 -04:00
Jim Blandy
f8deb0317f
[core] Use expect instead of "if let else panic". (#5513)
Use `Option::expect` to check the result from `Arc::into_inner`,
rather than `if let Some ... else panic!`.
2024-04-10 03:53:10 -04:00
Andreas Reich
82dead09e4
Bump wgpu-core/hal/types & naga versions to match latest released patch versions (#5404) 2024-04-09 00:33:43 -04:00
Jim Blandy
03db77cb8c
[core] Replace id transmute method with explicit functions. (#5509)
Replace the `wgpu_core:🆔:Id::transmute` method, the `transmute`
private module, and the `Transmute` sealed trait with some associated
functions with obvious names.
2024-04-08 21:51:30 -04:00
lylythechosenone
d814851350
[wgpu-core] pass resources as Arcs when adding them to the registry (#5499)
* [wgpu-core] pass resources as Arcs when adding them to the registry (fix gfx-rs#5493)

* [wgpu-core] also add `Arc::new` to `#[cfg(dx12)]` blocks

* [wgpu-core] allow `clippy::arc_with_non_send_sync`
2024-04-06 09:10:24 +02:00
teoxoy
7ce422c57a remove naga's clone feature 2024-04-05 18:07:41 +02:00
teoxoy
3bda381812 add pipeline constants plumbing 2024-04-05 18:07:41 +02:00
Erich Gubler
fb305b85f6 docs: add warning about stack size for WGSL compilation 2024-04-03 15:54:43 -04:00
Chase MacDonnell
3db0e46f7d
Implement Unorm10_10_10_2 VertexFormat (#5477) 2024-04-03 19:43:54 +00:00
JMS55
ed843f8029
Add more hal methods (#5452)
* Add return value to Texture::as_hal()

* Add TextureView::as_hal()

* Add CommandEncoder::as_hal_mut()

* Add changelog

* Add TextureView::raw_handle()

* Add CommandEncoder::raw_handle()

* Add additional docs for command_encoder_as_hal_mut
2024-04-03 00:37:18 +02:00
Erich Gubler
0c5bebca51 fix: unlock guard for release_gpu_resources call in Device::maintain 2024-04-02 16:12:28 -04:00
Andreas Reich
ed7d9de439
Fix indexed drawing with RenderBundle (#5441)
* enhance vertex_indices test to also run with render bundles

* fix render bundle index limit check

* changelog entry
2024-03-30 10:19:17 +01:00
Sludge
6b996dd9c7
Avoid recursive snatch lock acquisitions (#5426)
* Avoid recursive snatch lock acquisitions

* Always acquire the snatch lock before the fence lock

* Address review comments

* Add changelog entry
2024-03-23 21:29:00 +01:00
robtfm
ed95dfe9b4
Pool tracker vecs (#5414)
* pool tracker vecs

* pool

* ci

* move pool to device

* use pool ref, cleanup and comment

* suspect all the future suspects (#5413)

* suspect all the future suspects

* changelog

* changelog

* review feedback

---------

Co-authored-by: Andreas Reich <r_andreas2@web.de>
2024-03-23 11:42:08 +00:00
Brad Werth
00e0e72596
Invoke a DeviceLostClosure immediately if set on an invalid device. (#5358)
Invoke a DeviceLostClosure immediately if set on an invalid device.

To make the device invalid, this defines an explicit, test-only method
make_invalid. It also modifies calls that expect to always retrieve a
valid device.

Co-authored-by: Erich Gubler <erichdongubler@gmail.com>
2024-03-21 13:33:25 -04:00
robtfm
152a94bc6c
suspect all the future suspects (#5413)
* suspect all the future suspects

* changelog
2024-03-18 10:53:41 -04:00
dependabot[bot]
e04a9f4c6f
build(deps): bump the patch-updates group with 29 updates (#5376)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-03-14 13:00:43 -04:00
Erich Gubler
6040820099 refactor: extract Global::poll_single_device helper 2024-03-12 10:49:44 -04:00
Erich Gubler
9499e8c9df refactor: rename Global::poll_device to poll_all_devices_of_api 2024-03-12 10:49:44 -04:00
Erich Gubler
c5ee3b6880 refactor: Global::device_poll: hoist submission_index extr. 2024-03-12 10:49:44 -04:00
Erich Gubler
fe28eda3e0 refactor: Global::poll_device: use &= for all_queue_empty 2024-03-12 10:49:44 -04:00
Erich Gubler
e3b23a6c62 fix: add missing deferred resource dtor. in Global::poll_all_devices 2024-03-12 10:49:44 -04:00
vero
4e6f873da5
Add shader I64 and U64 support (#5154)
Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
2024-03-12 12:34:06 +01:00
Lucas Kent
cf4f8bc3a3
Minor rewording of ConfigureSurfaceError::TooLarge (#5371) 2024-03-10 20:48:30 +01:00
Erich Gubler
8f1981d5b1
fix: emit valid. err. on dev. mismatch in queue_write_buffer (#5359) 2024-03-07 11:20:42 +01:00
Connor Fitzgerald
330a8608e3
Fix Presentation (#5312) 2024-02-27 20:36:20 -05:00
dependabot[bot]
744454b9e2
Bump Many Dependencies and MSRV (#5241)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
2024-02-27 14:43:05 -05:00
Erich Gubler
023b0e063f feat!: make ProgrammableStage::entry_point optional in wgpu-core 2024-02-27 13:57:17 -05:00
Erich Gubler
2c66504a59 refactor(valid): factor out shader_stage_from_stage_bit helper 2024-02-27 13:57:17 -05:00
Erich Gubler
be384fc001 refactor: factor out stage_err helper in pipeline creation 2024-02-27 13:57:17 -05:00
Nicolas Silva
6f68d3dffa Correctly set the tacker sizes before executing render bundles 2024-02-27 10:05:09 -05:00
Nicolas Silva
ed852c4774 Don't put the mapped-at-creation staging buffer in the registry 2024-02-27 10:05:09 -05:00
Nicolas Silva
c77b4d3f56
Use a unique tracker index per resource instead of the ID in trackers (#5244)
Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
2024-02-26 20:25:12 +00:00
Erich Gubler
d6465702b6 fix: command_encoder_clear_buffer: err. on offset + size > u64::MAX
Rust would have made this operation either an overflow in release mode,
or a panic in debug mode. Neither seem appropriate for this context,
where I suspect an error should be returned instead. Web browsers, for
instance, shouldn't crash simply because of an issue of this nature.
Users may, quite reasonably, have bad arguments to this in early stages
of development!
2024-02-26 09:32:26 -05:00
Erich Gubler
9747a0ed23 fix: always check buffer clear offset for OOB
Fuzz testing in Firefox encountered crashes for calls of
`Global::command_encoder_clear_buffer` where:

* `offset` is greater than `buffer.size`, but…
* `size` is `None`.

Oops! We should _always_ check this (i.e., even when `size` is `None`),
because we have no guarantee that `offset` and the fallback value of
`size` is in bounds. 😅 So, we change validation here to unconditionally
compute `size` and run checks we previously gated behind `if let
Some(size) = size { … }`.

For convenience, the spec. link for this method:
<https://gpuweb.github.io/gpuweb/#dom-gpucommandencoder-clearbuffer>
2024-02-26 09:32:26 -05:00
Erich Gubler
751cddc510 refactor: command_encoder_clear_buffer: s/end/end_offset 2024-02-26 09:32:26 -05:00
Erich Gubler
7300b9f037 style: fix fmt. of assert!(…) in clear_texture_via_buffer_copies 2024-02-26 09:32:26 -05:00
Augusto Hack
a315925882
wgpu-core: Inform user about possible fix (#5298) 2024-02-25 14:30:55 -05:00
Nicolas Silva
75a98f2712
Validate that the view dimension of a multisampled texture binding is 2d (#5274)
* Validate that the view dimension of a multisampled texture binding is 2d

* typo
2024-02-21 08:56:28 +01:00
Nicolas Silva
004e3efe84
Simplify the ID allocation in IdentityValues (#5229)
Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
2024-02-15 20:55:55 +00:00
Nicolas Silva
66ba64b721
Store Arcs instead of IDs in render bundles (#5242) 2024-02-15 15:54:11 -05:00
Nicolas Silva
286306d7e8
Store the device's queue via a weak ref instead of an ID (#5230) 2024-02-15 15:42:28 -05:00
Erich Gubler
18b7904b8e fix: discard cmd. enc. buf. on wgpu_core::Global::command_encoder_drop 2024-02-15 10:45:32 -05:00
andristarr
a7d76743a8
MissingBufferUsageError now has an id prop (#5203) 2024-02-14 13:27:58 +01:00
Andreas Reich
f350f28c35
Separate native-only feature for wgpu::CommandEncoder::write_timestamp (#5188)
* split out TIMESTAMP_QUERY_INSIDE_ENCODERS from TIMESTAMP_QUERY

* changelog entry

* update changelog change number

* fix web warnings

* single line changelog

* note on followup issue
2024-02-13 16:03:33 +00:00
Jim Blandy
59e79c0664 [wgpu-core] Document and improve naming in PendingWrites. 2024-02-09 11:33:52 -08:00
Bruce Mitchener
665c075fa0
Remove TextureInner::Surface::has_work. (#5200)
When no work is submitted for a frame, presenting the surface results
in a timeout due to no work having been submitted.

Fixes #3189.

This flag was added in #1892 with a note that it was going to be
temporary until #1688 landed.
2024-02-09 11:36:24 +00:00
Erich Gubler
f21087ddaf
Revert "docs: inline document-features usage, remove dep." (#5169)
* docs: sync. `wgpu/Cargo.toml` feature comments with `lib.rs`

* Revert "docs: inline `document-features` usage, remove dep."

This reverts commit 3d5bec659b9cf19f1c64274de0d11808d771cc66, with an
update to `document-features`, and preferring to keep new `feature`
content. To be clear, the only difference I have observed is the
addition of the `serde` feature.

In case it shortens anyone's search, the specific issue resolved is
[`slint-ui/document-features`#20](https://github.com/slint-ui/document-features/issues/20).
2024-02-09 11:44:29 +01:00
andristarr
3028972817
buffer_map_async should use offset + size (#5185) 2024-02-09 09:48:00 +01:00
Nicolas Silva
990324fc33
Add max_color_attachments and max_color_attachment_bytes_per_sample (#5218) 2024-02-09 09:39:29 +01:00
Jim Blandy
4af531cf69
[wgpu-core] Compute minimum binding size correctly for arrays. (#5222)
* [wgpu-core] Add tests for minimum binding size validation.

* [wgpu-core] Compute minimum binding size correctly for arrays.

In early versions of WGSL, `storage` or `uniform` global variables had
to be either structs or runtime-sized arrays. This rule was relaxed,
and now globals can have any type; Naga automatically wraps such
variables in structs when required by the backend shading language.

Under the old rules, whenever wgpu-core saw a `storage` or `uniform`
global variable with an array type, it could assume it was a
runtime-sized array, and take the stride as the minimum binding size.
Under the new rules, wgpu-core must consider fixed-sized and
runtime-sized arrays separately.
2024-02-09 03:08:01 +00:00
Nicolas Silva
499bd64c29
Prevent a deadlock when destroying resources (#5216)
It's risky to get write access through the snatchlock from a drop implementation since the snatch lock is typically held for large scopes. This commit makes it so we deffer snatching some resources to when the device is polled and we know the snatch lock is not held.

Co-authored-by: Erich Gubler <erichdongubler@gmail.com>
2024-02-07 16:17:04 +00:00
Nicolas Silva
20fda69834 Fix the validation of max_bindings_per_bind_group 2024-02-06 15:03:19 +01:00
Connor Fitzgerald
faed98b45c
Add typos to Repository CI (#5191)
Co-authored-by: Andreas Reich <r_andreas2@web.de>
2024-02-05 12:30:29 -05:00
Nicolas Silva
32e70bc163
Prevent another deadlock. (#5201) 2024-02-05 17:52:04 +01:00
Nicolas Silva
4da46f35ef
Avoid a deadlock in Device::lose (#5197) 2024-02-05 10:01:05 -05:00
John-John Tedro
c038b5c433 Consistent debug formatting 2024-02-02 14:31:28 -05:00
John-John Tedro
f45d500c1c Remove HalSurface and fix layout assumptions in AnySurface and AnyDerive 2024-02-02 14:31:28 -05:00
John-John Tedro
84ba4e5461
Remove another unused A: HalApi parameter (#5181) 2024-02-01 14:03:46 +01:00
Nicolas Silva
617050ec16
Always serialize and deserialize ids the same way (#5182) 2024-02-01 13:29:50 +01:00
Nicolas Silva
d7bbababa7
Add information to some of the api logging (#5174) 2024-01-31 09:55:46 -05:00
Andreas Reich
45957088ad
Fix panic when creating a surface while no backend is available (#5166)
* Fix panic when creating a surface while no backend is available

* changelog entry
2024-01-31 08:48:33 +00:00
Brad Werth
0888a630a0
Call device lost callback when it is replaced, or when the global is dropped. (#5168)
This fixes two cases where a DeviceLostClosureC might not be consumed
before it is dropped, which is a requirement:

1) When the closure is replaced, this ensures the to-be-dropped closure
is invoked.
2)  When the global is dropped, this ensures that the closure is invoked
before it is dropped.

The first of these two cases is tested in a new test,
DEVICE_LOST_REPLACED_CALLBACK. The second case has a stub,
always-skipped test, DROPPED_GLOBAL_THEN_DEVICE_LOST. The test is
always-skipped because there does not appear to be a way to drop the
global from within a test. Nor is there any other way to reach
Device.prepare_to_die without having first dropping the device.
2024-01-31 08:15:45 +01:00
John-John Tedro
950d765a4d
Remove G parameter in Global<G> and generic IdentityHandlerFactory (#5159) 2024-01-29 15:37:57 +01:00
Nicolas Silva
6e020a079e
Fix the validation for vertex limits for regular render passes (#5156) 2024-01-29 14:01:03 +01:00
John-John Tedro
dec6ea5ea4
Improve the consistency of identifiers (#5108) 2024-01-29 10:56:04 +01:00
Bude
4face1c2ba
Feature/serde feature (#5149)
* Add serde, serialize, deserialize features to wgpu and wgpu-core
Remove trace, replay features from wgpu-types

* Do not use trace, replay in wgpu-types anymore

* Make use of deserialize, serialize features in wgpu-core

* Make use of serialize, deserialize features in wgpu

* Run cargo fmt

* Use serde(default) for deserialize only

* Fix serial-pass feature

* Add a comment for new features

* Add CHANGELOG entry

* Run cargo fmt

* serial-pass also needs serde features for Id<T>

* Add feature documentation to lib.rs docs

* wgpu-types implicit serde feature

* wgpu-core explicit serde feature

* wgpu explicit serde feature

* Update CHANGELOG.md

* Fix compilation with default features

* Address review comments
2024-01-28 20:13:04 +00:00
Nicolas Silva
e2e9ef5547 Fix the validation of vertex/index/instance ranges in render bundles 2024-01-26 17:26:44 +01:00
Nicolas Silva
d47534ed9a
Discard draws when the instance/vertex/index count is zero (#5137) 2024-01-25 09:06:29 +01:00
Nicolas Silva
efb35d4fa1
Snatch bind groups associated with destroyed textures and buffers (#5136)
* Make bind groups snatchable

* Snatch bindgroups when destroying associated textures and buffers.
2024-01-25 05:11:43 +00:00
Nicolas Silva
7d0f656dd9
Snatch texture views of destroyed textures (#5131) 2024-01-24 20:55:20 +01:00
Nicolas Silva
b0e4734a7e Differentiate between device loss caused by an error and caused by dropping the device 2024-01-24 13:41:23 +01:00
Nicolas Silva
8d64915b3c
Remove the lock around TextureView::parent (#5126) 2024-01-23 10:31:13 -05:00
wayne
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
Nicolas Silva
60a5739df2
d3d12: Propagate errors when closing command lists (#5125)
Before this commit, command lists that we failed to close were used anyway during submit, causing device loss.
2024-01-23 14:30:08 +01:00
Brad Werth
ac8756c2d3
Release GPU resources from device.trackers, not from lifetime_tracker. (#5075) 2024-01-22 17:55:42 +01:00
John-John Tedro
e5c62fb5bd
vulkan: Replace fence with semaphore when acquiring surfaces (#4967) 2024-01-21 18:14:17 -05:00
Connor Fitzgerald
8b2098bd4e
Release 0.19 (#5082) 2024-01-17 14:42:11 -05:00
Andreas Reich
b8f27c7284
Expose maximum_frame_latency (#4899)
Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
2024-01-17 12:46:34 -05:00
Connor Fitzgerald
2e38187954
Re-export public dependencies (#5063) 2024-01-16 19:21:51 +00:00
John-John Tedro
90b078f037
Improve ergonomics of gfx_select! (#5069) 2024-01-16 11:15:56 +01:00
dependabot[bot]
c5a0b0b7b4
Bump the patch-updates group with 12 updates (#5061)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-01-14 23:48:30 -05:00
Brad Werth
f89bd3b978
Make DeviceLostClosure.from_c consume the closure before dropping it. (#5032)
This clarifies that the Rust and C-style callbacks/closures need to be
consumed (not called) before they are dropped. It also makes the from_c
function consume the param closure so that it can be dropped without
panicking.

It also relaxes the restriction that the callback/closure can only be
called once.
2024-01-14 02:53:40 -05:00
daxpedda
580340f2d3
Add cfg_aliases to wgpu-core and wgpu-hal (#5055) 2024-01-14 00:59:59 -05:00
Nicolas Silva
376d901d1e
Triage suspected resources after triaging submissions (#5050) 2024-01-12 13:19:19 -05:00
Nicolas Silva
11c29c825f
Prevent a few integer overflows (#5042)
* Prevent a few integer overflows

* Add a changelog entry

* use u64
2024-01-12 16:23:23 +01:00
Andreas Reich
4fd4a7142e
Unify surface creation by introducing new SurfaceTarget enum (#4984) 2024-01-11 22:24:01 -05:00
Nicolas Silva
bc65d84cdb
Remove the Destroyed state from Storage (#4970)
* Remove the Destroyed state from Storage

It used to be how we handled destroying buffers and textures but we moved to different approach.

* Explicit check for destroyed textures/buffers in a few entry points

This used to be checked automatically when getting the resource from the registry, but has to be done manually now that we track we track the destroyed state in the resources.
2024-01-11 10:45:12 +00:00
Nicolas Silva
b30c0c2e00
Remove the free_resources tracker (#5037) 2024-01-11 09:41:09 +00:00
Nicolas Silva
c90f43bc2a
Move the trace recording of destroy events out of triage_resources (#5036) 2024-01-11 00:48:25 -05:00
Nicolas Silva
f27bb443c1
Don't crash if a texture is destroyed before queue submission (#5028) 2024-01-10 14:36:02 +01:00
Nicolas Silva
4400a58470
Fix a bounds check in remove_abandoned (#5024) 2024-01-09 11:24:18 -05:00
Nicolas Silva
37755b6985 Validate that a binding offset fits in the buffer 2024-01-09 16:07:47 +01:00
Nicolas Silva
58fe7eac48
Don't case the dynamic offsets count to u8 (#5026) 2024-01-09 15:41:39 +01:00
Nicolas Silva
1bc71eb8b2
Validate max_vertex_buffers in render bundles. (#5025) 2024-01-09 15:41:24 +01:00
Jim Blandy
8af6975d5e
Prefer Arc::into_inner over Arc::try_unwrap. (#5018) 2024-01-08 19:24:33 -05:00
Jim Blandy
a24bdbaa25
[wgpu-core] Minor doc fixes for initialization tracking. (#5017) 2024-01-08 16:46:57 -05:00
Nicolas Silva
c6eea50b04
Track the actual size of the buffer for memory init (#5014) 2024-01-08 17:24:09 +01:00
Nicolas Silva
8358868526
Propagate errors when openning/closing a command encoder (#4999) 2024-01-06 10:14:38 +01:00
Nicolas Silva
4b82121501 Snatch the raw texture when destroying it 2024-01-05 11:42:28 +01:00
Nicolas Silva
95c451a3b8 Check thata bindgroup's textures are not destroyed before using it 2024-01-05 11:42:28 +01:00
Nicolas Silva
defd43dff2 Rename Texture::as_raw into Texture::raw
For consistency with Buffer::raw.
2024-01-05 11:27:17 +01:00
Nicolas Silva
bfe235a295 Put raw texture access behind snatch guards 2024-01-05 11:27:17 +01:00
Nick
00cf05c1d0
Fix Queue::write_texture, Fix DX12 write_texture_subset_2d and re-enable the test. (#4990) 2024-01-04 19:50:41 -05:00
Connor Fitzgerald
d96d953025
Shorten Lock Lifetimes (#4976) 2024-01-04 09:24:54 +01:00
Connor Fitzgerald
b989e56874
Use Custom Mesa for Building (#4977) 2024-01-03 22:49:40 -05:00
Connor Fitzgerald
fd37dbfae9
Fix hang in multithreaded test (#4975) 2024-01-03 23:05:35 +01:00
Nathan Adams
ec920e85d1
Fix incorrect ConfigureSurfaceError::TooLarge message (#4960)
Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
2024-01-02 15:32:51 -05:00
Connor Fitzgerald
e26a853654
BGL Weak Pointer Deduplication Pool (#4927)
* Ho boy

* BGL pool finished

* Remove id32 feature

* Add BGL Test

* Iteration

* Working Dedupe

* Tests

* Iteration

* Re-iteration

* Hash Cleanup

* Add large slew of tests

* Whoops
2024-01-02 09:27:22 -05:00
Erich Gubler
e1baa5a56e docs: inline document-features usage, remove dep.
Re-implements https://github.com/gfx-rs/wgpu/pull/4886 (CC @Wumpf)
without the `document-features` crate, which has issues integrating into
Firefox builds after being `cargo vendor`ed into its repository. This
issue is being tracked against
https://github.com/slint-ui/document-features/issues/20. Once resolved,
I expect that we will want to revert this PR in its entirety, since
`document-features` is still a good addition to `wgpu`'s documentation
story.

Internally, consensus has already been achieved for this change.
Firefox's ability to build unfortunately take priority over this
particular convenience. Hopefully, we won't have to compromise shortly!

I tested this by ensuring that the HTML output of our existing
`document_features::document_features!(…)` usage was exactly the same.
There should be exactly zero regressions in the current state of
documentation for users. For maintainers, I have added a disclaimer that
one needs to keep changes in sync. with the relevant `Cargo.toml`
manifests.
2023-12-22 14:31:12 -05:00
Andrew Farkas
2993650ede
Fix typo "layout pipeline layout" -> "pipeline layout" (#4921) 2023-12-22 01:02:41 +00:00
Connor Fitzgerald
87ecc089dd Remove id32 feature 2023-12-20 21:39:24 -08:00
Brad Werth
9eea31a4ae
Eagerly release GPU resources when we lose the device. (#4851)
Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
2023-12-20 22:43:43 +00:00
Nicolas Silva
85b91c0408
Buffer snatching (#4896)
Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
2023-12-20 16:42:42 -05:00
Nicolas Silva
164e478fcb
Simplify some code around buffer unmapping (#4892) 2023-12-20 15:21:32 -05:00
Nicolas Silva
0524c88c03
Check that raw buffers and raw bind groups are valid (#4895) 2023-12-20 15:13:20 -05:00
sotaroikeda
1d6c7a0263
Support Device fence sharing with dx12 on Windows (#4900)
Co-authored-by: Sotaro Ikeda <you@example.com>
2023-12-20 13:33:47 -05:00
Brad Werth
56d9d32a07
[wgpu-core] Ensure that DeviceLostCallback is always called exactly once
* Ensure device lost closure is called exactly once before being dropped.

This requires a change to the Rust callback signature, which is now Fn
instead of FnOnce. When the Rust callback or the C closure are dropped,
they will panic if they haven't been called. `device_drop` is changed
to call the closure with a message of "Device dropped." A test is added.
2023-12-19 23:16:10 +00:00
Nicolas Silva
aade481bdf
Remove some locks in BindGroup (#4894)
* Remove some locks in BindGroup

These are only written to clear the vectors when triaging bindgroups for destruction, which is not necessary. We can let the reference counts drop when the bind group is dropped.

* Make the mem_leak test pass again
2023-12-19 10:29:32 +01:00
Nicolas Silva
a1b183f736
Avoid allocating memory every time we might log a label (#4893)
We allocate a String every time we want to get a label for logging. The string is also allocated when logging is disabled. Either way, the allocation is unnecessary. This commit replaces the String with a dyn Debug reference which does not need any allocation.
2023-12-18 13:08:18 +01:00
Nicolas Silva
192a2fe16c
Simplify ResourceMaps (#4880)
* Remove the abstractions in resource maps

ResourceMaps had a rather convoluted system for erasing types that isn't needed anywhere except in one place in the triage_resource function. Everywhere else we are always dealing with specific types so using a member of the resource maps is simpler than going through an abstraction. More importantly there was a constraint that all contents of the resource maps implement the Resource trait which got in the way of some of the ongoing buffer snatching changes.

This commit simplifies this by removing the abstraction. Each resource type has its hash map directly in ResourceMaps and it is easier to have different requirements and behaviors depending on the type of the each resource.
2023-12-18 08:27:58 +00:00
Mikko Lehtonen
159ac9e373
validation: More detailed on incompatible BGL (#4826) 2023-12-17 18:22:39 -05:00
Andreas Reich
ba56dd2901
Document wgpu & wgpu-core features (#4886) 2023-12-17 22:10:38 +00:00
Nicolas Silva
10dd5844ac
Allow clippy::pattern_type_mismatch (#4887) 2023-12-17 15:00:02 -05:00
daxpedda
2053358d89
Add wgpu crate features for backends (#4815)
* Introduce `dx12` and `metal` crate features to `wgpu`

* Implement dummy `Context` to allow compilation with `--no-default-features`

* Address review

* Remove `dummy::Context` in favor of `hal::api::Empty`

* Add changelog entry

* Panic early in `Instance::new()` if no backend is enabled

Co-Authored-By: Andreas Reich <1220815+Wumpf@users.noreply.github.com>

---------

Co-authored-by: Andreas Reich <1220815+Wumpf@users.noreply.github.com>
2023-12-16 10:39:53 +01:00
Nicolas Silva
855b06977f
Refactor create_buffer so that we can snatch the raw buffer in the error path. (#4878)
The general idea is to register postpone reigistering the buffer until towards the end of the function so that our unique reference to it lets us easily snatch the raw buffer if an error happens.
2023-12-15 10:08:03 +01:00
Nicolas Silva
c5e6122b65
Reintroduce buffer snatching Part 1 (#4867)
Introduce snatch guards
2023-12-14 13:14:49 +01:00
Teodor Tanasoaia
0cbabcf229
Update multi-planar texture API (#4837) 2023-12-07 14:06:56 -05:00
Connor Fitzgerald
dc842ae289
Some minor cleanups (#4843) 2023-12-07 08:55:02 +01:00
Daniel Keitel
0f4df52b5a
[wgpu-hal] Inline RayQuery Support (#3507)
Co-authored-by: JMS55 <47158642+JMS55@users.noreply.github.com>
Co-authored-by: Ashley Ruglys <ashley.ruglys@gmail.com>
Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
2023-12-06 21:12:41 +00:00
daxpedda
3e0fb2c14e
Expose shader validation (#4811)
Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
2023-12-06 21:06:04 +00:00
Valaphee The Meerkat
a1fafe394f
Remove DX11 backend (#4828) 2023-12-06 15:12:46 -05:00
Nicolas Silva
537f656626
Use Display instead of Debug to log errors. (#4830) 2023-12-04 18:49:33 -05:00
Almar Klein
32c5a22293
Add feature float32-filterable (#4759) 2023-12-04 14:23:13 +01:00
teoxoy
acdc9fcced move alignments & downlevel .clone()s inside function 2023-11-29 19:55:18 +01:00
teoxoy
da73522720 rename DeviceDescriptor.limits to DeviceDescriptor.required_limits 2023-11-29 19:55:18 +01:00
teoxoy
9be6c8890f rename DeviceDescriptor.features to DeviceDescriptor.required_features 2023-11-29 19:55:18 +01:00
Andreas Reich
8da4925948
Remove surface extent validation (and thus fix the annoying Requested size ... is outside of the supported range warning) (#4796)
* Remove surface extent validation

* silence pnext vulkan validation warning which can happen on surface resize

* remove old VUID-VkSwapchainCreateInfoKHR-imageExtent-01689 validation warning ignore

* Validate surface against max texture size
2023-11-29 18:21:26 +01:00
Jim Blandy
276c978b70 [naga] Introduce ScalarKind::AbstractInt and AbstractFloat.
Introduce new variants of `naga::ScalarKind`, `AbstractInt` and
`AbstractFloat`, for representing WGSL abstract types.
2023-11-29 08:58:47 +01:00
dependabot[bot]
723b8baf2a
Bump web-sys from 0.3.65 to 0.3.66 (#4800)
Bumps [web-sys](https://github.com/rustwasm/wasm-bindgen) from 0.3.65 to 0.3.66.
- [Release notes](https://github.com/rustwasm/wasm-bindgen/releases)
- [Changelog](https://github.com/rustwasm/wasm-bindgen/blob/main/CHANGELOG.md)
- [Commits](https://github.com/rustwasm/wasm-bindgen/commits)

---
updated-dependencies:
- dependency-name: web-sys
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-11-29 02:03:18 -05:00
Xiaopeng Li
a6503e59c9
Support nv12 texture format (#4573)
Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
2023-11-28 16:11:26 +00:00
Mauro Gentile
238c3732a4
Don't keep a strong ref in storage for destroyed resources (#4786) 2023-11-27 13:37:09 +01:00
Mauro Gentile
2c67f79970
Remove resources ONLY when needed inside wgpu and not in user land (#4782) 2023-11-27 13:09:50 +01:00
TÖRÖK Attila
2964eed6f9
Bump web-sys to 0.3.65 (#4777) 2023-11-26 17:54:29 -05:00
Mauro Gentile
281a7aecd5
remove_abandoned fix (#4781)
* remove_abandoned fix

* Updated doc
2023-11-26 14:58:00 +00:00
Nicolas Silva
ebcfd25b58
Downgrade resource lifetime management log level to trace. (#4772)
* Downgrade resource lifetime management log level to trace.

Allow promoting it back to info via an feature flag.

* Don't filter out info and warning log in the examples.

* Changelog entry.
2023-11-25 17:33:02 +01:00
Nicolas Silva
ca4e1313f7
Downgrade some of wgpu_core's logging level from info to trace and debug (#4771)
* Downgrade storage log level from info to trace

* Downgrade tracking log level from info to trace

* Demote present log from info to debug

* Downgrade device/life.rs log from info to debug and trace

* Downgrade more log from info to trace
2023-11-24 20:09:36 +01:00
Nicolas Silva
350c9633fe
Conditionally lift API logging from trace to info level (#4769)
* Conditionally lift API logging from trace to info level

Most of this logging used to be info level until I demoted it to trace. Unfortunately this gets in my way because:
 - Most of the logging I currently need is these API entry points, there is is a fair amount of more verbose logging in wgpu at higher levels than trace
 - Firefox disable all trace and debug logging for optimized builds, which means I miss the this API logging where I need most.

This patch lifts the api logging back to info level.

* Move the api logging behind the api_log macro
2023-11-24 19:14:38 +01:00
Nicolas Silva
039660ec85
Logging cleanups in device/global.rs (#4752)
* Clean up the trace-level logging for devices

* Log the descriptors for create_buffer and create_texture.

* Make logged ids more concise

Logged ids go from 'Id { index: 204, epoch: 1, backend: Vulkan }' to 'Id(204,1,vk)'.

* Log errors in more places.
2023-11-22 19:28:55 +00:00
Nicolas Silva
7dad106039
Make the command_encoder_clear_buffer's size an Option<BufferAddress> (#4737)
* Make the size parameter of command_encoder_clear_buffer an Option<BufferAddress>

* Add a changelog entry
2023-11-22 11:42:34 +01:00
Brad Werth
877dd5b26c
Ensure DeviceLostClosureC callbacks have null-terminated message strings. (#4744) 2023-11-22 09:00:28 +01:00
Connor Fitzgerald
1df98d9888
Test And Normalize Vertex Behavior on All Backends (#4723)
Co-authored-by: teoxoy <28601907+teoxoy@users.noreply.github.com>
2023-11-21 22:11:24 +00:00
Jim Blandy
72462267e8 [naga]: Let TypeInner::Matrix hold a Scalar, not just a width.
Let `naga::TypeInner::Matrix` hold a full `Scalar`, with a kind and
byte width, not merely a byte width, to make it possible to represent
matrices of AbstractFloats for WGSL.
2023-11-21 12:02:50 +01:00
Nicolas Silva
6786548d1e
Fix max_vertex_buffers validation (#4708) 2023-11-20 10:17:19 +01:00