Skip to content

Conversation

@natepiano
Copy link
Contributor

@natepiano natepiano commented Dec 23, 2025

Objective

On systems without a GPU (like VMs using Microsoft Basic Render Driver), resizing windows or switching to fullscreen crashes with a "surface is in use" error.

Fixes #22225

Solution

The issue was introduced in #21866 which removed cleanup code that hardware GPUs don't need, but software renderers require.

This fix restores that cleanup behavior specifically for software renderers (CPU device type), ensuring texture views are released before the window surface is reconfigured.

Changes

  • In clear_view_attachments: Drop swap_chain_texture_view for windows with pending size/mode changes on CPU device types (runs before create_surfaces)
  • In render_system: Remove ViewTarget components on CPU device types to release cloned texture views

Note: I'm not deeply familiar with bevy_render internals. If this approach or style isn't satisfactory, feel free to use this as an example of what can work and suggest changes. Happy to adapt!

Testing

Tested on Windows 11 VM with Microsoft Basic Render Driver (DX12 backend, CPU device type):

AdapterInfo { name: "Microsoft Basic Render Driver", vendor: 5140, device: 140, device_type: Cpu, driver: "10.0.26100.7309", driver_info: "", backend: Dx12 }

Test cases:

  1. Minimal reproduction app (bevy_resize_repro) - simple App::new().add_plugins(DefaultPlugins).run()
  2. Full integration with bevy_window_manager - window resize, fullscreen switching, borderless fullscreen all working

Platforms tested:

  • ✅ Windows 11 VM (software renderer)
  • ✅ macOS (hardware GPU)
  • ✅ Linux (Asahi Linux on Apple Silicon)

Known limitation: The tests/window/resizing.rs example (which resizes every frame down to 1x1) still crashes on software renderers, but this is a pre-existing issue that occurred in 0.17.3 as well.

Happy to do additional testing if needed!


On systems without a GPU (like VMs using Microsoft Basic Render Driver),
resizing windows or switching to fullscreen would crash with a "surface
is in use" error.

The issue was introduced in PR bevyengine#21866 which removed cleanup code that
hardware GPUs don't need, but software renderers require.

This fix restores that cleanup behavior specifically for software
renderers (CPU device type), ensuring texture views are released before
the window surface is reconfigured.

Fixes bevyengine#22225
@IQuick143 IQuick143 added C-Bug An unexpected or incorrect behavior A-Windowing Platform-agnostic interface layer to run your app in P-Crash A sudden unexpected crash D-Straightforward Simple bug fixes and API improvements, docs, test and examples S-Needs-Review Needs reviewer attention (from anyone!) to move forward P-Regression Functionality that used to work but no longer does. Add a test for this! labels Dec 23, 2025
@IQuick143 IQuick143 added this to the 0.18 milestone Dec 23, 2025
@IceSentry IceSentry requested a review from tychedelia December 24, 2025 01:24
@tychedelia
Copy link
Member

Thanks for catching this! We really appreciate user testing and your willingness to dig into fixing this. I've opened an alternative implementation that is a little less code here: #22254.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-Windowing Platform-agnostic interface layer to run your app in C-Bug An unexpected or incorrect behavior D-Straightforward Simple bug fixes and API improvements, docs, test and examples P-Crash A sudden unexpected crash P-Regression Functionality that used to work but no longer does. Add a test for this! S-Needs-Review Needs reviewer attention (from anyone!) to move forward

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Window resize crashes on DX12 software renderer in 0.18.0-rc.1 (regression from 0.17.3)

3 participants