Zebediah Figura : wined3d: Move the "coherent" field from struct wined3d_bo_gl to struct wined3d_bo.

Alexandre Julliard julliard at winehq.org
Fri Oct 15 15:40:04 CDT 2021


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

Author: Zebediah Figura <zfigura at codeweavers.com>
Date:   Thu Oct 14 23:44:17 2021 -0500

wined3d: Move the "coherent" field from struct wined3d_bo_gl 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      | 4 ++--
 dlls/wined3d/context_gl.c      | 6 +++---
 dlls/wined3d/context_vk.c      | 1 +
 dlls/wined3d/resource.c        | 2 +-
 dlls/wined3d/wined3d_private.h | 2 +-
 5 files changed, 8 insertions(+), 7 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 4510fe5b155..2bc63464f7b 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);
@@ -2754,7 +2754,7 @@ void wined3d_context_gl_unmap_bo_address(struct wined3d_context_gl *context_gl,
     gl_info = context_gl->gl_info;
     wined3d_context_gl_bind_bo(context_gl, bo->binding, bo->id);
 
-    if (!bo->coherent)
+    if (!bo->b.coherent)
     {
         if (gl_info->supported[ARB_MAP_BUFFER_RANGE])
         {
@@ -2889,7 +2889,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 ad2f7adfe0b..8e055202ec2 100644
--- a/dlls/wined3d/context_vk.c
+++ b/dlls/wined3d/context_vk.c
@@ -492,6 +492,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/resource.c b/dlls/wined3d/resource.c
index abf07682c76..c8fb4cf2e29 100644
--- a/dlls/wined3d/resource.c
+++ b/dlls/wined3d/resource.c
@@ -395,7 +395,7 @@ GLbitfield wined3d_resource_gl_map_flags(const struct wined3d_bo_gl *bo, DWORD d
     if (d3d_flags & WINED3D_MAP_WRITE)
     {
         ret |= GL_MAP_WRITE_BIT;
-        if (!bo->coherent)
+        if (!bo->b.coherent)
             ret |= GL_MAP_FLUSH_EXPLICIT_BIT;
     }
     if (d3d_flags & WINED3D_MAP_READ)
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 41956f1f061..993d0b3c4e4 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;
 };
 




More information about the wine-cvs mailing list