2144 Commits

Author SHA1 Message Date
Samson
8f82992b9f
Inline PassChannel into ColorAttachment (#6704)
Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
2024-12-12 15:57:05 +01:00
Erich Gubler
727992e844
chore: satisfy clippy::unused_qualification (#6712) 2024-12-12 00:47:48 -05:00
atlv
5543961a71
Replace Range<T> with StateTransition<T> (#6703)
Co-authored-by: Erich Gubler <erichdongubler@gmail.com>
2024-12-11 16:11:39 +01:00
Teodor Tanasoaia
dc5bd9dbac
Remove BufferUses::STORAGE_WRITE_ONLY (#6691) 2024-12-11 02:15:11 -05:00
Teodor Tanasoaia
a1fc2ba76d
fix being able to use storage textures without TEXTURE_ADAPTER_SPECIFIC_FORMAT_FEATURES (#6690)
Co-authored-by: Erich Gubler <erichdongubler@gmail.com>
2024-12-10 15:34:38 -05:00
Andreas Reich
ed694eda89
Improve logging around surface creation (#6511)
* additional debug logging for request_adapter, demote some messages to debug

* unrelated log messages that annoyed me in Vulkan: debug utils disabled is now `debug`, it being enabled is `info`

* document compatible_surface requirement for WebGL directly on wgt::RequestAdapterOptions

* make adapterenumarge_adapters & request_adapters results info log again when api_log is enabled
2024-12-08 14:44:55 +01:00
Nathan Adams
11b51693d3
Fix dropping Device if not using indirect validation (#6681) 2024-12-07 22:17:12 +01:00
Erich Gubler
f8b67a752a
docs: remove last paragraph from CommandBuffer::data (#6680) 2024-12-07 01:30:09 -05:00
Connor Fitzgerald
4e139ed199
Rework wgpu-rs Context (#6619) 2024-12-04 12:00:14 -05:00
atlv
0b6571a68d
Align Storage Access enums to spec (#6642) 2024-12-03 17:37:23 +01:00
teoxoy
02b28e28f0 use EncoderGuard for the other command encoder operations
The spec requires us to invalidate the encoder if there was any error during the body of these operations.
2024-12-02 15:59:14 -08:00
teoxoy
5e1fbd7176 move CommandEncoderStatus on the CommandBuffer and change its variants to hold CommandBufferMutable
This makes the code more straightforward, we were previously holding invalidity state in 2 places: `CommandBuffer::data` could hold `None` and in `CommandEncoderStatus::Error`.

This commit also implements `Drop` for `CommandEncoder` which makes the destruction/reclamation code automatic. We were previously not reclaiming all command encoders (`CommandBufferMutable::destroy` didn't call `release_encoder`) even though all encoders are coming from a pool.
2024-12-02 15:59:14 -08:00
teoxoy
68d336ef79 use CommandEncoder for BakedCommands & EncoderInFlight 2024-12-02 15:59:14 -08:00
teoxoy
ba416c1dad remove hal::Device::destroy_command_encoder, use Drop implementations instead
Co-Authored-By: Erich Gubler <erichdongubler@gmail.com>
2024-12-02 15:59:14 -08:00
atlv
cf793f7c0f
clean up bitflag serde (#6644) 2024-12-02 16:03:37 -05:00
atlv
d5253be7fd
rename TFFF::STORAGE_READ_WRITE to STORAGE_WRITE (#6622) 2024-12-01 23:26:47 -05:00
atlv
5e52a313b9
rename TFC::STORAGE to STORAGE_WRITE (#6621) 2024-12-01 16:53:27 -06:00
Teodor Tanasoaia
1a643291c2
Simplify WeakVec (#6587)
* simplify `WeakVec`

* iterate backwards & avoid rescans

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

---------

Co-authored-by: Jim Blandy <jimb@red-bean.com>
2024-11-27 07:16:11 -08:00
Jim Blandy
8fce9f6191 [core] Make insert_or_merge a method of BufferUsageScope.
Change `wgpu_core::track::buffer::insert_or_merge` into a
method of `BufferUsageScope`, replacing three arguments with `self`.
2024-11-27 02:00:03 -05:00
Jim Blandy
eaa5fea40d [core] Make insert_or_barrier_update a method of BufferTracker.
Change `wgpu_core::track::buffer::insert_or_barrier_update` into a
method of `BufferTracker`, and replace four arguments with `self`.
2024-11-27 02:00:03 -05:00
Erich Gubler
9436d56271 feat(types): add deprecated type aliases for idents. in 2024-08 spec. rename 2024-11-26 23:16:35 -05:00
Erich Gubler
c05aa105f2 refactor!: handle 2024-08 spec. rename of image copy APIs
This commit was authored by running the following Nushell script, using
the `nu` binary and the lovely `fastmod` tool:

```nushell
# Copy-pasted from the OP in [`gpuweb`#4838](https://github.com/gpuweb/gpuweb/pull/4838).
let renames_table = '
Type 	Old 	New 	Used in
dict 	GPUImageDataLayout 	GPUTexelCopyBufferLayout 	"writeTexture,
parent type of ↙"
dict 	GPUImageCopyBuffer 	"GPUTexelCopyBufferInfo
extends ↑" 	T2B, B2T
dict 	GPUImageCopyTexture 	GPUTexelCopyTextureInfo 	T2B, B2T, T2T, writeTexture
dict 	GPUImageCopyTextureTagged 	"GPUCopyExternalImageDestInfo
extends ↑" 	copyExternalImageToTexture
dict 	GPUImageCopyExternalImage 	GPUCopyExternalImageSourceInfo 	copyExternalImageToTexture
union 	GPUImageCopyExternalImageSource 	GPUCopyExternalImageSource 	member of ↖
'

let renames_table = $renames_table
  | from tsv
  | select 'Old ' 'New '
  | rename old new
  | update new { $in | lines | get 0 } # only the first line has the renamed symbol identifier
  | update old { strip_gpu_prefix | str trim }
  | update new { strip_gpu_prefix | str trim }
  | sort-by old | reverse # Replace most specific symbol names first (some have the same "word segments" but with fewer segments)

def strip_gpu_prefix []: string -> string {
  $in | str replace --regex '^GPU' ''
}

# Rename image APIs.
for entry in $renames_table {
  fastmod --accept-all --fixed-strings $entry.old $entry.new --iglob '!CHANGELOG.md' --iglob "!xtask/src/vendor_web_sys.rs" --iglob '!wgpu/src/backend/webgpu/webgpu_sys/' --iglob '!deno_webgpu/' --iglob '!wgpu/src/backend/webgpu.rs'
}
cargo fmt
```

…and cleaning up `deno_webgpu/`'s Rust compilation errors.
2024-11-26 23:16:35 -05:00
teoxoy
e2eeba7dae [wgpu-core] document which closures are guaranteed to be called 2024-11-26 20:31:18 +01:00
teoxoy
14af686b9f Remove device_unregister_device_lost_closure 2024-11-26 20:31:18 +01:00
teoxoy
86656e182b simplify DeviceLostClosure by removing its C variant 2024-11-26 20:31:18 +01:00
teoxoy
13fbf30813 simplify BufferMapCallback by removing its C variant 2024-11-26 20:31:18 +01:00
teoxoy
8e4622b399 simplify SubmittedWorkDoneClosure by removing its C variant 2024-11-26 20:31:18 +01:00
teoxoy
f4bdd1cb65 remove Dropped & ReplacedCallback variants of DeviceLostReason 2024-11-26 20:31:18 +01:00
teoxoy
f096c66938 remove DeviceLostClosure consumed check 2024-11-26 20:31:18 +01:00
teoxoy
816e9c5856 use FnOnce instead of Fn for the device lost closure 2024-11-26 20:31:18 +01:00
Erich Gubler
96c855b7ed chore: satisfy elided_named_lifetimes lint 2024-11-25 03:36:18 -05:00
Erich Gubler
ca410afb5f chore: satisfy clippy::assigning_clones
Started firing with Rust 1.78.0, but we can preempt it with our current
MSRV.
2024-11-25 03:36:18 -05:00
atlv
c22c062b54
fix typo (#6597) 2024-11-23 18:03:41 -05:00
Elie Michel
c54a159bab
Improve binding error (#6553)
* Improve binding error

* Introduce a new BindingTypeName enum

* Fix formatting

* Use From trait instead of map functions for BindingTypeName

* Update CHANGELOG.md
2024-11-22 21:11:22 -05:00
atlv
b75f46cfbe
fix typo (#6591) 2024-11-22 21:09:48 -05:00
Teodor Tanasoaia
47bfede63f
Add device_unregister_device_lost_closure (#6588)
Co-authored-by: Erich Gubler <erichdongubler@gmail.com>
2024-11-22 19:49:47 +00:00
Erich Gubler
19d80fe229 refactor(core): extract Global::validate_pass_timestamp_writes 2024-11-22 13:50:29 -05:00
Erich Gubler
29e7fe3fe2 fix(core): validate that at least one pass timestamp write index is specified 2024-11-22 13:50:29 -05:00
Erich Gubler
6365e2dd75 fix(core): validate dst_buffer isn't destroyed when resolving query sets 2024-11-21 23:23:15 -05:00
Erich Gubler
f1ec934dbc fix(core): validate that begin and end indices of pass timestamp writes are not equal 2024-11-21 23:22:15 -05:00
Erich Gubler
be50bdfc18 fix(core): validate bounds of pass timestamp writes' indices 2024-11-21 23:22:15 -05:00
Erich Gubler
ce1d6e4173 refactor: destructure timestamp writes in command_encoder_create_{compute,render}_pass 2024-11-21 23:22:15 -05:00
Erich Gubler
b17c30338d fix(core): validate TIMESTAMP_QUERY feature before other query set validation in pass creation 2024-11-21 23:22:15 -05:00
Xiaopeng Li
5ca92bf984
Fix leaks of WeakVec (#6576) 2024-11-21 10:47:05 +01: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
Teodor Tanasoaia
1abf3fe90e
remove unused enum variants (#6550) 2024-11-15 14:25:18 +01: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