Zebediah Figura : wined3d: Do not accelerate NOOVERWRITE maps if we cannot map persistently.

Alexandre Julliard julliard at winehq.org
Wed Jun 1 15:44:32 CDT 2022


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

Author: Zebediah Figura <zfigura at codeweavers.com>
Date:   Mon May 30 20:10:07 2022 -0500

wined3d: Do not accelerate NOOVERWRITE maps if we cannot map persistently.

I.e. if ARB_buffer_storage is not supported.

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

---

 dlls/wined3d/adapter_gl.c      | 1 +
 dlls/wined3d/adapter_vk.c      | 1 +
 dlls/wined3d/buffer.c          | 4 +++-
 dlls/wined3d/wined3d_private.h | 1 +
 4 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/dlls/wined3d/adapter_gl.c b/dlls/wined3d/adapter_gl.c
index 0d9f6953de3..05e8c112388 100644
--- a/dlls/wined3d/adapter_gl.c
+++ b/dlls/wined3d/adapter_gl.c
@@ -5231,6 +5231,7 @@ static void wined3d_adapter_gl_init_d3d_info(struct wined3d_adapter_gl *adapter_
     d3d_info->fences = wined3d_fence_supported(gl_info);
     d3d_info->feature_level = feature_level_from_caps(gl_info, &shader_caps, &fragment_caps);
     d3d_info->filling_convention_offset = gl_info->filling_convention_offset;
+    d3d_info->persistent_map = !!gl_info->supported[ARB_BUFFER_STORAGE];
 
     if (gl_info->supported[ARB_TEXTURE_MULTISAMPLE])
         d3d_info->multisample_draw_location = WINED3D_LOCATION_TEXTURE_RGB;
diff --git a/dlls/wined3d/adapter_vk.c b/dlls/wined3d/adapter_vk.c
index cd1748afe90..3b87ab63ee5 100644
--- a/dlls/wined3d/adapter_vk.c
+++ b/dlls/wined3d/adapter_vk.c
@@ -2351,6 +2351,7 @@ static void wined3d_adapter_vk_init_d3d_info(struct wined3d_adapter_vk *adapter_
     d3d_info->feature_level = feature_level_from_caps(&shader_caps);
     d3d_info->subpixel_viewport = true;
     d3d_info->fences = true;
+    d3d_info->persistent_map = true;
 
     /* Like GL, Vulkan doesn't explicitly specify a filling convention and only mandates that a
      * shared edge of two adjacent triangles generate a fragment for exactly one of the triangles.
diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c
index 0d6550bf613..9b0d98139ce 100644
--- a/dlls/wined3d/buffer.c
+++ b/dlls/wined3d/buffer.c
@@ -1008,11 +1008,13 @@ static HRESULT buffer_resource_sub_resource_map(struct wined3d_resource *resourc
             addr.buffer_object = buffer->buffer_object;
             addr.addr = 0;
             buffer->map_ptr = wined3d_context_map_bo_address(context, &addr, resource->size, flags);
+
             /* We are accessing buffer->resource.client from the CS thread,
              * but it's safe because the client thread will wait for the
              * map to return, thus completely serializing this call with
              * other client code. */
-            buffer->resource.client.addr = addr;
+            if (context->d3d_info->persistent_map)
+                buffer->resource.client.addr = addr;
 
             if (((DWORD_PTR)buffer->map_ptr) & (RESOURCE_ALIGNMENT - 1))
             {
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 1e3888cd30d..7bfca0bcb88 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -243,6 +243,7 @@ struct wined3d_d3d_info
     uint32_t pbo : 1;
     uint32_t subpixel_viewport : 1;
     uint32_t fences : 1;
+    uint32_t persistent_map : 1;
     enum wined3d_feature_level feature_level;
 
     DWORD multisample_draw_location;




More information about the wine-cvs mailing list