[prev in list] [next in list] [prev in thread] [next in thread]
List: wine-devel
Subject: [PATCH v2 1/2] wined3d: Negiotiate less specific memory types on allocation failure.
From: Jan Sikorski <jsikorski () codeweavers ! com>
Date: 2021-07-30 15:08:37
Message-ID: 20210730150838.235219-1-jsikorski () codeweavers ! com
[Download RAW message or body]
Try to combine DEVICE_LOCAL with HOST_CACHED and HOST_VISIBLE properties.
Drop HOST_CACHED or DEVICE_LOCAL in case the device does not support
a particular combination or there is no more space in a heap.
Signed-off-by: Jan Sikorski <jsikorski@codeweavers.com>
---
v2: simplified sequence
---
dlls/wined3d/buffer.c | 15 ++++++++++++---
1 file changed, 12 insertions(+), 3 deletions(-)
diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c
index 4420885b15f..afe186042e5 100644
--- a/dlls/wined3d/buffer.c
+++ b/dlls/wined3d/buffer.c
@@ -1390,6 +1390,7 @@ static BOOL wined3d_buffer_vk_create_buffer_object(struct \
wined3d_buffer_vk *buf uint32_t bind_flags = resource->bind_flags;
VkMemoryPropertyFlags memory_type;
VkBufferUsageFlags usage;
+ BOOL success;
usage = VK_BUFFER_USAGE_TRANSFER_SRC_BIT | VK_BUFFER_USAGE_TRANSFER_DST_BIT;
if (bind_flags & WINED3D_BIND_VERTEX_BUFFER)
@@ -1410,14 +1411,22 @@ static BOOL wined3d_buffer_vk_create_buffer_object(struct \
wined3d_buffer_vk *buf FIXME("Ignoring some bind flags %#x.\n", bind_flags);
memory_type = 0;
+ if (!(resource->usage & WINED3DUSAGE_DYNAMIC))
+ memory_type |= VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT;
if (resource->access & WINED3D_RESOURCE_ACCESS_MAP_R)
memory_type |= VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | \
VK_MEMORY_PROPERTY_HOST_CACHED_BIT; else if (resource->access & \
WINED3D_RESOURCE_ACCESS_MAP_W) memory_type |= VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT;
- else if (!(resource->usage & WINED3DUSAGE_DYNAMIC))
- memory_type |= VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT;
- if (!(wined3d_context_vk_create_bo(context_vk, resource->size, usage, \
memory_type, &buffer_vk->bo))) + success = \
wined3d_context_vk_create_bo(context_vk, resource->size, usage, memory_type, \
&buffer_vk->bo); + if (!success && memory_type & \
VK_MEMORY_PROPERTY_HOST_CACHED_BIT) + success = \
wined3d_context_vk_create_bo(context_vk, resource->size, usage, + \
memory_type & ~VK_MEMORY_PROPERTY_HOST_CACHED_BIT, &buffer_vk->bo); + if (!success \
&& memory_type & VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT) + success = \
wined3d_context_vk_create_bo(context_vk, resource->size, usage, + \
memory_type & ~VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT, &buffer_vk->bo); +
+ if (!success)
{
WARN("Failed to create Vulkan buffer.\n");
return FALSE;
--
2.30.2
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic