mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-07-11 01:25:07 +02:00
Fix a filtering issue, enable this for Fushigi no Dungeon 4.
This commit is contained in:
@@ -59,6 +59,10 @@ bool NeedsTestDiscard();
|
||||
bool IsDepthTestEffectivelyDisabled();
|
||||
bool IsStencilTestOutputDisabled();
|
||||
|
||||
inline bool CanForceBilinear(const GPUgstate &gstate) {
|
||||
return ((!gstate.isColorTestEnabled() || IsColorTestTriviallyTrue()) && (!gstate.isAlphaTestEnabled() || IsAlphaTestTriviallyTrue()));
|
||||
}
|
||||
|
||||
StencilValueType ReplaceAlphaWithStencilType();
|
||||
ReplaceAlphaType ReplaceAlphaWithStencil(ReplaceBlendType replaceBlend);
|
||||
ReplaceBlendType ReplaceBlendWithShader(GEBufferFormat bufferFormat);
|
||||
|
||||
@@ -188,33 +188,39 @@ void BaseUpdateUniforms(UB_VS_FS_Base *ub, uint64_t dirtyUniforms, bool useBuffe
|
||||
}
|
||||
|
||||
if (dirtyUniforms & DIRTY_DEPAL) {
|
||||
int indexMask = gstate.getClutIndexMask();
|
||||
int indexShift = gstate.getClutIndexShift();
|
||||
int indexOffset = gstate.getClutIndexStartPos() >> 4;
|
||||
int format = gstate_c.depalTextureFormat;
|
||||
uint32_t val = BytesToUint32(indexMask, indexShift, indexOffset, format);
|
||||
// NOTE: This must follow similar logic to TextureCacheCommon::GetSamplingParams -
|
||||
// maybe we can share it somehow.
|
||||
// TOOD: Handle replaced textures.
|
||||
bool bilinear = gstate.isMagnifyFilteringEnabled() && !gstate_c.pixelMapped;
|
||||
switch (g_Config.iTexFiltering) {
|
||||
case TEX_FILTER_FORCE_NEAREST:
|
||||
bilinear = false;
|
||||
break;
|
||||
case TEX_FILTER_FORCE_LINEAR:
|
||||
bilinear = true;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if (bilinear) {
|
||||
// Poke in a bilinear filter flag in the top bit.
|
||||
val |= 0x80000000;
|
||||
}
|
||||
ub->depal_mask_shift_off_fmt = val;
|
||||
ub->depal_mask_shift_off_fmt = PackDepalBits();
|
||||
}
|
||||
}
|
||||
|
||||
uint32_t PackDepalBits() {
|
||||
const int indexMask = gstate.getClutIndexMask();
|
||||
const int indexShift = gstate.getClutIndexShift();
|
||||
const int indexOffset = gstate.getClutIndexStartPos() >> 4;
|
||||
const int format = gstate_c.depalTextureFormat;
|
||||
uint32_t val = BytesToUint32(indexMask, indexShift, indexOffset, format);
|
||||
// NOTE: This must follow similar logic to TextureCacheCommon::GetSamplingParams -
|
||||
// maybe we can share it somehow.
|
||||
// TOOD: Handle replaced textures.
|
||||
bool bilinear = gstate.isMagnifyFilteringEnabled() && !gstate_c.pixelMapped;
|
||||
switch (g_Config.iTexFiltering) {
|
||||
case TEX_FILTER_FORCE_NEAREST:
|
||||
bilinear = false;
|
||||
break;
|
||||
case TEX_FILTER_FORCE_LINEAR:
|
||||
if (CanForceBilinear(gstate)) {
|
||||
bilinear = true;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if (bilinear) {
|
||||
// Poke in a bilinear filter flag in the top bit.
|
||||
val |= 0x80000000;
|
||||
}
|
||||
return val;
|
||||
}
|
||||
|
||||
// For "light ubershader" bits.
|
||||
// TODO: We pack these bits even when not using ubershader lighting. Maybe not bother.
|
||||
uint32_t PackLightControlBits() {
|
||||
|
||||
@@ -119,3 +119,4 @@ void LightUpdateUniforms(UB_VS_Lights *ub, uint64_t dirtyUniforms);
|
||||
void BoneUpdateUniforms(UB_VS_Bones *ub, uint64_t dirtyUniforms);
|
||||
|
||||
uint32_t PackLightControlBits();
|
||||
uint32_t PackDepalBits();
|
||||
|
||||
@@ -282,8 +282,7 @@ SamplerCacheKey TextureCacheCommon::GetSamplingParams(int maxLevel, const TexCac
|
||||
break;
|
||||
case TEX_FILTER_FORCE_LINEAR:
|
||||
// Override to linear filtering if there's no alpha or color testing going on.
|
||||
if ((!gstate.isColorTestEnabled() || IsColorTestTriviallyTrue()) &&
|
||||
(!gstate.isAlphaTestEnabled() || IsAlphaTestTriviallyTrue())) {
|
||||
if (CanForceBilinear(gstate)) {
|
||||
forceFiltering = TEX_FILTER_FORCE_LINEAR;
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -374,14 +374,7 @@ void LinkedShader::UpdateUniforms(const ShaderID &vsid, const ShaderLanguageDesc
|
||||
return;
|
||||
|
||||
if (dirty & DIRTY_DEPAL) {
|
||||
int indexMask = gstate.getClutIndexMask();
|
||||
int indexShift = gstate.getClutIndexShift();
|
||||
int indexOffset = gstate.getClutIndexStartPos() >> 4;
|
||||
int format = gstate_c.depalTextureFormat;
|
||||
uint32_t val = BytesToUint32(indexMask, indexShift, indexOffset, format);
|
||||
// Poke in a bilinear filter flag in the top bit.
|
||||
val |= gstate.isMagnifyFilteringEnabled() << 31;
|
||||
render_->SetUniformUI1(&u_depal_mask_shift_off_fmt, val);
|
||||
render_->SetUniformUI1(&u_depal_mask_shift_off_fmt, PackDepalBits());
|
||||
}
|
||||
|
||||
// Set HUD mode
|
||||
|
||||
@@ -716,4 +716,3 @@ class GPUInterface;
|
||||
class GPUCommon;
|
||||
|
||||
extern GPUStateCache gstate_c;
|
||||
|
||||
|
||||
+3
-3
@@ -2142,6 +2142,6 @@ ULKS46087 = 0.5
|
||||
# NPJH50878 = -0.4
|
||||
|
||||
[TextureCLUTInShader]
|
||||
# See #15251. This drastically reduces the amount of textures decoded by the game, but due to lots of tile modifications
|
||||
# the number is still pretty high.
|
||||
# NPJH50698 = true
|
||||
# Fushigi no Dungeon 4. See #15251. This drastically reduces the amount of textures decoded by the game,
|
||||
# but due to lots of tile modifications the number is still pretty high.
|
||||
NPJH50698 = true
|
||||
|
||||
Reference in New Issue
Block a user