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 16->32 colors with CLUT start pos #16358

Merged
merged 3 commits into from
Nov 8, 2022

Conversation

unknownbrackets
Copy link
Collaborator

@unknownbrackets unknownbrackets commented Nov 8, 2022

When converting a texture from 16-bit to 32-bit (i.e. to save textures or for a GPU that lacks 16-bit texture support), we were expanding the CLUT to a buffer, and then using that directly, for efficiency.

This expansion failed to consider the start pos, so had uninitialized values or previous CLUT values in it. Additionally, the buffer was not large enough for large start pos values, which could cause invalid accesses or other bad things.

This expands the buffer, aligns it (so color conv uses SIMD - it was usually at +4 before), and expands the portion of it pointed to by the start index (and shift.)

Fixes #16331, fixes #12188 (finally - must've been a device without 16-bit format support.)

-[Unknown]

We shouldn't need larger than 2 KB CLUT buffers, since it's actually only
1 KB.  We have a hack that allows 2 KB for separate mip map levels.
@unknownbrackets unknownbrackets added the GE emulation Backend-independent GPU issues label Nov 8, 2022
@unknownbrackets unknownbrackets added this to the v1.14.0 milestone Nov 8, 2022
@hrydgard
Copy link
Owner

hrydgard commented Nov 8, 2022

Ooh, nice catch!

@hrydgard hrydgard merged commit 094666e into hrydgard:master Nov 8, 2022
@ghost
Copy link

ghost commented Nov 8, 2022

This is also fixes #16335

@unknownbrackets unknownbrackets deleted the tex-expand-16 branch November 8, 2022 13:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
GE emulation Backend-independent GPU issues
Projects
None yet
2 participants