Commit Graph

8425 Commits

Author SHA1 Message Date
David Peicho
3018912897
naga: Add support for GLSL signed/unsigned samplers (#6513) 2024-11-15 11:49:56 +01:00
François Mockers
4681f4ffba
Fix iOS crash: don't set autoresizing mask (#6535) 2024-11-15 08:18:11 +00:00
teoxoy
278620be26 destroy subsequent command buffers if we encountered an error at submission
This gets the `wgpu_test::ray_tracing::as_build::out_of_order_as_build` test to pass.

This seems to be an issue even on trunk, looking at the nr of calls to `create_command_encoder` & `destroy_command_encoder` in hal, they are not equal. So, I'm not sure why the validation layers don't raise the `VUID-vkDestroyDevice-device-05137`.

There is still an issue with previous command buffers being leaked but I will fix this in a follow-up.
2024-11-14 06:27:37 -08:00
teoxoy
5a3de2d3a8 add a retry mechanism for waiting on the last submission in Queue::drop 2024-11-14 06:27:37 -08:00
teoxoy
d489e4c2e8 remove hal::Device::exit, add Drop implementations to Device and Queue instead 2024-11-14 06:27:37 -08:00
teoxoy
394bf37f98 expect to timeout when targeting WebGL 2024-11-14 06:27:37 -08:00
teoxoy
ddf0e67da7 wait for the last successful submission to complete before dropping the Queue 2024-11-14 06:27:37 -08:00
teoxoy
9e17e32686 extract Queue.maintain 2024-11-14 06:27:37 -08:00
teoxoy
5061ae3e5e map buffers immediately in map_async if the Queue has been dropped 2024-11-14 06:27:37 -08:00
teoxoy
6cc53421bf move LifetimeTracker into the Queue
The `Device` should not contain any `Arc`s to resources as that creates cycles (since all resources hold strong references to the `Device`).
Note that `LifetimeTracker` internally has `Arc`s to resources.
2024-11-14 06:27:37 -08:00
teoxoy
e934595bb2 move device_lost_closure from Device::life_tracker to Device 2024-11-14 06:27:37 -08:00
teoxoy
61c84f956e Remove outdated locking comments
We should rely on the ranks in `wgpu-core\src\lock\rank.rs`.
2024-11-14 06:27:37 -08:00
teoxoy
6c7dbba399 move PendingWrites into the Queue
The `Device` should not contain any `Arc`s to resources as that creates cycles (since all resources hold strong references to the `Device`).
Note that `PendingWrites` internally has `Arc`s to resources.

I think this change also makes more sense conceptually since most operations that use `PendingWrites` are on the `Queue`.
2024-11-14 06:27:37 -08:00
teoxoy
97acfd26ce rely on our ownership model to keep the device alive while there are still active submissions
`Global::device_drop` was wrongly assuming `device_poll` with `Maintain::Wait` was called but this is not a documented invariant and only `wgpu` was upholding this.
2024-11-14 06:27:37 -08:00
Jamie Nicol
4fb32170bf
[wgpu-core] Replace usage of PreHashedMap with FastHashMap (#6541)
PreHashedMap was introduced as a performance optimization. It is,
however, potentially unsound as it cannot distinguish between keys
that are not equal yet have the same hash. This patch replaces its
usage with a simple FastHashMap, which should be good enough. If this
is found to cause real life performance issues down the line then we
can figure out a better solution.
2024-11-14 13:09:51 +00:00
Erich Gubler
d0fd6a231c chore: satisfy unused_qualifications (again) 2024-11-14 07:56:22 -05:00
Erich Gubler
3767a62339 chore: qualify std::mem::size_of with use (again) 2024-11-14 07:56:22 -05:00
Erich Gubler
693eaaf7f8 docs(CHANGELOG): add ref. to #6533 2024-11-13 08:59:25 -05:00
Erich Gubler
435514176e feat(wgsl-in): add unimpl. diag. for compound stmt. @diagnostic(…)s 2024-11-13 08:59:25 -05:00
Erich Gubler
c259f3b5a0 feat(wgsl-in): add @diagnostic(…) checks on global decls.
Co-authored-by: Teodor Tanasoaia <28601907+teoxoy@users.noreply.github.com>
2024-11-13 08:59:25 -05:00
Erich Gubler
82e7aa3d5b refactor(naga): hoist Attribute's name{,_span} bindings 2024-11-13 08:59:25 -05:00
Erich Gubler
e6f52bf46d move(naga)!: move WGSL-specific diagnostic_filter stuff to naga::front::wgsl 2024-11-13 08:59:25 -05:00
Erich Gubler
66d2ac6f5d refactor(naga)!: diagnostic_filter: s/{from,to}_ident/{from,to}_wgsl_ident 2024-11-13 08:59:25 -05:00
Erich Gubler
a2044aefe7
fix: allow non-filterable float on derived BGLs for texture binding usage w/ no sampler (#6531) 2024-11-13 12:20:02 +00:00
Erich Gubler
efc15ba03b
chore: revert removal of DISABLE_UNIFORMITY_REQ_FOR_FRAGMENT_STAGE (#6534) 2024-11-13 07:03:16 -05:00
Erich Gubler
b5986a9df1 diag: re-word CreateBindGroupError::InvalidTextureSampleType 2024-11-13 07:02:53 -05:00
Erich Gubler
5fb5719cdc diag: add CreateBindGroupError::InvalidTextureSampleType::view_sample_type 2024-11-13 07:02:53 -05:00
Andreas Reich
ae6c6fbea4
Fix Vulkan surface capabilities being advertised when its query failed. (#6510)
* distinguish `GetSurfaceSupportError` between backend unsupported and failing to get surface caps

* Fix vulkan backend returning invalid surface configuration

* changelog entry
2024-11-12 23:51:07 +01:00
Erich Gubler
4311091cce
fix: lower QUERY_SET_MAX_QUERYS 8192 → 4096 (#6525) 2024-11-12 14:38:19 +00:00
Erich Gubler
e8a8281203 diag(naga): add type info to InvalidBinaryOperandTypes 2024-11-12 09:20:56 -05:00
Erich Gubler
2a2655def8 refactor(naga): use named fields for ExpressionError::InvalidBinaryOperandTypes 2024-11-12 09:20:56 -05:00
Erich Gubler
ea75a8ced4 feat(wgsl-in): filter unif. analysis errors with derivative_uniformity
- Remove `DISABLE_UNIFORMITY_REQ_FOR_FRAGMENT_STAGE`.
- Add `CHANGELOG` entry.
- Add coverage to `naga`'s `valid::analyzer::uniform_control_flow` test.
2024-11-12 08:49:02 -05:00
Erich Gubler
b81fcb4134 refactor(wgsl-in): track diagnostic directives in func. analysis 2024-11-12 08:49:02 -05:00
Erich Gubler
290ea1553b chore: remove unimpl. diag. filt. err. check 2024-11-12 08:49:02 -05:00
Erich Gubler
7a5d505896 feat(wgsl-in): detect conflicting diag. filters 2024-11-12 08:49:02 -05:00
Erich Gubler
44b8e38fd8 refactor(wgsl-in): specify more closure ret. types in parsing
This resolves ambiguity that will be introduced in the subsequent commit
that adds `impl From<ConflictingDiagnosticRuleError> for naga::Error`.
2024-11-12 08:49:02 -05:00
Erich Gubler
5e68a63151
fix(const_eval): don't panic when a vecN constructor's arg. count is less than N (#6508) 2024-11-12 12:44:02 +00:00
Jamie Nicol
cffc7933fd
[naga] Implement quantizeToF16 (#6519)
Implement WGSL frontend and WGSL, SPIR-V, HLSL, MSL, and GLSL
backends. WGSL and SPIR-V backends natively support the instruction.
MSL and HLSL emulate it by casting to f16 and back to f32. GLSL does
similar but must (mis)use (un)pack2x16 to do so.
2024-11-12 12:05:19 +01:00
dependabot[bot]
6a60458790
build(deps): bump thiserror from 1.0.67 to 1.0.69 (#6517)
Bumps [thiserror](https://github.com/dtolnay/thiserror) from 1.0.67 to 1.0.69.
- [Release notes](https://github.com/dtolnay/thiserror/releases)
- [Commits](https://github.com/dtolnay/thiserror/compare/1.0.67...1.0.69)

---
updated-dependencies:
- dependency-name: thiserror
  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>
2024-11-11 10:06:58 +01:00
dependabot[bot]
dd11d49afa
build(deps): bump JamesIves/github-pages-deploy-action from 4.6.8 to 4.6.9 (#6515)
Bumps [JamesIves/github-pages-deploy-action](https://github.com/jamesives/github-pages-deploy-action) from 4.6.8 to 4.6.9.
- [Release notes](https://github.com/jamesives/github-pages-deploy-action/releases)
- [Commits](https://github.com/jamesives/github-pages-deploy-action/compare/v4.6.8...v4.6.9)

---
updated-dependencies:
- dependency-name: JamesIves/github-pages-deploy-action
  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>
2024-11-11 10:06:36 +01:00
dependabot[bot]
fb63134153
build(deps): bump crate-ci/typos from 1.27.0 to 1.27.3 (#6514)
Bumps [crate-ci/typos](https://github.com/crate-ci/typos) from 1.27.0 to 1.27.3.
- [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.27.0...v1.27.3)

---
updated-dependencies:
- dependency-name: crate-ci/typos
  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>
2024-11-11 10:06:15 +01:00
Vecvec
79a6f2cd31
Ray Queries (#6291)
* fix more compile errors

* fix err

* fix all compile errors

* fix clippy errors

* fix issues in ray-traced-triangle example

* fix clippy warnings

* fix wasm not compiling

* fix test

* fix clippy (again)

* fix some rustfmt issues

* fix more rustfmt issues

* fix even more rustfmt issues

* fix yet more rustfmt issues

* add #[allow(dead_code)] to some structs to fix clippy on web assembly

* more format fixes

* even more format fixes

* close to final format fixes

* final format fixes (hopefully)

* actual final format fixes (hopefully)

* move ray_cube_cube example and fix bugs

* move other examples

* fix crash when dropping

* fix test

* apply clippy and rustfmt changes

* fix some memory leaks

* fix incompatibility with new wgpu trunk changes

* fix clippy & fmt

* fix clippy errors on github

* update to trunk

* remove a line that printed log "Created blas ..." in device create tlas

* fix merge issues

* fix merge

* fix fmt

* restored example ray scene functionality

* WIP fix rebase

* Fix compile issues

* More fixes

* Fix rebase

* Add wgls backend write_value_type AccelerationStructure

* Add back xtask Cargo.lock

* Revert serde path

* Doc typos

* Add -diff

* Revert more serde

* Revert serde again?

* Fix doc typo

* add test

* clippy & fmt

* fix error "blas does not exist"

* fix various things

* fix unused acceleration structures causing invalid SPIR-V

* fix merge

* fix use after free in a different way (now moved tlas instances to wgpu_core)

* refactor & fmt

* remove accidentally created file

* remove accidentally created file (actually)

* merge & fix

* Fix problems

* fix validation error

* fix validation

* fix merge

* fmt

* fix merge

* use staging buffer trackers in creating the ray-tracing staging buffers (not the tlas_s)

* change one missed staging buffer's tracker

* wip: example

* finished shadow!

* fix merge

* clippy

* remove some uses of blas ids

* fmt

* fix merge

* deduplicate code shared between command_encoder_build_acceleration_structures and command_encoder_build_acceleration_structures_unsafe_tlas

* clippy

* fix merge

* fix warnings

* clippy & fmt

* re-add matching to get_raw_tlas_instance_size and tlas_instance_into_bytes

* fmt

* fix command

* wip: fix merge

* fix merge

* fmt & docs

* fix wasm clippy

* fix issues with tests

* fix issues with tests

* fmt & clippy (wasm)

* wip ray-traced-triangle (non hal)

* unify camera location in ray_shadows

* fix tests

* add readme to ray_traced_triangle

* note that vertex format must be f32x3 (not yet validated)

* changelog

* require VertexFormat::Float32x3

* fix compile error

* when creating and building acceleration structures require Features::RAY_TRACING_ACCELERATION_STRUCTURE is enabled

* remove duplicate workaround

* fix most feedback

* remove all changes from .gitattributes

* fix compile error in test

* more changes along same lines

* format

* apply feedback to more places

* fix `cargo clippy` not just `cargo clippy --all-features`

* cache max instances from tlas creation

* fix clippy

* fix examples

* fix tests

* remove now useless docs

* add more docs

* yet more docs

* still more docs

* Documentation.

* Running out of unique commit messages to say writing docs.

* Add more references to docs.

* Get BindGroup in scope

* Remove unintentional changes

* Remove #[allow(dead_code)]

* Remove old comments

* Add device.poll

* make ray_scene start right way up

* fmt

* move scratch buffer to its own module

* actually remove intentional changes (turns out wgt is inconsistent)

* use better names in ray_scene/shader.wgsl

* fmt

* remove more unintentional changes.

* work on ray_tracing use after free

* spelling

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

* grammar

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

* move things into struct (should be all vectors with 3 item types or more)

* remove long-standing locks.

* fmt

* move not using index buffer to test

* impl index & index mut for tlas package

* impl index & index mut for tlas package

* fix errors

* fix test errors

* move everything out of ray_tracing.rs

* more index_mut

* fmt

* fix docs links

* move to separate impl block

* fix older request review

* fmt

* remove missed deref

* fix wasm clippy

* change to suggestions

* fmt

* add a note as to why `command_encoder_build_acceleration_structures_unsafe_tlas` and `command_encoder_build_acceleration_structures` are currently separate

* add a todo to reconsider soon `command_encoder_build_acceleration_structures_unsafe_tlas`

* switch to mat4 in ray-tracing examples

* Combine RT Tests Under Single Submodule

* Add More Raytracing Tests and Re-Organize

* Documentation and Formatting Fixes

* Remove Forced Alignment in wgpu-hal

* work on out_of_order_as_build and add out_of_order_as_build_use

* fmt

* update test label naming

* fix one validation error

* fix clippy & fmt

* add acceleration structure creation tests

* make mis-matched index test use the correct function

* move validation into validate_command_buffer

* fix tests

* add blas and tlas to pending writes to remove (now unneeded) `device.poll()`s

* remove commented out code from examples and properly use the constants in ray_shadow

* add examples to examples\README.md

* rename ray tracing to ray queries in readme

* remove unneeded usage from scratch buffer creation

* use snatchables for raw acceleration structures

* format

* add EXPERIMENTAL_ to features

* fix missed comment

---------

Co-authored-by: Daniel Keitel <daniel.mg.keitel@fau.de>
Co-authored-by: JMS55 <47158642+JMS55@users.noreply.github.com>
Co-authored-by: atlas dostal <rodol@rivalrebels.com>
Co-authored-by: vero <email@atlasdostal.com>
Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
2024-11-09 17:59:48 +00:00
Erich Gubler
01973a98dc
fix(core): handle HAL errors from query set creation (#6505)
* fix(core): handle HAL errors from query set creation

* Update CHANGELOG.md

Co-authored-by: Andreas Reich <r_andreas2@web.de>

---------

Co-authored-by: Andreas Reich <r_andreas2@web.de>
2024-11-09 12:21:58 +00:00
Adam Winiarczuk
b89a57f8ca
Dx12 HAL texture: expose raw resource (#6502)
Co-authored-by: Adam Winiarczuk <tsu@liv.tv>
2024-11-08 18:54:10 +01:00
Gábor Gyebnár
47d20d913d
Fixes crash when there's a missing texture argument (#6486) 2024-11-07 16:35:36 +01:00
Jerzy Wilczek
9b47b06a4f
Make Surface::as_hal take an immutable reference. (#6500) 2024-11-06 15:47:25 +01:00
Erich Gubler
5936fe58f4 fix: check for device mismatch in create_{render,compute}_pass 2024-11-06 01:33:32 -05:00
Erich Gubler
2e46a6c9c9 fix: req. TIMESTAMP_QUERY feat. for <pass desc.>::timestamp_writes 2024-11-06 01:33:32 -05:00
David Ellis
080d99b5bf
Fix Issue 6467: Prevent MacOS crash on invalid workgroup size definition (#6494) 2024-11-05 14:21:33 +01:00
Jasper St. Pierre
9ccea8179d naga: Fix textureNumLevels in the GLSL backend
... and reactivate the GLSL test for it.

Fixes issue #6435.
2024-11-04 08:07:23 -08:00