mirror of
https://gitlab.winehq.org/wine/wine-staging.git
synced 2025-01-28 22:04:43 -08:00
wined3d-CSMT_Main: Reenable patchset.
This commit is contained in:
parent
10837badd4
commit
5dcd52a67f
@ -417,6 +417,7 @@ patch_enable_all ()
|
||||
enable_wined3d_1DTextures="$1"
|
||||
enable_wined3d_Accounting="$1"
|
||||
enable_wined3d_CSMT_Helper="$1"
|
||||
enable_wined3d_CSMT_Main="$1"
|
||||
enable_wined3d_DXTn="$1"
|
||||
enable_wined3d_Error_Handling="$1"
|
||||
enable_wined3d_GTX_560M="$1"
|
||||
@ -1482,6 +1483,9 @@ patch_enable ()
|
||||
wined3d-CSMT_Helper)
|
||||
enable_wined3d_CSMT_Helper="$2"
|
||||
;;
|
||||
wined3d-CSMT_Main)
|
||||
enable_wined3d_CSMT_Main="$2"
|
||||
;;
|
||||
wined3d-DXTn)
|
||||
enable_wined3d_DXTn="$2"
|
||||
;;
|
||||
@ -2034,6 +2038,13 @@ if test "$enable_winex11_WM_WINDOWPOSCHANGING" -eq 1; then
|
||||
enable_winex11__NET_ACTIVE_WINDOW=1
|
||||
fi
|
||||
|
||||
if test "$enable_wined3d_CSMT_Main" -eq 1; then
|
||||
if test "$enable_wined3d_CSMT_Helper" -gt 1; then
|
||||
abort "Patchset wined3d-CSMT_Helper disabled, but wined3d-CSMT_Main depends on that."
|
||||
fi
|
||||
enable_wined3d_CSMT_Helper=1
|
||||
fi
|
||||
|
||||
if test "$enable_wined3d_CSMT_Helper" -eq 1; then
|
||||
if test "$enable_d3d11_Deferred_Context" -gt 1; then
|
||||
abort "Patchset d3d11-Deferred_Context disabled, but wined3d-CSMT_Helper depends on that."
|
||||
@ -8759,6 +8770,43 @@ if test "$enable_wined3d_check_format_support" -eq 1; then
|
||||
) >> "$patchlist"
|
||||
fi
|
||||
|
||||
# Patchset wined3d-CSMT_Main
|
||||
# |
|
||||
# | This patchset has the following (direct or indirect) dependencies:
|
||||
# | * d3d11-Deferred_Context, d3d9-Tests, makedep-PARENTSPEC, ntdll-Attach_Process_DLLs, ntdll-DllOverrides_WOW64, ntdll-
|
||||
# | Loader_Machine_Type, ntdll-DllRedirects, wined3d-1DTextures, wined3d-Accounting, wined3d-DXTn, wined3d-QUERY_Stubs,
|
||||
# | wined3d-Revert_Buffer_Upload, wined3d-Revert_Pixel_Center_Offset, wined3d-Silence_FIXMEs, wined3d-CSMT_Helper
|
||||
# |
|
||||
# | This patchset fixes the following Wine bugs:
|
||||
# | * [#11674] Support for CSMT (command stream) to increase graphic performance
|
||||
# |
|
||||
# | Modified files:
|
||||
# | * dlls/wined3d/buffer.c, dlls/wined3d/cs.c, dlls/wined3d/device.c, dlls/wined3d/resource.c, dlls/wined3d/surface.c,
|
||||
# | dlls/wined3d/swapchain.c, dlls/wined3d/texture.c, dlls/wined3d/view.c, dlls/wined3d/wined3d_main.c,
|
||||
# | dlls/wined3d/wined3d_private.h
|
||||
# |
|
||||
if test "$enable_wined3d_CSMT_Main" -eq 1; then
|
||||
patch_apply wined3d-CSMT_Main/9999-IfDefined.patch
|
||||
(
|
||||
printf '%s\n' '+ { "Sebastian Lackner", "wined3d: Add additional synchronization CS ops.", 1 },';
|
||||
printf '%s\n' '+ { "Stefan Dösinger", "wined3d: Prevent the command stream from running ahead too far.", 1 },';
|
||||
printf '%s\n' '+ { "Stefan Dösinger", "wined3d: Send blits through the command stream.", 1 },';
|
||||
printf '%s\n' '+ { "Stefan Dösinger", "wined3d: Wrap GL BOs in a structure.", 1 },';
|
||||
printf '%s\n' '+ { "Stefan Dösinger", "wined3d: Wait for the cs to finish before destroying the device.", 1 },';
|
||||
printf '%s\n' '+ { "Stefan Dösinger", "wined3d: Add swapchain waits.", 1 },';
|
||||
printf '%s\n' '+ { "Stefan Dösinger", "wined3d: Hackily introduce a multithreaded command stream.", 1 },';
|
||||
printf '%s\n' '+ { "Sebastian Lackner", "wined3d: Run the cs asynchronously.", 1 },';
|
||||
printf '%s\n' '+ { "Sebastian Lackner", "wined3d: Introduce a separate priority queue.", 1 },';
|
||||
printf '%s\n' '+ { "Sebastian Lackner", "wined3d: Use priority queue for maps/unmaps.", 1 },';
|
||||
printf '%s\n' '+ { "Stefan Dösinger", "wined3d: Don'\''t call glFinish before swapping.", 1 },';
|
||||
printf '%s\n' '+ { "Sebastian Lackner", "wined3d: Use priority queue for update_sub_resource.", 1 },';
|
||||
printf '%s\n' '+ { "Sebastian Lackner", "wined3d: Reset context before destruction.", 1 },';
|
||||
printf '%s\n' '+ { "Sebastian Lackner", "wined3d: Synchronize before resizing swapchain context array.", 1 },';
|
||||
printf '%s\n' '+ { "Michael Müller", "wined3d: Improve wined3d_cs_emit_update_sub_resource.", 1 },';
|
||||
printf '%s\n' '+ { "Michael Müller", "wined3d: Discard buffer during upload when replacing complete content.", 1 },';
|
||||
) >> "$patchlist"
|
||||
fi
|
||||
|
||||
# Patchset winedbg-Process_Arguments
|
||||
# |
|
||||
# | Modified files:
|
||||
|
@ -1,79 +1,51 @@
|
||||
From bf9af9d4fc2546603587ce2e57eb6feff9744892 Mon Sep 17 00:00:00 2001
|
||||
From fdbfdf6df22ea87be4390c3d8913417b6177cbd7 Mon Sep 17 00:00:00 2001
|
||||
From: Sebastian Lackner <sebastian@fds-team.de>
|
||||
Date: Sun, 19 Feb 2017 00:57:12 +0100
|
||||
Subject: wined3d: Add additional synchronization CS ops.
|
||||
|
||||
---
|
||||
dlls/wined3d/cs.c | 53 +++++++++++++++++++++++++++++++++++++++---
|
||||
dlls/wined3d/cs.c | 51 ++++++++++++++++++++++++++++++++++++------
|
||||
dlls/wined3d/device.c | 2 ++
|
||||
dlls/wined3d/swapchain.c | 2 ++
|
||||
dlls/wined3d/texture.c | 11 +++++++++
|
||||
dlls/wined3d/view.c | 6 +++++
|
||||
dlls/wined3d/wined3d_private.h | 3 +++
|
||||
6 files changed, 74 insertions(+), 3 deletions(-)
|
||||
6 files changed, 68 insertions(+), 7 deletions(-)
|
||||
|
||||
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
|
||||
index ed567bc571..445a11d07e 100644
|
||||
index b4e819cf01..833ab4b4c1 100644
|
||||
--- a/dlls/wined3d/cs.c
|
||||
+++ b/dlls/wined3d/cs.c
|
||||
@@ -26,6 +26,8 @@ WINE_DEFAULT_DEBUG_CHANNEL(d3d);
|
||||
|
||||
enum wined3d_cs_op
|
||||
{
|
||||
+ WINED3D_CS_OP_SYNC,
|
||||
+ WINED3D_CS_OP_GLFINISH,
|
||||
WINED3D_CS_OP_PRESENT,
|
||||
@@ -31,6 +31,7 @@ enum wined3d_cs_op
|
||||
WINED3D_CS_OP_CLEAR,
|
||||
WINED3D_CS_OP_DISPATCH,
|
||||
@@ -68,6 +70,16 @@ enum wined3d_cs_op
|
||||
WINED3D_CS_OP_ADD_DIRTY_TEXTURE_REGION,
|
||||
WINED3D_CS_OP_DRAW,
|
||||
+ WINED3D_CS_OP_FINISH,
|
||||
WINED3D_CS_OP_FLUSH,
|
||||
WINED3D_CS_OP_SET_PREDICATION,
|
||||
WINED3D_CS_OP_SET_VIEWPORT,
|
||||
@@ -127,6 +128,11 @@ struct wined3d_cs_draw
|
||||
BOOL indexed;
|
||||
};
|
||||
|
||||
+struct wined3d_cs_sync
|
||||
+struct wined3d_cs_finish
|
||||
+{
|
||||
+ enum wined3d_cs_op opcode;
|
||||
+};
|
||||
+
|
||||
+struct wined3d_cs_glfinish
|
||||
+{
|
||||
+ enum wined3d_cs_op opcode;
|
||||
+};
|
||||
+
|
||||
struct wined3d_cs_present
|
||||
struct wined3d_cs_flush
|
||||
{
|
||||
enum wined3d_cs_op opcode;
|
||||
@@ -380,6 +392,38 @@ struct wined3d_cs_add_dirty_texture_region
|
||||
unsigned int layer;
|
||||
};
|
||||
@@ -418,6 +424,16 @@ static void wined3d_cs_exec_nop(struct wined3d_cs *cs, const void *data)
|
||||
{
|
||||
}
|
||||
|
||||
+static void wined3d_cs_exec_sync(struct wined3d_cs *cs, const void *data)
|
||||
+{
|
||||
+}
|
||||
+
|
||||
+void wined3d_cs_emit_sync(struct wined3d_cs *cs)
|
||||
+{
|
||||
+ struct wined3d_cs_sync *op;
|
||||
+ struct wined3d_cs_nop *op;
|
||||
+
|
||||
+ op = cs->ops->require_space(cs, sizeof(*op));
|
||||
+ op->opcode = WINED3D_CS_OP_SYNC;
|
||||
+
|
||||
+ cs->ops->submit_and_wait(cs);
|
||||
+}
|
||||
+
|
||||
+static void wined3d_cs_exec_glfinish(struct wined3d_cs *cs, const void *data)
|
||||
+{
|
||||
+ struct wined3d_context *context = context_get_current();
|
||||
+
|
||||
+ if (context)
|
||||
+ context->gl_info->gl_ops.gl.p_glFinish();
|
||||
+}
|
||||
+
|
||||
+void wined3d_cs_emit_glfinish(struct wined3d_cs *cs)
|
||||
+{
|
||||
+ struct wined3d_cs_glfinish *op;
|
||||
+
|
||||
+ op = cs->ops->require_space(cs, sizeof(*op));
|
||||
+ op->opcode = WINED3D_CS_OP_GLFINISH;
|
||||
+ op->opcode = WINED3D_CS_OP_NOP;
|
||||
+
|
||||
+ cs->ops->submit_and_wait(cs);
|
||||
+}
|
||||
@ -81,7 +53,32 @@ index ed567bc571..445a11d07e 100644
|
||||
static void wined3d_cs_exec_present(struct wined3d_cs *cs, const void *data)
|
||||
{
|
||||
const struct wined3d_cs_present *op = data;
|
||||
@@ -1710,7 +1754,7 @@ HRESULT wined3d_cs_map(struct wined3d_cs *cs, struct wined3d_resource *resource,
|
||||
@@ -797,6 +813,24 @@ void wined3d_cs_emit_draw(struct wined3d_cs *cs, GLenum primitive_type, int base
|
||||
cs->ops->submit(cs);
|
||||
}
|
||||
|
||||
+static void wined3d_cs_exec_finish(struct wined3d_cs *cs, const void *data)
|
||||
+{
|
||||
+ struct wined3d_context *context = context_get_current();
|
||||
+
|
||||
+ if (context)
|
||||
+ context->gl_info->gl_ops.gl.p_glFinish();
|
||||
+}
|
||||
+
|
||||
+void wined3d_cs_emit_finish(struct wined3d_cs *cs)
|
||||
+{
|
||||
+ struct wined3d_cs_finish *op;
|
||||
+
|
||||
+ op = cs->ops->require_space(cs, sizeof(*op));
|
||||
+ op->opcode = WINED3D_CS_OP_FINISH;
|
||||
+
|
||||
+ cs->ops->submit_and_wait(cs);
|
||||
+}
|
||||
+
|
||||
static void wined3d_cs_exec_flush(struct wined3d_cs *cs, const void *data)
|
||||
{
|
||||
struct wined3d_context *context;
|
||||
@@ -1865,7 +1899,7 @@ HRESULT wined3d_cs_map(struct wined3d_cs *cs, struct wined3d_resource *resource,
|
||||
op->flags = flags;
|
||||
op->hr = &hr;
|
||||
|
||||
@ -90,7 +87,7 @@ index ed567bc571..445a11d07e 100644
|
||||
|
||||
return hr;
|
||||
}
|
||||
@@ -1734,7 +1778,7 @@ HRESULT wined3d_cs_unmap(struct wined3d_cs *cs, struct wined3d_resource *resourc
|
||||
@@ -1889,7 +1923,7 @@ HRESULT wined3d_cs_unmap(struct wined3d_cs *cs, struct wined3d_resource *resourc
|
||||
op->sub_resource_idx = sub_resource_idx;
|
||||
op->hr = &hr;
|
||||
|
||||
@ -99,7 +96,7 @@ index ed567bc571..445a11d07e 100644
|
||||
|
||||
return hr;
|
||||
}
|
||||
@@ -1955,7 +1999,7 @@ void wined3d_cs_emit_update_sub_resource(struct wined3d_cs *cs, struct wined3d_r
|
||||
@@ -2111,7 +2145,7 @@ void wined3d_cs_emit_update_sub_resource(struct wined3d_cs *cs, struct wined3d_r
|
||||
|
||||
wined3d_resource_acquire(resource);
|
||||
|
||||
@ -108,16 +105,15 @@ index ed567bc571..445a11d07e 100644
|
||||
}
|
||||
|
||||
static void wined3d_cs_exec_add_dirty_texture_region(struct wined3d_cs *cs, const void *data)
|
||||
@@ -1996,6 +2040,8 @@ void wined3d_cs_emit_add_dirty_texture_region(struct wined3d_cs *cs,
|
||||
|
||||
static void (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void *data) =
|
||||
{
|
||||
+ /* WINED3D_CS_OP_SYNC */ wined3d_cs_exec_sync,
|
||||
+ /* WINED3D_CS_OP_GLFINISH */ wined3d_cs_exec_glfinish,
|
||||
/* WINED3D_CS_OP_PRESENT */ wined3d_cs_exec_present,
|
||||
@@ -2167,6 +2201,7 @@ static void (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void
|
||||
/* WINED3D_CS_OP_CLEAR */ wined3d_cs_exec_clear,
|
||||
/* WINED3D_CS_OP_DISPATCH */ wined3d_cs_exec_dispatch,
|
||||
@@ -2129,6 +2175,7 @@ static const struct wined3d_cs_ops wined3d_cs_st_ops =
|
||||
/* WINED3D_CS_OP_DRAW */ wined3d_cs_exec_draw,
|
||||
+ /* WINED3D_CS_OP_FINISH */ wined3d_cs_exec_finish,
|
||||
/* WINED3D_CS_OP_FLUSH */ wined3d_cs_exec_flush,
|
||||
/* WINED3D_CS_OP_SET_PREDICATION */ wined3d_cs_exec_set_predication,
|
||||
/* WINED3D_CS_OP_SET_VIEWPORT */ wined3d_cs_exec_set_viewport,
|
||||
@@ -2258,6 +2293,7 @@ static const struct wined3d_cs_ops wined3d_cs_st_ops =
|
||||
{
|
||||
wined3d_cs_st_require_space,
|
||||
wined3d_cs_st_submit,
|
||||
@ -125,8 +121,37 @@ index ed567bc571..445a11d07e 100644
|
||||
wined3d_cs_st_push_constants,
|
||||
};
|
||||
|
||||
@@ -2355,6 +2391,7 @@ static const struct wined3d_cs_ops wined3d_cs_mt_ops =
|
||||
{
|
||||
wined3d_cs_mt_require_space,
|
||||
wined3d_cs_mt_submit,
|
||||
+ wined3d_cs_mt_submit,
|
||||
wined3d_cs_mt_push_constants,
|
||||
};
|
||||
|
||||
@@ -2504,10 +2541,6 @@ fail:
|
||||
|
||||
void wined3d_cs_destroy(struct wined3d_cs *cs)
|
||||
{
|
||||
- state_cleanup(&cs->state);
|
||||
- HeapFree(GetProcessHeap(), 0, cs->fb.render_targets);
|
||||
- HeapFree(GetProcessHeap(), 0, cs->data);
|
||||
-
|
||||
if (cs->thread)
|
||||
{
|
||||
wined3d_cs_emit_stop(cs);
|
||||
@@ -2516,5 +2549,9 @@ void wined3d_cs_destroy(struct wined3d_cs *cs)
|
||||
ERR("Closing event failed.\n");
|
||||
}
|
||||
|
||||
+ state_cleanup(&cs->state);
|
||||
+ HeapFree(GetProcessHeap(), 0, cs->fb.render_targets);
|
||||
+ HeapFree(GetProcessHeap(), 0, cs->data);
|
||||
+
|
||||
HeapFree(GetProcessHeap(), 0, cs);
|
||||
}
|
||||
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
|
||||
index f557306dfb..62580f6867 100644
|
||||
index c86d243c00..22e474303b 100644
|
||||
--- a/dlls/wined3d/device.c
|
||||
+++ b/dlls/wined3d/device.c
|
||||
@@ -1023,6 +1023,7 @@ static void wined3d_device_delete_opengl_contexts_cs(void *object)
|
||||
@ -146,7 +171,7 @@ index f557306dfb..62580f6867 100644
|
||||
return E_FAIL;
|
||||
|
||||
diff --git a/dlls/wined3d/swapchain.c b/dlls/wined3d/swapchain.c
|
||||
index 026322d7eb..b01607be4b 100644
|
||||
index 3be9a92a06..5482e3024e 100644
|
||||
--- a/dlls/wined3d/swapchain.c
|
||||
+++ b/dlls/wined3d/swapchain.c
|
||||
@@ -66,6 +66,7 @@ static void swapchain_cleanup(struct wined3d_swapchain *swapchain)
|
||||
@ -157,7 +182,7 @@ index 026322d7eb..b01607be4b 100644
|
||||
|
||||
/* Restore the screen resolution if we rendered in fullscreen.
|
||||
* This will restore the screen resolution to what it was before creating
|
||||
@@ -857,6 +858,7 @@ static HRESULT swapchain_init(struct wined3d_swapchain *swapchain, struct wined3
|
||||
@@ -900,6 +901,7 @@ static HRESULT swapchain_init(struct wined3d_swapchain *swapchain, struct wined3
|
||||
}
|
||||
|
||||
wined3d_cs_init_object(device->cs, wined3d_swapchain_cs_init, swapchain);
|
||||
@ -257,10 +282,10 @@ index dc225f4f81..cd09c9c8ee 100644
|
||||
|
||||
return WINED3D_OK;
|
||||
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
|
||||
index ab6472339b..d5b26d1f43 100644
|
||||
index df8427d1b7..de832d8125 100644
|
||||
--- a/dlls/wined3d/wined3d_private.h
|
||||
+++ b/dlls/wined3d/wined3d_private.h
|
||||
@@ -3229,6 +3229,7 @@ struct wined3d_cs_ops
|
||||
@@ -3248,6 +3248,7 @@ struct wined3d_cs_ops
|
||||
{
|
||||
void *(*require_space)(struct wined3d_cs *cs, size_t size);
|
||||
void (*submit)(struct wined3d_cs *cs);
|
||||
@ -268,15 +293,15 @@ index ab6472339b..d5b26d1f43 100644
|
||||
void (*push_constants)(struct wined3d_cs *cs, enum wined3d_push_constants p,
|
||||
unsigned int start_idx, unsigned int count, const void *constants);
|
||||
};
|
||||
@@ -3263,6 +3264,7 @@ void wined3d_cs_emit_dispatch(struct wined3d_cs *cs,
|
||||
@@ -3289,6 +3290,7 @@ void wined3d_cs_emit_dispatch(struct wined3d_cs *cs,
|
||||
void wined3d_cs_emit_draw(struct wined3d_cs *cs, GLenum primitive_type, int base_vertex_idx,
|
||||
unsigned int start_idx, unsigned int index_count, unsigned int start_instance,
|
||||
unsigned int instance_count, BOOL indexed) DECLSPEC_HIDDEN;
|
||||
+void wined3d_cs_emit_glfinish(struct wined3d_cs *cs) DECLSPEC_HIDDEN;
|
||||
+void wined3d_cs_emit_finish(struct wined3d_cs *cs) 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, DWORD flags) DECLSPEC_HIDDEN;
|
||||
@@ -3314,6 +3316,7 @@ void wined3d_cs_emit_set_unordered_access_view(struct wined3d_cs *cs, enum wined
|
||||
@@ -3341,6 +3343,7 @@ void wined3d_cs_emit_set_unordered_access_view(struct wined3d_cs *cs, enum wined
|
||||
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;
|
||||
@ -285,5 +310,5 @@ index ab6472339b..d5b26d1f43 100644
|
||||
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,
|
||||
--
|
||||
2.11.0
|
||||
2.12.2
|
||||
|
||||
|
@ -1,264 +0,0 @@
|
||||
From d595e0401ffc44a7e33b1d47931bc3cfb2ef1f24 Mon Sep 17 00:00:00 2001
|
||||
From: Sebastian Lackner <sebastian@fds-team.de>
|
||||
Date: Mon, 6 Feb 2017 05:50:11 +0100
|
||||
Subject: wined3d: Send push_constants through the CS.
|
||||
|
||||
---
|
||||
dlls/wined3d/cs.c | 113 +++++++++++++++++++++++++----------------
|
||||
dlls/wined3d/device.c | 12 ++---
|
||||
dlls/wined3d/wined3d_private.h | 10 +---
|
||||
3 files changed, 77 insertions(+), 58 deletions(-)
|
||||
|
||||
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
|
||||
index 445a11d07e..eb2b012545 100644
|
||||
--- a/dlls/wined3d/cs.c
|
||||
+++ b/dlls/wined3d/cs.c
|
||||
@@ -68,6 +68,7 @@ enum wined3d_cs_op
|
||||
WINED3D_CS_OP_BLT_SUB_RESOURCE,
|
||||
WINED3D_CS_OP_UPDATE_SUB_RESOURCE,
|
||||
WINED3D_CS_OP_ADD_DIRTY_TEXTURE_REGION,
|
||||
+ WINED3D_CS_OP_PUSH_CONSTANTS,
|
||||
};
|
||||
|
||||
struct wined3d_cs_sync
|
||||
@@ -392,6 +393,15 @@ struct wined3d_cs_add_dirty_texture_region
|
||||
unsigned int layer;
|
||||
};
|
||||
|
||||
+struct wined3d_cs_push_constants
|
||||
+{
|
||||
+ enum wined3d_cs_op opcode;
|
||||
+ enum wined3d_push_constants p;
|
||||
+ unsigned int start_idx;
|
||||
+ unsigned int count;
|
||||
+ BYTE constants[1];
|
||||
+};
|
||||
+
|
||||
static void wined3d_cs_exec_sync(struct wined3d_cs *cs, const void *data)
|
||||
{
|
||||
}
|
||||
@@ -2038,6 +2048,64 @@ void wined3d_cs_emit_add_dirty_texture_region(struct wined3d_cs *cs,
|
||||
cs->ops->submit(cs);
|
||||
}
|
||||
|
||||
+static const struct
|
||||
+{
|
||||
+ size_t offset;
|
||||
+ size_t size;
|
||||
+ DWORD mask;
|
||||
+}
|
||||
+push_constant_info[] =
|
||||
+{
|
||||
+ /* WINED3D_PUSH_CONSTANTS_VS_F */
|
||||
+ {FIELD_OFFSET(struct wined3d_state, vs_consts_f), sizeof(struct wined3d_vec4), WINED3D_SHADER_CONST_VS_F},
|
||||
+ /* WINED3D_PUSH_CONSTANTS_PS_F */
|
||||
+ {FIELD_OFFSET(struct wined3d_state, ps_consts_f), sizeof(struct wined3d_vec4), WINED3D_SHADER_CONST_PS_F},
|
||||
+ /* WINED3D_PUSH_CONSTANTS_VS_I */
|
||||
+ {FIELD_OFFSET(struct wined3d_state, vs_consts_i), sizeof(struct wined3d_ivec4), WINED3D_SHADER_CONST_VS_I},
|
||||
+ /* WINED3D_PUSH_CONSTANTS_PS_I */
|
||||
+ {FIELD_OFFSET(struct wined3d_state, ps_consts_i), sizeof(struct wined3d_ivec4), WINED3D_SHADER_CONST_PS_I},
|
||||
+ /* WINED3D_PUSH_CONSTANTS_VS_B */
|
||||
+ {FIELD_OFFSET(struct wined3d_state, vs_consts_b), sizeof(BOOL), WINED3D_SHADER_CONST_VS_B},
|
||||
+ /* WINED3D_PUSH_CONSTANTS_PS_B */
|
||||
+ {FIELD_OFFSET(struct wined3d_state, ps_consts_b), sizeof(BOOL), WINED3D_SHADER_CONST_PS_B},
|
||||
+};
|
||||
+
|
||||
+static void wined3d_cs_exec_push_constants(struct wined3d_cs *cs, const void *data)
|
||||
+{
|
||||
+ const struct wined3d_cs_push_constants *op = data;
|
||||
+ struct wined3d_device *device = cs->device;
|
||||
+ unsigned int context_count;
|
||||
+ unsigned int i;
|
||||
+ size_t offset;
|
||||
+
|
||||
+ if (op->p == WINED3D_PUSH_CONSTANTS_VS_F)
|
||||
+ device->shader_backend->shader_update_float_vertex_constants(device, op->start_idx, op->count);
|
||||
+ else if (op->p == WINED3D_PUSH_CONSTANTS_PS_F)
|
||||
+ device->shader_backend->shader_update_float_pixel_constants(device, op->start_idx, op->count);
|
||||
+
|
||||
+ offset = push_constant_info[op->p].offset + op->start_idx * push_constant_info[op->p].size;
|
||||
+ memcpy((BYTE *)&cs->state + offset, op->constants, op->count * push_constant_info[op->p].size);
|
||||
+ for (i = 0, context_count = device->context_count; i < context_count; ++i)
|
||||
+ {
|
||||
+ device->contexts[i]->constant_update_mask |= push_constant_info[op->p].mask;
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+void wined3d_cs_emit_push_constants(struct wined3d_cs *cs, enum wined3d_push_constants p,
|
||||
+ unsigned int start_idx, unsigned int count, const void *constants)
|
||||
+{
|
||||
+ struct wined3d_cs_push_constants *op;
|
||||
+
|
||||
+ op = cs->ops->require_space(cs, FIELD_OFFSET(struct wined3d_cs_push_constants, constants[count * push_constant_info[p].size]));
|
||||
+ op->opcode = WINED3D_CS_OP_PUSH_CONSTANTS;
|
||||
+ op->p = p;
|
||||
+ op->start_idx = start_idx;
|
||||
+ op->count = count;
|
||||
+ memcpy(op->constants, constants, count * push_constant_info[p].size);
|
||||
+
|
||||
+ cs->ops->submit(cs);
|
||||
+}
|
||||
+
|
||||
static void (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void *data) =
|
||||
{
|
||||
/* WINED3D_CS_OP_SYNC */ wined3d_cs_exec_sync,
|
||||
@@ -2082,6 +2150,7 @@ static void (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void
|
||||
/* WINED3D_CS_OP_BLT_SUB_RESOURCE */ wined3d_cs_exec_blt_sub_resource,
|
||||
/* WINED3D_CS_OP_UPDATE_SUB_RESOURCE */ wined3d_cs_exec_update_sub_resource,
|
||||
/* WINED3D_CS_OP_ADD_DIRTY_TEXTURE_REGION */ wined3d_cs_exec_add_dirty_texture_region,
|
||||
+ /* WINED3D_CS_OP_PUSH_CONSTANTS */ wined3d_cs_exec_push_constants,
|
||||
};
|
||||
|
||||
static void *wined3d_cs_st_require_space(struct wined3d_cs *cs, size_t size)
|
||||
@@ -2128,55 +2197,11 @@ static void wined3d_cs_st_submit(struct wined3d_cs *cs)
|
||||
HeapFree(GetProcessHeap(), 0, data);
|
||||
}
|
||||
|
||||
-static void wined3d_cs_st_push_constants(struct wined3d_cs *cs, enum wined3d_push_constants p,
|
||||
- unsigned int start_idx, unsigned int count, const void *constants)
|
||||
-{
|
||||
- struct wined3d_device *device = cs->device;
|
||||
- unsigned int context_count;
|
||||
- unsigned int i;
|
||||
- size_t offset;
|
||||
-
|
||||
- static const struct
|
||||
- {
|
||||
- size_t offset;
|
||||
- size_t size;
|
||||
- DWORD mask;
|
||||
- }
|
||||
- push_constant_info[] =
|
||||
- {
|
||||
- /* WINED3D_PUSH_CONSTANTS_VS_F */
|
||||
- {FIELD_OFFSET(struct wined3d_state, vs_consts_f), sizeof(struct wined3d_vec4), WINED3D_SHADER_CONST_VS_F},
|
||||
- /* WINED3D_PUSH_CONSTANTS_PS_F */
|
||||
- {FIELD_OFFSET(struct wined3d_state, ps_consts_f), sizeof(struct wined3d_vec4), WINED3D_SHADER_CONST_PS_F},
|
||||
- /* WINED3D_PUSH_CONSTANTS_VS_I */
|
||||
- {FIELD_OFFSET(struct wined3d_state, vs_consts_i), sizeof(struct wined3d_ivec4), WINED3D_SHADER_CONST_VS_I},
|
||||
- /* WINED3D_PUSH_CONSTANTS_PS_I */
|
||||
- {FIELD_OFFSET(struct wined3d_state, ps_consts_i), sizeof(struct wined3d_ivec4), WINED3D_SHADER_CONST_PS_I},
|
||||
- /* WINED3D_PUSH_CONSTANTS_VS_B */
|
||||
- {FIELD_OFFSET(struct wined3d_state, vs_consts_b), sizeof(BOOL), WINED3D_SHADER_CONST_VS_B},
|
||||
- /* WINED3D_PUSH_CONSTANTS_PS_B */
|
||||
- {FIELD_OFFSET(struct wined3d_state, ps_consts_b), sizeof(BOOL), WINED3D_SHADER_CONST_PS_B},
|
||||
- };
|
||||
-
|
||||
- if (p == WINED3D_PUSH_CONSTANTS_VS_F)
|
||||
- device->shader_backend->shader_update_float_vertex_constants(device, start_idx, count);
|
||||
- else if (p == WINED3D_PUSH_CONSTANTS_PS_F)
|
||||
- device->shader_backend->shader_update_float_pixel_constants(device, start_idx, count);
|
||||
-
|
||||
- offset = push_constant_info[p].offset + start_idx * push_constant_info[p].size;
|
||||
- memcpy((BYTE *)&cs->state + offset, constants, count * push_constant_info[p].size);
|
||||
- for (i = 0, context_count = device->context_count; i < context_count; ++i)
|
||||
- {
|
||||
- device->contexts[i]->constant_update_mask |= push_constant_info[p].mask;
|
||||
- }
|
||||
-}
|
||||
-
|
||||
static const struct wined3d_cs_ops wined3d_cs_st_ops =
|
||||
{
|
||||
wined3d_cs_st_require_space,
|
||||
wined3d_cs_st_submit,
|
||||
wined3d_cs_st_submit,
|
||||
- wined3d_cs_st_push_constants,
|
||||
};
|
||||
|
||||
struct wined3d_cs *wined3d_cs_create(struct wined3d_device *device)
|
||||
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
|
||||
index 62580f6867..08cb0cb369 100644
|
||||
--- a/dlls/wined3d/device.c
|
||||
+++ b/dlls/wined3d/device.c
|
||||
@@ -2373,7 +2373,7 @@ HRESULT CDECL wined3d_device_set_vs_consts_b(struct wined3d_device *device,
|
||||
}
|
||||
else
|
||||
{
|
||||
- wined3d_cs_push_constants(device->cs, WINED3D_PUSH_CONSTANTS_VS_B, start_idx, count, constants);
|
||||
+ wined3d_cs_emit_push_constants(device->cs, WINED3D_PUSH_CONSTANTS_VS_B, start_idx, count, constants);
|
||||
}
|
||||
|
||||
return WINED3D_OK;
|
||||
@@ -2422,7 +2422,7 @@ HRESULT CDECL wined3d_device_set_vs_consts_i(struct wined3d_device *device,
|
||||
}
|
||||
else
|
||||
{
|
||||
- wined3d_cs_push_constants(device->cs, WINED3D_PUSH_CONSTANTS_VS_I, start_idx, count, constants);
|
||||
+ wined3d_cs_emit_push_constants(device->cs, WINED3D_PUSH_CONSTANTS_VS_I, start_idx, count, constants);
|
||||
}
|
||||
|
||||
return WINED3D_OK;
|
||||
@@ -2467,7 +2467,7 @@ HRESULT CDECL wined3d_device_set_vs_consts_f(struct wined3d_device *device,
|
||||
memset(&device->recording->changed.vs_consts_f[start_idx], 1,
|
||||
count * sizeof(*device->recording->changed.vs_consts_f));
|
||||
else
|
||||
- wined3d_cs_push_constants(device->cs, WINED3D_PUSH_CONSTANTS_VS_F, start_idx, count, constants);
|
||||
+ wined3d_cs_emit_push_constants(device->cs, WINED3D_PUSH_CONSTANTS_VS_F, start_idx, count, constants);
|
||||
|
||||
return WINED3D_OK;
|
||||
}
|
||||
@@ -2588,7 +2588,7 @@ HRESULT CDECL wined3d_device_set_ps_consts_b(struct wined3d_device *device,
|
||||
}
|
||||
else
|
||||
{
|
||||
- wined3d_cs_push_constants(device->cs, WINED3D_PUSH_CONSTANTS_PS_B, start_idx, count, constants);
|
||||
+ wined3d_cs_emit_push_constants(device->cs, WINED3D_PUSH_CONSTANTS_PS_B, start_idx, count, constants);
|
||||
}
|
||||
|
||||
return WINED3D_OK;
|
||||
@@ -2637,7 +2637,7 @@ HRESULT CDECL wined3d_device_set_ps_consts_i(struct wined3d_device *device,
|
||||
}
|
||||
else
|
||||
{
|
||||
- wined3d_cs_push_constants(device->cs, WINED3D_PUSH_CONSTANTS_PS_I, start_idx, count, constants);
|
||||
+ wined3d_cs_emit_push_constants(device->cs, WINED3D_PUSH_CONSTANTS_PS_I, start_idx, count, constants);
|
||||
}
|
||||
|
||||
return WINED3D_OK;
|
||||
@@ -2683,7 +2683,7 @@ HRESULT CDECL wined3d_device_set_ps_consts_f(struct wined3d_device *device,
|
||||
memset(&device->recording->changed.ps_consts_f[start_idx], 1,
|
||||
count * sizeof(*device->recording->changed.ps_consts_f));
|
||||
else
|
||||
- wined3d_cs_push_constants(device->cs, WINED3D_PUSH_CONSTANTS_PS_F, start_idx, count, constants);
|
||||
+ wined3d_cs_emit_push_constants(device->cs, WINED3D_PUSH_CONSTANTS_PS_F, start_idx, count, constants);
|
||||
|
||||
return WINED3D_OK;
|
||||
}
|
||||
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
|
||||
index d5b26d1f43..ee41d45201 100644
|
||||
--- a/dlls/wined3d/wined3d_private.h
|
||||
+++ b/dlls/wined3d/wined3d_private.h
|
||||
@@ -3230,8 +3230,6 @@ struct wined3d_cs_ops
|
||||
void *(*require_space)(struct wined3d_cs *cs, size_t size);
|
||||
void (*submit)(struct wined3d_cs *cs);
|
||||
void (*submit_and_wait)(struct wined3d_cs *cs);
|
||||
- void (*push_constants)(struct wined3d_cs *cs, enum wined3d_push_constants p,
|
||||
- unsigned int start_idx, unsigned int count, const void *constants);
|
||||
};
|
||||
|
||||
struct wined3d_cs
|
||||
@@ -3268,6 +3266,8 @@ void wined3d_cs_emit_glfinish(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, DWORD flags) DECLSPEC_HIDDEN;
|
||||
+void wined3d_cs_emit_push_constants(struct wined3d_cs *cs, enum wined3d_push_constants p,
|
||||
+ unsigned int start_idx, unsigned int count, const void *constants) 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,
|
||||
@@ -3328,12 +3328,6 @@ HRESULT wined3d_cs_map(struct wined3d_cs *cs, struct wined3d_resource *resource,
|
||||
HRESULT wined3d_cs_unmap(struct wined3d_cs *cs, struct wined3d_resource *resource,
|
||||
unsigned int sub_resource_idx) DECLSPEC_HIDDEN;
|
||||
|
||||
-static inline void wined3d_cs_push_constants(struct wined3d_cs *cs, enum wined3d_push_constants p,
|
||||
- unsigned int start_idx, unsigned int count, const void *constants)
|
||||
-{
|
||||
- cs->ops->push_constants(cs, p, start_idx, count, constants);
|
||||
-}
|
||||
-
|
||||
/* 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.11.0
|
||||
|
@ -1,4 +1,4 @@
|
||||
From 60b6de71e32b72a2ff8efcfcd1def39b458b6904 Mon Sep 17 00:00:00 2001
|
||||
From b53b6032e3923711099eb7aaf6d1cedbd0c3a866 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Stefan=20D=C3=B6singer?= <stefan@codeweavers.com>
|
||||
Date: Wed, 10 Apr 2013 19:10:41 +0200
|
||||
Subject: wined3d: Prevent the command stream from running ahead too far
|
||||
@ -9,10 +9,10 @@ Subject: wined3d: Prevent the command stream from running ahead too far
|
||||
2 files changed, 18 insertions(+)
|
||||
|
||||
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
|
||||
index 11c786a731c..8663c029215 100644
|
||||
index 96c88f068b..f7d8f86d5c 100644
|
||||
--- a/dlls/wined3d/cs.c
|
||||
+++ b/dlls/wined3d/cs.c
|
||||
@@ -409,6 +409,8 @@ static void wined3d_cs_exec_present(struct wined3d_cs *cs, const void *data)
|
||||
@@ -445,6 +445,8 @@ static void wined3d_cs_exec_present(struct wined3d_cs *cs, const void *data)
|
||||
|
||||
swapchain->swapchain_ops->swapchain_present(swapchain, &op->src_rect, &op->dst_rect, op->flags);
|
||||
|
||||
@ -21,7 +21,7 @@ index 11c786a731c..8663c029215 100644
|
||||
wined3d_resource_release(&swapchain->front_buffer->resource);
|
||||
for (i = 0; i < swapchain->desc.backbuffer_count; ++i)
|
||||
{
|
||||
@@ -421,6 +423,7 @@ void wined3d_cs_emit_present(struct wined3d_cs *cs, struct wined3d_swapchain *sw
|
||||
@@ -457,6 +459,7 @@ void wined3d_cs_emit_present(struct wined3d_cs *cs, struct wined3d_swapchain *sw
|
||||
{
|
||||
struct wined3d_cs_present *op;
|
||||
unsigned int i;
|
||||
@ -29,7 +29,7 @@ index 11c786a731c..8663c029215 100644
|
||||
|
||||
op = cs->ops->require_space(cs, sizeof(*op));
|
||||
op->opcode = WINED3D_CS_OP_PRESENT;
|
||||
@@ -436,7 +439,20 @@ void wined3d_cs_emit_present(struct wined3d_cs *cs, struct wined3d_swapchain *sw
|
||||
@@ -472,7 +475,20 @@ void wined3d_cs_emit_present(struct wined3d_cs *cs, struct wined3d_swapchain *sw
|
||||
wined3d_resource_acquire(&swapchain->back_buffers[i]->resource);
|
||||
}
|
||||
|
||||
@ -51,18 +51,18 @@ index 11c786a731c..8663c029215 100644
|
||||
|
||||
static void wined3d_cs_exec_clear(struct wined3d_cs *cs, const void *data)
|
||||
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
|
||||
index e9aeb48fb6f..5ba22f2c148 100644
|
||||
index de832d8125..0001cffc12 100644
|
||||
--- a/dlls/wined3d/wined3d_private.h
|
||||
+++ b/dlls/wined3d/wined3d_private.h
|
||||
@@ -3194,6 +3194,8 @@ struct wined3d_cs
|
||||
@@ -3269,6 +3269,8 @@ struct wined3d_cs
|
||||
|
||||
size_t data_size, start, end;
|
||||
void *data;
|
||||
HANDLE event;
|
||||
BOOL waiting_for_event;
|
||||
+
|
||||
+ LONG pending_presents;
|
||||
};
|
||||
|
||||
struct wined3d_cs *wined3d_cs_create(struct wined3d_device *device) DECLSPEC_HIDDEN;
|
||||
--
|
||||
2.11.0
|
||||
2.12.2
|
||||
|
||||
|
@ -1,42 +0,0 @@
|
||||
From fa9c3acd78f8f8cf34a7ab7caae3c52e6a0f0053 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Stefan=20D=C3=B6singer?= <stefan@codeweavers.com>
|
||||
Date: Thu, 4 Jul 2013 22:59:33 +0200
|
||||
Subject: wined3d: Get rid of the end_scene flush and finish
|
||||
|
||||
Either keep the patch this way, or send a flush through the CS. I'm not
|
||||
sure it's worth it though, this has never had any real performance
|
||||
impact.
|
||||
---
|
||||
dlls/wined3d/device.c | 9 ---------
|
||||
1 file changed, 9 deletions(-)
|
||||
|
||||
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
|
||||
index 3176aed1ddc..69f88b3420c 100644
|
||||
--- a/dlls/wined3d/device.c
|
||||
+++ b/dlls/wined3d/device.c
|
||||
@@ -3457,8 +3457,6 @@ HRESULT CDECL wined3d_device_begin_scene(struct wined3d_device *device)
|
||||
|
||||
HRESULT CDECL wined3d_device_end_scene(struct wined3d_device *device)
|
||||
{
|
||||
- struct wined3d_context *context;
|
||||
-
|
||||
TRACE("device %p.\n", device);
|
||||
|
||||
if (!device->inScene)
|
||||
@@ -3467,13 +3465,6 @@ HRESULT CDECL wined3d_device_end_scene(struct wined3d_device *device)
|
||||
return WINED3DERR_INVALIDCALL;
|
||||
}
|
||||
|
||||
- context = context_acquire(device, NULL, 0);
|
||||
- /* We only have to do this if we need to read the, swapbuffers performs a flush for us */
|
||||
- context->gl_info->gl_ops.gl.p_glFlush();
|
||||
- /* No checkGLcall here to avoid locking the lock just for checking a call that hardly ever
|
||||
- * fails. */
|
||||
- context_release(context);
|
||||
-
|
||||
device->inScene = FALSE;
|
||||
return WINED3D_OK;
|
||||
}
|
||||
--
|
||||
2.11.0
|
||||
|
@ -1,105 +0,0 @@
|
||||
From 644d2723fdf8d547bf5a0a4c43d119b6801dac77 Mon Sep 17 00:00:00 2001
|
||||
From: Sebastian Lackner <sebastian@fds-team.de>
|
||||
Date: Sun, 19 Feb 2017 01:58:25 +0100
|
||||
Subject: wined3d: Send query_poll through the command stream.
|
||||
|
||||
---
|
||||
dlls/wined3d/cs.c | 34 ++++++++++++++++++++++++++++++++++
|
||||
dlls/wined3d/query.c | 2 +-
|
||||
dlls/wined3d/wined3d_private.h | 1 +
|
||||
3 files changed, 36 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
|
||||
index bbea6bbb45..6d01424bda 100644
|
||||
--- a/dlls/wined3d/cs.c
|
||||
+++ b/dlls/wined3d/cs.c
|
||||
@@ -61,6 +61,7 @@ enum wined3d_cs_op
|
||||
WINED3D_CS_OP_RESET_STATE,
|
||||
WINED3D_CS_OP_CALLBACK,
|
||||
WINED3D_CS_OP_QUERY_ISSUE,
|
||||
+ WINED3D_CS_OP_QUERY_POLL,
|
||||
WINED3D_CS_OP_PRELOAD_RESOURCE,
|
||||
WINED3D_CS_OP_UNLOAD_RESOURCE,
|
||||
WINED3D_CS_OP_MAP,
|
||||
@@ -330,6 +331,14 @@ struct wined3d_cs_query_issue
|
||||
DWORD flags;
|
||||
};
|
||||
|
||||
+struct wined3d_cs_query_poll
|
||||
+{
|
||||
+ enum wined3d_cs_op opcode;
|
||||
+ struct wined3d_query *query;
|
||||
+ DWORD flags;
|
||||
+ BOOL *ret;
|
||||
+};
|
||||
+
|
||||
struct wined3d_cs_preload_resource
|
||||
{
|
||||
enum wined3d_cs_op opcode;
|
||||
@@ -1665,6 +1674,30 @@ void wined3d_cs_emit_query_issue(struct wined3d_cs *cs, struct wined3d_query *qu
|
||||
cs->ops->submit(cs);
|
||||
}
|
||||
|
||||
+static void wined3d_cs_exec_query_poll(struct wined3d_cs *cs, const void *data)
|
||||
+{
|
||||
+ const struct wined3d_cs_query_poll *op = data;
|
||||
+ struct wined3d_query *query = op->query;
|
||||
+
|
||||
+ *op->ret = query->query_ops->query_poll(query, op->flags);
|
||||
+}
|
||||
+
|
||||
+BOOL wined3d_cs_emit_query_poll(struct wined3d_cs *cs, struct wined3d_query *query, DWORD flags)
|
||||
+{
|
||||
+ struct wined3d_cs_query_poll *op;
|
||||
+ BOOL ret;
|
||||
+
|
||||
+ op = cs->ops->require_space(cs, sizeof(*op));
|
||||
+ op->opcode = WINED3D_CS_OP_QUERY_POLL;
|
||||
+ op->query = query;
|
||||
+ op->flags = flags;
|
||||
+ op->ret = &ret;
|
||||
+
|
||||
+ cs->ops->submit_and_wait(cs);
|
||||
+
|
||||
+ return ret;
|
||||
+}
|
||||
+
|
||||
static void wined3d_cs_exec_preload_resource(struct wined3d_cs *cs, const void *data)
|
||||
{
|
||||
const struct wined3d_cs_preload_resource *op = data;
|
||||
@@ -2061,6 +2094,7 @@ static void (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void
|
||||
/* WINED3D_CS_OP_RESET_STATE */ wined3d_cs_exec_reset_state,
|
||||
/* WINED3D_CS_OP_CALLBACK */ wined3d_cs_exec_callback,
|
||||
/* WINED3D_CS_OP_QUERY_ISSUE */ wined3d_cs_exec_query_issue,
|
||||
+ /* WINED3D_CS_OP_QUERY_POLL */ wined3d_cs_exec_query_poll,
|
||||
/* WINED3D_CS_OP_PRELOAD_RESOURCE */ wined3d_cs_exec_preload_resource,
|
||||
/* WINED3D_CS_OP_UNLOAD_RESOURCE */ wined3d_cs_exec_unload_resource,
|
||||
/* WINED3D_CS_OP_MAP */ wined3d_cs_exec_map,
|
||||
diff --git a/dlls/wined3d/query.c b/dlls/wined3d/query.c
|
||||
index bc3b15f30d..15935ab446 100644
|
||||
--- a/dlls/wined3d/query.c
|
||||
+++ b/dlls/wined3d/query.c
|
||||
@@ -350,7 +350,7 @@ HRESULT CDECL wined3d_query_get_data(struct wined3d_query *query,
|
||||
return WINED3DERR_INVALIDCALL;
|
||||
}
|
||||
|
||||
- if (!query->query_ops->query_poll(query, flags))
|
||||
+ if (!wined3d_cs_emit_query_poll(query->device->cs, query, flags))
|
||||
return S_FALSE;
|
||||
|
||||
if (data)
|
||||
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
|
||||
index 9301d10999..9d25bae822 100644
|
||||
--- a/dlls/wined3d/wined3d_private.h
|
||||
+++ b/dlls/wined3d/wined3d_private.h
|
||||
@@ -3252,6 +3252,7 @@ void wined3d_cs_emit_present(struct wined3d_cs *cs, struct wined3d_swapchain *sw
|
||||
void wined3d_cs_emit_push_constants(struct wined3d_cs *cs, enum wined3d_push_constants p,
|
||||
unsigned int start_idx, unsigned int count, const void *constants) DECLSPEC_HIDDEN;
|
||||
void wined3d_cs_emit_query_issue(struct wined3d_cs *cs, struct wined3d_query *query, DWORD flags) DECLSPEC_HIDDEN;
|
||||
+BOOL wined3d_cs_emit_query_poll(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;
|
||||
--
|
||||
2.11.0
|
||||
|
@ -1,62 +0,0 @@
|
||||
From 2c32b3dc13fe6872a69e430cb7cb0a2a2f111875 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Stefan=20D=C3=B6singer?= <stefan@codeweavers.com>
|
||||
Date: Sun, 19 Feb 2017 05:10:26 +0100
|
||||
Subject: wined3d: Add a separate variable to check if queries are started.
|
||||
|
||||
---
|
||||
dlls/wined3d/query.c | 6 ++++--
|
||||
dlls/wined3d/wined3d_private.h | 1 +
|
||||
2 files changed, 5 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/dlls/wined3d/query.c b/dlls/wined3d/query.c
|
||||
index f437c49faa..5965a330d5 100644
|
||||
--- a/dlls/wined3d/query.c
|
||||
+++ b/dlls/wined3d/query.c
|
||||
@@ -491,7 +491,7 @@ static void wined3d_occlusion_query_ops_issue(struct wined3d_query *query, DWORD
|
||||
* restart. */
|
||||
if (flags & WINED3DISSUE_BEGIN)
|
||||
{
|
||||
- if (query->state == QUERY_BUILDING)
|
||||
+ if (oq->started)
|
||||
{
|
||||
if ((context = context_reacquire(device, oq->context)))
|
||||
{
|
||||
@@ -518,13 +518,14 @@ static void wined3d_occlusion_query_ops_issue(struct wined3d_query *query, DWORD
|
||||
checkGLcall("glBeginQuery()");
|
||||
|
||||
context_release(context);
|
||||
+ oq->started = TRUE;
|
||||
}
|
||||
if (flags & WINED3DISSUE_END)
|
||||
{
|
||||
/* MSDN says END on a non-building occlusion query returns an error,
|
||||
* but our tests show that it returns OK. But OpenGL doesn't like it,
|
||||
* so avoid generating an error. */
|
||||
- if (query->state == QUERY_BUILDING)
|
||||
+ if (oq->started)
|
||||
{
|
||||
if ((context = context_reacquire(device, oq->context)))
|
||||
{
|
||||
@@ -538,6 +539,7 @@ static void wined3d_occlusion_query_ops_issue(struct wined3d_query *query, DWORD
|
||||
FIXME("Wrong thread, can't end query.\n");
|
||||
}
|
||||
}
|
||||
+ oq->started = FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
|
||||
index b564036b55..7cef5c4dcb 100644
|
||||
--- a/dlls/wined3d/wined3d_private.h
|
||||
+++ b/dlls/wined3d/wined3d_private.h
|
||||
@@ -1617,6 +1617,7 @@ struct wined3d_occlusion_query
|
||||
GLuint id;
|
||||
struct wined3d_context *context;
|
||||
UINT64 samples;
|
||||
+ BOOL started;
|
||||
};
|
||||
|
||||
struct wined3d_timestamp_query
|
||||
--
|
||||
2.11.0
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,34 +1,49 @@
|
||||
From 13fe67e10d483f6fe5047f693949bdf6560758ed Mon Sep 17 00:00:00 2001
|
||||
From f37495b98b6c9ddd4624326dfb5658e184978917 Mon Sep 17 00:00:00 2001
|
||||
From: Sebastian Lackner <sebastian@fds-team.de>
|
||||
Date: Sun, 19 Feb 2017 07:01:45 +0100
|
||||
Subject: wined3d: Run the cs asynchronously.
|
||||
|
||||
---
|
||||
dlls/wined3d/cs.c | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
dlls/wined3d/cs.c | 19 ++++++++++++++++++-
|
||||
1 file changed, 18 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
|
||||
index c8394533a86..a656c93684a 100644
|
||||
index 659cfdf7c3..73d5c48e86 100644
|
||||
--- a/dlls/wined3d/cs.c
|
||||
+++ b/dlls/wined3d/cs.c
|
||||
@@ -2637,7 +2637,7 @@ static void *wined3d_cs_mt_require_space(struct wined3d_cs *cs, size_t size)
|
||||
return data;
|
||||
}
|
||||
@@ -2333,6 +2333,23 @@ static void wined3d_cs_mt_submit(struct wined3d_cs *cs)
|
||||
|
||||
-/* static */ void wined3d_cs_mt_submit(struct wined3d_cs *cs)
|
||||
+static void wined3d_cs_mt_submit(struct wined3d_cs *cs)
|
||||
{
|
||||
if (cs->thread_id == GetCurrentThreadId())
|
||||
return wined3d_cs_st_submit(cs);
|
||||
@@ -2667,7 +2667,7 @@ static void wined3d_cs_mt_submit_and_wait(struct wined3d_cs *cs)
|
||||
static const struct wined3d_cs_ops wined3d_cs_mt_ops =
|
||||
if (InterlockedCompareExchange(&cs->waiting_for_event, FALSE, TRUE))
|
||||
SetEvent(cs->event);
|
||||
+}
|
||||
+
|
||||
+static void wined3d_cs_mt_submit_and_wait(struct wined3d_cs *cs)
|
||||
+{
|
||||
+ struct wined3d_cs_queue *queue = &cs->queue;
|
||||
+ struct wined3d_cs_packet *packet;
|
||||
+ size_t packet_size;
|
||||
+
|
||||
+ if (cs->thread_id == GetCurrentThreadId())
|
||||
+ return wined3d_cs_st_submit(cs);
|
||||
+
|
||||
+ packet = (struct wined3d_cs_packet *)&queue->data[queue->head];
|
||||
+ packet_size = FIELD_OFFSET(struct wined3d_cs_packet, data[packet->size]);
|
||||
+ InterlockedExchange(&queue->head, (queue->head + packet_size) & (WINED3D_CS_QUEUE_SIZE - 1));
|
||||
+
|
||||
+ if (InterlockedCompareExchange(&cs->waiting_for_event, FALSE, TRUE))
|
||||
+ SetEvent(cs->event);
|
||||
|
||||
while (!wined3d_cs_queue_is_empty(queue))
|
||||
wined3d_pause();
|
||||
@@ -2407,7 +2424,7 @@ static const struct wined3d_cs_ops wined3d_cs_mt_ops =
|
||||
{
|
||||
wined3d_cs_mt_require_space,
|
||||
- wined3d_cs_mt_submit_and_wait, /* FIXME */
|
||||
+ wined3d_cs_mt_submit,
|
||||
wined3d_cs_mt_submit_and_wait,
|
||||
wined3d_cs_mt_submit,
|
||||
- wined3d_cs_mt_submit,
|
||||
+ wined3d_cs_mt_submit_and_wait,
|
||||
wined3d_cs_mt_push_constants,
|
||||
};
|
||||
|
||||
--
|
||||
2.11.0
|
||||
2.12.2
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,78 +0,0 @@
|
||||
From 5325c69d1b31fd1cd22638c995a1684f1f05e823 Mon Sep 17 00:00:00 2001
|
||||
From: Sebastian Lackner <sebastian@fds-team.de>
|
||||
Date: Wed, 8 Feb 2017 00:40:59 +0100
|
||||
Subject: wined3d: Use priority queue for query polls.
|
||||
|
||||
---
|
||||
dlls/wined3d/cs.c | 6 +++++-
|
||||
dlls/wined3d/query.c | 3 +++
|
||||
dlls/wined3d/wined3d_private.h | 1 +
|
||||
3 files changed, 9 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
|
||||
index 3e7defdeb1b..a5a6fc0fa4a 100644
|
||||
--- a/dlls/wined3d/cs.c
|
||||
+++ b/dlls/wined3d/cs.c
|
||||
@@ -1694,6 +1694,8 @@ static UINT wined3d_cs_exec_query_issue(struct wined3d_cs *cs, const void *data)
|
||||
|
||||
query->query_ops->query_issue(query, op->flags);
|
||||
|
||||
+ InterlockedDecrement(&query->pending);
|
||||
+
|
||||
return sizeof(*op);
|
||||
}
|
||||
|
||||
@@ -1706,6 +1708,8 @@ void wined3d_cs_emit_query_issue(struct wined3d_cs *cs, struct wined3d_query *qu
|
||||
op->query = query;
|
||||
op->flags = flags;
|
||||
|
||||
+ InterlockedIncrement(&query->pending);
|
||||
+
|
||||
cs->ops->submit(cs);
|
||||
}
|
||||
|
||||
@@ -1724,7 +1728,7 @@ BOOL wined3d_cs_emit_query_poll(struct wined3d_cs *cs, struct wined3d_query *que
|
||||
struct wined3d_cs_query_poll *op;
|
||||
BOOL ret;
|
||||
|
||||
- op = cs->ops->require_space(cs, sizeof(*op), 0);
|
||||
+ op = cs->ops->require_space(cs, sizeof(*op), 1);
|
||||
op->opcode = WINED3D_CS_OP_QUERY_POLL;
|
||||
op->query = query;
|
||||
op->flags = flags;
|
||||
diff --git a/dlls/wined3d/query.c b/dlls/wined3d/query.c
|
||||
index 70603367894..2db6fa8c10d 100644
|
||||
--- a/dlls/wined3d/query.c
|
||||
+++ b/dlls/wined3d/query.c
|
||||
@@ -37,6 +37,7 @@ static void wined3d_query_init(struct wined3d_query *query, struct wined3d_devic
|
||||
query->data = data;
|
||||
query->data_size = data_size;
|
||||
query->query_ops = query_ops;
|
||||
+ query->pending = 0;
|
||||
}
|
||||
|
||||
static struct wined3d_event_query *wined3d_event_query_from_query(struct wined3d_query *query)
|
||||
@@ -350,6 +351,8 @@ HRESULT CDECL wined3d_query_get_data(struct wined3d_query *query,
|
||||
return WINED3DERR_INVALIDCALL;
|
||||
}
|
||||
|
||||
+ while (InterlockedCompareExchange(&query->pending, 0, 0));
|
||||
+
|
||||
if (!wined3d_cs_emit_query_poll(query->device->cs, query, flags))
|
||||
return S_FALSE;
|
||||
|
||||
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
|
||||
index 43b3146f6f8..ba371f13d8d 100644
|
||||
--- a/dlls/wined3d/wined3d_private.h
|
||||
+++ b/dlls/wined3d/wined3d_private.h
|
||||
@@ -1500,6 +1500,7 @@ struct wined3d_query
|
||||
const void *data;
|
||||
DWORD data_size;
|
||||
const struct wined3d_query_ops *query_ops;
|
||||
+ LONG pending;
|
||||
};
|
||||
|
||||
union wined3d_gl_query_object
|
||||
--
|
||||
2.11.0
|
||||
|
@ -1,164 +0,0 @@
|
||||
From c1afe12bb6d64352554ac5ca4e8599de2fae62f1 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Stefan=20D=C3=B6singer?= <stefan@codeweavers.com>
|
||||
Date: Thu, 24 Oct 2013 18:56:13 +0200
|
||||
Subject: wined3d: Use an event to block the worker thread when it is idle.
|
||||
|
||||
I could not find a canonical implementation for this. Suggestions are
|
||||
welcome.
|
||||
|
||||
The main goal was to avoid SetEvent / WaitForSingleObject / ResetEvent
|
||||
calls at all costs. They go straight to wineserver, bringing it to 25%
|
||||
CPU time and cutting framerates in half. Hence the extra BOOL to tell
|
||||
cs_submit when to set the event.
|
||||
|
||||
Finding the correct spin count is tricky. The value I set is high enough
|
||||
to prevent 3DMark2001 car chase high detail from waiting. This benchmark
|
||||
maps a lot of in-use managed buffers and thus waits for the CS. But what
|
||||
the ideal number is depends a lot on the game and CPU.
|
||||
|
||||
A better heuristic is needed. E.g. we could tell the worker thread when
|
||||
the main thread is waiting for a resource to become idle and avoid
|
||||
waiting for the event in that case. We may have to use POSIX
|
||||
synchronization primitives for efficiency. On the other hand, the
|
||||
current implementation probably still spins way too much for an
|
||||
application that throttles the framerate to 30 fps by waiting in its own
|
||||
code. So it is probably only good enough for Microsoft Powerpoint.
|
||||
|
||||
We should also think about blocking the main thread with events if it is
|
||||
waiting for the worker thread when waiting for resources, the swap
|
||||
counter or space in the command Stream. This should preserve power when
|
||||
vsync is turned on.
|
||||
---
|
||||
dlls/wined3d/cs.c | 47 ++++++++++++++++++++++++++++++++++++++++++
|
||||
dlls/wined3d/wined3d_private.h | 5 +++++
|
||||
2 files changed, 52 insertions(+)
|
||||
|
||||
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
|
||||
index 74b8b024cc3..c47d918b81e 100644
|
||||
--- a/dlls/wined3d/cs.c
|
||||
+++ b/dlls/wined3d/cs.c
|
||||
@@ -2542,9 +2542,33 @@ static struct wined3d_cs_block *wined3d_cs_list_dequeue(struct wined3d_cs_list *
|
||||
return LIST_ENTRY(head, struct wined3d_cs_block, entry);
|
||||
}
|
||||
|
||||
+static void wined3d_cs_wait_event(struct wined3d_cs *cs)
|
||||
+{
|
||||
+ InterlockedExchange(&cs->waiting_for_event, TRUE);
|
||||
+
|
||||
+ /* The main thread might enqueue a finish command and block on it
|
||||
+ * after the worker thread decided to enter wined3d_cs_wait_event
|
||||
+ * and before waiting_for_event was set to TRUE. Check again if
|
||||
+ * the queues are empty */
|
||||
+ if (cs->exec_list.count || cs->exec_prio_list.count)
|
||||
+ {
|
||||
+ /* The main thread might have signalled the event, or be in the process
|
||||
+ * of doing so. Wait for the event to reset it. ResetEvent is not good
|
||||
+ * because the main thread might be beween the waiting_for_event reset
|
||||
+ * and SignalEvent call. */
|
||||
+ if (!InterlockedCompareExchange(&cs->waiting_for_event, FALSE, TRUE))
|
||||
+ WaitForSingleObject(cs->event, INFINITE);
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ WaitForSingleObject(cs->event, INFINITE);
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
static struct wined3d_cs_block *wined3d_cs_dequeue_command(struct wined3d_cs *cs)
|
||||
{
|
||||
struct wined3d_cs_block *block;
|
||||
+ DWORD spin_count = 0;
|
||||
|
||||
/* FIXME: Use an event to wait after a couple of spins. */
|
||||
for (;;)
|
||||
@@ -2553,6 +2577,13 @@ static struct wined3d_cs_block *wined3d_cs_dequeue_command(struct wined3d_cs *cs
|
||||
return block;
|
||||
if ((block = wined3d_cs_list_dequeue(&cs->exec_list)))
|
||||
return block;
|
||||
+
|
||||
+ spin_count++;
|
||||
+ if (spin_count >= WINED3D_CS_SPIN_COUNT)
|
||||
+ {
|
||||
+ wined3d_cs_wait_event(cs);
|
||||
+ spin_count = 0;
|
||||
+ }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2633,6 +2664,9 @@ static void wined3d_cs_mt_submit(struct wined3d_cs *cs)
|
||||
block = cs->current_block;
|
||||
wined3d_cs_list_enqueue(block->list, block);
|
||||
cs->current_block = NULL;
|
||||
+
|
||||
+ if (InterlockedCompareExchange(&cs->waiting_for_event, FALSE, TRUE))
|
||||
+ SetEvent(cs->event);
|
||||
}
|
||||
|
||||
static void wined3d_cs_mt_submit_and_wait(struct wined3d_cs *cs)
|
||||
@@ -2648,6 +2682,9 @@ static void wined3d_cs_mt_submit_and_wait(struct wined3d_cs *cs)
|
||||
wined3d_cs_list_enqueue(block->list, block);
|
||||
cs->current_block = NULL;
|
||||
|
||||
+ if (InterlockedCompareExchange(&cs->waiting_for_event, FALSE, TRUE))
|
||||
+ SetEvent(cs->event);
|
||||
+
|
||||
/* A busy wait should be fine, we're not supposed to have to wait very
|
||||
* long. */
|
||||
while (!InterlockedCompareExchange(&fence, TRUE, TRUE));
|
||||
@@ -2747,6 +2784,14 @@ struct wined3d_cs *wined3d_cs_create(struct wined3d_device *device)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
+ if (!(cs->event = CreateEventW(NULL, FALSE, FALSE, NULL)))
|
||||
+ {
|
||||
+ state_cleanup(&cs->state);
|
||||
+ HeapFree(GetProcessHeap(), 0, cs->data);
|
||||
+ HeapFree(GetProcessHeap(), 0, cs);
|
||||
+ return NULL;
|
||||
+ }
|
||||
+
|
||||
if (wined3d_settings.cs_multithreaded)
|
||||
{
|
||||
cs->ops = &wined3d_cs_mt_ops;
|
||||
@@ -2759,6 +2804,7 @@ struct wined3d_cs *wined3d_cs_create(struct wined3d_device *device)
|
||||
{
|
||||
ERR("Failed to create wined3d command stream thread.\n");
|
||||
state_cleanup(&cs->state);
|
||||
+ CloseHandle(cs->event);
|
||||
HeapFree(GetProcessHeap(), 0, cs->fb.render_targets);
|
||||
HeapFree(GetProcessHeap(), 0, cs->data);
|
||||
HeapFree(GetProcessHeap(), 0, cs);
|
||||
@@ -2784,6 +2830,7 @@ void wined3d_cs_destroy(struct wined3d_cs *cs)
|
||||
wined3d_cs_list_cleanup(&cs->free_list);
|
||||
}
|
||||
|
||||
+ CloseHandle(cs->event);
|
||||
HeapFree(GetProcessHeap(), 0, cs->fb.render_targets);
|
||||
HeapFree(GetProcessHeap(), 0, cs->data);
|
||||
HeapFree(GetProcessHeap(), 0, cs);
|
||||
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
|
||||
index c1919b314bc..e71dfbb2ca8 100644
|
||||
--- a/dlls/wined3d/wined3d_private.h
|
||||
+++ b/dlls/wined3d/wined3d_private.h
|
||||
@@ -3218,6 +3218,8 @@ struct wined3d_cs_ops
|
||||
void (*submit_and_wait)(struct wined3d_cs *cs);
|
||||
};
|
||||
|
||||
+#define WINED3D_CS_SPIN_COUNT 10000000
|
||||
+
|
||||
struct wined3d_cs
|
||||
{
|
||||
const struct wined3d_cs_ops *ops;
|
||||
@@ -3236,6 +3238,9 @@ struct wined3d_cs
|
||||
struct wined3d_cs_list exec_prio_list;
|
||||
|
||||
LONG pending_presents;
|
||||
+
|
||||
+ HANDLE event;
|
||||
+ BOOL waiting_for_event;
|
||||
};
|
||||
|
||||
static inline void wined3d_resource_wait_idle(struct wined3d_resource *resource)
|
||||
--
|
||||
2.11.0
|
||||
|
@ -1,307 +0,0 @@
|
||||
From 52300fd0f8d10adaab547cb7195168be253f2d1d Mon Sep 17 00:00:00 2001
|
||||
From: Sebastian Lackner <sebastian@fds-team.de>
|
||||
Date: Wed, 8 Feb 2017 12:32:55 +0100
|
||||
Subject: wined3d: Do not immediately submit stateblock updates.
|
||||
|
||||
---
|
||||
dlls/wined3d/cs.c | 63 +++++++++++++++++++++++-------------------
|
||||
dlls/wined3d/wined3d_private.h | 1 +
|
||||
2 files changed, 36 insertions(+), 28 deletions(-)
|
||||
|
||||
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
|
||||
index 209d34fc9d..273ff7cd6c 100644
|
||||
--- a/dlls/wined3d/cs.c
|
||||
+++ b/dlls/wined3d/cs.c
|
||||
@@ -880,7 +880,7 @@ void wined3d_cs_emit_set_predication(struct wined3d_cs *cs, struct wined3d_query
|
||||
op->predicate = predicate;
|
||||
op->value = value;
|
||||
|
||||
- cs->ops->submit(cs);
|
||||
+ cs->ops->submit_delayed(cs);
|
||||
}
|
||||
|
||||
static UINT wined3d_cs_exec_set_viewport(struct wined3d_cs *cs, const void *data)
|
||||
@@ -901,7 +901,7 @@ void wined3d_cs_emit_set_viewport(struct wined3d_cs *cs, const struct wined3d_vi
|
||||
op->opcode = WINED3D_CS_OP_SET_VIEWPORT;
|
||||
op->viewport = *viewport;
|
||||
|
||||
- cs->ops->submit(cs);
|
||||
+ cs->ops->submit_delayed(cs);
|
||||
}
|
||||
|
||||
static UINT wined3d_cs_exec_set_scissor_rect(struct wined3d_cs *cs, const void *data)
|
||||
@@ -922,7 +922,7 @@ void wined3d_cs_emit_set_scissor_rect(struct wined3d_cs *cs, const RECT *rect)
|
||||
op->opcode = WINED3D_CS_OP_SET_SCISSOR_RECT;
|
||||
op->rect = *rect;
|
||||
|
||||
- cs->ops->submit(cs);
|
||||
+ cs->ops->submit_delayed(cs);
|
||||
}
|
||||
|
||||
static UINT wined3d_cs_exec_set_rendertarget_view(struct wined3d_cs *cs, const void *data)
|
||||
@@ -945,7 +945,7 @@ void wined3d_cs_emit_set_rendertarget_view(struct wined3d_cs *cs, unsigned int v
|
||||
op->view_idx = view_idx;
|
||||
op->view = view;
|
||||
|
||||
- cs->ops->submit(cs);
|
||||
+ cs->ops->submit_delayed(cs);
|
||||
}
|
||||
|
||||
static UINT wined3d_cs_exec_set_depth_stencil_view(struct wined3d_cs *cs, const void *data)
|
||||
@@ -995,7 +995,7 @@ void wined3d_cs_emit_set_depth_stencil_view(struct wined3d_cs *cs, struct wined3
|
||||
op->opcode = WINED3D_CS_OP_SET_DEPTH_STENCIL_VIEW;
|
||||
op->view = view;
|
||||
|
||||
- cs->ops->submit(cs);
|
||||
+ cs->ops->submit_delayed(cs);
|
||||
}
|
||||
|
||||
static UINT wined3d_cs_exec_set_vertex_declaration(struct wined3d_cs *cs, const void *data)
|
||||
@@ -1016,7 +1016,7 @@ void wined3d_cs_emit_set_vertex_declaration(struct wined3d_cs *cs, struct wined3
|
||||
op->opcode = WINED3D_CS_OP_SET_VERTEX_DECLARATION;
|
||||
op->declaration = declaration;
|
||||
|
||||
- cs->ops->submit(cs);
|
||||
+ cs->ops->submit_delayed(cs);
|
||||
}
|
||||
|
||||
static UINT wined3d_cs_exec_set_stream_source(struct wined3d_cs *cs, const void *data)
|
||||
@@ -1053,7 +1053,7 @@ void wined3d_cs_emit_set_stream_source(struct wined3d_cs *cs, UINT stream_idx,
|
||||
op->offset = offset;
|
||||
op->stride = stride;
|
||||
|
||||
- cs->ops->submit(cs);
|
||||
+ cs->ops->submit_delayed(cs);
|
||||
}
|
||||
|
||||
static UINT wined3d_cs_exec_set_stream_source_freq(struct wined3d_cs *cs, const void *data)
|
||||
@@ -1080,7 +1080,7 @@ void wined3d_cs_emit_set_stream_source_freq(struct wined3d_cs *cs, UINT stream_i
|
||||
op->frequency = frequency;
|
||||
op->flags = flags;
|
||||
|
||||
- cs->ops->submit(cs);
|
||||
+ cs->ops->submit_delayed(cs);
|
||||
}
|
||||
|
||||
static UINT wined3d_cs_exec_set_stream_output(struct wined3d_cs *cs, const void *data)
|
||||
@@ -1115,7 +1115,7 @@ void wined3d_cs_emit_set_stream_output(struct wined3d_cs *cs, UINT stream_idx,
|
||||
op->buffer = buffer;
|
||||
op->offset = offset;
|
||||
|
||||
- cs->ops->submit(cs);
|
||||
+ cs->ops->submit_delayed(cs);
|
||||
}
|
||||
|
||||
static UINT wined3d_cs_exec_set_index_buffer(struct wined3d_cs *cs, const void *data)
|
||||
@@ -1149,7 +1149,7 @@ void wined3d_cs_emit_set_index_buffer(struct wined3d_cs *cs, struct wined3d_buff
|
||||
op->format_id = format_id;
|
||||
op->offset = offset;
|
||||
|
||||
- cs->ops->submit(cs);
|
||||
+ cs->ops->submit_delayed(cs);
|
||||
}
|
||||
|
||||
static UINT wined3d_cs_exec_set_constant_buffer(struct wined3d_cs *cs, const void *data)
|
||||
@@ -1180,7 +1180,7 @@ void wined3d_cs_emit_set_constant_buffer(struct wined3d_cs *cs, enum wined3d_sha
|
||||
op->cb_idx = cb_idx;
|
||||
op->buffer = buffer;
|
||||
|
||||
- cs->ops->submit(cs);
|
||||
+ cs->ops->submit_delayed(cs);
|
||||
}
|
||||
|
||||
static UINT wined3d_cs_exec_set_texture(struct wined3d_cs *cs, const void *data)
|
||||
@@ -1273,7 +1273,7 @@ void wined3d_cs_emit_set_texture(struct wined3d_cs *cs, UINT stage, struct wined
|
||||
op->stage = stage;
|
||||
op->texture = texture;
|
||||
|
||||
- cs->ops->submit(cs);
|
||||
+ cs->ops->submit_delayed(cs);
|
||||
}
|
||||
|
||||
static UINT wined3d_cs_exec_set_shader_resource_view(struct wined3d_cs *cs, const void *data)
|
||||
@@ -1308,7 +1308,7 @@ void wined3d_cs_emit_set_shader_resource_view(struct wined3d_cs *cs, enum wined3
|
||||
op->view_idx = view_idx;
|
||||
op->view = view;
|
||||
|
||||
- cs->ops->submit(cs);
|
||||
+ cs->ops->submit_delayed(cs);
|
||||
}
|
||||
|
||||
static UINT wined3d_cs_exec_set_unordered_access_view(struct wined3d_cs *cs, const void *data)
|
||||
@@ -1340,7 +1340,7 @@ void wined3d_cs_emit_set_unordered_access_view(struct wined3d_cs *cs, enum wined
|
||||
op->view_idx = view_idx;
|
||||
op->view = view;
|
||||
|
||||
- cs->ops->submit(cs);
|
||||
+ cs->ops->submit_delayed(cs);
|
||||
}
|
||||
|
||||
static UINT wined3d_cs_exec_set_sampler(struct wined3d_cs *cs, const void *data)
|
||||
@@ -1367,7 +1367,7 @@ void wined3d_cs_emit_set_sampler(struct wined3d_cs *cs, enum wined3d_shader_type
|
||||
op->sampler_idx = sampler_idx;
|
||||
op->sampler = sampler;
|
||||
|
||||
- cs->ops->submit(cs);
|
||||
+ cs->ops->submit_delayed(cs);
|
||||
}
|
||||
|
||||
static UINT wined3d_cs_exec_set_shader(struct wined3d_cs *cs, const void *data)
|
||||
@@ -1393,7 +1393,7 @@ void wined3d_cs_emit_set_shader(struct wined3d_cs *cs, enum wined3d_shader_type
|
||||
op->type = type;
|
||||
op->shader = shader;
|
||||
|
||||
- cs->ops->submit(cs);
|
||||
+ cs->ops->submit_delayed(cs);
|
||||
}
|
||||
|
||||
static UINT wined3d_cs_exec_set_rasterizer_state(struct wined3d_cs *cs, const void *data)
|
||||
@@ -1415,7 +1415,7 @@ void wined3d_cs_emit_set_rasterizer_state(struct wined3d_cs *cs,
|
||||
op->opcode = WINED3D_CS_OP_SET_RASTERIZER_STATE;
|
||||
op->state = rasterizer_state;
|
||||
|
||||
- cs->ops->submit(cs);
|
||||
+ cs->ops->submit_delayed(cs);
|
||||
}
|
||||
|
||||
static UINT wined3d_cs_exec_set_render_state(struct wined3d_cs *cs, const void *data)
|
||||
@@ -1437,7 +1437,7 @@ void wined3d_cs_emit_set_render_state(struct wined3d_cs *cs, enum wined3d_render
|
||||
op->state = state;
|
||||
op->value = value;
|
||||
|
||||
- cs->ops->submit(cs);
|
||||
+ cs->ops->submit_delayed(cs);
|
||||
}
|
||||
|
||||
static UINT wined3d_cs_exec_set_texture_state(struct wined3d_cs *cs, const void *data)
|
||||
@@ -1461,7 +1461,7 @@ void wined3d_cs_emit_set_texture_state(struct wined3d_cs *cs, UINT stage,
|
||||
op->state = state;
|
||||
op->value = value;
|
||||
|
||||
- cs->ops->submit(cs);
|
||||
+ cs->ops->submit_delayed(cs);
|
||||
}
|
||||
|
||||
static UINT wined3d_cs_exec_set_sampler_state(struct wined3d_cs *cs, const void *data)
|
||||
@@ -1485,7 +1485,7 @@ void wined3d_cs_emit_set_sampler_state(struct wined3d_cs *cs, UINT sampler_idx,
|
||||
op->state = state;
|
||||
op->value = value;
|
||||
|
||||
- cs->ops->submit(cs);
|
||||
+ cs->ops->submit_delayed(cs);
|
||||
}
|
||||
|
||||
static UINT wined3d_cs_exec_set_transform(struct wined3d_cs *cs, const void *data)
|
||||
@@ -1509,7 +1509,7 @@ void wined3d_cs_emit_set_transform(struct wined3d_cs *cs, enum wined3d_transform
|
||||
op->state = state;
|
||||
op->matrix = *matrix;
|
||||
|
||||
- cs->ops->submit(cs);
|
||||
+ cs->ops->submit_delayed(cs);
|
||||
}
|
||||
|
||||
static UINT wined3d_cs_exec_set_clip_plane(struct wined3d_cs *cs, const void *data)
|
||||
@@ -1531,7 +1531,7 @@ void wined3d_cs_emit_set_clip_plane(struct wined3d_cs *cs, UINT plane_idx, const
|
||||
op->plane_idx = plane_idx;
|
||||
op->plane = *plane;
|
||||
|
||||
- cs->ops->submit(cs);
|
||||
+ cs->ops->submit_delayed(cs);
|
||||
}
|
||||
|
||||
static UINT wined3d_cs_exec_set_color_key(struct wined3d_cs *cs, const void *data)
|
||||
@@ -1616,7 +1616,7 @@ void wined3d_cs_emit_set_color_key(struct wined3d_cs *cs, struct wined3d_texture
|
||||
else
|
||||
op->set = 0;
|
||||
|
||||
- cs->ops->submit(cs);
|
||||
+ cs->ops->submit_delayed(cs);
|
||||
}
|
||||
|
||||
static UINT wined3d_cs_exec_set_material(struct wined3d_cs *cs, const void *data)
|
||||
@@ -1637,7 +1637,7 @@ void wined3d_cs_emit_set_material(struct wined3d_cs *cs, const struct wined3d_ma
|
||||
op->opcode = WINED3D_CS_OP_SET_MATERIAL;
|
||||
op->material = *material;
|
||||
|
||||
- cs->ops->submit(cs);
|
||||
+ cs->ops->submit_delayed(cs);
|
||||
}
|
||||
|
||||
static UINT wined3d_cs_exec_set_light(struct wined3d_cs *cs, const void *data)
|
||||
@@ -1687,7 +1687,7 @@ void wined3d_cs_emit_set_light(struct wined3d_cs *cs, const struct wined3d_light
|
||||
op->opcode = WINED3D_CS_OP_SET_LIGHT;
|
||||
op->light = *light;
|
||||
|
||||
- cs->ops->submit(cs);
|
||||
+ cs->ops->submit_delayed(cs);
|
||||
}
|
||||
|
||||
static UINT wined3d_cs_exec_set_light_enable(struct wined3d_cs *cs, const void *data)
|
||||
@@ -1723,7 +1723,7 @@ void wined3d_cs_emit_set_light_enable(struct wined3d_cs *cs, unsigned int idx, B
|
||||
op->idx = idx;
|
||||
op->enable = enable;
|
||||
|
||||
- cs->ops->submit(cs);
|
||||
+ cs->ops->submit_delayed(cs);
|
||||
}
|
||||
|
||||
static UINT wined3d_cs_exec_reset_state(struct wined3d_cs *cs, const void *data)
|
||||
@@ -1745,7 +1745,7 @@ void wined3d_cs_emit_reset_state(struct wined3d_cs *cs)
|
||||
op = cs->ops->require_space(cs, sizeof(*op), 0);
|
||||
op->opcode = WINED3D_CS_OP_RESET_STATE;
|
||||
|
||||
- cs->ops->submit(cs);
|
||||
+ cs->ops->submit_delayed(cs);
|
||||
}
|
||||
|
||||
static UINT wined3d_cs_exec_callback(struct wined3d_cs *cs, const void *data)
|
||||
@@ -2255,7 +2255,7 @@ void wined3d_cs_emit_push_constants(struct wined3d_cs *cs, enum wined3d_push_con
|
||||
op->count = count;
|
||||
memcpy(op->constants, constants, count * push_constant_info[p].size);
|
||||
|
||||
- cs->ops->submit(cs);
|
||||
+ cs->ops->submit_delayed(cs);
|
||||
}
|
||||
|
||||
static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void *data) =
|
||||
@@ -2355,6 +2355,7 @@ static const struct wined3d_cs_ops wined3d_cs_st_ops =
|
||||
wined3d_cs_st_require_space,
|
||||
wined3d_cs_st_submit,
|
||||
wined3d_cs_st_submit,
|
||||
+ wined3d_cs_st_submit,
|
||||
};
|
||||
|
||||
static void wined3d_cs_list_enqueue(struct wined3d_cs_list *list, struct wined3d_cs_block *block)
|
||||
@@ -2531,11 +2532,17 @@ static void wined3d_cs_mt_submit_and_wait(struct wined3d_cs *cs)
|
||||
while (!InterlockedCompareExchange(&fence, TRUE, TRUE));
|
||||
}
|
||||
|
||||
+static void wined3d_cs_mt_submit_delayed(struct wined3d_cs *cs)
|
||||
+{
|
||||
+ assert(cs->thread_id != GetCurrentThreadId());
|
||||
+}
|
||||
+
|
||||
static const struct wined3d_cs_ops wined3d_cs_mt_ops =
|
||||
{
|
||||
wined3d_cs_mt_require_space,
|
||||
wined3d_cs_mt_submit,
|
||||
wined3d_cs_mt_submit_and_wait,
|
||||
+ wined3d_cs_mt_submit_delayed,
|
||||
};
|
||||
|
||||
static void wined3d_cs_mt_emit_stop(struct wined3d_cs *cs)
|
||||
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
|
||||
index fadb4bc152..f245e6f24e 100644
|
||||
--- a/dlls/wined3d/wined3d_private.h
|
||||
+++ b/dlls/wined3d/wined3d_private.h
|
||||
@@ -3256,6 +3256,7 @@ struct wined3d_cs_ops
|
||||
void *(*require_space)(struct wined3d_cs *cs, size_t size, int priority);
|
||||
void (*submit)(struct wined3d_cs *cs);
|
||||
void (*submit_and_wait)(struct wined3d_cs *cs);
|
||||
+ void (*submit_delayed)(struct wined3d_cs *cs);
|
||||
};
|
||||
|
||||
#define WINED3D_CS_SPIN_COUNT 10000000
|
||||
--
|
||||
2.11.0
|
||||
|
@ -1,25 +0,0 @@
|
||||
From 859730a4ab49d0d1da04a96d4b636e5709fe1a10 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
|
||||
Date: Sun, 12 Feb 2017 15:40:54 +0100
|
||||
Subject: wined3d: Use spin lock for cs list critical sections.
|
||||
|
||||
---
|
||||
dlls/wined3d/cs.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
|
||||
index 7ee2fe18f49..41167f49ace 100644
|
||||
--- a/dlls/wined3d/cs.c
|
||||
+++ b/dlls/wined3d/cs.c
|
||||
@@ -2553,7 +2553,7 @@ static struct wined3d_cs_block *wined3d_cs_dequeue_command(struct wined3d_cs *cs
|
||||
|
||||
static void wined3d_cs_list_init(struct wined3d_cs_list *list)
|
||||
{
|
||||
- InitializeCriticalSection(&list->lock);
|
||||
+ InitializeCriticalSectionAndSpinCount(&list->lock, WINED3D_CS_SPIN_COUNT);
|
||||
list->lock.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": wined3d_cs_list_lock");
|
||||
|
||||
list_init(&list->blocks);
|
||||
--
|
||||
2.11.0
|
||||
|
@ -1,64 +0,0 @@
|
||||
From 6e41725a162f9ad5acc17733be62667570435c5a Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
|
||||
Date: Sat, 18 Feb 2017 00:45:39 +0100
|
||||
Subject: wined3d: Don't wait for events that have not been issued yet.
|
||||
|
||||
---
|
||||
dlls/wined3d/cs.c | 4 ++++
|
||||
dlls/wined3d/query.c | 6 +++++-
|
||||
dlls/wined3d/wined3d_private.h | 1 +
|
||||
3 files changed, 10 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
|
||||
index 91089ff9df..4086e3c7f3 100644
|
||||
--- a/dlls/wined3d/cs.c
|
||||
+++ b/dlls/wined3d/cs.c
|
||||
@@ -1784,11 +1784,15 @@ static UINT wined3d_cs_exec_query_issue(struct wined3d_cs *cs, const void *data)
|
||||
{
|
||||
const struct wined3d_cs_query_issue *op = data;
|
||||
struct wined3d_query *query = op->query;
|
||||
+ struct wined3d_context *context;
|
||||
|
||||
query->query_ops->query_issue(query, op->flags);
|
||||
|
||||
InterlockedDecrement(&query->pending);
|
||||
|
||||
+ if (query->flush && (context = context_get_current()))
|
||||
+ context->gl_info->gl_ops.gl.p_glFlush();
|
||||
+
|
||||
return sizeof(*op);
|
||||
}
|
||||
|
||||
diff --git a/dlls/wined3d/query.c b/dlls/wined3d/query.c
|
||||
index 2db6fa8c10..d6264cec01 100644
|
||||
--- a/dlls/wined3d/query.c
|
||||
+++ b/dlls/wined3d/query.c
|
||||
@@ -351,8 +351,12 @@ HRESULT CDECL wined3d_query_get_data(struct wined3d_query *query,
|
||||
return WINED3DERR_INVALIDCALL;
|
||||
}
|
||||
|
||||
- while (InterlockedCompareExchange(&query->pending, 0, 0));
|
||||
+ if (flags & WINED3DGETDATA_FLUSH)
|
||||
+ query->flush = TRUE;
|
||||
+ if (InterlockedCompareExchange(&query->pending, 0, 0))
|
||||
+ return S_FALSE;
|
||||
|
||||
+ query->flush = FALSE;
|
||||
if (!wined3d_cs_emit_query_poll(query->device->cs, query, flags))
|
||||
return S_FALSE;
|
||||
|
||||
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
|
||||
index 747153e24f..69c3f9b48c 100644
|
||||
--- a/dlls/wined3d/wined3d_private.h
|
||||
+++ b/dlls/wined3d/wined3d_private.h
|
||||
@@ -1507,6 +1507,7 @@ struct wined3d_query
|
||||
DWORD data_size;
|
||||
const struct wined3d_query_ops *query_ops;
|
||||
LONG pending;
|
||||
+ BOOL flush;
|
||||
};
|
||||
|
||||
union wined3d_gl_query_object
|
||||
--
|
||||
2.11.0
|
||||
|
@ -1,23 +1,19 @@
|
||||
From 3d756295634736a4685f5a672e47e4dcaaf44908 Mon Sep 17 00:00:00 2001
|
||||
From 10c158a6010bc2aa8699701626fbba3945e50611 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
|
||||
Date: Mon, 20 Feb 2017 00:27:25 +0100
|
||||
Subject: wined3d: Improve wined3d_cs_emit_update_sub_resource.
|
||||
|
||||
---
|
||||
dlls/wined3d/cs.c | 49 ++++++++++++++++++++++++++++++++++++++++++++++++-
|
||||
dlls/wined3d/device.c | 2 --
|
||||
2 files changed, 48 insertions(+), 3 deletions(-)
|
||||
dlls/wined3d/cs.c | 68 ++++++++++++++++++++++++++++++++++++++++++
|
||||
dlls/wined3d/device.c | 2 --
|
||||
dlls/wined3d/wined3d_private.h | 1 +
|
||||
3 files changed, 69 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
|
||||
index 0bc2a59d2e..27ec9dc130 100644
|
||||
index 1d5e221292..cf3ea9f9ab 100644
|
||||
--- a/dlls/wined3d/cs.c
|
||||
+++ b/dlls/wined3d/cs.c
|
||||
@@ -393,10 +393,12 @@ struct wined3d_cs_blt_sub_resource
|
||||
struct wined3d_cs_update_sub_resource
|
||||
{
|
||||
enum wined3d_cs_op opcode;
|
||||
+ unsigned int size;
|
||||
struct wined3d_resource *resource;
|
||||
@@ -406,6 +406,7 @@ struct wined3d_cs_update_sub_resource
|
||||
unsigned int sub_resource_idx;
|
||||
struct wined3d_box box;
|
||||
struct wined3d_sub_resource_data data;
|
||||
@ -25,16 +21,7 @@ index 0bc2a59d2e..27ec9dc130 100644
|
||||
};
|
||||
|
||||
struct wined3d_cs_add_dirty_texture_region
|
||||
@@ -2147,7 +2149,7 @@ static UINT wined3d_cs_exec_update_sub_resource(struct wined3d_cs *cs, const voi
|
||||
|
||||
done:
|
||||
wined3d_resource_release(op->resource);
|
||||
- return sizeof(*op);
|
||||
+ return op->size;
|
||||
}
|
||||
|
||||
void wined3d_cs_emit_update_sub_resource(struct wined3d_cs *cs, struct wined3d_resource *resource,
|
||||
@@ -2155,9 +2157,54 @@ void wined3d_cs_emit_update_sub_resource(struct wined3d_cs *cs, struct wined3d_r
|
||||
@@ -2149,6 +2150,49 @@ void wined3d_cs_emit_update_sub_resource(struct wined3d_cs *cs, struct wined3d_r
|
||||
unsigned int slice_pitch)
|
||||
{
|
||||
struct wined3d_cs_update_sub_resource *op;
|
||||
@ -61,12 +48,11 @@ index 0bc2a59d2e..27ec9dc130 100644
|
||||
+ }
|
||||
+
|
||||
+ size = FIELD_OFFSET(struct wined3d_cs_update_sub_resource, copy_data[data_size]);
|
||||
+ if (size > sizeof(cs->current_block->data))
|
||||
+ if (!cs->ops->check_space(cs, size, 0))
|
||||
+ goto no_async;
|
||||
+
|
||||
+ op = cs->ops->require_space(cs, size, 0);
|
||||
+ op->opcode = WINED3D_CS_OP_UPDATE_SUB_RESOURCE;
|
||||
+ op->size = size;
|
||||
+ op->resource = resource;
|
||||
+ op->sub_resource_idx = sub_resource_idx;
|
||||
+ op->box = *box;
|
||||
@ -85,15 +71,63 @@ index 0bc2a59d2e..27ec9dc130 100644
|
||||
|
||||
op = cs->ops->require_space(cs, sizeof(*op), 1);
|
||||
op->opcode = WINED3D_CS_OP_UPDATE_SUB_RESOURCE;
|
||||
+ op->size = sizeof(*op);
|
||||
op->resource = resource;
|
||||
op->sub_resource_idx = sub_resource_idx;
|
||||
op->box = *box;
|
||||
@@ -2258,6 +2302,11 @@ static void (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void
|
||||
/* WINED3D_CS_OP_ADD_DIRTY_TEXTURE_REGION */ wined3d_cs_exec_add_dirty_texture_region,
|
||||
};
|
||||
|
||||
+static BOOL wined3d_cs_st_check_space(struct wined3d_cs *cs, size_t size, int priority)
|
||||
+{
|
||||
+ return TRUE;
|
||||
+}
|
||||
+
|
||||
static void *wined3d_cs_st_require_space(struct wined3d_cs *cs, size_t size, int priority)
|
||||
{
|
||||
if (size > (cs->data_size - cs->end))
|
||||
@@ -2307,6 +2356,7 @@ static void wined3d_cs_st_submit(struct wined3d_cs *cs)
|
||||
|
||||
static const struct wined3d_cs_ops wined3d_cs_st_ops =
|
||||
{
|
||||
+ wined3d_cs_st_check_space,
|
||||
wined3d_cs_st_require_space,
|
||||
wined3d_cs_st_submit,
|
||||
wined3d_cs_st_submit,
|
||||
@@ -2355,6 +2405,23 @@ static void wined3d_cs_mt_submit_and_wait(struct wined3d_cs *cs)
|
||||
wined3d_pause();
|
||||
}
|
||||
|
||||
+static BOOL wined3d_cs_mt_check_space(struct wined3d_cs *cs, size_t size, int priority)
|
||||
+{
|
||||
+ struct wined3d_cs_queue *queue = priority ? &cs->prio_queue : &cs->norm_queue;
|
||||
+ size_t queue_size = ARRAY_SIZE(queue->data);
|
||||
+ size_t header_size, packet_size, remaining;
|
||||
+
|
||||
+ if (cs->thread_id == GetCurrentThreadId())
|
||||
+ return wined3d_cs_st_check_space(cs, size, priority);
|
||||
+
|
||||
+ header_size = FIELD_OFFSET(struct wined3d_cs_packet, data[0]);
|
||||
+ size = (size + header_size - 1) & ~(header_size - 1);
|
||||
+ packet_size = FIELD_OFFSET(struct wined3d_cs_packet, data[size]);
|
||||
+
|
||||
+ remaining = queue_size - queue->head;
|
||||
+ return (remaining >= packet_size);
|
||||
+}
|
||||
+
|
||||
static void *wined3d_cs_mt_require_space(struct wined3d_cs *cs, size_t size, int priority)
|
||||
{
|
||||
struct wined3d_cs_queue *queue = priority ? &cs->prio_queue : &cs->norm_queue;
|
||||
@@ -2423,6 +2490,7 @@ static void *wined3d_cs_mt_require_space(struct wined3d_cs *cs, size_t size, int
|
||||
|
||||
static const struct wined3d_cs_ops wined3d_cs_mt_ops =
|
||||
{
|
||||
+ wined3d_cs_mt_check_space,
|
||||
wined3d_cs_mt_require_space,
|
||||
wined3d_cs_mt_submit,
|
||||
wined3d_cs_mt_submit_and_wait,
|
||||
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
|
||||
index 170215b944..a642f77b58 100644
|
||||
index e3fd896e39..5fceafdb13 100644
|
||||
--- a/dlls/wined3d/device.c
|
||||
+++ b/dlls/wined3d/device.c
|
||||
@@ -4115,8 +4115,6 @@ void CDECL wined3d_device_update_sub_resource(struct wined3d_device *device, str
|
||||
@@ -4119,8 +4119,6 @@ void CDECL wined3d_device_update_sub_resource(struct wined3d_device *device, str
|
||||
TRACE("device %p, resource %p, sub_resource_idx %u, box %s, data %p, row_pitch %u, depth_pitch %u.\n",
|
||||
device, resource, sub_resource_idx, debug_box(box), data, row_pitch, depth_pitch);
|
||||
|
||||
@ -102,6 +136,18 @@ index 170215b944..a642f77b58 100644
|
||||
if (resource->type == WINED3D_RTYPE_BUFFER)
|
||||
{
|
||||
if (sub_resource_idx > 0)
|
||||
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
|
||||
index 8f6d720902..f0b07a6a64 100644
|
||||
--- a/dlls/wined3d/wined3d_private.h
|
||||
+++ b/dlls/wined3d/wined3d_private.h
|
||||
@@ -3258,6 +3258,7 @@ struct wined3d_cs_queue
|
||||
|
||||
struct wined3d_cs_ops
|
||||
{
|
||||
+ BOOL (*check_space)(struct wined3d_cs *cs, size_t size, int priority);
|
||||
void *(*require_space)(struct wined3d_cs *cs, size_t size, int priority);
|
||||
void (*submit)(struct wined3d_cs *cs);
|
||||
void (*submit_and_wait)(struct wined3d_cs *cs);
|
||||
--
|
||||
2.11.0
|
||||
2.12.2
|
||||
|
||||
|
@ -1,49 +0,0 @@
|
||||
From e7bbfe3b2bac3311d455b16b7f67ae1fec4f3c1f Mon Sep 17 00:00:00 2001
|
||||
From: Sebastian Lackner <sebastian@fds-team.de>
|
||||
Date: Thu, 23 Feb 2017 02:22:46 +0100
|
||||
Subject: wined3d: Enforce a memory limit of about 16 MB for CSMT blocks.
|
||||
|
||||
---
|
||||
dlls/wined3d/cs.c | 10 ++++++----
|
||||
dlls/wined3d/wined3d_private.h | 1 +
|
||||
2 files changed, 7 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
|
||||
index b5b2d94e619..ce0306bdb71 100644
|
||||
--- a/dlls/wined3d/cs.c
|
||||
+++ b/dlls/wined3d/cs.c
|
||||
@@ -2713,13 +2713,15 @@ static struct wined3d_cs_block *wined3d_cs_get_block(struct wined3d_cs *cs, stru
|
||||
{
|
||||
struct wined3d_cs_block *block;
|
||||
|
||||
- if (!(block = wined3d_cs_list_dequeue(&cs->free_list)))
|
||||
+ while (!(block = wined3d_cs_list_dequeue(&cs->free_list)))
|
||||
{
|
||||
- if (!(block = HeapAlloc(GetProcessHeap(), 0, sizeof(*block))))
|
||||
+ if (cs->num_blocks < 1024 && /* limit memory usage to about 16 MB */
|
||||
+ (block = HeapAlloc(GetProcessHeap(), 0, sizeof(*block))))
|
||||
{
|
||||
- ERR("Failed to get new block.\n");
|
||||
- return NULL;
|
||||
+ cs->num_blocks++;
|
||||
+ break;
|
||||
}
|
||||
+ while (!InterlockedCompareExchange(&cs->free_list.count, 0, 0));
|
||||
}
|
||||
|
||||
block->pos = 0;
|
||||
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
|
||||
index 74032096a60..ad999649965 100644
|
||||
--- a/dlls/wined3d/wined3d_private.h
|
||||
+++ b/dlls/wined3d/wined3d_private.h
|
||||
@@ -3252,6 +3252,7 @@ struct wined3d_cs
|
||||
struct wined3d_cs_list free_list;
|
||||
struct wined3d_cs_list exec_list;
|
||||
struct wined3d_cs_list exec_prio_list;
|
||||
+ LONG num_blocks;
|
||||
|
||||
LONG pending_presents;
|
||||
|
||||
--
|
||||
2.11.0
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -5,7 +5,6 @@ Fixes: [11674] Support for CSMT (command stream) to increase graphic performance
|
||||
Apply-After: dlls/wined3d/*
|
||||
Depends: wined3d-CSMT_Helper
|
||||
IfDefined: STAGING_CSMT
|
||||
Disabled: true
|
||||
|
||||
# Known issues:
|
||||
# https://bugs.wine-staging.com/buglist.cgi?component=Bugs&keywords=csmt%2C%20&keywords_type=allwords&list_id=3690&query_format=advanced&resolution=---
|
||||
|
Loading…
x
Reference in New Issue
Block a user