Commit 22bdde47 authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

wined3d: Introduce a separate CS queue for resource maps.

parent 0f8b0d9d
......@@ -1003,7 +1003,7 @@ static void wined3d_device_delete_opengl_contexts_cs(void *object)
static void wined3d_device_delete_opengl_contexts(struct wined3d_device *device)
{
wined3d_cs_destroy_object(device->cs, wined3d_device_delete_opengl_contexts_cs, device);
device->cs->ops->finish(device->cs);
device->cs->ops->finish(device->cs, WINED3D_CS_QUEUE_DEFAULT);
}
static void wined3d_device_create_primary_opengl_context_cs(void *object)
......@@ -1042,7 +1042,7 @@ static void wined3d_device_create_primary_opengl_context_cs(void *object)
static HRESULT wined3d_device_create_primary_opengl_context(struct wined3d_device *device)
{
wined3d_cs_init_object(device->cs, wined3d_device_create_primary_opengl_context_cs, device);
device->cs->ops->finish(device->cs);
device->cs->ops->finish(device->cs, WINED3D_CS_QUEUE_DEFAULT);
if (!device->swapchains[0]->num_contexts)
return E_FAIL;
......@@ -1187,7 +1187,7 @@ HRESULT CDECL wined3d_device_uninit_3d(struct wined3d_device *device)
if (!device->d3d_initialized)
return WINED3DERR_INVALIDCALL;
device->cs->ops->finish(device->cs);
device->cs->ops->finish(device->cs, WINED3D_CS_QUEUE_DEFAULT);
if (device->logo_texture)
wined3d_texture_decref(device->logo_texture);
......@@ -4612,7 +4612,7 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device,
TRACE("device %p, swapchain_desc %p, mode %p, callback %p, reset_state %#x.\n",
device, swapchain_desc, mode, callback, reset_state);
device->cs->ops->finish(device->cs);
device->cs->ops->finish(device->cs, WINED3D_CS_QUEUE_DEFAULT);
if (!(swapchain = wined3d_device_get_swapchain(device, 0)))
{
......
......@@ -358,6 +358,7 @@ HRESULT CDECL wined3d_resource_map(struct wined3d_resource *resource, unsigned i
resource, sub_resource_idx, map_desc, debug_box(box), flags);
flags = wined3d_resource_sanitise_map_flags(resource, flags);
wined3d_resource_wait_idle(resource);
return wined3d_cs_map(resource->device->cs, resource, sub_resource_idx, map_desc, box, flags);
}
......
......@@ -66,7 +66,7 @@ static void swapchain_cleanup(struct wined3d_swapchain *swapchain)
}
wined3d_cs_destroy_object(swapchain->device->cs, wined3d_swapchain_destroy_object, swapchain);
swapchain->device->cs->ops->finish(swapchain->device->cs);
swapchain->device->cs->ops->finish(swapchain->device->cs, WINED3D_CS_QUEUE_DEFAULT);
/* Restore the screen resolution if we rendered in fullscreen.
* This will restore the screen resolution to what it was before creating
......@@ -116,7 +116,7 @@ ULONG CDECL wined3d_swapchain_decref(struct wined3d_swapchain *swapchain)
{
struct wined3d_device *device = swapchain->device;
device->cs->ops->finish(device->cs);
device->cs->ops->finish(device->cs, WINED3D_CS_QUEUE_DEFAULT);
swapchain_cleanup(swapchain);
swapchain->parent_ops->wined3d_object_destroyed(swapchain->parent);
......@@ -901,7 +901,7 @@ static HRESULT swapchain_init(struct wined3d_swapchain *swapchain, struct wined3
}
wined3d_cs_init_object(device->cs, wined3d_swapchain_cs_init, swapchain);
device->cs->ops->finish(device->cs);
device->cs->ops->finish(device->cs, WINED3D_CS_QUEUE_DEFAULT);
if (!swapchain->context[0])
{
......@@ -998,7 +998,7 @@ err:
}
wined3d_cs_destroy_object(swapchain->device->cs, wined3d_swapchain_destroy_object, swapchain);
swapchain->device->cs->ops->finish(device->cs);
swapchain->device->cs->ops->finish(device->cs, WINED3D_CS_QUEUE_DEFAULT);
if (swapchain->front_buffer)
{
......@@ -1204,7 +1204,7 @@ HRESULT CDECL wined3d_swapchain_resize_buffers(struct wined3d_swapchain *swapcha
if (buffer_count && buffer_count != swapchain->desc.backbuffer_count)
FIXME("Cannot change the back buffer count yet.\n");
device->cs->ops->finish(device->cs);
device->cs->ops->finish(device->cs, WINED3D_CS_QUEUE_DEFAULT);
if (!width || !height)
{
......
......@@ -1327,7 +1327,7 @@ HRESULT CDECL wined3d_texture_update_desc(struct wined3d_texture *texture, UINT
if (surface->dc)
{
wined3d_cs_destroy_object(device->cs, texture2d_destroy_dc, surface);
device->cs->ops->finish(device->cs);
device->cs->ops->finish(device->cs, WINED3D_CS_QUEUE_DEFAULT);
create_dib = TRUE;
}
......@@ -1390,7 +1390,7 @@ HRESULT CDECL wined3d_texture_update_desc(struct wined3d_texture *texture, UINT
if (create_dib)
{
wined3d_cs_init_object(device->cs, texture2d_create_dc, surface);
device->cs->ops->finish(device->cs);
device->cs->ops->finish(device->cs, WINED3D_CS_QUEUE_DEFAULT);
}
return WINED3D_OK;
......@@ -2247,7 +2247,7 @@ static HRESULT texture_init(struct wined3d_texture *texture, const struct wined3
if ((desc->usage & WINED3DUSAGE_OWNDC) || (device->wined3d->flags & WINED3D_NO3D))
{
wined3d_cs_init_object(device->cs, texture2d_create_dc, surface);
device->cs->ops->finish(device->cs);
device->cs->ops->finish(device->cs, WINED3D_CS_QUEUE_DEFAULT);
if (!surface->dc)
{
wined3d_texture_cleanup_sync(texture);
......@@ -3044,7 +3044,7 @@ HRESULT CDECL wined3d_texture_get_dc(struct wined3d_texture *texture, unsigned i
if (!surface->dc)
{
wined3d_cs_init_object(device->cs, texture2d_create_dc, surface);
device->cs->ops->finish(device->cs);
device->cs->ops->finish(device->cs, WINED3D_CS_QUEUE_DEFAULT);
}
if (!surface->dc)
return WINED3DERR_INVALIDCALL;
......@@ -3091,7 +3091,7 @@ HRESULT CDECL wined3d_texture_release_dc(struct wined3d_texture *texture, unsign
if (!(texture->resource.usage & WINED3DUSAGE_OWNDC) && !(device->wined3d->flags & WINED3D_NO3D))
{
wined3d_cs_destroy_object(device->cs, texture2d_destroy_dc, surface);
device->cs->ops->finish(device->cs);
device->cs->ops->finish(device->cs, WINED3D_CS_QUEUE_DEFAULT);
}
--sub_resource->map_count;
......
......@@ -3246,6 +3246,13 @@ void state_init(struct wined3d_state *state, struct wined3d_fb_state *fb,
DWORD flags) DECLSPEC_HIDDEN;
void state_unbind_resources(struct wined3d_state *state) DECLSPEC_HIDDEN;
enum wined3d_cs_queue_id
{
WINED3D_CS_QUEUE_DEFAULT = 0,
WINED3D_CS_QUEUE_MAP,
WINED3D_CS_QUEUE_COUNT,
};
enum wined3d_push_constants
{
WINED3D_PUSH_CONSTANTS_VS_F,
......@@ -3268,9 +3275,9 @@ struct wined3d_cs_queue
struct wined3d_cs_ops
{
void *(*require_space)(struct wined3d_cs *cs, size_t size);
void (*submit)(struct wined3d_cs *cs);
void (*finish)(struct wined3d_cs *cs);
void *(*require_space)(struct wined3d_cs *cs, size_t size, enum wined3d_cs_queue_id queue_id);
void (*submit)(struct wined3d_cs *cs, enum wined3d_cs_queue_id queue_id);
void (*finish)(struct wined3d_cs *cs, enum wined3d_cs_queue_id queue_id);
void (*push_constants)(struct wined3d_cs *cs, enum wined3d_push_constants p,
unsigned int start_idx, unsigned int count, const void *constants);
};
......@@ -3285,7 +3292,7 @@ struct wined3d_cs
HANDLE thread;
DWORD thread_id;
struct wined3d_cs_queue queue;
struct wined3d_cs_queue queue[WINED3D_CS_QUEUE_COUNT];
size_t data_size, start, end;
void *data;
struct list query_poll_list;
......
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