wined3d: Reduce locking of device context operations.
Only actually take the lock for the immediate context. According to the d3d11 documentation, operations on device contexts are not thread safe, and testing on Windows confirms this. Signed-off-by: Jan Sikorski <jsikorski@codeweavers.com> Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
ce93526f48
commit
803274ac14
|
@ -1019,7 +1019,7 @@ void CDECL wined3d_device_context_dispatch(struct wined3d_device_context *contex
|
|||
{
|
||||
struct wined3d_cs_dispatch *op;
|
||||
|
||||
wined3d_mutex_lock();
|
||||
wined3d_device_context_lock(context);
|
||||
op = wined3d_device_context_require_space(context, sizeof(*op), WINED3D_CS_QUEUE_DEFAULT);
|
||||
op->opcode = WINED3D_CS_OP_DISPATCH;
|
||||
op->parameters.indirect = FALSE;
|
||||
|
@ -1030,7 +1030,7 @@ void CDECL wined3d_device_context_dispatch(struct wined3d_device_context *contex
|
|||
acquire_compute_pipeline_resources(context);
|
||||
|
||||
wined3d_device_context_submit(context, WINED3D_CS_QUEUE_DEFAULT);
|
||||
wined3d_mutex_unlock();
|
||||
wined3d_device_context_unlock(context);
|
||||
}
|
||||
|
||||
void CDECL wined3d_device_context_dispatch_indirect(struct wined3d_device_context *context,
|
||||
|
@ -1038,7 +1038,7 @@ void CDECL wined3d_device_context_dispatch_indirect(struct wined3d_device_contex
|
|||
{
|
||||
struct wined3d_cs_dispatch *op;
|
||||
|
||||
wined3d_mutex_lock();
|
||||
wined3d_device_context_lock(context);
|
||||
op = wined3d_device_context_require_space(context, sizeof(*op), WINED3D_CS_QUEUE_DEFAULT);
|
||||
op->opcode = WINED3D_CS_OP_DISPATCH;
|
||||
op->parameters.indirect = TRUE;
|
||||
|
@ -1049,7 +1049,7 @@ void CDECL wined3d_device_context_dispatch_indirect(struct wined3d_device_contex
|
|||
wined3d_device_context_acquire_resource(context, &buffer->resource);
|
||||
|
||||
wined3d_device_context_submit(context, WINED3D_CS_QUEUE_DEFAULT);
|
||||
wined3d_mutex_unlock();
|
||||
wined3d_device_context_unlock(context);
|
||||
}
|
||||
|
||||
static void wined3d_cs_exec_draw(struct wined3d_cs *cs, const void *data)
|
||||
|
@ -1206,7 +1206,7 @@ void CDECL wined3d_device_context_draw_indirect(struct wined3d_device_context *c
|
|||
const struct wined3d_state *state = context->state;
|
||||
struct wined3d_cs_draw *op;
|
||||
|
||||
wined3d_mutex_lock();
|
||||
wined3d_device_context_lock(context);
|
||||
op = wined3d_device_context_require_space(context, sizeof(*op), WINED3D_CS_QUEUE_DEFAULT);
|
||||
op->opcode = WINED3D_CS_OP_DRAW;
|
||||
op->primitive_type = state->primitive_type;
|
||||
|
@ -1220,7 +1220,7 @@ void CDECL wined3d_device_context_draw_indirect(struct wined3d_device_context *c
|
|||
wined3d_device_context_acquire_resource(context, &buffer->resource);
|
||||
|
||||
wined3d_device_context_submit(context, WINED3D_CS_QUEUE_DEFAULT);
|
||||
wined3d_mutex_unlock();
|
||||
wined3d_device_context_unlock(context);
|
||||
}
|
||||
|
||||
static void wined3d_cs_exec_flush(struct wined3d_cs *cs, const void *data)
|
||||
|
@ -3824,7 +3824,7 @@ HRESULT CDECL wined3d_deferred_context_record_command_list(struct wined3d_device
|
|||
|
||||
TRACE("context %p, list %p.\n", context, list);
|
||||
|
||||
wined3d_mutex_lock();
|
||||
wined3d_device_context_lock(context);
|
||||
memory = heap_alloc(sizeof(*object) + deferred->resource_count * sizeof(*object->resources)
|
||||
+ deferred->upload_count * sizeof(*object->uploads)
|
||||
+ deferred->command_list_count * sizeof(*object->command_lists)
|
||||
|
@ -3833,7 +3833,7 @@ HRESULT CDECL wined3d_deferred_context_record_command_list(struct wined3d_device
|
|||
|
||||
if (!memory)
|
||||
{
|
||||
wined3d_mutex_unlock();
|
||||
wined3d_device_context_unlock(context);
|
||||
return E_OUTOFMEMORY;
|
||||
}
|
||||
|
||||
|
@ -3886,7 +3886,7 @@ HRESULT CDECL wined3d_deferred_context_record_command_list(struct wined3d_device
|
|||
|
||||
TRACE("Created command list %p.\n", object);
|
||||
*list = object;
|
||||
wined3d_mutex_unlock();
|
||||
wined3d_device_context_unlock(context);
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
|
|
@ -1649,11 +1649,11 @@ void CDECL wined3d_device_context_reset_state(struct wined3d_device_context *con
|
|||
{
|
||||
TRACE("context %p.\n", context);
|
||||
|
||||
wined3d_mutex_lock();
|
||||
wined3d_device_context_lock(context);
|
||||
state_cleanup(context->state);
|
||||
wined3d_state_reset(context->state, &context->device->adapter->d3d_info);
|
||||
wined3d_device_context_emit_reset_state(context, true);
|
||||
wined3d_mutex_unlock();
|
||||
wined3d_device_context_unlock(context);
|
||||
}
|
||||
|
||||
void CDECL wined3d_device_context_set_state(struct wined3d_device_context *context, struct wined3d_state *state)
|
||||
|
@ -1663,7 +1663,7 @@ void CDECL wined3d_device_context_set_state(struct wined3d_device_context *conte
|
|||
|
||||
TRACE("context %p, state %p.\n", context, state);
|
||||
|
||||
wined3d_mutex_lock();
|
||||
wined3d_device_context_lock(context);
|
||||
context->state = state;
|
||||
wined3d_device_context_emit_set_feature_level(context, state->feature_level);
|
||||
|
||||
|
@ -1760,7 +1760,7 @@ void CDECL wined3d_device_context_set_state(struct wined3d_device_context *conte
|
|||
wined3d_device_context_emit_set_blend_state(context, state->blend_state, &state->blend_factor, state->sample_mask);
|
||||
wined3d_device_context_emit_set_depth_stencil_state(context, state->depth_stencil_state, state->stencil_ref);
|
||||
wined3d_device_context_emit_set_rasterizer_state(context, state->rasterizer_state);
|
||||
wined3d_mutex_unlock();
|
||||
wined3d_device_context_unlock(context);
|
||||
}
|
||||
|
||||
struct wined3d_state * CDECL wined3d_device_get_state(struct wined3d_device *device)
|
||||
|
@ -1793,7 +1793,7 @@ void CDECL wined3d_device_context_set_shader(struct wined3d_device_context *cont
|
|||
|
||||
TRACE("context %p, type %#x, shader %p.\n", context, type, shader);
|
||||
|
||||
wined3d_mutex_lock();
|
||||
wined3d_device_context_lock(context);
|
||||
prev = state->shader[type];
|
||||
if (shader == prev)
|
||||
goto out;
|
||||
|
@ -1805,7 +1805,7 @@ void CDECL wined3d_device_context_set_shader(struct wined3d_device_context *cont
|
|||
if (prev)
|
||||
wined3d_shader_decref(prev);
|
||||
out:
|
||||
wined3d_mutex_unlock();
|
||||
wined3d_device_context_unlock(context);
|
||||
}
|
||||
|
||||
struct wined3d_shader * CDECL wined3d_device_context_get_shader(const struct wined3d_device_context *context,
|
||||
|
@ -1831,7 +1831,7 @@ void CDECL wined3d_device_context_set_constant_buffers(struct wined3d_device_con
|
|||
return;
|
||||
}
|
||||
|
||||
wined3d_mutex_lock();
|
||||
wined3d_device_context_lock(context);
|
||||
if (!memcmp(buffers, &state->cb[type][start_idx], count * sizeof(*buffers)))
|
||||
goto out;
|
||||
|
||||
|
@ -1848,7 +1848,7 @@ void CDECL wined3d_device_context_set_constant_buffers(struct wined3d_device_con
|
|||
wined3d_buffer_decref(prev);
|
||||
}
|
||||
out:
|
||||
wined3d_mutex_unlock();
|
||||
wined3d_device_context_unlock(context);
|
||||
}
|
||||
|
||||
void CDECL wined3d_device_context_set_blend_state(struct wined3d_device_context *context,
|
||||
|
@ -1860,7 +1860,7 @@ void CDECL wined3d_device_context_set_blend_state(struct wined3d_device_context
|
|||
TRACE("context %p, blend_state %p, blend_factor %p, sample_mask %#x.\n",
|
||||
context, blend_state, blend_factor, sample_mask);
|
||||
|
||||
wined3d_mutex_lock();
|
||||
wined3d_device_context_lock(context);
|
||||
prev = state->blend_state;
|
||||
if (prev == blend_state && !memcmp(blend_factor, &state->blend_factor, sizeof(*blend_factor))
|
||||
&& sample_mask == state->sample_mask)
|
||||
|
@ -1875,7 +1875,7 @@ void CDECL wined3d_device_context_set_blend_state(struct wined3d_device_context
|
|||
if (prev)
|
||||
wined3d_blend_state_decref(prev);
|
||||
out:
|
||||
wined3d_mutex_unlock();
|
||||
wined3d_device_context_unlock(context);
|
||||
}
|
||||
|
||||
void CDECL wined3d_device_context_set_depth_stencil_state(struct wined3d_device_context *context,
|
||||
|
@ -1886,7 +1886,7 @@ void CDECL wined3d_device_context_set_depth_stencil_state(struct wined3d_device_
|
|||
|
||||
TRACE("context %p, depth_stencil_state %p, stencil_ref %u.\n", context, depth_stencil_state, stencil_ref);
|
||||
|
||||
wined3d_mutex_lock();
|
||||
wined3d_device_context_lock(context);
|
||||
prev = state->depth_stencil_state;
|
||||
if (prev == depth_stencil_state && state->stencil_ref == stencil_ref)
|
||||
goto out;
|
||||
|
@ -1899,7 +1899,7 @@ void CDECL wined3d_device_context_set_depth_stencil_state(struct wined3d_device_
|
|||
if (prev)
|
||||
wined3d_depth_stencil_state_decref(prev);
|
||||
out:
|
||||
wined3d_mutex_unlock();
|
||||
wined3d_device_context_unlock(context);
|
||||
}
|
||||
|
||||
void CDECL wined3d_device_context_set_rasterizer_state(struct wined3d_device_context *context,
|
||||
|
@ -1910,7 +1910,7 @@ void CDECL wined3d_device_context_set_rasterizer_state(struct wined3d_device_con
|
|||
|
||||
TRACE("context %p, rasterizer_state %p.\n", context, rasterizer_state);
|
||||
|
||||
wined3d_mutex_lock();
|
||||
wined3d_device_context_lock(context);
|
||||
prev = state->rasterizer_state;
|
||||
if (prev == rasterizer_state)
|
||||
goto out;
|
||||
|
@ -1922,7 +1922,7 @@ void CDECL wined3d_device_context_set_rasterizer_state(struct wined3d_device_con
|
|||
if (prev)
|
||||
wined3d_rasterizer_state_decref(prev);
|
||||
out:
|
||||
wined3d_mutex_unlock();
|
||||
wined3d_device_context_unlock(context);
|
||||
}
|
||||
|
||||
void CDECL wined3d_device_context_set_viewports(struct wined3d_device_context *context, unsigned int viewport_count,
|
||||
|
@ -1939,7 +1939,7 @@ void CDECL wined3d_device_context_set_viewports(struct wined3d_device_context *c
|
|||
viewports[i].width, viewports[i].height, viewports[i].min_z, viewports[i].max_z);
|
||||
}
|
||||
|
||||
wined3d_mutex_lock();
|
||||
wined3d_device_context_lock(context);
|
||||
if (viewport_count)
|
||||
memcpy(state->viewports, viewports, viewport_count * sizeof(*viewports));
|
||||
else
|
||||
|
@ -1947,7 +1947,7 @@ void CDECL wined3d_device_context_set_viewports(struct wined3d_device_context *c
|
|||
state->viewport_count = viewport_count;
|
||||
|
||||
wined3d_device_context_emit_set_viewports(context, viewport_count, viewports);
|
||||
wined3d_mutex_unlock();
|
||||
wined3d_device_context_unlock(context);
|
||||
}
|
||||
|
||||
void CDECL wined3d_device_context_set_scissor_rects(struct wined3d_device_context *context, unsigned int rect_count,
|
||||
|
@ -1963,7 +1963,7 @@ void CDECL wined3d_device_context_set_scissor_rects(struct wined3d_device_contex
|
|||
TRACE("%u: %s\n", i, wine_dbgstr_rect(&rects[i]));
|
||||
}
|
||||
|
||||
wined3d_mutex_lock();
|
||||
wined3d_device_context_lock(context);
|
||||
if (state->scissor_rect_count == rect_count
|
||||
&& !memcmp(state->scissor_rects, rects, rect_count * sizeof(*rects)))
|
||||
{
|
||||
|
@ -1979,7 +1979,7 @@ void CDECL wined3d_device_context_set_scissor_rects(struct wined3d_device_contex
|
|||
|
||||
wined3d_device_context_emit_set_scissor_rects(context, rect_count, rects);
|
||||
out:
|
||||
wined3d_mutex_unlock();
|
||||
wined3d_device_context_unlock(context);
|
||||
}
|
||||
|
||||
void CDECL wined3d_device_context_set_shader_resource_views(struct wined3d_device_context *context,
|
||||
|
@ -1999,7 +1999,7 @@ void CDECL wined3d_device_context_set_shader_resource_views(struct wined3d_devic
|
|||
return;
|
||||
}
|
||||
|
||||
wined3d_mutex_lock();
|
||||
wined3d_device_context_lock(context);
|
||||
if (!memcmp(views, &state->shader_resource_view[type][start_idx], count * sizeof(*views)))
|
||||
goto out;
|
||||
|
||||
|
@ -2037,7 +2037,7 @@ void CDECL wined3d_device_context_set_shader_resource_views(struct wined3d_devic
|
|||
}
|
||||
}
|
||||
out:
|
||||
wined3d_mutex_unlock();
|
||||
wined3d_device_context_unlock(context);
|
||||
}
|
||||
|
||||
void CDECL wined3d_device_context_set_samplers(struct wined3d_device_context *context, enum wined3d_shader_type type,
|
||||
|
@ -2054,7 +2054,7 @@ void CDECL wined3d_device_context_set_samplers(struct wined3d_device_context *co
|
|||
return;
|
||||
}
|
||||
|
||||
wined3d_mutex_lock();
|
||||
wined3d_device_context_lock(context);
|
||||
if (!memcmp(samplers, &state->sampler[type][start_idx], count * sizeof(*samplers)))
|
||||
goto out;
|
||||
|
||||
|
@ -2071,7 +2071,7 @@ void CDECL wined3d_device_context_set_samplers(struct wined3d_device_context *co
|
|||
wined3d_sampler_decref(prev);
|
||||
}
|
||||
out:
|
||||
wined3d_mutex_unlock();
|
||||
wined3d_device_context_unlock(context);
|
||||
}
|
||||
|
||||
void CDECL wined3d_device_context_set_unordered_access_views(struct wined3d_device_context *context,
|
||||
|
@ -2090,7 +2090,7 @@ void CDECL wined3d_device_context_set_unordered_access_views(struct wined3d_devi
|
|||
return;
|
||||
}
|
||||
|
||||
wined3d_mutex_lock();
|
||||
wined3d_device_context_lock(context);
|
||||
if (!memcmp(uavs, &state->unordered_access_view[pipeline][start_idx], count * sizeof(*uavs)) && !initial_counts)
|
||||
goto out;
|
||||
|
||||
|
@ -2107,7 +2107,7 @@ void CDECL wined3d_device_context_set_unordered_access_views(struct wined3d_devi
|
|||
wined3d_unordered_access_view_decref(prev);
|
||||
}
|
||||
out:
|
||||
wined3d_mutex_unlock();
|
||||
wined3d_device_context_unlock(context);
|
||||
}
|
||||
|
||||
void CDECL wined3d_device_context_set_render_targets_and_unordered_access_views(struct wined3d_device_context *context,
|
||||
|
@ -2115,7 +2115,7 @@ void CDECL wined3d_device_context_set_render_targets_and_unordered_access_views(
|
|||
struct wined3d_rendertarget_view *depth_stencil_view, UINT uav_count,
|
||||
struct wined3d_unordered_access_view *const *unordered_access_views, const unsigned int *initial_counts)
|
||||
{
|
||||
wined3d_mutex_lock();
|
||||
wined3d_device_context_lock(context);
|
||||
if (rtv_count != ~0u)
|
||||
{
|
||||
if (depth_stencil_view && !(depth_stencil_view->resource->bind_flags & WINED3D_BIND_DEPTH_STENCIL))
|
||||
|
@ -2138,7 +2138,7 @@ void CDECL wined3d_device_context_set_render_targets_and_unordered_access_views(
|
|||
unordered_access_views, initial_counts);
|
||||
}
|
||||
out:
|
||||
wined3d_mutex_unlock();
|
||||
wined3d_device_context_unlock(context);
|
||||
}
|
||||
|
||||
static void wined3d_device_context_unbind_srv_for_rtv(struct wined3d_device_context *context,
|
||||
|
@ -2200,7 +2200,7 @@ HRESULT CDECL wined3d_device_context_set_rendertarget_views(struct wined3d_devic
|
|||
}
|
||||
}
|
||||
|
||||
wined3d_mutex_lock();
|
||||
wined3d_device_context_lock(context);
|
||||
/* Set the viewport and scissor rectangles, if requested. Tests show that
|
||||
* stateblock recording is ignored, the change goes directly into the
|
||||
* primary stateblock. */
|
||||
|
@ -2246,7 +2246,7 @@ HRESULT CDECL wined3d_device_context_set_rendertarget_views(struct wined3d_devic
|
|||
wined3d_device_context_unbind_srv_for_rtv(context, view, FALSE);
|
||||
}
|
||||
out:
|
||||
wined3d_mutex_unlock();
|
||||
wined3d_device_context_unlock(context);
|
||||
return WINED3D_OK;
|
||||
}
|
||||
|
||||
|
@ -2265,7 +2265,7 @@ HRESULT CDECL wined3d_device_context_set_depth_stencil_view(struct wined3d_devic
|
|||
return WINED3DERR_INVALIDCALL;
|
||||
}
|
||||
|
||||
wined3d_mutex_lock();
|
||||
wined3d_device_context_lock(context);
|
||||
prev = fb->depth_stencil;
|
||||
if (prev == view)
|
||||
{
|
||||
|
@ -2280,7 +2280,7 @@ HRESULT CDECL wined3d_device_context_set_depth_stencil_view(struct wined3d_devic
|
|||
wined3d_rendertarget_view_decref(prev);
|
||||
wined3d_device_context_unbind_srv_for_rtv(context, view, TRUE);
|
||||
out:
|
||||
wined3d_mutex_unlock();
|
||||
wined3d_device_context_unlock(context);
|
||||
return WINED3D_OK;
|
||||
}
|
||||
|
||||
|
@ -2292,7 +2292,7 @@ void CDECL wined3d_device_context_set_predication(struct wined3d_device_context
|
|||
|
||||
TRACE("context %p, predicate %p, value %#x.\n", context, predicate, value);
|
||||
|
||||
wined3d_mutex_lock();
|
||||
wined3d_device_context_lock(context);
|
||||
prev = state->predicate;
|
||||
if (predicate)
|
||||
{
|
||||
|
@ -2304,7 +2304,7 @@ void CDECL wined3d_device_context_set_predication(struct wined3d_device_context
|
|||
wined3d_device_context_emit_set_predication(context, predicate, value);
|
||||
if (prev)
|
||||
wined3d_query_decref(prev);
|
||||
wined3d_mutex_unlock();
|
||||
wined3d_device_context_unlock(context);
|
||||
}
|
||||
|
||||
HRESULT CDECL wined3d_device_context_set_stream_sources(struct wined3d_device_context *context,
|
||||
|
@ -2332,7 +2332,7 @@ HRESULT CDECL wined3d_device_context_set_stream_sources(struct wined3d_device_co
|
|||
}
|
||||
}
|
||||
|
||||
wined3d_mutex_lock();
|
||||
wined3d_device_context_lock(context);
|
||||
if (!memcmp(streams, &state->streams[start_idx], count * sizeof(*streams)))
|
||||
goto out;
|
||||
|
||||
|
@ -2350,7 +2350,7 @@ HRESULT CDECL wined3d_device_context_set_stream_sources(struct wined3d_device_co
|
|||
wined3d_buffer_decref(prev);
|
||||
}
|
||||
out:
|
||||
wined3d_mutex_unlock();
|
||||
wined3d_device_context_unlock(context);
|
||||
return WINED3D_OK;
|
||||
}
|
||||
|
||||
|
@ -2365,7 +2365,7 @@ void CDECL wined3d_device_context_set_index_buffer(struct wined3d_device_context
|
|||
TRACE("context %p, buffer %p, format %s, offset %u.\n",
|
||||
context, buffer, debug_d3dformat(format_id), offset);
|
||||
|
||||
wined3d_mutex_lock();
|
||||
wined3d_device_context_lock(context);
|
||||
prev_buffer = state->index_buffer;
|
||||
prev_format = state->index_format;
|
||||
prev_offset = state->index_offset;
|
||||
|
@ -2382,7 +2382,7 @@ void CDECL wined3d_device_context_set_index_buffer(struct wined3d_device_context
|
|||
if (prev_buffer)
|
||||
wined3d_buffer_decref(prev_buffer);
|
||||
out:
|
||||
wined3d_mutex_unlock();
|
||||
wined3d_device_context_unlock(context);
|
||||
}
|
||||
|
||||
void CDECL wined3d_device_context_set_vertex_declaration(struct wined3d_device_context *context,
|
||||
|
@ -2393,7 +2393,7 @@ void CDECL wined3d_device_context_set_vertex_declaration(struct wined3d_device_c
|
|||
|
||||
TRACE("context %p, declaration %p.\n", context, declaration);
|
||||
|
||||
wined3d_mutex_lock();
|
||||
wined3d_device_context_lock(context);
|
||||
prev = state->vertex_declaration;
|
||||
if (declaration == prev)
|
||||
goto out;
|
||||
|
@ -2405,7 +2405,7 @@ void CDECL wined3d_device_context_set_vertex_declaration(struct wined3d_device_c
|
|||
if (prev)
|
||||
wined3d_vertex_declaration_decref(prev);
|
||||
out:
|
||||
wined3d_mutex_unlock();
|
||||
wined3d_device_context_unlock(context);
|
||||
}
|
||||
|
||||
void CDECL wined3d_device_context_set_stream_outputs(struct wined3d_device_context *context,
|
||||
|
@ -2416,7 +2416,7 @@ void CDECL wined3d_device_context_set_stream_outputs(struct wined3d_device_conte
|
|||
|
||||
TRACE("context %p, outputs %p.\n", context, outputs);
|
||||
|
||||
wined3d_mutex_lock();
|
||||
wined3d_device_context_lock(context);
|
||||
wined3d_device_context_emit_set_stream_outputs(context, outputs);
|
||||
for (i = 0; i < WINED3D_MAX_STREAM_OUTPUT_BUFFERS; ++i)
|
||||
{
|
||||
|
@ -2429,7 +2429,7 @@ void CDECL wined3d_device_context_set_stream_outputs(struct wined3d_device_conte
|
|||
if (prev_buffer)
|
||||
wined3d_buffer_decref(prev_buffer);
|
||||
}
|
||||
wined3d_mutex_unlock();
|
||||
wined3d_device_context_unlock(context);
|
||||
}
|
||||
|
||||
void CDECL wined3d_device_context_draw(struct wined3d_device_context *context, unsigned int start_vertex,
|
||||
|
@ -2440,10 +2440,10 @@ void CDECL wined3d_device_context_draw(struct wined3d_device_context *context, u
|
|||
TRACE("context %p, start_vertex %u, vertex_count %u, start_instance %u, instance_count %u.\n",
|
||||
context, start_vertex, vertex_count, start_instance, instance_count);
|
||||
|
||||
wined3d_mutex_lock();
|
||||
wined3d_device_context_lock(context);
|
||||
wined3d_device_context_emit_draw(context, state->primitive_type, state->patch_vertex_count,
|
||||
0, start_vertex, vertex_count, start_instance, instance_count, false);
|
||||
wined3d_mutex_unlock();
|
||||
wined3d_device_context_unlock(context);
|
||||
}
|
||||
|
||||
void CDECL wined3d_device_context_draw_indexed(struct wined3d_device_context *context, int base_vertex_index,
|
||||
|
@ -2454,10 +2454,10 @@ void CDECL wined3d_device_context_draw_indexed(struct wined3d_device_context *co
|
|||
TRACE("context %p, base_vertex_index %d, start_index %u, index_count %u, start_instance %u, instance_count %u.\n",
|
||||
context, base_vertex_index, start_index, index_count, start_instance, instance_count);
|
||||
|
||||
wined3d_mutex_lock();
|
||||
wined3d_device_context_lock(context);
|
||||
wined3d_device_context_emit_draw(context, state->primitive_type, state->patch_vertex_count,
|
||||
base_vertex_index, start_index, index_count, start_instance, instance_count, true);
|
||||
wined3d_mutex_unlock();
|
||||
wined3d_device_context_unlock(context);
|
||||
}
|
||||
|
||||
void CDECL wined3d_device_context_get_constant_buffer(const struct wined3d_device_context *context,
|
||||
|
@ -4150,10 +4150,10 @@ void CDECL wined3d_device_context_set_primitive_type(struct wined3d_device_conte
|
|||
TRACE("context %p, primitive_type %s, patch_vertex_count %u.\n",
|
||||
context, debug_d3dprimitivetype(primitive_type), patch_vertex_count);
|
||||
|
||||
wined3d_mutex_lock();
|
||||
wined3d_device_context_lock(context);
|
||||
state->primitive_type = primitive_type;
|
||||
state->patch_vertex_count = patch_vertex_count;
|
||||
wined3d_mutex_unlock();
|
||||
wined3d_device_context_unlock(context);
|
||||
}
|
||||
|
||||
void CDECL wined3d_device_context_get_primitive_type(const struct wined3d_device_context *context,
|
||||
|
@ -4471,9 +4471,9 @@ void CDECL wined3d_device_context_copy_uav_counter(struct wined3d_device_context
|
|||
TRACE("context %p, dst_buffer %p, offset %u, uav %p.\n",
|
||||
context, dst_buffer, offset, uav);
|
||||
|
||||
wined3d_mutex_lock();
|
||||
wined3d_device_context_lock(context);
|
||||
wined3d_device_context_emit_copy_uav_counter(context, dst_buffer, offset, uav);
|
||||
wined3d_mutex_unlock();
|
||||
wined3d_device_context_unlock(context);
|
||||
}
|
||||
|
||||
static bool resources_format_compatible(const struct wined3d_resource *src_resource,
|
||||
|
@ -4548,10 +4548,10 @@ void CDECL wined3d_device_context_copy_resource(struct wined3d_device_context *c
|
|||
if (dst_resource->type == WINED3D_RTYPE_BUFFER)
|
||||
{
|
||||
wined3d_box_set(&src_box, 0, 0, src_resource->size, 1, 0, 1);
|
||||
wined3d_mutex_lock();
|
||||
wined3d_device_context_lock(context);
|
||||
wined3d_device_context_emit_blt_sub_resource(context, dst_resource, 0, &src_box,
|
||||
src_resource, 0, &src_box, WINED3D_BLT_RAW, NULL, WINED3D_TEXF_POINT);
|
||||
wined3d_mutex_unlock();
|
||||
wined3d_device_context_unlock(context);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -4567,7 +4567,7 @@ void CDECL wined3d_device_context_copy_resource(struct wined3d_device_context *c
|
|||
return;
|
||||
}
|
||||
|
||||
wined3d_mutex_lock();
|
||||
wined3d_device_context_lock(context);
|
||||
for (i = 0; i < dst_texture->level_count; ++i)
|
||||
{
|
||||
wined3d_texture_get_level_box(src_texture, i, &src_box);
|
||||
|
@ -4580,7 +4580,7 @@ void CDECL wined3d_device_context_copy_resource(struct wined3d_device_context *c
|
|||
src_resource, idx, &src_box, WINED3D_BLT_RAW, NULL, WINED3D_TEXF_POINT);
|
||||
}
|
||||
}
|
||||
wined3d_mutex_unlock();
|
||||
wined3d_device_context_unlock(context);
|
||||
}
|
||||
|
||||
HRESULT CDECL wined3d_device_context_copy_sub_resource_region(struct wined3d_device_context *context,
|
||||
|
@ -4737,10 +4737,10 @@ HRESULT CDECL wined3d_device_context_copy_sub_resource_region(struct wined3d_dev
|
|||
}
|
||||
}
|
||||
|
||||
wined3d_mutex_lock();
|
||||
wined3d_device_context_lock(context);
|
||||
wined3d_device_context_emit_blt_sub_resource(context, dst_resource, dst_sub_resource_idx, &dst_box,
|
||||
src_resource, src_sub_resource_idx, src_box, WINED3D_BLT_RAW, NULL, WINED3D_TEXF_POINT);
|
||||
wined3d_mutex_unlock();
|
||||
wined3d_device_context_unlock(context);
|
||||
|
||||
return WINED3D_OK;
|
||||
}
|
||||
|
@ -4780,10 +4780,10 @@ void CDECL wined3d_device_context_update_sub_resource(struct wined3d_device_cont
|
|||
return;
|
||||
}
|
||||
|
||||
wined3d_mutex_lock();
|
||||
wined3d_device_context_lock(context);
|
||||
wined3d_device_context_emit_update_sub_resource(context, resource,
|
||||
sub_resource_idx, box, data, row_pitch, depth_pitch);
|
||||
wined3d_mutex_unlock();
|
||||
wined3d_device_context_unlock(context);
|
||||
}
|
||||
|
||||
void CDECL wined3d_device_context_resolve_sub_resource(struct wined3d_device_context *context,
|
||||
|
@ -4820,7 +4820,7 @@ void CDECL wined3d_device_context_resolve_sub_resource(struct wined3d_device_con
|
|||
return;
|
||||
}
|
||||
|
||||
wined3d_mutex_lock();
|
||||
wined3d_device_context_lock(context);
|
||||
fx.resolve_format_id = format_id;
|
||||
|
||||
dst_texture = texture_from_resource(dst_resource);
|
||||
|
@ -4834,7 +4834,7 @@ void CDECL wined3d_device_context_resolve_sub_resource(struct wined3d_device_con
|
|||
wined3d_texture_get_level_height(src_texture, src_level));
|
||||
wined3d_device_context_blt(context, dst_texture, dst_sub_resource_idx, &dst_rect,
|
||||
src_texture, src_sub_resource_idx, &src_rect, 0, &fx, WINED3D_TEXF_POINT);
|
||||
wined3d_mutex_unlock();
|
||||
wined3d_device_context_unlock(context);
|
||||
}
|
||||
|
||||
HRESULT CDECL wined3d_device_context_clear_rendertarget_view(struct wined3d_device_context *context,
|
||||
|
@ -4871,9 +4871,9 @@ HRESULT CDECL wined3d_device_context_clear_rendertarget_view(struct wined3d_devi
|
|||
return hr;
|
||||
}
|
||||
|
||||
wined3d_mutex_lock();
|
||||
wined3d_device_context_lock(context);
|
||||
wined3d_device_context_emit_clear_rendertarget_view(context, view, rect, flags, color, depth, stencil);
|
||||
wined3d_mutex_unlock();
|
||||
wined3d_device_context_unlock(context);
|
||||
|
||||
return WINED3D_OK;
|
||||
}
|
||||
|
@ -4889,9 +4889,9 @@ void CDECL wined3d_device_context_clear_uav_float(struct wined3d_device_context
|
|||
return;
|
||||
}
|
||||
|
||||
wined3d_mutex_lock();
|
||||
wined3d_device_context_lock(context);
|
||||
wined3d_device_context_emit_clear_uav(context, view, (const struct wined3d_uvec4 *)clear_value, true);
|
||||
wined3d_mutex_unlock();
|
||||
wined3d_device_context_unlock(context);
|
||||
}
|
||||
|
||||
void CDECL wined3d_device_context_clear_uav_uint(struct wined3d_device_context *context,
|
||||
|
@ -4899,9 +4899,9 @@ void CDECL wined3d_device_context_clear_uav_uint(struct wined3d_device_context *
|
|||
{
|
||||
TRACE("context %p, view %p, clear_value %s.\n", context, view, debug_uvec4(clear_value));
|
||||
|
||||
wined3d_mutex_lock();
|
||||
wined3d_device_context_lock(context);
|
||||
wined3d_device_context_emit_clear_uav(context, view, clear_value, false);
|
||||
wined3d_mutex_unlock();
|
||||
wined3d_device_context_unlock(context);
|
||||
}
|
||||
|
||||
static unsigned int sanitise_map_flags(const struct wined3d_resource *resource, unsigned int flags)
|
||||
|
@ -4989,9 +4989,9 @@ HRESULT CDECL wined3d_device_context_map(struct wined3d_device_context *context,
|
|||
return WINED3DERR_INVALIDCALL;
|
||||
}
|
||||
|
||||
wined3d_mutex_lock();
|
||||
wined3d_device_context_lock(context);
|
||||
hr = wined3d_device_context_emit_map(context, resource, sub_resource_idx, map_desc, box, flags);
|
||||
wined3d_mutex_unlock();
|
||||
wined3d_device_context_unlock(context);
|
||||
return hr;
|
||||
}
|
||||
|
||||
|
@ -5001,9 +5001,9 @@ HRESULT CDECL wined3d_device_context_unmap(struct wined3d_device_context *contex
|
|||
HRESULT hr;
|
||||
TRACE("context %p, resource %p, sub_resource_idx %u.\n", context, resource, sub_resource_idx);
|
||||
|
||||
wined3d_mutex_lock();
|
||||
wined3d_device_context_lock(context);
|
||||
hr = wined3d_device_context_emit_unmap(context, resource, sub_resource_idx);
|
||||
wined3d_mutex_unlock();
|
||||
wined3d_device_context_unlock(context);
|
||||
return hr;
|
||||
}
|
||||
|
||||
|
@ -5012,9 +5012,9 @@ void CDECL wined3d_device_context_issue_query(struct wined3d_device_context *con
|
|||
{
|
||||
TRACE("context %p, query %p, flags %#x.\n", context, query, flags);
|
||||
|
||||
wined3d_mutex_lock();
|
||||
wined3d_device_context_lock(context);
|
||||
context->ops->issue_query(context, query, flags);
|
||||
wined3d_mutex_unlock();
|
||||
wined3d_device_context_unlock(context);
|
||||
}
|
||||
|
||||
void CDECL wined3d_device_context_execute_command_list(struct wined3d_device_context *context,
|
||||
|
@ -5022,9 +5022,9 @@ void CDECL wined3d_device_context_execute_command_list(struct wined3d_device_con
|
|||
{
|
||||
TRACE("context %p, list %p, restore_state %d.\n", context, list, restore_state);
|
||||
|
||||
wined3d_mutex_lock();
|
||||
wined3d_device_context_lock(context);
|
||||
wined3d_device_context_emit_execute_command_list(context, list, restore_state);
|
||||
wined3d_mutex_unlock();
|
||||
wined3d_device_context_unlock(context);
|
||||
}
|
||||
|
||||
struct wined3d_rendertarget_view * CDECL wined3d_device_context_get_rendertarget_view(
|
||||
|
@ -5072,9 +5072,9 @@ void CDECL wined3d_device_context_generate_mipmaps(struct wined3d_device_context
|
|||
return;
|
||||
}
|
||||
|
||||
wined3d_mutex_lock();
|
||||
wined3d_device_context_lock(context);
|
||||
wined3d_device_context_emit_generate_mipmaps(context, view);
|
||||
wined3d_mutex_unlock();
|
||||
wined3d_device_context_unlock(context);
|
||||
}
|
||||
|
||||
static struct wined3d_texture *wined3d_device_create_cursor_texture(struct wined3d_device *device,
|
||||
|
@ -5298,9 +5298,9 @@ void CDECL wined3d_device_context_flush(struct wined3d_device_context *context)
|
|||
{
|
||||
TRACE("context %p.\n", context);
|
||||
|
||||
wined3d_mutex_lock();
|
||||
wined3d_device_context_lock(context);
|
||||
context->ops->flush(context);
|
||||
wined3d_mutex_unlock();
|
||||
wined3d_device_context_unlock(context);
|
||||
}
|
||||
|
||||
static void update_swapchain_flags(struct wined3d_texture *texture)
|
||||
|
|
|
@ -4839,6 +4839,18 @@ struct wined3d_cs
|
|||
LONG pending_presents;
|
||||
};
|
||||
|
||||
static inline void wined3d_device_context_lock(struct wined3d_device_context *context)
|
||||
{
|
||||
if (context == &context->device->cs->c)
|
||||
wined3d_mutex_lock();
|
||||
}
|
||||
|
||||
static inline void wined3d_device_context_unlock(struct wined3d_device_context *context)
|
||||
{
|
||||
if (context == &context->device->cs->c)
|
||||
wined3d_mutex_unlock();
|
||||
}
|
||||
|
||||
struct wined3d_cs *wined3d_cs_create(struct wined3d_device *device,
|
||||
const enum wined3d_feature_level *levels, unsigned int level_count) DECLSPEC_HIDDEN;
|
||||
void wined3d_cs_destroy(struct wined3d_cs *cs) DECLSPEC_HIDDEN;
|
||||
|
|
Loading…
Reference in New Issue