-
Notifications
You must be signed in to change notification settings - Fork 935
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Do texture init via clear passes when possible #2307
Conversation
there's apparently some DX12 test failures during tests that I need to look into |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Skimmed to the first half, a lot more to go!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
almost there!
this has mostly implications on the constraints, but also allows a more leaky documentation which makes sense for this non-standard function as there is no other place to look it up
pending inits need to store Stored textures now though, causing more ref count bumping
…_via_buffer_copies
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please take care of CI failures
Running this on https://github.com/niklaskorz/linon/tree/wgpu-0.12 gives me the following error instead of the current "Texture needs to have the COPY_DST flag" (#2309):
full stack trace
|
@niklaskorz looks like this will be addressed by the very PR we are commenting on |
That's what I was hoping :) The error I posted occurs when using this PR as wgpu crate, which is why I thought it relevant for the discussion here. |
@niklaskorz reproed it and looking for a solution, I think I know what to do but looking for a nice way to add a test for this in wgpu. Meanwhile, you can fix/workaround this in your application by passing a clear color to egui in your application:
@kvark please hold on with merging until I have this done as well. Meanwhile, you may want to complain about |
all done in f80a13d . Not pretty: For testing I needed to hijack an existing example so I didn't need to go through all the window creation stuff. Destruction of the new clear target every surface has is in two places and I'm actually not sure why this is ok to do it there (expecting it to be still in use, but neither DX12/Vulkan complain about this even under resize which causes discarded surfaces) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you, LGTM, such grand piece!
* CLEAR_COMMANDS extension is now more of a window into wgpu zero-init this has mostly implications on the constraints, but also allows a more leaky documentation which makes sense for this non-standard function as there is no other place to look it up * clear_texture via renderpasses wip * 3D depth textures are no longer allowed, volumes are always cleared via CPY_DST * cleanup texture's clear_views * rename CLEAR_COMMANDS to CLEAR_TEXTURE * separate clear_texture into reusable & more descriptive parts * texture clear views are now created ahead of time * discarded surface fixup goes through new clear_texture method now * onq ueue texture initialization now goes threw clear_texture pending inits need to store Stored textures now though, causing more ref count bumping * texture init on queue_write_texture now also goes through new clear_texture * transfer functions on commandbuffer use now new texture init route * merge collect_zero_buffer_copies_for_clear_texture into clear_texture_via_buffer_copies * clear functions now take TextureInitRange * Fix clippy lints * command_encoder_clear_texture no longer takes write lock on texture * TextureClearMode encodes now is_color * code cleanup, mostly about `use` * Handle volume textures in clear_texture_via_render_passes properly * texture clear no longer requires id::Stored * init tracking fixes for volumes and init on partial subresource writes * texture creation enforces COPY_DST only if absolutely necessary * unrolled functional chain, reduce unsafe scope size * fix clippy lints * clear_texture test no longer creates 1D textures see gfx-rs#2323 * 3D textures are no longer cleared as render target since this isn't supported on Metal * fix deno building issue, fix formatting * TextureInner::Surface can now be zero initialized
* CLEAR_COMMANDS extension is now more of a window into wgpu zero-init this has mostly implications on the constraints, but also allows a more leaky documentation which makes sense for this non-standard function as there is no other place to look it up * clear_texture via renderpasses wip * 3D depth textures are no longer allowed, volumes are always cleared via CPY_DST * cleanup texture's clear_views * rename CLEAR_COMMANDS to CLEAR_TEXTURE * separate clear_texture into reusable & more descriptive parts * texture clear views are now created ahead of time * discarded surface fixup goes through new clear_texture method now * onq ueue texture initialization now goes threw clear_texture pending inits need to store Stored textures now though, causing more ref count bumping * texture init on queue_write_texture now also goes through new clear_texture * transfer functions on commandbuffer use now new texture init route * merge collect_zero_buffer_copies_for_clear_texture into clear_texture_via_buffer_copies * clear functions now take TextureInitRange * Fix clippy lints * command_encoder_clear_texture no longer takes write lock on texture * TextureClearMode encodes now is_color * code cleanup, mostly about `use` * Handle volume textures in clear_texture_via_render_passes properly * texture clear no longer requires id::Stored * init tracking fixes for volumes and init on partial subresource writes * texture creation enforces COPY_DST only if absolutely necessary * unrolled functional chain, reduce unsafe scope size * fix clippy lints * clear_texture test no longer creates 1D textures see #2323 * 3D textures are no longer cleared as render target since this isn't supported on Metal * fix deno building issue, fix formatting * TextureInner::Surface can now be zero initialized
#2327 is published in wgpu-core-0.12.1 |
# Objective - `Msaa` was disabled in webgl due to a bug in wgpu - Bug has been fixed (gfx-rs/wgpu#2307) and backported (gfx-rs/wgpu#2327), and updates for [`wgpu-core`](https://crates.io/crates/wgpu-core/0.12.1) and [`wgpu-hal`](https://crates.io/crates/wgpu-hal/0.12.1) have been released ## Solution - Remove custom config for `Msaa` in webgl - I also changed two options that were using the arch instead of the `webgl` feature. it shouldn't change much for webgl, but could help if someone wants to target wasm but not webgl2 Co-authored-by: François <[email protected]>
# Objective - `Msaa` was disabled in webgl due to a bug in wgpu - Bug has been fixed (gfx-rs/wgpu#2307) and backported (gfx-rs/wgpu#2327), and updates for [`wgpu-core`](https://crates.io/crates/wgpu-core/0.12.1) and [`wgpu-hal`](https://crates.io/crates/wgpu-hal/0.12.1) have been released ## Solution - Remove custom config for `Msaa` in webgl - I also changed two options that were using the arch instead of the `webgl` feature. it shouldn't change much for webgl, but could help if someone wants to target wasm but not webgl2 Co-authored-by: François <[email protected]>
Connections
Should fix #2149 - haven't confirmed since I don't a repro at hand.
Changes clear extension semantics a bit as discussed on #2174
Description
Previously, render target/depth textures couldn't be initialized at all if they not also were COPY_DST, violating the spec.
Now, we always will use render passes when possible since it's expected to be faster.
All this comes with an overhaul of the texture clearing mechanisms as we tried to optimize things based on the assumption of texture-init == copy zero_buffer:
TextureClearMode
which may bring with it pre-created render views for clearingOther smaller but important things in this PR:
Testing
Tests in tests/clear_texture.rs clear now depth/stencil formats as well (this was not possible previously)
Ran
cargo test
locally (win10)