diff --git a/premake5.lua b/premake5.lua index 55a0523a4..d55843c3e 100644 --- a/premake5.lua +++ b/premake5.lua @@ -211,6 +211,11 @@ workspace("xenia") architecture("x86_64") if os.istarget("linux") then platforms({"Linux"}) + elseif os.istarget("macosx") then + platforms({"Mac"}) + xcodebuildsettings({ + ["ARCHS"] = "x86_64" + }) elseif os.istarget("windows") then platforms({"Windows"}) -- 10.0.15063.0: ID3D12GraphicsCommandList1::SetSamplePositions. diff --git a/src/xenia/base/arena.cc b/src/xenia/base/arena.cc index 9b619cf56..66184f0f2 100644 --- a/src/xenia/base/arena.cc +++ b/src/xenia/base/arena.cc @@ -48,7 +48,7 @@ void Arena::DebugFill() { void* Arena::Alloc(size_t size, size_t align) { assert_true( - xe::bit_count(align) == 1 && align <= 16, + align > 0 && xe::is_pow2(align) && align <= 16, "align needs to be a power of 2 and not greater than Chunk alignment"); // for alignment diff --git a/src/xenia/base/atomic.h b/src/xenia/base/atomic.h index f1b8bb4b7..e34a6f1e6 100644 --- a/src/xenia/base/atomic.h +++ b/src/xenia/base/atomic.h @@ -16,46 +16,7 @@ namespace xe { -// These functions are modeled off of the Apple OSAtomic routines -// https://developer.apple.com/documentation/kernel/osatomic_h (?) -// Original link (dead): -// https://developer.apple.com/library/mac/#documentation/DriversKernelHardware/Reference/libkern_ref/OSAtomic_h/ - -#if XE_PLATFORM_MAC - -inline int32_t atomic_inc(volatile int32_t* value) { - return OSAtomicIncrement32Barrier(reinterpret_cast(value)); -} -inline int32_t atomic_dec(volatile int32_t* value) { - return OSAtomicDecrement32Barrier(reinterpret_cast(value)); -} - -inline int32_t atomic_exchange(int32_t new_value, volatile int32_t* value) { - return OSAtomicCompareAndSwap32Barrier(*value, new_value, value); -} -inline int64_t atomic_exchange(int64_t new_value, volatile int64_t* value) { - return OSAtomicCompareAndSwap64Barrier(*value, new_value, value); -} - -inline int32_t atomic_exchange_add(int32_t amount, volatile int32_t* value) { - return OSAtomicAdd32Barrier(amount, value) - amount; -} -inline int64_t atomic_exchange_add(int64_t amount, volatile int64_t* value) { - return OSAtomicAdd64Barrier(amount, value) - amount; -} - -inline bool atomic_cas(int32_t old_value, int32_t new_value, - volatile int32_t* value) { - return OSAtomicCompareAndSwap32Barrier( - old_value, new_value, reinterpret_cast(value)); -} -inline bool atomic_cas(int64_t old_value, int64_t new_value, - volatile int64_t* value) { - return OSAtomicCompareAndSwap64Barrier( - old_value, new_value, reinterpret_cast(value)); -} - -#elif XE_PLATFORM_WIN32 +#if XE_PLATFORM_WIN32 inline int32_t atomic_inc(volatile int32_t* value) { return _InterlockedIncrement(reinterpret_cast(value)); @@ -94,7 +55,7 @@ inline bool atomic_cas(int64_t old_value, int64_t new_value, old_value) == old_value; } -#elif XE_PLATFORM_LINUX +#elif XE_PLATFORM_LINUX || XE_PLATFORM_MAC inline int32_t atomic_inc(volatile int32_t* value) { return __sync_add_and_fetch(value, 1); @@ -132,7 +93,7 @@ inline bool atomic_cas(int64_t old_value, int64_t new_value, #error No atomic primitives defined for this platform/cpu combination. -#endif // OSX +#endif // XE_PLATFORM inline uint32_t atomic_inc(volatile uint32_t* value) { return static_cast( diff --git a/src/xenia/base/clock_x64.cc b/src/xenia/base/clock_x64.cc index e84d5baf2..14155303a 100644 --- a/src/xenia/base/clock_x64.cc +++ b/src/xenia/base/clock_x64.cc @@ -80,7 +80,7 @@ uint64_t Clock::host_tick_frequency_raw() { // For some CPUs, Crystal frequency is not reported. if (ratio_num && ratio_den && cryst_freq) { // If it is, calculate the TSC frequency - auto tsc_freq = cryst_freq * ratio_num / ratio_den; + return cryst_freq * ratio_num / ratio_den; } } diff --git a/src/xenia/base/logging.cc b/src/xenia/base/logging.cc index 1bf3870a0..ef04ec192 100644 --- a/src/xenia/base/logging.cc +++ b/src/xenia/base/logging.cc @@ -280,8 +280,7 @@ class Logger { // many blocks needed for at least one log line. auto next_range = dp::sequence_range(next_sequence, desired_count); - auto available_sequence = claim_strategy_.wait_until_published( - next_range.last(), last_sequence); + claim_strategy_.wait_until_published(next_range.last(), last_sequence); size_t read_count = 0; auto available_range = next_range; diff --git a/src/xenia/base/utf8.cc b/src/xenia/base/utf8.cc index 3f4775b7a..943e293b1 100644 --- a/src/xenia/base/utf8.cc +++ b/src/xenia/base/utf8.cc @@ -241,7 +241,6 @@ std::string_view::size_type find_any_of(const std::string_view haystack, auto [haystack_begin, haystack_end] = make_citer(haystack); auto [needle_begin, needle_end] = make_citer(needles); - auto needle_count = count(needles); auto it = find_needle(haystack_begin, haystack_end, needle_begin, needle_end); if (it == haystack_end) { @@ -261,7 +260,6 @@ std::string_view::size_type find_any_of_case(const std::string_view haystack, auto [haystack_begin, haystack_end] = make_citer(haystack); auto [needle_begin, needle_end] = make_citer(needles); - auto needle_count = count(needles); auto it = find_needle_case(haystack_begin, haystack_end, needle_begin, needle_end); diff --git a/third_party/FFmpeg b/third_party/FFmpeg index fb6c32ddf..e07c38c67 160000 --- a/third_party/FFmpeg +++ b/third_party/FFmpeg @@ -1 +1 @@ -Subproject commit fb6c32ddf75d818dce39e2f7d00401e9864a8d4d +Subproject commit e07c38c67578352e3f3e769cdac91650ea9575a9 diff --git a/third_party/SDL2.lua b/third_party/SDL2.lua index ab4c68d34..972aa1aa7 100644 --- a/third_party/SDL2.lua +++ b/third_party/SDL2.lua @@ -30,7 +30,7 @@ function sdl2_include() includedirs({ path.getrelative(".", third_party_path) .. "/SDL2/include", }) - filter("platforms:Linux") + filter("platforms:Linux or platforms:Mac") includedirs(sdl2_sys_includedirs) filter({}) end