mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-10-01 14:58:14 +00:00
Vulkan: Correct CheckAlpha on scaled textures.
This commit is contained in:
1 parent
4c94cd764d
commit
f0ed9a9915
1 file changed
+5
-8
@@ -1399,9 +1399,7 @@ void TextureCacheVulkan::LoadTextureLevel(TexCacheEntry &entry, uint8_t *writePt
|
||||
CachedTextureVulkan *tex = entry.vkTex;
|
||||
int w = gstate.getTextureWidth(level);
|
||||
int h = gstate.getTextureHeight(level);
|
||||
u32 *pixelData;
|
||||
int decPitch;
|
||||
int rowBytes;
|
||||
|
||||
{
|
||||
PROFILE_THIS_SCOPE("decodetex");
|
||||
|
||||
@@ -1411,8 +1409,8 @@ void TextureCacheVulkan::LoadTextureLevel(TexCacheEntry &entry, uint8_t *writePt
|
||||
int bufw = GetTextureBufw(level, texaddr, tfmt);
|
||||
int bpp = dstFmt == VULKAN_8888_FORMAT ? 4 : 2;
|
||||
|
||||
pixelData = (u32 *)writePtr;
|
||||
decPitch = rowPitch;
|
||||
u32 *pixelData = (u32 *)writePtr;
|
||||
int decPitch = rowPitch;
|
||||
if (scaleFactor > 1) {
|
||||
tmpTexBufRearrange.resize(std::max(bufw, w) * h);
|
||||
pixelData = tmpTexBufRearrange.data();
|
||||
@@ -1425,7 +1423,6 @@ void TextureCacheVulkan::LoadTextureLevel(TexCacheEntry &entry, uint8_t *writePt
|
||||
memset(writePtr, 0, rowPitch * h);
|
||||
return;
|
||||
}
|
||||
rowBytes = w * bpp;
|
||||
gpuStats.numTexturesDecoded++;
|
||||
|
||||
if (scaleFactor > 1) {
|
||||
@@ -1438,14 +1435,14 @@ void TextureCacheVulkan::LoadTextureLevel(TexCacheEntry &entry, uint8_t *writePt
|
||||
assert(dstFmt == VULKAN_8888_FORMAT);
|
||||
bpp = sizeof(u32);
|
||||
decPitch = w * bpp;
|
||||
rowBytes = w * bpp;
|
||||
|
||||
if (decPitch != rowPitch) {
|
||||
// Rearrange in place to match the requested pitch.
|
||||
// (it can only be larger than w * bpp, and a match is likely.)
|
||||
for (int y = h - 1; y >= 0; --y) {
|
||||
memcpy(writePtr + rowPitch * y, writePtr + decPitch * y, rowBytes);
|
||||
memcpy(writePtr + rowPitch * y, writePtr + decPitch * y, w * bpp);
|
||||
}
|
||||
decPitch = rowPitch;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user