diff options
| author | Markus Wick <degasus@users.noreply.github.com> | 2018-05-17 10:45:50 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-05-17 10:45:50 +0200 |
| commit | c485efdfe1730d54dbbe2150378cb7b02b3d435c (patch) | |
| tree | 528e08f39193e8ff7cb8662e72d7d21896589e50 /Source/Core/VideoCommon/TextureCacheBase.cpp | |
| parent | 6ed3f8b474be5555b196e1b7f240cbfa778d0d8d (diff) | |
| parent | 4faac3a6270c288dad57a59ee0f821512846ebfb (diff) | |
Merge pull request #6743 from stenzek/faster-disabled-copy-filter
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.cpp | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/Source/Core/VideoCommon/TextureCacheBase.cpp b/Source/Core/VideoCommon/TextureCacheBase.cpp index bf9dc98b9d..e68b408cff 100644 --- a/Source/Core/VideoCommon/TextureCacheBase.cpp +++ b/Source/Core/VideoCommon/TextureCacheBase.cpp @@ -1501,8 +1501,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. @@ -1512,8 +1512,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. @@ -1530,6 +1530,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, @@ -1652,11 +1658,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 { |
