mirror of
https://github.com/storytold/wgpu.git
synced 2026-11-20 06:21:13 +01:00
412: Another big tracking refactor r=later a=kvark Fixes #409 Note: there is way more code that had to be thrown out in the process of this PR than there is in the PR itself. Also fixes [this comment](https://github.com/gfx-rs/wgpu/blob/04e17b3f4fe44d816cebeadc0e89bf588cfefe70/wgpu-core/src/track/texture.rs#L29): > //TODO: make this less awkward! ## Logic Instead of having a run-time per-operation control over what state is being used for stitching (with `Stitch` enum), we are now deriving this automatically on a per-subresource level. Whenever we are detecting a transition for a sub-resource, and we know there wasn't any "first" state associated with it in the current tracker, we are saving this "first" state. Unlike previous code, where it was confusing what of `Unit` fields (`init`, `last`) are valid, now `first` is `Option<>`, so we know we should be using it if it's there. This allows us to have this hybrid tracking state of a render pass, where all resources are immutable (and their usage is extended), except for the output attachments. This, together with a whole lot of refactoring, gets us #409. I'm actually quite happy with the tracking code now. It's finally taking shape we aren't afraid to tell others about :) Note: this was tested on wgpu-rs examples and vange-rs. Co-authored-by: Dzmitry Malyshau <kvarkus@gmail.com>