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

TexCache: Fix texture alignment in GLES #11374

Merged
merged 3 commits into from
Sep 9, 2018

Conversation

unknownbrackets
Copy link
Collaborator

This fixes the OpenGL and Direct3D 11 parts of #10629, but not the Vulkan and Direct3D 9 parts.

For textures that were <= 4 pixels wide (not that common), we had a couple invalid assumptions in the GLES path. First, we left row alignment at 4, which would be an issue for 1 pixel wide 16-bit textures (definitely an edge case, though.) More importantly, we unswizzled assuming the pitch was aligned to 16 bytes.

While I was there, I fixed Direct3D 11 using bufw (if larger than w) for pitch. It doesn't need to, but aligning to 16 is ideal (which this was implicitly doing, since bufw is always aligned to 16 bytes.)

I decided to keep it in this same pull, but the color test change is kinda separate. Basically, x.rgb == y.rgb was not working, but x.r == y.r && x.g == y.g && x.b == y.b was. A shame.

-[Unknown]

We must align to 4 bytes, and we aren't always aligned to 16 anymore, so
we must check when dealing with swizzle.
Not working correctly together.  See hrydgard#10629.
Just so we don't have surprises later if we implement masking.
@unknownbrackets unknownbrackets added this to the v1.7.0 milestone Sep 9, 2018
@hrydgard
Copy link
Owner

hrydgard commented Sep 9, 2018

Great catches, including the color test!

@hrydgard hrydgard merged commit 7a5ec71 into hrydgard:master Sep 9, 2018
@unknownbrackets unknownbrackets deleted the texcache branch September 9, 2018 13:55
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