Skip to content

Commit

Permalink
[dxvk] Do not create global buffer with unaligned size
Browse files Browse the repository at this point in the history
  • Loading branch information
doitsujin committed Sep 26, 2024
1 parent 1370e39 commit c5d1286
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/dxvk/dxvk_memory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ namespace dxvk {
}

// Create global buffer if the allocation supports it
if (type.bufferUsage && !next) {
if (type.bufferUsage && !next && !(size & (GlobalBufferAlignment - 1u))) {
VkBuffer buffer = VK_NULL_HANDLE;

VkBufferCreateInfo bufferInfo = { VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO };
Expand Down
4 changes: 4 additions & 0 deletions src/dxvk/dxvk_memory.h
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,10 @@ namespace dxvk {

constexpr static VkDeviceSize MinChunkSize = 4ull << 20;
constexpr static VkDeviceSize MaxChunkSize = 256ull << 20;

// Assume an alignment of 256 bytes. This is enough to satisfy all
// buffer use cases, and matches our minimum allocation size.
constexpr static VkDeviceSize GlobalBufferAlignment = 256u;
public:

DxvkMemoryAllocator(DxvkDevice* device);
Expand Down

0 comments on commit c5d1286

Please sign in to comment.