From 1454934a07b233693291c5eba297e13811e496ab Mon Sep 17 00:00:00 2001 From: TellowKrinkle Date: Mon, 30 Sep 2024 23:35:27 -0500 Subject: [PATCH] VideoBackends:Metal: Use standardized C++ features over clang builtins --- Source/Core/VideoBackends/Metal/MTLObjectCache.h | 2 +- Source/Core/VideoBackends/Metal/MTLStateTracker.mm | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Source/Core/VideoBackends/Metal/MTLObjectCache.h b/Source/Core/VideoBackends/Metal/MTLObjectCache.h index f47a513116..81d77e894b 100644 --- a/Source/Core/VideoBackends/Metal/MTLObjectCache.h +++ b/Source/Core/VideoBackends/Metal/MTLObjectCache.h @@ -83,7 +83,7 @@ public: id GetSampler(SamplerSelector sel) { - if (__builtin_expect(!m_samplers[sel.value], false)) + if (!m_samplers[sel.value]) [[unlikely]] m_samplers[sel.value] = CreateSampler(sel); return m_samplers[sel.value]; } diff --git a/Source/Core/VideoBackends/Metal/MTLStateTracker.mm b/Source/Core/VideoBackends/Metal/MTLStateTracker.mm index b67c4162b1..e9abbaee33 100644 --- a/Source/Core/VideoBackends/Metal/MTLStateTracker.mm +++ b/Source/Core/VideoBackends/Metal/MTLStateTracker.mm @@ -144,7 +144,7 @@ Metal::StateTracker::Map Metal::StateTracker::AllocateForTextureUpload(size_t am CPUBuffer& buffer = m_texture_upload_buffer; u64 last_draw = m_last_finished_draw.load(std::memory_order_acquire); bool needs_new = buffer.usage.PrepareForAllocation(last_draw, amt); - if (__builtin_expect(needs_new, false)) + if (needs_new) [[unlikely]] { // Orphan buffer size_t newsize = std::max(buffer.usage.Size() * 2, 4096); @@ -187,7 +187,7 @@ std::pair Metal::StateTracker::Preallocate(UploadBuffer buffer_id } buffer.last_upload = 0; } - if (__builtin_expect(needs_new, false)) + if (needs_new) [[unlikely]] { // Orphan buffer size_t newsize = std::max(buffer.usage.Size() * 2, 4096);