From db8ced7e4e4724c38f148ee449c346e447dd3942 Mon Sep 17 00:00:00 2001 From: Pokechu22 Date: Thu, 11 Feb 2021 22:38:07 -0800 Subject: Add FogParam0::FloatValue and FogParam3::FloatValue This value will be used in the register description; so expose it in a way that can be re-used instead of calculating it in 2 places later. --- Source/Core/VideoCommon/BPMemory.cpp | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) (limited to 'Source/Core/VideoCommon/BPMemory.cpp') diff --git a/Source/Core/VideoCommon/BPMemory.cpp b/Source/Core/VideoCommon/BPMemory.cpp index cb510e9e6a..e3887327d3 100644 --- a/Source/Core/VideoCommon/BPMemory.cpp +++ b/Source/Core/VideoCommon/BPMemory.cpp @@ -47,16 +47,26 @@ bool FogParams::IsNaNCase() const return a.exp == 255 && c_proj_fsel.c_exp == 255; } +float FogParam0::FloatValue() const +{ + // scale mantissa from 11 to 23 bits + const u32 integral = (sign << 31) | (exp << 23) | (mant << 12); + return Common::BitCast(integral); +} + +float FogParam3::FloatValue() const +{ + // scale mantissa from 11 to 23 bits + const u32 integral = (c_sign << 31) | (c_exp << 23) | (c_mant << 12); + return Common::BitCast(integral); +} + float FogParams::GetA() const { if (IsNaNCase()) return 0.0f; - // scale mantissa from 11 to 23 bits - const u32 integral = (static_cast(a.sign) << 31) | (static_cast(a.exp) << 23) | - (static_cast(a.mant) << 12); - - return Common::BitCast(integral); + return a.FloatValue(); } float FogParams::GetC() const @@ -67,9 +77,5 @@ float FogParams::GetC() const return !a.sign && !c_proj_fsel.c_sign ? -inf : inf; } - // scale mantissa from 11 to 23 bits - const u32 integral = (c_proj_fsel.c_sign.Value() << 31) | (c_proj_fsel.c_exp.Value() << 23) | - (c_proj_fsel.c_mant.Value() << 12); - - return Common::BitCast(integral); + return c_proj_fsel.FloatValue(); } -- cgit v1.2.3 From 70f9fc4e7526fc9cfc008a43cd33229f62be99b6 Mon Sep 17 00:00:00 2001 From: Pokechu22 Date: Wed, 10 Feb 2021 18:11:31 -0800 Subject: Convert BPMemory to BitField and enum class Additional changes: - For TevStageCombiner's ColorCombiner and AlphaCombiner, op/comparison and scale/compare_mode have been split as there are different meanings and enums if bias is set to compare. (Shift has also been renamed to scale) - In TexMode0, min_filter has been split into min_mip and min_filter. - In TexImage1, image_type is now cache_manually_managed. - The unused bit in GenMode is now exposed. - LPSize's lineaspect is now named adjust_for_aspect_ratio. --- Source/Core/VideoCommon/BPMemory.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Source/Core/VideoCommon/BPMemory.cpp') diff --git a/Source/Core/VideoCommon/BPMemory.cpp b/Source/Core/VideoCommon/BPMemory.cpp index e3887327d3..c5749a7bb4 100644 --- a/Source/Core/VideoCommon/BPMemory.cpp +++ b/Source/Core/VideoCommon/BPMemory.cpp @@ -17,7 +17,7 @@ bool BlendMode::UseLogicOp() const return false; // Fast path for Kirby's Return to Dreamland, they use it with dstAlpha. - if (logicmode == BlendMode::NOOP) + if (logicmode == LogicOp::NoOp) return false; return true; -- cgit v1.2.3