diff --git a/patches/patchinstall.sh b/patches/patchinstall.sh index 4a739636..98b7bc4c 100755 --- a/patches/patchinstall.sh +++ b/patches/patchinstall.sh @@ -51,7 +51,7 @@ usage() # Get the upstream commit sha upstream_commit() { - echo "9ba058e94c2662f5296c95adeafd29c59b137249" + echo "38fb1062daaf68afe4dc20e1aceddfa89fe1ea4f" } # Show version information diff --git a/patches/wined3d-CSMT_Main/0043-wined3d-Poll-queries-automatically-in-the-CS.patch b/patches/wined3d-CSMT_Main/0043-wined3d-Poll-queries-automatically-in-the-CS.patch index eaf5a7cd..348830ca 100644 --- a/patches/wined3d-CSMT_Main/0043-wined3d-Poll-queries-automatically-in-the-CS.patch +++ b/patches/wined3d-CSMT_Main/0043-wined3d-Poll-queries-automatically-in-the-CS.patch @@ -1,19 +1,19 @@ -From 61128d9c27790e748b376a5f5ba9070e13a0d0fa Mon Sep 17 00:00:00 2001 +From 3958c674d2d38c1df8a5e1685de057629cc9945d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20D=C3=B6singer?= Date: Sat, 6 Jul 2013 19:18:48 +0200 Subject: wined3d: Poll queries automatically in the CS --- - dlls/wined3d/cs.c | 76 ++++++-------- - dlls/wined3d/query.c | 233 +++++++++++++++++++++++++++-------------- + dlls/wined3d/cs.c | 76 ++++++------- + dlls/wined3d/query.c | 235 +++++++++++++++++++++++++++-------------- dlls/wined3d/wined3d_private.h | 7 +- - 3 files changed, 190 insertions(+), 126 deletions(-) + 3 files changed, 192 insertions(+), 126 deletions(-) diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c -index 2bcabbf..d721534 100644 +index 6c54818..9cda883 100644 --- a/dlls/wined3d/cs.c +++ b/dlls/wined3d/cs.c -@@ -69,7 +69,6 @@ enum wined3d_cs_op +@@ -70,7 +70,6 @@ enum wined3d_cs_op WINED3D_CS_OP_TEXTURE_MAP, WINED3D_CS_OP_TEXTURE_UNMAP, WINED3D_CS_OP_QUERY_ISSUE, @@ -21,7 +21,7 @@ index 2bcabbf..d721534 100644 WINED3D_CS_OP_STOP, }; -@@ -384,16 +383,6 @@ struct wined3d_cs_query_issue +@@ -397,16 +396,6 @@ struct wined3d_cs_query_issue DWORD flags; }; @@ -38,7 +38,7 @@ index 2bcabbf..d721534 100644 static void wined3d_cs_submit(struct wined3d_cs *cs, size_t size) { LONG new_val = (cs->queue.head + size) & (WINED3D_CS_QUEUE_SIZE - 1); -@@ -1818,8 +1807,9 @@ static UINT wined3d_cs_exec_query_issue(struct wined3d_cs *cs, const void *data) +@@ -1857,8 +1846,9 @@ static UINT wined3d_cs_exec_query_issue(struct wined3d_cs *cs, const void *data) query->query_ops->query_issue(query, op->flags); @@ -50,7 +50,7 @@ index 2bcabbf..d721534 100644 return sizeof(*op); } -@@ -1836,37 +1826,6 @@ void wined3d_cs_emit_query_issue(struct wined3d_cs *cs, struct wined3d_query *qu +@@ -1875,37 +1865,6 @@ void wined3d_cs_emit_query_issue(struct wined3d_cs *cs, struct wined3d_query *qu cs->ops->submit(cs, sizeof(*op)); } @@ -88,7 +88,7 @@ index 2bcabbf..d721534 100644 static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void *data) = { /* WINED3D_CS_OP_NOP */ wined3d_cs_exec_nop, -@@ -1914,7 +1873,6 @@ static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void +@@ -1954,7 +1913,6 @@ static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void /* WINED3D_CS_OP_TEXTURE_MAP */ wined3d_cs_exec_texture_map, /* WINED3D_CS_OP_TEXTURE_UNMAP */ wined3d_cs_exec_texture_unmap, /* WINED3D_CS_OP_QUERY_ISSUE */ wined3d_cs_exec_query_issue, @@ -96,7 +96,7 @@ index 2bcabbf..d721534 100644 }; static void *wined3d_cs_mt_require_space(struct wined3d_cs *cs, size_t size) -@@ -2033,17 +1991,45 @@ void wined3d_cs_switch_onscreen_ds(struct wined3d_cs *cs, +@@ -2073,17 +2031,45 @@ void wined3d_cs_switch_onscreen_ds(struct wined3d_cs *cs, wined3d_texture_incref(cs->onscreen_depth_stencil->container); } @@ -143,13 +143,14 @@ index 2bcabbf..d721534 100644 { continue; diff --git a/dlls/wined3d/query.c b/dlls/wined3d/query.c -index 84d3340..64a8672 100644 +index fa2c4fc..66368cf 100644 --- a/dlls/wined3d/query.c +++ b/dlls/wined3d/query.c -@@ -241,6 +241,15 @@ ULONG CDECL wined3d_query_decref(struct wined3d_query *query) +@@ -272,7 +272,18 @@ ULONG CDECL wined3d_query_decref(struct wined3d_query *query) + TRACE("%p decreasing refcount to %u.\n", query, refcount); if (!refcount) - { ++ { + if (wined3d_settings.cs_multithreaded) + { + struct wined3d_device *device = query->device; @@ -159,10 +160,12 @@ index 84d3340..64a8672 100644 + device->cs->ops->finish(device->cs); + } + - /* Queries are specific to the GL context that created them. Not - * deleting the query will obviously leak it, but that's still better - * than potentially deleting a different query with the same id in this -@@ -275,20 +284,10 @@ ULONG CDECL wined3d_query_decref(struct wined3d_query *query) + wined3d_cs_emit_destroy_object(query->device->cs, wined3d_query_destroy_object, query); ++ } + + return refcount; + } +@@ -280,20 +291,10 @@ ULONG CDECL wined3d_query_decref(struct wined3d_query *query) HRESULT CDECL wined3d_query_get_data(struct wined3d_query *query, void *data, UINT data_size, DWORD flags) { @@ -184,7 +187,7 @@ index 84d3340..64a8672 100644 } UINT CDECL wined3d_query_get_data_size(const struct wined3d_query *query) -@@ -317,15 +316,10 @@ static void fill_query_data(void *out, unsigned int out_size, const void *result +@@ -322,15 +323,10 @@ static void fill_query_data(void *out, unsigned int out_size, const void *result static HRESULT wined3d_occlusion_query_ops_get_data(struct wined3d_query *query, void *data, DWORD size, DWORD flags) { @@ -201,7 +204,7 @@ index 84d3340..64a8672 100644 if (!oq->context) query->state = QUERY_CREATED; -@@ -339,6 +333,8 @@ static HRESULT wined3d_occlusion_query_ops_get_data(struct wined3d_query *query, +@@ -344,6 +340,8 @@ static HRESULT wined3d_occlusion_query_ops_get_data(struct wined3d_query *query, return S_OK; } @@ -210,7 +213,7 @@ index 84d3340..64a8672 100644 if (query->state == QUERY_BUILDING) { /* Msdn says this returns an error, but our tests show that S_FALSE is returned */ -@@ -354,12 +350,37 @@ static HRESULT wined3d_occlusion_query_ops_get_data(struct wined3d_query *query, +@@ -359,12 +357,37 @@ static HRESULT wined3d_occlusion_query_ops_get_data(struct wined3d_query *query, return S_OK; } @@ -251,7 +254,7 @@ index 84d3340..64a8672 100644 } context = context_acquire(device, context_get_rt_surface(oq->context)); -@@ -370,67 +391,77 @@ static HRESULT wined3d_occlusion_query_ops_get_data(struct wined3d_query *query, +@@ -375,67 +398,77 @@ static HRESULT wined3d_occlusion_query_ops_get_data(struct wined3d_query *query, if (available) { @@ -363,7 +366,7 @@ index 84d3340..64a8672 100644 return S_OK; } -@@ -561,33 +592,57 @@ static HRESULT wined3d_timestamp_query_ops_get_data(struct wined3d_query *query, +@@ -566,33 +599,57 @@ static HRESULT wined3d_timestamp_query_ops_get_data(struct wined3d_query *query, void *data, DWORD size, DWORD flags) { struct wined3d_timestamp_query *tq = query->extendedData; @@ -436,7 +439,7 @@ index 84d3340..64a8672 100644 } context = context_acquire(device, context_get_rt_surface(tq->context)); -@@ -598,23 +653,20 @@ static HRESULT wined3d_timestamp_query_ops_get_data(struct wined3d_query *query, +@@ -603,23 +660,20 @@ static HRESULT wined3d_timestamp_query_ops_get_data(struct wined3d_query *query, if (available) { @@ -467,7 +470,7 @@ index 84d3340..64a8672 100644 } static void wined3d_timestamp_query_ops_issue(struct wined3d_query *query, DWORD flags) -@@ -657,7 +709,6 @@ static HRESULT wined3d_timestamp_disjoint_query_ops_get_data(struct wined3d_quer +@@ -662,7 +716,6 @@ static HRESULT wined3d_timestamp_disjoint_query_ops_get_data(struct wined3d_quer void *data, DWORD size, DWORD flags) { TRACE("query %p, data %p, size %#x, flags %#x.\n", query, data, size, flags); @@ -475,7 +478,7 @@ index 84d3340..64a8672 100644 if (query->type == WINED3D_QUERY_TYPE_TIMESTAMP_DISJOINT) { static const struct wined3d_query_data_timestamp_disjoint disjoint_data = {1000 * 1000 * 1000, FALSE}; -@@ -679,6 +730,11 @@ static HRESULT wined3d_timestamp_disjoint_query_ops_get_data(struct wined3d_quer +@@ -684,6 +737,11 @@ static HRESULT wined3d_timestamp_disjoint_query_ops_get_data(struct wined3d_quer return S_OK; } @@ -487,7 +490,7 @@ index 84d3340..64a8672 100644 static void wined3d_timestamp_disjoint_query_ops_issue(struct wined3d_query *query, DWORD flags) { TRACE("query %p, flags %#x.\n", query, flags); -@@ -701,6 +757,11 @@ static HRESULT wined3d_statistics_query_ops_get_data(struct wined3d_query *query +@@ -706,6 +764,11 @@ static HRESULT wined3d_statistics_query_ops_get_data(struct wined3d_query *query return S_OK; } @@ -499,7 +502,7 @@ index 84d3340..64a8672 100644 static void wined3d_statistics_query_ops_issue(struct wined3d_query *query, DWORD flags) { FIXME("query %p, flags %#x.\n", query, flags); -@@ -718,6 +779,11 @@ static HRESULT wined3d_overflow_query_ops_get_data(struct wined3d_query *query, +@@ -723,6 +786,11 @@ static HRESULT wined3d_overflow_query_ops_get_data(struct wined3d_query *query, return S_OK; } @@ -511,7 +514,7 @@ index 84d3340..64a8672 100644 static void wined3d_overflow_query_ops_issue(struct wined3d_query *query, DWORD flags) { FIXME("query %p, flags %#x.\n", query, flags); -@@ -726,36 +792,42 @@ static void wined3d_overflow_query_ops_issue(struct wined3d_query *query, DWORD +@@ -731,36 +799,42 @@ static void wined3d_overflow_query_ops_issue(struct wined3d_query *query, DWORD static const struct wined3d_query_ops event_query_ops = { wined3d_event_query_ops_get_data, @@ -554,7 +557,7 @@ index 84d3340..64a8672 100644 wined3d_overflow_query_ops_issue }; -@@ -870,6 +942,7 @@ static HRESULT query_init(struct wined3d_query *query, struct wined3d_device *de +@@ -875,6 +949,7 @@ static HRESULT query_init(struct wined3d_query *query, struct wined3d_device *de query->state = QUERY_CREATED; query->device = device; query->ref = 1; @@ -563,10 +566,10 @@ index 84d3340..64a8672 100644 return WINED3D_OK; } diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h -index 3c10eb6..1d85e1b 100644 +index 6fc8190..3699e3d 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h -@@ -1277,6 +1277,7 @@ struct wined3d_occlusion_query +@@ -1330,6 +1330,7 @@ struct wined3d_occlusion_query struct list entry; GLuint id; struct wined3d_context *context; @@ -574,7 +577,7 @@ index 3c10eb6..1d85e1b 100644 }; union wined3d_gl_query_object -@@ -1312,6 +1313,7 @@ struct wined3d_timestamp_query +@@ -1365,6 +1366,7 @@ struct wined3d_timestamp_query struct list entry; GLuint id; struct wined3d_context *context; @@ -582,7 +585,7 @@ index 3c10eb6..1d85e1b 100644 }; void context_alloc_timestamp_query(struct wined3d_context *context, struct wined3d_timestamp_query *query) DECLSPEC_HIDDEN; -@@ -2898,6 +2900,7 @@ struct wined3d_cs +@@ -2957,6 +2959,7 @@ struct wined3d_cs struct wined3d_cs_queue queue; LONG pending_presents; @@ -590,7 +593,7 @@ index 3c10eb6..1d85e1b 100644 }; struct wined3d_cs *wined3d_cs_create(struct wined3d_device *device) DECLSPEC_HIDDEN; -@@ -2994,6 +2997,7 @@ enum query_state { +@@ -3055,6 +3058,7 @@ enum query_state { struct wined3d_query_ops { HRESULT (*query_get_data)(struct wined3d_query *query, void *data, DWORD data_size, DWORD flags); @@ -598,7 +601,7 @@ index 3c10eb6..1d85e1b 100644 void (*query_issue)(struct wined3d_query *query, DWORD flags); }; -@@ -3009,7 +3013,8 @@ struct wined3d_query +@@ -3070,7 +3074,8 @@ struct wined3d_query DWORD data_size; void *extendedData; diff --git a/patches/wined3d-CSMT_Main/0045-wined3d-Destroy-queries-through-the-CS.patch b/patches/wined3d-CSMT_Main/0045-wined3d-Destroy-queries-through-the-CS.patch index fa194c2f..8e3329b8 100644 --- a/patches/wined3d-CSMT_Main/0045-wined3d-Destroy-queries-through-the-CS.patch +++ b/patches/wined3d-CSMT_Main/0045-wined3d-Destroy-queries-through-the-CS.patch @@ -1,183 +1,45 @@ -From 6285debb172f28036f6f970edb0180adff28ec55 Mon Sep 17 00:00:00 2001 +From 817d317d346d6f91b7affb58ed533ba3c22a397d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20D=C3=B6singer?= Date: Sat, 6 Jul 2013 21:54:45 +0200 Subject: wined3d: Destroy queries through the CS --- - dlls/wined3d/cs.c | 31 ++++++++++++++++++++ - dlls/wined3d/query.c | 66 +++++++++++++++++++----------------------- - dlls/wined3d/wined3d_private.h | 3 ++ - 3 files changed, 64 insertions(+), 36 deletions(-) + dlls/wined3d/query.c | 14 +++----------- + 1 file changed, 3 insertions(+), 11 deletions(-) -diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c -index 03ad89d..48d9fe3 100644 ---- a/dlls/wined3d/cs.c -+++ b/dlls/wined3d/cs.c -@@ -69,6 +69,7 @@ enum wined3d_cs_op - WINED3D_CS_OP_TEXTURE_MAP, - WINED3D_CS_OP_TEXTURE_UNMAP, - WINED3D_CS_OP_QUERY_ISSUE, -+ WINED3D_CS_OP_QUERY_DESTROY, - WINED3D_CS_OP_STOP, - }; - -@@ -383,6 +384,12 @@ struct wined3d_cs_query_issue - DWORD flags; - }; - -+struct wined3d_cs_query_destroy -+{ -+ enum wined3d_cs_op opcode; -+ struct wined3d_query *query; -+}; -+ - static void wined3d_cs_mt_submit(struct wined3d_cs *cs, size_t size) - { - LONG new_val = (cs->queue.head + size) & (WINED3D_CS_QUEUE_SIZE - 1); -@@ -1835,6 +1842,29 @@ void wined3d_cs_emit_query_issue(struct wined3d_cs *cs, struct wined3d_query *qu - cs->ops->submit(cs, sizeof(*op)); - } - -+static UINT wined3d_cs_exec_query_destroy(struct wined3d_cs *cs, const void *data) -+{ -+ const struct wined3d_cs_query_destroy *op = data; -+ -+ if (!list_empty(&op->query->poll_list_entry)) -+ list_remove(&op->query->poll_list_entry); -+ -+ wined3d_query_destroy(op->query); -+ -+ return sizeof(*op); -+} -+ -+void wined3d_cs_emit_query_destroy(struct wined3d_cs *cs, struct wined3d_query *query) -+{ -+ struct wined3d_cs_query_destroy *op; -+ -+ op = cs->ops->require_space(cs, sizeof(*op)); -+ op->opcode = WINED3D_CS_OP_QUERY_DESTROY; -+ op->query = query; -+ -+ cs->ops->submit(cs, sizeof(*op)); -+} -+ - static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void *data) = - { - /* WINED3D_CS_OP_NOP */ wined3d_cs_exec_nop, -@@ -1882,6 +1912,7 @@ static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void - /* WINED3D_CS_OP_TEXTURE_MAP */ wined3d_cs_exec_texture_map, - /* WINED3D_CS_OP_TEXTURE_UNMAP */ wined3d_cs_exec_texture_unmap, - /* WINED3D_CS_OP_QUERY_ISSUE */ wined3d_cs_exec_query_issue, -+ /* WINED3D_CS_OP_QUERY_DESTROY */ wined3d_cs_exec_query_destroy, - }; - - static inline void *_wined3d_cs_mt_require_space(struct wined3d_cs *cs, size_t size, BOOL prio) diff --git a/dlls/wined3d/query.c b/dlls/wined3d/query.c -index 6c981af..eaff776 100644 +index 66368cf..c1ba517 100644 --- a/dlls/wined3d/query.c +++ b/dlls/wined3d/query.c -@@ -233,50 +233,44 @@ ULONG CDECL wined3d_query_incref(struct wined3d_query *query) - return refcount; - } - --ULONG CDECL wined3d_query_decref(struct wined3d_query *query) -+void wined3d_query_destroy(struct wined3d_query *query) +@@ -237,6 +237,9 @@ static void wined3d_query_destroy_object(void *object) { -- ULONG refcount = InterlockedDecrement(&query->ref); -- -- TRACE("%p decreasing refcount to %u.\n", query, refcount); -+ /* Queries are specific to the GL context that created them. Not -+ * deleting the query will obviously leak it, but that's still better -+ * than potentially deleting a different query with the same id in this -+ * context, and (still) leaking the actual query. */ -+ if (query->type == WINED3D_QUERY_TYPE_EVENT) -+ { -+ struct wined3d_event_query *event_query = query->extendedData; -+ if (event_query) wined3d_event_query_destroy(event_query); -+ } -+ else if (query->type == WINED3D_QUERY_TYPE_OCCLUSION) -+ { -+ struct wined3d_occlusion_query *oq = query->extendedData; + struct wined3d_query *query = object; -- if (!refcount) -+ if (oq->context) context_free_occlusion_query(oq); -+ HeapFree(GetProcessHeap(), 0, query->extendedData); -+ } -+ else if (query->type == WINED3D_QUERY_TYPE_TIMESTAMP) - { ++ if (!list_empty(&query->poll_list_entry)) ++ list_remove(&query->poll_list_entry); ++ + /* Queries are specific to the GL context that created them. Not + * deleting the query will obviously leak it, but that's still better + * than potentially deleting a different query with the same id in this +@@ -272,18 +275,7 @@ ULONG CDECL wined3d_query_decref(struct wined3d_query *query) + TRACE("%p decreasing refcount to %u.\n", query, refcount); + + if (!refcount) +- { - if (wined3d_settings.cs_multithreaded) - { - struct wined3d_device *device = query->device; -+ struct wined3d_timestamp_query *tq = query->extendedData; - +- - FIXME("waiting for cs\n"); - wined3d_cs_emit_glfinish(device->cs); - device->cs->ops->finish(device->cs); - } -+ if (tq->context) -+ context_free_timestamp_query(tq); -+ HeapFree(GetProcessHeap(), 0, query->extendedData); -+ } - -- /* Queries are specific to the GL context that created them. Not -- * deleting the query will obviously leak it, but that's still better -- * than potentially deleting a different query with the same id in this -- * context, and (still) leaking the actual query. */ -- if (query->type == WINED3D_QUERY_TYPE_EVENT) -- { -- struct wined3d_event_query *event_query = query->extendedData; -- if (event_query) wined3d_event_query_destroy(event_query); -- } -- else if (query->type == WINED3D_QUERY_TYPE_OCCLUSION) -- { -- struct wined3d_occlusion_query *oq = query->extendedData; -+ HeapFree(GetProcessHeap(), 0, query); -+} - -- if (oq->context) context_free_occlusion_query(oq); -- HeapFree(GetProcessHeap(), 0, query->extendedData); -- } -- else if (query->type == WINED3D_QUERY_TYPE_TIMESTAMP) -- { -- struct wined3d_timestamp_query *tq = query->extendedData; -+ULONG CDECL wined3d_query_decref(struct wined3d_query *query) -+{ -+ ULONG refcount = InterlockedDecrement(&query->ref); - -- if (tq->context) -- context_free_timestamp_query(tq); -- HeapFree(GetProcessHeap(), 0, query->extendedData); -- } -+ TRACE("%p decreasing refcount to %u.\n", query, refcount); - -- HeapFree(GetProcessHeap(), 0, query); +- + wined3d_cs_emit_destroy_object(query->device->cs, wined3d_query_destroy_object, query); - } -+ if (!refcount) -+ wined3d_cs_emit_query_destroy(query->device->cs, query); return refcount; } -diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h -index 9efcd14..7651b39 100644 ---- a/dlls/wined3d/wined3d_private.h -+++ b/dlls/wined3d/wined3d_private.h -@@ -2986,6 +2986,7 @@ void wined3d_cs_emit_query_issue(struct wined3d_cs *cs, struct wined3d_query *qu - DWORD flags) DECLSPEC_HIDDEN; - void wined3d_cs_emit_query_get_data(struct wined3d_cs *cs, struct wined3d_query *query, void *data, - UINT data_size, DWORD flags, HRESULT *ret) DECLSPEC_HIDDEN; -+void wined3d_cs_emit_query_destroy(struct wined3d_cs *cs, struct wined3d_query *query) DECLSPEC_HIDDEN; - - /* Direct3D terminology with little modifications. We do not have an issued state - * because only the driver knows about it, but we have a created state because d3d -@@ -3020,6 +3021,8 @@ struct wined3d_query - struct list poll_list_entry; - }; - -+void wined3d_query_destroy(struct wined3d_query *query) DECLSPEC_HIDDEN; -+ - /* TODO: Add tests and support for FLOAT16_4 POSITIONT, D3DCOLOR position, other - * fixed function semantics as D3DCOLOR or FLOAT16 */ - enum wined3d_buffer_conversion_type -- 2.8.0 diff --git a/patches/wined3d-CSMT_Main/0051-wined3d-Send-texture-preloads-through-the-CS.patch b/patches/wined3d-CSMT_Main/0051-wined3d-Send-texture-preloads-through-the-CS.patch index 8ad3aacb..81d29378 100644 --- a/patches/wined3d-CSMT_Main/0051-wined3d-Send-texture-preloads-through-the-CS.patch +++ b/patches/wined3d-CSMT_Main/0051-wined3d-Send-texture-preloads-through-the-CS.patch @@ -1,4 +1,4 @@ -From bcfd12bb0bafeba3d720f3448c222688243cc672 Mon Sep 17 00:00:00 2001 +From c4394ed6817eddd3c0ca2c516173ddc84638ec7c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20D=C3=B6singer?= Date: Thu, 1 Aug 2013 00:10:40 +0200 Subject: wined3d: Send texture preloads through the CS @@ -10,19 +10,19 @@ Subject: wined3d: Send texture preloads through the CS 3 files changed, 35 insertions(+), 4 deletions(-) diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c -index afb1a80..f0d9834 100644 +index f8d7928..66c2f62 100644 --- a/dlls/wined3d/cs.c +++ b/dlls/wined3d/cs.c @@ -70,6 +70,7 @@ enum wined3d_cs_op + WINED3D_CS_OP_TEXTURE_MAP, WINED3D_CS_OP_TEXTURE_UNMAP, WINED3D_CS_OP_QUERY_ISSUE, - WINED3D_CS_OP_QUERY_DESTROY, + WINED3D_CS_OP_TEXTURE_PRELOAD, WINED3D_CS_OP_STOP, }; -@@ -390,6 +391,12 @@ struct wined3d_cs_query_destroy - struct wined3d_query *query; +@@ -396,6 +397,12 @@ struct wined3d_cs_query_issue + DWORD flags; }; +struct wined3d_cs_texture_preload @@ -34,7 +34,7 @@ index afb1a80..f0d9834 100644 static void wined3d_cs_mt_submit(struct wined3d_cs *cs, size_t size) { LONG new_val = (cs->queue.head + size) & (WINED3D_CS_QUEUE_SIZE - 1); -@@ -1889,6 +1896,30 @@ void wined3d_cs_emit_query_destroy(struct wined3d_cs *cs, struct wined3d_query * +@@ -1898,6 +1905,30 @@ void wined3d_cs_emit_query_issue(struct wined3d_cs *cs, struct wined3d_query *qu cs->ops->submit(cs, sizeof(*op)); } @@ -65,19 +65,19 @@ index afb1a80..f0d9834 100644 static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void *data) = { /* WINED3D_CS_OP_NOP */ wined3d_cs_exec_nop, -@@ -1937,6 +1968,7 @@ static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void +@@ -1946,6 +1977,7 @@ static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void + /* WINED3D_CS_OP_TEXTURE_MAP */ wined3d_cs_exec_texture_map, /* WINED3D_CS_OP_TEXTURE_UNMAP */ wined3d_cs_exec_texture_unmap, /* WINED3D_CS_OP_QUERY_ISSUE */ wined3d_cs_exec_query_issue, - /* WINED3D_CS_OP_QUERY_DESTROY */ wined3d_cs_exec_query_destroy, + /* WINED3D_CS_OP_TEXTURE_PRELOAD */ wined3d_cs_exec_texture_preload, }; static inline void *_wined3d_cs_mt_require_space(struct wined3d_cs *cs, size_t size, BOOL prio) diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c -index 14ac300..fac20c9 100644 +index e220474..094d707 100644 --- a/dlls/wined3d/texture.c +++ b/dlls/wined3d/texture.c -@@ -819,10 +819,8 @@ void wined3d_texture_load(struct wined3d_texture *texture, +@@ -894,10 +894,8 @@ void wined3d_texture_load(struct wined3d_texture *texture, void CDECL wined3d_texture_preload(struct wined3d_texture *texture) { @@ -91,13 +91,13 @@ index 14ac300..fac20c9 100644 void * CDECL wined3d_texture_get_parent(const struct wined3d_texture *texture) diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h -index 545c180..34e258a 100644 +index c468a7f..eedaccc 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h -@@ -2988,6 +2988,7 @@ void wined3d_cs_emit_query_issue(struct wined3d_cs *cs, struct wined3d_query *qu +@@ -3048,6 +3048,7 @@ void wined3d_cs_emit_query_issue(struct wined3d_cs *cs, struct wined3d_query *qu + DWORD flags) DECLSPEC_HIDDEN; void wined3d_cs_emit_query_get_data(struct wined3d_cs *cs, struct wined3d_query *query, void *data, UINT data_size, DWORD flags, HRESULT *ret) DECLSPEC_HIDDEN; - void wined3d_cs_emit_query_destroy(struct wined3d_cs *cs, struct wined3d_query *query) DECLSPEC_HIDDEN; +void wined3d_cs_emit_texture_preload(struct wined3d_cs *cs, struct wined3d_texture *texture) DECLSPEC_HIDDEN; /* Direct3D terminology with little modifications. We do not have an issued state diff --git a/patches/wined3d-CSMT_Main/0055-wined3d-Send-update_texture-calls-through-the-CS.patch b/patches/wined3d-CSMT_Main/0055-wined3d-Send-update_texture-calls-through-the-CS.patch index 29abaaca..32157c21 100644 --- a/patches/wined3d-CSMT_Main/0055-wined3d-Send-update_texture-calls-through-the-CS.patch +++ b/patches/wined3d-CSMT_Main/0055-wined3d-Send-update_texture-calls-through-the-CS.patch @@ -1,4 +1,4 @@ -From d4219aaabd252d45506c391898326af17c1d1417 Mon Sep 17 00:00:00 2001 +From 59ad07b3a1737ba2cb291ceb967840ed999e63ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20D=C3=B6singer?= Date: Thu, 1 Aug 2013 00:33:48 +0200 Subject: wined3d: Send update_texture calls through the CS @@ -11,18 +11,18 @@ FIXME: This logic duplication is ugly. 3 files changed, 137 insertions(+), 82 deletions(-) diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c -index d65f27a..9a4aec1 100644 +index 66c2f62..39f6978 100644 --- a/dlls/wined3d/cs.c +++ b/dlls/wined3d/cs.c @@ -71,6 +71,7 @@ enum wined3d_cs_op + WINED3D_CS_OP_TEXTURE_UNMAP, WINED3D_CS_OP_QUERY_ISSUE, - WINED3D_CS_OP_QUERY_DESTROY, WINED3D_CS_OP_TEXTURE_PRELOAD, + WINED3D_CS_OP_UPDATE_TEXTURE, WINED3D_CS_OP_STOP, }; -@@ -402,6 +403,12 @@ struct wined3d_cs_texture_preload +@@ -403,6 +404,12 @@ struct wined3d_cs_texture_preload struct wined3d_texture *texture; }; @@ -35,7 +35,7 @@ index d65f27a..9a4aec1 100644 static void wined3d_cs_mt_submit(struct wined3d_cs *cs, size_t size) { LONG new_val = (cs->queue.head + size) & (WINED3D_CS_QUEUE_SIZE - 1); -@@ -1919,6 +1926,31 @@ void wined3d_cs_emit_texture_preload(struct wined3d_cs *cs, struct wined3d_textu +@@ -1929,6 +1936,31 @@ void wined3d_cs_emit_texture_preload(struct wined3d_cs *cs, struct wined3d_textu cs->ops->submit(cs, sizeof(*op)); } @@ -67,9 +67,9 @@ index d65f27a..9a4aec1 100644 static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void *data) = { /* WINED3D_CS_OP_NOP */ wined3d_cs_exec_nop, -@@ -1968,6 +2000,7 @@ static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void +@@ -1978,6 +2010,7 @@ static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void + /* WINED3D_CS_OP_TEXTURE_UNMAP */ wined3d_cs_exec_texture_unmap, /* WINED3D_CS_OP_QUERY_ISSUE */ wined3d_cs_exec_query_issue, - /* WINED3D_CS_OP_QUERY_DESTROY */ wined3d_cs_exec_query_destroy, /* WINED3D_CS_OP_TEXTURE_PRELOAD */ wined3d_cs_exec_texture_preload, + /* WINED3D_CS_OP_UPDATE_TEXTURE */ wined3d_cs_exec_update_texture, }; @@ -319,10 +319,10 @@ index 903b091..6dc0a25 100644 HRESULT CDECL wined3d_device_validate_device(const struct wined3d_device *device, DWORD *num_passes) diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h -index 4eb0689..9519e5d 100644 +index 25f1ec9..769a970 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h -@@ -2421,6 +2421,8 @@ void device_resource_add(struct wined3d_device *device, struct wined3d_resource +@@ -2435,6 +2435,8 @@ void device_resource_add(struct wined3d_device *device, struct wined3d_resource void device_resource_released(struct wined3d_device *device, struct wined3d_resource *resource) DECLSPEC_HIDDEN; void device_invalidate_state(const struct wined3d_device *device, DWORD state) DECLSPEC_HIDDEN; void device_invalidate_shader_constants(const struct wined3d_device *device, DWORD mask) DECLSPEC_HIDDEN; @@ -331,9 +331,9 @@ index 4eb0689..9519e5d 100644 static inline BOOL isStateDirty(const struct wined3d_context *context, DWORD state) { -@@ -3034,6 +3036,8 @@ void wined3d_cs_emit_query_get_data(struct wined3d_cs *cs, struct wined3d_query +@@ -3049,6 +3051,8 @@ void wined3d_cs_emit_query_issue(struct wined3d_cs *cs, struct wined3d_query *qu + void wined3d_cs_emit_query_get_data(struct wined3d_cs *cs, struct wined3d_query *query, void *data, UINT data_size, DWORD flags, HRESULT *ret) DECLSPEC_HIDDEN; - void wined3d_cs_emit_query_destroy(struct wined3d_cs *cs, struct wined3d_query *query) DECLSPEC_HIDDEN; void wined3d_cs_emit_texture_preload(struct wined3d_cs *cs, struct wined3d_texture *texture) DECLSPEC_HIDDEN; +void wined3d_cs_emit_update_texture(struct wined3d_cs *cs, struct wined3d_texture *src, + struct wined3d_texture *dst) DECLSPEC_HIDDEN; diff --git a/patches/wined3d-CSMT_Main/0058-wined3d-Handle-evit_managed_resources-through-the-CS.patch b/patches/wined3d-CSMT_Main/0058-wined3d-Handle-evit_managed_resources-through-the-CS.patch index 7efbf7f6..feb09b81 100644 --- a/patches/wined3d-CSMT_Main/0058-wined3d-Handle-evit_managed_resources-through-the-CS.patch +++ b/patches/wined3d-CSMT_Main/0058-wined3d-Handle-evit_managed_resources-through-the-CS.patch @@ -1,4 +1,4 @@ -From 4cd31abbb46ce2584a71b523edfc0c057a13359e Mon Sep 17 00:00:00 2001 +From 81ddb7588fa1f7dde51cfffea7c95287bd9e933b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20D=C3=B6singer?= Date: Tue, 6 Aug 2013 13:50:31 +0200 Subject: wined3d: Handle evit_managed_resources through the CS @@ -10,18 +10,18 @@ Subject: wined3d: Handle evit_managed_resources through the CS 3 files changed, 41 insertions(+), 11 deletions(-) diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c -index 0ef6d4b..e036b3e 100644 +index 39f6978..f33cfa8 100644 --- a/dlls/wined3d/cs.c +++ b/dlls/wined3d/cs.c @@ -72,6 +72,7 @@ enum wined3d_cs_op - WINED3D_CS_OP_QUERY_DESTROY, + WINED3D_CS_OP_QUERY_ISSUE, WINED3D_CS_OP_TEXTURE_PRELOAD, WINED3D_CS_OP_UPDATE_TEXTURE, + WINED3D_CS_OP_EVICT_RESOURCE, WINED3D_CS_OP_STOP, }; -@@ -404,6 +405,12 @@ struct wined3d_cs_update_texture +@@ -410,6 +411,12 @@ struct wined3d_cs_update_texture struct wined3d_texture *src, *dst; }; @@ -34,7 +34,7 @@ index 0ef6d4b..e036b3e 100644 static void wined3d_cs_mt_submit(struct wined3d_cs *cs, size_t size) { LONG new_val = (cs->queue.head + size) & (WINED3D_CS_QUEUE_SIZE - 1); -@@ -1952,6 +1959,35 @@ void wined3d_cs_emit_update_texture(struct wined3d_cs *cs, struct wined3d_textur +@@ -1961,6 +1968,35 @@ void wined3d_cs_emit_update_texture(struct wined3d_cs *cs, struct wined3d_textur cs->ops->submit(cs, sizeof(*op)); } @@ -70,8 +70,8 @@ index 0ef6d4b..e036b3e 100644 static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void *data) = { /* WINED3D_CS_OP_NOP */ wined3d_cs_exec_nop, -@@ -2002,6 +2038,7 @@ static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void - /* WINED3D_CS_OP_QUERY_DESTROY */ wined3d_cs_exec_query_destroy, +@@ -2011,6 +2047,7 @@ static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void + /* WINED3D_CS_OP_QUERY_ISSUE */ wined3d_cs_exec_query_issue, /* WINED3D_CS_OP_TEXTURE_PRELOAD */ wined3d_cs_exec_texture_preload, /* WINED3D_CS_OP_UPDATE_TEXTURE */ wined3d_cs_exec_update_texture, + /* WINED3D_CS_OP_EVICT_RESOURCE */ wined3d_cs_exec_evict_resource, @@ -79,10 +79,10 @@ index 0ef6d4b..e036b3e 100644 static inline void *_wined3d_cs_mt_require_space(struct wined3d_cs *cs, size_t size, BOOL prio) diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c -index 12e87e1..8dbefcf 100644 +index 6c274c8..eed3623 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c -@@ -4499,13 +4499,8 @@ void CDECL wined3d_device_evict_managed_resources(struct wined3d_device *device) +@@ -4540,13 +4540,8 @@ void CDECL wined3d_device_evict_managed_resources(struct wined3d_device *device) TRACE("device %p.\n", device); @@ -98,7 +98,7 @@ index 12e87e1..8dbefcf 100644 LIST_FOR_EACH_ENTRY_SAFE(resource, cursor, &device->resources, struct wined3d_resource, resource_list_entry) { TRACE("Checking resource %p for eviction.\n", resource); -@@ -4513,12 +4508,9 @@ void CDECL wined3d_device_evict_managed_resources(struct wined3d_device *device) +@@ -4554,12 +4549,9 @@ void CDECL wined3d_device_evict_managed_resources(struct wined3d_device *device) if (resource->pool == WINED3D_POOL_MANAGED && !resource->map_count) { TRACE("Evicting %p.\n", resource); @@ -113,10 +113,10 @@ index 12e87e1..8dbefcf 100644 static void delete_opengl_contexts(struct wined3d_device *device, struct wined3d_swapchain *swapchain) diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h -index a6ff922..38a72de 100644 +index 769a970..8d991e1 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h -@@ -2993,6 +2993,7 @@ void wined3d_cs_emit_query_destroy(struct wined3d_cs *cs, struct wined3d_query * +@@ -3053,6 +3053,7 @@ void wined3d_cs_emit_query_get_data(struct wined3d_cs *cs, struct wined3d_query void wined3d_cs_emit_texture_preload(struct wined3d_cs *cs, struct wined3d_texture *texture) DECLSPEC_HIDDEN; void wined3d_cs_emit_update_texture(struct wined3d_cs *cs, struct wined3d_texture *src, struct wined3d_texture *dst) DECLSPEC_HIDDEN; diff --git a/patches/wined3d-CSMT_Main/0081-wined3d-Accelerate-DISCARD-buffer-maps.patch b/patches/wined3d-CSMT_Main/0081-wined3d-Accelerate-DISCARD-buffer-maps.patch index 6922dfb0..1f868888 100644 --- a/patches/wined3d-CSMT_Main/0081-wined3d-Accelerate-DISCARD-buffer-maps.patch +++ b/patches/wined3d-CSMT_Main/0081-wined3d-Accelerate-DISCARD-buffer-maps.patch @@ -1,4 +1,4 @@ -From f842a9a07432ce0bea63b5a4017da38bdac8f46a Mon Sep 17 00:00:00 2001 +From f39c194da347f4bece34f7bea45b6c53461818c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20D=C3=B6singer?= Date: Sat, 6 Jul 2013 16:14:16 +0200 Subject: wined3d: Accelerate DISCARD buffer maps @@ -13,10 +13,10 @@ TODO3: Clean up the map_mem allocation mess. 3 files changed, 51 insertions(+), 3 deletions(-) diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c -index 3d9cb5c..c1d5a40 100644 +index 9b21e97..5c5c1da 100644 --- a/dlls/wined3d/buffer.c +++ b/dlls/wined3d/buffer.c -@@ -1064,10 +1064,19 @@ HRESULT CDECL wined3d_buffer_map(struct wined3d_buffer *buffer, UINT offset, UIN +@@ -1055,10 +1055,19 @@ HRESULT CDECL wined3d_buffer_map(struct wined3d_buffer *buffer, UINT offset, UIN buffer->flags |= WINED3D_BUFFER_SYNC; } @@ -40,18 +40,18 @@ index 3d9cb5c..c1d5a40 100644 base = buffer->map_ptr ? buffer->map_ptr : buffer->resource.map_heap_memory; diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c -index 3a6299a..16d16e5 100644 +index 640a5f8..cabb880 100644 --- a/dlls/wined3d/cs.c +++ b/dlls/wined3d/cs.c -@@ -69,6 +69,7 @@ enum wined3d_cs_op +@@ -70,6 +70,7 @@ enum wined3d_cs_op WINED3D_CS_OP_TEXTURE_CHANGED, WINED3D_CS_OP_TEXTURE_MAP, WINED3D_CS_OP_TEXTURE_UNMAP, + WINED3D_CS_OP_BUFFER_SWAP_MEM, WINED3D_CS_OP_QUERY_ISSUE, - WINED3D_CS_OP_QUERY_DESTROY, WINED3D_CS_OP_TEXTURE_PRELOAD, -@@ -385,6 +386,13 @@ struct wined3d_cs_texture_changed + WINED3D_CS_OP_UPDATE_TEXTURE, +@@ -397,6 +398,13 @@ struct wined3d_cs_texture_changed void *swap_heap_memory; }; @@ -65,7 +65,7 @@ index 3a6299a..16d16e5 100644 struct wined3d_cs_skip { enum wined3d_cs_op opcode; -@@ -2233,6 +2241,34 @@ void wined3d_cs_emit_update_sub_resource(struct wined3d_cs *cs, struct wined3d_r +@@ -2242,6 +2250,34 @@ void wined3d_cs_emit_update_sub_resource(struct wined3d_cs *cs, struct wined3d_r cs->ops->finish(cs); } @@ -100,19 +100,19 @@ index 3a6299a..16d16e5 100644 static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void *data) = { /* WINED3D_CS_OP_NOP */ wined3d_cs_exec_nop, -@@ -2280,6 +2316,7 @@ static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void +@@ -2290,6 +2326,7 @@ static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void /* WINED3D_CS_OP_TEXTURE_CHANGED */ wined3d_cs_exec_texture_changed, /* WINED3D_CS_OP_TEXTURE_MAP */ wined3d_cs_exec_texture_map, /* WINED3D_CS_OP_TEXTURE_UNMAP */ wined3d_cs_exec_texture_unmap, + /* WINED3D_CS_OP_BUFFER_SWAP_MEM */ wined3d_cs_exec_buffer_swap_mem, /* WINED3D_CS_OP_QUERY_ISSUE */ wined3d_cs_exec_query_issue, - /* WINED3D_CS_OP_QUERY_DESTROY */ wined3d_cs_exec_query_destroy, /* WINED3D_CS_OP_TEXTURE_PRELOAD */ wined3d_cs_exec_texture_preload, + /* WINED3D_CS_OP_UPDATE_TEXTURE */ wined3d_cs_exec_update_texture, diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h -index 5feee06..c7b7e8f 100644 +index bb87b41..a6d438a 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h -@@ -3033,6 +3033,8 @@ void wined3d_cs_emit_evict_resource(struct wined3d_cs *cs, struct wined3d_resour +@@ -3093,6 +3093,8 @@ void wined3d_cs_emit_evict_resource(struct wined3d_cs *cs, struct wined3d_resour void wined3d_cs_emit_update_sub_resource(struct wined3d_cs *cs, struct wined3d_resource *resource, unsigned int sub_resource_idx, const struct wined3d_box *box, const void *data, unsigned int row_pitch, unsigned int depth_pitch) DECLSPEC_HIDDEN; diff --git a/patches/wined3d-CSMT_Main/0083-wined3d-Access-the-buffer-dirty-areas-through-the-CS.patch b/patches/wined3d-CSMT_Main/0083-wined3d-Access-the-buffer-dirty-areas-through-the-CS.patch index 6152aef4..5ac6aa3b 100644 --- a/patches/wined3d-CSMT_Main/0083-wined3d-Access-the-buffer-dirty-areas-through-the-CS.patch +++ b/patches/wined3d-CSMT_Main/0083-wined3d-Access-the-buffer-dirty-areas-through-the-CS.patch @@ -1,4 +1,4 @@ -From 477daa94578dd929f9682f56a6ac807ac0b9041b Mon Sep 17 00:00:00 2001 +From 1250ebaa61f449f123ea6677416ea876cc3cb0b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20D=C3=B6singer?= Date: Sat, 6 Jul 2013 17:05:12 +0200 Subject: wined3d: Access the buffer dirty areas through the CS @@ -27,7 +27,7 @@ be protected by locks. 3 files changed, 37 insertions(+), 3 deletions(-) diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c -index e4ee1ba..ca2184e 100644 +index 3a7ceeb..e51a87e 100644 --- a/dlls/wined3d/buffer.c +++ b/dlls/wined3d/buffer.c @@ -41,7 +41,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(d3d); @@ -39,7 +39,7 @@ index e4ee1ba..ca2184e 100644 { if (!offset && (!size || size == buffer->resource.size)) goto invalidate_all; -@@ -987,9 +987,9 @@ HRESULT CDECL wined3d_buffer_map(struct wined3d_buffer *buffer, UINT offset, UIN +@@ -978,9 +978,9 @@ HRESULT CDECL wined3d_buffer_map(struct wined3d_buffer *buffer, UINT offset, UIN * being uploaded in that case. Two such applications are Port Royale * and Darkstar One. */ if (flags & WINED3D_MAP_DISCARD) @@ -52,18 +52,18 @@ index e4ee1ba..ca2184e 100644 if (!(buffer->flags & WINED3D_BUFFER_DOUBLEBUFFER)) { diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c -index 16d16e5..b530ab2 100644 +index cabb880..2fa9077 100644 --- a/dlls/wined3d/cs.c +++ b/dlls/wined3d/cs.c -@@ -70,6 +70,7 @@ enum wined3d_cs_op +@@ -71,6 +71,7 @@ enum wined3d_cs_op WINED3D_CS_OP_TEXTURE_MAP, WINED3D_CS_OP_TEXTURE_UNMAP, WINED3D_CS_OP_BUFFER_SWAP_MEM, + WINED3D_CS_OP_BUFFER_INVALIDATE_RANGE, WINED3D_CS_OP_QUERY_ISSUE, - WINED3D_CS_OP_QUERY_DESTROY, WINED3D_CS_OP_TEXTURE_PRELOAD, -@@ -393,6 +394,13 @@ struct wined3d_cs_buffer_swap_mem + WINED3D_CS_OP_UPDATE_TEXTURE, +@@ -405,6 +406,13 @@ struct wined3d_cs_buffer_swap_mem BYTE *mem; }; @@ -77,7 +77,7 @@ index 16d16e5..b530ab2 100644 struct wined3d_cs_skip { enum wined3d_cs_op opcode; -@@ -2269,6 +2277,28 @@ void wined3d_cs_emit_buffer_swap_mem(struct wined3d_cs *cs, struct wined3d_buffe +@@ -2278,6 +2286,28 @@ void wined3d_cs_emit_buffer_swap_mem(struct wined3d_cs *cs, struct wined3d_buffe cs->ops->submit(cs, sizeof(*op)); } @@ -106,19 +106,19 @@ index 16d16e5..b530ab2 100644 static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void *data) = { /* WINED3D_CS_OP_NOP */ wined3d_cs_exec_nop, -@@ -2317,6 +2347,7 @@ static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void +@@ -2327,6 +2357,7 @@ static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void /* WINED3D_CS_OP_TEXTURE_MAP */ wined3d_cs_exec_texture_map, /* WINED3D_CS_OP_TEXTURE_UNMAP */ wined3d_cs_exec_texture_unmap, /* WINED3D_CS_OP_BUFFER_SWAP_MEM */ wined3d_cs_exec_buffer_swap_mem, + /* WINED3D_CS_OP_BUFFER_INVALIDATE_RANGE */ wined3d_cs_exec_buffer_invalidate_bo_range, /* WINED3D_CS_OP_QUERY_ISSUE */ wined3d_cs_exec_query_issue, - /* WINED3D_CS_OP_QUERY_DESTROY */ wined3d_cs_exec_query_destroy, /* WINED3D_CS_OP_TEXTURE_PRELOAD */ wined3d_cs_exec_texture_preload, + /* WINED3D_CS_OP_UPDATE_TEXTURE */ wined3d_cs_exec_update_texture, diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h -index c7b7e8f..18693e3 100644 +index a6d438a..97537a7 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h -@@ -3035,6 +3035,8 @@ void wined3d_cs_emit_update_sub_resource(struct wined3d_cs *cs, struct wined3d_r +@@ -3095,6 +3095,8 @@ void wined3d_cs_emit_update_sub_resource(struct wined3d_cs *cs, struct wined3d_r unsigned int depth_pitch) DECLSPEC_HIDDEN; void wined3d_cs_emit_buffer_swap_mem(struct wined3d_cs *cs, struct wined3d_buffer *buffer, BYTE *mem) DECLSPEC_HIDDEN; @@ -127,7 +127,7 @@ index c7b7e8f..18693e3 100644 /* Direct3D terminology with little modifications. We do not have an issued state * because only the driver knows about it, but we have a created state because d3d -@@ -3124,6 +3126,7 @@ HRESULT wined3d_buffer_copy(struct wined3d_buffer *dst_buffer, unsigned int dst_ +@@ -3182,6 +3184,7 @@ HRESULT wined3d_buffer_copy(struct wined3d_buffer *dst_buffer, unsigned int dst_ struct wined3d_buffer *src_buffer, unsigned int src_offset, unsigned int size) DECLSPEC_HIDDEN; HRESULT wined3d_buffer_upload_data(struct wined3d_buffer *buffer, const struct wined3d_box *box, const void *data) DECLSPEC_HIDDEN; diff --git a/patches/wined3d-CSMT_Main/0085-wined3d-Send-buffer-preloads-through-the-CS.patch b/patches/wined3d-CSMT_Main/0085-wined3d-Send-buffer-preloads-through-the-CS.patch index ab7c7af9..2a7535fe 100644 --- a/patches/wined3d-CSMT_Main/0085-wined3d-Send-buffer-preloads-through-the-CS.patch +++ b/patches/wined3d-CSMT_Main/0085-wined3d-Send-buffer-preloads-through-the-CS.patch @@ -1,4 +1,4 @@ -From 2230e8a2635b98e710facae0c430711ad70f3a0c Mon Sep 17 00:00:00 2001 +From bddfb1096b5a073ab49a5daedecf8e7fb31d5804 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20D=C3=B6singer?= Date: Sun, 7 Jul 2013 12:02:59 +0200 Subject: wined3d: Send buffer preloads through the CS @@ -13,10 +13,10 @@ the dirty area list, have to be considered. 3 files changed, 33 insertions(+), 11 deletions(-) diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c -index 3fb0d7c..4a73dcb 100644 +index e652695..92f3833 100644 --- a/dlls/wined3d/buffer.c +++ b/dlls/wined3d/buffer.c -@@ -934,7 +934,6 @@ void buffer_internal_preload(struct wined3d_buffer *buffer, struct wined3d_conte +@@ -925,7 +925,6 @@ void buffer_internal_preload(struct wined3d_buffer *buffer, struct wined3d_conte void CDECL wined3d_buffer_preload(struct wined3d_buffer *buffer) { @@ -24,7 +24,7 @@ index 3fb0d7c..4a73dcb 100644 struct wined3d_device *device = buffer->resource.device; if (buffer->resource.map_count) -@@ -943,16 +942,7 @@ void CDECL wined3d_buffer_preload(struct wined3d_buffer *buffer) +@@ -934,16 +933,7 @@ void CDECL wined3d_buffer_preload(struct wined3d_buffer *buffer) return; } @@ -43,18 +43,18 @@ index 3fb0d7c..4a73dcb 100644 struct wined3d_resource * CDECL wined3d_buffer_get_resource(struct wined3d_buffer *buffer) diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c -index b530ab2..91e4a84 100644 +index 2fa9077..6b409d8 100644 --- a/dlls/wined3d/cs.c +++ b/dlls/wined3d/cs.c -@@ -71,6 +71,7 @@ enum wined3d_cs_op +@@ -72,6 +72,7 @@ enum wined3d_cs_op WINED3D_CS_OP_TEXTURE_UNMAP, WINED3D_CS_OP_BUFFER_SWAP_MEM, WINED3D_CS_OP_BUFFER_INVALIDATE_RANGE, + WINED3D_CS_OP_BUFFER_PRELOAD, WINED3D_CS_OP_QUERY_ISSUE, - WINED3D_CS_OP_QUERY_DESTROY, WINED3D_CS_OP_TEXTURE_PRELOAD, -@@ -447,6 +448,12 @@ struct wined3d_cs_update_sub_resource + WINED3D_CS_OP_UPDATE_TEXTURE, +@@ -453,6 +454,12 @@ struct wined3d_cs_update_sub_resource const void *data; }; @@ -67,7 +67,7 @@ index b530ab2..91e4a84 100644 static void wined3d_cs_mt_submit(struct wined3d_cs *cs, size_t size) { LONG new_val = (cs->queue.head + size) & (WINED3D_CS_QUEUE_SIZE - 1); -@@ -2299,6 +2306,29 @@ void wined3d_cs_emit_buffer_invalidate_bo_range(struct wined3d_cs *cs, +@@ -2308,6 +2315,29 @@ void wined3d_cs_emit_buffer_invalidate_bo_range(struct wined3d_cs *cs, cs->ops->submit(cs, sizeof(*op)); } @@ -97,19 +97,19 @@ index b530ab2..91e4a84 100644 static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void *data) = { /* WINED3D_CS_OP_NOP */ wined3d_cs_exec_nop, -@@ -2348,6 +2378,7 @@ static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void +@@ -2358,6 +2388,7 @@ static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void /* WINED3D_CS_OP_TEXTURE_UNMAP */ wined3d_cs_exec_texture_unmap, /* WINED3D_CS_OP_BUFFER_SWAP_MEM */ wined3d_cs_exec_buffer_swap_mem, /* WINED3D_CS_OP_BUFFER_INVALIDATE_RANGE */ wined3d_cs_exec_buffer_invalidate_bo_range, + /* WINED3D_CS_OP_BUFFER_PRELOAD */ wined3d_cs_exec_buffer_preload, /* WINED3D_CS_OP_QUERY_ISSUE */ wined3d_cs_exec_query_issue, - /* WINED3D_CS_OP_QUERY_DESTROY */ wined3d_cs_exec_query_destroy, /* WINED3D_CS_OP_TEXTURE_PRELOAD */ wined3d_cs_exec_texture_preload, + /* WINED3D_CS_OP_UPDATE_TEXTURE */ wined3d_cs_exec_update_texture, diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h -index 18693e3..dcaab57 100644 +index 97537a7..0a9b962 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h -@@ -3037,6 +3037,7 @@ void wined3d_cs_emit_buffer_swap_mem(struct wined3d_cs *cs, struct wined3d_buffe +@@ -3097,6 +3097,7 @@ void wined3d_cs_emit_buffer_swap_mem(struct wined3d_cs *cs, struct wined3d_buffe BYTE *mem) DECLSPEC_HIDDEN; void wined3d_cs_emit_buffer_invalidate_bo_range(struct wined3d_cs *cs, struct wined3d_buffer *buffer, unsigned int offset, unsigned int size) DECLSPEC_HIDDEN; diff --git a/patches/wined3d-CSMT_Main/9999-IfDefined.patch b/patches/wined3d-CSMT_Main/9999-IfDefined.patch index 8188125b..7e8ddc41 100644 --- a/patches/wined3d-CSMT_Main/9999-IfDefined.patch +++ b/patches/wined3d-CSMT_Main/9999-IfDefined.patch @@ -100,7 +100,7 @@ diff --git a/dlls/wined3d/arb_program_shader.c b/dlls/wined3d/arb_program_shader shader_arb_ps_local_constants(compiled, context, state, rt_height); } -@@ -8015,11 +8027,16 @@ +@@ -8017,11 +8029,16 @@ /* Leave the opengl state valid for blitting */ arbfp_blit_unset(context->gl_info); @@ -745,7 +745,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c WINED3D_CS_OP_SET_VS_CONSTS_F, WINED3D_CS_OP_SET_VS_CONSTS_B, WINED3D_CS_OP_SET_VS_CONSTS_I, -@@ -100,6 +108,7 @@ +@@ -99,6 +107,7 @@ { enum wined3d_cs_op opcode; BOOL *signalled; @@ -753,7 +753,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c }; struct wined3d_cs_present -@@ -307,6 +316,7 @@ +@@ -306,6 +315,7 @@ void *object; }; @@ -761,7 +761,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c struct wined3d_cs_set_consts_f { enum wined3d_cs_op opcode; -@@ -619,6 +629,23 @@ +@@ -612,6 +622,23 @@ struct wined3d_cs_present *op; LONG pending; unsigned int i; @@ -785,7 +785,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c op = cs->ops->require_space(cs, sizeof(*op)); op->opcode = WINED3D_CS_OP_PRESENT; -@@ -628,6 +655,7 @@ +@@ -621,6 +648,7 @@ op->dst_rect = *dst_rect; op->flags = flags; @@ -793,7 +793,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c wined3d_resource_inc_fence(&swapchain->front_buffer->resource); for (i = 0; i < swapchain->desc.backbuffer_count; i++) wined3d_resource_inc_fence(&swapchain->back_buffers[i]->resource); -@@ -685,6 +713,30 @@ +@@ -678,6 +706,30 @@ unsigned int i; op = cs->ops->require_space(cs, size); @@ -824,7 +824,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c op->opcode = WINED3D_CS_OP_CLEAR; op->flags = flags; op->color = *color; -@@ -693,6 +745,7 @@ +@@ -686,6 +738,7 @@ op->rect_count = rect_count; memcpy(op->rects, rects, sizeof(*rects) * rect_count); @@ -832,7 +832,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c if (flags & WINED3DCLEAR_TARGET) { for (i = 0; i < cs->device->adapter->gl_info.limits.buffers; i++) -@@ -751,6 +804,15 @@ +@@ -744,6 +797,15 @@ cs->state.load_base_vertex_index = 0; device_invalidate_state(cs->device, STATE_BASEVERTEXINDEX); } @@ -848,7 +848,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c if (!cs->device->adapter->gl_info.supported[ARB_DRAW_ELEMENTS_BASE_VERTEX] && state->load_base_vertex_index != op->base_vertex_idx) -@@ -761,6 +823,7 @@ +@@ -754,6 +816,7 @@ draw_primitive(cs->device, state, op->base_vertex_idx, op->start_idx, op->index_count, op->start_instance, op->instance_count, op->indexed); @@ -856,7 +856,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c if (op->indexed) wined3d_resource_dec_fence(&cs->state.index_buffer->resource); -@@ -791,6 +854,14 @@ +@@ -784,6 +847,14 @@ struct wined3d_cs_draw *op; unsigned int i; const struct wined3d_state *state = &cs->device->state; @@ -871,7 +871,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c op = cs->ops->require_space(cs, sizeof(*op)); op->opcode = WINED3D_CS_OP_DRAW; -@@ -801,6 +872,7 @@ +@@ -794,6 +865,7 @@ op->instance_count = instance_count; op->indexed = indexed; @@ -879,7 +879,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c if (indexed) { wined3d_resource_inc_fence(&state->index_buffer->resource); -@@ -838,6 +910,17 @@ +@@ -831,6 +903,17 @@ cs->state.predicate_value = op->value; return sizeof(*op); @@ -897,7 +897,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c } void wined3d_cs_emit_set_predication(struct wined3d_cs *cs, struct wined3d_query *predicate, BOOL value) -@@ -849,6 +932,7 @@ +@@ -842,6 +925,7 @@ op->predicate = predicate; op->value = value; @@ -905,7 +905,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c cs->ops->submit(cs, sizeof(*op)); } -@@ -860,6 +944,17 @@ +@@ -853,6 +937,17 @@ device_invalidate_state(cs->device, STATE_VIEWPORT); return sizeof(*op); @@ -923,7 +923,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c } void wined3d_cs_emit_set_viewport(struct wined3d_cs *cs, const struct wined3d_viewport *viewport) -@@ -870,6 +965,7 @@ +@@ -863,6 +958,7 @@ op->opcode = WINED3D_CS_OP_SET_VIEWPORT; op->viewport = *viewport; @@ -931,7 +931,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c cs->ops->submit(cs, sizeof(*op)); } -@@ -881,6 +977,17 @@ +@@ -874,6 +970,17 @@ device_invalidate_state(cs->device, STATE_SCISSORRECT); return sizeof(*op); @@ -949,7 +949,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c } void wined3d_cs_emit_set_scissor_rect(struct wined3d_cs *cs, const RECT *rect) -@@ -891,6 +998,7 @@ +@@ -884,6 +991,7 @@ op->opcode = WINED3D_CS_OP_SET_SCISSOR_RECT; op->rect = *rect; @@ -957,7 +957,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c cs->ops->submit(cs, sizeof(*op)); } -@@ -902,6 +1010,17 @@ +@@ -895,6 +1003,17 @@ device_invalidate_state(cs->device, STATE_FRAMEBUFFER); return sizeof(*op); @@ -975,7 +975,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c } void wined3d_cs_emit_set_rendertarget_view(struct wined3d_cs *cs, unsigned int view_idx, -@@ -914,6 +1033,7 @@ +@@ -907,6 +1026,7 @@ op->view_idx = view_idx; op->view = view; @@ -983,7 +983,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c cs->ops->submit(cs, sizeof(*op)); } -@@ -924,6 +1044,18 @@ +@@ -917,6 +1037,18 @@ struct wined3d_rendertarget_view *prev; if ((prev = cs->state.fb.depth_stencil)) @@ -1002,7 +1002,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c { struct wined3d_surface *prev_surface = wined3d_rendertarget_view_get_surface(prev); -@@ -931,6 +1063,7 @@ +@@ -924,6 +1056,7 @@ || prev_surface->container->flags & WINED3D_TEXTURE_DISCARD)) { surface_modify_ds_location(prev_surface, WINED3D_LOCATION_DISCARDED, prev->width, prev->height); @@ -1010,7 +1010,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c if (prev_surface == cs->onscreen_depth_stencil) { wined3d_texture_decref(cs->onscreen_depth_stencil->container); -@@ -940,6 +1073,17 @@ +@@ -933,6 +1066,17 @@ } cs->state.fb.depth_stencil = op->view; @@ -1028,7 +1028,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c if (!prev != !op->view) { -@@ -956,8 +1100,10 @@ +@@ -949,8 +1093,10 @@ } device_invalidate_state(device, STATE_FRAMEBUFFER); @@ -1039,7 +1039,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c } void wined3d_cs_emit_set_depth_stencil_view(struct wined3d_cs *cs, struct wined3d_rendertarget_view *view) -@@ -968,6 +1114,7 @@ +@@ -961,6 +1107,7 @@ op->opcode = WINED3D_CS_OP_SET_DEPTH_STENCIL_VIEW; op->view = view; @@ -1047,7 +1047,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c cs->ops->submit(cs, sizeof(*op)); } -@@ -979,6 +1126,17 @@ +@@ -972,6 +1119,17 @@ device_invalidate_state(cs->device, STATE_VDECL); return sizeof(*op); @@ -1065,7 +1065,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c } void wined3d_cs_emit_set_vertex_declaration(struct wined3d_cs *cs, struct wined3d_vertex_declaration *declaration) -@@ -989,10 +1147,17 @@ +@@ -982,10 +1140,17 @@ op->opcode = WINED3D_CS_OP_SET_VERTEX_DECLARATION; op->declaration = declaration; @@ -1083,7 +1083,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c { const struct wined3d_cs_set_stream_source *op = data; struct wined3d_stream_state *stream; -@@ -1010,8 +1175,10 @@ +@@ -1003,8 +1168,10 @@ InterlockedDecrement(&prev->resource.bind_count); device_invalidate_state(cs->device, STATE_STREAMSRC); @@ -1094,7 +1094,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c } void wined3d_cs_emit_set_stream_source(struct wined3d_cs *cs, UINT stream_idx, -@@ -1026,10 +1193,17 @@ +@@ -1019,10 +1186,17 @@ op->offset = offset; op->stride = stride; @@ -1112,7 +1112,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c { const struct wined3d_cs_set_stream_source_freq *op = data; struct wined3d_stream_state *stream; -@@ -1039,8 +1213,10 @@ +@@ -1032,8 +1206,10 @@ stream->flags = op->flags; device_invalidate_state(cs->device, STATE_STREAMSRC); @@ -1123,7 +1123,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c } void wined3d_cs_emit_set_stream_source_freq(struct wined3d_cs *cs, UINT stream_idx, UINT frequency, UINT flags) -@@ -1053,10 +1229,17 @@ +@@ -1046,10 +1222,17 @@ op->frequency = frequency; op->flags = flags; @@ -1141,7 +1141,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c { const struct wined3d_cs_set_stream_output *op = data; struct wined3d_stream_output *stream; -@@ -1071,8 +1254,10 @@ +@@ -1064,8 +1247,10 @@ InterlockedIncrement(&op->buffer->resource.bind_count); if (prev) InterlockedDecrement(&prev->resource.bind_count); @@ -1152,7 +1152,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c } void wined3d_cs_emit_set_stream_output(struct wined3d_cs *cs, UINT stream_idx, -@@ -1086,10 +1271,17 @@ +@@ -1079,10 +1264,17 @@ op->buffer = buffer; op->offset = offset; @@ -1170,7 +1170,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c { const struct wined3d_cs_set_index_buffer *op = data; struct wined3d_buffer *prev; -@@ -1105,8 +1297,10 @@ +@@ -1098,8 +1290,10 @@ InterlockedDecrement(&prev->resource.bind_count); device_invalidate_state(cs->device, STATE_INDEXBUFFER); @@ -1181,7 +1181,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c } void wined3d_cs_emit_set_index_buffer(struct wined3d_cs *cs, struct wined3d_buffer *buffer, -@@ -1120,10 +1314,17 @@ +@@ -1113,10 +1307,17 @@ op->format_id = format_id; op->offset = offset; @@ -1199,7 +1199,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c { const struct wined3d_cs_set_constant_buffer *op = data; struct wined3d_buffer *prev; -@@ -1137,7 +1338,9 @@ +@@ -1130,7 +1331,9 @@ InterlockedDecrement(&prev->resource.bind_count); device_invalidate_state(cs->device, STATE_CONSTANT_BUFFER(op->type)); @@ -1209,7 +1209,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c } void wined3d_cs_emit_set_constant_buffer(struct wined3d_cs *cs, enum wined3d_shader_type type, -@@ -1151,10 +1354,17 @@ +@@ -1144,10 +1347,17 @@ op->cb_idx = cb_idx; op->buffer = buffer; @@ -1227,7 +1227,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c { const struct wined3d_gl_info *gl_info = &cs->device->adapter->gl_info; const struct wined3d_d3d_info *d3d_info = &cs->device->adapter->d3d_info; -@@ -1231,8 +1441,10 @@ +@@ -1224,8 +1434,10 @@ if (new_use_color_key) device_invalidate_state(cs->device, STATE_COLOR_KEY); @@ -1238,7 +1238,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c } void wined3d_cs_emit_set_texture(struct wined3d_cs *cs, UINT stage, struct wined3d_texture *texture) -@@ -1243,6 +1455,7 @@ +@@ -1236,6 +1448,7 @@ op->opcode = WINED3D_CS_OP_SET_TEXTURE; op->stage = stage; op->texture = texture; @@ -1246,7 +1246,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c cs->ops->submit(cs, sizeof(*op)); } -@@ -1254,6 +1467,18 @@ +@@ -1247,6 +1460,18 @@ device_invalidate_state(cs->device, STATE_SHADER_RESOURCE_BINDING); return sizeof(*op); @@ -1265,7 +1265,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c } void wined3d_cs_emit_set_shader_resource_view(struct wined3d_cs *cs, enum wined3d_shader_type type, -@@ -1267,6 +1492,7 @@ +@@ -1260,6 +1485,7 @@ op->view_idx = view_idx; op->view = view; @@ -1273,7 +1273,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c cs->ops->submit(cs, sizeof(*op)); } -@@ -1278,6 +1504,17 @@ +@@ -1271,6 +1497,17 @@ device_invalidate_state(cs->device, STATE_SHADER_RESOURCE_BINDING); return sizeof(*op); @@ -1291,7 +1291,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c } void wined3d_cs_emit_set_sampler(struct wined3d_cs *cs, enum wined3d_shader_type type, -@@ -1291,6 +1528,7 @@ +@@ -1284,6 +1521,7 @@ op->sampler_idx = sampler_idx; op->sampler = sampler; @@ -1299,7 +1299,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c cs->ops->submit(cs, sizeof(*op)); } -@@ -1303,6 +1541,18 @@ +@@ -1296,6 +1534,18 @@ device_invalidate_state(cs->device, STATE_SHADER_RESOURCE_BINDING); return sizeof(*op); @@ -1318,7 +1318,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c } void wined3d_cs_emit_set_shader(struct wined3d_cs *cs, enum wined3d_shader_type type, struct wined3d_shader *shader) -@@ -1314,6 +1564,7 @@ +@@ -1307,6 +1557,7 @@ op->type = type; op->shader = shader; @@ -1326,7 +1326,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c cs->ops->submit(cs, sizeof(*op)); } -@@ -1385,6 +1636,17 @@ +@@ -1378,6 +1629,17 @@ device_invalidate_state(cs->device, STATE_RENDER(op->state)); return sizeof(*op); @@ -1344,7 +1344,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c } void wined3d_cs_emit_set_render_state(struct wined3d_cs *cs, enum wined3d_render_state state, DWORD value) -@@ -1396,6 +1658,7 @@ +@@ -1389,6 +1651,7 @@ op->state = state; op->value = value; @@ -1352,7 +1352,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c cs->ops->submit(cs, sizeof(*op)); } -@@ -1523,6 +1786,17 @@ +@@ -1516,6 +1779,17 @@ device_invalidate_state(cs->device, STATE_TEXTURESTAGE(op->stage, op->state)); return sizeof(*op); @@ -1370,7 +1370,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c } void wined3d_cs_emit_set_texture_state(struct wined3d_cs *cs, UINT stage, -@@ -1536,6 +1810,7 @@ +@@ -1529,6 +1803,7 @@ op->state = state; op->value = value; @@ -1378,7 +1378,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c cs->ops->submit(cs, sizeof(*op)); } -@@ -1547,6 +1822,17 @@ +@@ -1540,6 +1815,17 @@ device_invalidate_state(cs->device, STATE_SAMPLER(op->sampler_idx)); return sizeof(*op); @@ -1396,7 +1396,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c } void wined3d_cs_emit_set_sampler_state(struct wined3d_cs *cs, UINT sampler_idx, -@@ -1560,6 +1846,7 @@ +@@ -1553,6 +1839,7 @@ op->state = state; op->value = value; @@ -1404,7 +1404,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c cs->ops->submit(cs, sizeof(*op)); } -@@ -1572,6 +1859,18 @@ +@@ -1565,6 +1852,18 @@ device_invalidate_state(cs->device, STATE_TRANSFORM(op->state)); return sizeof(*op); @@ -1423,7 +1423,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c } void wined3d_cs_emit_set_transform(struct wined3d_cs *cs, enum wined3d_transform_state state, -@@ -1584,6 +1883,7 @@ +@@ -1577,6 +1876,7 @@ op->state = state; op->matrix = *matrix; @@ -1431,7 +1431,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c cs->ops->submit(cs, sizeof(*op)); } -@@ -1595,6 +1895,17 @@ +@@ -1588,6 +1888,17 @@ device_invalidate_state(cs->device, STATE_CLIPPLANE(op->plane_idx)); return sizeof(*op); @@ -1449,7 +1449,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c } void wined3d_cs_emit_set_clip_plane(struct wined3d_cs *cs, UINT plane_idx, const struct wined3d_vec4 *plane) -@@ -1606,10 +1917,17 @@ +@@ -1599,10 +1910,17 @@ op->plane_idx = plane_idx; op->plane = *plane; @@ -1467,7 +1467,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c { const struct wined3d_cs_set_color_key *op = data; struct wined3d_texture *texture = op->texture; -@@ -1670,8 +1988,10 @@ +@@ -1663,8 +1981,10 @@ break; } } @@ -1478,7 +1478,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c } void wined3d_cs_emit_set_color_key(struct wined3d_cs *cs, struct wined3d_texture *texture, -@@ -1691,6 +2011,7 @@ +@@ -1684,6 +2004,7 @@ else op->set = 0; @@ -1486,7 +1486,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c cs->ops->submit(cs, sizeof(*op)); } -@@ -1702,6 +2023,17 @@ +@@ -1695,6 +2016,17 @@ device_invalidate_state(cs->device, STATE_MATERIAL); return sizeof(*op); @@ -1504,7 +1504,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c } void wined3d_cs_emit_set_material(struct wined3d_cs *cs, const struct wined3d_material *material) -@@ -1712,6 +2044,7 @@ +@@ -1705,6 +2037,7 @@ op->opcode = WINED3D_CS_OP_SET_MATERIAL; op->material = *material; @@ -1512,7 +1512,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c cs->ops->submit(cs, sizeof(*op)); } -@@ -1727,6 +2060,19 @@ +@@ -1720,6 +2053,19 @@ ERR("Failed to initialize CS state, hr %#x.\n", hr); return sizeof(struct wined3d_cs_reset_state); @@ -1532,7 +1532,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c } void wined3d_cs_emit_reset_state(struct wined3d_cs *cs) -@@ -1736,6 +2082,7 @@ +@@ -1729,6 +2075,7 @@ op = cs->ops->require_space(cs, sizeof(*op)); op->opcode = WINED3D_CS_OP_RESET_STATE; @@ -1540,7 +1540,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c cs->ops->submit(cs, sizeof(*op)); } -@@ -1746,6 +2093,16 @@ +@@ -1739,6 +2086,16 @@ op->callback(op->object); return sizeof(*op); @@ -1557,7 +1557,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c } void wined3d_cs_emit_destroy_object(struct wined3d_cs *cs, void (*callback)(void *object), void *object) -@@ -1757,6 +2114,7 @@ +@@ -1750,6 +2107,7 @@ op->callback = callback; op->object = object; @@ -1565,7 +1565,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c cs->ops->submit(cs, sizeof(*op)); } -@@ -3058,5 +3416,152 @@ +@@ -3027,5 +3385,152 @@ ERR("Closing event failed.\n"); } @@ -3215,62 +3215,19 @@ diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c diff --git a/dlls/wined3d/query.c b/dlls/wined3d/query.c --- a/dlls/wined3d/query.c +++ b/dlls/wined3d/query.c -@@ -233,6 +233,7 @@ - return refcount; - } +@@ -237,9 +237,11 @@ + { + struct wined3d_query *query = object; +#if defined(STAGING_CSMT) - void wined3d_query_destroy(struct wined3d_query *query) - { + if (!list_empty(&query->poll_list_entry)) + list_remove(&query->poll_list_entry); + ++#endif /* STAGING_CSMT */ /* Queries are specific to the GL context that created them. Not -@@ -263,6 +264,7 @@ - HeapFree(GetProcessHeap(), 0, query); - } - -+#endif /* STAGING_CSMT */ - ULONG CDECL wined3d_query_decref(struct wined3d_query *query) - { - ULONG refcount = InterlockedDecrement(&query->ref); -@@ -270,7 +272,38 @@ - TRACE("%p decreasing refcount to %u.\n", query, refcount); - - if (!refcount) -+#if defined(STAGING_CSMT) - wined3d_cs_emit_query_destroy(query->device->cs, query); -+#else /* STAGING_CSMT */ -+ { -+ /* Queries are specific to the GL context that created them. Not -+ * deleting the query will obviously leak it, but that's still better -+ * than potentially deleting a different query with the same id in this -+ * context, and (still) leaking the actual query. */ -+ if (query->type == WINED3D_QUERY_TYPE_EVENT) -+ { -+ struct wined3d_event_query *event_query = query->extendedData; -+ if (event_query) wined3d_event_query_destroy(event_query); -+ } -+ else if (query->type == WINED3D_QUERY_TYPE_OCCLUSION) -+ { -+ struct wined3d_occlusion_query *oq = query->extendedData; -+ -+ if (oq->context) context_free_occlusion_query(oq); -+ HeapFree(GetProcessHeap(), 0, query->extendedData); -+ } -+ else if (query->type == WINED3D_QUERY_TYPE_TIMESTAMP) -+ { -+ struct wined3d_timestamp_query *tq = query->extendedData; -+ -+ if (tq->context) -+ context_free_timestamp_query(tq); -+ HeapFree(GetProcessHeap(), 0, query->extendedData); -+ } -+ -+ HeapFree(GetProcessHeap(), 0, query); -+ } -+#endif /* STAGING_CSMT */ - - return refcount; - } -@@ -295,6 +328,7 @@ + * deleting the query will obviously leak it, but that's still better + * than potentially deleting a different query with the same id in this +@@ -300,6 +302,7 @@ { TRACE("query %p, flags %#x.\n", query, flags); @@ -3278,7 +3235,7 @@ diff --git a/dlls/wined3d/query.c b/dlls/wined3d/query.c if (flags & WINED3DISSUE_END) query->counter_main++; -@@ -306,6 +340,9 @@ +@@ -311,6 +314,9 @@ query->state = QUERY_SIGNALLED; return WINED3D_OK; @@ -3288,7 +3245,7 @@ diff --git a/dlls/wined3d/query.c b/dlls/wined3d/query.c } static void fill_query_data(void *out, unsigned int out_size, const void *result, unsigned int result_size) -@@ -316,10 +353,25 @@ +@@ -321,10 +327,25 @@ static HRESULT wined3d_occlusion_query_ops_get_data(struct wined3d_query *query, void *data, DWORD size, DWORD flags) { @@ -3314,7 +3271,7 @@ diff --git a/dlls/wined3d/query.c b/dlls/wined3d/query.c if (query->state == QUERY_CREATED) { -@@ -330,8 +382,10 @@ +@@ -335,8 +356,10 @@ return S_OK; } @@ -3325,7 +3282,7 @@ diff --git a/dlls/wined3d/query.c b/dlls/wined3d/query.c if (query->state == QUERY_BUILDING) { /* Msdn says this returns an error, but our tests show that S_FALSE is returned */ -@@ -347,6 +401,7 @@ +@@ -352,6 +375,7 @@ return S_OK; } @@ -3333,7 +3290,7 @@ diff --git a/dlls/wined3d/query.c b/dlls/wined3d/query.c if (!wined3d_settings.cs_multithreaded) { if (!query->query_ops->query_poll(query)) -@@ -378,6 +433,14 @@ +@@ -383,6 +407,14 @@ FIXME("%p Wrong thread, returning 1.\n", query); oq->samples = 1; return TRUE; @@ -3348,7 +3305,7 @@ diff --git a/dlls/wined3d/query.c b/dlls/wined3d/query.c } context = context_acquire(device, context_get_rt_surface(oq->context)); -@@ -388,6 +451,7 @@ +@@ -393,6 +425,7 @@ if (available) { @@ -3356,7 +3313,7 @@ diff --git a/dlls/wined3d/query.c b/dlls/wined3d/query.c GL_EXTCALL(glGetQueryObjectuiv(oq->id, GL_QUERY_RESULT, &samples)); checkGLcall("glGetQueryObjectuiv(GL_QUERY_RESULT)"); TRACE("Returning %d samples.\n", samples); -@@ -459,6 +523,69 @@ +@@ -464,6 +497,69 @@ if (data) fill_query_data(data, dwSize, &ret, sizeof(ret)); @@ -3426,7 +3383,7 @@ diff --git a/dlls/wined3d/query.c b/dlls/wined3d/query.c return S_OK; } -@@ -477,7 +604,11 @@ +@@ -482,7 +578,11 @@ return query->type; } @@ -3438,7 +3395,7 @@ diff --git a/dlls/wined3d/query.c b/dlls/wined3d/query.c { TRACE("query %p, flags %#x.\n", query, flags); -@@ -487,6 +618,7 @@ +@@ -492,6 +592,7 @@ struct wined3d_event_query *event_query = query->extendedData; /* Faked event query support */ @@ -3446,7 +3403,7 @@ diff --git a/dlls/wined3d/query.c b/dlls/wined3d/query.c if (!event_query) return FALSE; wined3d_event_query_issue(event_query, query->device); -@@ -505,6 +637,30 @@ +@@ -510,6 +611,30 @@ struct wined3d_device *device = query->device; const struct wined3d_gl_info *gl_info = &device->adapter->gl_info; BOOL poll = FALSE; @@ -3477,7 +3434,7 @@ diff --git a/dlls/wined3d/query.c b/dlls/wined3d/query.c TRACE("query %p, flags %#x.\n", query, flags); -@@ -516,7 +672,11 @@ +@@ -521,7 +646,11 @@ /* This is allowed according to msdn and our tests. Reset the query and restart */ if (flags & WINED3DISSUE_BEGIN) { @@ -3489,7 +3446,7 @@ diff --git a/dlls/wined3d/query.c b/dlls/wined3d/query.c { if (oq->context->tid != GetCurrentThreadId()) { -@@ -545,7 +705,9 @@ +@@ -550,7 +679,9 @@ checkGLcall("glBeginQuery()"); context_release(context); @@ -3499,7 +3456,7 @@ diff --git a/dlls/wined3d/query.c b/dlls/wined3d/query.c } if (flags & WINED3DISSUE_END) { -@@ -553,7 +715,11 @@ +@@ -558,7 +689,11 @@ * our tests show that it returns OK. But OpenGL doesn't like it, so avoid * generating an error */ @@ -3511,7 +3468,7 @@ diff --git a/dlls/wined3d/query.c b/dlls/wined3d/query.c { if (oq->context->tid != GetCurrentThreadId()) { -@@ -567,10 +733,15 @@ +@@ -572,10 +707,15 @@ checkGLcall("glEndQuery()"); context_release(context); @@ -3527,7 +3484,7 @@ diff --git a/dlls/wined3d/query.c b/dlls/wined3d/query.c } } else -@@ -578,6 +749,7 @@ +@@ -583,6 +723,7 @@ FIXME("%p Occlusion queries not supported.\n", query); } @@ -3535,7 +3492,7 @@ diff --git a/dlls/wined3d/query.c b/dlls/wined3d/query.c return poll; } -@@ -636,6 +808,47 @@ +@@ -641,6 +782,47 @@ FIXME("%p Wrong thread, returning 1.\n", query); tq->timestamp = 1; return TRUE; @@ -3583,7 +3540,7 @@ diff --git a/dlls/wined3d/query.c b/dlls/wined3d/query.c } context = context_acquire(device, context_get_rt_surface(tq->context)); -@@ -646,6 +859,7 @@ +@@ -651,6 +833,7 @@ if (available) { @@ -3591,7 +3548,7 @@ diff --git a/dlls/wined3d/query.c b/dlls/wined3d/query.c GL_EXTCALL(glGetQueryObjectui64v(tq->id, GL_QUERY_RESULT, ×tamp)); checkGLcall("glGetQueryObjectui64v(GL_QUERY_RESULT)"); TRACE("Returning timestamp %s.\n", wine_dbgstr_longlong(timestamp)); -@@ -663,6 +877,28 @@ +@@ -668,6 +851,28 @@ } static BOOL wined3d_timestamp_query_ops_issue(struct wined3d_query *query, DWORD flags) @@ -3620,7 +3577,7 @@ diff --git a/dlls/wined3d/query.c b/dlls/wined3d/query.c { struct wined3d_device *device = query->device; const struct wined3d_gl_info *gl_info = &device->adapter->gl_info; -@@ -695,6 +931,7 @@ +@@ -700,6 +905,7 @@ } if (flags & WINED3DISSUE_END) @@ -3628,7 +3585,7 @@ diff --git a/dlls/wined3d/query.c b/dlls/wined3d/query.c return TRUE; return FALSE; } -@@ -703,6 +940,18 @@ +@@ -708,6 +914,18 @@ void *data, DWORD size, DWORD flags) { TRACE("query %p, data %p, size %#x, flags %#x.\n", query, data, size, flags); @@ -3647,7 +3604,7 @@ diff --git a/dlls/wined3d/query.c b/dlls/wined3d/query.c if (query->type == WINED3D_QUERY_TYPE_TIMESTAMP_DISJOINT) { static const struct wined3d_query_data_timestamp_disjoint disjoint_data = {1000 * 1000 * 1000, FALSE}; -@@ -724,6 +973,7 @@ +@@ -729,6 +947,7 @@ return S_OK; } @@ -3655,7 +3612,7 @@ diff --git a/dlls/wined3d/query.c b/dlls/wined3d/query.c static BOOL wined3d_timestamp_disjoint_query_ops_poll(struct wined3d_query *query) { return TRUE; -@@ -733,6 +983,18 @@ +@@ -738,6 +957,18 @@ { TRACE("query %p, flags %#x.\n", query, flags); return FALSE; @@ -3674,7 +3631,7 @@ diff --git a/dlls/wined3d/query.c b/dlls/wined3d/query.c } static HRESULT wined3d_statistics_query_ops_get_data(struct wined3d_query *query, -@@ -747,6 +1009,7 @@ +@@ -752,6 +983,7 @@ return S_OK; } @@ -3682,7 +3639,7 @@ diff --git a/dlls/wined3d/query.c b/dlls/wined3d/query.c static BOOL wined3d_statistics_query_ops_poll(struct wined3d_query *query) { return TRUE; -@@ -756,6 +1019,12 @@ +@@ -761,6 +993,12 @@ { FIXME("query %p, flags %#x.\n", query, flags); return FALSE; @@ -3695,7 +3652,7 @@ diff --git a/dlls/wined3d/query.c b/dlls/wined3d/query.c } static HRESULT wined3d_overflow_query_ops_get_data(struct wined3d_query *query, -@@ -770,6 +1039,7 @@ +@@ -775,6 +1013,7 @@ return S_OK; } @@ -3703,7 +3660,7 @@ diff --git a/dlls/wined3d/query.c b/dlls/wined3d/query.c static BOOL wined3d_overflow_query_ops_poll(struct wined3d_query *query) { return TRUE; -@@ -820,6 +1090,47 @@ +@@ -825,6 +1064,47 @@ { wined3d_overflow_query_ops_get_data, wined3d_overflow_query_ops_poll, @@ -3751,7 +3708,7 @@ diff --git a/dlls/wined3d/query.c b/dlls/wined3d/query.c wined3d_overflow_query_ops_issue }; -@@ -841,6 +1152,7 @@ +@@ -846,6 +1126,7 @@ } query->query_ops = &occlusion_query_ops; query->data_size = sizeof(DWORD); @@ -3759,7 +3716,7 @@ diff --git a/dlls/wined3d/query.c b/dlls/wined3d/query.c query->extendedData = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(struct wined3d_occlusion_query)); if (!query->extendedData) -@@ -848,6 +1160,15 @@ +@@ -853,6 +1134,15 @@ ERR("Failed to allocate occlusion query extended data.\n"); return E_OUTOFMEMORY; } @@ -3775,7 +3732,7 @@ diff --git a/dlls/wined3d/query.c b/dlls/wined3d/query.c break; case WINED3D_QUERY_TYPE_EVENT: -@@ -934,7 +1255,9 @@ +@@ -939,7 +1229,9 @@ query->state = QUERY_CREATED; query->device = device; query->ref = 1; @@ -3934,7 +3891,7 @@ diff --git a/dlls/wined3d/sampler.c b/dlls/wined3d/sampler.c diff --git a/dlls/wined3d/shader.c b/dlls/wined3d/shader.c --- a/dlls/wined3d/shader.c +++ b/dlls/wined3d/shader.c -@@ -2986,7 +2986,11 @@ +@@ -3005,7 +3005,11 @@ UINT i; memset(args, 0, sizeof(*args)); /* FIXME: Make sure all bits are set. */ @@ -6712,7 +6669,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h }; extern struct wined3d_settings wined3d_settings DECLSPEC_HIDDEN; -@@ -1330,8 +1334,10 @@ +@@ -1348,8 +1352,10 @@ struct list entry; GLuint id; struct wined3d_context *context; @@ -6723,7 +6680,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h }; union wined3d_gl_query_object -@@ -1367,6 +1373,7 @@ +@@ -1385,6 +1391,7 @@ struct list entry; GLuint id; struct wined3d_context *context; @@ -6731,7 +6688,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h UINT64 timestamp; }; -@@ -1402,6 +1409,12 @@ +@@ -1420,6 +1427,12 @@ for (i = 0; i < min(dst->rt_size, src->rt_size); i++) dst->render_targets[i] = src->render_targets[i]; } @@ -6744,7 +6701,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h struct wined3d_context { -@@ -1417,7 +1430,9 @@ +@@ -1435,7 +1448,9 @@ DWORD dirtyArray[STATE_HIGHEST + 1]; /* Won't get bigger than that, a state is never marked dirty 2 times */ DWORD numDirtyEntries; DWORD isStateDirty[STATE_HIGHEST / (sizeof(DWORD) * CHAR_BIT) + 1]; /* Bitmap to find out quickly if a state is dirty */ @@ -6754,7 +6711,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h struct wined3d_swapchain *swapchain; struct -@@ -1525,6 +1540,14 @@ +@@ -1543,6 +1558,14 @@ GLuint dummy_arbfp_prog; }; @@ -6769,7 +6726,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h typedef void (*APPLYSTATEFUNC)(struct wined3d_context *ctx, const struct wined3d_state *state, DWORD state_id); struct StateEntry -@@ -1663,7 +1686,11 @@ +@@ -1681,7 +1704,11 @@ void context_alloc_occlusion_query(struct wined3d_context *context, struct wined3d_occlusion_query *query) DECLSPEC_HIDDEN; void context_apply_blit_state(struct wined3d_context *context, const struct wined3d_device *device) DECLSPEC_HIDDEN; @@ -6781,7 +6738,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h UINT rt_count, const struct wined3d_fb_state *fb) DECLSPEC_HIDDEN; BOOL context_apply_draw_state(struct wined3d_context *context, const struct wined3d_device *device, const struct wined3d_state *state) DECLSPEC_HIDDEN; -@@ -2283,7 +2310,11 @@ +@@ -2304,7 +2331,11 @@ struct wined3d_state { DWORD flags; @@ -6793,7 +6750,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h struct wined3d_vertex_declaration *vertex_declaration; struct wined3d_stream_output stream_output[MAX_STREAM_OUT]; -@@ -2329,6 +2360,7 @@ +@@ -2350,6 +2381,7 @@ DWORD render_states[WINEHIGHEST_RENDER_STATE + 1]; }; @@ -6801,7 +6758,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h struct wined3d_gl_bo { GLuint name; -@@ -2337,6 +2369,7 @@ +@@ -2358,6 +2390,7 @@ UINT size; }; @@ -6809,7 +6766,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h #define WINED3D_UNMAPPED_STAGE ~0U /* Multithreaded flag. Removed from the public header to signal that -@@ -2389,11 +2422,23 @@ +@@ -2410,11 +2443,23 @@ struct wined3d_rendertarget_view *back_buffer_view; struct wined3d_swapchain **swapchains; UINT swapchain_count; @@ -6833,7 +6790,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h /* For rendering to a texture using glCopyTexImage */ GLuint depth_blt_texture; -@@ -2441,6 +2486,7 @@ +@@ -2462,6 +2507,7 @@ UINT message, WPARAM wparam, LPARAM lparam, WNDPROC proc) DECLSPEC_HIDDEN; void device_resource_add(struct wined3d_device *device, struct wined3d_resource *resource) DECLSPEC_HIDDEN; void device_resource_released(struct wined3d_device *device, struct wined3d_resource *resource) DECLSPEC_HIDDEN; @@ -6841,7 +6798,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h void device_invalidate_state(const struct wined3d_device *device, DWORD state) DECLSPEC_HIDDEN; void device_invalidate_shader_constants(const struct wined3d_device *device, DWORD mask) DECLSPEC_HIDDEN; void device_exec_update_texture(struct wined3d_context *context, struct wined3d_texture *src_texture, -@@ -2452,6 +2498,11 @@ +@@ -2473,6 +2519,11 @@ void device_create_dummy_textures(struct wined3d_device *device, struct wined3d_context *context) DECLSPEC_HIDDEN; void device_delete_opengl_contexts_cs(struct wined3d_device *device, struct wined3d_swapchain *swapchain) DECLSPEC_HIDDEN; @@ -6853,7 +6810,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h static inline BOOL isStateDirty(const struct wined3d_context *context, DWORD state) { -@@ -2495,9 +2546,14 @@ +@@ -2516,9 +2567,14 @@ UINT depth; UINT size; DWORD priority; @@ -6868,7 +6825,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h void *parent; const struct wined3d_parent_ops *parent_ops; -@@ -2523,7 +2579,9 @@ +@@ -2544,7 +2600,9 @@ const struct wined3d_resource_ops *resource_ops) DECLSPEC_HIDDEN; void resource_unload(struct wined3d_resource *resource) DECLSPEC_HIDDEN; BOOL wined3d_resource_allocate_sysmem(struct wined3d_resource *resource) DECLSPEC_HIDDEN; @@ -6878,7 +6835,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h void wined3d_resource_free_sysmem(struct wined3d_resource *resource) DECLSPEC_HIDDEN; GLbitfield wined3d_resource_gl_map_flags(DWORD d3d_flags) DECLSPEC_HIDDEN; GLenum wined3d_resource_gl_legacy_map_flags(DWORD d3d_flags) DECLSPEC_HIDDEN; -@@ -2531,6 +2589,7 @@ +@@ -2552,6 +2610,7 @@ DWORD wined3d_resource_sanitize_map_flags(const struct wined3d_resource *resource, DWORD flags) DECLSPEC_HIDDEN; void wined3d_resource_update_draw_binding(struct wined3d_resource *resource) DECLSPEC_HIDDEN; @@ -6886,7 +6843,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h static inline void wined3d_resource_inc_fence(struct wined3d_resource *resource) { InterlockedIncrement(&resource->access_fence); -@@ -2546,6 +2605,7 @@ +@@ -2567,6 +2626,7 @@ while(InterlockedCompareExchange(&resource->access_fence, 0, 0)); } @@ -6894,7 +6851,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h /* Tests show that the start address of resources is 32 byte aligned */ #define RESOURCE_ALIGNMENT 16 -@@ -2603,7 +2663,9 @@ +@@ -2624,7 +2684,9 @@ DWORD flags; GLenum target; DWORD update_map_binding; @@ -6904,7 +6861,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h GLuint rb_multisample; GLuint rb_resolved; -@@ -2641,8 +2703,12 @@ +@@ -2662,8 +2724,12 @@ unsigned int map_count; DWORD locations; @@ -6917,7 +6874,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h } sub_resources[1]; }; -@@ -2693,6 +2759,7 @@ +@@ -2714,6 +2780,7 @@ struct wined3d_context *context, BOOL srgb) DECLSPEC_HIDDEN; void wined3d_texture_bind_and_dirtify(struct wined3d_texture *texture, struct wined3d_context *context, BOOL srgb) DECLSPEC_HIDDEN; @@ -6925,7 +6882,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h void wined3d_texture_changed(struct wined3d_texture *texture, unsigned int sub_resource_idx, struct wined3d_gl_bo *swap_buffer, void *swap_heap_memory) DECLSPEC_HIDDEN; -@@ -2702,6 +2769,13 @@ +@@ -2723,6 +2790,13 @@ GLenum wined3d_texture_get_gl_buffer(const struct wined3d_texture *texture) DECLSPEC_HIDDEN; void wined3d_texture_get_memory(struct wined3d_texture *texture, unsigned int sub_resource_idx, struct wined3d_bo_address *data, DWORD locations, BOOL map) DECLSPEC_HIDDEN; @@ -6939,7 +6896,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h struct wined3d_texture_sub_resource *wined3d_texture_get_sub_resource(struct wined3d_texture *texture, unsigned int sub_resource_idx) DECLSPEC_HIDDEN; void wined3d_texture_invalidate_location(struct wined3d_texture *texture, -@@ -2712,6 +2786,7 @@ +@@ -2733,6 +2807,7 @@ const struct wined3d_gl_info *gl_info, GLenum binding, DWORD flags) DECLSPEC_HIDDEN; BOOL wined3d_texture_prepare_location(struct wined3d_texture *texture, unsigned int sub_resource_idx, struct wined3d_context *context, DWORD location) DECLSPEC_HIDDEN; @@ -6947,7 +6904,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h BOOL wined3d_texture_load_location(struct wined3d_texture *texture, unsigned int sub_resource_idx, struct wined3d_context *context, DWORD location); void *wined3d_texture_map_internal(struct wined3d_texture *texture, unsigned int sub_resource_idx, -@@ -2727,6 +2802,15 @@ +@@ -2748,6 +2823,15 @@ const struct wined3d_gl_info *gl_info, GLenum binding) DECLSPEC_HIDDEN; void wined3d_texture_unmap_internal(struct wined3d_texture *texture, unsigned int sub_resource_idx) DECLSPEC_HIDDEN; @@ -6963,7 +6920,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h void wined3d_texture_validate_location(struct wined3d_texture *texture, unsigned int sub_resource_idx, DWORD location) DECLSPEC_HIDDEN; -@@ -2844,7 +2928,11 @@ +@@ -2865,7 +2949,11 @@ unsigned int *width, unsigned int *height) DECLSPEC_HIDDEN; void surface_load_fb_texture(struct wined3d_surface *surface, BOOL srgb, struct wined3d_context *context) DECLSPEC_HIDDEN; @@ -6975,7 +6932,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h struct wined3d_context *context, DWORD location) DECLSPEC_HIDDEN; void surface_modify_ds_location(struct wined3d_surface *surface, DWORD location, UINT w, UINT h) DECLSPEC_HIDDEN; void surface_set_compatible_renderbuffer(struct wined3d_surface *surface, -@@ -2855,9 +2943,11 @@ +@@ -2876,9 +2964,11 @@ void wined3d_surface_upload_data(struct wined3d_surface *surface, const struct wined3d_gl_info *gl_info, const struct wined3d_format *format, const RECT *src_rect, UINT src_pitch, const POINT *dst_point, BOOL srgb, const struct wined3d_const_bo_address *data) DECLSPEC_HIDDEN; @@ -6987,7 +6944,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h void draw_textured_quad(const struct wined3d_surface *src_surface, struct wined3d_context *context, const RECT *src_rect, const RECT *dst_rect, enum wined3d_texture_filter_type filter) DECLSPEC_HIDDEN; -@@ -2872,10 +2962,12 @@ +@@ -2893,10 +2983,12 @@ GLuint name; }; @@ -7000,7 +6957,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h struct wined3d_vertex_declaration_element { const struct wined3d_format *format; -@@ -2971,6 +3063,7 @@ +@@ -2992,6 +3084,7 @@ void stateblock_init_contained_states(struct wined3d_stateblock *stateblock) DECLSPEC_HIDDEN; void state_cleanup(struct wined3d_state *state) DECLSPEC_HIDDEN; @@ -7008,7 +6965,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h HRESULT state_init(struct wined3d_state *state, const struct wined3d_gl_info *gl_info, const struct wined3d_d3d_info *d3d_info, DWORD flags) DECLSPEC_HIDDEN; void state_unbind_resources(struct wined3d_state *state) DECLSPEC_HIDDEN; -@@ -3021,6 +3114,44 @@ +@@ -3042,6 +3135,44 @@ void wined3d_cs_destroy(struct wined3d_cs *cs) DECLSPEC_HIDDEN; void wined3d_cs_switch_onscreen_ds(struct wined3d_cs *cs, struct wined3d_context *context, struct wined3d_surface *depth_stencil) DECLSPEC_HIDDEN; @@ -7053,7 +7010,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h void wined3d_cs_emit_clear(struct wined3d_cs *cs, DWORD rect_count, const RECT *rects, DWORD flags, const struct wined3d_color *color, float depth, DWORD stencil) DECLSPEC_HIDDEN; -@@ -3071,6 +3202,7 @@ +@@ -3092,6 +3223,7 @@ void wined3d_cs_emit_set_vertex_declaration(struct wined3d_cs *cs, struct wined3d_vertex_declaration *declaration) DECLSPEC_HIDDEN; void wined3d_cs_emit_set_viewport(struct wined3d_cs *cs, const struct wined3d_viewport *viewport) DECLSPEC_HIDDEN; @@ -7061,7 +7018,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h void wined3d_cs_emit_set_consts_f(struct wined3d_cs *cs, unsigned int start_idx, unsigned int count, const struct wined3d_vec4 *constants, enum wined3d_shader_type type) DECLSPEC_HIDDEN; void wined3d_cs_emit_set_consts_b(struct wined3d_cs *cs, unsigned int start_idx, -@@ -3129,6 +3261,14 @@ +@@ -3149,6 +3281,14 @@ void wined3d_cs_emit_delete_opengl_contexts(struct wined3d_cs *cs, struct wined3d_swapchain *swapchain) DECLSPEC_HIDDEN; void wined3d_cs_emit_update_swap_interval(struct wined3d_cs *cs, struct wined3d_swapchain *swapchain) DECLSPEC_HIDDEN; @@ -7076,7 +7033,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h /* Direct3D terminology with little modifications. We do not have an issued state * because only the driver knows about it, but we have a created state because d3d -@@ -3143,8 +3283,12 @@ +@@ -3163,8 +3303,12 @@ struct wined3d_query_ops { HRESULT (*query_get_data)(struct wined3d_query *query, void *data, DWORD data_size, DWORD flags); @@ -7089,7 +7046,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h }; struct wined3d_query -@@ -3158,12 +3302,16 @@ +@@ -3178,9 +3322,11 @@ enum wined3d_query_type type; DWORD data_size; void *extendedData; @@ -7097,16 +7054,11 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h LONG counter_main, counter_retrieved; struct list poll_list_entry; ++#endif /* STAGING_CSMT */ }; - void wined3d_query_destroy(struct wined3d_query *query) DECLSPEC_HIDDEN; -+#else /* STAGING_CSMT */ -+}; -+#endif /* STAGING_CSMT */ - /* TODO: Add tests and support for FLOAT16_4 POSITIONT, D3DCOLOR position, other - * fixed function semantics as D3DCOLOR or FLOAT16 */ -@@ -3190,7 +3338,9 @@ +@@ -3208,7 +3354,9 @@ GLenum buffer_object_usage; GLenum buffer_type_hint; DWORD flags; @@ -7116,7 +7068,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h void *map_ptr; struct wined3d_map_range *maps; -@@ -3215,6 +3365,7 @@ +@@ -3233,6 +3381,7 @@ BYTE *buffer_get_sysmem(struct wined3d_buffer *buffer, struct wined3d_context *context) DECLSPEC_HIDDEN; void buffer_internal_preload(struct wined3d_buffer *buffer, struct wined3d_context *context, const struct wined3d_state *state) DECLSPEC_HIDDEN; @@ -7124,7 +7076,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h HRESULT wined3d_buffer_copy(struct wined3d_buffer *dst_buffer, unsigned int dst_offset, struct wined3d_buffer *src_buffer, unsigned int src_offset, unsigned int size) DECLSPEC_HIDDEN; HRESULT wined3d_buffer_upload_data(struct wined3d_buffer *buffer, -@@ -3223,6 +3374,13 @@ +@@ -3241,6 +3390,13 @@ void buffer_swap_mem(struct wined3d_buffer *buffer, BYTE *mem) DECLSPEC_HIDDEN; void buffer_create_buffer_object(struct wined3d_buffer *This, struct wined3d_context *context) DECLSPEC_HIDDEN; @@ -7138,7 +7090,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h struct wined3d_rendertarget_view { -@@ -3273,8 +3431,12 @@ +@@ -3291,8 +3447,12 @@ struct wined3d_swapchain_ops { void (*swapchain_present)(struct wined3d_swapchain *swapchain, @@ -7151,7 +7103,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h void (*swapchain_frontbuffer_updated)(struct wined3d_swapchain *swapchain); }; -@@ -3310,8 +3472,10 @@ +@@ -3328,8 +3488,10 @@ void wined3d_swapchain_activate(struct wined3d_swapchain *swapchain, BOOL activate) DECLSPEC_HIDDEN; struct wined3d_context *swapchain_get_context(struct wined3d_swapchain *swapchain) DECLSPEC_HIDDEN;