diff --git a/GPU/Common/TextureCacheCommon.cpp b/GPU/Common/TextureCacheCommon.cpp index 2886ea84c3..a434fba4bb 100644 --- a/GPU/Common/TextureCacheCommon.cpp +++ b/GPU/Common/TextureCacheCommon.cpp @@ -194,7 +194,8 @@ void TextureCacheCommon::GetSamplingParams(int &minFilt, int &magFilt, bool &sCl forceNearest = true; } } - if (g_Config.bRealtimeTexScaling && g_Config.iTexScalingLevel != 1) { + // addr is set to nullptr for framebuffers + if (addr && g_Config.bRealtimeTexScaling && g_Config.iTexScalingLevel != 1) { forceNearest = true; } if (forceNearest) { @@ -1533,8 +1534,10 @@ void TextureCacheCommon::ApplyTexture() { entry->lastFrame = gpuStats.numFlips; if (entry->framebuffer) { + gstate_c.curTextureIsRT = true; ApplyTextureFramebuffer(entry, entry->framebuffer); } else { + gstate_c.curTextureIsRT = false; BindTexture(entry); gstate_c.SetTextureFullAlpha(entry->GetAlphaStatus() == TexCacheEntry::STATUS_ALPHA_FULL); } diff --git a/GPU/Directx9/PixelShaderGeneratorDX9.cpp b/GPU/Directx9/PixelShaderGeneratorDX9.cpp index 6d98dc26dd..3813de0007 100644 --- a/GPU/Directx9/PixelShaderGeneratorDX9.cpp +++ b/GPU/Directx9/PixelShaderGeneratorDX9.cpp @@ -388,6 +388,7 @@ bool GenerateFragmentShaderHLSL(const FShaderID &id, char *buffer, ShaderLanguag GEComparison alphaTestFunc = (GEComparison)id.Bits(FS_BIT_ALPHA_TEST_FUNC, 3); GEComparison colorTestFunc = (GEComparison)id.Bits(FS_BIT_COLOR_TEST_FUNC, 2); bool needShaderTexClamp = id.Bit(FS_BIT_SHADER_TEX_CLAMP); + bool needScaleFilter = g_Config.bRealtimeTexScaling && g_Config.iTexScalingLevel != 1 && !gstate_c.curTextureIsRT; ReplaceBlendType replaceBlend = static_cast(id.Bits(FS_BIT_REPLACE_BLEND, 3)); ReplaceAlphaType stencilToAlpha = static_cast(id.Bits(FS_BIT_STENCIL_TO_ALPHA, 2)); @@ -491,7 +492,7 @@ bool GenerateFragmentShaderHLSL(const FShaderID &id, char *buffer, ShaderLanguag } WRITE(p, "};\n"); - if (g_Config.bRealtimeTexScaling && g_Config.iTexScalingLevel != 1) { + if (needScaleFilter) { switch (g_Config.iTexScalingType) { case TextureScalerCommon::XBRZ: WRITE(p, sampler_xbrz); diff --git a/GPU/GPUState.h b/GPU/GPUState.h index 8e6a7c8665..a6526aa0c7 100644 --- a/GPU/GPUState.h +++ b/GPU/GPUState.h @@ -560,6 +560,7 @@ struct GPUStateCache { // Only applied when needShaderTexClamp = true. u32 curTextureXOffset; u32 curTextureYOffset; + bool curTextureIsRT; float vpWidth; float vpHeight;