From: Zebediah Figura Subject: [PATCH 1/2] wined3d: Do not accelerate NOOVERWRITE maps if we cannot map persistently. Message-Id: <20220531011008.2341764-1-zfigura@codeweavers.com> Date: Mon, 30 May 2022 20:10:07 -0500 I.e. if ARB_buffer_storage is not supported. Signed-off-by: Zebediah Figura --- Somehow I had forgotten to protect against this... 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 ce4d7384066..9304de4e9d6 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; -- 2.35.1