[PATCH 4/5] wined3d: Don't use persistent BOs from the client thread if we might need to do vertex attribute conversion.

Zebediah Figura zfigura at codeweavers.com
Tue Feb 15 21:28:12 CST 2022


Signed-off-by: Zebediah Figura <zfigura at codeweavers.com>
---
 dlls/wined3d/cs.c           | 9 +++++++++
 dlls/wined3d/shader_spirv.c | 2 ++
 2 files changed, 11 insertions(+)

diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
index dede21d19b6..56abc146733 100644
--- a/dlls/wined3d/cs.c
+++ b/dlls/wined3d/cs.c
@@ -3079,12 +3079,21 @@ static bool wined3d_cs_map_upload_bo(struct wined3d_device_context *context, str
      * a texture can be invalidated to even count. */
     if (resource->type == WINED3D_RTYPE_BUFFER && (flags & (WINED3D_MAP_DISCARD | WINED3D_MAP_NOOVERWRITE)))
     {
+        const struct wined3d_d3d_info *d3d_info = &context->device->adapter->d3d_info;
         struct wined3d_client_resource *client = &resource->client;
         struct wined3d_device *device = context->device;
         struct wined3d_bo_address addr;
         struct wined3d_bo *bo;
         uint8_t *map_ptr;
 
+        /* We can't use persistent maps if we might need to do vertex attribute
+         * conversion; that will cause the CS thread to invalidate the BO. */
+        if (!d3d_info->xyzrhw || !d3d_info->vertex_bgra || !d3d_info->ffp_generic_attributes)
+        {
+            TRACE("Not returning a persistent buffer because we might need to do vertex attribute conversion.\n");
+            return NULL;
+        }
+
         if (flags & WINED3D_MAP_DISCARD)
         {
             if (!device->adapter->adapter_ops->adapter_alloc_bo(device, resource, sub_resource_idx, &addr))
diff --git a/dlls/wined3d/shader_spirv.c b/dlls/wined3d/shader_spirv.c
index 1e6a03040b9..9ad11f34ebd 100644
--- a/dlls/wined3d/shader_spirv.c
+++ b/dlls/wined3d/shader_spirv.c
@@ -1176,6 +1176,8 @@ static void spirv_vertex_pipe_vk_vp_enable(const struct wined3d_context *context
 static void spirv_vertex_pipe_vk_vp_get_caps(const struct wined3d_adapter *adapter, struct wined3d_vertex_caps *caps)
 {
     memset(caps, 0, sizeof(*caps));
+    caps->xyzrhw = TRUE;
+    caps->ffp_generic_attributes = TRUE;
 }
 
 static uint32_t spirv_vertex_pipe_vk_vp_get_emul_mask(const struct wined3d_gl_info *gl_info)
-- 
2.34.1




More information about the wine-devel mailing list