From 791bd16b281d3b123a2b9cf2d5c215d4ab235c1d Mon Sep 17 00:00:00 2001 From: Pokechu22 Date: Mon, 7 Feb 2022 13:37:28 -0800 Subject: Restructure parameters to TetxureConverterShaderGen/TextureConversionShader This will be used for later refactoring for increased accuracy. --- Source/Core/VideoCommon/TextureCacheBase.h | 43 +++++++++++++++--------------- 1 file changed, 22 insertions(+), 21 deletions(-) (limited to 'Source/Core/VideoCommon/TextureCacheBase.h') diff --git a/Source/Core/VideoCommon/TextureCacheBase.h b/Source/Core/VideoCommon/TextureCacheBase.h index 287f3b840f..4fe11a64f4 100644 --- a/Source/Core/VideoCommon/TextureCacheBase.h +++ b/Source/Core/VideoCommon/TextureCacheBase.h @@ -57,23 +57,30 @@ struct TextureAndTLUTFormat struct EFBCopyParams { EFBCopyParams(PixelFormat efb_format_, EFBCopyFormat copy_format_, bool depth_, bool yuv_, - bool copy_filter_) + bool all_copy_filter_coefs_needed_, bool copy_filter_can_overflow_, + bool apply_gamma_) : efb_format(efb_format_), copy_format(copy_format_), depth(depth_), yuv(yuv_), - copy_filter(copy_filter_) + all_copy_filter_coefs_needed(all_copy_filter_coefs_needed_), + copy_filter_can_overflow(copy_filter_can_overflow_), apply_gamma(apply_gamma_) { } bool operator<(const EFBCopyParams& rhs) const { - return std::tie(efb_format, copy_format, depth, yuv, copy_filter) < - std::tie(rhs.efb_format, rhs.copy_format, rhs.depth, rhs.yuv, rhs.copy_filter); + return std::tie(efb_format, copy_format, depth, yuv, all_copy_filter_coefs_needed, + copy_filter_can_overflow, + apply_gamma) < std::tie(rhs.efb_format, rhs.copy_format, rhs.depth, rhs.yuv, + rhs.all_copy_filter_coefs_needed, + rhs.copy_filter_can_overflow, rhs.apply_gamma); } PixelFormat efb_format; EFBCopyFormat copy_format; bool depth; bool yuv; - bool copy_filter; + bool all_copy_filter_coefs_needed; + bool copy_filter_can_overflow; + bool apply_gamma; }; template <> @@ -89,19 +96,13 @@ struct fmt::formatter else copy_format = fmt::to_string(uid.copy_format); return fmt::format_to(ctx.out(), - "format: {}, copy format: {}, depth: {}, yuv: {}, copy filter: {}", - uid.efb_format, copy_format, uid.depth, uid.yuv, uid.copy_filter); + "format: {}, copy format: {}, depth: {}, yuv: {}, apply_gamma: {}, " + "all_copy_filter_coefs_needed: {}, copy_filter_can_overflow: {}", + uid.efb_format, copy_format, uid.depth, uid.yuv, uid.apply_gamma, + uid.all_copy_filter_coefs_needed, uid.copy_filter_can_overflow); } }; -// Reduced version of the full coefficient array, with a single value for each row. -struct EFBCopyFilterCoefficients -{ - float upper; - float middle; - float lower; -}; - class TextureCacheBase { private: @@ -267,8 +268,8 @@ public: // Save States void DoState(PointerWrap& p); - // Returns false if the top/bottom row coefficients are zero. - static bool NeedsCopyFilterInShader(const EFBCopyFilterCoefficients& coefficients); + static bool AllCopyFilterCoefsNeeded(const std::array& coefficients); + static bool CopyFilterCanOverflow(const std::array& coefficients); protected: // Decodes the specified data to the GPU texture specified by entry. @@ -285,12 +286,12 @@ protected: u32 bytes_per_row, u32 num_blocks_y, u32 memory_stride, const MathUtil::Rectangle& src_rect, bool scale_by_half, bool linear_filter, float y_scale, float gamma, bool clamp_top, - bool clamp_bottom, const EFBCopyFilterCoefficients& filter_coefficients); + bool clamp_bottom, const std::array& filter_coefficients); virtual void CopyEFBToCacheEntry(TCacheEntry* entry, bool is_depth_copy, const MathUtil::Rectangle& src_rect, bool scale_by_half, bool linear_filter, EFBCopyFormat dst_format, bool is_intensity, float gamma, bool clamp_top, bool clamp_bottom, - const EFBCopyFilterCoefficients& filter_coefficients); + const std::array& filter_coefficients); alignas(16) u8* temp = nullptr; size_t temp_size = 0; @@ -338,9 +339,9 @@ private: void UninitializeXFBMemory(u8* dst, u32 stride, u32 bytes_per_row, u32 num_blocks_y); // Precomputing the coefficients for the previous, current, and next lines for the copy filter. - static EFBCopyFilterCoefficients + static std::array GetRAMCopyFilterCoefficients(const CopyFilterCoefficients::Values& coefficients); - static EFBCopyFilterCoefficients + static std::array GetVRAMCopyFilterCoefficients(const CopyFilterCoefficients::Values& coefficients); // Flushes a pending EFB copy to RAM from the host to the guest RAM. -- cgit v1.2.3