Skip to content

Commit

Permalink
Dynamic Buffer: added GetVirtualSize method
Browse files Browse the repository at this point in the history
  • Loading branch information
TheMostDiligent committed Feb 14, 2024
1 parent 26c9841 commit ff42779
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
12 changes: 11 additions & 1 deletion Graphics/GraphicsTools/interface/DynamicBuffer.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2019-2023 Diligent Graphics LLC
* Copyright 2019-2024 Diligent Graphics LLC
* Copyright 2015-2019 Egor Yusov
*
* Licensed under the Apache License, Version 2.0 (the "License");
Expand Down Expand Up @@ -173,6 +173,16 @@ class DynamicBuffer
return m_Version.load();
}


/// Returns the virtual size of the sparse buffer.
///
/// \remarks If the internal buffer has not been initialized yet,
/// the method returns zero.
Uint64 GetVirtualSize() const
{
return m_pBuffer ? m_VirtualSize : 0;
}

private:
void InitBuffer(IRenderDevice* pDevice);
void CreateSparseBuffer(IRenderDevice* pDevice);
Expand Down
4 changes: 2 additions & 2 deletions Graphics/GraphicsTools/src/DynamicBuffer.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2019-2023 Diligent Graphics LLC
* Copyright 2019-2024 Diligent Graphics LLC
* Copyright 2015-2019 Egor Yusov
*
* Licensed under the Apache License, Version 2.0 (the "License");
Expand Down Expand Up @@ -66,7 +66,7 @@ DynamicBuffer::DynamicBuffer(IRenderDevice* pDevice,
const DynamicBufferCreateInfo& CI) :
m_Name{CI.Desc.Name != nullptr ? CI.Desc.Name : "Dynamic buffer"},
m_Desc{CI.Desc},
m_VirtualSize{CI.VirtualSize},
m_VirtualSize{CI.Desc.Usage == USAGE_SPARSE ? CI.VirtualSize : 0},
m_MemoryPageSize{CI.MemoryPageSize}
{
if (m_Desc.BindFlags & (BIND_SHADER_RESOURCE | BIND_UNORDERED_ACCESS))
Expand Down

0 comments on commit ff42779

Please sign in to comment.