Commit Graph
71 Commits
Author SHA1 Message Date
teoxoy 425526828f introduce DeviceTextureTracker which holds weak references to textures 2024-07-09 10:48:52 +02:00
teoxoy e26d2d7763 move command buffer resolving in Global's methods 2024-07-03 15:01:41 +02:00
teoxoy 4df5474c9c remove MissingCopyDstUsageFlag error variants 2024-07-02 18:06:19 +02:00
teoxoy ae7da8f669 introduce Labeled trait 2024-07-02 18:06:19 +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 a979d2ed46 simplify BufferTracker.set_single's return type 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 edc2cd9615 introduce Device.check_is_valid 2024-06-19 14:05:18 +02:00
teoxoy ce716adb5e improve device mismatch errors 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
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
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
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
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
John-John Tedro 950d765a4d Remove G parameter in Global<G> and generic IdentityHandlerFactory (#5159) 2024-01-29 15:37:57 +01:00
Nicolas Silva 8358868526 Propagate errors when openning/closing a command encoder (#4999) 2024-01-06 10:14:38 +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
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
Xiaopeng LiandConnor Fitzgerald a6503e59c9 Support nv12 texture format (#4573)
Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
2023-11-28 16:11:26 +00: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 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
6e21f7a929 Arcanization of wgpu core resources (#3626)
Arcanization of wgpu_core resources

---------

Co-authored-by: Elabajaba <Elabajaba@users.noreply.github.com>
Co-authored-by: Niklas Korz <niklas@niklaskorz.de>
Co-authored-by: grovesNL <josh@joshgroves.com>
Co-authored-by: Jim Blandy <jimb@red-bean.com>
Co-authored-by: Mauro Gentile <Mauro.Gentile@ubisoft.com>
Co-authored-by: Sludge <96552222+SludgePhD@users.noreply.github.com>
2023-11-20 08:41:52 +01:00
Andreas ReichandTeodor Tanasoaia f7420511d0 rename/deprecate block_size -> block_copy_size, improve docs (#4647)
Co-authored-by: Teodor Tanasoaia <28601907+teoxoy@users.noreply.github.com>
2023-11-13 19:04:35 +00:00
Nicolas Silva 9a76c483da Add trace level logging to most API entry points (#4183)
* Add trace level logging to most API entry points

* Add a changelog entry
2023-09-28 18:29:44 +02:00
Brad Werth 57f8757fad Add device destroy method (#4163)
Plus tests that ensure that an invalid device behaves correctly.
Mostly a stub implementation otherwise.
2023-09-27 14:34:23 +02:00
Connor Fitzgerald d11d2f96dc Fix Occlusion Queries on Mac (#4001) 2023-08-02 19:10:21 -04:00
3305e88d63 feature: Timestamp queries (#3636)
Co-authored-by: Andreas Reich <r_andreas2@web.de>
Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
Co-authored-by: Connor Fitzgerald <connor@modyfi.io>
2023-08-02 18:04:24 -04:00
Jim Blandy 4d1fbeb753 wgpu-core: Move storage code to new storage module. 2023-05-24 09:54:03 -07:00
Jim Blandy 29914b308f wgpu-core: Move identity code to new identity module. 2023-05-24 09:54:03 -07:00
Jim Blandy 13bd3eea55 wgpu-core: Move HalAPI to new hal_api module. 2023-05-24 09:54:03 -07:00
Jim Blandy f00e6b70ea wgpu-core: Move Global to new global module. 2023-05-24 09:54:03 -07:00
Connor FitzgeraldandConnor Fitzgerald 51bf95bbd6 Make wgpu-core errors non-exhaustive (#3652)
Co-authored-by: Connor Fitzgerald <connor@modyfi.io>
2023-04-07 19:18:29 +02:00
Teodor TanasoaiaandConnor Fitzgerald 6918cf33d4 [metal] Fix metal erroring on an array_stride of 0 (#3538)
Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
2023-04-05 22:40:15 +00:00
Teodor Tanasoaia cf40e64b16 Change type of bytes_per_row and rows_per_image (#3529) 2023-03-06 16:44:36 -05:00
Connor Fitzgerald db3be88f90 Uppercase all error strings 2023-03-03 11:33:20 -05:00
Teodor Tanasoaia c51edd36fd Support stencil-only views and copying to/from combined depth-stencil textures (#3436) 2023-02-15 16:20:22 -05:00
Teodor Tanasoaia 41de797c74 Change type of mip_level_count and array_layer_count (members of TextureViewDescriptor and ImageSubresourceRange) from Option<NonZeroU32> to Option<u32> (#3445)
Clean up duplicated code related to texture layers/mips.
2023-02-03 15:03:34 +01:00
Teodor Tanasoaia 964c94a02d Update TextureView validation (#3410)
* update TextureView validation

* add changelog entry

* remove call to clone

* dereference instead
2023-01-24 12:02:16 +01:00
Jinlei Li 0849e78600 Add view_formats in TextureDescriptor (#3237)
Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
Co-authored-by: crowlkats <crowlkats@toaxl.com>
Closes https://github.com/gfx-rs/wgpu/issues/3030
2023-01-18 16:03:56 -05:00
Nicolas SilvaandConnor Fitzgerald e90aacea96 Validate texture copy ranges earlier to prevent integer overflow (#3090)
Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
2022-12-01 01:20:48 +00:00
Jim Blandy 215884184b Reformat comments in wgpu-core. (#3102) 2022-10-13 18:34:44 +00:00
Jinlei Li 61796b1d59 Relax render pass color_attachments validation (#2778)
* Make the color attachments `Option`-al in render pipelines, render passes, and render bundles

* vk:  `Option`-al color attachments support

* dx12: sparse color_attachments support

* Only non-hole attachments is supported on wasm target and gl backend

* deno_webgpu: `Option`-al color attachments support

* Follow all suggestions
2022-06-27 16:10:18 -07:00
Connor Fitzgerald 9114283707 Tracking Optimization and Rewrite (#2662)
* Texture state full is dead code

* temp

* temp2 - next is lifetime only

* temp3 - all trackers in place

* temp4 - continue muddling along

* temp5 - doodle doodle

* temp6 - continuous progress is continuous

* temp7 - pro-gress

* temp8 - Add refcounts to trackers

* temp9 - Soundness, generics, refcounts, and epochs

* temp10 - Compiling?!1?!1?!1

* temp11 - Add bind group state optimization

* temp12 - Safety and adding size setting

* temp13 - unsafe

* temp14 - Abstract all the state transitions

* temp15 - It verks! kinda...

* temp16 - it more verks!

* temp17 - debugging and unit tests

* temp18 - fixing unfixed things

* temp19 - hmmm

* temp20 - curious about line deltas

* temp21 - working texture trackers

* temp22 - write merge/update/barrier for buffers

* temp23 - cleanup and buffers

* temp24 - clippy cleanup

* temp25 - Add inline markers on buffer functions

* temp26 - Fix buffer trackers

* temp27 - fixed texture insert to handle both sides

* temp28 - document tracker and usages

* temp29 - document track/mod.rs

* temp30 - convert STORAGE_WRITE to STORAGE_READ_WRITE

* temp31 - Add some debug asserts to make sure we can't insert invalid states

* temp32 - clippy is opinionated sometimes

* temp33 - renaming and documentation

* temp34 - logging
2022-05-24 11:36:13 -04:00