Commit Graph
8439 Commits
Author SHA1 Message Date
Jamie Nicol 00a6032eb7 [naga spv-out] Handle nested arrays when adding matrix decorations
Previously we only checked whether the outermost array's subtype was a
Matrix when determining whether to add ColMajor and MatrixStride
decorations, meaning arrays of arrays of matrices would not be
decorated.
2024-11-20 06:38:39 -08:00
Vecvec 6f5014f0a3 [wgpu-core/-hal] move raytracing alignments into hal (#6563) 2024-11-19 11:57:48 +01:00
fyellin 2389106a75 Fix set_push_constants for render bundles (#6540) 2024-11-19 11:12:21 +01:00
Jim Blandy 0b82776947 [naga msl-out] Avoid UB by making all loops bounded.
In MSL output, avoid undefined behavior due to unbounded loops by
adding an unpredictable, never-actually-taken `break` to the bottom of
each loop body, rather than adding an unpredictable,
never-actually-taken branch over each loop.

This will probably have more of a performance impact, because it
affects each iteration of the loop, but unlike branching over the
loop, which leaves infinite loops (and thus undefined behavior) in the
output, this actually ensures that no loop presented to Metal is
unbounded, so that there is no undefined behavior present that the
optimizer could use to make unwelcome inferences.

Fixes #6528.
2024-11-18 14:10:50 -08:00
Erich Gubler e59f00399e fix(wgsl-in): include user and unknown rules in diagnostic(…) tracking 2024-11-18 17:10:07 -05:00
Erich Gubler 1fc5e4027a refactor: remove ConflictingDiagnosticRuleError::triggering_rule
Did this to decrease size of `ConflictingDiagnosticRuleError`, which
would have gotten even bigger in a subsequent commit.
2024-11-18 17:10:07 -05:00
Erich Gubler ffc2a1e9a0 diag(wgsl-in): fix plurality agreement for conflicting diagnostic rules 2024-11-18 17:10:07 -05:00
Erich Gubler f6f0e5dbc2 refactor(naga): unimpl. Copy for FilterableTriggeringRule 2024-11-18 17:10:07 -05:00
Jamie Nicol 6f528e2ebc [wgsl-in] Reject invalid texture types for textureSampleBias (#6566)
Non-sampled textures are not allowed, and neither are 1 dimensional
textures.
2024-11-18 17:37:52 +01:00
Jamie Nicol baecb5fbf1 [wgsl-in] Ensure textureSampleLevel's level argument is an integer for depth textures (#6529)
Until now we accepted a float, as is the case for non-depth textures.
This makes us compliant with the spec.

The validator is updated to expect an Sint or Uint when the ImageClass
is ImageClass::Depth. The SPIR-V frontend converts the LOD argument
from float to Sint (assuming that it is representable), likewise The
SPIR-V backend now converts the LOD from either Sint or Uint to
Float. HLSL and MSL backends require no changes as they implicitly do
that conversion. GLSL does not support non-compare LOD samples,
therefore no changes are required.
2024-11-18 12:05:04 +00:00
Jim BlandyandErich Gubler c110bf22d8 docs(diagnostic_filter): add more words to DiagnosticFilterMap
Co-authored-by: Erich Gubler <erichdongubler@gmail.com>
2024-11-15 16:11:07 -08:00
Teodor Tanasoaia 1abf3fe90e remove unused enum variants (#6550) 2024-11-15 14:25:18 +01:00
Erich Gubler 92ca5a3850 feat(wgsl-in): parse diagnostic attrs. on fns 2024-11-15 07:44:14 -05:00
Erich Gubler ed29b2b758 fix(wgsl-in): yield conflict errors for full diagnostic(…) rule dupes in attr. pos. 2024-11-15 07:44:14 -05:00
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 GublerandTeodor Tanasoaia 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