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

examples/ui/relative_cursor_position.rs crashes if window is shrunk #15661

Open
shiki-saiki opened this issue Oct 5, 2024 · 5 comments · May be fixed by #16115
Open

examples/ui/relative_cursor_position.rs crashes if window is shrunk #15661

shiki-saiki opened this issue Oct 5, 2024 · 5 comments · May be fixed by #16115
Assignees
Labels
A-UI Graphical user interfaces, styles, layouts, and widgets A-Windowing Platform-agnostic interface layer to run your app in C-Bug An unexpected or incorrect behavior S-Ready-For-Implementation This issue is ready for an implementation PR. Go for it!

Comments

@shiki-saiki
Copy link

Bevy version

v0.14.2

[Optional] Relevant system information

OS: Windows 11

AdapterInfo { name: "AMD Radeon RX 6600", vendor: 4098, device: 29695, device_type: DiscreteGpu, driver: "AMD proprietary driver", driver_info: "23.10.2 (AMD proprietary shader compiler)", backend: Vulkan }

What you did

Run the example relative_cursor_position.

What went wrong

If the window is shrunk small enough, it crashes.

Additional information

ERROR wgpu::backend::wgpu_core: Handling wgpu errors as fatal by default    
thread '<unnamed>' panicked at C:\dev\rust\.cargo\registry\src\index.crates.io-6f17d22bba15001f\wgpu-0.20.1\src\backend\wgpu_core.rs:2996:5:
wgpu error: Validation Error

Caused by:
    In a RenderPass
      note: encoder = `<CommandBuffer-(104, 1, Vulkan)>`
    In a set_viewport command
    Viewport has invalid rect Rect { x: 200.0, y: 100.0, w: 600.0, h: 600.0 }; origin and/or size is less than or equal to 0, and/or is not contained in the render target (1280, 625, 1)
@shiki-saiki shiki-saiki added C-Bug An unexpected or incorrect behavior S-Needs-Triage This issue needs to be labelled labels Oct 5, 2024
@LiamGallagher737 LiamGallagher737 added A-UI Graphical user interfaces, styles, layouts, and widgets A-Windowing Platform-agnostic interface layer to run your app in and removed S-Needs-Triage This issue needs to be labelled labels Oct 7, 2024
@BenjaminBrienen BenjaminBrienen added the S-Needs-Investigation This issue requires detective work to figure out what's going wrong label Oct 26, 2024
@BenjaminBrienen
Copy link
Contributor

     Running `target\debug\examples\relative_cursor_position.exe`
2024-10-26T23:13:21.207246Z  INFO bevy_diagnostic::system_information_diagnostics_plugin::internal: SystemInfo { os: "Windows 11 Pro", kernel: "22631", cpu: "12th Gen Intel(R) Core(TM) i7-12700H", core_count: "14", memory: "31.7 GiB" }
2024-10-26T23:13:21.587930Z  INFO bevy_render::renderer: AdapterInfo { name: "NVIDIA GeForce RTX 2060", vendor: 4318, device: 7944, device_type: DiscreteGpu, driver: "NVIDIA", driver_info: "561.09", backend: Vulkan }
2024-10-26T23:13:22.657612Z  INFO bevy_winit::system: Creating new window "App" (0v1#4294967296)
2024-10-26T23:13:54.944161Z ERROR wgpu::backend::wgpu_core: Handling wgpu errors as fatal by default    
thread '<unnamed>' panicked at C:\Users\BenjaminBrienen\.cargo\registry\src\index.crates.io-6f17d22bba15001f\wgpu-22.1.0\src\backend\wgpu_core.rs:3411:5:
wgpu error: Validation Error

Caused by:
  In RenderPass::end
    In a set_viewport command
      Viewport has invalid rect Rect { x: 200.0, y: 100.0, w: 425.0, h: 294.0 }; origin and/or size is less than or equal to 0, and/or is not contained in the render target (425, 294, 1)     


note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Encountered a panic in system `bevy_render::renderer::render_system`!

@BenjaminBrienen
Copy link
Contributor

This happens even if the window is made slightly smaller

     Running `target\debug\examples\relative_cursor_position.exe`
2024-10-26T23:15:46.235519Z  INFO bevy_diagnostic::system_information_diagnostics_plugin::internal: SystemInfo { os: "Windows 11 Pro", kernel: "22631", cpu: "12th Gen Intel(R) Core(TM) i7-12700H", core_count: "14", memory: "31.7 GiB" }
2024-10-26T23:15:46.621190Z  INFO bevy_render::renderer: AdapterInfo { name: "NVIDIA GeForce RTX 2060", vendor: 4318, device: 7944, device_type: DiscreteGpu, driver: "NVIDIA", driver_info: "561.09", backend: Vulkan }
2024-10-26T23:15:47.494352Z  INFO bevy_winit::system: Creating new window "App" (0v1#4294967296)
2024-10-26T23:15:52.683968Z ERROR wgpu::backend::wgpu_core: Handling wgpu errors as fatal by default    
thread '<unnamed>' panicked at C:\Users\BenjaminBrienen\.cargo\registry\src\index.crates.io-6f17d22bba15001f\wgpu-22.1.0\src\backend\wgpu_core.rs:3411:5:
wgpu error: Validation Error

Caused by:
  In RenderPass::end
    In a set_viewport command
      Viewport has invalid rect Rect { x: 200.0, y: 100.0, w: 600.0, h: 600.0 }; origin and/or size is less than or equal to 0, and/or is not contained in the render target (1230, 661, 1)    


note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Encountered a panic in system `bevy_render::renderer::render_system`!

@BenjaminBrienen
Copy link
Contributor

Not fixed with #15988

@BenjaminBrienen BenjaminBrienen self-assigned this Oct 26, 2024
@BenjaminBrienen
Copy link
Contributor

I think the Camera Viewport needs to be updated when the window is resized.

@BenjaminBrienen
Copy link
Contributor

Spawning the Camera2d with a Transform bundle instead allows resizing to work.

    commands.spawn((
        Camera2d,
        Transform::from_xyz(0., 0., 0.).looking_at(Vec3::ZERO, Vec3::Y),
    ));

Image

@BenjaminBrienen BenjaminBrienen added S-Ready-For-Implementation This issue is ready for an implementation PR. Go for it! and removed S-Needs-Investigation This issue requires detective work to figure out what's going wrong labels Oct 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-UI Graphical user interfaces, styles, layouts, and widgets A-Windowing Platform-agnostic interface layer to run your app in C-Bug An unexpected or incorrect behavior S-Ready-For-Implementation This issue is ready for an implementation PR. Go for it!
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants