* Remove generic parameter in compat::Manager.
The code is specific to bind group layout ids and the generic parameter gets in the way.
* Add a test.
The test actually covers wgpu's configuration where deduplication does not require the indirection rather than the new code. I used it to debug the new code with the configuration hard-coded. It's tedious to add a test to cover dedpuplication of bind group layouts for users of wgpu_core to provide their IDs, we can rely on the CTS which has test for that.
* Implement bind group layout deduplication for all configurations
Currently wgpu-core implement bind group layout deduplication only when it creates its own resource IDs. In other words it works for wgpu but not in Firefox.
This PR bridges the gap by allowing an optional indirection in bind group layouts: each BGL may store an ID referring to its "deduplicated" BGL.
When referring to a BGL the rest of the code must make sure to follow the indirection. The exception is command buffer processing which is considered hot code and where we first validate against the provided BGL ID and only follow the indirection if the initial check failed.
The main pain point with this approach is the various places where wgpu-core manually updates reference counts: we have to be careful about following the indirection to track the right BGL.
* Avoid making decisions based on the size of some generic type.
This change is to help with an attempt to allow the Context type in wgpu to be swappable at runtime. In order to do that, the functions provided by Context and it's associated types need to be object safe. Instead of passing a impl trait that combines both HasRawWindowHandle and HasRawDisplayHandle, we seperate the types into their RawDisplayHandle and RawWindowHandle parts internally to reduce some of the hal implementation code mess.
Since `wgpu-core`'s public functions are supposed to validate their
parameters, the internal `track` module skips many of Rust's usual
run-time checks in release builds. However, some `wgpu-core` users are
happy to pay the performance cost in exchange for more safety. The
`"strict_asserts"` feature causes `wgpu_core` to perform the same
checks in release builds as it does in debug builds.
* 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
* Implement submission indexes
* Write some unit tests for poll
* Update wgpu/src/lib.rs
Co-authored-by: Jim Blandy <jimb@red-bean.com>
* Unify Maintain in both wgc and wgpu
Co-authored-by: Jim Blandy <jimb@red-bean.com>
The `min_index` parameter has no useful effect. Because the range 0..n is pushed
on the free list, index values less than `min_index` do get allocated.
Document `IdentityManager` and `TypedId`.
* Renamed clear_buffer to fill_buffer (keeping up with spec)
* fill_buffer does not require CLEAR_BUFFER feature
* Changed ClearBuffer to FillBuffer for `trace` feature
* Renamed clearBuffer for web backend
* Added tests for texture zero init
sadly, they are typically passing even if texture zero init isn't doing its job
However, they form nice isolated examples for testing out texture initialization
It could be possible to dirty texture memory prior to ensure zero init did the job
* texture init tracker
* tracking texture init requirements for bind group, transfer and rendertarget
* texture clears for texture init
* queue submit
* write_texture
* Enforce presence of either render target or copy_dst flag
* clear render targets also with using buffer copies
enforce COPY_DST usage now on all textures
* adjust ImageSubresourceRange.layer_range calculation for 3D textures
init_tracker has now a `discard` function to get single data points back to uninitialized
use new standardized partition_point function
* track init state for discarded textures from renderpasses
missing:
* init on the fly if discarded is found within command buffer
* handle discarding only stencil or only depth
* added tests for zero init after discard
* tracking discarded surfaces now in separate struct, piping all inits through utility function
allows to resolve discard/init_action interactions
* Move various memory init code to separate mod
CommandBufferTextureMemoryActions is now fully encapsulated
* implemented discard init fixups for everything but renderpass
* render passes also cause now discard fixups
* fixup_discarded_surfaces takes now an iterator instead of Drain
* Add memory init test for discarding depth targets
* handle divergently discarded depth/stencil target
* comment & clippy fixes
* fix collect_zero_buffer_copies_for_clear_texture yielding block breaking copies
* [pr feedback] minor cleanup in zero_init_texture_after_discard, `use` hygenie
* [pr feedback] fix bug in ImageSubresourceRange range utils
* [pr feedback] fix texture tracker check, bundle transition_texture on init, cleanups
* Implemented drop for InitTrackerDrain
* remove incorrect comment about extents in add_pass_texture_init_actions
* Fix unit test & clippy issues in init_tracker