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

Viewport::default() produces a viewport that always crashes #14355

Closed
SludgePhD opened this issue Jul 16, 2024 · 2 comments · Fixed by #14372
Closed

Viewport::default() produces a viewport that always crashes #14355

SludgePhD opened this issue Jul 16, 2024 · 2 comments · Fixed by #14372
Labels
A-Rendering Drawing game state to the screen C-Bug An unexpected or incorrect behavior S-Ready-For-Implementation This issue is ready for an implementation PR. Go for it!

Comments

@SludgePhD
Copy link
Contributor

Bevy version

0.11

What you did

Set Camera.viewport to Some(Viewport::default()).

(I use ReflectDefault to create values in an editor, so this can't be easily worked around except by remembering not to click the wrong button)

What went wrong

An invalid viewport is returned which promptly causes a wgpu validation error:

wgpu error: Validation Error

Caused by:
    In a RenderPass
      note: encoder = `main_opaque_pass_3d_command_encoder`
    In a set_viewport command
    Viewport has invalid rect Rect { x: 0.0, y: 0.0, w: 0.0, h: 0.0 }; origin and/or size is less than or equal to 0, and/or is not contained in the render target (1664, 936, 1)
@SludgePhD SludgePhD added C-Bug An unexpected or incorrect behavior S-Needs-Triage This issue needs to be labelled labels Jul 16, 2024
@TrialDragon TrialDragon added A-Rendering Drawing game state to the screen S-Needs-Design This issue requires design work to think about how it would best be accomplished and removed S-Needs-Triage This issue needs to be labelled labels Jul 17, 2024
@TrialDragon
Copy link
Member

(Marking as S-Needs-Design since it needs to be figured out what exactly we want to the default to be in this case since the obvious one of zero is erring / invalid).

@SludgePhD
Copy link
Contributor Author

I believe the only viewport valid for all render target sizes is one with size 1x1 and origin (0,0)

@TrialDragon TrialDragon added S-Ready-For-Implementation This issue is ready for an implementation PR. Go for it! and removed S-Needs-Design This issue requires design work to think about how it would best be accomplished labels Jul 17, 2024
github-merge-queue bot pushed a commit that referenced this issue Jul 20, 2024
# Objective

- The current default viewport crashes bevy due to a wgpu validation
error, this PR fixes that
- Fixes #14355

## Solution

- `Viewport::default()` now returns a 1x1 viewport

## Testing

- I modified the `3d_viewport_to_world` example to use
`Viewport::default()`, and it works as expected (only the top-left pixel
is rendered)
mockersf pushed a commit that referenced this issue Aug 2, 2024
# Objective

- The current default viewport crashes bevy due to a wgpu validation
error, this PR fixes that
- Fixes #14355

## Solution

- `Viewport::default()` now returns a 1x1 viewport

## Testing

- I modified the `3d_viewport_to_world` example to use
`Viewport::default()`, and it works as expected (only the top-left pixel
is rendered)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Rendering Drawing game state to the screen 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.

2 participants