Skip to content

Commit 3d955bd

Browse files
Vertex pool: improved default virtual size computation
Reserve some space for alignment
1 parent 994158b commit 3d955bd

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

Graphics/GraphicsTools/src/VertexPool.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -191,8 +191,9 @@ class VertexPoolImpl final : public ObjectBase<IVertexPool>
191191

192192
DynBuffCI.VirtualSize = m_MaxVertexCount != 0 ?
193193
Uint64{m_MaxVertexCount} * Uint64{VtxElem.Size} :
194-
// Use 2GB as the default virtual size
195-
Uint64{2} << Uint64{30};
194+
// Use 2GB as the default virtual size, but reserve at least 1 MB for alignment.
195+
// Resources above 2GB don't work in Direct3D11 (even though there are no errors).
196+
(Uint64{2} << Uint64{30}) - AlignUp(DynBuffCI.MemoryPageSize, 1u << 20u);
196197

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

0 commit comments

Comments
 (0)