[PATCH 5/5] wined3d: Try harder to reuse the current context.

Henri Verbeet hverbeet at codeweavers.com
Thu Jul 4 06:58:03 CDT 2019


Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
---
 dlls/wined3d/context.c   |  4 +---
 dlls/wined3d/swapchain.c | 38 --------------------------------------
 2 files changed, 1 insertion(+), 41 deletions(-)

diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c
index 619b5ff7d02..32cbc029e7f 100644
--- a/dlls/wined3d/context.c
+++ b/dlls/wined3d/context.c
@@ -4215,14 +4215,12 @@ struct wined3d_context *wined3d_context_gl_acquire(const struct wined3d_device *
 {
     struct wined3d_context *current_context = context_get_current();
     struct wined3d_context *context;
-    BOOL swapchain_texture;
 
     TRACE("device %p, texture %p, sub_resource_idx %u.\n", device, texture, sub_resource_idx);
 
     if (current_context && current_context->destroyed)
         current_context = NULL;
 
-    swapchain_texture = texture && texture->swapchain;
     if (!texture)
     {
         if (current_context
@@ -4248,7 +4246,7 @@ struct wined3d_context *wined3d_context_gl_acquire(const struct wined3d_device *
     {
         context = current_context;
     }
-    else if (swapchain_texture)
+    else if (texture && !wined3d_resource_is_offscreen(&texture->resource))
     {
         TRACE("Rendering onscreen.\n");
 
diff --git a/dlls/wined3d/swapchain.c b/dlls/wined3d/swapchain.c
index 69580adbffb..bf0c308f0d3 100644
--- a/dlls/wined3d/swapchain.c
+++ b/dlls/wined3d/swapchain.c
@@ -717,25 +717,6 @@ static void wined3d_swapchain_apply_sample_count_override(const struct wined3d_s
     *quality = 0;
 }
 
-static void wined3d_swapchain_cs_init(void *object)
-{
-    struct wined3d_swapchain *swapchain = object;
-    struct wined3d_context *context;
-
-    if (!(context = context_acquire(swapchain->device, swapchain->front_buffer, 0)))
-    {
-        WARN("Failed to acquire context.\n");
-        return;
-    }
-
-    if (wined3d_settings.offscreen_rendering_mode != ORM_FBO
-            && (!swapchain->desc.enable_auto_depth_stencil
-            || swapchain->desc.auto_depth_stencil_format != swapchain->ds_format->id))
-        FIXME("Add OpenGL context recreation support.\n");
-
-    context_release(context);
-}
-
 void swapchain_set_max_frame_latency(struct wined3d_swapchain *swapchain, const struct wined3d_device *device)
 {
     /* Subtract 1 for the implicit OpenGL latency. */
@@ -890,25 +871,6 @@ static HRESULT swapchain_init(struct wined3d_swapchain *swapchain, struct wined3
         }
     }
 
-    if (!(device->wined3d->flags & WINED3D_NO3D))
-    {
-        if (!(swapchain->context = heap_alloc(sizeof(*swapchain->context))))
-        {
-            ERR("Failed to create the context array.\n");
-            hr = E_OUTOFMEMORY;
-            goto err;
-        }
-
-        wined3d_cs_init_object(device->cs, wined3d_swapchain_cs_init, swapchain);
-        wined3d_cs_finish(device->cs, WINED3D_CS_QUEUE_DEFAULT);
-
-        if (!swapchain->num_contexts)
-        {
-            hr = WINED3DERR_NOTAVAILABLE;
-            goto err;
-        }
-    }
-
     if (swapchain->desc.backbuffer_count > 0)
     {
         if (!(swapchain->back_buffers = heap_calloc(swapchain->desc.backbuffer_count,
-- 
2.11.0




More information about the wine-devel mailing list