Commit 57110d5b authored by Józef Kucia's avatar Józef Kucia Committed by Alexandre Julliard

wined3d: Introduce wined3d_cs_finish() helper.

parent 662e6452
......@@ -673,7 +673,7 @@ void wined3d_cs_emit_clear_rendertarget_view(struct wined3d_cs *cs, struct wined
cs->ops->submit(cs, WINED3D_CS_QUEUE_DEFAULT);
if (flags & WINED3DCLEAR_SYNCHRONOUS)
cs->ops->finish(cs, WINED3D_CS_QUEUE_DEFAULT);
wined3d_cs_finish(cs, WINED3D_CS_QUEUE_DEFAULT);
}
static void acquire_shader_resources(const struct wined3d_state *state, unsigned int shader_mask)
......@@ -2137,7 +2137,7 @@ HRESULT wined3d_cs_map(struct wined3d_cs *cs, struct wined3d_resource *resource,
op->hr = &hr;
cs->ops->submit(cs, WINED3D_CS_QUEUE_MAP);
cs->ops->finish(cs, WINED3D_CS_QUEUE_MAP);
wined3d_cs_finish(cs, WINED3D_CS_QUEUE_MAP);
return hr;
}
......@@ -2164,7 +2164,7 @@ HRESULT wined3d_cs_unmap(struct wined3d_cs *cs, struct wined3d_resource *resourc
op->hr = &hr;
cs->ops->submit(cs, WINED3D_CS_QUEUE_MAP);
cs->ops->finish(cs, WINED3D_CS_QUEUE_MAP);
wined3d_cs_finish(cs, WINED3D_CS_QUEUE_MAP);
return hr;
}
......@@ -2297,7 +2297,7 @@ void wined3d_cs_emit_blt_sub_resource(struct wined3d_cs *cs, struct wined3d_reso
cs->ops->submit(cs, WINED3D_CS_QUEUE_DEFAULT);
if (flags & WINED3D_BLT_SYNCHRONOUS)
cs->ops->finish(cs, WINED3D_CS_QUEUE_DEFAULT);
wined3d_cs_finish(cs, WINED3D_CS_QUEUE_DEFAULT);
}
static void wined3d_cs_exec_update_sub_resource(struct wined3d_cs *cs, const void *data)
......@@ -2379,7 +2379,7 @@ void wined3d_cs_emit_update_sub_resource(struct wined3d_cs *cs, struct wined3d_r
cs->ops->submit(cs, WINED3D_CS_QUEUE_MAP);
/* The data pointer may go away, so we need to wait until it is read.
* Copying the data may be faster if it's small. */
cs->ops->finish(cs, WINED3D_CS_QUEUE_MAP);
wined3d_cs_finish(cs, WINED3D_CS_QUEUE_MAP);
}
static void wined3d_cs_exec_add_dirty_texture_region(struct wined3d_cs *cs, const void *data)
......@@ -2505,7 +2505,7 @@ static void wined3d_cs_emit_stop(struct wined3d_cs *cs)
op->opcode = WINED3D_CS_OP_STOP;
cs->ops->submit(cs, WINED3D_CS_QUEUE_DEFAULT);
cs->ops->finish(cs, WINED3D_CS_QUEUE_DEFAULT);
wined3d_cs_finish(cs, WINED3D_CS_QUEUE_DEFAULT);
}
static void (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void *data) =
......
......@@ -1017,7 +1017,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, WINED3D_CS_QUEUE_DEFAULT);
wined3d_cs_finish(device->cs, WINED3D_CS_QUEUE_DEFAULT);
}
static void wined3d_device_create_primary_opengl_context_cs(void *object)
......@@ -1058,7 +1058,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, WINED3D_CS_QUEUE_DEFAULT);
wined3d_cs_finish(device->cs, WINED3D_CS_QUEUE_DEFAULT);
if (!device->swapchains[0]->num_contexts)
return E_FAIL;
......@@ -1208,7 +1208,7 @@ HRESULT CDECL wined3d_device_uninit_3d(struct wined3d_device *device)
if (!device->d3d_initialized)
return WINED3DERR_INVALIDCALL;
device->cs->ops->finish(device->cs, WINED3D_CS_QUEUE_DEFAULT);
wined3d_cs_finish(device->cs, WINED3D_CS_QUEUE_DEFAULT);
if (device->logo_texture)
wined3d_texture_decref(device->logo_texture);
......@@ -4788,7 +4788,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, WINED3D_CS_QUEUE_DEFAULT);
wined3d_cs_finish(device->cs, WINED3D_CS_QUEUE_DEFAULT);
if (!(swapchain = wined3d_device_get_swapchain(device, 0)))
{
......
......@@ -109,7 +109,6 @@ ULONG CDECL wined3d_swapchain_incref(struct wined3d_swapchain *swapchain)
ULONG CDECL wined3d_swapchain_decref(struct wined3d_swapchain *swapchain)
{
ULONG refcount = InterlockedDecrement(&swapchain->ref);
struct wined3d_device *device;
TRACE("%p decreasing refcount to %u.\n", swapchain, refcount);
......@@ -117,8 +116,7 @@ ULONG CDECL wined3d_swapchain_decref(struct wined3d_swapchain *swapchain)
{
wined3d_mutex_lock();
device = swapchain->device;
device->cs->ops->finish(device->cs, WINED3D_CS_QUEUE_DEFAULT);
wined3d_cs_finish(swapchain->device->cs, WINED3D_CS_QUEUE_DEFAULT);
swapchain_cleanup(swapchain);
swapchain->parent_ops->wined3d_object_destroyed(swapchain->parent);
......@@ -140,8 +138,6 @@ void * CDECL wined3d_swapchain_get_parent(const struct wined3d_swapchain *swapch
void CDECL wined3d_swapchain_set_window(struct wined3d_swapchain *swapchain, HWND window)
{
struct wined3d_device *device = swapchain->device;
if (!window)
window = swapchain->device_window;
if (window == swapchain->win_handle)
......@@ -150,7 +146,7 @@ void CDECL wined3d_swapchain_set_window(struct wined3d_swapchain *swapchain, HWN
TRACE("Setting swapchain %p window from %p to %p.\n",
swapchain, swapchain->win_handle, window);
device->cs->ops->finish(device->cs, WINED3D_CS_QUEUE_DEFAULT);
wined3d_cs_finish(swapchain->device->cs, WINED3D_CS_QUEUE_DEFAULT);
swapchain->win_handle = window;
}
......@@ -905,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, WINED3D_CS_QUEUE_DEFAULT);
wined3d_cs_finish(device->cs, WINED3D_CS_QUEUE_DEFAULT);
if (!swapchain->context[0])
{
......@@ -1006,8 +1002,8 @@ err:
heap_free(swapchain->back_buffers);
}
wined3d_cs_destroy_object(swapchain->device->cs, wined3d_swapchain_destroy_object, swapchain);
swapchain->device->cs->ops->finish(device->cs, WINED3D_CS_QUEUE_DEFAULT);
wined3d_cs_destroy_object(device->cs, wined3d_swapchain_destroy_object, swapchain);
wined3d_cs_finish(device->cs, WINED3D_CS_QUEUE_DEFAULT);
if (swapchain->front_buffer)
{
......@@ -1213,7 +1209,6 @@ HRESULT CDECL wined3d_swapchain_resize_buffers(struct wined3d_swapchain *swapcha
unsigned int width, unsigned int height, enum wined3d_format_id format_id,
enum wined3d_multisample_type multisample_type, unsigned int multisample_quality)
{
struct wined3d_device *device = swapchain->device;
BOOL update_desc = FALSE;
TRACE("swapchain %p, buffer_count %u, width %u, height %u, format %s, "
......@@ -1226,7 +1221,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, WINED3D_CS_QUEUE_DEFAULT);
wined3d_cs_finish(swapchain->device->cs, WINED3D_CS_QUEUE_DEFAULT);
if (!width || !height)
{
......
......@@ -1622,7 +1622,7 @@ HRESULT CDECL wined3d_texture_update_desc(struct wined3d_texture *texture, UINT
struct wined3d_texture_idx texture_idx = {texture, 0};
wined3d_cs_destroy_object(device->cs, wined3d_texture_destroy_dc, &texture_idx);
device->cs->ops->finish(device->cs, WINED3D_CS_QUEUE_DEFAULT);
wined3d_cs_finish(device->cs, WINED3D_CS_QUEUE_DEFAULT);
create_dib = TRUE;
}
......@@ -1692,7 +1692,7 @@ HRESULT CDECL wined3d_texture_update_desc(struct wined3d_texture *texture, UINT
struct wined3d_texture_idx texture_idx = {texture, 0};
wined3d_cs_init_object(device->cs, wined3d_texture_create_dc, &texture_idx);
device->cs->ops->finish(device->cs, WINED3D_CS_QUEUE_DEFAULT);
wined3d_cs_finish(device->cs, WINED3D_CS_QUEUE_DEFAULT);
}
return WINED3D_OK;
......@@ -3117,7 +3117,7 @@ static HRESULT wined3d_texture_init(struct wined3d_texture *texture, const struc
struct wined3d_texture_idx texture_idx = {texture, i};
wined3d_cs_init_object(device->cs, wined3d_texture_create_dc, &texture_idx);
device->cs->ops->finish(device->cs, WINED3D_CS_QUEUE_DEFAULT);
wined3d_cs_finish(device->cs, WINED3D_CS_QUEUE_DEFAULT);
if (!texture->dc_info || !texture->dc_info[i].dc)
{
wined3d_texture_cleanup_sync(texture);
......@@ -3737,7 +3737,7 @@ HRESULT CDECL wined3d_texture_get_dc(struct wined3d_texture *texture, unsigned i
struct wined3d_texture_idx texture_idx = {texture, sub_resource_idx};
wined3d_cs_init_object(device->cs, wined3d_texture_create_dc, &texture_idx);
device->cs->ops->finish(device->cs, WINED3D_CS_QUEUE_DEFAULT);
wined3d_cs_finish(device->cs, WINED3D_CS_QUEUE_DEFAULT);
if (!(dc_info = texture->dc_info) || !dc_info[sub_resource_idx].dc)
return WINED3DERR_INVALIDCALL;
}
......@@ -3785,7 +3785,7 @@ HRESULT CDECL wined3d_texture_release_dc(struct wined3d_texture *texture, unsign
struct wined3d_texture_idx texture_idx = {texture, sub_resource_idx};
wined3d_cs_destroy_object(device->cs, wined3d_texture_destroy_dc, &texture_idx);
device->cs->ops->finish(device->cs, WINED3D_CS_QUEUE_DEFAULT);
wined3d_cs_finish(device->cs, WINED3D_CS_QUEUE_DEFAULT);
}
--sub_resource->map_count;
......
......@@ -3739,6 +3739,11 @@ HRESULT wined3d_cs_map(struct wined3d_cs *cs, struct wined3d_resource *resource,
HRESULT wined3d_cs_unmap(struct wined3d_cs *cs, struct wined3d_resource *resource,
unsigned int sub_resource_idx) DECLSPEC_HIDDEN;
static inline void wined3d_cs_finish(struct wined3d_cs *cs, enum wined3d_cs_queue_id queue_id)
{
cs->ops->finish(cs, queue_id);
}
static inline void wined3d_cs_push_constants(struct wined3d_cs *cs, enum wined3d_push_constants p,
unsigned int start_idx, unsigned int count, const void *constants)
{
......
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