summaryrefslogtreecommitdiff
path: root/Source/Core/VideoCommon/TextureCacheBase.cpp
diff options
context:
space:
mode:
authorStenzek <stenzek@gmail.com>2018-05-03 14:09:32 +1000
committerStenzek <stenzek@gmail.com>2018-05-03 14:09:32 +1000
commit4faac3a6270c288dad57a59ee0f821512846ebfb (patch)
treee2ba0b26d90ce97abaf13d7e83192be4c25e4f67 /Source/Core/VideoCommon/TextureCacheBase.cpp
parentef98a2173516c6e3b67362877b7890ae19c978a6 (diff)
TextureConversionShader: Don't sample from adjacent rows when not needed
Diffstat (limited to 'Source/Core/VideoCommon/TextureCacheBase.cpp')
-rw-r--r--Source/Core/VideoCommon/TextureCacheBase.cpp21
1 files changed, 14 insertions, 7 deletions
diff --git a/Source/Core/VideoCommon/TextureCacheBase.cpp b/Source/Core/VideoCommon/TextureCacheBase.cpp
index f0b1392531..0a04a93168 100644
--- a/Source/Core/VideoCommon/TextureCacheBase.cpp
+++ b/Source/Core/VideoCommon/TextureCacheBase.cpp
@@ -1499,8 +1499,8 @@ void TextureCacheBase::LoadTextureLevelZeroFromMemory(TCacheEntry* entry_to_upda
}
}
-TextureCacheBase::CopyFilterCoefficientArray
-TextureCacheBase::GetRAMCopyFilterCoefficients(const CopyFilterCoefficients::Values& coefficients)
+TextureCacheBase::CopyFilterCoefficientArray TextureCacheBase::GetRAMCopyFilterCoefficients(
+ const CopyFilterCoefficients::Values& coefficients) const
{
// To simplify the backend, we precalculate the three coefficients in common. Coefficients 0, 1
// are for the row above, 2, 3, 4 are for the current pixel, and 5, 6 are for the row below.
@@ -1510,8 +1510,8 @@ TextureCacheBase::GetRAMCopyFilterCoefficients(const CopyFilterCoefficients::Val
static_cast<u32>(coefficients[5]) + static_cast<u32>(coefficients[6])};
}
-TextureCacheBase::CopyFilterCoefficientArray
-TextureCacheBase::GetVRAMCopyFilterCoefficients(const CopyFilterCoefficients::Values& coefficients)
+TextureCacheBase::CopyFilterCoefficientArray TextureCacheBase::GetVRAMCopyFilterCoefficients(
+ const CopyFilterCoefficients::Values& coefficients) const
{
// If the user disables the copy filter, only apply it to the VRAM copy.
// This way games which are sensitive to changes to the RAM copy of the XFB will be unaffected.
@@ -1528,6 +1528,12 @@ TextureCacheBase::GetVRAMCopyFilterCoefficients(const CopyFilterCoefficients::Va
return res;
}
+bool TextureCacheBase::NeedsCopyFilterInShader(const CopyFilterCoefficientArray& coefficients) const
+{
+ // If the top/bottom coefficients are zero, no point sampling/blending from these rows.
+ return coefficients[0] != 0 || coefficients[2] != 0;
+}
+
void TextureCacheBase::CopyRenderTargetToTexture(
u32 dstAddr, EFBCopyFormat dstFormat, u32 width, u32 height, u32 dstStride, bool is_depth_copy,
const EFBRectangle& srcRect, bool isIntensity, bool scaleByHalf, float y_scale, float gamma,
@@ -1650,11 +1656,12 @@ void TextureCacheBase::CopyRenderTargetToTexture(
if (copy_to_ram)
{
+ CopyFilterCoefficientArray coefficients = GetRAMCopyFilterCoefficients(filter_coefficients);
PEControl::PixelFormat srcFormat = bpmem.zcontrol.pixel_format;
- EFBCopyParams format(srcFormat, dstFormat, is_depth_copy, isIntensity);
+ EFBCopyParams format(srcFormat, dstFormat, is_depth_copy, isIntensity,
+ NeedsCopyFilterInShader(coefficients));
CopyEFB(dst, format, tex_w, bytes_per_row, num_blocks_y, dstStride, srcRect, scaleByHalf,
- y_scale, gamma, clamp_top, clamp_bottom,
- GetRAMCopyFilterCoefficients(filter_coefficients));
+ y_scale, gamma, clamp_top, clamp_bottom, coefficients);
}
else
{