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

yakui-wgpu: add mipmap filtering for custom textures #138

Merged

Conversation

Uriopass
Copy link
Contributor

@Uriopass Uriopass commented Jan 17, 2024

The user can provide custom textures that have been properly mipmapped.
So we allow nice trilinear filtering

@Uriopass Uriopass requested a review from LPGhatguy as a code owner January 17, 2024 19:09
@Uriopass
Copy link
Contributor Author

Could also be nice to simply pass one's own sampler

Comment on lines +37 to +44
(Nearest, Nearest, Nearest) => &self.nearest_nearest_nearest,
(Linear, Linear, Nearest) => &self.linear_linear_nearest,
(Nearest, Linear, Nearest) => &self.nearest_linear_nearest,
(Linear, Nearest, Nearest) => &self.linear_nearest_nearest,
(Nearest, Nearest, Linear) => &self.nearest_nearest_linear,
(Linear, Linear, Linear) => &self.linear_linear_linear,
(Nearest, Linear, Linear) => &self.nearest_linear_linear,
(Linear, Nearest, Linear) => &self.linear_nearest_linear,
Copy link
Member

Choose a reason for hiding this comment

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

This code is very straightforward (and I'm so happy that Rust verifies this for us!) but... man, the combinatorics here are rough. 😅

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Agreed! I chose to follow the original code but this is clearly the limit

Copy link
Member

@LPGhatguy LPGhatguy left a comment

Choose a reason for hiding this comment

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

Straightforward enough fix, LGTM!

I think you're right that it'd be nice for users to be able to provide their own samplers. If we have any other sampler fields that we want to configure (address mode?) it would probably justify that feature so that we don't end up with another axis of combinations in this code.

@LPGhatguy LPGhatguy merged commit 836a695 into SecondHalfGames:main Jan 25, 2024
2 checks passed
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