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

Fixed incorrect behaviour of headless_renderer depending on image dimensions #13388

Conversation

bugsweeper
Copy link
Contributor

Objective

Solution

  • If the image became wider when copying from the texture to the buffer, then the data is reduced to its original size when copying from the buffer to the image.

Testing

  • Ran example with 1919x1080 resolution
    000

@alice-i-cecile alice-i-cecile added C-Bug An unexpected or incorrect behavior A-Rendering Drawing game state to the screen C-Examples An addition or correction to our examples labels May 16, 2024
Copy link
Member

@alice-i-cecile alice-i-cecile left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix seems fine, but I think it would be helpful to include the context about why we're doing this in the source itself.

bugsweeper and others added 2 commits May 16, 2024 14:35
Co-authored-by: Alice Cecile <alice.i.cecile@gmail.com>
@bugsweeper bugsweeper force-pushed the undepend_headless_renderer_example_from_image_dimensions branch from 423118e to 7bff4ec Compare May 16, 2024 13:03
Copy link
Member

@mockersf mockersf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It doesn't work.

If I ask for an image of 1080x1080:

thread '<unnamed>' panicked at examples/app/headless_renderer.rs:517:49:
range end index 4320 out of range for slice of length 2560
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Encountered a panic in system `headless_renderer::update`!
Encountered a panic in system `bevy_app::main_schedule::Main::run_main`!

@bugsweeper
Copy link
Contributor Author

bugsweeper commented May 17, 2024

Looks like problem of 1080x1080 was in last row, which somehow is reminder of division by aligned_row_bytes. I cut off remaining rows, this reinsurance works well alone, but i will keep them both. Literaly buffer has length 5529600, aligned row has length 4352, it turns out 1270 full rows (not 1080!) and 2560 bytes in partial row

@bugsweeper bugsweeper requested a review from mockersf May 17, 2024 07:43
@bugsweeper
Copy link
Contributor Author

@mockersf May I ask you for review?

@mockersf mockersf added the S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it label May 19, 2024
@mockersf mockersf added this pull request to the merge queue May 19, 2024
Merged via the queue into bevyengine:main with commit 2aed777 May 19, 2024
28 checks passed
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 C-Examples An addition or correction to our examples S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Skewed output when changing resolution of new headless_renderer example
3 participants