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 incorrect tile UVs when using atlas feature on AMD hardware #367

Merged
merged 1 commit into from
Dec 18, 2022

Conversation

rparrett
Copy link
Collaborator

@rparrett rparrett commented Dec 18, 2022

Fixes an issue reported by @odecay on discord.

This is specific to AMD hardware and the issue and fix were reproduced by @odecay and @bzm3r. I am unable to reproduce on any of my non-AMD HW.

Here's a changeset on their fork that reproduces the issue:
main...odecay:bevy_ecs_tilemap:main

That example should show something like this:
image
But shows this instead:
image

It seems that there's some sort of floating point imprecision thing going on where var columns ends up as 2 rather than the correct 3 after being cast as u32 / implicitly floored. This messes up the rest of the UV calculations.

It is possible to induce this same visual result on hardware that doesn't exhibit this bug by subtracting 1 from var columns.

@bzm3r
Copy link
Collaborator

bzm3r commented Dec 18, 2022

Big if true! And it is true!

@odecay
Copy link

odecay commented Dec 18, 2022

Can confirm this change fixes the issue for me 👍

@bzm3r bzm3r merged commit e416b48 into StarArawn:main Dec 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants