From 45e13b03f372230dbf780f3fa87dd88f388af605 Mon Sep 17 00:00:00 2001 From: arades79 Date: Sat, 11 Feb 2023 13:28:03 -0500 Subject: add static lifetime to constexpr values to force compile time evaluation where possible Signed-off-by: arades79 --- src/audio_core/renderer/adsp/audio_renderer.cpp | 4 +- .../renderer/command/data_source/decode.cpp | 8 +- .../renderer/command/effect/biquad_filter.cpp | 8 +- .../renderer/command/effect/i3dl2_reverb.cpp | 8 +- .../renderer/command/effect/light_limiter.cpp | 4 +- src/audio_core/renderer/command/effect/reverb.cpp | 8 +- .../renderer/command/resample/upsample.cpp | 12 +-- .../renderer/command/sink/circular_buffer.cpp | 4 +- src/audio_core/renderer/command/sink/device.cpp | 4 +- src/audio_core/renderer/system_manager.cpp | 2 +- src/audio_core/renderer/voice/voice_info.cpp | 4 +- src/audio_core/sink/sink_stream.cpp | 12 +-- src/common/fixed_point.h | 12 +-- src/common/hex_util.h | 2 +- src/common/tiny_mt.h | 8 +- src/core/core.cpp | 2 +- src/core/core_timing.cpp | 2 +- src/core/debugger/gdbstub_arch.cpp | 4 +- src/core/file_sys/ips_layer.cpp | 8 +- src/core/file_sys/program_metadata.cpp | 2 +- src/core/file_sys/registered_cache.cpp | 2 +- src/core/hid/emulated_devices.cpp | 2 +- .../kernel/board/nintendo/nx/k_system_control.cpp | 4 +- src/core/hle/kernel/init/init_slab_setup.cpp | 4 +- src/core/hle/kernel/k_capabilities.cpp | 6 +- src/core/hle/kernel/k_memory_manager.h | 6 +- src/core/hle/kernel/k_page_heap.cpp | 2 +- src/core/hle/kernel/k_page_table.cpp | 4 +- src/core/hle/kernel/kernel.cpp | 42 +++++----- src/core/hle/kernel/process_capability.cpp | 2 +- src/core/hle/kernel/svc/svc_activity.cpp | 2 +- src/core/hle/kernel/svc/svc_info.cpp | 2 +- src/core/hle/kernel/svc/svc_memory.cpp | 2 +- src/core/hle/service/acc/acc.cpp | 2 +- src/core/hle/service/am/am.cpp | 6 +- .../am/applets/applet_software_keyboard.cpp | 8 +- src/core/hle/service/apm/apm_controller.cpp | 2 +- src/core/hle/service/audio/audctl.cpp | 4 +- src/core/hle/service/audio/hwopus.cpp | 2 +- src/core/hle/service/caps/caps_u.cpp | 4 +- src/core/hle/service/filesystem/fsp_srv.cpp | 2 +- src/core/hle/service/hid/controllers/npad.cpp | 6 +- src/core/hle/service/mii/mii_manager.cpp | 2 +- src/core/hle/service/nfp/amiibo_crypto.cpp | 12 +-- src/core/hle/service/nifm/nifm.cpp | 2 +- .../hle/service/nvdrv/core/syncpoint_manager.cpp | 4 +- .../service/nvflinger/buffer_queue_consumer.cpp | 2 +- src/core/hle/service/olsc/olsc.cpp | 2 +- src/core/hle/service/prepo/prepo.cpp | 4 +- src/core/hle/service/sockets/sfdnsres.cpp | 4 +- src/core/hle/service/ssl/ssl.cpp | 4 +- src/core/hle/service/time/time_zone_manager.cpp | 8 +- src/core/hle/service/vi/vi.cpp | 8 +- src/core/perf_stats.cpp | 2 +- src/core/telemetry_session.cpp | 4 +- src/input_common/drivers/gc_adapter.cpp | 8 +- src/input_common/drivers/joycon.cpp | 4 +- src/input_common/drivers/mouse.cpp | 2 +- src/input_common/drivers/sdl_driver.cpp | 8 +- src/input_common/drivers/udp_client.cpp | 2 +- src/input_common/helpers/joycon_driver.cpp | 4 +- .../helpers/joycon_protocol/calibration.cpp | 12 +-- .../helpers/joycon_protocol/common_protocol.cpp | 14 ++-- src/input_common/helpers/joycon_protocol/irs.cpp | 6 +- src/input_common/helpers/joycon_protocol/nfc.cpp | 8 +- .../helpers/joycon_protocol/ringcon.cpp | 2 +- .../backend/glsl/emit_glsl_integer.cpp | 2 +- .../backend/spirv/emit_spirv_integer.cpp | 2 +- .../floating_point_conversion_floating_point.cpp | 2 +- .../impl/floating_point_conversion_integer.cpp | 4 +- .../translate/impl/integer_add_three_input.cpp | 2 +- src/tests/common/fibers.cpp | 2 +- .../input_common/calibration_configuration_job.cpp | 4 +- src/video_core/buffer_cache/buffer_cache.h | 8 +- src/video_core/dma_pusher.cpp | 2 +- src/video_core/engines/fermi_2d.cpp | 2 +- src/video_core/engines/maxwell_3d.cpp | 2 +- src/video_core/engines/sw_blitter/converter.cpp | 10 +-- src/video_core/gpu.cpp | 4 +- src/video_core/host1x/codecs/vp9.cpp | 4 +- src/video_core/query_cache.h | 2 +- .../renderer_opengl/gl_compute_pipeline.cpp | 3 +- src/video_core/renderer_opengl/gl_device.cpp | 4 +- .../renderer_opengl/gl_graphics_pipeline.cpp | 3 +- src/video_core/renderer_opengl/renderer_opengl.cpp | 4 +- src/video_core/renderer_vulkan/blit_image.cpp | 5 +- src/video_core/renderer_vulkan/vk_blit_screen.cpp | 4 +- .../renderer_vulkan/vk_compute_pipeline.cpp | 3 +- .../renderer_vulkan/vk_graphics_pipeline.cpp | 3 +- src/video_core/renderer_vulkan/vk_rasterizer.cpp | 6 +- src/video_core/renderer_vulkan/vk_smaa.cpp | 37 ++++---- .../renderer_vulkan/vk_staging_buffer_pool.cpp | 2 +- src/video_core/renderer_vulkan/vk_swapchain.cpp | 2 +- src/video_core/renderer_vulkan/vk_turbo_mode.cpp | 4 +- src/video_core/surface.cpp | 2 +- src/video_core/textures/decoders.cpp | 2 +- src/video_core/vulkan_common/vulkan_wrapper.cpp | 4 +- src/yuzu/bootmanager.cpp | 2 +- .../configure_input_player_widget.cpp | 98 +++++++++++----------- src/yuzu/game_list.cpp | 4 +- src/yuzu/main.cpp | 6 +- 101 files changed, 309 insertions(+), 303 deletions(-) (limited to 'src') diff --git a/src/audio_core/renderer/adsp/audio_renderer.cpp b/src/audio_core/renderer/adsp/audio_renderer.cpp index d982ef630..5bafd4c06 100644 --- a/src/audio_core/renderer/adsp/audio_renderer.cpp +++ b/src/audio_core/renderer/adsp/audio_renderer.cpp @@ -132,7 +132,7 @@ void AudioRenderer::CreateSinkStreams() { } void AudioRenderer::ThreadFunc() { - constexpr char name[]{"AudioRenderer"}; + constexpr static char name[]{"AudioRenderer"}; MicroProfileOnThreadCreate(name); Common::SetCurrentThreadName(name); Common::SetCurrentThreadPriority(Common::ThreadPriority::Critical); @@ -144,7 +144,7 @@ void AudioRenderer::ThreadFunc() { mailbox->ADSPSendMessage(RenderMessage::AudioRenderer_InitializeOK); - constexpr u64 max_process_time{2'304'000ULL}; + constexpr static u64 max_process_time{2'304'000ULL}; while (true) { auto message{mailbox->ADSPWaitMessage()}; diff --git a/src/audio_core/renderer/command/data_source/decode.cpp b/src/audio_core/renderer/command/data_source/decode.cpp index ff5d31bd6..68a0aa15d 100644 --- a/src/audio_core/renderer/command/data_source/decode.cpp +++ b/src/audio_core/renderer/command/data_source/decode.cpp @@ -27,8 +27,8 @@ constexpr std::array PitchBySrcQuality = {4, 8, 4}; template static u32 DecodePcm(Core::Memory::Memory& memory, std::span out_buffer, const DecodeArg& req) { - constexpr s32 min{std::numeric_limits::min()}; - constexpr s32 max{std::numeric_limits::max()}; + constexpr static s32 min{std::numeric_limits::min()}; + constexpr static s32 max{std::numeric_limits::max()}; if (req.buffer == 0 || req.buffer_size == 0) { return 0; @@ -101,8 +101,8 @@ static u32 DecodePcm(Core::Memory::Memory& memory, std::span out_buffer, */ static u32 DecodeAdpcm(Core::Memory::Memory& memory, std::span out_buffer, const DecodeArg& req) { - constexpr u32 SamplesPerFrame{14}; - constexpr u32 NibblesPerFrame{16}; + constexpr static u32 SamplesPerFrame{14}; + constexpr static u32 NibblesPerFrame{16}; if (req.buffer == 0 || req.buffer_size == 0) { return 0; diff --git a/src/audio_core/renderer/command/effect/biquad_filter.cpp b/src/audio_core/renderer/command/effect/biquad_filter.cpp index dea6423dc..84fb6ae7a 100644 --- a/src/audio_core/renderer/command/effect/biquad_filter.cpp +++ b/src/audio_core/renderer/command/effect/biquad_filter.cpp @@ -20,8 +20,8 @@ namespace AudioCore::AudioRenderer { void ApplyBiquadFilterFloat(std::span output, std::span input, std::array& b_, std::array& a_, VoiceState::BiquadFilterState& state, const u32 sample_count) { - constexpr f64 min{std::numeric_limits::min()}; - constexpr f64 max{std::numeric_limits::max()}; + constexpr static f64 min{std::numeric_limits::min()}; + constexpr static f64 max{std::numeric_limits::max()}; std::array b{Common::FixedPoint<50, 14>::from_base(b_[0]).to_double(), Common::FixedPoint<50, 14>::from_base(b_[1]).to_double(), Common::FixedPoint<50, 14>::from_base(b_[2]).to_double()}; @@ -61,8 +61,8 @@ void ApplyBiquadFilterFloat(std::span output, std::span input, static void ApplyBiquadFilterInt(std::span output, std::span input, std::array& b, std::array& a, VoiceState::BiquadFilterState& state, const u32 sample_count) { - constexpr s64 min{std::numeric_limits::min()}; - constexpr s64 max{std::numeric_limits::max()}; + constexpr static s64 min{std::numeric_limits::min()}; + constexpr static s64 max{std::numeric_limits::max()}; for (u32 i = 0; i < sample_count; i++) { const s64 in_sample{input[i]}; diff --git a/src/audio_core/renderer/command/effect/i3dl2_reverb.cpp b/src/audio_core/renderer/command/effect/i3dl2_reverb.cpp index 2187d8a65..98217cd2d 100644 --- a/src/audio_core/renderer/command/effect/i3dl2_reverb.cpp +++ b/src/audio_core/renderer/command/effect/i3dl2_reverb.cpp @@ -244,16 +244,16 @@ template static void ApplyI3dl2ReverbEffect(I3dl2ReverbInfo::State& state, std::span> inputs, std::span> outputs, const u32 sample_count) { - constexpr std::array OutTapIndexes1Ch{ + constexpr static std::array OutTapIndexes1Ch{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; - constexpr std::array OutTapIndexes2Ch{ + constexpr static std::array OutTapIndexes2Ch{ 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, }; - constexpr std::array OutTapIndexes4Ch{ + constexpr static std::array OutTapIndexes4Ch{ 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 1, 1, 1, 0, 0, 0, 0, 3, 3, 3, }; - constexpr std::array OutTapIndexes6Ch{ + constexpr static std::array OutTapIndexes6Ch{ 2, 0, 0, 1, 1, 1, 1, 4, 4, 4, 1, 1, 1, 0, 0, 0, 0, 5, 5, 5, }; diff --git a/src/audio_core/renderer/command/effect/light_limiter.cpp b/src/audio_core/renderer/command/effect/light_limiter.cpp index e8fb0e2fc..410e5dac0 100644 --- a/src/audio_core/renderer/command/effect/light_limiter.cpp +++ b/src/audio_core/renderer/command/effect/light_limiter.cpp @@ -50,8 +50,8 @@ static void ApplyLightLimiterEffect(const LightLimiterInfo::ParameterVersion2& p std::vector>& inputs, std::vector>& outputs, const u32 sample_count, LightLimiterInfo::StatisticsInternal* statistics) { - constexpr s64 min{std::numeric_limits::min()}; - constexpr s64 max{std::numeric_limits::max()}; + constexpr static s64 min{std::numeric_limits::min()}; + constexpr static s64 max{std::numeric_limits::max()}; const auto recip_estimate = [](f64 a) -> f64 { s32 q, s; diff --git a/src/audio_core/renderer/command/effect/reverb.cpp b/src/audio_core/renderer/command/effect/reverb.cpp index 427489214..ffe108268 100644 --- a/src/audio_core/renderer/command/effect/reverb.cpp +++ b/src/audio_core/renderer/command/effect/reverb.cpp @@ -252,16 +252,16 @@ template static void ApplyReverbEffect(const ReverbInfo::ParameterVersion2& params, ReverbInfo::State& state, std::vector>& inputs, std::vector>& outputs, const u32 sample_count) { - constexpr std::array OutTapIndexes1Ch{ + constexpr static std::array OutTapIndexes1Ch{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; - constexpr std::array OutTapIndexes2Ch{ + constexpr static std::array OutTapIndexes2Ch{ 0, 0, 1, 1, 0, 1, 0, 0, 1, 1, }; - constexpr std::array OutTapIndexes4Ch{ + constexpr static std::array OutTapIndexes4Ch{ 0, 0, 1, 1, 0, 1, 2, 2, 3, 3, }; - constexpr std::array OutTapIndexes6Ch{ + constexpr static std::array OutTapIndexes6Ch{ 0, 0, 1, 1, 2, 2, 4, 4, 5, 5, }; diff --git a/src/audio_core/renderer/command/resample/upsample.cpp b/src/audio_core/renderer/command/resample/upsample.cpp index 5f7db12ca..4bd604754 100644 --- a/src/audio_core/renderer/command/resample/upsample.cpp +++ b/src/audio_core/renderer/command/resample/upsample.cpp @@ -19,24 +19,24 @@ namespace AudioCore::AudioRenderer { static void SrcProcessFrame(std::span output, std::span input, const u32 target_sample_count, const u32 source_sample_count, UpsamplerState* state) { - constexpr u32 WindowSize = 10; - constexpr std::array, WindowSize> WindowedSinc1{ + constexpr static u32 WindowSize = 10; + constexpr static std::array, WindowSize> WindowedSinc1{ 0.95376587f, -0.12872314f, 0.060028076f, -0.032470703f, 0.017669678f, -0.009124756f, 0.004272461f, -0.001739502f, 0.000579834f, -0.000091552734f, }; - constexpr std::array, WindowSize> WindowedSinc2{ + constexpr static std::array, WindowSize> WindowedSinc2{ 0.8230896f, -0.19161987f, 0.093444824f, -0.05090332f, 0.027557373f, -0.014038086f, 0.0064697266f, -0.002532959f, 0.00079345703f, -0.00012207031f, }; - constexpr std::array, WindowSize> WindowedSinc3{ + constexpr static std::array, WindowSize> WindowedSinc3{ 0.6298828f, -0.19274902f, 0.09725952f, -0.05319214f, 0.028625488f, -0.014373779f, 0.006500244f, -0.0024719238f, 0.0007324219f, -0.000091552734f, }; - constexpr std::array, WindowSize> WindowedSinc4{ + constexpr static std::array, WindowSize> WindowedSinc4{ 0.4057312f, -0.1468811f, 0.07601929f, -0.041656494f, 0.022216797f, -0.011016846f, 0.004852295f, -0.0017700195f, 0.00048828125f, -0.000030517578f, }; - constexpr std::array, WindowSize> WindowedSinc5{ + constexpr static std::array, WindowSize> WindowedSinc5{ 0.1854248f, -0.075164795f, 0.03967285f, -0.021728516f, 0.011474609f, -0.005584717f, 0.0024108887f, -0.0008239746f, 0.00021362305f, 0.0f, }; diff --git a/src/audio_core/renderer/command/sink/circular_buffer.cpp b/src/audio_core/renderer/command/sink/circular_buffer.cpp index ded5afc94..1989873db 100644 --- a/src/audio_core/renderer/command/sink/circular_buffer.cpp +++ b/src/audio_core/renderer/command/sink/circular_buffer.cpp @@ -21,8 +21,8 @@ void CircularBufferSinkCommand::Dump([[maybe_unused]] const ADSP::CommandListPro } void CircularBufferSinkCommand::Process(const ADSP::CommandListProcessor& processor) { - constexpr s32 min{std::numeric_limits::min()}; - constexpr s32 max{std::numeric_limits::max()}; + constexpr static s32 min{std::numeric_limits::min()}; + constexpr static s32 max{std::numeric_limits::max()}; std::vector output(processor.sample_count); for (u32 channel = 0; channel < input_count; channel++) { diff --git a/src/audio_core/renderer/command/sink/device.cpp b/src/audio_core/renderer/command/sink/device.cpp index e88372a75..2f2e82ae2 100644 --- a/src/audio_core/renderer/command/sink/device.cpp +++ b/src/audio_core/renderer/command/sink/device.cpp @@ -20,8 +20,8 @@ void DeviceSinkCommand::Dump([[maybe_unused]] const ADSP::CommandListProcessor& } void DeviceSinkCommand::Process(const ADSP::CommandListProcessor& processor) { - constexpr s32 min = std::numeric_limits::min(); - constexpr s32 max = std::numeric_limits::max(); + constexpr static s32 min = std::numeric_limits::min(); + constexpr static s32 max = std::numeric_limits::max(); auto stream{processor.GetOutputSinkStream()}; stream->SetSystemChannels(input_count); diff --git a/src/audio_core/renderer/system_manager.cpp b/src/audio_core/renderer/system_manager.cpp index f66b2b890..a8517014e 100644 --- a/src/audio_core/renderer/system_manager.cpp +++ b/src/audio_core/renderer/system_manager.cpp @@ -94,7 +94,7 @@ bool SystemManager::Remove(System& system_) { } void SystemManager::ThreadFunc() { - constexpr char name[]{"AudioRenderSystemManager"}; + constexpr static char name[]{"AudioRenderSystemManager"}; MicroProfileOnThreadCreate(name); Common::SetCurrentThreadName(name); Common::SetCurrentThreadPriority(Common::ThreadPriority::High); diff --git a/src/audio_core/renderer/voice/voice_info.cpp b/src/audio_core/renderer/voice/voice_info.cpp index 1849eeb57..2b3705647 100644 --- a/src/audio_core/renderer/voice/voice_info.cpp +++ b/src/audio_core/renderer/voice/voice_info.cpp @@ -177,7 +177,7 @@ void VoiceInfo::UpdateWaveBuffer(std::span error_info, switch (sample_format_) { case SampleFormat::PcmInt16: { - constexpr auto byte_size{GetSampleFormatByteSize(SampleFormat::PcmInt16)}; + constexpr static auto byte_size{GetSampleFormatByteSize(SampleFormat::PcmInt16)}; if (wave_buffer_internal.start_offset * byte_size > wave_buffer_internal.size || wave_buffer_internal.end_offset * byte_size > wave_buffer_internal.size) { LOG_ERROR(Service_Audio, "Invalid PCM16 start/end wavebuffer sizes!"); @@ -188,7 +188,7 @@ void VoiceInfo::UpdateWaveBuffer(std::span error_info, } break; case SampleFormat::PcmFloat: { - constexpr auto byte_size{GetSampleFormatByteSize(SampleFormat::PcmFloat)}; + constexpr static auto byte_size{GetSampleFormatByteSize(SampleFormat::PcmFloat)}; if (wave_buffer_internal.start_offset * byte_size > wave_buffer_internal.size || wave_buffer_internal.end_offset * byte_size > wave_buffer_internal.size) { LOG_ERROR(Service_Audio, "Invalid PCMFloat start/end wavebuffer sizes!"); diff --git a/src/audio_core/sink/sink_stream.cpp b/src/audio_core/sink/sink_stream.cpp index 06c2a876e..fa3cee3ea 100644 --- a/src/audio_core/sink/sink_stream.cpp +++ b/src/audio_core/sink/sink_stream.cpp @@ -24,8 +24,8 @@ void SinkStream::AppendBuffer(SinkBuffer& buffer, std::vector& samples) { return; } - constexpr s32 min{std::numeric_limits::min()}; - constexpr s32 max{std::numeric_limits::max()}; + constexpr static s32 min{std::numeric_limits::min()}; + constexpr static s32 max{std::numeric_limits::max()}; auto yuzu_volume{Settings::Volume()}; if (yuzu_volume > 1.0f) { @@ -35,7 +35,7 @@ void SinkStream::AppendBuffer(SinkBuffer& buffer, std::vector& samples) { if (system_channels == 6 && device_channels == 2) { // We're given 6 channels, but our device only outputs 2, so downmix. - constexpr std::array down_mix_coeff{1.0f, 0.707f, 0.251f, 0.707f}; + constexpr static std::array down_mix_coeff{1.0f, 0.707f, 0.251f, 0.707f}; for (u32 read_index = 0, write_index = 0; read_index < samples.size(); read_index += system_channels, write_index += device_channels) { @@ -106,8 +106,8 @@ void SinkStream::AppendBuffer(SinkBuffer& buffer, std::vector& samples) { } std::vector SinkStream::ReleaseBuffer(u64 num_samples) { - constexpr s32 min = std::numeric_limits::min(); - constexpr s32 max = std::numeric_limits::max(); + constexpr static s32 min = std::numeric_limits::min(); + constexpr static s32 max = std::numeric_limits::max(); auto samples{samples_buffer.Pop(num_samples)}; @@ -202,7 +202,7 @@ void SinkStream::ProcessAudioOutAndRender(std::span output_buffer, std::siz // If we're paused or going to shut down, we don't want to consume buffers as coretiming is // paused and we'll desync, so just play silence. if (system.IsPaused() || system.IsShuttingDown()) { - constexpr std::array silence{}; + constexpr static std::array silence{}; for (size_t i = frames_written; i < num_frames; i++) { std::memcpy(&output_buffer[i * frame_size], &silence[0], frame_size_bytes); } diff --git a/src/common/fixed_point.h b/src/common/fixed_point.h index f899b0d54..29b80c328 100644 --- a/src/common/fixed_point.h +++ b/src/common/fixed_point.h @@ -107,7 +107,7 @@ constexpr FixedPoint divide( using next_type = typename FixedPoint::next_type; using base_type = typename FixedPoint::base_type; - constexpr size_t fractional_bits = FixedPoint::fractional_bits; + constexpr static size_t fractional_bits = FixedPoint::fractional_bits; next_type t(numerator.to_raw()); t <<= fractional_bits; @@ -127,7 +127,7 @@ constexpr FixedPoint divide( using unsigned_type = typename FixedPoint::unsigned_type; - constexpr int bits = FixedPoint::total_bits; + constexpr static int bits = FixedPoint::total_bits; if (denominator == 0) { throw divide_by_zero(); @@ -198,7 +198,7 @@ constexpr FixedPoint multiply( using next_type = typename FixedPoint::next_type; using base_type = typename FixedPoint::base_type; - constexpr size_t fractional_bits = FixedPoint::fractional_bits; + constexpr static size_t fractional_bits = FixedPoint::fractional_bits; next_type t(static_cast(lhs.to_raw()) * static_cast(rhs.to_raw())); t >>= fractional_bits; @@ -216,9 +216,9 @@ constexpr FixedPoint multiply( using base_type = typename FixedPoint::base_type; - constexpr size_t fractional_bits = FixedPoint::fractional_bits; - constexpr base_type integer_mask = FixedPoint::integer_mask; - constexpr base_type fractional_mask = FixedPoint::fractional_mask; + constexpr static size_t fractional_bits = FixedPoint::fractional_bits; + constexpr static base_type integer_mask = FixedPoint::integer_mask; + constexpr static base_type fractional_mask = FixedPoint::fractional_mask; // more costly but doesn't need a larger type const base_type a_hi = (lhs.to_raw() & integer_mask) >> fractional_bits; diff --git a/src/common/hex_util.h b/src/common/hex_util.h index a00904939..6b024588b 100644 --- a/src/common/hex_util.h +++ b/src/common/hex_util.h @@ -47,7 +47,7 @@ template static_assert(std::is_same_v, "Underlying type within the contiguous container must be u8."); - constexpr std::size_t pad_width = 2; + constexpr static std::size_t pad_width = 2; std::string out; out.reserve(std::size(data) * pad_width); diff --git a/src/common/tiny_mt.h b/src/common/tiny_mt.h index 5d5ebf158..4689fd55b 100644 --- a/src/common/tiny_mt.h +++ b/src/common/tiny_mt.h @@ -223,7 +223,7 @@ public: float GenerateRandomF32() { // Floats have 24 bits of mantissa. - constexpr u32 MantissaBits = 24; + constexpr static u32 MantissaBits = 24; return static_cast(GenerateRandomU24()) * (1.0f / (1U << MantissaBits)); } @@ -234,9 +234,9 @@ public: // Nintendo does not. They use (32 - 5) = 27 bits from the first rnd32() // call, and (32 - 6) bits from the second. We'll do what they do, but // There's not a clear reason why. - constexpr u32 MantissaBits = 53; - constexpr u32 Shift1st = (64 - MantissaBits) / 2; - constexpr u32 Shift2nd = (64 - MantissaBits) - Shift1st; + constexpr static u32 MantissaBits = 53; + constexpr static u32 Shift1st = (64 - MantissaBits) / 2; + constexpr static u32 Shift2nd = (64 - MantissaBits) - Shift1st; const u32 first = (this->GenerateRandomU32() >> Shift1st); const u32 second = (this->GenerateRandomU32() >> Shift2nd); diff --git a/src/core/core.cpp b/src/core/core.cpp index 47292cd78..7ba13ab51 100644 --- a/src/core/core.cpp +++ b/src/core/core.cpp @@ -361,7 +361,7 @@ struct System::Impl { // Log last frame performance stats if game was loded if (perf_stats) { const auto perf_results = GetAndResetPerfStats(); - constexpr auto performance = Common::Telemetry::FieldType::Performance; + constexpr static auto performance = Common::Telemetry::FieldType::Performance; telemetry_session->AddField(performance, "Shutdown_EmulationSpeed", perf_results.emulation_speed * 100.0); diff --git a/src/core/core_timing.cpp b/src/core/core_timing.cpp index 6bac6722f..5214e88b8 100644 --- a/src/core/core_timing.cpp +++ b/src/core/core_timing.cpp @@ -45,7 +45,7 @@ CoreTiming::~CoreTiming() { } void CoreTiming::ThreadEntry(CoreTiming& instance) { - constexpr char name[] = "HostTiming"; + constexpr static char name[] = "HostTiming"; MicroProfileOnThreadCreate(name); Common::SetCurrentThreadName(name); Common::SetCurrentThreadPriority(Common::ThreadPriority::Critical); diff --git a/src/core/debugger/gdbstub_arch.cpp b/src/core/debugger/gdbstub_arch.cpp index 4bef09bd7..b13c473bb 100644 --- a/src/core/debugger/gdbstub_arch.cpp +++ b/src/core/debugger/gdbstub_arch.cpp @@ -42,7 +42,7 @@ static void PutSIMDRegister(std::array& simd_regs, size_t offset, const // For sample XML files see the GDB source /gdb/features // This XML defines what the registers are for this specific ARM device std::string GDBStubA64::GetTargetXML() const { - constexpr const char* target_xml = + constexpr static const char* target_xml = R"( @@ -271,7 +271,7 @@ u32 GDBStubA64::BreakpointInstruction() const { } std::string GDBStubA32::GetTargetXML() const { - constexpr const char* target_xml = + constexpr static const char* target_xml = R"( diff --git a/src/core/file_sys/ips_layer.cpp b/src/core/file_sys/ips_layer.cpp index 5aab428bb..0a86e8b0a 100644 --- a/src/core/file_sys/ips_layer.cpp +++ b/src/core/file_sys/ips_layer.cpp @@ -41,12 +41,12 @@ static IPSFileType IdentifyMagic(const std::vector& magic) { return IPSFileType::Error; } - constexpr std::array patch_magic{{'P', 'A', 'T', 'C', 'H'}}; + constexpr static std::array patch_magic{{'P', 'A', 'T', 'C', 'H'}}; if (std::equal(magic.begin(), magic.end(), patch_magic.begin())) { return IPSFileType::IPS; } - constexpr std::array ips32_magic{{'I', 'P', 'S', '3', '2'}}; + constexpr static std::array ips32_magic{{'I', 'P', 'S', '3', '2'}}; if (std::equal(magic.begin(), magic.end(), ips32_magic.begin())) { return IPSFileType::IPS32; } @@ -55,12 +55,12 @@ static IPSFileType IdentifyMagic(const std::vector& magic) { } static bool IsEOF(IPSFileType type, const std::vector& data) { - constexpr std::array eof{{'E', 'O', 'F'}}; + constexpr static std::array eof{{'E', 'O', 'F'}}; if (type == IPSFileType::IPS && std::equal(data.begin(), data.end(), eof.begin())) { return true; } - constexpr std::array eeof{{'E', 'E', 'O', 'F'}}; + constexpr static std::array eeof{{'E', 'E', 'O', 'F'}}; return type == IPSFileType::IPS32 && std::equal(data.begin(), data.end(), eeof.begin()); } diff --git a/src/core/file_sys/program_metadata.cpp b/src/core/file_sys/program_metadata.cpp index f00479bd3..cb172f574 100644 --- a/src/core/file_sys/program_metadata.cpp +++ b/src/core/file_sys/program_metadata.cpp @@ -97,7 +97,7 @@ Loader::ResultStatus ProgramMetadata::Load(VirtualFile file) { /*static*/ ProgramMetadata ProgramMetadata::GetDefault() { // Allow use of cores 0~3 and thread priorities 1~63. - constexpr u32 default_thread_info_capability = 0x30007F7; + constexpr static u32 default_thread_info_capability = 0x30007F7; ProgramMetadata result; diff --git a/src/core/file_sys/registered_cache.cpp b/src/core/file_sys/registered_cache.cpp index 878d832c2..0f1f76949 100644 --- a/src/core/file_sys/registered_cache.cpp +++ b/src/core/file_sys/registered_cache.cpp @@ -71,7 +71,7 @@ static std::string GetRelativePathFromNcaID(const std::array& nca_id, bo } static std::string GetCNMTName(TitleType type, u64 title_id) { - constexpr std::array TITLE_TYPE_NAMES{ + constexpr static std::array TITLE_TYPE_NAMES{ "SystemProgram", "SystemData", "SystemUpdate", diff --git a/src/core/hid/emulated_devices.cpp b/src/core/hid/emulated_devices.cpp index 836f32c0f..e380da3a4 100644 --- a/src/core/hid/emulated_devices.cpp +++ b/src/core/hid/emulated_devices.cpp @@ -213,7 +213,7 @@ void EmulatedDevices::SetKeyboardButton(const Common::Input::CallbackStatus& cal } void EmulatedDevices::UpdateKey(std::size_t key_index, bool status) { - constexpr std::size_t KEYS_PER_BYTE = 8; + constexpr static std::size_t KEYS_PER_BYTE = 8; auto& entry = device_status.keyboard_state.key[key_index / KEYS_PER_BYTE]; const u8 mask = static_cast(1 << (key_index % KEYS_PER_BYTE)); if (status) { diff --git a/src/core/hle/kernel/board/nintendo/nx/k_system_control.cpp b/src/core/hle/kernel/board/nintendo/nx/k_system_control.cpp index c10b7bf30..49098d2c9 100644 --- a/src/core/hle/kernel/board/nintendo/nx/k_system_control.cpp +++ b/src/core/hle/kernel/board/nintendo/nx/k_system_control.cpp @@ -114,13 +114,13 @@ size_t KSystemControl::Init::GetAppletPoolSize() { }(); // Return (possibly) adjusted size. - constexpr size_t ExtraSystemMemoryForAtmosphere = 33_MiB; + constexpr static size_t ExtraSystemMemoryForAtmosphere = 33_MiB; return base_pool_size - ExtraSystemMemoryForAtmosphere - KTraceBufferSize; } size_t KSystemControl::Init::GetMinimumNonSecureSystemPoolSize() { // Verify that our minimum is at least as large as Nintendo's. - constexpr size_t MinimumSize = RequiredNonSecureSystemMemorySize; + constexpr static size_t MinimumSize = RequiredNonSecureSystemMemorySize; static_assert(MinimumSize >= 0x29C8000); return MinimumSize; diff --git a/src/core/hle/kernel/init/init_slab_setup.cpp b/src/core/hle/kernel/init/init_slab_setup.cpp index 571acf4b2..951326a85 100644 --- a/src/core/hle/kernel/init/init_slab_setup.cpp +++ b/src/core/hle/kernel/init/init_slab_setup.cpp @@ -129,7 +129,7 @@ VAddr InitializeSlabHeap(Core::System& system, KMemoryLayout& memory_layout, VAd } size_t CalculateSlabHeapGapSize() { - constexpr size_t KernelSlabHeapGapSize = 2_MiB - 320_KiB; + constexpr static size_t KernelSlabHeapGapSize = 2_MiB - 320_KiB; static_assert(KernelSlabHeapGapSize <= KernelSlabHeapGapsSizeMax); return KernelSlabHeapGapSize; } @@ -272,7 +272,7 @@ void KPageBufferSlabHeap::Initialize(Core::System& system) { kernel.GetSystemResourceLimit()->Reserve(LimitableResource::PhysicalMemoryMax, slab_size)); // Allocate memory for the slab. - constexpr auto AllocateOption = KMemoryManager::EncodeOption( + constexpr static auto AllocateOption = KMemoryManager::EncodeOption( KMemoryManager::Pool::System, KMemoryManager::Direction::FromFront); const PAddr slab_address = kernel.MemoryManager().AllocateAndOpenContinuous(num_pages, 1, AllocateOption); diff --git a/src/core/hle/kernel/k_capabilities.cpp b/src/core/hle/kernel/k_capabilities.cpp index 2907cc6e3..374bc2c06 100644 --- a/src/core/hle/kernel/k_capabilities.cpp +++ b/src/core/hle/kernel/k_capabilities.cpp @@ -21,8 +21,8 @@ Result KCapabilities::InitializeForKIP(std::span kern_caps, KPageTabl m_program_type = 0; // Initial processes may run on all cores. - constexpr u64 VirtMask = Core::Hardware::VirtualCoreMask; - constexpr u64 PhysMask = Core::Hardware::ConvertVirtualCoreMaskToPhysical(VirtMask); + constexpr static u64 VirtMask = Core::Hardware::VirtualCoreMask; + constexpr static u64 PhysMask = Core::Hardware::ConvertVirtualCoreMaskToPhysical(VirtMask); m_core_mask = VirtMask; m_phys_core_mask = PhysMask; @@ -170,7 +170,7 @@ Result KCapabilities::MapIoPage_(const u32 cap, KPageTable* page_table) { template Result KCapabilities::ProcessMapRegionCapability(const u32 cap, F f) { // Define the allowed memory regions. - constexpr std::array MemoryRegions{ + constexpr static std::array MemoryRegions{ KMemoryRegionType_None, KMemoryRegionType_KernelTraceBuffer, KMemoryRegionType_OnMemoryBootImage, diff --git a/src/core/hle/kernel/k_memory_manager.h b/src/core/hle/kernel/k_memory_manager.h index 401d4e644..d13549b5e 100644 --- a/src/core/hle/kernel/k_memory_manager.h +++ b/src/core/hle/kernel/k_memory_manager.h @@ -121,7 +121,7 @@ public: } size_t GetSize(Pool pool) { - constexpr Direction GetSizeDirection = Direction::FromFront; + constexpr static Direction GetSizeDirection = Direction::FromFront; size_t total = 0; for (auto* manager = this->GetFirstManager(pool, GetSizeDirection); manager != nullptr; manager = this->GetNextManager(manager, GetSizeDirection)) { @@ -142,7 +142,7 @@ public: size_t GetFreeSize(Pool pool) { KScopedLightLock lk(m_pool_locks[static_cast(pool)]); - constexpr Direction GetSizeDirection = Direction::FromFront; + constexpr static Direction GetSizeDirection = Direction::FromFront; size_t total = 0; for (auto* manager = this->GetFirstManager(pool, GetSizeDirection); manager != nullptr; manager = this->GetNextManager(manager, GetSizeDirection)) { @@ -154,7 +154,7 @@ public: void DumpFreeList(Pool pool) { KScopedLightLock lk(m_pool_locks[static_cast(pool)]); - constexpr Direction DumpDirection = Direction::FromFront; + constexpr static Direction DumpDirection = Direction::FromFront; for (auto* manager = this->GetFirstManager(pool, DumpDirection); manager != nullptr; manager = this->GetNextManager(manager, DumpDirection)) { manager->DumpFreeList(); diff --git a/src/core/hle/kernel/k_page_heap.cpp b/src/core/hle/kernel/k_page_heap.cpp index 7b02c7d8b..ffebf0a35 100644 --- a/src/core/hle/kernel/k_page_heap.cpp +++ b/src/core/hle/kernel/k_page_heap.cpp @@ -68,7 +68,7 @@ PAddr KPageHeap::AllocateByRandom(s32 index, size_t num_pages, size_t align_page const size_t align_shift = std::countr_zero(align_size); // Decide on a block to allocate from. - constexpr size_t MinimumPossibleAlignmentsForRandomAllocation = 4; + constexpr static size_t MinimumPossibleAlignmentsForRandomAllocation = 4; { // By default, we'll want to look at all blocks larger than our current one. s32 max_blocks = static_cast(m_num_blocks); diff --git a/src/core/hle/kernel/k_page_table.cpp b/src/core/hle/kernel/k_page_table.cpp index 2e13d5d0d..d3e0334ed 100644 --- a/src/core/hle/kernel/k_page_table.cpp +++ b/src/core/hle/kernel/k_page_table.cpp @@ -134,7 +134,7 @@ Result KPageTable::InitializeForProcess(FileSys::ProgramAddressSpaceType as_type } // Set code regions and determine remaining - constexpr size_t RegionAlignment{2_MiB}; + constexpr static size_t RegionAlignment{2_MiB}; VAddr process_code_start{}; VAddr process_code_end{}; size_t stack_region_size{}; @@ -2624,7 +2624,7 @@ Result KPageTable::SetMemoryAttribute(VAddr addr, size_t size, u32 mask, u32 att KMemoryPermission old_perm; KMemoryAttribute old_attr; size_t num_allocator_blocks; - constexpr auto AttributeTestMask = + constexpr static auto AttributeTestMask = ~(KMemoryAttribute::SetMask | KMemoryAttribute::DeviceShared); R_TRY(this->CheckMemoryState( std::addressof(old_state), std::addressof(old_perm), std::addressof(old_attr), diff --git a/src/core/hle/kernel/kernel.cpp b/src/core/hle/kernel/kernel.cpp index 5b72eaaa1..563e2681b 100644 --- a/src/core/hle/kernel/kernel.cpp +++ b/src/core/hle/kernel/kernel.cpp @@ -254,7 +254,7 @@ struct KernelCore::Impl { system_resource_limit->Reserve(LimitableResource::PhysicalMemoryMax, kernel_size); // Reserve secure applet memory, introduced in firmware 5.0.0 - constexpr u64 secure_applet_memory_size{4_MiB}; + constexpr static u64 secure_applet_memory_size{4_MiB}; ASSERT(system_resource_limit->Reserve(LimitableResource::PhysicalMemoryMax, secure_applet_memory_size)); } @@ -477,9 +477,9 @@ struct KernelCore::Impl { const VAddr code_end_virt_addr = KernelVirtualAddressCodeEnd; // Setup the containing kernel region. - constexpr size_t KernelRegionSize = 1_GiB; - constexpr size_t KernelRegionAlign = 1_GiB; - constexpr VAddr kernel_region_start = + constexpr static size_t KernelRegionSize = 1_GiB; + constexpr static size_t KernelRegionAlign = 1_GiB; + constexpr static VAddr kernel_region_start = Common::AlignDown(code_start_virt_addr, KernelRegionAlign); size_t kernel_region_size = KernelRegionSize; if (!(kernel_region_start + KernelRegionSize - 1 <= KernelVirtualAddressSpaceLast)) { @@ -489,11 +489,11 @@ struct KernelCore::Impl { kernel_region_start, kernel_region_size, KMemoryRegionType_Kernel)); // Setup the code region. - constexpr size_t CodeRegionAlign = PageSize; - constexpr VAddr code_region_start = + constexpr static size_t CodeRegionAlign = PageSize; + constexpr static VAddr code_region_start = Common::AlignDown(code_start_virt_addr, CodeRegionAlign); - constexpr VAddr code_region_end = Common::AlignUp(code_end_virt_addr, CodeRegionAlign); - constexpr size_t code_region_size = code_region_end - code_region_start; + constexpr static VAddr code_region_end = Common::AlignUp(code_end_virt_addr, CodeRegionAlign); + constexpr static size_t code_region_size = code_region_end - code_region_start; ASSERT(memory_layout->GetVirtualMemoryRegionTree().Insert( code_region_start, code_region_size, KMemoryRegionType_KernelCode)); @@ -524,8 +524,8 @@ struct KernelCore::Impl { } // Decide on the actual size for the misc region. - constexpr size_t MiscRegionAlign = KernelAslrAlignment; - constexpr size_t MiscRegionMinimumSize = 32_MiB; + constexpr static size_t MiscRegionAlign = KernelAslrAlignment; + constexpr static size_t MiscRegionMinimumSize = 32_MiB; const size_t misc_region_size = Common::AlignUp( std::max(misc_region_needed_size, MiscRegionMinimumSize), MiscRegionAlign); ASSERT(misc_region_size > 0); @@ -541,8 +541,8 @@ struct KernelCore::Impl { const bool use_extra_resources = KSystemControl::Init::ShouldIncreaseThreadResourceLimit(); // Setup the stack region. - constexpr size_t StackRegionSize = 14_MiB; - constexpr size_t StackRegionAlign = KernelAslrAlignment; + constexpr static size_t StackRegionSize = 14_MiB; + constexpr static size_t StackRegionAlign = KernelAslrAlignment; const VAddr stack_region_start = memory_layout->GetVirtualMemoryRegionTree().GetRandomAlignedRegion( StackRegionSize, StackRegionAlign, KMemoryRegionType_Kernel); @@ -563,7 +563,7 @@ struct KernelCore::Impl { const PAddr code_end_phys_addr = code_start_phys_addr + code_region_size; const PAddr slab_start_phys_addr = code_end_phys_addr; const PAddr slab_end_phys_addr = slab_start_phys_addr + slab_region_size; - constexpr size_t SlabRegionAlign = KernelAslrAlignment; + constexpr static size_t SlabRegionAlign = KernelAslrAlignment; const size_t slab_region_needed_size = Common::AlignUp(code_end_phys_addr + slab_region_size, SlabRegionAlign) - Common::AlignDown(code_end_phys_addr, SlabRegionAlign); @@ -575,8 +575,8 @@ struct KernelCore::Impl { slab_region_start, slab_region_size, KMemoryRegionType_KernelSlab)); // Setup the temp region. - constexpr size_t TempRegionSize = 128_MiB; - constexpr size_t TempRegionAlign = KernelAslrAlignment; + constexpr static size_t TempRegionSize = 128_MiB; + constexpr static size_t TempRegionAlign = KernelAslrAlignment; const VAddr temp_region_start = memory_layout->GetVirtualMemoryRegionTree().GetRandomAlignedRegion( TempRegionSize, TempRegionAlign, KMemoryRegionType_Kernel); @@ -656,7 +656,7 @@ struct KernelCore::Impl { ASSERT(linear_extents.GetEndAddress() != 0); // Setup the linear mapping region. - constexpr size_t LinearRegionAlign = 1_GiB; + constexpr static size_t LinearRegionAlign = 1_GiB; const PAddr aligned_linear_phys_start = Common::AlignDown(linear_extents.GetAddress(), LinearRegionAlign); const size_t linear_region_size = @@ -737,11 +737,11 @@ struct KernelCore::Impl { void InitializeHackSharedMemory() { // Setup memory regions for emulated processes // TODO(bunnei): These should not be hardcoded regions initialized within the kernel - constexpr std::size_t hid_size{0x40000}; - constexpr std::size_t font_size{0x1100000}; - constexpr std::size_t irs_size{0x8000}; - constexpr std::size_t time_size{0x1000}; - constexpr std::size_t hidbus_size{0x1000}; + constexpr static std::size_t hid_size{0x40000}; + constexpr static std::size_t font_size{0x1100000}; + constexpr static std::size_t irs_size{0x8000}; + constexpr static std::size_t time_size{0x1000}; + constexpr static std::size_t hidbus_size{0x1000}; hid_shared_mem = KSharedMemory::Create(system.Kernel()); font_shared_mem = KSharedMemory::Create(system.Kernel()); diff --git a/src/core/hle/kernel/process_capability.cpp b/src/core/hle/kernel/process_capability.cpp index 773319ad8..de322cbf9 100644 --- a/src/core/hle/kernel/process_capability.cpp +++ b/src/core/hle/kernel/process_capability.cpp @@ -306,7 +306,7 @@ Result ProcessCapabilities::HandleMapRegionFlags(u32 flags, KPageTable& page_tab } Result ProcessCapabilities::HandleInterruptFlags(u32 flags) { - constexpr u32 interrupt_ignore_value = 0x3FF; + constexpr static u32 interrupt_ignore_value = 0x3FF; const u32 interrupt0 = (flags >> 12) & 0x3FF; const u32 interrupt1 = (flags >> 22) & 0x3FF; diff --git a/src/core/hle/kernel/svc/svc_activity.cpp b/src/core/hle/kernel/svc/svc_activity.cpp index 1dcdb7a15..0fd1b3d4c 100644 --- a/src/core/hle/kernel/svc/svc_activity.cpp +++ b/src/core/hle/kernel/svc/svc_activity.cpp @@ -16,7 +16,7 @@ Result SetThreadActivity(Core::System& system, Handle thread_handle, thread_activity); // Validate the activity. - constexpr auto IsValidThreadActivity = [](ThreadActivity activity) { + constexpr static auto IsValidThreadActivity = [](ThreadActivity activity) { return activity == ThreadActivity::Runnable || activity == ThreadActivity::Paused; }; R_UNLESS(IsValidThreadActivity(thread_activity), ResultInvalidEnumValue); diff --git a/src/core/hle/kernel/svc/svc_info.cpp b/src/core/hle/kernel/svc/svc_info.cpp index ad56e2fe6..c30ba0295 100644 --- a/src/core/hle/kernel/svc/svc_info.cpp +++ b/src/core/hle/kernel/svc/svc_info.cpp @@ -193,7 +193,7 @@ Result GetInfo(Core::System& system, u64* result, InfoType info_id_type, Handle return ResultSuccess; case InfoType::ThreadTickCount: { - constexpr u64 num_cpus = 4; + constexpr static u64 num_cpus = 4; if (info_sub_id != 0xFFFFFFFFFFFFFFFF && info_sub_id >= num_cpus) { LOG_ERROR(Kernel_SVC, "Core count is out of range, expected {} but got {}", num_cpus, info_sub_id); diff --git a/src/core/hle/kernel/svc/svc_memory.cpp b/src/core/hle/kernel/svc/svc_memory.cpp index 21f818da6..7045c5e69 100644 --- a/src/core/hle/kernel/svc/svc_memory.cpp +++ b/src/core/hle/kernel/svc/svc_memory.cpp @@ -132,7 +132,7 @@ Result SetMemoryAttribute(Core::System& system, VAddr address, u64 size, u32 mas R_UNLESS((address < address + size), ResultInvalidCurrentMemory); // Validate the attribute and mask. - constexpr u32 SupportedMask = static_cast(MemoryAttribute::Uncached); + constexpr static u32 SupportedMask = static_cast(MemoryAttribute::Uncached); R_UNLESS((mask | attr) == mask, ResultInvalidCombination); R_UNLESS((mask | attr | SupportedMask) == SupportedMask, ResultInvalidCombination); diff --git a/src/core/hle/service/acc/acc.cpp b/src/core/hle/service/acc/acc.cpp index 6d1084fd1..5b87bb18c 100644 --- a/src/core/hle/service/acc/acc.cpp +++ b/src/core/hle/service/acc/acc.cpp @@ -871,7 +871,7 @@ void Module::Interface::StoreSaveDataThumbnailApplication(Kernel::HLERequestCont // TODO(ogniK): Check if application ID is zero on acc initialize. As we don't have a reliable // way of confirming things like the TID, we're going to assume a non zero value for the time // being. - constexpr u64 tid{1}; + constexpr static u64 tid{1}; StoreSaveDataThumbnail(ctx, uuid, tid); } diff --git a/src/core/hle/service/am/am.cpp b/src/core/hle/service/am/am.cpp index ebcf6e164..01f03effe 100644 --- a/src/core/hle/service/am/am.cpp +++ b/src/core/hle/service/am/am.cpp @@ -1086,7 +1086,7 @@ private: // We require a non-zero handle to be valid. Using 0xdeadbeef allows us to trace if this is // actually used anywhere - constexpr u64 handle = 0xdeadbeef; + constexpr static u64 handle = 0xdeadbeef; IPC::ResponseBuilder rb{ctx, 4}; rb.Push(ResultSuccess); @@ -1570,7 +1570,7 @@ void IApplicationFunctions::GetDisplayVersion(Kernel::HLERequestContext& ctx) { const auto& version = res.first->GetVersionString(); std::copy(version.begin(), version.end(), version_string.begin()); } else { - constexpr char default_version[]{"1.0.0"}; + constexpr static char default_version[]{"1.0.0"}; std::memcpy(version_string.data(), default_version, sizeof(default_version)); } @@ -1638,7 +1638,7 @@ void IApplicationFunctions::GetDesiredLanguage(Kernel::HLERequestContext& ctx) { void IApplicationFunctions::IsGamePlayRecordingSupported(Kernel::HLERequestContext& ctx) { LOG_WARNING(Service_AM, "(STUBBED) called"); - constexpr bool gameplay_recording_supported = false; + constexpr static bool gameplay_recording_supported = false; IPC::ResponseBuilder rb{ctx, 3}; rb.Push(ResultSuccess); diff --git a/src/core/hle/service/am/applets/applet_software_keyboard.cpp b/src/core/hle/service/am/applets/applet_software_keyboard.cpp index c18236045..962371a99 100644 --- a/src/core/hle/service/am/applets/applet_software_keyboard.cpp +++ b/src/core/hle/service/am/applets/applet_software_keyboard.cpp @@ -1180,7 +1180,7 @@ void SoftwareKeyboard::ReplyChangedStringV2() { .cursor_position{current_cursor_position}, }; - constexpr u8 flag = 0; + constexpr static u8 flag = 0; std::memcpy(reply.data() + REPLY_BASE_SIZE, current_text.data(), current_text.size() * sizeof(char16_t)); @@ -1204,7 +1204,7 @@ void SoftwareKeyboard::ReplyMovedCursorV2() { .cursor_position{current_cursor_position}, }; - constexpr u8 flag = 0; + constexpr static u8 flag = 0; std::memcpy(reply.data() + REPLY_BASE_SIZE, current_text.data(), current_text.size() * sizeof(char16_t)); @@ -1232,7 +1232,7 @@ void SoftwareKeyboard::ReplyChangedStringUtf8V2() { .cursor_position{current_cursor_position}, }; - constexpr u8 flag = 0; + constexpr static u8 flag = 0; std::memcpy(reply.data() + REPLY_BASE_SIZE, utf8_current_text.data(), utf8_current_text.size()); std::memcpy(reply.data() + REPLY_BASE_SIZE + REPLY_UTF8_SIZE, &changed_string_arg, @@ -1257,7 +1257,7 @@ void SoftwareKeyboard::ReplyMovedCursorUtf8V2() { .cursor_position{current_cursor_position}, }; - constexpr u8 flag = 0; + constexpr static u8 flag = 0; std::memcpy(reply.data() + REPLY_BASE_SIZE, utf8_current_text.data(), utf8_current_text.size()); std::memcpy(reply.data() + REPLY_BASE_SIZE + REPLY_UTF8_SIZE, &moved_cursor_arg, diff --git a/src/core/hle/service/apm/apm_controller.cpp b/src/core/hle/service/apm/apm_controller.cpp index d6de84066..7236f586d 100644 --- a/src/core/hle/service/apm/apm_controller.cpp +++ b/src/core/hle/service/apm/apm_controller.cpp @@ -56,7 +56,7 @@ void Controller::SetPerformanceConfiguration(PerformanceMode mode, } void Controller::SetFromCpuBoostMode(CpuBoostMode mode) { - constexpr std::array BOOST_MODE_TO_CONFIG_MAP{{ + constexpr static std::array BOOST_MODE_TO_CONFIG_MAP{{ PerformanceConfiguration::Config7, PerformanceConfiguration::Config13, PerformanceConfiguration::Config15, diff --git a/src/core/hle/service/audio/audctl.cpp b/src/core/hle/service/audio/audctl.cpp index 5abf22ba4..654d2c493 100644 --- a/src/core/hle/service/audio/audctl.cpp +++ b/src/core/hle/service/audio/audctl.cpp @@ -77,7 +77,7 @@ void AudCtl::GetTargetVolumeMin(Kernel::HLERequestContext& ctx) { // This service function is currently hardcoded on the // actual console to this value (as of 8.0.0). - constexpr s32 target_min_volume = 0; + constexpr static s32 target_min_volume = 0; IPC::ResponseBuilder rb{ctx, 3}; rb.Push(ResultSuccess); @@ -89,7 +89,7 @@ void AudCtl::GetTargetVolumeMax(Kernel::HLERequestContext& ctx) { // This service function is currently hardcoded on the // actual console to this value (as of 8.0.0). - constexpr s32 target_max_volume = 15; + constexpr static s32 target_max_volume = 15; IPC::ResponseBuilder rb{ctx, 3}; rb.Push(ResultSuccess); diff --git a/src/core/hle/service/audio/hwopus.cpp b/src/core/hle/service/audio/hwopus.cpp index e01f87356..fe975157c 100644 --- a/src/core/hle/service/audio/hwopus.cpp +++ b/src/core/hle/service/audio/hwopus.cpp @@ -209,7 +209,7 @@ private: std::size_t WorkerBufferSize(u32 channel_count) { ASSERT_MSG(channel_count == 1 || channel_count == 2, "Invalid channel count"); - constexpr int num_streams = 1; + constexpr static int num_streams = 1; const int num_stereo_streams = channel_count == 2 ? 1 : 0; return opus_multistream_decoder_get_size(num_streams, num_stereo_streams); } diff --git a/src/core/hle/service/caps/caps_u.cpp b/src/core/hle/service/caps/caps_u.cpp index 5fbba8673..1c2694645 100644 --- a/src/core/hle/service/caps/caps_u.cpp +++ b/src/core/hle/service/caps/caps_u.cpp @@ -77,8 +77,8 @@ void CAPS_U::GetAlbumContentsFileListForApplication(Kernel::HLERequestContext& c // TODO: Update this when we implement the album. // Currently we do not have a method of accessing album entries, set this to 0 for now. - constexpr u32 total_entries_1{}; - constexpr u32 total_entries_2{}; + constexpr static u32 total_entries_1{}; + constexpr static u32 total_entries_2{}; LOG_WARNING( Service_Capture, diff --git a/src/core/hle/service/filesystem/fsp_srv.cpp b/src/core/hle/service/filesystem/fsp_srv.cpp index 447d624e1..f95ad9253 100644 --- a/src/core/hle/service/filesystem/fsp_srv.cpp +++ b/src/core/hle/service/filesystem/fsp_srv.cpp @@ -942,7 +942,7 @@ void FSP_SRV::ReadSaveDataFileSystemExtraDataWithMaskBySaveDataAttribute( const auto parameters = rp.PopRaw(); // Stub this to None for now, backend needs an impl to read/write the SaveDataExtraData - constexpr auto flags = static_cast(FileSys::SaveDataFlags::None); + constexpr static auto flags = static_cast(FileSys::SaveDataFlags::None); LOG_WARNING(Service_FS, "(STUBBED) called, flags={}, space_id={}, attribute.title_id={:016X}\n" diff --git a/src/core/hle/service/hid/controllers/npad.cpp b/src/core/hle/service/hid/controllers/npad.cpp index ba6f04d8d..f4485141c 100644 --- a/src/core/hle/service/hid/controllers/npad.cpp +++ b/src/core/hle/service/hid/controllers/npad.cpp @@ -439,7 +439,7 @@ void Controller_NPad::RequestPadStateUpdate(Core::HID::NpadIdType npad_id) { using btn = Core::HID::NpadButton; pad_entry.npad_buttons.raw = btn::None; if (controller_type != Core::HID::NpadStyleIndex::JoyconLeft) { - constexpr btn right_button_mask = btn::A | btn::B | btn::X | btn::Y | btn::StickR | btn::R | + constexpr static btn right_button_mask = btn::A | btn::B | btn::X | btn::Y | btn::StickR | btn::R | btn::ZR | btn::Plus | btn::StickRLeft | btn::StickRUp | btn::StickRRight | btn::StickRDown; pad_entry.npad_buttons.raw = button_state.raw & right_button_mask; @@ -447,7 +447,7 @@ void Controller_NPad::RequestPadStateUpdate(Core::HID::NpadIdType npad_id) { } if (controller_type != Core::HID::NpadStyleIndex::JoyconRight) { - constexpr btn left_button_mask = + constexpr static btn left_button_mask = btn::Left | btn::Up | btn::Right | btn::Down | btn::StickL | btn::L | btn::ZL | btn::Minus | btn::StickLLeft | btn::StickLUp | btn::StickLRight | btn::StickLDown; pad_entry.npad_buttons.raw |= button_state.raw & left_button_mask; @@ -759,7 +759,7 @@ Core::HID::NpadStyleTag Controller_NPad::GetSupportedStyleSet() const { } Result Controller_NPad::SetSupportedNpadIdTypes(std::span data) { - constexpr std::size_t max_number_npad_ids = 0xa; + constexpr static std::size_t max_number_npad_ids = 0xa; const auto length = data.size(); ASSERT(length > 0 && (length % sizeof(u32)) == 0); const std::size_t elements = length / sizeof(u32); diff --git a/src/core/hle/service/mii/mii_manager.cpp b/src/core/hle/service/mii/mii_manager.cpp index 3a2fe938f..a1b187b63 100644 --- a/src/core/hle/service/mii/mii_manager.cpp +++ b/src/core/hle/service/mii/mii_manager.cpp @@ -670,7 +670,7 @@ ResultVal> MiiManager::GetDefault(SourceFlag source_ } Result MiiManager::GetIndex([[maybe_unused]] const CharInfo& info, u32& index) { - constexpr u32 INVALID_INDEX{0xFFFFFFFF}; + constexpr static u32 INVALID_INDEX{0xFFFFFFFF}; index = INVALID_INDEX; diff --git a/src/core/hle/service/nfp/amiibo_crypto.cpp b/src/core/hle/service/nfp/amiibo_crypto.cpp index ffb2f959c..0d9c3d0f6 100644 --- a/src/core/hle/service/nfp/amiibo_crypto.cpp +++ b/src/core/hle/service/nfp/amiibo_crypto.cpp @@ -35,7 +35,7 @@ bool IsAmiiboValid(const EncryptedNTAG215File& ntag_file) { LOG_DEBUG(Service_NFP, "tag_CFG1=0x{0:x}", ntag_file.CFG1); // Validate UUID - constexpr u8 CT = 0x88; // As defined in `ISO / IEC 14443 - 3` + constexpr static u8 CT = 0x88; // As defined in `ISO / IEC 14443 - 3` if ((CT ^ ntag_file.uuid.uid[0] ^ ntag_file.uuid.uid[1] ^ ntag_file.uuid.uid[2]) != ntag_file.uuid.uid[3]) { return false; @@ -247,7 +247,7 @@ void Cipher(const DerivedKeys& keys, const NTAG215File& in_data, NTAG215File& ou mbedtls_aes_setkey_enc(&aes, keys.aes_key.data(), aes_key_size); memcpy(nonce_counter.data(), keys.aes_iv.data(), sizeof(keys.aes_iv)); - constexpr std::size_t encrypted_data_size = HMAC_TAG_START - SETTINGS_START; + constexpr static std::size_t encrypted_data_size = HMAC_TAG_START - SETTINGS_START; mbedtls_aes_crypt_ctr(&aes, encrypted_data_size, &nc_off, nonce_counter.data(), stream_block.data(), reinterpret_cast(&in_data.settings), @@ -317,13 +317,13 @@ bool DecodeAmiibo(const EncryptedNTAG215File& encrypted_tag_data, NTAG215File& t Cipher(data_keys, encoded_data, tag_data); // Regenerate tag HMAC. Note: order matters, data HMAC depends on tag HMAC! - constexpr std::size_t input_length = DYNAMIC_LOCK_START - UUID_START; + constexpr static std::size_t input_length = DYNAMIC_LOCK_START - UUID_START; mbedtls_md_hmac(mbedtls_md_info_from_type(MBEDTLS_MD_SHA256), tag_keys.hmac_key.data(), sizeof(HmacKey), reinterpret_cast(&tag_data.uid), input_length, reinterpret_cast(&tag_data.hmac_tag)); // Regenerate data HMAC - constexpr std::size_t input_length2 = DYNAMIC_LOCK_START - WRITE_COUNTER_START; + constexpr static std::size_t input_length2 = DYNAMIC_LOCK_START - WRITE_COUNTER_START; mbedtls_md_hmac(mbedtls_md_info_from_type(MBEDTLS_MD_SHA256), data_keys.hmac_key.data(), sizeof(HmacKey), reinterpret_cast(&tag_data.write_counter), input_length2, @@ -357,8 +357,8 @@ bool EncodeAmiibo(const NTAG215File& tag_data, EncryptedNTAG215File& encrypted_t NTAG215File encoded_tag_data{}; // Generate tag HMAC - constexpr std::size_t input_length = DYNAMIC_LOCK_START - UUID_START; - constexpr std::size_t input_length2 = HMAC_TAG_START - WRITE_COUNTER_START; + constexpr static std::size_t input_length = DYNAMIC_LOCK_START - UUID_START; + constexpr static std::size_t input_length2 = HMAC_TAG_START - WRITE_COUNTER_START; mbedtls_md_hmac(mbedtls_md_info_from_type(MBEDTLS_MD_SHA256), tag_keys.hmac_key.data(), sizeof(HmacKey), reinterpret_cast(&tag_data.uid), input_length, reinterpret_cast(&encoded_tag_data.hmac_tag)); diff --git a/src/core/hle/service/nifm/nifm.cpp b/src/core/hle/service/nifm/nifm.cpp index 5d32adf64..df4f60d59 100644 --- a/src/core/hle/service/nifm/nifm.cpp +++ b/src/core/hle/service/nifm/nifm.cpp @@ -512,7 +512,7 @@ void IGeneralService::GetInternetConnectionStatus(Kernel::HLERequestContext& ctx }; static_assert(sizeof(Output) == 0x3, "Output has incorrect size."); - constexpr Output out{}; + constexpr static Output out{}; IPC::ResponseBuilder rb{ctx, 3}; rb.Push(ResultSuccess); diff --git a/src/core/hle/service/nvdrv/core/syncpoint_manager.cpp b/src/core/hle/service/nvdrv/core/syncpoint_manager.cpp index aba51d280..1f0e05df6 100644 --- a/src/core/hle/service/nvdrv/core/syncpoint_manager.cpp +++ b/src/core/hle/service/nvdrv/core/syncpoint_manager.cpp @@ -9,8 +9,8 @@ namespace Service::Nvidia::NvCore { SyncpointManager::SyncpointManager(Tegra::Host1x::Host1x& host1x_) : host1x{host1x_} { - constexpr u32 VBlank0SyncpointId{26}; - constexpr u32 VBlank1SyncpointId{27}; + constexpr static u32 VBlank0SyncpointId{26}; + constexpr static u32 VBlank1SyncpointId{27}; // Reserve both vblank syncpoints as client managed as they use Continuous Mode // Refer to section 14.3.5.3 of the TRM for more information on Continuous Mode diff --git a/src/core/hle/service/nvflinger/buffer_queue_consumer.cpp b/src/core/hle/service/nvflinger/buffer_queue_consumer.cpp index 0767e548d..3f41aa0d9 100644 --- a/src/core/hle/service/nvflinger/buffer_queue_consumer.cpp +++ b/src/core/hle/service/nvflinger/buffer_queue_consumer.cpp @@ -45,7 +45,7 @@ Status BufferQueueConsumer::AcquireBuffer(BufferItem* out_buffer, // If expected_present is specified, we may not want to return a buffer yet. if (expected_present.count() != 0) { - constexpr auto MAX_REASONABLE_NSEC = 1000000000LL; // 1 second + constexpr static auto MAX_REASONABLE_NSEC = 1000000000LL; // 1 second // The expected_present argument indicates when the buffer is expected to be presented // on-screen. diff --git a/src/core/hle/service/olsc/olsc.cpp b/src/core/hle/service/olsc/olsc.cpp index 530e1be3b..fbae10e7d 100644 --- a/src/core/hle/service/olsc/olsc.cpp +++ b/src/core/hle/service/olsc/olsc.cpp @@ -55,7 +55,7 @@ private: LOG_WARNING(Service_OLSC, "(STUBBED) called"); // backup_setting is set to 0 since real value is unknown - constexpr u64 backup_setting = 0; + constexpr static u64 backup_setting = 0; IPC::ResponseBuilder rb{ctx, 4}; rb.Push(ResultSuccess); diff --git a/src/core/hle/service/prepo/prepo.cpp b/src/core/hle/service/prepo/prepo.cpp index 01040b32a..155d6a00b 100644 --- a/src/core/hle/service/prepo/prepo.cpp +++ b/src/core/hle/service/prepo/prepo.cpp @@ -116,7 +116,7 @@ private: void GetTransmissionStatus(Kernel::HLERequestContext& ctx) { LOG_WARNING(Service_PREPO, "(STUBBED) called"); - constexpr s32 status = 0; + constexpr static s32 status = 0; IPC::ResponseBuilder rb{ctx, 3}; rb.Push(ResultSuccess); @@ -126,7 +126,7 @@ private: void GetSystemSessionId(Kernel::HLERequestContext& ctx) { LOG_WARNING(Service_PREPO, "(STUBBED) called"); - constexpr u64 system_session_id = 0; + constexpr static u64 system_session_id = 0; IPC::ResponseBuilder rb{ctx, 4}; rb.Push(ResultSuccess); rb.Push(system_session_id); diff --git a/src/core/hle/service/sockets/sfdnsres.cpp b/src/core/hle/service/sockets/sfdnsres.cpp index e96eda7f3..831a51a67 100644 --- a/src/core/hle/service/sockets/sfdnsres.cpp +++ b/src/core/hle/service/sockets/sfdnsres.cpp @@ -92,7 +92,7 @@ static std::vector SerializeAddrInfo(const addrinfo* addrinfo, s32 result_co static_assert(sizeof(SerializedResponseHeader) == 0x18, "Response header size must be 0x18 bytes"); - constexpr auto header_size = sizeof(SerializedResponseHeader); + constexpr static auto header_size = sizeof(SerializedResponseHeader); const auto addr_size = current->ai_addr && current->ai_addrlen > 0 ? current->ai_addrlen : 4; const auto canonname_size = current->ai_canonname ? strlen(current->ai_canonname) + 1 : 1; @@ -103,7 +103,7 @@ static std::vector SerializeAddrInfo(const addrinfo* addrinfo, s32 result_co // Header in network byte order SerializedResponseHeader header{}; - constexpr auto HEADER_MAGIC = 0xBEEFCAFE; + constexpr static auto HEADER_MAGIC = 0xBEEFCAFE; header.magic = htonl(HEADER_MAGIC); header.family = htonl(current->ai_family); header.flags = htonl(current->ai_flags); diff --git a/src/core/hle/service/ssl/ssl.cpp b/src/core/hle/service/ssl/ssl.cpp index dcf47083f..ceb491224 100644 --- a/src/core/hle/service/ssl/ssl.cpp +++ b/src/core/hle/service/ssl/ssl.cpp @@ -103,7 +103,7 @@ private: const auto certificate_format = rp.PopEnum(); [[maybe_unused]] const auto pkcs_12_certificates = ctx.ReadBuffer(0); - constexpr u64 server_id = 0; + constexpr static u64 server_id = 0; LOG_WARNING(Service_SSL, "(STUBBED) called, certificate_format={}", certificate_format); @@ -122,7 +122,7 @@ private: return std::span{}; }(); - constexpr u64 client_id = 0; + constexpr static u64 client_id = 0; LOG_WARNING(Service_SSL, "(STUBBED) called"); diff --git a/src/core/hle/service/time/time_zone_manager.cpp b/src/core/hle/service/time/time_zone_manager.cpp index f9ada7c93..7b94b33f7 100644 --- a/src/core/hle/service/time/time_zone_manager.cpp +++ b/src/core/hle/service/time/time_zone_manager.cpp @@ -286,7 +286,7 @@ static constexpr int TransitionTime(int year, Rule rule, int offset) { } static bool ParsePosixName(const char* name, TimeZoneRule& rule) { - constexpr char default_rule[]{",M4.1.0,M10.5.0"}; + constexpr static char default_rule[]{",M4.1.0,M10.5.0"}; const char* std_name{name}; int std_len{}; int offset{}; @@ -512,8 +512,8 @@ static bool ParseTimeZoneBinary(TimeZoneRule& time_zone_rule, FileSys::VirtualFi return {}; } - constexpr s32 time_zone_max_leaps{50}; - constexpr s32 time_zone_max_chars{50}; + constexpr static s32 time_zone_max_leaps{50}; + constexpr static s32 time_zone_max_chars{50}; if (!(0 <= header.leap_count && header.leap_count < time_zone_max_leaps && 0 < header.type_count && header.type_count < s32(time_zone_rule.ttis.size()) && 0 <= header.time_count && header.time_count < s32(time_zone_rule.ats.size()) && @@ -610,7 +610,7 @@ static bool ParseTimeZoneBinary(TimeZoneRule& time_zone_rule, FileSys::VirtualFi if (bytes_read < 0) { return {}; } - constexpr s32 time_zone_name_max{255}; + constexpr static s32 time_zone_name_max{255}; if (bytes_read > (time_zone_name_max + 1)) { return {}; } diff --git a/src/core/hle/service/vi/vi.cpp b/src/core/hle/service/vi/vi.cpp index 2fb631183..66c8fd38a 100644 --- a/src/core/hle/service/vi/vi.cpp +++ b/src/core/hle/service/vi/vi.cpp @@ -725,8 +725,8 @@ private: // TODO: Figure out what these are - constexpr s64 unknown_result_1 = 0; - constexpr s64 unknown_result_2 = 0; + constexpr static s64 unknown_result_1 = 0; + constexpr static s64 unknown_result_2 = 0; IPC::ResponseBuilder rb{ctx, 6}; rb.Push(unknown_result_1); @@ -740,8 +740,8 @@ private: const auto height = rp.Pop(); LOG_DEBUG(Service_VI, "called width={}, height={}", width, height); - constexpr u64 base_size = 0x20000; - constexpr u64 alignment = 0x1000; + constexpr static u64 base_size = 0x20000; + constexpr static u64 alignment = 0x1000; const auto texture_size = width * height * 4; const auto out_size = (texture_size + base_size - 1) / base_size * base_size; diff --git a/src/core/perf_stats.cpp b/src/core/perf_stats.cpp index f09c176f8..9cf361986 100644 --- a/src/core/perf_stats.cpp +++ b/src/core/perf_stats.cpp @@ -121,7 +121,7 @@ PerfStatsResults PerfStats::GetAndResetStats(microseconds current_system_time_us double PerfStats::GetLastFrameTimeScale() const { std::scoped_lock lock{object_mutex}; - constexpr double FRAME_LENGTH = 1.0 / 60; + constexpr static double FRAME_LENGTH = 1.0 / 60; return duration_cast(previous_frame_length).count() / FRAME_LENGTH; } diff --git a/src/core/telemetry_session.cpp b/src/core/telemetry_session.cpp index 8d5f2be2f..3bcdd9a99 100644 --- a/src/core/telemetry_session.cpp +++ b/src/core/telemetry_session.cpp @@ -34,7 +34,7 @@ static u64 GenerateTelemetryId() { mbedtls_entropy_context entropy; mbedtls_entropy_init(&entropy); mbedtls_ctr_drbg_context ctr_drbg; - constexpr std::array personalization{{"yuzu Telemetry ID"}}; + constexpr static std::array personalization{{"yuzu Telemetry ID"}}; mbedtls_ctr_drbg_init(&ctr_drbg); ASSERT(mbedtls_ctr_drbg_seed(&ctr_drbg, mbedtls_entropy_func, &entropy, @@ -225,7 +225,7 @@ void TelemetrySession::AddInitialInfo(Loader::AppLoader& app_loader, Telemetry::AppendOSInfo(field_collection); // Log user configuration information - constexpr auto field_type = Telemetry::FieldType::UserConfig; + constexpr static auto field_type = Telemetry::FieldType::UserConfig; AddField(field_type, "Audio_SinkId", Settings::values.sink_id.GetValue()); AddField(field_type, "Core_UseMultiCore", Settings::values.use_multi_core.GetValue()); AddField(field_type, "Renderer_Backend", diff --git a/src/input_common/drivers/gc_adapter.cpp b/src/input_common/drivers/gc_adapter.cpp index d09ff178b..a4faab15e 100644 --- a/src/input_common/drivers/gc_adapter.cpp +++ b/src/input_common/drivers/gc_adapter.cpp @@ -223,8 +223,8 @@ void GCAdapter::AdapterScanThread(std::stop_token stop_token) { } bool GCAdapter::Setup() { - constexpr u16 nintendo_vid = 0x057e; - constexpr u16 gc_adapter_pid = 0x0337; + constexpr static u16 nintendo_vid = 0x057e; + constexpr static u16 gc_adapter_pid = 0x0337; usb_adapter_handle = std::make_unique(libusb_ctx->get(), nintendo_vid, gc_adapter_pid); if (!usb_adapter_handle->get()) { @@ -346,7 +346,7 @@ void GCAdapter::UpdateVibrations() { // Use 8 states to keep the switching between on/off fast enough for // a human to feel different vibration strenght // More states == more rumble strengths == slower update time - constexpr u8 vibration_states = 8; + constexpr static u8 vibration_states = 8; vibration_counter = (vibration_counter + 1) % vibration_states; @@ -363,7 +363,7 @@ void GCAdapter::SendVibrations() { return; } s32 size{}; - constexpr u8 rumble_command = 0x11; + constexpr static u8 rumble_command = 0x11; const u8 p1 = pads[0].enable_vibration; const u8 p2 = pads[1].enable_vibration; const u8 p3 = pads[2].enable_vibration; diff --git a/src/input_common/drivers/joycon.cpp b/src/input_common/drivers/joycon.cpp index afc33db57..a93bb5c25 100644 --- a/src/input_common/drivers/joycon.cpp +++ b/src/input_common/drivers/joycon.cpp @@ -77,7 +77,7 @@ void Joycons::Setup() { } void Joycons::ScanThread(std::stop_token stop_token) { - constexpr u16 nintendo_vendor_id = 0x057e; + constexpr static u16 nintendo_vendor_id = 0x057e; Common::SetCurrentThreadName("JoyconScanThread"); do { @@ -390,7 +390,7 @@ void Joycons::OnMotionUpdate(std::size_t port, Joycon::ControllerType type, int void Joycons::OnRingConUpdate(f32 ring_data) { // To simplify ring detection it will always be mapped to an empty identifier for all // controllers - constexpr PadIdentifier identifier = { + constexpr static PadIdentifier identifier = { .guid = Common::UUID{}, .port = 0, .pad = 0, diff --git a/src/input_common/drivers/mouse.cpp b/src/input_common/drivers/mouse.cpp index faf9cbdc3..dfa93d58a 100644 --- a/src/input_common/drivers/mouse.cpp +++ b/src/input_common/drivers/mouse.cpp @@ -37,7 +37,7 @@ Mouse::Mouse(std::string input_engine_) : InputEngine(std::move(input_engine_)) void Mouse::UpdateThread(std::stop_token stop_token) { Common::SetCurrentThreadName("Mouse"); - constexpr int update_time = 10; + constexpr static int update_time = 10; while (!stop_token.stop_requested()) { if (Settings::values.mouse_panning && !Settings::values.mouse_enabled) { // Slow movement by 4% diff --git a/src/input_common/drivers/sdl_driver.cpp b/src/input_common/drivers/sdl_driver.cpp index 88cacd615..53ebae2d6 100644 --- a/src/input_common/drivers/sdl_driver.cpp +++ b/src/input_common/drivers/sdl_driver.cpp @@ -63,7 +63,7 @@ public: } bool UpdateMotion(SDL_ControllerSensorEvent event) { - constexpr float gravity_constant = 9.80665f; + constexpr static float gravity_constant = 9.80665f; std::scoped_lock lock{mutex}; const u64 time_difference = event.timestamp - last_motion_update; last_motion_update = event.timestamp; @@ -109,7 +109,7 @@ public: } bool RumblePlay(const Common::Input::VibrationStatus vibration) { - constexpr u32 rumble_max_duration_ms = 1000; + constexpr static u32 rumble_max_duration_ms = 1000; if (sdl_controller) { return SDL_GameControllerRumble( sdl_controller.get(), static_cast(vibration.low_amplitude), @@ -616,7 +616,7 @@ bool SDLDriver::IsVibrationEnabled(const PadIdentifier& identifier) { const auto joystick = GetSDLJoystickByGUID(identifier.guid.RawString(), static_cast(identifier.port)); - constexpr Common::Input::VibrationStatus test_vibration{ + constexpr static Common::Input::VibrationStatus test_vibration{ .low_amplitude = 1, .low_frequency = 160.0f, .high_amplitude = 1, @@ -624,7 +624,7 @@ bool SDLDriver::IsVibrationEnabled(const PadIdentifier& identifier) { .type = Common::Input::VibrationAmplificationType::Exponential, }; - constexpr Common::Input::VibrationStatus zero_vibration{ + constexpr static Common::Input::VibrationStatus zero_vibration{ .low_amplitude = 0, .low_frequency = 160.0f, .high_amplitude = 0, diff --git a/src/input_common/drivers/udp_client.cpp b/src/input_common/drivers/udp_client.cpp index 808b21069..ae49f0478 100644 --- a/src/input_common/drivers/udp_client.cpp +++ b/src/input_common/drivers/udp_client.cpp @@ -599,7 +599,7 @@ CalibrationConfigurationJob::CalibrationConfigurationJob( Status current_status{Status::Initialized}; SocketCallback callback{[](Response::Version) {}, [](Response::PortInfo) {}, [&](Response::PadData data) { - constexpr u16 CALIBRATION_THRESHOLD = 100; + constexpr static u16 CALIBRATION_THRESHOLD = 100; if (current_status == Status::Initialized) { // Receiving data means the communication is ready now diff --git a/src/input_common/helpers/joycon_driver.cpp b/src/input_common/helpers/joycon_driver.cpp index e65b6b845..6ab16cde6 100644 --- a/src/input_common/helpers/joycon_driver.cpp +++ b/src/input_common/helpers/joycon_driver.cpp @@ -129,7 +129,7 @@ void JoyconDriver::InputThread(std::stop_token stop_token) { input_thread_running = true; // Max update rate is 5ms, ensure we are always able to read a bit faster - constexpr int ThreadDelay = 2; + constexpr static int ThreadDelay = 2; std::vector buffer(MaxBufferSize); while (!stop_token.stop_requested()) { @@ -548,7 +548,7 @@ DriverResult JoyconDriver::GetDeviceType(SDL_hid_device_info* device_info, {0x2007, ControllerType::Right}, {0x2009, ControllerType::Pro}, }; - constexpr u16 nintendo_vendor_id = 0x057e; + constexpr static u16 nintendo_vendor_id = 0x057e; controller_type = ControllerType::None; if (device_info->vendor_id != nintendo_vendor_id) { diff --git a/src/input_common/helpers/joycon_protocol/calibration.cpp b/src/input_common/helpers/joycon_protocol/calibration.cpp index d8f040f75..69e3379cf 100644 --- a/src/input_common/helpers/joycon_protocol/calibration.cpp +++ b/src/input_common/helpers/joycon_protocol/calibration.cpp @@ -129,7 +129,7 @@ DriverResult CalibrationProtocol::GetImuCalibration(MotionCalibration& calibrati DriverResult CalibrationProtocol::GetRingCalibration(RingCalibration& calibration, s16 current_value) { - constexpr s16 DefaultRingRange{800}; + constexpr static s16 DefaultRingRange{800}; // TODO: Get default calibration form ring itself if (ring_data_max == 0 && ring_data_min == 0) { @@ -168,8 +168,8 @@ u16 CalibrationProtocol::GetYAxisCalibrationValue(std::span block) const { } void CalibrationProtocol::ValidateCalibration(JoyStickCalibration& calibration) { - constexpr u16 DefaultStickCenter{0x800}; - constexpr u16 DefaultStickRange{0x6cc}; + constexpr static u16 DefaultStickCenter{0x800}; + constexpr static u16 DefaultStickRange{0x6cc}; calibration.x.center = ValidateValue(calibration.x.center, DefaultStickCenter); calibration.x.max = ValidateValue(calibration.x.max, DefaultStickRange); @@ -181,9 +181,9 @@ void CalibrationProtocol::ValidateCalibration(JoyStickCalibration& calibration) } void CalibrationProtocol::ValidateCalibration(MotionCalibration& calibration) { - constexpr s16 DefaultAccelerometerScale{0x4000}; - constexpr s16 DefaultGyroScale{0x3be7}; - constexpr s16 DefaultOffset{0}; + constexpr static s16 DefaultAccelerometerScale{0x4000}; + constexpr static s16 DefaultGyroScale{0x3be7}; + constexpr static s16 DefaultOffset{0}; for (auto& sensor : calibration.accelerometer) { sensor.scale = ValidateValue(sensor.scale, DefaultAccelerometerScale); diff --git a/src/input_common/helpers/joycon_protocol/common_protocol.cpp b/src/input_common/helpers/joycon_protocol/common_protocol.cpp index 2b42a4555..95c3923b0 100644 --- a/src/input_common/helpers/joycon_protocol/common_protocol.cpp +++ b/src/input_common/helpers/joycon_protocol/common_protocol.cpp @@ -72,8 +72,8 @@ DriverResult JoyconCommonProtocol::SendRawData(std::span buffer) { DriverResult JoyconCommonProtocol::GetSubCommandResponse(SubCommand sc, SubCommandResponse& output) { - constexpr int timeout_mili = 66; - constexpr int MaxTries = 15; + constexpr static int timeout_mili = 66; + constexpr static int MaxTries = 15; int tries = 0; do { @@ -157,8 +157,8 @@ DriverResult JoyconCommonProtocol::SendVibrationReport(std::span buffe } DriverResult JoyconCommonProtocol::ReadRawSPI(SpiAddress addr, std::span output) { - constexpr std::size_t HeaderSize = 5; - constexpr std::size_t MaxTries = 10; + constexpr static std::size_t HeaderSize = 5; + constexpr static std::size_t MaxTries = 10; std::size_t tries = 0; SubCommandResponse response{}; std::array buffer{}; @@ -216,8 +216,8 @@ DriverResult JoyconCommonProtocol::ConfigureMCU(const MCUConfig& config) { DriverResult JoyconCommonProtocol::GetMCUDataResponse(ReportMode report_mode, MCUCommandResponse& output) { - constexpr int TimeoutMili = 200; - constexpr int MaxTries = 9; + constexpr static int TimeoutMili = 200; + constexpr static int MaxTries = 9; int tries = 0; do { @@ -265,7 +265,7 @@ DriverResult JoyconCommonProtocol::SendMCUData(ReportMode report_mode, SubComman DriverResult JoyconCommonProtocol::WaitSetMCUMode(ReportMode report_mode, MCUMode mode) { MCUCommandResponse output{}; - constexpr std::size_t MaxTries{8}; + constexpr static std::size_t MaxTries{8}; std::size_t tries{}; do { diff --git a/src/input_common/helpers/joycon_protocol/irs.cpp b/src/input_common/helpers/joycon_protocol/irs.cpp index 731fd5981..5c07f698b 100644 --- a/src/input_common/helpers/joycon_protocol/irs.cpp +++ b/src/input_common/helpers/joycon_protocol/irs.cpp @@ -131,7 +131,7 @@ DriverResult IrsProtocol::RequestImage(std::span buffer) { DriverResult IrsProtocol::ConfigureIrs() { LOG_DEBUG(Input, "Configure IRS"); - constexpr std::size_t max_tries = 28; + constexpr static std::size_t max_tries = 28; SubCommandResponse output{}; std::size_t tries = 0; @@ -166,7 +166,7 @@ DriverResult IrsProtocol::ConfigureIrs() { DriverResult IrsProtocol::WriteRegistersStep1() { LOG_DEBUG(Input, "WriteRegistersStep1"); DriverResult result{DriverResult::Success}; - constexpr std::size_t max_tries = 28; + constexpr static std::size_t max_tries = 28; SubCommandResponse output{}; std::size_t tries = 0; @@ -226,7 +226,7 @@ DriverResult IrsProtocol::WriteRegistersStep1() { DriverResult IrsProtocol::WriteRegistersStep2() { LOG_DEBUG(Input, "WriteRegistersStep2"); - constexpr std::size_t max_tries = 28; + constexpr static std::size_t max_tries = 28; SubCommandResponse output{}; std::size_t tries = 0; diff --git a/src/input_common/helpers/joycon_protocol/nfc.cpp b/src/input_common/helpers/joycon_protocol/nfc.cpp index eeba82986..6b8f38aec 100644 --- a/src/input_common/helpers/joycon_protocol/nfc.cpp +++ b/src/input_common/helpers/joycon_protocol/nfc.cpp @@ -109,7 +109,7 @@ bool NfcProtocol::HasAmiibo() { } DriverResult NfcProtocol::WaitUntilNfcIsReady() { - constexpr std::size_t timeout_limit = 10; + constexpr static std::size_t timeout_limit = 10; MCUCommandResponse output{}; std::size_t tries = 0; @@ -131,7 +131,7 @@ DriverResult NfcProtocol::WaitUntilNfcIsReady() { DriverResult NfcProtocol::StartPolling(TagFoundData& data) { LOG_DEBUG(Input, "Start Polling for tag"); - constexpr std::size_t timeout_limit = 7; + constexpr static std::size_t timeout_limit = 7; MCUCommandResponse output{}; std::size_t tries = 0; @@ -155,7 +155,7 @@ DriverResult NfcProtocol::StartPolling(TagFoundData& data) { } DriverResult NfcProtocol::ReadTag(const TagFoundData& data) { - constexpr std::size_t timeout_limit = 10; + constexpr static std::size_t timeout_limit = 10; MCUCommandResponse output{}; std::size_t tries = 0; @@ -224,7 +224,7 @@ DriverResult NfcProtocol::ReadTag(const TagFoundData& data) { } DriverResult NfcProtocol::GetAmiiboData(std::vector& ntag_data) { - constexpr std::size_t timeout_limit = 10; + constexpr static std::size_t timeout_limit = 10; MCUCommandResponse output{}; std::size_t tries = 0; diff --git a/src/input_common/helpers/joycon_protocol/ringcon.cpp b/src/input_common/helpers/joycon_protocol/ringcon.cpp index 190cef812..9056e64dc 100644 --- a/src/input_common/helpers/joycon_protocol/ringcon.cpp +++ b/src/input_common/helpers/joycon_protocol/ringcon.cpp @@ -69,7 +69,7 @@ DriverResult RingConProtocol::StartRingconPolling() { DriverResult RingConProtocol::IsRingConnected(bool& is_connected) { LOG_DEBUG(Input, "IsRingConnected"); - constexpr std::size_t max_tries = 28; + constexpr static std::size_t max_tries = 28; SubCommandResponse output{}; std::size_t tries = 0; is_connected = false; diff --git a/src/shader_recompiler/backend/glsl/emit_glsl_integer.cpp b/src/shader_recompiler/backend/glsl/emit_glsl_integer.cpp index 49397c9b2..06599c1b0 100644 --- a/src/shader_recompiler/backend/glsl/emit_glsl_integer.cpp +++ b/src/shader_recompiler/backend/glsl/emit_glsl_integer.cpp @@ -39,7 +39,7 @@ void EmitIAdd32(EmitContext& ctx, IR::Inst& inst, std::string_view a, std::strin // which may be overwritten by the result of the addition if (IR::Inst * overflow{inst.GetAssociatedPseudoOperation(IR::Opcode::GetOverflowFromOp)}) { // https://stackoverflow.com/questions/55468823/how-to-detect-integer-overflow-in-c - constexpr u32 s32_max{static_cast(std::numeric_limits::max())}; + constexpr static u32 s32_max{static_cast(std::numeric_limits::max())}; const auto sub_a{fmt::format("{}u-{}", s32_max, a)}; const auto positive_result{fmt::format("int({})>int({})", b, sub_a)}; const auto negative_result{fmt::format("int({})GetAssociatedPseudoOperation(IR::Opcode::GetOverflowFromOp)}) { // https://stackoverflow.com/questions/55468823/how-to-detect-integer-overflow-in-c - constexpr u32 s32_max{static_cast(std::numeric_limits::max())}; + constexpr static u32 s32_max{static_cast(std::numeric_limits::max())}; const Id is_positive{ctx.OpSGreaterThanEqual(ctx.U1, a, ctx.u32_zero_value)}; const Id sub_a{ctx.OpISub(ctx.U32[1], ctx.Const(s32_max), a)}; diff --git a/src/shader_recompiler/frontend/maxwell/translate/impl/floating_point_conversion_floating_point.cpp b/src/shader_recompiler/frontend/maxwell/translate/impl/floating_point_conversion_floating_point.cpp index 7f3dccc52..15ad55a43 100644 --- a/src/shader_recompiler/frontend/maxwell/translate/impl/floating_point_conversion_floating_point.cpp +++ b/src/shader_recompiler/frontend/maxwell/translate/impl/floating_point_conversion_floating_point.cpp @@ -48,7 +48,7 @@ void F2F(TranslatorVisitor& v, u64 insn, const IR::F16F32F64& src_a, bool abs) { BitField<8, 2, FloatFormat> dst_size; [[nodiscard]] RoundingOp RoundingOperation() const { - constexpr u64 rounding_mask = 0x0B; + constexpr static u64 rounding_mask = 0x0B; return static_cast(rounding_op.Value() & rounding_mask); } } const f2f{insn}; diff --git a/src/shader_recompiler/frontend/maxwell/translate/impl/floating_point_conversion_integer.cpp b/src/shader_recompiler/frontend/maxwell/translate/impl/floating_point_conversion_integer.cpp index 85c18d942..429733187 100644 --- a/src/shader_recompiler/frontend/maxwell/translate/impl/floating_point_conversion_integer.cpp +++ b/src/shader_recompiler/frontend/maxwell/translate/impl/floating_point_conversion_integer.cpp @@ -176,11 +176,11 @@ void TranslateF2I(TranslatorVisitor& v, u64 insn, const IR::F16F32F64& src_a) { (f2i.src_format == SrcFormat::F64) != (f2i.dest_format == DestFormat::I64); if (special_nan_cases) { if (f2i.dest_format == DestFormat::I32) { - constexpr u32 nan_value = 0x8000'0000U; + constexpr static u32 nan_value = 0x8000'0000U; handled_special_case = true; result = IR::U32{v.ir.Select(v.ir.FPIsNan(op_a), v.ir.Imm32(nan_value), result)}; } else if (f2i.dest_format == DestFormat::I64) { - constexpr u64 nan_value = 0x8000'0000'0000'0000ULL; + constexpr static u64 nan_value = 0x8000'0000'0000'0000ULL; handled_special_case = true; result = IR::U64{v.ir.Select(v.ir.FPIsNan(op_a), v.ir.Imm64(nan_value), result)}; } diff --git a/src/shader_recompiler/frontend/maxwell/translate/impl/integer_add_three_input.cpp b/src/shader_recompiler/frontend/maxwell/translate/impl/integer_add_three_input.cpp index 3d9877359..3c8ef62e2 100644 --- a/src/shader_recompiler/frontend/maxwell/translate/impl/integer_add_three_input.cpp +++ b/src/shader_recompiler/frontend/maxwell/translate/impl/integer_add_three_input.cpp @@ -19,7 +19,7 @@ enum class Half : u64 { }; [[nodiscard]] IR::U32 IntegerHalf(IR::IREmitter& ir, const IR::U32& value, Half half) { - constexpr bool is_signed{false}; + constexpr static bool is_signed{false}; switch (half) { case Half::All: return value; diff --git a/src/tests/common/fibers.cpp b/src/tests/common/fibers.cpp index ecad7583f..c0b22d0ee 100644 --- a/src/tests/common/fibers.cpp +++ b/src/tests/common/fibers.cpp @@ -76,7 +76,7 @@ void TestControl1::ExecuteThread(u32 id) { * doing all the work required. */ TEST_CASE("Fibers::Setup", "[common]") { - constexpr std::size_t num_threads = 7; + constexpr static std::size_t num_threads = 7; TestControl1 test_control{}; test_control.thread_fibers.resize(num_threads); test_control.work_fibers.resize(num_threads); diff --git a/src/tests/input_common/calibration_configuration_job.cpp b/src/tests/input_common/calibration_configuration_job.cpp index 516ff1b30..8d3951ee6 100644 --- a/src/tests/input_common/calibration_configuration_job.cpp +++ b/src/tests/input_common/calibration_configuration_job.cpp @@ -35,8 +35,8 @@ public: } void Run(const std::vector touch_movement_path) { - constexpr size_t HeaderSize = sizeof(InputCommon::CemuhookUDP::Header); - constexpr size_t PadDataSize = + constexpr static size_t HeaderSize = sizeof(InputCommon::CemuhookUDP::Header); + constexpr static size_t PadDataSize = sizeof(InputCommon::CemuhookUDP::Message); REQUIRE(touch_movement_path.size() > 0); diff --git a/src/video_core/buffer_cache/buffer_cache.h b/src/video_core/buffer_cache/buffer_cache.h index 627917ab6..b650d0e59 100644 --- a/src/video_core/buffer_cache/buffer_cache.h +++ b/src/video_core/buffer_cache/buffer_cache.h @@ -890,8 +890,8 @@ void BufferCache

::CommitAsyncFlushesHigh() { buffer_id, }); // Align up to avoid cache conflicts - constexpr u64 align = 8ULL; - constexpr u64 mask = ~(align - 1ULL); + constexpr static u64 align = 8ULL; + constexpr static u64 mask = ~(align - 1ULL); total_size_bytes += (new_size + align - 1) & mask; largest_copy = std::max(largest_copy, new_size); }; @@ -1843,8 +1843,8 @@ void BufferCache

::DownloadBufferMemory(Buffer& buffer, VAddr cpu_addr, u64 si .size = new_size, }); // Align up to avoid cache conflicts - constexpr u64 align = 256ULL; - constexpr u64 mask = ~(align - 1ULL); + constexpr static u64 align = 256ULL; + constexpr static u64 mask = ~(align - 1ULL); total_size_bytes += (new_size + align - 1) & mask; largest_copy = std::max(largest_copy, new_size); }; diff --git a/src/video_core/dma_pusher.cpp b/src/video_core/dma_pusher.cpp index 551929824..72ad3ccc8 100644 --- a/src/video_core/dma_pusher.cpp +++ b/src/video_core/dma_pusher.cpp @@ -75,7 +75,7 @@ bool DmaPusher::Step() { // Push buffer non-empty, read a word command_headers.resize_destructive(command_list_header.size); - constexpr u32 MacroRegistersStart = 0xE00; + constexpr static u32 MacroRegistersStart = 0xE00; if (dma_state.method < MacroRegistersStart) { if (Settings::IsGPULevelHigh()) { memory_manager.ReadBlock(dma_state.dma_get, command_headers.data(), 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() { UNIMPLEMENTED_IF_MSG(regs.clip_enable != 0, "Clipped blit enabled"); const auto& args = regs.pixels_from_memory; - constexpr s64 null_derivate = 1ULL << 32; + constexpr static s64 null_derivate = 1ULL << 32; Surface src = regs.src; const auto bytes_per_pixel = BytesPerBlock(PixelFormatFromRenderTargetFormat(src.format)); 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() { size_t Maxwell3D::EstimateIndexBufferSize() { GPUVAddr start_address = regs.index_buffer.StartAddress(); GPUVAddr end_address = regs.index_buffer.EndAddress(); - constexpr std::array max_sizes = { + constexpr static std::array max_sizes = { std::numeric_limits::max(), std::numeric_limits::max(), std::numeric_limits::max(), std::numeric_limits::max()}; 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: }; const auto force_to_fp16 = [](f32 base_value) { u32 tmp = Common::BitCast(base_value); - constexpr size_t fp32_mantissa_bits = 23; - constexpr size_t fp16_mantissa_bits = 10; - constexpr size_t mantissa_mask = + constexpr static size_t fp32_mantissa_bits = 23; + constexpr static size_t fp16_mantissa_bits = 10; + constexpr static size_t mantissa_mask = ~((1ULL << (fp32_mantissa_bits - fp16_mantissa_bits)) - 1ULL); tmp = tmp & static_cast(mantissa_mask); // TODO: force the exponent within the range of half float. Not needed in UNORM / SNORM return Common::BitCast(tmp); }; const auto from_fp_n = [&sign_extend](u32 base_value, size_t bits, size_t mantissa) { - constexpr size_t fp32_mantissa_bits = 23; + constexpr static size_t fp32_mantissa_bits = 23; size_t shift_towards = fp32_mantissa_bits - mantissa; const u32 new_value = static_cast(sign_extend(base_value, bits) << shift_towards) & (~(1U << 31)); @@ -770,7 +770,7 @@ private: component_mask[which_component]; }; const auto to_fp_n = [](f32 base_value, size_t bits, size_t mantissa) { - constexpr size_t fp32_mantissa_bits = 23; + constexpr static size_t fp32_mantissa_bits = 23; u32 tmp_value = Common::BitCast(std::max(base_value, 0.0f)); size_t shift_towards = fp32_mantissa_bits - mantissa; return tmp_value >> shift_towards; diff --git a/src/video_core/gpu.cpp b/src/video_core/gpu.cpp index 7024a19cf..caf241eac 100644 --- a/src/video_core/gpu.cpp +++ b/src/video_core/gpu.cpp @@ -194,8 +194,8 @@ struct GPU::Impl { [[nodiscard]] u64 GetTicks() const { // This values were reversed engineered by fincs from NVN // The gpu clock is reported in units of 385/625 nanoseconds - constexpr u64 gpu_ticks_num = 384; - constexpr u64 gpu_ticks_den = 625; + constexpr static u64 gpu_ticks_num = 384; + constexpr static u64 gpu_ticks_den = 625; u64 nanoseconds = system.CoreTiming().GetGlobalTimeNs().count(); if (Settings::values.use_fast_gpu_time.GetValue()) { diff --git a/src/video_core/host1x/codecs/vp9.cpp b/src/video_core/host1x/codecs/vp9.cpp index cf40c9012..bb691f7d8 100644 --- a/src/video_core/host1x/codecs/vp9.cpp +++ b/src/video_core/host1x/codecs/vp9.cpp @@ -283,7 +283,7 @@ void VP9::EncodeTermSubExp(VpxRangeEncoder& writer, s32 value) { } else { value -= 64; - constexpr s32 size = 8; + constexpr static s32 size = 8; const s32 mask = (1 << size) - 191; @@ -307,7 +307,7 @@ bool VP9::WriteLessThan(VpxRangeEncoder& writer, s32 value, s32 test) { void VP9::WriteCoefProbabilityUpdate(VpxRangeEncoder& writer, s32 tx_mode, const std::array& new_prob, const std::array& old_prob) { - constexpr u32 block_bytes = 2 * 2 * 6 * 6 * 3; + constexpr static u32 block_bytes = 2 * 2 * 6 * 6 * 3; const auto needs_update = [&](u32 base_index) { return !std::equal(new_prob.begin() + base_index, diff --git a/src/video_core/query_cache.h b/src/video_core/query_cache.h index 00ce53e3e..c9b482bbe 100644 --- a/src/video_core/query_cache.h +++ b/src/video_core/query_cache.h @@ -281,7 +281,7 @@ public: explicit HostCounterBase(std::shared_ptr dependency_) : dependency{std::move(dependency_)}, depth{dependency ? (dependency->Depth() + 1) : 0} { // Avoid nesting too many dependencies to avoid a stack overflow when these are deleted. - constexpr u64 depth_threshold = 96; + constexpr static u64 depth_threshold = 96; if (depth > depth_threshold) { depth = 0; base_result = dependency->Query(); diff --git a/src/video_core/renderer_opengl/gl_compute_pipeline.cpp b/src/video_core/renderer_opengl/gl_compute_pipeline.cpp index 1a0cea9b7..e49b04975 100644 --- a/src/video_core/renderer_opengl/gl_compute_pipeline.cpp +++ b/src/video_core/renderer_opengl/gl_compute_pipeline.cpp @@ -162,7 +162,8 @@ void ComputePipeline::Configure() { buffer_cache.UnbindComputeTextureBuffers(); size_t texbuf_index{}; const auto add_buffer{[&](const auto& desc) { - constexpr bool is_image = std::is_same_v; + constexpr static bool is_image = + std::is_same_v; for (u32 i = 0; i < desc.count; ++i) { bool is_written{false}; if constexpr (is_image) { diff --git a/src/video_core/renderer_opengl/gl_device.cpp b/src/video_core/renderer_opengl/gl_device.cpp index 22ed16ebf..a5e27de73 100644 --- a/src/video_core/renderer_opengl/gl_device.cpp +++ b/src/video_core/renderer_opengl/gl_device.cpp @@ -126,9 +126,9 @@ Device::Device(Core::Frontend::EmuWindow& emu_window) { const bool is_intel = vendor_name == "Intel"; #ifdef __unix__ - constexpr bool is_linux = true; + constexpr static bool is_linux = true; #else - constexpr bool is_linux = false; + constexpr static bool is_linux = false; #endif bool disable_fast_buffer_sub_data = false; diff --git a/src/video_core/renderer_opengl/gl_graphics_pipeline.cpp b/src/video_core/renderer_opengl/gl_graphics_pipeline.cpp index 29491e762..c409d6ae7 100644 --- a/src/video_core/renderer_opengl/gl_graphics_pipeline.cpp +++ b/src/video_core/renderer_opengl/gl_graphics_pipeline.cpp @@ -385,7 +385,8 @@ void GraphicsPipeline::ConfigureImpl(bool is_indexed) { const auto bind_stage_info{[&](size_t stage) LAMBDA_FORCEINLINE { size_t index{}; const auto add_buffer{[&](const auto& desc) { - constexpr bool is_image = std::is_same_v; + constexpr static bool is_image = + std::is_same_v; for (u32 i = 0; i < desc.count; ++i) { bool is_written{false}; if constexpr (is_image) { diff --git a/src/video_core/renderer_opengl/renderer_opengl.cpp b/src/video_core/renderer_opengl/renderer_opengl.cpp index 2a74c1d05..5d25b8a7d 100644 --- a/src/video_core/renderer_opengl/renderer_opengl.cpp +++ b/src/video_core/renderer_opengl/renderer_opengl.cpp @@ -237,7 +237,7 @@ void RendererOpenGL::LoadFBToScreenInfo(const Tegra::FramebufferConfig& framebuf screen_info.display_texture = screen_info.texture.resource.handle; // TODO(Rodrigo): Read this from HLE - constexpr u32 block_height_log2 = 4; + constexpr static u32 block_height_log2 = 4; const auto pixel_format{ VideoCore::Surface::PixelFormatFromGPUPixelFormat(framebuffer.pixel_format)}; const u32 bytes_per_pixel{VideoCore::Surface::BytesPerBlock(pixel_format)}; @@ -375,7 +375,7 @@ void RendererOpenGL::AddTelemetryFields() { LOG_INFO(Render_OpenGL, "GL_VENDOR: {}", gpu_vendor); LOG_INFO(Render_OpenGL, "GL_RENDERER: {}", gpu_model); - constexpr auto user_system = Common::Telemetry::FieldType::UserSystem; + constexpr static auto user_system = Common::Telemetry::FieldType::UserSystem; telemetry_session.AddField(user_system, "GPU_Vendor", std::string(gpu_vendor)); telemetry_session.AddField(user_system, "GPU_Model", std::string(gpu_model)); telemetry_session.AddField(user_system, "GPU_OpenGL_Version", std::string(gl_version)); diff --git a/src/video_core/renderer_vulkan/blit_image.cpp b/src/video_core/renderer_vulkan/blit_image.cpp index cf2964a3f..334087119 100644 --- a/src/video_core/renderer_vulkan/blit_image.cpp +++ b/src/video_core/renderer_vulkan/blit_image.cpp @@ -358,8 +358,9 @@ VkExtent2D GetConversionExtent(const ImageView& src_image_view) { void TransitionImageLayout(vk::CommandBuffer& cmdbuf, VkImage image, VkImageLayout target_layout, VkImageLayout source_layout = VK_IMAGE_LAYOUT_GENERAL) { - constexpr VkFlags flags{VK_ACCESS_COLOR_ATTACHMENT_READ_BIT | - VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT | VK_ACCESS_SHADER_READ_BIT}; + constexpr static VkFlags flags{VK_ACCESS_COLOR_ATTACHMENT_READ_BIT | + VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT | + VK_ACCESS_SHADER_READ_BIT}; const VkImageMemoryBarrier barrier{ .sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER, .pNext = nullptr, diff --git a/src/video_core/renderer_vulkan/vk_blit_screen.cpp b/src/video_core/renderer_vulkan/vk_blit_screen.cpp index 2f0cc27e8..34a86a407 100644 --- a/src/video_core/renderer_vulkan/vk_blit_screen.cpp +++ b/src/video_core/renderer_vulkan/vk_blit_screen.cpp @@ -175,7 +175,7 @@ VkSemaphore BlitScreen::Draw(const Tegra::FramebufferConfig& framebuffer, const u8* const host_ptr = cpu_memory.GetPointer(framebuffer_addr); // TODO(Rodrigo): Read this from HLE - constexpr u32 block_height_log2 = 4; + constexpr static u32 block_height_log2 = 4; const u32 bytes_per_pixel = GetBytesPerPixel(framebuffer); const u64 linear_size{GetSizeInBytes(framebuffer)}; const u64 tiled_size{Tegra::Texture::CalculateSize(true, bytes_per_pixel, @@ -1482,7 +1482,7 @@ u64 BlitScreen::CalculateBufferSize(const Tegra::FramebufferConfig& framebuffer) u64 BlitScreen::GetRawImageOffset(const Tegra::FramebufferConfig& framebuffer, std::size_t image_index) const { - constexpr auto first_image_offset = static_cast(sizeof(BufferData)); + constexpr static auto first_image_offset = static_cast(sizeof(BufferData)); return first_image_offset + GetSizeInBytes(framebuffer) * image_index; } diff --git a/src/video_core/renderer_vulkan/vk_compute_pipeline.cpp b/src/video_core/renderer_vulkan/vk_compute_pipeline.cpp index 2a0f0dbf0..326260b41 100644 --- a/src/video_core/renderer_vulkan/vk_compute_pipeline.cpp +++ b/src/video_core/renderer_vulkan/vk_compute_pipeline.cpp @@ -172,7 +172,8 @@ void ComputePipeline::Configure(Tegra::Engines::KeplerCompute& kepler_compute, buffer_cache.UnbindComputeTextureBuffers(); size_t index{}; const auto add_buffer{[&](const auto& desc) { - constexpr bool is_image = std::is_same_v; + constexpr static bool is_image = + std::is_same_v; for (u32 i = 0; i < desc.count; ++i) { bool is_written{false}; if constexpr (is_image) { diff --git a/src/video_core/renderer_vulkan/vk_graphics_pipeline.cpp b/src/video_core/renderer_vulkan/vk_graphics_pipeline.cpp index baedc4424..bdab00597 100644 --- a/src/video_core/renderer_vulkan/vk_graphics_pipeline.cpp +++ b/src/video_core/renderer_vulkan/vk_graphics_pipeline.cpp @@ -398,7 +398,8 @@ void GraphicsPipeline::ConfigureImpl(bool is_indexed) { const auto bind_stage_info{[&](size_t stage) LAMBDA_FORCEINLINE { size_t index{}; const auto add_buffer{[&](const auto& desc) { - constexpr bool is_image = std::is_same_v; + constexpr static bool is_image = + std::is_same_v; for (u32 i = 0; i < desc.count; ++i) { bool is_written{false}; if constexpr (is_image) { diff --git a/src/video_core/renderer_vulkan/vk_rasterizer.cpp b/src/video_core/renderer_vulkan/vk_rasterizer.cpp index 719edbcfb..3d50f8edb 100644 --- a/src/video_core/renderer_vulkan/vk_rasterizer.cpp +++ b/src/video_core/renderer_vulkan/vk_rasterizer.cpp @@ -1109,9 +1109,9 @@ void RasterizerVulkan::UpdateDepthBiasEnable(Tegra::Engines::Maxwell3D::Regs& re if (!state_tracker.TouchDepthBiasEnable()) { return; } - constexpr size_t POINT = 0; - constexpr size_t LINE = 1; - constexpr size_t POLYGON = 2; + constexpr static size_t POINT = 0; + constexpr static size_t LINE = 1; + constexpr static size_t POLYGON = 2; static constexpr std::array POLYGON_OFFSET_ENABLE_LUT = { POINT, // Points LINE, // Lines diff --git a/src/video_core/renderer_vulkan/vk_smaa.cpp b/src/video_core/renderer_vulkan/vk_smaa.cpp index 8eb735489..1cd354003 100644 --- a/src/video_core/renderer_vulkan/vk_smaa.cpp +++ b/src/video_core/renderer_vulkan/vk_smaa.cpp @@ -55,8 +55,9 @@ std::pair CreateWrappedImage(const Device& device, void TransitionImageLayout(vk::CommandBuffer& cmdbuf, VkImage image, VkImageLayout target_layout, VkImageLayout source_layout = VK_IMAGE_LAYOUT_GENERAL) { - constexpr VkFlags flags{VK_ACCESS_COLOR_ATTACHMENT_READ_BIT | - VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT | VK_ACCESS_SHADER_READ_BIT}; + constexpr static VkFlags flags{VK_ACCESS_COLOR_ATTACHMENT_READ_BIT | + VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT | + VK_ACCESS_SHADER_READ_BIT}; const VkImageMemoryBarrier barrier{ .sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER, .pNext = nullptr, @@ -152,7 +153,7 @@ vk::RenderPass CreateWrappedRenderPass(const Device& device, VkFormat format) { .finalLayout = VK_IMAGE_LAYOUT_GENERAL, }; - constexpr VkAttachmentReference color_attachment_ref{ + constexpr static VkAttachmentReference color_attachment_ref{ .attachment = 0, .layout = VK_IMAGE_LAYOUT_GENERAL, }; @@ -170,7 +171,7 @@ vk::RenderPass CreateWrappedRenderPass(const Device& device, VkFormat format) { .pPreserveAttachments = nullptr, }; - constexpr VkSubpassDependency dependency{ + constexpr static VkSubpassDependency dependency{ .srcSubpass = VK_SUBPASS_EXTERNAL, .dstSubpass = 0, .srcStageMask = VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT, @@ -328,7 +329,7 @@ vk::Pipeline CreateWrappedPipeline(const Device& device, vk::RenderPass& renderp }, }}; - constexpr VkPipelineVertexInputStateCreateInfo vertex_input_ci{ + constexpr static VkPipelineVertexInputStateCreateInfo vertex_input_ci{ .sType = VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_STATE_CREATE_INFO, .pNext = nullptr, .flags = 0, @@ -338,7 +339,7 @@ vk::Pipeline CreateWrappedPipeline(const Device& device, vk::RenderPass& renderp .pVertexAttributeDescriptions = nullptr, }; - constexpr VkPipelineInputAssemblyStateCreateInfo input_assembly_ci{ + constexpr static VkPipelineInputAssemblyStateCreateInfo input_assembly_ci{ .sType = VK_STRUCTURE_TYPE_PIPELINE_INPUT_ASSEMBLY_STATE_CREATE_INFO, .pNext = nullptr, .flags = 0, @@ -346,7 +347,7 @@ vk::Pipeline CreateWrappedPipeline(const Device& device, vk::RenderPass& renderp .primitiveRestartEnable = VK_FALSE, }; - constexpr VkPipelineViewportStateCreateInfo viewport_state_ci{ + constexpr static VkPipelineViewportStateCreateInfo viewport_state_ci{ .sType = VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_STATE_CREATE_INFO, .pNext = nullptr, .flags = 0, @@ -356,7 +357,7 @@ vk::Pipeline CreateWrappedPipeline(const Device& device, vk::RenderPass& renderp .pScissors = nullptr, }; - constexpr VkPipelineRasterizationStateCreateInfo rasterization_ci{ + constexpr static VkPipelineRasterizationStateCreateInfo rasterization_ci{ .sType = VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_STATE_CREATE_INFO, .pNext = nullptr, .flags = 0, @@ -372,7 +373,7 @@ vk::Pipeline CreateWrappedPipeline(const Device& device, vk::RenderPass& renderp .lineWidth = 1.0f, }; - constexpr VkPipelineMultisampleStateCreateInfo multisampling_ci{ + constexpr static VkPipelineMultisampleStateCreateInfo multisampling_ci{ .sType = VK_STRUCTURE_TYPE_PIPELINE_MULTISAMPLE_STATE_CREATE_INFO, .pNext = nullptr, .flags = 0, @@ -384,7 +385,7 @@ vk::Pipeline CreateWrappedPipeline(const Device& device, vk::RenderPass& renderp .alphaToOneEnable = VK_FALSE, }; - constexpr VkPipelineColorBlendAttachmentState color_blend_attachment{ + constexpr static VkPipelineColorBlendAttachmentState color_blend_attachment{ .blendEnable = VK_FALSE, .srcColorBlendFactor = VK_BLEND_FACTOR_ZERO, .dstColorBlendFactor = VK_BLEND_FACTOR_ZERO, @@ -407,7 +408,7 @@ vk::Pipeline CreateWrappedPipeline(const Device& device, vk::RenderPass& renderp .blendConstants = {0.0f, 0.0f, 0.0f, 0.0f}, }; - constexpr std::array dynamic_states{ + constexpr static std::array dynamic_states{ VK_DYNAMIC_STATE_VIEWPORT, VK_DYNAMIC_STATE_SCISSOR, }; @@ -468,7 +469,7 @@ VkWriteDescriptorSet CreateWriteDescriptorSet(std::vector } void ClearColorImage(vk::CommandBuffer& cmdbuf, VkImage image) { - constexpr std::array subresources{{{ + constexpr static std::array subresources{{{ .aspectMask = VK_IMAGE_ASPECT_COLOR_BIT, .baseMipLevel = 0, .levelCount = 1, @@ -528,8 +529,8 @@ SMAA::SMAA(const Device& device, MemoryAllocator& allocator, size_t image_count, } void SMAA::CreateImages() { - constexpr VkExtent2D area_extent{AREATEX_WIDTH, AREATEX_HEIGHT}; - constexpr VkExtent2D search_extent{SEARCHTEX_WIDTH, SEARCHTEX_HEIGHT}; + constexpr static VkExtent2D area_extent{AREATEX_WIDTH, AREATEX_HEIGHT}; + constexpr static VkExtent2D search_extent{SEARCHTEX_WIDTH, SEARCHTEX_HEIGHT}; std::tie(m_static_images[Area], m_static_buffer_commits[Area]) = CreateWrappedImage(m_device, m_allocator, area_extent, VK_FORMAT_R8G8_UNORM); @@ -586,12 +587,12 @@ void SMAA::CreateSampler() { void SMAA::CreateShaders() { // These match the order of the SMAAStage enum - constexpr std::array vert_shader_sources{ + constexpr static std::array vert_shader_sources{ ARRAY_TO_SPAN(SMAA_EDGE_DETECTION_VERT_SPV), ARRAY_TO_SPAN(SMAA_BLENDING_WEIGHT_CALCULATION_VERT_SPV), ARRAY_TO_SPAN(SMAA_NEIGHBORHOOD_BLENDING_VERT_SPV), }; - constexpr std::array frag_shader_sources{ + constexpr static std::array frag_shader_sources{ ARRAY_TO_SPAN(SMAA_EDGE_DETECTION_FRAG_SPV), ARRAY_TO_SPAN(SMAA_BLENDING_WEIGHT_CALCULATION_FRAG_SPV), ARRAY_TO_SPAN(SMAA_NEIGHBORHOOD_BLENDING_FRAG_SPV), @@ -675,8 +676,8 @@ void SMAA::UploadImages(Scheduler& scheduler) { return; } - constexpr VkExtent2D area_extent{AREATEX_WIDTH, AREATEX_HEIGHT}; - constexpr VkExtent2D search_extent{SEARCHTEX_WIDTH, SEARCHTEX_HEIGHT}; + constexpr static VkExtent2D area_extent{AREATEX_WIDTH, AREATEX_HEIGHT}; + constexpr static VkExtent2D search_extent{SEARCHTEX_WIDTH, SEARCHTEX_HEIGHT}; UploadImage(m_device, m_allocator, scheduler, m_static_images[Area], area_extent, VK_FORMAT_R8G8_UNORM, ARRAY_TO_SPAN(areaTexBytes)); diff --git a/src/video_core/renderer_vulkan/vk_staging_buffer_pool.cpp b/src/video_core/renderer_vulkan/vk_staging_buffer_pool.cpp index 74ca77216..172b6ed95 100644 --- a/src/video_core/renderer_vulkan/vk_staging_buffer_pool.cpp +++ b/src/video_core/renderer_vulkan/vk_staging_buffer_pool.cpp @@ -299,7 +299,7 @@ void StagingBufferPool::ReleaseCache(MemoryUsage usage) { } void StagingBufferPool::ReleaseLevel(StagingBuffersCache& cache, size_t log2) { - constexpr size_t deletions_per_tick = 16; + constexpr static size_t deletions_per_tick = 16; auto& staging = cache[log2]; auto& entries = staging.entries; const size_t old_size = entries.size(); diff --git a/src/video_core/renderer_vulkan/vk_swapchain.cpp b/src/video_core/renderer_vulkan/vk_swapchain.cpp index b6810eef9..0b24a98eb 100644 --- a/src/video_core/renderer_vulkan/vk_swapchain.cpp +++ b/src/video_core/renderer_vulkan/vk_swapchain.cpp @@ -53,7 +53,7 @@ VkPresentModeKHR ChooseSwapPresentMode(vk::Span modes) { } VkExtent2D ChooseSwapExtent(const VkSurfaceCapabilitiesKHR& capabilities, u32 width, u32 height) { - constexpr auto undefined_size{std::numeric_limits::max()}; + constexpr static auto undefined_size{std::numeric_limits::max()}; if (capabilities.currentExtent.width != undefined_size) { return capabilities.currentExtent; } diff --git a/src/video_core/renderer_vulkan/vk_turbo_mode.cpp b/src/video_core/renderer_vulkan/vk_turbo_mode.cpp index c42594149..38c7e533d 100644 --- a/src/video_core/renderer_vulkan/vk_turbo_mode.cpp +++ b/src/video_core/renderer_vulkan/vk_turbo_mode.cpp @@ -48,7 +48,7 @@ void TurboMode::Run(std::stop_token stop_token) { auto commit = m_allocator.Commit(buffer, MemoryUsage::DeviceLocal); // Create the descriptor pool to contain our descriptor. - constexpr VkDescriptorPoolSize pool_size{ + constexpr static VkDescriptorPoolSize pool_size{ .type = VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, .descriptorCount = 1, }; @@ -63,7 +63,7 @@ void TurboMode::Run(std::stop_token stop_token) { }); // Create the descriptor set layout from the pool. - constexpr VkDescriptorSetLayoutBinding layout_binding{ + constexpr static VkDescriptorSetLayoutBinding layout_binding{ .binding = 0, .descriptorType = VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, .descriptorCount = 1, diff --git a/src/video_core/surface.cpp b/src/video_core/surface.cpp index 1a76d4178..e69855cad 100644 --- a/src/video_core/surface.cpp +++ b/src/video_core/surface.cpp @@ -371,7 +371,7 @@ std::pair GetASTCBlockSize(PixelFormat format) { } u64 EstimatedDecompressedSize(u64 base_size, PixelFormat format) { - constexpr u64 RGBA8_PIXEL_SIZE = 4; + constexpr static u64 RGBA8_PIXEL_SIZE = 4; const u64 base_block_size = static_cast(DefaultBlockWidth(format)) * static_cast(DefaultBlockHeight(format)) * RGBA8_PIXEL_SIZE; return (base_size * base_block_size) / BytesPerBlock(format); diff --git a/src/video_core/textures/decoders.cpp b/src/video_core/textures/decoders.cpp index 59120cd09..436f228b3 100644 --- a/src/video_core/textures/decoders.cpp +++ b/src/video_core/textures/decoders.cpp @@ -29,7 +29,7 @@ constexpr u32 pdep(u32 value) { template void incrpdep(u32& value) { - constexpr u32 swizzled_incr = pdep(incr_amount); + constexpr static u32 swizzled_incr = pdep(incr_amount); value = ((value | ~mask) + swizzled_incr) & mask; } diff --git a/src/video_core/vulkan_common/vulkan_wrapper.cpp b/src/video_core/vulkan_common/vulkan_wrapper.cpp index 486d4dfaf..7efe83c9a 100644 --- a/src/video_core/vulkan_common/vulkan_wrapper.cpp +++ b/src/video_core/vulkan_common/vulkan_wrapper.cpp @@ -495,9 +495,9 @@ VkResult Free(VkDevice device, VkCommandPool handle, Span buffe Instance Instance::Create(u32 version, Span layers, Span extensions, InstanceDispatch& dispatch) { #ifdef __APPLE__ - constexpr VkFlags ci_flags{VK_INSTANCE_CREATE_ENUMERATE_PORTABILITY_BIT_KHR}; + constexpr static VkFlags ci_flags{VK_INSTANCE_CREATE_ENUMERATE_PORTABILITY_BIT_KHR}; #else - constexpr VkFlags ci_flags{}; + constexpr static VkFlags ci_flags{}; #endif const VkApplicationInfo application_info{ diff --git a/src/yuzu/bootmanager.cpp b/src/yuzu/bootmanager.cpp index d65991734..c2b144b78 100644 --- a/src/yuzu/bootmanager.cpp +++ b/src/yuzu/bootmanager.cpp @@ -720,7 +720,7 @@ void GRenderWindow::TouchEndEvent() { void GRenderWindow::InitializeCamera() { #if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0)) && YUZU_USE_QT_MULTIMEDIA - constexpr auto camera_update_ms = std::chrono::milliseconds{50}; // (50ms, 20Hz) + constexpr static auto camera_update_ms = std::chrono::milliseconds{50}; // (50ms, 20Hz) if (!Settings::values.enable_ir_sensor) { return; } diff --git a/src/yuzu/configuration/configure_input_player_widget.cpp b/src/yuzu/configuration/configure_input_player_widget.cpp index c287220fc..fa8afc2d9 100644 --- a/src/yuzu/configuration/configure_input_player_widget.cpp +++ b/src/yuzu/configuration/configure_input_player_widget.cpp @@ -317,9 +317,9 @@ void PlayerControlPreview::DrawLeftController(QPainter& p, const QPointF center) // D-pad constants const QPointF dpad_center = center + QPoint(9, 14); - constexpr int dpad_distance = 23; - constexpr int dpad_radius = 11; - constexpr float dpad_arrow_size = 1.2f; + constexpr static int dpad_distance = 23; + constexpr static int dpad_radius = 11; + constexpr static float dpad_arrow_size = 1.2f; // D-pad buttons p.setPen(colors.outline); @@ -439,9 +439,9 @@ void PlayerControlPreview::DrawRightController(QPainter& p, const QPointF center // Face buttons constants const QPointF face_center = center + QPoint(-9, -73); - constexpr int face_distance = 23; - constexpr int face_radius = 11; - constexpr float text_size = 1.1f; + constexpr static int face_distance = 23; + constexpr static int face_radius = 11; + constexpr static float text_size = 1.1f; // Face buttons p.setPen(colors.outline); @@ -559,9 +559,9 @@ void PlayerControlPreview::DrawDualController(QPainter& p, const QPointF center) // Face buttons constants const QPointF face_center = center + QPoint(65, -65); - constexpr int face_distance = 20; - constexpr int face_radius = 10; - constexpr float text_size = 1.0f; + constexpr static int face_distance = 20; + constexpr static int face_radius = 10; + constexpr static float text_size = 1.0f; // Face buttons p.setPen(colors.outline); @@ -581,9 +581,9 @@ void PlayerControlPreview::DrawDualController(QPainter& p, const QPointF center) // D-pad constants const QPointF dpad_center = center + QPoint(-65, 12); - constexpr int dpad_distance = 20; - constexpr int dpad_radius = 10; - constexpr float dpad_arrow_size = 1.1f; + constexpr static int dpad_distance = 20; + constexpr static int dpad_radius = 10; + constexpr static float dpad_arrow_size = 1.1f; // D-pad buttons p.setPen(colors.outline); @@ -651,9 +651,9 @@ void PlayerControlPreview::DrawHandheldController(QPainter& p, const QPointF cen // Face buttons constants const QPointF face_center = center + QPoint(171, -41); - constexpr float face_distance = 12.8f; - constexpr float face_radius = 6.4f; - constexpr float text_size = 0.6f; + constexpr static float face_distance = 12.8f; + constexpr static float face_radius = 6.4f; + constexpr static float text_size = 0.6f; // Face buttons p.setPen(colors.outline); @@ -673,9 +673,9 @@ void PlayerControlPreview::DrawHandheldController(QPainter& p, const QPointF cen // D-pad constants const QPointF dpad_center = center + QPoint(-171, 8); - constexpr float dpad_distance = 12.8f; - constexpr float dpad_radius = 6.4f; - constexpr float dpad_arrow_size = 0.68f; + constexpr static float dpad_distance = 12.8f; + constexpr static float dpad_radius = 6.4f; + constexpr static float dpad_arrow_size = 0.68f; // D-pad buttons p.setPen(colors.outline); @@ -754,9 +754,9 @@ void PlayerControlPreview::DrawProController(QPainter& p, const QPointF center) // Face buttons constants const QPointF face_center = center + QPoint(105, -56); - constexpr int face_distance = 31; - constexpr int face_radius = 15; - constexpr float text_size = 1.5f; + constexpr static int face_distance = 31; + constexpr static int face_radius = 15; + constexpr static float text_size = 1.5f; // Face buttons p.setPen(colors.outline); @@ -846,7 +846,7 @@ void PlayerControlPreview::DrawGCController(QPainter& p, const QPointF center) { using namespace Settings::NativeButton; // Face buttons constants - constexpr float text_size = 1.1f; + constexpr static float text_size = 1.1f; // Face buttons p.setPen(colors.outline); @@ -1497,7 +1497,7 @@ void PlayerControlPreview::DrawProBody(QPainter& p, const QPointF center) { std::array qleft_handle; std::array qright_handle; std::array qbody; - constexpr int radius1 = 32; + constexpr static int radius1 = 32; for (std::size_t point = 0; point < pro_left_handle.size() / 2; ++point) { const float left_x = pro_left_handle[point * 2 + 0]; @@ -1539,7 +1539,7 @@ void PlayerControlPreview::DrawGCBody(QPainter& p, const QPointF center) { std::array qbody; std::array left_hex; std::array right_hex; - constexpr float angle = 2 * 3.1415f / 8; + constexpr static float angle = 2 * 3.1415f / 8; for (std::size_t point = 0; point < gc_left_body.size() / 2; ++point) { const float body_x = gc_left_body[point * 2 + 0]; @@ -1676,9 +1676,9 @@ void PlayerControlPreview::DrawDualBody(QPainter& p, const QPointF center) { std::array qright_joycon_slider_topview; std::array qleft_joycon_topview; std::array qright_joycon_topview; - constexpr float size = 1.61f; - constexpr float size2 = 0.9f; - constexpr float offset = 209.3f; + constexpr static float size = 1.61f; + constexpr static float size2 = 0.9f; + constexpr static float offset = 209.3f; for (std::size_t point = 0; point < left_joycon_body.size() / 2; ++point) { const float body_x = left_joycon_body[point * 2 + 0]; @@ -1767,10 +1767,10 @@ void PlayerControlPreview::DrawLeftBody(QPainter& p, const QPointF center) { std::array qleft_joycon_slider; std::array qleft_joycon_slider_topview; std::array qleft_joycon_topview; - constexpr float size = 1.78f; - constexpr float size2 = 1.1115f; - constexpr float offset = 312.39f; - constexpr float offset2 = 335; + constexpr static float size = 1.78f; + constexpr static float size2 = 1.1115f; + constexpr static float offset = 312.39f; + constexpr static float offset2 = 335; for (std::size_t point = 0; point < left_joycon_body.size() / 2; ++point) { left_joycon[point] = center + QPointF(left_joycon_body[point * 2] * size + offset, @@ -1867,10 +1867,10 @@ void PlayerControlPreview::DrawRightBody(QPainter& p, const QPointF center) { std::array qright_joycon_slider; std::array qright_joycon_slider_topview; std::array qright_joycon_topview; - constexpr float size = 1.78f; - constexpr float size2 = 1.1115f; - constexpr float offset = 312.39f; - constexpr float offset2 = 335; + constexpr static float size = 1.78f; + constexpr static float size2 = 1.1115f; + constexpr static float offset = 312.39f; + constexpr static float offset2 = 335; for (std::size_t point = 0; point < left_joycon_body.size() / 2; ++point) { right_joycon[point] = center + QPointF(-left_joycon_body[point * 2] * size - offset, @@ -2068,8 +2068,8 @@ void PlayerControlPreview::DrawDualTriggers(QPainter& p, const QPointF center, const Common::Input::ButtonStatus& right_pressed) { std::array qleft_trigger; std::array qright_trigger; - constexpr float size = 1.62f; - constexpr float offset = 210.6f; + constexpr static float size = 1.62f; + constexpr static float offset = 210.6f; for (std::size_t point = 0; point < left_joycon_trigger.size() / 2; ++point) { const float left_trigger_x = left_joycon_trigger[point * 2 + 0]; const float left_trigger_y = left_joycon_trigger[point * 2 + 1]; @@ -2097,7 +2097,7 @@ void PlayerControlPreview::DrawDualTriggersTopView( const Common::Input::ButtonStatus& right_pressed) { std::array qleft_trigger; std::array qright_trigger; - constexpr float size = 0.9f; + constexpr static float size = 0.9f; for (std::size_t point = 0; point < left_joystick_L_topview.size() / 2; ++point) { const float top_view_x = left_joystick_L_topview[point * 2 + 0]; @@ -2134,7 +2134,7 @@ void PlayerControlPreview::DrawDualZTriggersTopView( const Common::Input::ButtonStatus& right_pressed) { std::array qleft_trigger; std::array qright_trigger; - constexpr float size = 0.9f; + constexpr static float size = 0.9f; for (std::size_t point = 0; point < left_joystick_ZL_topview.size() / 2; ++point) { qleft_trigger[point] = @@ -2167,8 +2167,8 @@ void PlayerControlPreview::DrawDualZTriggersTopView( void PlayerControlPreview::DrawLeftTriggers(QPainter& p, const QPointF center, const Common::Input::ButtonStatus& left_pressed) { std::array qleft_trigger; - constexpr float size = 1.78f; - constexpr float offset = 311.5f; + constexpr static float size = 1.78f; + constexpr static float offset = 311.5f; for (std::size_t point = 0; point < left_joycon_trigger.size() / 2; ++point) { qleft_trigger[point] = center + QPointF(left_joycon_trigger[point * 2] * size + offset, @@ -2184,8 +2184,8 @@ void PlayerControlPreview::DrawLeftTriggers(QPainter& p, const QPointF center, void PlayerControlPreview::DrawLeftZTriggers(QPainter& p, const QPointF center, const Common::Input::ButtonStatus& left_pressed) { std::array qleft_trigger; - constexpr float size = 1.1115f; - constexpr float offset2 = 335; + constexpr static float size = 1.1115f; + constexpr static float offset2 = 335; for (std::size_t point = 0; point < left_joycon_sideview_zl.size() / 2; ++point) { qleft_trigger[point] = center + QPointF(left_joycon_sideview_zl[point * 2] * size + offset2, @@ -2241,8 +2241,8 @@ void PlayerControlPreview::DrawLeftZTriggersTopView( void PlayerControlPreview::DrawRightTriggers(QPainter& p, const QPointF center, const Common::Input::ButtonStatus& right_pressed) { std::array qright_trigger; - constexpr float size = 1.78f; - constexpr float offset = 311.5f; + constexpr static float size = 1.78f; + constexpr static float offset = 311.5f; for (std::size_t point = 0; point < left_joycon_trigger.size() / 2; ++point) { qright_trigger[point] = center + QPointF(-left_joycon_trigger[point * 2] * size - offset, @@ -2258,8 +2258,8 @@ void PlayerControlPreview::DrawRightTriggers(QPainter& p, const QPointF center, void PlayerControlPreview::DrawRightZTriggers(QPainter& p, const QPointF center, const Common::Input::ButtonStatus& right_pressed) { std::array qright_trigger; - constexpr float size = 1.1115f; - constexpr float offset2 = 335; + constexpr static float size = 1.1115f; + constexpr static float offset2 = 335; for (std::size_t point = 0; point < left_joycon_sideview_zl.size() / 2; ++point) { qright_trigger[point] = @@ -2433,7 +2433,7 @@ void PlayerControlPreview::DrawRawJoystick(QPainter& p, QPointF center_left, QPo void PlayerControlPreview::DrawJoystickProperties( QPainter& p, const QPointF center, const Common::Input::AnalogProperties& properties) { - constexpr float size = 45.0f; + constexpr static float size = 45.0f; const float range = size * properties.range; const float deadzone = size * properties.deadzone; @@ -2453,7 +2453,7 @@ void PlayerControlPreview::DrawJoystickProperties( void PlayerControlPreview::DrawJoystickDot(QPainter& p, const QPointF center, const Common::Input::StickStatus& stick, bool raw) { - constexpr float size = 45.0f; + constexpr static float size = 45.0f; const float range = size * stick.x.properties.range; if (raw) { diff --git a/src/yuzu/game_list.cpp b/src/yuzu/game_list.cpp index 22aa19c56..2e73c2719 100644 --- a/src/yuzu/game_list.cpp +++ b/src/yuzu/game_list.cpp @@ -476,8 +476,8 @@ void GameList::DonePopulating(const QStringList& watch_list) { // Workaround: Add the watch paths in chunks to allow the gui to refresh // This prevents the UI from stalling when a large number of watch paths are added // Also artificially caps the watcher to a certain number of directories - constexpr int LIMIT_WATCH_DIRECTORIES = 5000; - constexpr int SLICE_SIZE = 25; + constexpr static int LIMIT_WATCH_DIRECTORIES = 5000; + constexpr static int SLICE_SIZE = 25; int len = std::min(static_cast(watch_list.size()), LIMIT_WATCH_DIRECTORIES); for (int i = 0; i < len; i += SLICE_SIZE) { watcher->addPaths(watch_list.mid(i, i + SLICE_SIZE)); diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp index 62dfc526a..68abde028 100644 --- a/src/yuzu/main.cpp +++ b/src/yuzu/main.cpp @@ -219,7 +219,7 @@ static void LogRuntimes() { #ifdef _MSC_VER // It is possible that the name of the dll will change. // vcruntime140.dll is for 2015 and onwards - constexpr char runtime_dll_name[] = "vcruntime140.dll"; + constexpr static char runtime_dll_name[] = "vcruntime140.dll"; UINT sz = GetFileVersionInfoSizeA(runtime_dll_name, nullptr); bool runtime_version_inspection_worked = false; if (sz > 0) { @@ -4490,8 +4490,8 @@ static void SetHighDPIAttributes() { // Recommended minimum width and height for proper window fit. // Any screen with a lower resolution than this will still have a scale of 1. - constexpr float minimum_width = 1350.0f; - constexpr float minimum_height = 900.0f; + constexpr static float minimum_width = 1350.0f; + constexpr static float minimum_height = 900.0f; const float width_ratio = std::max(1.0f, real_width / minimum_width); const float height_ratio = std::max(1.0f, real_height / minimum_height); -- cgit v1.2.3