Zebediah Figura : wined3d: Move the "memory_offset" field from struct wined3d_bo_vk to struct wined3d_bo.

Alexandre Julliard julliard at winehq.org
Thu Oct 14 15:09:33 CDT 2021


Module: wine
Branch: master
Commit: c53736d12fb0a03fa059d1ee10d1a34f5572aca6
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=c53736d12fb0a03fa059d1ee10d1a34f5572aca6

Author: Zebediah Figura <zfigura at codeweavers.com>
Date:   Tue Oct 12 16:15:45 2021 -0500

wined3d: Move the "memory_offset" field from struct wined3d_bo_vk to struct wined3d_bo.

Signed-off-by: Zebediah Figura <zfigura at codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/wined3d/adapter_vk.c      | 6 +++---
 dlls/wined3d/context_gl.c      | 1 +
 dlls/wined3d/context_vk.c      | 6 +++---
 dlls/wined3d/wined3d_private.h | 2 +-
 4 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/dlls/wined3d/adapter_vk.c b/dlls/wined3d/adapter_vk.c
index fe738a4bcaa..8c3e63aac49 100644
--- a/dlls/wined3d/adapter_vk.c
+++ b/dlls/wined3d/adapter_vk.c
@@ -988,7 +988,7 @@ static void *adapter_vk_map_bo_address(struct wined3d_context *context,
             range.sType = VK_STRUCTURE_TYPE_MAPPED_MEMORY_RANGE;
             range.pNext = NULL;
             range.memory = bo->vk_memory;
-            range.offset = bo->memory_offset + (uintptr_t)data->addr;
+            range.offset = bo->b.memory_offset + (uintptr_t)data->addr;
             range.size = size;
             VK_CALL(vkInvalidateMappedMemoryRanges(device_vk->vk_device, 1, &range));
         }
@@ -1005,7 +1005,7 @@ map:
         return NULL;
     }
 
-    return (uint8_t *)map_ptr + bo->memory_offset + (uintptr_t)data->addr;
+    return (uint8_t *)map_ptr + bo->b.memory_offset + (uintptr_t)data->addr;
 }
 
 static void adapter_vk_unmap_bo_address(struct wined3d_context *context,
@@ -1032,7 +1032,7 @@ static void adapter_vk_unmap_bo_address(struct wined3d_context *context,
 
         for (i = 0; i < range_count; ++i)
         {
-            range.offset = bo->memory_offset + ranges[i].offset;
+            range.offset = bo->b.memory_offset + ranges[i].offset;
             range.size = ranges[i].size;
             VK_CALL(vkFlushMappedMemoryRanges(device_vk->vk_device, 1, &range));
         }
diff --git a/dlls/wined3d/context_gl.c b/dlls/wined3d/context_gl.c
index 55782f1ba8e..b08003c697a 100644
--- a/dlls/wined3d/context_gl.c
+++ b/dlls/wined3d/context_gl.c
@@ -2889,6 +2889,7 @@ bool wined3d_context_gl_create_bo(struct wined3d_context_gl *context_gl, GLsizei
     bo->coherent = coherent;
     list_init(&bo->b.users);
     bo->command_fence_id = 0;
+    bo->b.memory_offset = 0;
 
     return true;
 }
diff --git a/dlls/wined3d/context_vk.c b/dlls/wined3d/context_vk.c
index ebd8bbece89..ad2f7adfe0b 100644
--- a/dlls/wined3d/context_vk.c
+++ b/dlls/wined3d/context_vk.c
@@ -411,7 +411,7 @@ static bool wined3d_context_vk_create_slab_bo(struct wined3d_context_vk *context
     bo->memory = NULL;
     bo->slab = slab;
     bo->buffer_offset = idx * object_size;
-    bo->memory_offset = slab->bo.memory_offset + bo->buffer_offset;
+    bo->b.memory_offset = slab->bo.b.memory_offset + bo->buffer_offset;
     bo->size = size;
     list_init(&bo->b.users);
     bo->command_buffer_id = 0;
@@ -473,10 +473,10 @@ BOOL wined3d_context_vk_create_bo(struct wined3d_context_vk *context_vk, VkDevic
         VK_CALL(vkDestroyBuffer(device_vk->vk_device, bo->vk_buffer, NULL));
         return FALSE;
     }
-    bo->memory_offset = bo->memory ? bo->memory->offset : 0;
+    bo->b.memory_offset = bo->memory ? bo->memory->offset : 0;
 
     if ((vr = VK_CALL(vkBindBufferMemory(device_vk->vk_device, bo->vk_buffer,
-            bo->vk_memory, bo->memory_offset))) < 0)
+            bo->vk_memory, bo->b.memory_offset))) < 0)
     {
         ERR("Failed to bind buffer memory, vr %s.\n", wined3d_debug_vkresult(vr));
         if (bo->memory)
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index ab262e3425c..161d36ad76c 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -1591,6 +1591,7 @@ do {                                                                \
 struct wined3d_bo
 {
     struct list users;
+    size_t memory_offset;
 };
 
 struct wined3d_bo_gl
@@ -1630,7 +1631,6 @@ struct wined3d_bo_vk
     void *map_ptr;
 
     VkDeviceSize buffer_offset;
-    VkDeviceSize memory_offset;
     VkDeviceSize size;
     VkBufferUsageFlags usage;
     VkMemoryPropertyFlags memory_type;




More information about the wine-cvs mailing list