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

Add texture scale mode #1444

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Add texture scale mode #1444

wants to merge 3 commits into from

Conversation

jagprog5
Copy link

@jagprog5 jagprog5 commented Dec 3, 2024

otherwise texture copy to a smaller destination can look quite bad

@jagprog5
Copy link
Author

jagprog5 commented Jan 8, 2025

@Cobrand

type Error = ();

fn try_from(n: u32) -> Result<Self, Self::Error> {
Ok(match unsafe { transmute(n) } {
Copy link
Member

Choose a reason for hiding this comment

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

Huge no-no, it will crash badly if n is not a safe value, even though the function is a try_from, which should simply output a Err on invalid value.

Read the implications of transmute with enums and fix this PR, this is not the only time you're using it, and I don't think you should be using it even once.

Copy link
Author

@jagprog5 jagprog5 Jan 10, 2025

Choose a reason for hiding this comment

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

I'm happy to make this change. Quick question first, should these existing instances be changed as well? My intent was to follow the existing style.

Thanks

Copy link
Member

Choose a reason for hiding this comment

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

I just checked on the playground, they are all big mistakes and should be fixed ASAP:

https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=1f798ba39aef506228d8ecfeeda9b759

Try in debug and release modes, it's wildly different behaviors, and never what's expected

Copy link
Author

@jagprog5 jagprog5 Jan 10, 2025

Choose a reason for hiding this comment

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

Addressed in: aa858db

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.

2 participants