mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-22 22:00:39 -06:00
Restructure parameters to TetxureConverterShaderGen/TextureConversionShader
This will be used for later refactoring for increased accuracy.
This commit is contained in:
@ -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<EFBCopyParams>
|
||||
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<u32, 3>& coefficients);
|
||||
static bool CopyFilterCanOverflow(const std::array<u32, 3>& 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<int>& 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<u32, 3>& filter_coefficients);
|
||||
virtual void CopyEFBToCacheEntry(TCacheEntry* entry, bool is_depth_copy,
|
||||
const MathUtil::Rectangle<int>& 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<u32, 3>& 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<u32, 3>
|
||||
GetRAMCopyFilterCoefficients(const CopyFilterCoefficients::Values& coefficients);
|
||||
static EFBCopyFilterCoefficients
|
||||
static std::array<u32, 3>
|
||||
GetVRAMCopyFilterCoefficients(const CopyFilterCoefficients::Values& coefficients);
|
||||
|
||||
// Flushes a pending EFB copy to RAM from the host to the guest RAM.
|
||||
|
Reference in New Issue
Block a user