diff --git a/src/common/gsvector.cpp b/src/common/gsvector.cpp index 146411240..4c23676f9 100644 --- a/src/common/gsvector.cpp +++ b/src/common/gsvector.cpp @@ -94,7 +94,7 @@ void GSMatrix2x2::store(void* m) std::memcpy(m, E, sizeof(E)); } -ALWAYS_INLINE static void MatrixMult4x4(GSMatrix4x4& res, const GSMatrix4x4& lhs, const GSMatrix4x4& rhs) +ALWAYS_INLINE void MatrixMult4x4(GSMatrix4x4& res, const GSMatrix4x4& lhs, const GSMatrix4x4& rhs) { // This isn't speedy by any means, but it's not hot code either. #define MultRC(rw, cl) \ diff --git a/src/common/gsvector_sse.h b/src/common/gsvector_sse.h index 0ba55d680..99932161c 100644 --- a/src/common/gsvector_sse.h +++ b/src/common/gsvector_sse.h @@ -33,48 +33,48 @@ class GSVector4i; #ifndef CPU_ARCH_SSE41 // Thank LLVM for these. -ALWAYS_INLINE static __m128i sse2_min_s8(const __m128i m, const __m128i v) +ALWAYS_INLINE __m128i sse2_min_s8(const __m128i m, const __m128i v) { const __m128i temp = _mm_cmpgt_epi8(m, v); return _mm_or_si128(_mm_andnot_si128(temp, m), _mm_and_si128(v, temp)); } -ALWAYS_INLINE static __m128i sse2_max_s8(const __m128i m, const __m128i v) +ALWAYS_INLINE __m128i sse2_max_s8(const __m128i m, const __m128i v) { const __m128i temp = _mm_cmpgt_epi8(v, m); return _mm_or_si128(_mm_andnot_si128(temp, m), _mm_and_si128(v, temp)); } -ALWAYS_INLINE static __m128i sse2_min_s32(const __m128i m, const __m128i v) +ALWAYS_INLINE __m128i sse2_min_s32(const __m128i m, const __m128i v) { const __m128i temp = _mm_cmpgt_epi32(m, v); return _mm_or_si128(_mm_andnot_si128(temp, m), _mm_and_si128(v, temp)); } -ALWAYS_INLINE static __m128i sse2_max_s32(const __m128i m, const __m128i v) +ALWAYS_INLINE __m128i sse2_max_s32(const __m128i m, const __m128i v) { const __m128i temp = _mm_cmpgt_epi32(v, m); return _mm_or_si128(_mm_andnot_si128(temp, m), _mm_and_si128(v, temp)); } -ALWAYS_INLINE static __m128i sse2_min_u16(const __m128i m, const __m128i v) +ALWAYS_INLINE __m128i sse2_min_u16(const __m128i m, const __m128i v) { return _mm_sub_epi16(m, _mm_subs_epu16(m, v)); } -ALWAYS_INLINE static __m128i sse2_max_u16(const __m128i m, const __m128i v) +ALWAYS_INLINE __m128i sse2_max_u16(const __m128i m, const __m128i v) { return _mm_add_epi16(m, _mm_subs_epu16(v, m)); } -ALWAYS_INLINE static __m128i sse2_min_u32(const __m128i m, const __m128i v) +ALWAYS_INLINE __m128i sse2_min_u32(const __m128i m, const __m128i v) { const __m128i msb = _mm_set1_epi32(0x80000000); const __m128i temp = _mm_cmpgt_epi32(_mm_xor_si128(msb, v), _mm_xor_si128(m, msb)); return _mm_or_si128(_mm_andnot_si128(temp, v), _mm_and_si128(m, temp)); } -ALWAYS_INLINE static __m128i sse2_max_u32(const __m128i m, const __m128i v) +ALWAYS_INLINE __m128i sse2_max_u32(const __m128i m, const __m128i v) { const __m128i msb = _mm_set1_epi32(0x80000000); const __m128i temp = _mm_cmpgt_epi32(_mm_xor_si128(msb, m), _mm_xor_si128(v, msb)); diff --git a/src/common/intrin.h b/src/common/intrin.h index 5d23e20ea..24d11b42f 100644 --- a/src/common/intrin.h +++ b/src/common/intrin.h @@ -60,7 +60,7 @@ inline constexpr u32 VECTOR_ALIGNMENT = 16; /// Aligns allocation/pitch size to preferred host size. template -ALWAYS_INLINE static T VectorAlign(T value) +ALWAYS_INLINE T VectorAlign(T value) { return Common::AlignUpPow2(value, VECTOR_ALIGNMENT); } @@ -108,7 +108,7 @@ ALWAYS_INLINE_RELEASE static void MemsetPtrs(T* ptr, T value, u32 count) *(dest++) = value; } -ALWAYS_INLINE static void MultiPause() +ALWAYS_INLINE void MultiPause() { #if defined(CPU_ARCH_X86) || defined(CPU_ARCH_X64) _mm_pause(); diff --git a/src/common/memmap.h b/src/common/memmap.h index 0240fbb2e..9bcd80dbb 100644 --- a/src/common/memmap.h +++ b/src/common/memmap.h @@ -75,7 +75,7 @@ void ReleaseJITMemory(void* ptr, size_t size); /// Only needed outside of X86, X86 has coherent D/I cache. #if !defined(CPU_ARCH_ARM32) && !defined(CPU_ARCH_ARM64) && !defined(CPU_ARCH_RISCV64) && !defined(CPU_ARCH_LOONGARCH64) // clang-format off -ALWAYS_INLINE static void FlushInstructionCache(void* address, size_t size) { } +ALWAYS_INLINE void FlushInstructionCache(void* address, size_t size) { } // clang-format on #else void FlushInstructionCache(void* address, size_t size); diff --git a/src/core/cpu_core.cpp b/src/core/cpu_core.cpp index 8bc295c6e..99b818c67 100644 --- a/src/core/cpu_core.cpp +++ b/src/core/cpu_core.cpp @@ -874,7 +874,7 @@ const std::array(old_value), static_cast(add_value), @@ -885,7 +885,7 @@ ALWAYS_INLINE static bool AddOverflow(u32 old_value, u32 add_value, u32* new_val #endif } -ALWAYS_INLINE static bool SubOverflow(u32 old_value, u32 sub_value, u32* new_value) +ALWAYS_INLINE bool SubOverflow(u32 old_value, u32 sub_value, u32* new_value) { #if defined(__clang__) || defined(__GNUC__) return __builtin_sub_overflow(static_cast(old_value), static_cast(sub_value), diff --git a/src/core/fullscreenui_widgets.h b/src/core/fullscreenui_widgets.h index f5e13fe23..eac88d8bb 100644 --- a/src/core/fullscreenui_widgets.h +++ b/src/core/fullscreenui_widgets.h @@ -454,9 +454,9 @@ bool MenuActionButton(std::string_view title, std::string_view summary, std::str bool dropdown_icon = false, bool enabled = true); template -ALWAYS_INLINE static bool EnumChoiceButton(std::string_view title, std::string_view summary, DataType* value_pointer, - const char* (*to_display_name_function)(DataType value), CountType count, - bool enabled = true) +ALWAYS_INLINE bool EnumChoiceButton(std::string_view title, std::string_view summary, DataType* value_pointer, + const char* (*to_display_name_function)(DataType value), CountType count, + bool enabled = true) { s32 value = static_cast(*value_pointer); auto to_display_name_wrapper = [](s32 value, void* opaque) -> const char* { diff --git a/src/core/gpu.cpp b/src/core/gpu.cpp index f4486c3ec..d31bc5d83 100644 --- a/src/core/gpu.cpp +++ b/src/core/gpu.cpp @@ -130,11 +130,11 @@ static void FrameDoneEvent(void*, TickCount ticks); // The GPU internally appears to run at 2x the system clock. // TODO: No, it just draws two pixels per clock. -ALWAYS_INLINE static constexpr TickCount GPUTicksToSystemTicks(TickCount gpu_ticks) +ALWAYS_INLINE constexpr TickCount GPUTicksToSystemTicks(TickCount gpu_ticks) { return std::max((gpu_ticks + 1) >> 1, 1); } -ALWAYS_INLINE static constexpr TickCount SystemTicksToGPUTicks(TickCount sysclk_ticks) +ALWAYS_INLINE constexpr TickCount SystemTicksToGPUTicks(TickCount sysclk_ticks) { return sysclk_ticks << 1; } diff --git a/src/core/gpu_helpers.h b/src/core/gpu_helpers.h index 418b00aad..10176fcc4 100644 --- a/src/core/gpu_helpers.h +++ b/src/core/gpu_helpers.h @@ -10,7 +10,7 @@ #include "common/bitutils.h" #include "common/gsvector.h" -ALWAYS_INLINE static constexpr bool TextureModeHasPalette(GPUTextureMode mode) +ALWAYS_INLINE constexpr bool TextureModeHasPalette(GPUTextureMode mode) { return (mode < GPUTextureMode::Direct16Bit); } diff --git a/src/core/gpu_hw.cpp b/src/core/gpu_hw.cpp index 3ba568873..13ae39366 100644 --- a/src/core/gpu_hw.cpp +++ b/src/core/gpu_hw.cpp @@ -76,7 +76,7 @@ static_assert(s_batch_render_modes.size() == static_cast(GPU_HW::BatchRe #endif /// Returns the distance between two rectangles. -ALWAYS_INLINE static float RectDistance(const GSVector4i lhs, const GSVector4i rhs) +ALWAYS_INLINE float RectDistance(const GSVector4i lhs, const GSVector4i rhs) { const s32 lcx = (lhs.left + ((lhs.right - lhs.left) / 2)); const s32 lcy = (lhs.top + ((lhs.bottom - lhs.top) / 2)); @@ -88,7 +88,7 @@ ALWAYS_INLINE static float RectDistance(const GSVector4i lhs, const GSVector4i r return std::sqrt(static_cast(distsq)); } -ALWAYS_INLINE static u32 GetMaxResolutionScale() +ALWAYS_INLINE u32 GetMaxResolutionScale() { return g_gpu_device->GetMaxTextureSize() / VRAM_WIDTH; } @@ -101,34 +101,34 @@ ALWAYS_INLINE_RELEASE static u32 GetBoxDownsampleScale(u32 resolution_scale) return scale; } -ALWAYS_INLINE static bool ShouldDrawWithSoftwareRenderer() +ALWAYS_INLINE bool ShouldDrawWithSoftwareRenderer() { return (g_gpu_settings.gpu_use_software_renderer_for_readbacks || g_gpu_settings.gpu_use_software_renderer_for_memory_states); } -ALWAYS_INLINE static bool ShouldClampUVs(GPUTextureFilter texture_filter) +ALWAYS_INLINE bool ShouldClampUVs(GPUTextureFilter texture_filter) { // We only need UV limits if PGXP is enabled, or texture filtering is enabled. return (g_gpu_settings.gpu_pgxp_enable || texture_filter != GPUTextureFilter::Nearest); } -ALWAYS_INLINE static bool ShouldAllowSpriteMode(u8 resolution_scale, GPUTextureFilter texture_filter, - GPUTextureFilter sprite_texture_filter) +ALWAYS_INLINE bool ShouldAllowSpriteMode(u8 resolution_scale, GPUTextureFilter texture_filter, + GPUTextureFilter sprite_texture_filter) { // Use sprite shaders/mode when texcoord rounding is forced, or if the filters are different. return (sprite_texture_filter != texture_filter || (resolution_scale > 1 && g_gpu_settings.gpu_force_round_texcoords)); } -ALWAYS_INLINE static bool ShouldDisableColorPerspective() +ALWAYS_INLINE bool ShouldDisableColorPerspective() { return g_gpu_settings.gpu_pgxp_enable && g_gpu_settings.gpu_pgxp_texture_correction && !g_gpu_settings.gpu_pgxp_color_correction; } /// Returns true if the specified texture filtering mode requires dual-source blending. -ALWAYS_INLINE static bool IsBlendedTextureFiltering(GPUTextureFilter filter) +ALWAYS_INLINE bool IsBlendedTextureFiltering(GPUTextureFilter filter) { // return (filter == GPUTextureFilter::Bilinear || filter == GPUTextureFilter::JINC2 || filter == // GPUTextureFilter::xBR); @@ -164,14 +164,14 @@ ALWAYS_INLINE_RELEASE static GSVector4i GetVRAMTransferBounds(u32 x, u32 y, u32 } /// Returns true if the below function should be applied. -ALWAYS_INLINE static bool ShouldTruncate32To16(const GPUBackendDrawCommand* cmd) +ALWAYS_INLINE bool ShouldTruncate32To16(const GPUBackendDrawCommand* cmd) { return (!cmd->texture_enable && !cmd->shading_enable && !cmd->dither_enable && g_gpu_settings.gpu_dithering_mode == GPUDitheringMode::TrueColor); } /// Truncates a 32-bit colour to 16-bit. -ALWAYS_INLINE static u32 Truncate32To16(u32 color) +ALWAYS_INLINE u32 Truncate32To16(u32 color) { return GSVector4i((GSVector4(GSVector4i::zext32(color).u8to32().srl32<3>()) / GSVector4::cxpr(31.0f)) * GSVector4::cxpr(255.0f)) @@ -179,14 +179,14 @@ ALWAYS_INLINE static u32 Truncate32To16(u32 color) } /// Returns true if two given spans overlap. -ALWAYS_INLINE static bool SpansOverlap(s32 start1, s32 end1, s32 start2, s32 end2) +ALWAYS_INLINE bool SpansOverlap(s32 start1, s32 end1, s32 start2, s32 end2) { return (start1 <= end2 && start2 <= end1); } /// Computes the clamped average Z for the given polygon Z values. template -ALWAYS_INLINE static float ComputePolygonAverageZ(Args... args) +ALWAYS_INLINE float ComputePolygonAverageZ(Args... args) { static_assert(sizeof...(args) >= 2, "At least two arguments are required"); const float sum = (args + ...); diff --git a/src/core/gpu_hw_texture_cache.cpp b/src/core/gpu_hw_texture_cache.cpp index 879323d87..2816252b9 100644 --- a/src/core/gpu_hw_texture_cache.cpp +++ b/src/core/gpu_hw_texture_cache.cpp @@ -516,12 +516,12 @@ ALWAYS_INLINE_RELEASE static void LoopXWrappedPages(u32 page, u32 num_pages, con f((page & VRAM_PAGE_Y_MASK) | ((page + i) & VRAM_PAGE_X_MASK)); } -ALWAYS_INLINE static void DoStateVector(StateWrapper& sw, GSVector4i* vec) +ALWAYS_INLINE void DoStateVector(StateWrapper& sw, GSVector4i* vec) { sw.DoBytes(vec->S32, sizeof(vec->S32)); } -ALWAYS_INLINE static float RectDistance(const GSVector4i& lhs, const GSVector4i& rhs) +ALWAYS_INLINE float RectDistance(const GSVector4i& lhs, const GSVector4i& rhs) { const GSVector4 flhs(lhs); const GSVector4 frhs(rhs); @@ -1128,7 +1128,7 @@ void GPUTextureCache::AddWrittenRectangle(const GSVector4i rect, bool update_vra }); } -[[maybe_unused]] ALWAYS_INLINE static TinyString SourceKeyToString(const GPUTextureCache::SourceKey& key) +[[maybe_unused]] ALWAYS_INLINE TinyString SourceKeyToString(const GPUTextureCache::SourceKey& key) { static constexpr const std::array texture_modes = { {"Palette4Bit", "Palette8Bit", "Direct16Bit", "Reserved_Direct16Bit"}}; @@ -1146,7 +1146,7 @@ void GPUTextureCache::AddWrittenRectangle(const GSVector4i rect, bool update_vra return ret; } -[[maybe_unused]] ALWAYS_INLINE static TinyString SourceToString(const GPUTextureCache::Source* src) +[[maybe_unused]] ALWAYS_INLINE TinyString SourceToString(const GPUTextureCache::Source* src) { return SourceKeyToString(src->key); } diff --git a/src/core/gte.cpp b/src/core/gte.cpp index 46090f004..424afe51b 100644 --- a/src/core/gte.cpp +++ b/src/core/gte.cpp @@ -98,7 +98,7 @@ static constinit Config s_config; #define REGS CPU::g_state.gte_regs -ALWAYS_INLINE static u32 CountLeadingBits(u32 value) +ALWAYS_INLINE u32 CountLeadingBits(u32 value) { // if top-most bit is set, we want to count ones not zeros if (value & UINT32_C(0x80000000)) @@ -108,7 +108,7 @@ ALWAYS_INLINE static u32 CountLeadingBits(u32 value) } template -ALWAYS_INLINE static void CheckMACOverflow(s64 value) +ALWAYS_INLINE void CheckMACOverflow(s64 value) { constexpr s64 MIN_VALUE = (index == 0) ? MAC0_MIN_VALUE : MAC123_MIN_VALUE; constexpr s64 MAX_VALUE = (index == 0) ? MAC0_MAX_VALUE : MAC123_MAX_VALUE; @@ -137,14 +137,14 @@ ALWAYS_INLINE static void CheckMACOverflow(s64 value) } template -ALWAYS_INLINE static s64 SignExtendMACResult(s64 value) +ALWAYS_INLINE s64 SignExtendMACResult(s64 value) { CheckMACOverflow(value); return SignExtendN < index == 0 ? 31 : 44 > (value); } template -ALWAYS_INLINE static void TruncateAndSetMAC(s64 value, u8 shift) +ALWAYS_INLINE void TruncateAndSetMAC(s64 value, u8 shift) { CheckMACOverflow(value); @@ -155,7 +155,7 @@ ALWAYS_INLINE static void TruncateAndSetMAC(s64 value, u8 shift) } template -ALWAYS_INLINE static void TruncateAndSetIR(s32 value, bool lm) +ALWAYS_INLINE void TruncateAndSetIR(s32 value, bool lm) { constexpr s32 MIN_VALUE = (index == 0) ? IR0_MIN_VALUE : IR123_MIN_VALUE; constexpr s32 MAX_VALUE = (index == 0) ? IR0_MAX_VALUE : IR123_MAX_VALUE; @@ -190,7 +190,7 @@ ALWAYS_INLINE static void TruncateAndSetIR(s32 value, bool lm) } template -ALWAYS_INLINE static void TruncateAndSetMACAndIR(s64 value, u8 shift, bool lm) +ALWAYS_INLINE void TruncateAndSetMACAndIR(s64 value, u8 shift, bool lm) { CheckMACOverflow(value); @@ -206,7 +206,7 @@ ALWAYS_INLINE static void TruncateAndSetMACAndIR(s64 value, u8 shift, bool lm) } template -ALWAYS_INLINE static u32 TruncateRGB(s32 value) +ALWAYS_INLINE u32 TruncateRGB(s32 value) { if (value < 0 || value > 0xFF) { diff --git a/src/core/spu.cpp b/src/core/spu.cpp index 4d7b85a05..824a9ae9a 100644 --- a/src/core/spu.cpp +++ b/src/core/spu.cpp @@ -40,17 +40,17 @@ LOG_CHANNEL(SPU); #define SPU_ENABLE_VU_METER 1 #endif -ALWAYS_INLINE static constexpr s32 Clamp16(s32 value) +ALWAYS_INLINE constexpr s32 Clamp16(s32 value) { return (value < -0x8000) ? -0x8000 : (value > 0x7FFF) ? 0x7FFF : value; } -ALWAYS_INLINE static constexpr s32 ApplyVolume(s32 sample, s16 volume) +ALWAYS_INLINE constexpr s32 ApplyVolume(s32 sample, s16 volume) { return (sample * s32(volume)) >> 15; } -ALWAYS_INLINE static constexpr float ApplyVolumeF(float sample, s16 volume) +ALWAYS_INLINE constexpr float ApplyVolumeF(float sample, s16 volume) { return (sample * static_cast(volume)) / static_cast(0x8000); } diff --git a/src/duckstation-qt/vcruntimecheck.cpp b/src/duckstation-qt/vcruntimecheck.cpp index 2320a1040..946830dc7 100644 --- a/src/duckstation-qt/vcruntimecheck.cpp +++ b/src/duckstation-qt/vcruntimecheck.cpp @@ -20,7 +20,7 @@ static constexpr const char* DOWNLOAD_URL = "https://aka.ms/vs/17/release/vc_red // Can't rely on IsProcessorFeaturePresent(PF_SSE4_1_INSTRUCTIONS_AVAILABLE) because that was only added in Win10 2004, // and you can bet that people with such ancient CPUs probably aren't running the latest OS versions either. -ALWAYS_INLINE static bool CheckCPUIDForSSE4() +ALWAYS_INLINE bool CheckCPUIDForSSE4() { int result[4] = {};