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

fix cluster tile size calculation #4146

Closed
wants to merge 1 commit into from

Conversation

HackerFoo
Copy link
Contributor

Objective

Fixes #4127 & #3596

Solution

  1. Calculate how many tiles we can use per Z slice: n_tiles_xy
  2. Then, estimate the size of each tile in pixels: px_per_tile
  3. Number of tiles across, such that it's less that the screen width: n_tiles_x
  4. Number of tiles down, such the the total is less that n_tiles_xy: n_tiles_y
  5. Then, divide up the screen into tiles to get the actual dimensions of each tile, rounding up, so that we can cover the whole screen.

This, along with the new calculation in update(), should never fail the assertion.

Remaining tasks

  • Add a unit test, either exhaustive up to 4k (12 + 12 bits = ~16M, should be pretty quick), or use proptest.

@github-actions github-actions bot added the S-Needs-Triage This issue needs to be labelled label Mar 8, 2022
@alice-i-cecile
Copy link
Member

I love property based testing, and would be happy to see it used in our code base.

@alice-i-cecile alice-i-cecile added A-Rendering Drawing game state to the screen C-Bug An unexpected or incorrect behavior and removed S-Needs-Triage This issue needs to be labelled labels Mar 8, 2022
@robtfm
Copy link
Contributor

robtfm commented Mar 8, 2022

i've put in a PR (#4148) covering this ground on top of the latest updates. i should have commented on the issues sooner to save your time, sorry.

@HackerFoo
Copy link
Contributor Author

i've put in a PR (#4148) covering this ground on top of the latest updates. i should have commented on the issues sooner to save your time, sorry.

No problem. I wrote this a while ago, so the only time lost was writing the description.

@HackerFoo HackerFoo closed this Mar 8, 2022
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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

render_to_texture example crashes with other texture sizes
3 participants