Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/HansKristian-Work/vkd3d-proton.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans-Kristian Arntzen <post@arntzen-software.no>2022-09-29 11:22:57 +0300
committerHans-Kristian Arntzen <post@arntzen-software.no>2022-09-29 11:25:20 +0300
commit4629958647336742a16beedfdaadfa02e8fd306d (patch)
tree877715e7475f26597e1feea58f54af8edc172881
parenteb052f080c8cf4c0f18b2fa524d89c239377cfde (diff)
vkd3d: Consider that CACHED can be an optional memory type.memory-type-early-fallbacks
Some resources might only expose HOST | COHERENT and not CACHED | COHERENT. If we cannot find a suitable type, just try again immediate with just COHERENT. Never try to fallback allocations on the outside. If we fail to allocate system memory, there is nothing we can do. Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
-rw-r--r--libs/vkd3d/memory.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/libs/vkd3d/memory.c b/libs/vkd3d/memory.c
index 5b9bea20..bbe4026e 100644
--- a/libs/vkd3d/memory.c
+++ b/libs/vkd3d/memory.c
@@ -177,6 +177,9 @@ static HRESULT vkd3d_try_allocate_device_memory(struct d3d12_device *device,
void *pNext, struct vkd3d_device_memory_allocation *allocation)
{
const VkPhysicalDeviceMemoryProperties *memory_props = &device->memory_properties;
+ /* We consider CACHED optional here if we cannot find a memory type that supports it.
+ * Failing to allocate CACHED is not a scenario where we would fall back. */
+ const VkMemoryPropertyFlags optional_flags_host = VK_MEMORY_PROPERTY_HOST_CACHED_BIT;
const VkMemoryPropertyFlags optional_flags = VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT;
const struct vkd3d_vk_device_procs *vk_procs = &device->vk_procs;
struct vkd3d_memory_info *memory_info = &device->memory_info;
@@ -274,10 +277,11 @@ static HRESULT vkd3d_try_allocate_device_memory(struct d3d12_device *device,
* another allocation if it can identify at least 2 GPU heaps, but in this case, the calling code
* might infer that we failed to allocate from a single supported GPU heap, and therefore there is no need
* to try more. We still have not actually tried anything, so query the memory types again. */
- if (type_flags & optional_flags)
+ if (type_flags & (optional_flags | optional_flags_host))
{
return vkd3d_try_allocate_device_memory(device, size,
- type_flags & ~optional_flags, base_type_mask, pNext, allocation);
+ type_flags & ~(optional_flags | optional_flags_host),
+ base_type_mask, pNext, allocation);
}
else
return E_OUTOFMEMORY;