GPU: Consistently bias const mip levels.

Since SLOPE is just a more complicated CONST, we can treat them the same.
This commit is contained in:
Unknown W. Brackets committed 2017-05-12 20:30:47 -07:00
1 parent f9b2272fd3
commit c4d1863ded
7 files changed
+71 -78

No files matched your search

+7 -15
View File
@@ -154,27 +154,18 @@ void TextureCacheDX9::UpdateSamplingParams(TexCacheEntry &entry, bool force) {
bool sClamp;
bool tClamp;
float lodBias;
GetSamplingParams(minFilt, magFilt, sClamp, tClamp, lodBias, entry.maxLevel, entry.addr);
bool autoMip;
GetSamplingParams(minFilt, magFilt, sClamp, tClamp, lodBias, entry.maxLevel, entry.addr, autoMip);
if (entry.maxLevel != 0) {
GETexLevelMode mode = gstate.getTexLevelMode();
switch (mode) {
case GE_TEXLEVEL_MODE_AUTO:
if (autoMip) {
dxstate.texMaxMipLevel.set(0);
dxstate.texMipLodBias.set(lodBias);
break;
case GE_TEXLEVEL_MODE_CONST:
} else {
// TODO: This is just an approximation - texMaxMipLevel sets the lowest numbered mip to use.
// Unfortunately, this doesn't support a const 1.5 or etc.
dxstate.texMaxMipLevel.set((int)lodBias);
dxstate.texMaxMipLevel.set(std::max(0, std::min((int)entry.maxLevel, (int)lodBias)));
dxstate.texMipLodBias.set(-1000.0f);
break;
case GE_TEXLEVEL_MODE_SLOPE:
WARN_LOG_REPORT_ONCE(texSlope, G3D, "Unsupported texture lod slope: %f + %f", gstate.getTextureLodSlope(), lodBias);
// TODO: This behavior isn't correct.
dxstate.texMaxMipLevel.set(0);
dxstate.texMipLodBias.set(lodBias);
break;
}
entry.lodBias = lodBias;
} else {
@@ -203,7 +194,8 @@ void TextureCacheDX9::SetFramebufferSamplingParams(u16 bufferWidth, u16 bufferHe
bool sClamp;
bool tClamp;
float lodBias;
GetSamplingParams(minFilt, magFilt, sClamp, tClamp, lodBias, 0, 0);
bool autoMip;
GetSamplingParams(minFilt, magFilt, sClamp, tClamp, lodBias, 0, 0, autoMip);
dxstate.texMinFilter.set(MinFilt[minFilt]);
dxstate.texMipFilter.set(MipFilt[minFilt]);