summaryrefslogtreecommitdiff
path: root/src/video_core/engines
diff options
context:
space:
mode:
authorGravatar arades792023-02-11 13:28:03 -0500
committerGravatar arades792023-02-14 12:33:11 -0500
commit45e13b03f372230dbf780f3fa87dd88f388af605 (patch)
tree555593e7e5016b6ba2a777d7417ada244abce458 /src/video_core/engines
parentMerge pull request #9795 from Kelebek1/biquad_fix (diff)
downloadyuzu-45e13b03f372230dbf780f3fa87dd88f388af605.tar.gz
yuzu-45e13b03f372230dbf780f3fa87dd88f388af605.tar.xz
yuzu-45e13b03f372230dbf780f3fa87dd88f388af605.zip
add static lifetime to constexpr values to force compile time evaluation where possible
Signed-off-by: arades79 <scravers@protonmail.com>
Diffstat (limited to 'src/video_core/engines')
-rw-r--r--src/video_core/engines/fermi_2d.cpp2
-rw-r--r--src/video_core/engines/maxwell_3d.cpp2
-rw-r--r--src/video_core/engines/sw_blitter/converter.cpp10
3 files changed, 7 insertions, 7 deletions
diff --git a/src/video_core/engines/fermi_2d.cpp b/src/video_core/engines/fermi_2d.cpp
index a126c359c..40176821b 100644
--- a/src/video_core/engines/fermi_2d.cpp
+++ b/src/video_core/engines/fermi_2d.cpp
@@ -72,7 +72,7 @@ void Fermi2D::Blit() {
72 UNIMPLEMENTED_IF_MSG(regs.clip_enable != 0, "Clipped blit enabled"); 72 UNIMPLEMENTED_IF_MSG(regs.clip_enable != 0, "Clipped blit enabled");
73 73
74 const auto& args = regs.pixels_from_memory; 74 const auto& args = regs.pixels_from_memory;
75 constexpr s64 null_derivate = 1ULL << 32; 75 constexpr static s64 null_derivate = 1ULL << 32;
76 Surface src = regs.src; 76 Surface src = regs.src;
77 const auto bytes_per_pixel = BytesPerBlock(PixelFormatFromRenderTargetFormat(src.format)); 77 const auto bytes_per_pixel = BytesPerBlock(PixelFormatFromRenderTargetFormat(src.format));
78 const bool delegate_to_gpu = src.width > 512 && src.height > 512 && bytes_per_pixel <= 8 && 78 const bool delegate_to_gpu = src.width > 512 && src.height > 512 && bytes_per_pixel <= 8 &&
diff --git a/src/video_core/engines/maxwell_3d.cpp b/src/video_core/engines/maxwell_3d.cpp
index ae9da6290..3c1af92c4 100644
--- a/src/video_core/engines/maxwell_3d.cpp
+++ b/src/video_core/engines/maxwell_3d.cpp
@@ -258,7 +258,7 @@ u32 Maxwell3D::GetMaxCurrentVertices() {
258size_t Maxwell3D::EstimateIndexBufferSize() { 258size_t Maxwell3D::EstimateIndexBufferSize() {
259 GPUVAddr start_address = regs.index_buffer.StartAddress(); 259 GPUVAddr start_address = regs.index_buffer.StartAddress();
260 GPUVAddr end_address = regs.index_buffer.EndAddress(); 260 GPUVAddr end_address = regs.index_buffer.EndAddress();
261 constexpr std::array<size_t, 4> max_sizes = { 261 constexpr static std::array<size_t, 4> max_sizes = {
262 std::numeric_limits<u8>::max(), std::numeric_limits<u16>::max(), 262 std::numeric_limits<u8>::max(), std::numeric_limits<u16>::max(),
263 std::numeric_limits<u32>::max(), std::numeric_limits<u32>::max()}; 263 std::numeric_limits<u32>::max(), std::numeric_limits<u32>::max()};
264 const size_t byte_size = regs.index_buffer.FormatSizeInBytes(); 264 const size_t byte_size = regs.index_buffer.FormatSizeInBytes();
diff --git a/src/video_core/engines/sw_blitter/converter.cpp b/src/video_core/engines/sw_blitter/converter.cpp
index 2419b5632..11674c748 100644
--- a/src/video_core/engines/sw_blitter/converter.cpp
+++ b/src/video_core/engines/sw_blitter/converter.cpp
@@ -694,16 +694,16 @@ private:
694 }; 694 };
695 const auto force_to_fp16 = [](f32 base_value) { 695 const auto force_to_fp16 = [](f32 base_value) {
696 u32 tmp = Common::BitCast<u32>(base_value); 696 u32 tmp = Common::BitCast<u32>(base_value);
697 constexpr size_t fp32_mantissa_bits = 23; 697 constexpr static size_t fp32_mantissa_bits = 23;
698 constexpr size_t fp16_mantissa_bits = 10; 698 constexpr static size_t fp16_mantissa_bits = 10;
699 constexpr size_t mantissa_mask = 699 constexpr static size_t mantissa_mask =
700 ~((1ULL << (fp32_mantissa_bits - fp16_mantissa_bits)) - 1ULL); 700 ~((1ULL << (fp32_mantissa_bits - fp16_mantissa_bits)) - 1ULL);
701 tmp = tmp & static_cast<u32>(mantissa_mask); 701 tmp = tmp & static_cast<u32>(mantissa_mask);
702 // TODO: force the exponent within the range of half float. Not needed in UNORM / SNORM 702 // TODO: force the exponent within the range of half float. Not needed in UNORM / SNORM
703 return Common::BitCast<f32>(tmp); 703 return Common::BitCast<f32>(tmp);
704 }; 704 };
705 const auto from_fp_n = [&sign_extend](u32 base_value, size_t bits, size_t mantissa) { 705 const auto from_fp_n = [&sign_extend](u32 base_value, size_t bits, size_t mantissa) {
706 constexpr size_t fp32_mantissa_bits = 23; 706 constexpr static size_t fp32_mantissa_bits = 23;
707 size_t shift_towards = fp32_mantissa_bits - mantissa; 707 size_t shift_towards = fp32_mantissa_bits - mantissa;
708 const u32 new_value = 708 const u32 new_value =
709 static_cast<u32>(sign_extend(base_value, bits) << shift_towards) & (~(1U << 31)); 709 static_cast<u32>(sign_extend(base_value, bits) << shift_towards) & (~(1U << 31));
@@ -770,7 +770,7 @@ private:
770 component_mask[which_component]; 770 component_mask[which_component];
771 }; 771 };
772 const auto to_fp_n = [](f32 base_value, size_t bits, size_t mantissa) { 772 const auto to_fp_n = [](f32 base_value, size_t bits, size_t mantissa) {
773 constexpr size_t fp32_mantissa_bits = 23; 773 constexpr static size_t fp32_mantissa_bits = 23;
774 u32 tmp_value = Common::BitCast<u32>(std::max(base_value, 0.0f)); 774 u32 tmp_value = Common::BitCast<u32>(std::max(base_value, 0.0f));
775 size_t shift_towards = fp32_mantissa_bits - mantissa; 775 size_t shift_towards = fp32_mantissa_bits - mantissa;
776 return tmp_value >> shift_towards; 776 return tmp_value >> shift_towards;