[PATCH 1/5] wined3d: Introduce wined3d_context_vk_reference_bo().

Henri Verbeet hverbeet at codeweavers.com
Thu Apr 23 16:51:22 CDT 2020


Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
---
 dlls/wined3d/adapter_vk.c      | 6 +++---
 dlls/wined3d/texture.c         | 4 ++--
 dlls/wined3d/wined3d_private.h | 5 +++++
 3 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/dlls/wined3d/adapter_vk.c b/dlls/wined3d/adapter_vk.c
index efb1ae8ba22..9fd5c35d4b1 100644
--- a/dlls/wined3d/adapter_vk.c
+++ b/dlls/wined3d/adapter_vk.c
@@ -855,7 +855,7 @@ static void *adapter_vk_map_bo_address(struct wined3d_context *context,
             VK_CALL(vkInvalidateMappedMemoryRanges(device_vk->vk_device, 1, &range));
         }
 
-        bo->command_buffer_id = context_vk->current_command_buffer.id;
+        wined3d_context_vk_reference_bo(context_vk, bo);
     }
 
     if (bo->command_buffer_id == context_vk->current_command_buffer.id)
@@ -971,8 +971,8 @@ static void adapter_vk_copy_bo_address(struct wined3d_context *context,
         VK_CALL(vkCmdPipelineBarrier(vk_command_buffer, VK_PIPELINE_STAGE_TRANSFER_BIT,
                 VK_PIPELINE_STAGE_ALL_COMMANDS_BIT, 0, 0, NULL, 2, vk_barrier, 0, NULL));
 
-        src_bo->command_buffer_id = context_vk->current_command_buffer.id;
-        dst_bo->command_buffer_id = context_vk->current_command_buffer.id;
+        wined3d_context_vk_reference_bo(context_vk, src_bo);
+        wined3d_context_vk_reference_bo(context_vk, dst_bo);
 
         return;
     }
diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c
index aacc965ffcf..6b833cc4ec1 100644
--- a/dlls/wined3d/texture.c
+++ b/dlls/wined3d/texture.c
@@ -4625,7 +4625,7 @@ static void wined3d_texture_vk_upload_data(struct wined3d_context *context,
             VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, dst_texture_vk->layout,
             dst_texture_vk->vk_image, aspect_mask);
     dst_texture_vk->command_buffer_id = context_vk->current_command_buffer.id;
-    staging_bo.command_buffer_id = context_vk->current_command_buffer.id;
+    wined3d_context_vk_reference_bo(context_vk, &staging_bo);
     wined3d_context_vk_destroy_bo(context_vk, &staging_bo);
 }
 
@@ -4758,7 +4758,7 @@ static void wined3d_texture_vk_download_data(struct wined3d_context *context,
             src_texture_vk->vk_image, aspect_mask);
 
     src_texture_vk->command_buffer_id = context_vk->current_command_buffer.id;
-    staging_bo.command_buffer_id = context_vk->current_command_buffer.id;
+    wined3d_context_vk_reference_bo(context_vk, &staging_bo);
     wined3d_context_vk_submit_command_buffer(context_vk, 0, NULL, NULL, 0, NULL);
     wined3d_context_vk_wait_command_buffer(context_vk, src_texture_vk->command_buffer_id);
 
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index bd42e3f18b4..c4957d9bbc4 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -5483,6 +5483,11 @@ static inline void wined3d_context_copy_bo_address(struct wined3d_context *conte
     context->device->adapter->adapter_ops->adapter_copy_bo_address(context, dst, src, size);
 }
 
+static inline void wined3d_context_vk_reference_bo(struct wined3d_context_vk *context_vk, struct wined3d_bo_vk *bo)
+{
+    bo->command_buffer_id = context_vk->current_command_buffer.id;
+}
+
 static inline BOOL wined3d_dsv_srv_conflict(const struct wined3d_rendertarget_view *dsv,
         const struct wined3d_format *srv_format)
 {
-- 
2.20.1




More information about the wine-devel mailing list