[PATCH v2 5/7] wined3d: Move the "coherent" field from struct wined3d_bo_gl to struct wined3d_bo.

Zebediah Figura zfigura at codeweavers.com
Tue Oct 12 16:15:46 CDT 2021


Signed-off-by: Zebediah Figura <zfigura at codeweavers.com>
---
 dlls/wined3d/adapter_vk.c      | 4 ++--
 dlls/wined3d/context_gl.c      | 6 +++---
 dlls/wined3d/context_vk.c      | 2 ++
 dlls/wined3d/wined3d_private.h | 2 +-
 4 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/dlls/wined3d/adapter_vk.c b/dlls/wined3d/adapter_vk.c
index 8c3e63aac49..ffeffb4d145 100644
--- a/dlls/wined3d/adapter_vk.c
+++ b/dlls/wined3d/adapter_vk.c
@@ -983,7 +983,7 @@ static void *adapter_vk_map_bo_address(struct wined3d_context *context,
             wined3d_context_vk_reference_bo(context_vk, bo);
         }
 
-        if (!(bo->memory_type & VK_MEMORY_PROPERTY_HOST_COHERENT_BIT))
+        if (!bo->b.coherent)
         {
             range.sType = VK_STRUCTURE_TYPE_MAPPED_MEMORY_RANGE;
             range.pNext = NULL;
@@ -1024,7 +1024,7 @@ static void adapter_vk_unmap_bo_address(struct wined3d_context *context,
     vk_info = context_vk->vk_info;
     device_vk = wined3d_device_vk(context->device);
 
-    if (!(bo->memory_type & VK_MEMORY_PROPERTY_HOST_COHERENT_BIT))
+    if (!bo->b.coherent)
     {
         range.sType = VK_STRUCTURE_TYPE_MAPPED_MEMORY_RANGE;
         range.pNext = NULL;
diff --git a/dlls/wined3d/context_gl.c b/dlls/wined3d/context_gl.c
index b08003c697a..0bae527cc93 100644
--- a/dlls/wined3d/context_gl.c
+++ b/dlls/wined3d/context_gl.c
@@ -2684,7 +2684,7 @@ static void *wined3d_bo_gl_map(struct wined3d_bo_gl *bo,
     if ((flags & WINED3D_MAP_DISCARD) && bo->command_fence_id > device_gl->completed_fence_id)
     {
         if (wined3d_context_gl_create_bo(context_gl, bo->size,
-                bo->binding, bo->usage, bo->coherent, bo->flags, &tmp))
+                bo->binding, bo->usage, bo->b.coherent, bo->flags, &tmp))
         {
             list_move_head(&tmp.b.users, &bo->b.users);
             wined3d_context_gl_destroy_bo(context_gl, bo);
@@ -2762,7 +2762,7 @@ void wined3d_context_gl_unmap_bo_address(struct wined3d_context_gl *context_gl,
                     (UINT_PTR)data->addr + ranges[i].offset, ranges[i].size));
         }
     }
-    else if (!bo->coherent && gl_info->supported[APPLE_FLUSH_BUFFER_RANGE])
+    else if (!bo->b.coherent && gl_info->supported[APPLE_FLUSH_BUFFER_RANGE])
     {
         for (i = 0; i < range_count; ++i)
         {
@@ -2886,7 +2886,7 @@ bool wined3d_context_gl_create_bo(struct wined3d_context_gl *context_gl, GLsizei
     bo->binding = binding;
     bo->usage = usage;
     bo->flags = flags;
-    bo->coherent = coherent;
+    bo->b.coherent = coherent;
     list_init(&bo->b.users);
     bo->command_fence_id = 0;
     bo->b.memory_offset = 0;
diff --git a/dlls/wined3d/context_vk.c b/dlls/wined3d/context_vk.c
index f23d4d8f9fb..bc04c9dca88 100644
--- a/dlls/wined3d/context_vk.c
+++ b/dlls/wined3d/context_vk.c
@@ -413,6 +413,7 @@ static bool wined3d_context_vk_create_slab_bo(struct wined3d_context_vk *context
     bo->buffer_offset = idx * object_size;
     bo->b.memory_offset = slab->bo.b.memory_offset + bo->buffer_offset;
     bo->size = size;
+    bo->b.coherent = !!(bo->memory_type & VK_MEMORY_PROPERTY_HOST_COHERENT_BIT);
     list_init(&bo->b.users);
     bo->command_buffer_id = 0;
     bo->host_synced = false;
@@ -492,6 +493,7 @@ BOOL wined3d_context_vk_create_bo(struct wined3d_context_vk *context_vk, VkDevic
     bo->size = size;
     bo->usage = usage;
     bo->memory_type = adapter_vk->memory_properties.memoryTypes[memory_type_idx].propertyFlags;
+    bo->b.coherent = !!(bo->memory_type & VK_MEMORY_PROPERTY_HOST_COHERENT_BIT);
     list_init(&bo->b.users);
     bo->command_buffer_id = 0;
     bo->slab = NULL;
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 161d36ad76c..bc7b396e122 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -1592,6 +1592,7 @@ struct wined3d_bo
 {
     struct list users;
     size_t memory_offset;
+    bool coherent;
 };
 
 struct wined3d_bo_gl
@@ -1604,7 +1605,6 @@ struct wined3d_bo_gl
     GLenum usage;
 
     GLbitfield flags;
-    bool coherent;
     uint64_t command_fence_id;
 };
 
-- 
2.33.0




More information about the wine-devel mailing list