Skip to content

Commit 9e3b277

Browse files
DeviceContextVkImpl: made GetDynamicBufferOffset function force-inlined
1 parent 31a2065 commit 9e3b277

File tree

2 files changed

+23
-27
lines changed

2 files changed

+23
-27
lines changed

Graphics/GraphicsEngineVulkan/include/DeviceContextVkImpl.hpp

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,7 @@ class DeviceContextVkImpl final : public DeviceContextNextGenBase<EngineVkImplTr
407407

408408
QueryManagerVk* GetQueryManager() { return m_pQueryMgr; }
409409

410-
size_t GetDynamicBufferOffset(const BufferVkImpl* pBuffer, bool VerifyAllocation = true);
410+
__forceinline size_t GetDynamicBufferOffset(const BufferVkImpl* pBuffer, bool VerifyAllocation = true);
411411

412412
#ifdef DILIGENT_DEVELOPMENT
413413
void DvpVerifyDynamicAllocation(const BufferVkImpl* pBuffer) const;
@@ -656,4 +656,26 @@ class DeviceContextVkImpl final : public DeviceContextNextGenBase<EngineVkImplTr
656656
VulkanUtilities::QueryPoolWrapper m_ASQueryPool;
657657
};
658658

659+
660+
__forceinline size_t DeviceContextVkImpl::GetDynamicBufferOffset(const BufferVkImpl* pBuffer, bool VerifyAllocation)
661+
{
662+
VERIFY_EXPR(pBuffer != nullptr);
663+
664+
if (pBuffer->m_VulkanBuffer != VK_NULL_HANDLE)
665+
return 0;
666+
667+
#ifdef DILIGENT_DEVELOPMENT
668+
if (VerifyAllocation)
669+
{
670+
DvpVerifyDynamicAllocation(pBuffer);
671+
}
672+
#endif
673+
674+
const Uint32 DynamicBufferId = pBuffer->GetDynamicBufferId();
675+
VERIFY(DynamicBufferId != ~0u, "Dynamic buffer '", pBuffer->GetDesc().Name, "' does not have dynamic buffer ID");
676+
return DynamicBufferId < m_MappedBuffers.size() ?
677+
m_MappedBuffers[DynamicBufferId].Allocation.AlignedOffset :
678+
0;
679+
}
680+
659681
} // namespace Diligent

Graphics/GraphicsEngineVulkan/src/DeviceContextVkImpl.cpp

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -2316,32 +2316,6 @@ void DeviceContextVkImpl::DvpVerifyDynamicAllocation(const BufferVkImpl* pBuffer
23162316
}
23172317
#endif
23182318

2319-
size_t DeviceContextVkImpl::GetDynamicBufferOffset(const BufferVkImpl* pBuffer, bool VerifyAllocation)
2320-
{
2321-
VERIFY_EXPR(pBuffer != nullptr);
2322-
2323-
if (pBuffer->m_VulkanBuffer != VK_NULL_HANDLE)
2324-
return 0;
2325-
2326-
#ifdef DILIGENT_DEVELOPMENT
2327-
if (VerifyAllocation)
2328-
{
2329-
DvpVerifyDynamicAllocation(pBuffer);
2330-
}
2331-
#endif
2332-
2333-
const Uint32 DynamicBufferId = pBuffer->GetDynamicBufferId();
2334-
VERIFY(DynamicBufferId != ~0u, "Dynamic buffer '", pBuffer->GetDesc().Name, "' does not have dynamic buffer ID");
2335-
if (DynamicBufferId < m_MappedBuffers.size())
2336-
{
2337-
return m_MappedBuffers[DynamicBufferId].Allocation.AlignedOffset;
2338-
}
2339-
else
2340-
{
2341-
return 0;
2342-
}
2343-
}
2344-
23452319
void DeviceContextVkImpl::UpdateTexture(ITexture* pTexture,
23462320
Uint32 MipLevel,
23472321
Uint32 Slice,

0 commit comments

Comments
 (0)