mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-10-01 14:58:14 +00:00
Vulkan: Avoid checking texture alpha after scale.
Since we're decoding to mapped memory, we don't want to read from it if possible, especially not a large amount of data like an upscaled texture.
This commit is contained in:
1 parent
d4c345c870
commit
fb65c7b87b
1 file changed
+12
-3
@@ -768,6 +768,15 @@ void TextureCacheVulkan::LoadTextureLevel(TexCacheEntry &entry, uint8_t *writePt
|
||||
gpuStats.numTexturesDecoded++;
|
||||
|
||||
if (scaleFactor > 1) {
|
||||
// Check alpha before scaling: it's slower to check it from writePtr.
|
||||
TexCacheEntry::Status alphaStatus = CheckAlpha(pixelData, dstFmt, decPitch / bpp, w, h);
|
||||
if (alphaStatus != TexCacheEntry::STATUS_ALPHA_SIMPLE) {
|
||||
entry.SetAlphaStatus(alphaStatus, level);
|
||||
} else {
|
||||
// Scaling may invent alpha values from SIMPLE. Let's play it safe.
|
||||
entry.SetAlphaStatus(TexCacheEntry::STATUS_ALPHA_UNKNOWN);
|
||||
}
|
||||
|
||||
u32 fmt = dstFmt;
|
||||
scaler.ScaleAlways((u32 *)writePtr, pixelData, fmt, w, h, scaleFactor);
|
||||
pixelData = (u32 *)writePtr;
|
||||
@@ -786,9 +795,9 @@ void TextureCacheVulkan::LoadTextureLevel(TexCacheEntry &entry, uint8_t *writePt
|
||||
}
|
||||
decPitch = rowPitch;
|
||||
}
|
||||
}
|
||||
|
||||
if ((entry.status & TexCacheEntry::STATUS_CHANGE_FREQUENT) == 0) {
|
||||
} else if ((entry.status & TexCacheEntry::STATUS_CHANGE_FREQUENT) == 0) {
|
||||
// TODO: Since we decode directly, this can be more expensive (maybe not on mobile?)
|
||||
// This does allow us to skip alpha testing, though.
|
||||
TexCacheEntry::Status alphaStatus = CheckAlpha(pixelData, dstFmt, decPitch / bpp, w, h);
|
||||
entry.SetAlphaStatus(alphaStatus, level);
|
||||
} else {
|
||||
|
||||
Reference in new issue
Block a user