diff --git a/src/dxvk/dxvk_buffer.cpp b/src/dxvk/dxvk_buffer.cpp index 7fb1e503c..9b1442906 100644 --- a/src/dxvk/dxvk_buffer.cpp +++ b/src/dxvk/dxvk_buffer.cpp @@ -125,9 +125,18 @@ namespace dxvk { vkd->vkGetBufferMemoryRequirements2KHR( vkd->device(), &memReqInfo, &memReq); + // Use high memory priority for GPU-writable resources + bool isGpuWritable = (m_info.usage & ( + VK_BUFFER_USAGE_STORAGE_BUFFER_BIT | + VK_BUFFER_USAGE_STORAGE_TEXEL_BUFFER_BIT)) != 0; + + float priority = isGpuWritable ? 1.0f : 0.5f; + + // Ask driver whether we should be using a dedicated allocation bool useDedicated = dedicatedRequirements.prefersDedicatedAllocation; + handle.memory = m_memAlloc->alloc(&memReq.memoryRequirements, - useDedicated ? &dedMemoryAllocInfo : nullptr, m_memFlags, 0.5f); + useDedicated ? &dedMemoryAllocInfo : nullptr, m_memFlags, priority); if (vkd->vkBindBufferMemory(vkd->device(), handle.buffer, handle.memory.memory(), handle.memory.offset()) != VK_SUCCESS) diff --git a/src/dxvk/dxvk_image.cpp b/src/dxvk/dxvk_image.cpp index eeeb5ae7d..ecab78dea 100644 --- a/src/dxvk/dxvk_image.cpp +++ b/src/dxvk/dxvk_image.cpp @@ -89,9 +89,19 @@ namespace dxvk { memReq.memoryRequirements.alignment = align(memReq.memoryRequirements.alignment , memAlloc.bufferImageGranularity()); } + // Use high memory priority for GPU-writable resources + bool isGpuWritable = (m_info.usage & ( + VK_IMAGE_USAGE_STORAGE_BIT | + VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT | + VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT)) != 0; + + float priority = isGpuWritable ? 1.0f : 0.5f; + + // Ask driver whether we should be using a dedicated allocation bool useDedicated = dedicatedRequirements.prefersDedicatedAllocation; + m_memory = memAlloc.alloc(&memReq.memoryRequirements, - useDedicated ? &dedMemoryAllocInfo : nullptr, memFlags, 0.5f); + useDedicated ? &dedMemoryAllocInfo : nullptr, memFlags, priority); // Try to bind the allocated memory slice to the image if (m_vkd->vkBindImageMemory(m_vkd->device(),