Zebediah Figura : wined3d: Don't use persistent BOs from the client thread if we might need to do vertex attribute conversion.

Alexandre Julliard julliard at winehq.org
Wed Feb 16 15:30:24 CST 2022


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

Author: Zebediah Figura <zfigura at codeweavers.com>
Date:   Tue Feb 15 21:28:12 2022 -0600

wined3d: Don't use persistent BOs from the client thread if we might need to do vertex attribute conversion.

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/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 63d8628cea7..9f4a39cfe7e 100644
--- a/dlls/wined3d/cs.c
+++ b/dlls/wined3d/cs.c
@@ -3077,12 +3077,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)




More information about the wine-cvs mailing list