Skip to content
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

DX12: Surface::configure panics if old TextureView is still alive #6235

Closed
akimakinai opened this issue Sep 8, 2024 · 2 comments
Closed

Comments

@akimakinai
Copy link

akimakinai commented Sep 8, 2024

Description
Documentation for Surface::configure says it will panic if an old SurfaceTexture is still alive, but does not mention TextureView etc. It seems like TextureView referencing old surface also causes panic when resizing surface with Dx12 backend.

Repro steps
Retaining old TextureView returned by SurfaceTexture.texture.create_view() across Surface::configure with Dx12 backend. (It did not reproduce with Vulkan backend on the other hand)

Expected vs observed behavior
Surface::configure should be clarified to panic in this case, or it should not panic. (per bevyengine/bevy#15087 (comment))

Extra materials

These errors are logged when Surface::configure is called under such condition.

2024-09-07T09:31:15.876281Z ERROR wgpu_hal::dx12: ResizeBuffers failed: 0x887A0001    
2024-09-07T09:31:15.876492Z ERROR wgpu_core::device::global: surface configuration failed: window is in use
thread 'Compute Task Pool (2)' panicked at E:\.cargo\registry\src\index.crates.io-6f17d22bba15001f\wgpu-22.1.0\src\backend\wgpu_core.rs:786:18:
Error in Surface::configure: Validation Error

Caused by:
  Invalid surface

stack backtrace:
   0: std::panicking::begin_panic_handler
             at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library\std\src\panicking.rs:665
   1: core::panicking::panic_fmt
             at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library\core\src\panicking.rs:74
   2: wgpu::backend::wgpu_core::ContextWgpuCore::handle_error_fatal<enum2$<wgpu_core::present::ConfigureSurfaceError> >
             at E:\.cargo\registry\src\index.crates.io-6f17d22bba15001f\wgpu-22.1.0\src\backend\wgpu_core.rs:317
   3: wgpu::backend::wgpu_core::impl$7::surface_configure
             at E:\.cargo\registry\src\index.crates.io-6f17d22bba15001f\wgpu-22.1.0\src\backend\wgpu_core.rs:786
   4: wgpu::context::impl$5::surface_configure<wgpu::backend::wgpu_core::ContextWgpuCore>
             at E:\.cargo\registry\src\index.crates.io-6f17d22bba15001f\wgpu-22.1.0\src\context.rs:2169
   5: wgpu::Surface::configure
             at E:\.cargo\registry\src\index.crates.io-6f17d22bba15001f\wgpu-22.1.0\src\lib.rs:5658
   6: bevy_render::renderer::render_device::RenderDevice::configure_surface
             at .\crates\bevy_render\src\renderer\render_device.rs:197
      ...

Platform
Information about your OS, version of wgpu, your tech stack, etc.

AdapterInfo { name: "NVIDIA GeForce RTX 3060 Ti", vendor: 4318, device: 9353, device_type: DiscreteGpu, driver: "32.0.15.5599", driver_info: "", backend: Dx12 }
wgpu 22.1.0
Using wgpu via bevy.

@cwfitzgerald
Copy link
Member

This is basically intended, and the only real thing is that we should be validating against this in wgpu-core.

@akimakinai
Copy link
Author

Thank you. In surface_configure I see there's already a todo referencing #4105, so closing as duplicate.

@akimakinai akimakinai closed this as not planned Won't fix, can't repro, duplicate, stale Sep 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

No branches or pull requests

2 participants