[PATCH 2/8] wined3d: Pass a wined3d_device_vk to wined3d_context_vk_allocate_memory().

Zebediah Figura zfigura at codeweavers.com
Tue Nov 2 18:20:07 CDT 2021


With the goal of making the context_vk parameter optional, so that we can
allocate new BOs from the client thread.

Signed-off-by: Zebediah Figura <zfigura at codeweavers.com>
---
 dlls/wined3d/context_vk.c | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/dlls/wined3d/context_vk.c b/dlls/wined3d/context_vk.c
index 63de2f0f052..9854ca70ef0 100644
--- a/dlls/wined3d/context_vk.c
+++ b/dlls/wined3d/context_vk.c
@@ -306,10 +306,9 @@ VkDeviceMemory wined3d_context_vk_allocate_vram_chunk_memory(struct wined3d_cont
     return vk_memory;
 }
 
-static struct wined3d_allocator_block *wined3d_context_vk_allocate_memory(struct wined3d_context_vk *context_vk,
-        unsigned int memory_type, VkDeviceSize size, VkDeviceMemory *vk_memory)
+static struct wined3d_allocator_block *wined3d_device_vk_allocate_memory(struct wined3d_device_vk *device_vk,
+        struct wined3d_context_vk *context_vk, unsigned int memory_type, VkDeviceSize size, VkDeviceMemory *vk_memory)
 {
-    struct wined3d_device_vk *device_vk = wined3d_device_vk(context_vk->c.device);
     struct wined3d_allocator *allocator = &device_vk->allocator;
     struct wined3d_allocator_block *block;
 
@@ -330,7 +329,7 @@ static struct wined3d_allocator_block *wined3d_context_vk_allocate_memory(struct
     return block;
 }
 
-static bool wined3d_context_vk_create_slab_bo(struct wined3d_device_vk *device_vk, struct wined3d_context_vk *context_vk,
+static bool wined3d_device_vk_create_slab_bo(struct wined3d_device_vk *device_vk, struct wined3d_context_vk *context_vk,
         VkDeviceSize size, VkBufferUsageFlags usage, VkMemoryPropertyFlags memory_type, struct wined3d_bo_vk *bo)
 {
     const struct wined3d_adapter_vk *adapter_vk = wined3d_adapter_vk(context_vk->c.device->adapter);
@@ -434,7 +433,7 @@ BOOL wined3d_device_vk_create_bo(struct wined3d_device_vk *device_vk, struct win
     unsigned int memory_type_idx;
     VkResult vr;
 
-    if (wined3d_context_vk_create_slab_bo(device_vk, context_vk, size, usage, memory_type, bo))
+    if (wined3d_device_vk_create_slab_bo(device_vk, context_vk, size, usage, memory_type, bo))
         return TRUE;
 
     adapter_vk = wined3d_adapter_vk(device_vk->d.adapter);
@@ -464,7 +463,7 @@ BOOL wined3d_device_vk_create_bo(struct wined3d_device_vk *device_vk, struct win
         VK_CALL(vkDestroyBuffer(device_vk->vk_device, bo->vk_buffer, NULL));
         return FALSE;
     }
-    bo->memory = wined3d_context_vk_allocate_memory(context_vk,
+    bo->memory = wined3d_device_vk_allocate_memory(device_vk, context_vk,
             memory_type_idx, memory_requirements.size, &bo->vk_memory);
     if (!bo->vk_memory)
     {
@@ -557,7 +556,7 @@ BOOL wined3d_context_vk_create_image(struct wined3d_context_vk *context_vk, VkIm
         return FALSE;
     }
 
-    image->memory = wined3d_context_vk_allocate_memory(context_vk, memory_type_idx,
+    image->memory = wined3d_device_vk_allocate_memory(device_vk, context_vk, memory_type_idx,
             memory_requirements.size, &image->vk_memory);
     if (!image->vk_memory)
     {
-- 
2.33.0




More information about the wine-devel mailing list