Skip to content

Commit 994158b

Browse files
VertexPool: set buffer virtual size based on the max vertex count
1 parent 0104a93 commit 994158b

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

Graphics/GraphicsTools/src/VertexPool.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -189,8 +189,10 @@ class VertexPoolImpl final : public ObjectBase<IVertexPool>
189189
CreateInfo.ExtraVertexCount * VtxElem.Size :
190190
static_cast<Uint32>(DynBuffCI.Desc.Size);
191191

192-
// 1 GB should be enough for any use case.
193-
DynBuffCI.VirtualSize = Uint64{1} << Uint64{30};
192+
DynBuffCI.VirtualSize = m_MaxVertexCount != 0 ?
193+
Uint64{m_MaxVertexCount} * Uint64{VtxElem.Size} :
194+
// Use 2GB as the default virtual size
195+
Uint64{2} << Uint64{30};
194196

195197
m_Buffers.emplace_back(std::make_unique<DynamicBuffer>(pDevice, DynBuffCI));
196198
if (!m_Buffers.back())

0 commit comments

Comments
 (0)