mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-04-02 11:01:50 -04:00
Merge pull request #15493 from hrydgard/cleanup-fake-mipmap-checks
Fix checks for the "fake mipmap" situation.
This commit is contained in:
commit
89ce53db44
4 changed files with 20 additions and 11 deletions
|
@ -355,8 +355,9 @@ void TextureCacheCommon::UpdateMaxSeenV(TexCacheEntry *entry, bool throughMode)
|
||||||
|
|
||||||
TexCacheEntry *TextureCacheCommon::SetTexture() {
|
TexCacheEntry *TextureCacheCommon::SetTexture() {
|
||||||
u8 level = 0;
|
u8 level = 0;
|
||||||
if (IsFakeMipmapChange())
|
if (IsFakeMipmapChange()) {
|
||||||
level = std::max(0, gstate.getTexLevelOffset16() / 16);
|
level = std::max(0, gstate.getTexLevelOffset16() / 16);
|
||||||
|
}
|
||||||
u32 texaddr = gstate.getTextureAddress(level);
|
u32 texaddr = gstate.getTextureAddress(level);
|
||||||
if (!Memory::IsValidAddress(texaddr)) {
|
if (!Memory::IsValidAddress(texaddr)) {
|
||||||
// Bind a null texture and return.
|
// Bind a null texture and return.
|
||||||
|
|
|
@ -474,13 +474,13 @@ void TextureCacheDX9::BuildTexture(TexCacheEntry *const entry) {
|
||||||
maxLevel = 0;
|
maxLevel = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
u8 level = 0;
|
||||||
if (IsFakeMipmapChange()) {
|
if (IsFakeMipmapChange()) {
|
||||||
// NOTE: Since the level is not part of the cache key, we assume it never changes.
|
// NOTE: Since the level is not part of the cache key, we assume it never changes.
|
||||||
u8 level = std::max(0, gstate.getTexLevelOffset16() / 16);
|
level = std::max(0, gstate.getTexLevelOffset16() / 16);
|
||||||
LoadTextureLevel(*entry, replaced, level, maxLevel, scaleFactor, dstFmt);
|
|
||||||
} else {
|
|
||||||
LoadTextureLevel(*entry, replaced, 0, maxLevel, scaleFactor, dstFmt);
|
|
||||||
}
|
}
|
||||||
|
LoadTextureLevel(*entry, replaced, level, maxLevel, scaleFactor, dstFmt);
|
||||||
|
|
||||||
LPDIRECT3DTEXTURE9 &texture = DxTex(entry);
|
LPDIRECT3DTEXTURE9 &texture = DxTex(entry);
|
||||||
if (!texture) {
|
if (!texture) {
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -540,13 +540,12 @@ void TextureCacheGLES::BuildTexture(TexCacheEntry *const entry) {
|
||||||
// be as good quality as the game's own (might even be better in some cases though).
|
// be as good quality as the game's own (might even be better in some cases though).
|
||||||
|
|
||||||
// Always load base level texture here
|
// Always load base level texture here
|
||||||
|
u8 level = 0;
|
||||||
if (IsFakeMipmapChange()) {
|
if (IsFakeMipmapChange()) {
|
||||||
// NOTE: Since the level is not part of the cache key, we assume it never changes.
|
// NOTE: Since the level is not part of the cache key, we assume it never changes.
|
||||||
u8 level = std::max(0, gstate.getTexLevelOffset16() / 16);
|
level = std::max(0, gstate.getTexLevelOffset16() / 16);
|
||||||
LoadTextureLevel(*entry, replaced, level, scaleFactor, dstFmt);
|
|
||||||
} else {
|
|
||||||
LoadTextureLevel(*entry, replaced, 0, scaleFactor, dstFmt);
|
|
||||||
}
|
}
|
||||||
|
LoadTextureLevel(*entry, replaced, level, scaleFactor, dstFmt);
|
||||||
|
|
||||||
// Mipmapping is only enabled when texture scaling is disabled.
|
// Mipmapping is only enabled when texture scaling is disabled.
|
||||||
int texMaxLevel = 0;
|
int texMaxLevel = 0;
|
||||||
|
|
|
@ -811,8 +811,14 @@ void TextureCacheVulkan::BuildTexture(TexCacheEntry *const entry) {
|
||||||
"Texture Upload (%08x) video=%d", entry->addr, isVideo);
|
"Texture Upload (%08x) video=%d", entry->addr, isVideo);
|
||||||
|
|
||||||
// NOTE: Since the level is not part of the cache key, we assume it never changes.
|
// NOTE: Since the level is not part of the cache key, we assume it never changes.
|
||||||
u8 level = std::max(0, gstate.getTexLevelOffset16() / 16);
|
|
||||||
bool fakeMipmap = IsFakeMipmapChange() && level > 0;
|
u8 level = 0;
|
||||||
|
bool fakeMipmap = false;
|
||||||
|
if (IsFakeMipmapChange()) {
|
||||||
|
level = std::max(0, gstate.getTexLevelOffset16() / 16);
|
||||||
|
fakeMipmap = level > 0;
|
||||||
|
}
|
||||||
|
|
||||||
// Upload the texture data.
|
// Upload the texture data.
|
||||||
for (int i = 0; i <= maxLevel; i++) {
|
for (int i = 0; i <= maxLevel; i++) {
|
||||||
int mipUnscaledWidth = gstate.getTextureWidth(i);
|
int mipUnscaledWidth = gstate.getTextureWidth(i);
|
||||||
|
@ -976,6 +982,9 @@ void TextureCacheVulkan::LoadTextureLevel(TexCacheEntry &entry, uint8_t *writePt
|
||||||
GETextureFormat tfmt = (GETextureFormat)entry.format;
|
GETextureFormat tfmt = (GETextureFormat)entry.format;
|
||||||
GEPaletteFormat clutformat = gstate.getClutPaletteFormat();
|
GEPaletteFormat clutformat = gstate.getClutPaletteFormat();
|
||||||
u32 texaddr = gstate.getTextureAddress(level);
|
u32 texaddr = gstate.getTextureAddress(level);
|
||||||
|
|
||||||
|
_assert_msg_(texaddr != 0, "Can't load a texture from address null")
|
||||||
|
|
||||||
int bufw = GetTextureBufw(level, texaddr, tfmt);
|
int bufw = GetTextureBufw(level, texaddr, tfmt);
|
||||||
int bpp = dstFmt == VULKAN_8888_FORMAT ? 4 : 2;
|
int bpp = dstFmt == VULKAN_8888_FORMAT ? 4 : 2;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue