Commit 64d41b3d authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

wined3d: Try harder to reuse the current context.

parent d7fd6414
......@@ -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");
......
......@@ -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,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment