Misc: Swap LIKELY/UNLIKELY macros for attributes
This commit is contained in:
@ -114,7 +114,7 @@ void D3D11Framebuffer::SetDebugName(const std::string_view& name)
|
||||
|
||||
void D3D11Framebuffer::CommitClear(ID3D11DeviceContext1* context)
|
||||
{
|
||||
if (UNLIKELY(m_rt && m_rt->GetState() != GPUTexture::State::Dirty))
|
||||
if (m_rt && m_rt->GetState() != GPUTexture::State::Dirty) [[unlikely]]
|
||||
{
|
||||
if (m_rt->GetState() == GPUTexture::State::Invalidated)
|
||||
context->DiscardView(m_rtv.Get());
|
||||
@ -124,7 +124,7 @@ void D3D11Framebuffer::CommitClear(ID3D11DeviceContext1* context)
|
||||
m_rt->SetState(GPUTexture::State::Dirty);
|
||||
}
|
||||
|
||||
if (UNLIKELY(m_ds && m_ds->GetState() != GPUTexture::State::Dirty))
|
||||
if (m_ds && m_ds->GetState() != GPUTexture::State::Dirty) [[unlikely]]
|
||||
{
|
||||
if (m_ds->GetState() == GPUTexture::State::Invalidated)
|
||||
context->DiscardView(m_dsv.Get());
|
||||
|
||||
@ -1563,7 +1563,7 @@ void D3D12Device::BeginRenderPass()
|
||||
|
||||
ID3D12GraphicsCommandList4* cmdlist = GetCommandList();
|
||||
|
||||
if (LIKELY(m_current_framebuffer))
|
||||
if (m_current_framebuffer) [[likely]]
|
||||
{
|
||||
D3D12Texture* rt = static_cast<D3D12Texture*>(m_current_framebuffer->GetRT());
|
||||
if (rt)
|
||||
|
||||
@ -36,7 +36,7 @@ std::pair<const char*, u32> Host::LookupTranslationString(const std::string_view
|
||||
s32 len;
|
||||
|
||||
// Shouldn't happen, but just in case someone tries to translate an empty string.
|
||||
if (UNLIKELY(msg.empty()))
|
||||
if (msg.empty()) [[unlikely]]
|
||||
{
|
||||
ret.first = &s_translation_string_cache[0];
|
||||
ret.second = 0;
|
||||
@ -46,11 +46,11 @@ std::pair<const char*, u32> Host::LookupTranslationString(const std::string_view
|
||||
s_translation_string_mutex.lock_shared();
|
||||
ctx_it = s_translation_string_map.find(context);
|
||||
|
||||
if (UNLIKELY(ctx_it == s_translation_string_map.end()))
|
||||
if (ctx_it == s_translation_string_map.end()) [[unlikely]]
|
||||
goto add_string;
|
||||
|
||||
msg_it = ctx_it->second.find(msg);
|
||||
if (UNLIKELY(msg_it == ctx_it->second.end()))
|
||||
if (msg_it == ctx_it->second.end()) [[unlikely]]
|
||||
goto add_string;
|
||||
|
||||
ret.first = &s_translation_string_cache[msg_it->second.first];
|
||||
@ -62,7 +62,7 @@ add_string:
|
||||
s_translation_string_mutex.unlock_shared();
|
||||
s_translation_string_mutex.lock();
|
||||
|
||||
if (UNLIKELY(s_translation_string_cache.empty()))
|
||||
if (s_translation_string_cache.empty()) [[unlikely]]
|
||||
{
|
||||
// First element is always an empty string.
|
||||
s_translation_string_cache.resize(TRANSLATION_STRING_CACHE_SIZE);
|
||||
|
||||
@ -2686,7 +2686,7 @@ void VulkanDevice::BeginRenderPass()
|
||||
VK_STRUCTURE_TYPE_RENDER_PASS_BEGIN_INFO, nullptr, VK_NULL_HANDLE, VK_NULL_HANDLE, {}, 0u, nullptr};
|
||||
std::array<VkClearValue, 2> clear_values;
|
||||
|
||||
if (LIKELY(m_current_framebuffer))
|
||||
if (m_current_framebuffer) [[likely]]
|
||||
{
|
||||
VkFormat rt_format = VK_FORMAT_UNDEFINED;
|
||||
VkFormat ds_format = VK_FORMAT_UNDEFINED;
|
||||
|
||||
Reference in New Issue
Block a user