Skip to content

Commit

Permalink
[dxvk] Allow overcommitting non-device local memory
Browse files Browse the repository at this point in the history
If allocations on host-local memory types fail, we can rely on
Vulkan's error reporting. May fix issues on systems with small amounts of VRAM.
  • Loading branch information
doitsujin committed May 29, 2018
1 parent c600b43 commit 3b70e23
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/dxvk/dxvk_memory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ namespace dxvk {

DxvkMemoryStats DxvkMemoryAllocator::getMemoryStats() {
std::lock_guard<std::mutex> lock(m_mutex);

DxvkMemoryStats totalStats;

for (size_t i = 0; i < m_memProps.memoryHeapCount; i++) {
Expand Down Expand Up @@ -260,7 +260,8 @@ namespace dxvk {
DxvkDeviceMemory DxvkMemoryAllocator::tryAllocDeviceMemory(
DxvkMemoryType* type,
VkDeviceSize size) {
if (type->heap->stats.memoryAllocated + size > type->heap->properties.size)
if ((type->memType.propertyFlags & VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT)
&& (type->heap->stats.memoryAllocated + size > type->heap->properties.size))
return DxvkDeviceMemory();

DxvkDeviceMemory result;
Expand Down

0 comments on commit 3b70e23

Please sign in to comment.