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

GS: UV rounding method to grab enough of texture #12131

Closed
wants to merge 1 commit into from

Conversation

TJnotJT
Copy link

@TJnotJT TJnotJT commented Dec 28, 2024

EDIT: This is still broken except in special cases

Description of Changes

This is in response to the issue #12100. The problem was that for certain draws, not enough of a texture was being read from memory, because the edge texels for bilinear filter was not being accounted for properly (which can be +/-1 more than for without the bilinear filter). To fix the issue, the code calculates the UV coordinates at the minimum/maximum pixel centers in the draw's bounding box, then computes the UV coordinates for the bilinear filter, then uses these to specify the area of the texture that needs to be read. I believe this is most useful when the draw is something that looks like a flat rectangle (either a sprite or triangles shaped like a rectangle, with constant depth). I'm not sure what would happen for 3d polys.

Rationale behind Changes

The previous method for determining the proper bounds of the texture to read from memory used a heuristic that depended on ratio that the texture was being expanded/shrunk from texel space to pixel space. However, there are cases where this code cannot properly detect the bound of the texture being used when doing bilinear filtering.

Suggested Testing Steps

I would recommend running the GS dump in the thread #12100 and running the game itself. If there are other games that have similar issues, it would be good to check those too.

PS. Any feedback/suggestions from devs/testers with more experience on these issues or help testing this is much appreciated. Currently the code is still rough, though I would plan to clean it up if it was accepted.

@github-actions github-actions bot added the GS label Dec 28, 2024
@TJnotJT TJnotJT force-pushed the uv-rounding-hack-clean branch from bd80cdf to 312095d Compare December 28, 2024 17:10
@TJnotJT TJnotJT changed the title UV rounding method to grab enough of texture GS: UV rounding method to grab enough of texture Dec 28, 2024
@TJnotJT TJnotJT force-pushed the uv-rounding-hack-clean branch 4 times, most recently from cd1de8a to 6f79d62 Compare December 29, 2024 01:41
@TJnotJT TJnotJT force-pushed the uv-rounding-hack-clean branch 3 times, most recently from 3b56472 to 9db06fb Compare December 29, 2024 03:45
@TheLastRar
Copy link
Contributor

Why the changes to the project filters?

@TJnotJT
Copy link
Author

TJnotJT commented Dec 31, 2024

Why the changes to the project filters?

My mistake, this was unintentional. I might have done something in VStudio.

Anyway, this PR is currently broken and I am working on something completely different, so closing for now.

@TJnotJT TJnotJT closed this Dec 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants