TextureCacheCommon::UpdateSamplingParams no longer takes a TexCacheEntry

This commit is contained in:
Henrik Rydgård 2020-09-13 15:57:26 +02:00
parent cea35007ae
commit a4c071261b
8 changed files with 12 additions and 13 deletions

View file

@ -821,7 +821,6 @@ static ConfigSetting graphicsSettings[] = {
ConfigSetting("ClearFramebuffersOnFirstUseHack", &g_Config.bClearFramebuffersOnFirstUseHack, false, true, true),
ConfigSetting(false),
};

View file

@ -186,7 +186,6 @@ public:
bool bFullScreenMulti;
int iInternalResolution; // 0 = Auto (native), 1 = 1x (480x272), 2 = 2x, 3 = 3x, 4 = 4x and so on.
int iAnisotropyLevel; // 0 - 5, powers of 2: 0 = 1x = no aniso
int iMipmapMode; // 0 = default, 1 = performance, 2 = quality
int bHighQualityDepth;
bool bReplaceTextures;
bool bSaveNewTextures;

View file

@ -201,17 +201,16 @@ void TextureCacheCommon::GetSamplingParams(int &minFilt, int &magFilt, bool &sCl
}
}
void TextureCacheCommon::UpdateSamplingParams(TexCacheEntry &entry, SamplerCacheKey &key) {
void TextureCacheCommon::UpdateSamplingParams(int maxLevel, u32 texAddr, SamplerCacheKey &key) {
// TODO: Make GetSamplingParams write SamplerCacheKey directly
int minFilt;
int magFilt;
bool sClamp;
bool tClamp;
float lodBias;
int maxLevel = (entry.status & TexCacheEntry::STATUS_BAD_MIPS) ? 0 : entry.maxLevel;
GETexLevelMode mode;
GetSamplingParams(minFilt, magFilt, sClamp, tClamp, lodBias, maxLevel, entry.addr, mode);
GetSamplingParams(minFilt, magFilt, sClamp, tClamp, lodBias, maxLevel, texAddr, mode);
key.minFilt = minFilt & 1;
key.mipEnable = (minFilt >> 2) & 1;
key.mipFilt = (minFilt >> 1) & 1;
@ -227,7 +226,7 @@ void TextureCacheCommon::UpdateSamplingParams(TexCacheEntry &entry, SamplerCache
} else {
switch (mode) {
case GE_TEXLEVEL_MODE_AUTO:
key.maxLevel = entry.maxLevel * 256;
key.maxLevel = maxLevel * 256;
key.minLevel = 0;
key.lodBias = (int)(lodBias * 256.0f);
if (gstate_c.Supports(GPU_SUPPORTS_ANISOTROPY) && g_Config.iAnisotropyLevel > 0) {
@ -244,7 +243,7 @@ void TextureCacheCommon::UpdateSamplingParams(TexCacheEntry &entry, SamplerCache
// It's incorrect to use the slope as a bias. Instead it should be passed
// into the shader directly as an explicit lod level, with the bias on top. For now, we just kill the
// lodBias in this mode, working around #9772.
key.maxLevel = entry.maxLevel * 256;
key.maxLevel = maxLevel * 256;
key.minLevel = 0;
key.lodBias = 0;
break;

View file

@ -285,7 +285,7 @@ protected:
u32 EstimateTexMemoryUsage(const TexCacheEntry *entry);
void GetSamplingParams(int &minFilt, int &magFilt, bool &sClamp, bool &tClamp, float &lodBias, int maxLevel, u32 addr, GETexLevelMode &mode);
void UpdateSamplingParams(TexCacheEntry &entry, SamplerCacheKey &key); // Used by D3D11 and Vulkan.
void UpdateSamplingParams(int maxLevel, u32 texAddr, SamplerCacheKey &key); // Used by D3D11 and Vulkan.
void UpdateMaxSeenV(TexCacheEntry *entry, bool throughMode);
FramebufferMatchInfo MatchFramebuffer(const TextureDefinition &entry, VirtualFramebuffer *framebuffer, u32 texaddrOffset, FramebufferNotificationChannel channel) const;

View file

@ -240,7 +240,8 @@ void TextureCacheD3D11::BindTexture(TexCacheEntry *entry) {
lastBoundTexture = textureView;
}
SamplerCacheKey key{};
UpdateSamplingParams(*entry, key);
int maxLevel = (entry->status & TexCacheEntry::STATUS_BAD_MIPS) ? 0 : entry->maxLevel;
UpdateSamplingParams(maxLevel, entry->addr, key);
ID3D11SamplerState *state = samplerCache_.GetOrCreateSampler(device_, key);
context_->PSSetSamplers(0, 1, &state);
}

View file

@ -221,7 +221,7 @@ void TextureCacheDX9::StartFrame() {
timesInvalidatedAllThisFrame_ = 0;
if (texelsScaledThisFrame_) {
// INFO_LOG(G3D, "Scaled %i texels", texelsScaledThisFrame_);
VERBOSE_LOG(G3D, "Scaled %i texels", texelsScaledThisFrame_);
}
texelsScaledThisFrame_ = 0;
if (clearCacheNextFrame_) {

View file

@ -227,7 +227,7 @@ void TextureCacheGLES::StartFrame() {
}
if (texelsScaledThisFrame_) {
// INFO_LOG(G3D, "Scaled %i texels", texelsScaledThisFrame_);
VERBOSE_LOG(G3D, "Scaled %i texels", texelsScaledThisFrame_);
}
texelsScaledThisFrame_ = 0;
if (clearCacheNextFrame_) {

View file

@ -492,7 +492,7 @@ void TextureCacheVulkan::EndFrame() {
computeShaderManager_.EndFrame();
if (texelsScaledThisFrame_) {
// INFO_LOG(G3D, "Scaled %i texels", texelsScaledThisFrame_);
VERBOSE_LOG(G3D, "Scaled %i texels", texelsScaledThisFrame_);
}
}
@ -542,7 +542,8 @@ void TextureCacheVulkan::BindTexture(TexCacheEntry *entry) {
entry->vkTex->Touch();
imageView_ = entry->vkTex->GetImageView();
SamplerCacheKey key{};
UpdateSamplingParams(*entry, key);
int maxLevel = (entry->status & TexCacheEntry::STATUS_BAD_MIPS) ? 0 : entry->maxLevel;
UpdateSamplingParams(maxLevel, entry->addr, key);
curSampler_ = samplerCache_.GetOrCreateSampler(key);
drawEngine_->SetDepalTexture(VK_NULL_HANDLE);
gstate_c.SetUseShaderDepal(false);