Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/wined3d/cs.c | 10 +++++++--- dlls/wined3d/query.c | 2 +- dlls/wined3d/wined3d_private.h | 2 +- 3 files changed, 9 insertions(+), 5 deletions(-)
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c index bb11851c1be..ae4d97873a4 100644 --- a/dlls/wined3d/cs.c +++ b/dlls/wined3d/cs.c @@ -2213,16 +2213,18 @@ static void wined3d_cs_exec_query_issue(struct wined3d_cs *cs, const void *data) InterlockedIncrement(&query->counter_retrieved); }
-void wined3d_cs_emit_query_issue(struct wined3d_cs *cs, struct wined3d_query *query, DWORD flags) +static void wined3d_cs_issue_query(struct wined3d_device_context *context, + struct wined3d_query *query, unsigned int flags) { + struct wined3d_cs *cs = wined3d_cs_from_context(context); struct wined3d_cs_query_issue *op;
- op = wined3d_device_context_require_space(&cs->c, sizeof(*op), WINED3D_CS_QUEUE_DEFAULT); + op = wined3d_device_context_require_space(context, sizeof(*op), WINED3D_CS_QUEUE_DEFAULT); op->opcode = WINED3D_CS_OP_QUERY_ISSUE; op->query = query; op->flags = flags;
- wined3d_device_context_submit(&cs->c, WINED3D_CS_QUEUE_DEFAULT); + wined3d_device_context_submit(context, WINED3D_CS_QUEUE_DEFAULT); cs->queries_flushed = FALSE; }
@@ -2796,6 +2798,7 @@ static const struct wined3d_device_context_ops wined3d_cs_st_ops = wined3d_cs_st_push_constants, wined3d_cs_map, wined3d_cs_unmap, + wined3d_cs_issue_query, };
static BOOL wined3d_cs_queue_is_empty(const struct wined3d_cs *cs, const struct wined3d_cs_queue *queue) @@ -2919,6 +2922,7 @@ static const struct wined3d_device_context_ops wined3d_cs_mt_ops = wined3d_cs_mt_push_constants, wined3d_cs_map, wined3d_cs_unmap, + wined3d_cs_issue_query, };
static void poll_queries(struct wined3d_cs *cs) diff --git a/dlls/wined3d/query.c b/dlls/wined3d/query.c index 1ef83891ddf..ed66794c757 100644 --- a/dlls/wined3d/query.c +++ b/dlls/wined3d/query.c @@ -507,7 +507,7 @@ HRESULT CDECL wined3d_query_issue(struct wined3d_query *query, DWORD flags) if (flags & WINED3DISSUE_END) ++query->counter_main;
- wined3d_cs_emit_query_issue(query->device->cs, query, flags); + query->device->cs->c.ops->issue_query(&query->device->cs->c, query, flags);
if (flags & WINED3DISSUE_BEGIN) query->state = QUERY_BUILDING; diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index 4d5f4765f57..0af1258e355 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -4692,6 +4692,7 @@ struct wined3d_device_context_ops unsigned int flags); HRESULT (*unmap)(struct wined3d_device_context *context, struct wined3d_resource *resource, unsigned int sub_resource_idx); + void (*issue_query)(struct wined3d_device_context *context, struct wined3d_query *query, unsigned int flags); };
struct wined3d_device_context @@ -4737,7 +4738,6 @@ void wined3d_cs_emit_flush(struct wined3d_cs *cs) DECLSPEC_HIDDEN; void wined3d_cs_emit_preload_resource(struct wined3d_cs *cs, struct wined3d_resource *resource) DECLSPEC_HIDDEN; void wined3d_cs_emit_present(struct wined3d_cs *cs, struct wined3d_swapchain *swapchain, const RECT *src_rect, const RECT *dst_rect, HWND dst_window_override, unsigned int swap_interval, DWORD flags) DECLSPEC_HIDDEN; -void wined3d_cs_emit_query_issue(struct wined3d_cs *cs, struct wined3d_query *query, DWORD flags) DECLSPEC_HIDDEN; void wined3d_cs_emit_reset_state(struct wined3d_cs *cs) DECLSPEC_HIDDEN; void wined3d_cs_emit_set_clip_plane(struct wined3d_cs *cs, UINT plane_idx, const struct wined3d_vec4 *plane) DECLSPEC_HIDDEN;
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/wined3d/device.c | 16 ++++++++++++++++ dlls/wined3d/query.c | 10 +--------- dlls/wined3d/wined3d.spec | 1 + include/wine/wined3d.h | 2 ++ 4 files changed, 20 insertions(+), 9 deletions(-)
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c index 9240bad9d27..2e129513501 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -5324,6 +5324,22 @@ HRESULT CDECL wined3d_device_context_unmap(struct wined3d_device_context *contex return context->ops->unmap(context, resource, sub_resource_idx); }
+void CDECL wined3d_device_context_issue_query(struct wined3d_device_context *context, + struct wined3d_query *query, unsigned int flags) +{ + TRACE("context %p, query %p, flags %#x.\n", context, query, flags); + + if (flags & WINED3DISSUE_END) + ++query->counter_main; + + query->device->cs->c.ops->issue_query(context, query, flags); + + if (flags & WINED3DISSUE_BEGIN) + query->state = QUERY_BUILDING; + else + query->state = QUERY_SIGNALLED; +} + struct wined3d_rendertarget_view * CDECL wined3d_device_get_rendertarget_view(const struct wined3d_device *device, unsigned int view_idx) { diff --git a/dlls/wined3d/query.c b/dlls/wined3d/query.c index ed66794c757..610a37b9269 100644 --- a/dlls/wined3d/query.c +++ b/dlls/wined3d/query.c @@ -504,15 +504,7 @@ HRESULT CDECL wined3d_query_issue(struct wined3d_query *query, DWORD flags) { TRACE("query %p, flags %#x.\n", query, flags);
- if (flags & WINED3DISSUE_END) - ++query->counter_main; - - query->device->cs->c.ops->issue_query(&query->device->cs->c, query, flags); - - if (flags & WINED3DISSUE_BEGIN) - query->state = QUERY_BUILDING; - else - query->state = QUERY_SIGNALLED; + wined3d_device_context_issue_query(&query->device->cs->c, query, flags);
return WINED3D_OK; } diff --git a/dlls/wined3d/wined3d.spec b/dlls/wined3d/wined3d.spec index 7c81eff1593..1de62071aa0 100644 --- a/dlls/wined3d/wined3d.spec +++ b/dlls/wined3d/wined3d.spec @@ -171,6 +171,7 @@ @ cdecl wined3d_device_context_dispatch(ptr long long long) @ cdecl wined3d_device_context_dispatch_indirect(ptr ptr long) @ cdecl wined3d_device_context_generate_mipmaps(ptr ptr) +@ cdecl wined3d_device_context_issue_query(ptr ptr long) @ cdecl wined3d_device_context_map(ptr ptr long ptr ptr long) @ cdecl wined3d_device_context_resolve_sub_resource(ptr ptr long ptr long long) @ cdecl wined3d_device_context_set_blend_state(ptr ptr ptr long) diff --git a/include/wine/wined3d.h b/include/wine/wined3d.h index e0a205f3dad..0b3120017c5 100644 --- a/include/wine/wined3d.h +++ b/include/wine/wined3d.h @@ -2566,6 +2566,8 @@ void __cdecl wined3d_device_context_draw_indirect(struct wined3d_device_context struct wined3d_buffer *buffer, unsigned int offset, bool indexed); void __cdecl wined3d_device_context_generate_mipmaps(struct wined3d_device_context *context, struct wined3d_shader_resource_view *view); +void __cdecl wined3d_device_context_issue_query(struct wined3d_device_context *context, + struct wined3d_query *query, unsigned int flags); HRESULT __cdecl wined3d_device_context_map(struct wined3d_device_context *context, struct wined3d_resource *resource, unsigned int sub_resource_idx, struct wined3d_map_desc *map_desc, const struct wined3d_box *box, unsigned int flags);
Signed-off-by: Henri Verbeet hverbeet@codeweavers.com
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/d3d11/device.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/dlls/d3d11/device.c b/dlls/d3d11/device.c index 47f865ed14c..7bc9a217f4a 100644 --- a/dlls/d3d11/device.c +++ b/dlls/d3d11/device.c @@ -821,28 +821,26 @@ static void STDMETHODCALLTYPE d3d11_immediate_context_VSSetSamplers(ID3D11Device static void STDMETHODCALLTYPE d3d11_immediate_context_Begin(ID3D11DeviceContext1 *iface, ID3D11Asynchronous *asynchronous) { + struct d3d11_immediate_context *context = impl_from_ID3D11DeviceContext1(iface); struct d3d_query *query = unsafe_impl_from_ID3D11Asynchronous(asynchronous); - HRESULT hr;
TRACE("iface %p, asynchronous %p.\n", iface, asynchronous);
wined3d_mutex_lock(); - if (FAILED(hr = wined3d_query_issue(query->wined3d_query, WINED3DISSUE_BEGIN))) - ERR("Failed to issue query, hr %#x.\n", hr); + wined3d_device_context_issue_query(context->wined3d_context, query->wined3d_query, WINED3DISSUE_BEGIN); wined3d_mutex_unlock(); }
static void STDMETHODCALLTYPE d3d11_immediate_context_End(ID3D11DeviceContext1 *iface, ID3D11Asynchronous *asynchronous) { + struct d3d11_immediate_context *context = impl_from_ID3D11DeviceContext1(iface); struct d3d_query *query = unsafe_impl_from_ID3D11Asynchronous(asynchronous); - HRESULT hr;
TRACE("iface %p, asynchronous %p.\n", iface, asynchronous);
wined3d_mutex_lock(); - if (FAILED(hr = wined3d_query_issue(query->wined3d_query, WINED3DISSUE_END))) - ERR("Failed to issue query, hr %#x.\n", hr); + wined3d_device_context_issue_query(context->wined3d_context, query->wined3d_query, WINED3DISSUE_END); wined3d_mutex_unlock(); }
Signed-off-by: Henri Verbeet hverbeet@codeweavers.com
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/wined3d/cs.c | 19 +++++++++++-------- dlls/wined3d/device.c | 2 +- dlls/wined3d/query.c | 2 +- dlls/wined3d/wined3d_private.h | 2 +- 4 files changed, 14 insertions(+), 11 deletions(-)
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c index ae4d97873a4..b99e3bbac30 100644 --- a/dlls/wined3d/cs.c +++ b/dlls/wined3d/cs.c @@ -480,6 +480,11 @@ static inline void wined3d_device_context_finish(struct wined3d_device_context * context->ops->finish(context, queue_id); }
+static struct wined3d_cs *wined3d_cs_from_context(struct wined3d_device_context *context) +{ + return CONTAINING_RECORD(context, struct wined3d_cs, c); +} + static const char *debug_cs_op(enum wined3d_cs_op op) { switch (op) @@ -1110,14 +1115,15 @@ static void wined3d_cs_exec_flush(struct wined3d_cs *cs, const void *data) context_release(context); }
-void wined3d_cs_emit_flush(struct wined3d_cs *cs) +static void wined3d_cs_flush(struct wined3d_device_context *context) { + struct wined3d_cs *cs = wined3d_cs_from_context(context); struct wined3d_cs_flush *op;
- op = wined3d_device_context_require_space(&cs->c, sizeof(*op), WINED3D_CS_QUEUE_DEFAULT); + op = wined3d_device_context_require_space(context, sizeof(*op), WINED3D_CS_QUEUE_DEFAULT); op->opcode = WINED3D_CS_OP_FLUSH;
- wined3d_device_context_submit(&cs->c, WINED3D_CS_QUEUE_DEFAULT); + wined3d_device_context_submit(context, WINED3D_CS_QUEUE_DEFAULT); cs->queries_flushed = TRUE; }
@@ -2073,11 +2079,6 @@ wined3d_cs_push_constant_info[] = {FIELD_OFFSET(struct wined3d_state, ps_consts_b), sizeof(BOOL), WINED3D_SHADER_CONST_PS_B}, };
-static struct wined3d_cs *wined3d_cs_from_context(struct wined3d_device_context *context) -{ - return CONTAINING_RECORD(context, struct wined3d_cs, c); -} - static void wined3d_cs_st_push_constants(struct wined3d_device_context *context, enum wined3d_push_constants p, unsigned int start_idx, unsigned int count, const void *constants) { @@ -2799,6 +2800,7 @@ static const struct wined3d_device_context_ops wined3d_cs_st_ops = wined3d_cs_map, wined3d_cs_unmap, wined3d_cs_issue_query, + wined3d_cs_flush, };
static BOOL wined3d_cs_queue_is_empty(const struct wined3d_cs *cs, const struct wined3d_cs_queue *queue) @@ -2923,6 +2925,7 @@ static const struct wined3d_device_context_ops wined3d_cs_mt_ops = wined3d_cs_map, wined3d_cs_unmap, wined3d_cs_issue_query, + wined3d_cs_flush, };
static void poll_queries(struct wined3d_cs *cs) diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c index 2e129513501..f19ea1ff212 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -5625,7 +5625,7 @@ void CDECL wined3d_device_flush(struct wined3d_device *device) { TRACE("device %p.\n", device);
- wined3d_cs_emit_flush(device->cs); + device->cs->c.ops->flush(&device->cs->c); }
static void update_swapchain_flags(struct wined3d_texture *texture) diff --git a/dlls/wined3d/query.c b/dlls/wined3d/query.c index 610a37b9269..81f5ba7d0d7 100644 --- a/dlls/wined3d/query.c +++ b/dlls/wined3d/query.c @@ -476,7 +476,7 @@ HRESULT CDECL wined3d_query_get_data(struct wined3d_query *query, || (query->buffer_object && !wined3d_query_buffer_is_valid(query))) { if (flags & WINED3DGETDATA_FLUSH && !query->device->cs->queries_flushed) - wined3d_cs_emit_flush(query->device->cs); + query->device->cs->c.ops->flush(&query->device->cs->c); return S_FALSE; } if (query->buffer_object) diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index 0af1258e355..c3e3752ed71 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -4693,6 +4693,7 @@ struct wined3d_device_context_ops HRESULT (*unmap)(struct wined3d_device_context *context, struct wined3d_resource *resource, unsigned int sub_resource_idx); void (*issue_query)(struct wined3d_device_context *context, struct wined3d_query *query, unsigned int flags); + void (*flush)(struct wined3d_device_context *context); };
struct wined3d_device_context @@ -4734,7 +4735,6 @@ void wined3d_cs_emit_clear(struct wined3d_cs *cs, DWORD rect_count, const RECT * DWORD flags, const struct wined3d_color *color, float depth, DWORD stencil) DECLSPEC_HIDDEN; void wined3d_device_context_emit_clear_uav_uint(struct wined3d_device_context *context, struct wined3d_unordered_access_view *view, const struct wined3d_uvec4 *clear_value) DECLSPEC_HIDDEN; -void wined3d_cs_emit_flush(struct wined3d_cs *cs) DECLSPEC_HIDDEN; void wined3d_cs_emit_preload_resource(struct wined3d_cs *cs, struct wined3d_resource *resource) DECLSPEC_HIDDEN; void wined3d_cs_emit_present(struct wined3d_cs *cs, struct wined3d_swapchain *swapchain, const RECT *src_rect, const RECT *dst_rect, HWND dst_window_override, unsigned int swap_interval, DWORD flags) DECLSPEC_HIDDEN;
Signed-off-by: Henri Verbeet hverbeet@codeweavers.com
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/d3d11/device.c | 6 +++--- dlls/wined3d/device.c | 6 +++--- dlls/wined3d/wined3d.spec | 2 +- include/wine/wined3d.h | 1 + 4 files changed, 8 insertions(+), 7 deletions(-)
diff --git a/dlls/d3d11/device.c b/dlls/d3d11/device.c index 7bc9a217f4a..43fc18126ff 100644 --- a/dlls/d3d11/device.c +++ b/dlls/d3d11/device.c @@ -2641,12 +2641,12 @@ static void STDMETHODCALLTYPE d3d11_immediate_context_ClearState(ID3D11DeviceCon
static void STDMETHODCALLTYPE d3d11_immediate_context_Flush(ID3D11DeviceContext1 *iface) { - struct d3d_device *device = device_from_immediate_ID3D11DeviceContext1(iface); + struct d3d11_immediate_context *context = impl_from_ID3D11DeviceContext1(iface);
TRACE("iface %p.\n", iface);
wined3d_mutex_lock(); - wined3d_device_flush(device->wined3d_device); + wined3d_device_context_flush(context->wined3d_context); wined3d_mutex_unlock(); }
@@ -5643,7 +5643,7 @@ static void STDMETHODCALLTYPE d3d10_device_Flush(ID3D10Device1 *iface) TRACE("iface %p.\n", iface);
wined3d_mutex_lock(); - wined3d_device_flush(device->wined3d_device); + wined3d_device_context_flush(device->immediate_context.wined3d_context); wined3d_mutex_unlock(); }
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c index f19ea1ff212..e6406c7a04f 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -5621,11 +5621,11 @@ void CDECL wined3d_device_evict_managed_resources(struct wined3d_device *device) } }
-void CDECL wined3d_device_flush(struct wined3d_device *device) +void CDECL wined3d_device_context_flush(struct wined3d_device_context *context) { - TRACE("device %p.\n", device); + TRACE("context %p.\n", context);
- device->cs->c.ops->flush(&device->cs->c); + context->ops->flush(context); }
static void update_swapchain_flags(struct wined3d_texture *texture) diff --git a/dlls/wined3d/wined3d.spec b/dlls/wined3d/wined3d.spec index 1de62071aa0..34eba025b8a 100644 --- a/dlls/wined3d/wined3d.spec +++ b/dlls/wined3d/wined3d.spec @@ -54,7 +54,6 @@ @ cdecl wined3d_device_draw_primitive_instanced_indirect(ptr ptr long) @ cdecl wined3d_device_end_scene(ptr) @ cdecl wined3d_device_evict_managed_resources(ptr) -@ cdecl wined3d_device_flush(ptr) @ cdecl wined3d_device_get_available_texture_mem(ptr) @ cdecl wined3d_device_get_blend_state(ptr ptr) @ cdecl wined3d_device_get_clip_status(ptr ptr) @@ -170,6 +169,7 @@ @ cdecl wined3d_device_context_draw_indirect(ptr ptr long long) @ cdecl wined3d_device_context_dispatch(ptr long long long) @ cdecl wined3d_device_context_dispatch_indirect(ptr ptr long) +@ cdecl wined3d_device_context_flush(ptr) @ cdecl wined3d_device_context_generate_mipmaps(ptr ptr) @ cdecl wined3d_device_context_issue_query(ptr ptr long) @ cdecl wined3d_device_context_map(ptr ptr long ptr ptr long) diff --git a/include/wine/wined3d.h b/include/wine/wined3d.h index 0b3120017c5..db5f75d7aca 100644 --- a/include/wine/wined3d.h +++ b/include/wine/wined3d.h @@ -2564,6 +2564,7 @@ void __cdecl wined3d_device_context_draw_indexed(struct wined3d_device_context * unsigned int start_index, unsigned int index_count, unsigned int start_instance, unsigned int instance_count); void __cdecl wined3d_device_context_draw_indirect(struct wined3d_device_context *context, struct wined3d_buffer *buffer, unsigned int offset, bool indexed); +void __cdecl wined3d_device_context_flush(struct wined3d_device_context *context); void __cdecl wined3d_device_context_generate_mipmaps(struct wined3d_device_context *context, struct wined3d_shader_resource_view *view); void __cdecl wined3d_device_context_issue_query(struct wined3d_device_context *context,
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=88679
Your paranoid android.
=== debiant2 (32 bit Chinese:China report) ===
d3d11: d3d11.c:9661: Test failed: d3d11.c:15027: Test marked todo: Got hr 0 for WRITE_DISCARD.
Signed-off-by: Henri Verbeet hverbeet@codeweavers.com