wined3d-CSMT_Main: Rebase to upstream changes.

This commit is contained in:
Sebastian Lackner 2017-02-19 07:57:04 +01:00
parent 81e2fbadc8
commit 884a25c8bf
65 changed files with 2837 additions and 5133 deletions

View File

@ -399,6 +399,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_GTX_560M="$1"
enable_wined3d_Limit_Vram="$1"
@ -1407,6 +1408,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"
;;
@ -1943,10 +1947,20 @@ 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."
fi
if test "$enable_d3d9_Tests" -gt 1; then
abort "Patchset d3d9-Tests disabled, but wined3d-CSMT_Helper depends on that."
fi
if test "$enable_makedep_PARENTSPEC" -gt 1; then
abort "Patchset makedep-PARENTSPEC disabled, but wined3d-CSMT_Helper depends on that."
fi
@ -1975,6 +1989,7 @@ if test "$enable_wined3d_CSMT_Helper" -eq 1; then
abort "Patchset wined3d-Silence_FIXMEs disabled, but wined3d-CSMT_Helper depends on that."
fi
enable_d3d11_Deferred_Context=1
enable_d3d9_Tests=1
enable_makedep_PARENTSPEC=1
enable_ntdll_DllRedirects=1
enable_wined3d_1DTextures=1
@ -8254,7 +8269,7 @@ fi
# Patchset wined3d-CSMT_Helper
# |
# | This patchset has the following (direct or indirect) dependencies:
# | * d3d11-Deferred_Context, makedep-PARENTSPEC, ntdll-Attach_Process_DLLs, ntdll-DllOverrides_WOW64, ntdll-
# | * 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
# |
@ -8330,6 +8345,72 @@ 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/d3d10core/tests/device.c, dlls/d3d11/tests/d3d11.c, dlls/d3d9/tests/visual.c, dlls/wined3d/arb_program_shader.c,
# | dlls/wined3d/context.c, dlls/wined3d/cs.c, dlls/wined3d/device.c, dlls/wined3d/drawprim.c, dlls/wined3d/glsl_shader.c,
# | dlls/wined3d/query.c, dlls/wined3d/resource.c, dlls/wined3d/shader.c, dlls/wined3d/state.c, dlls/wined3d/stateblock.c,
# | dlls/wined3d/surface.c, dlls/wined3d/swapchain.c, dlls/wined3d/texture.c, dlls/wined3d/utils.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' '+ { "Sebastian Lackner", "wined3d: Send push_constants through the CS.", 1 },';
printf '%s\n' '+ { "Stefan Dösinger", "wined3d: Send primitive type updates through the command stream.", 1 },';
printf '%s\n' '+ { "Stefan Dösinger", "wined3d: Send light updates through the command stream.", 1 },';
printf '%s\n' '+ { "Stefan Dösinger", "wined3d: Give the cs its own state.", 1 },';
printf '%s\n' '+ { "Stefan Dösinger", "wined3d: Pass the depth stencil to swapchain->present.", 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: Send render target view clears through the command stream.", 1 },';
printf '%s\n' '+ { "Stefan Dösinger", "wined3d: Get rid of the end_scene flush and finish.", 1 },';
printf '%s\n' '+ { "Stefan Dösinger", "wined3d: Send update_texture calls through the CS.", 1 },';
printf '%s\n' '+ { "Stefan Dösinger", "wined3d: Send update_sub_resource calls through the command stream.", 1 },';
printf '%s\n' '+ { "Stefan Dösinger", "wined3d: Send getdc and releasedc through the command stream.", 1 },';
printf '%s\n' '+ { "Sebastian Lackner", "wined3d: Send query_poll through the command stream.", 1 },';
printf '%s\n' '+ { "Stefan Dösinger", "wined3d: Create the initial context through the CS.", 1 },';
printf '%s\n' '+ { "Stefan Dösinger", "wined3d: Update the swap interval through the CS in reset.", 1 },';
printf '%s\n' '+ { "Stefan Dösinger", "wined3d: Create initial DCs through the CS.", 1 },';
printf '%s\n' '+ { "Nils Kuhnhenn", "wined3d: Fix context_acquire not being called from the command thread in wined3d_texture_add_dirty_region.", 1 },';
printf '%s\n' '+ { "Stefan Dösinger", "wined3d: Wrap GL BOs in a structure.", 1 },';
printf '%s\n' '+ { "Sebastian Lackner", "wined3d: Send buffer update subresource requests through CS.", 1 },';
printf '%s\n' '+ { "Sebastian Lackner", "wined3d: Send buffer copy requests through CS.", 1 },';
printf '%s\n' '+ { "Stefan Dösinger", "wined3d: Move the framebuffer into wined3d_state.", 1 },';
printf '%s\n' '+ { "Stefan Dösinger", "wined3d: Don'\''t access device state in clears.", 1 },';
printf '%s\n' '+ { "Stefan Dösinger", "wined3d: Avoid destroying views in color and depth fills.", 1 },';
printf '%s\n' '+ { "Stefan Dösinger", "wined3d: Add a separate variable to check if queries are started.", 1 },';
printf '%s\n' '+ { "Michael Müller", "wined3d: Map vertex buffers through cs.", 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' '+ { "Sebastian Lackner", "wined3d: Use priority queue for query polls.", 1 },';
printf '%s\n' '+ { "Stefan Dösinger", "wined3d: Don'\''t call glFinish before swapping.", 1 },';
printf '%s\n' '+ { "Stefan Dösinger", "wined3d: Use an event to block the worker thread when it is idle.", 1 },';
printf '%s\n' '+ { "Stefan Dösinger", "wined3d: Unset some objects in state_init_default.", 1 },';
printf '%s\n' '+ { "Sebastian Lackner", "wined3d: Use priority queue for get_dc / release_dc.", 1 },';
printf '%s\n' '+ { "Sebastian Lackner", "wined3d: Do not immediately submit stateblock updates.", 1 },';
printf '%s\n' '+ { "Sebastian Lackner", "wined3d: Use priority queue for update_sub_resource.", 1 },';
printf '%s\n' '+ { "Michael Müller", "wined3d: Use spin lock for cs list critical sections.", 1 },';
printf '%s\n' '+ { "Michael Müller", "wined3d: Don'\''t wait for events that have not been issued yet.", 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 },';
) >> "$patchlist"
fi
# Patchset winedbg-Process_Arguments
# |
# | Modified files:

View File

@ -5,6 +5,7 @@ Depends: wined3d-1DTextures
Depends: wined3d-Silence_FIXMEs
Depends: wined3d-Revert_Pixel_Center_Offset
Depends: wined3d-Revert_Buffer_Upload
Depends: d3d9-Tests
Depends: d3d11-Deferred_Context
Depends: makedep-PARENTSPEC
Depends: ntdll-DllRedirects

View File

@ -0,0 +1,204 @@
From 1278d18bdb2ef4ffbc21b5d9a4a384bdd598d3d2 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 | 51 ++++++++++++++++++++++++++++++++++++++++--
dlls/wined3d/device.c | 2 ++
dlls/wined3d/view.c | 6 +++++
dlls/wined3d/wined3d_private.h | 3 +++
4 files changed, 60 insertions(+), 2 deletions(-)
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
index bbae5add951..990cb6735d7 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,
WINED3D_CS_OP_CLEAR,
WINED3D_CS_OP_DISPATCH,
@@ -63,6 +65,16 @@ enum wined3d_cs_op
WINED3D_CS_OP_UNMAP,
};
+struct wined3d_cs_sync
+{
+ enum wined3d_cs_op opcode;
+};
+
+struct wined3d_cs_glfinish
+{
+ enum wined3d_cs_op opcode;
+};
+
struct wined3d_cs_present
{
enum wined3d_cs_op opcode;
@@ -328,6 +340,38 @@ struct wined3d_cs_unmap
HRESULT *hr;
};
+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;
+
+ 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;
+
+ cs->ops->submit_and_wait(cs);
+}
+
static void wined3d_cs_exec_present(struct wined3d_cs *cs, const void *data)
{
const struct wined3d_cs_present *op = data;
@@ -1506,7 +1550,7 @@ HRESULT wined3d_cs_map(struct wined3d_cs *cs, struct wined3d_resource *resource,
op->flags = flags;
op->hr = &hr;
- cs->ops->submit(cs);
+ cs->ops->submit_and_wait(cs);
return hr;
}
@@ -1530,13 +1574,15 @@ HRESULT wined3d_cs_unmap(struct wined3d_cs *cs, struct wined3d_resource *resourc
op->sub_resource_idx = sub_resource_idx;
op->hr = &hr;
- cs->ops->submit(cs);
+ cs->ops->submit_and_wait(cs);
return hr;
}
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,
/* WINED3D_CS_OP_CLEAR */ wined3d_cs_exec_clear,
/* WINED3D_CS_OP_DISPATCH */ wined3d_cs_exec_dispatch,
@@ -1665,6 +1711,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_push_constants,
};
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index cfa3e889aa0..b449225d2e9 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -1008,6 +1008,7 @@ static void wined3d_device_delete_opengl_contexts_cs(void *object)
static void wined3d_device_delete_opengl_contexts(struct wined3d_device *device)
{
wined3d_cs_destroy_object(device->cs, wined3d_device_delete_opengl_contexts_cs, device);
+ wined3d_cs_emit_sync(device->cs);
}
static void wined3d_device_create_primary_opengl_context_cs(void *object)
@@ -1043,6 +1044,7 @@ static void wined3d_device_create_primary_opengl_context_cs(void *object)
static HRESULT wined3d_device_create_primary_opengl_context(struct wined3d_device *device)
{
wined3d_cs_init_object(device->cs, wined3d_device_create_primary_opengl_context_cs, device);
+ wined3d_cs_emit_sync(device->cs);
if (!device->swapchains[0]->num_contexts)
return E_FAIL;
diff --git a/dlls/wined3d/view.c b/dlls/wined3d/view.c
index abed78051cd..9d9a300fb44 100644
--- a/dlls/wined3d/view.c
+++ b/dlls/wined3d/view.c
@@ -518,6 +518,8 @@ static void wined3d_shader_resource_view_cs_init(void *object)
debug_d3dformat(resource->format->id), debug_d3dformat(view_format->id));
}
}
+
+ wined3d_resource_release(resource);
}
static HRESULT wined3d_shader_resource_view_init(struct wined3d_shader_resource_view *view,
@@ -577,6 +579,7 @@ static HRESULT wined3d_shader_resource_view_init(struct wined3d_shader_resource_
view->format = view_format;
view->desc = *desc;
+ wined3d_resource_acquire(resource);
wined3d_cs_init_object(resource->device->cs, wined3d_shader_resource_view_cs_init, view);
return WINED3D_OK;
@@ -723,6 +726,8 @@ static void wined3d_unordered_access_view_cs_init(void *object)
desc, texture, view->format);
}
}
+
+ wined3d_resource_release(resource);
}
static HRESULT wined3d_unordered_access_view_init(struct wined3d_unordered_access_view *view,
@@ -786,6 +791,7 @@ static HRESULT wined3d_unordered_access_view_init(struct wined3d_unordered_acces
}
wined3d_resource_incref(view->resource = resource);
+ wined3d_resource_acquire(resource);
wined3d_cs_init_object(resource->device->cs, wined3d_unordered_access_view_cs_init, view);
return WINED3D_OK;
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index bfde7d2d6d0..46ca81b4e77 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -3168,6 +3168,7 @@ 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);
};
@@ -3193,6 +3194,7 @@ void wined3d_cs_emit_dispatch(struct wined3d_cs *cs,
unsigned int group_count_x, unsigned int group_count_y, unsigned int group_count_z) DECLSPEC_HIDDEN;
void wined3d_cs_emit_draw(struct wined3d_cs *cs, 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_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;
@@ -3242,6 +3244,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;
+void wined3d_cs_emit_sync(struct wined3d_cs *cs);
void wined3d_cs_emit_unload_resource(struct wined3d_cs *cs, struct wined3d_resource *resource) DECLSPEC_HIDDEN;
void wined3d_cs_init_object(struct wined3d_cs *cs,
void (*callback)(void *object), void *object) DECLSPEC_HIDDEN;
--
2.11.0

View File

@ -1,28 +1,28 @@
From 29cdf26fd35b1d309b9326c2eb8641ed5564e85b Mon Sep 17 00:00:00 2001
From e565d8dfb0453633c53c6a74f5f204e99231729a 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 | 119 +++++++++++++++++++++++++----------------
dlls/wined3d/cs.c | 113 +++++++++++++++++++++++++----------------
dlls/wined3d/device.c | 12 ++---
dlls/wined3d/wined3d_private.h | 12 ++---
3 files changed, 83 insertions(+), 60 deletions(-)
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 c0d8a5f2fd5..b832b7e0733 100644
index 990cb6735d7..4612244ce0c 100644
--- a/dlls/wined3d/cs.c
+++ b/dlls/wined3d/cs.c
@@ -75,6 +75,7 @@ enum wined3d_cs_op
@@ -63,6 +63,7 @@ enum wined3d_cs_op
WINED3D_CS_OP_UNLOAD_RESOURCE,
WINED3D_CS_OP_MAP,
WINED3D_CS_OP_UNMAP,
WINED3D_CS_OP_GLFINISH,
+ WINED3D_CS_OP_PUSH_CONSTANTS,
WINED3D_CS_OP_STOP,
};
@@ -366,6 +367,15 @@ struct wined3d_cs_finish
enum wined3d_cs_op opcode;
struct wined3d_cs_sync
@@ -340,6 +341,15 @@ struct wined3d_cs_unmap
HRESULT *hr;
};
+struct wined3d_cs_push_constants
@ -34,11 +34,11 @@ index c0d8a5f2fd5..b832b7e0733 100644
+ BYTE constants[1];
+};
+
static inline BOOL wined3d_cs_process_block(struct wined3d_cs *cs, struct wined3d_cs_block *block);
static void wined3d_cs_mt_submit(struct wined3d_cs *cs);
@@ -1742,6 +1752,67 @@ void wined3d_cs_emit_glfinish(struct wined3d_cs *cs)
cs->ops->submit(cs);
static void wined3d_cs_exec_sync(struct wined3d_cs *cs, const void *data)
{
}
@@ -1579,6 +1589,64 @@ HRESULT wined3d_cs_unmap(struct wined3d_cs *cs, struct wined3d_resource *resourc
return hr;
}
+static const struct
@ -63,10 +63,9 @@ index c0d8a5f2fd5..b832b7e0733 100644
+ {FIELD_OFFSET(struct wined3d_state, ps_consts_b), sizeof(BOOL), WINED3D_SHADER_CONST_PS_B},
+};
+
+static UINT wined3d_cs_exec_push_constants(struct wined3d_cs *cs, const void *data)
+static void wined3d_cs_exec_push_constants(struct wined3d_cs *cs, const void *data)
+{
+ const struct wined3d_cs_push_constants *op = data;
+ size_t size = FIELD_OFFSET(struct wined3d_cs_push_constants, constants[op->count * push_constant_info[op->p].size]);
+ struct wined3d_device *device = cs->device;
+ unsigned int context_count;
+ unsigned int i;
@ -83,8 +82,6 @@ index c0d8a5f2fd5..b832b7e0733 100644
+ {
+ device->contexts[i]->constant_update_mask |= push_constant_info[op->p].mask;
+ }
+
+ return size;
+}
+
+void wined3d_cs_emit_push_constants(struct wined3d_cs *cs, enum wined3d_push_constants p,
@ -102,19 +99,19 @@ index c0d8a5f2fd5..b832b7e0733 100644
+ cs->ops->submit(cs);
+}
+
static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void *data) =
static void (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void *data) =
{
/* WINED3D_CS_OP_FENCE */ wined3d_cs_exec_fence,
@@ -1782,6 +1853,7 @@ static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void
/* WINED3D_CS_OP_SYNC */ wined3d_cs_exec_sync,
@@ -1618,6 +1686,7 @@ static void (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void
/* WINED3D_CS_OP_UNLOAD_RESOURCE */ wined3d_cs_exec_unload_resource,
/* WINED3D_CS_OP_MAP */ wined3d_cs_exec_map,
/* WINED3D_CS_OP_UNMAP */ wined3d_cs_exec_unmap,
/* WINED3D_CS_OP_GLFINISH */ wined3d_cs_exec_glfinish,
+ /* WINED3D_CS_OP_PUSH_CONSTANTS */ wined3d_cs_exec_push_constants,
};
static void *wined3d_cs_st_require_space(struct wined3d_cs *cs, size_t size)
@@ -1808,55 +1880,11 @@ static void wined3d_cs_st_submit(struct wined3d_cs *cs)
wined3d_cs_op_handlers[opcode](cs, cs->data);
@@ -1664,55 +1733,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,
@ -168,29 +165,12 @@ index c0d8a5f2fd5..b832b7e0733 100644
- wined3d_cs_st_push_constants,
};
static void *wined3d_cs_mt_require_space(struct wined3d_cs *cs, size_t size)
@@ -1864,6 +1892,8 @@ static void *wined3d_cs_mt_require_space(struct wined3d_cs *cs, size_t size)
struct wined3d_cs_block *block = wined3d_cs_get_thread_block(cs);
void *data;
+ assert(size <= sizeof(block->data));
+
if (!block || block->pos + size > sizeof(block->data))
{
if (block)
@@ -1906,7 +1936,6 @@ 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_and_wait,
- wined3d_cs_st_push_constants, /* FIXME */
};
/* FIXME: wined3d_device_uninit_3d() should either flush and wait, or be an
struct wined3d_cs *wined3d_cs_create(struct wined3d_device *device)
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index 4d0f6f2c4be..831f36c9870 100644
index b449225d2e9..5e17ba185de 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -2417,7 +2417,7 @@ HRESULT CDECL wined3d_device_set_vs_consts_b(struct wined3d_device *device,
@@ -2347,7 +2347,7 @@ HRESULT CDECL wined3d_device_set_vs_consts_b(struct wined3d_device *device,
}
else
{
@ -199,7 +179,7 @@ index 4d0f6f2c4be..831f36c9870 100644
}
return WINED3D_OK;
@@ -2466,7 +2466,7 @@ HRESULT CDECL wined3d_device_set_vs_consts_i(struct wined3d_device *device,
@@ -2396,7 +2396,7 @@ HRESULT CDECL wined3d_device_set_vs_consts_i(struct wined3d_device *device,
}
else
{
@ -208,7 +188,7 @@ index 4d0f6f2c4be..831f36c9870 100644
}
return WINED3D_OK;
@@ -2511,7 +2511,7 @@ HRESULT CDECL wined3d_device_set_vs_consts_f(struct wined3d_device *device,
@@ -2441,7 +2441,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
@ -217,7 +197,7 @@ index 4d0f6f2c4be..831f36c9870 100644
return WINED3D_OK;
}
@@ -2650,7 +2650,7 @@ HRESULT CDECL wined3d_device_set_ps_consts_b(struct wined3d_device *device,
@@ -2580,7 +2580,7 @@ HRESULT CDECL wined3d_device_set_ps_consts_b(struct wined3d_device *device,
}
else
{
@ -226,7 +206,7 @@ index 4d0f6f2c4be..831f36c9870 100644
}
return WINED3D_OK;
@@ -2699,7 +2699,7 @@ HRESULT CDECL wined3d_device_set_ps_consts_i(struct wined3d_device *device,
@@ -2629,7 +2629,7 @@ HRESULT CDECL wined3d_device_set_ps_consts_i(struct wined3d_device *device,
}
else
{
@ -235,7 +215,7 @@ index 4d0f6f2c4be..831f36c9870 100644
}
return WINED3D_OK;
@@ -2745,7 +2745,7 @@ HRESULT CDECL wined3d_device_set_ps_consts_f(struct wined3d_device *device,
@@ -2675,7 +2675,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
@ -245,19 +225,10 @@ index 4d0f6f2c4be..831f36c9870 100644
return WINED3D_OK;
}
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index d225e85b909..e7437a38023 100644
index 46ca81b4e77..df05dcb8fc8 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -3124,7 +3124,7 @@ struct wined3d_cs_block
{
struct list entry;
UINT pos;
- BYTE data[4000]; /* FIXME? The size is somewhat arbitrary. */
+ BYTE data[0x4000]; /* FIXME? The size is somewhat arbitrary. */
};
struct wined3d_cs_ops
@@ -3132,8 +3132,6 @@ struct wined3d_cs_ops
@@ -3169,8 +3169,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);
@ -266,16 +237,16 @@ index d225e85b909..e7437a38023 100644
};
struct wined3d_cs
@@ -3173,6 +3171,8 @@ void wined3d_cs_emit_glfinish(struct wined3d_cs *cs) DECLSPEC_HIDDEN;
@@ -3198,6 +3196,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;
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;
@@ -3226,12 +3226,6 @@ HRESULT wined3d_cs_map(struct wined3d_cs *cs, struct wined3d_resource *resource,
void wined3d_cs_emit_set_clip_plane(struct wined3d_cs *cs, UINT plane_idx,
@@ -3253,12 +3253,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;

View File

@ -1,29 +1,29 @@
From 54250a452e83961539ea9adecd5bee1f525feb94 Mon Sep 17 00:00:00 2001
From d699a2c72dfa675f6d718673e2dabfd3139bab8a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20D=C3=B6singer?= <stefan@codeweavers.com>
Date: Sun, 7 Apr 2013 17:53:43 +0200
Subject: wined3d: Send primitive type updates through the command stream
---
dlls/wined3d/cs.c | 39 ++++++++++++++++++++++++++++++++++-----
dlls/wined3d/cs.c | 32 ++++++++++++++++++++++++++++++++
dlls/wined3d/device.c | 4 ++--
dlls/wined3d/stateblock.c | 4 ++--
dlls/wined3d/wined3d_private.h | 2 ++
4 files changed, 40 insertions(+), 9 deletions(-)
4 files changed, 38 insertions(+), 4 deletions(-)
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
index e9d238d262f..c6b7aa71ecd 100644
index 4612244ce0c..7490b36a827 100644
--- a/dlls/wined3d/cs.c
+++ b/dlls/wined3d/cs.c
@@ -77,6 +77,7 @@ enum wined3d_cs_op
WINED3D_CS_OP_GLFINISH,
@@ -64,6 +64,7 @@ enum wined3d_cs_op
WINED3D_CS_OP_MAP,
WINED3D_CS_OP_UNMAP,
WINED3D_CS_OP_PUSH_CONSTANTS,
WINED3D_CS_OP_STATEBLOCK,
+ WINED3D_CS_OP_SET_PRIMITIVE_TYPE,
WINED3D_CS_OP_STOP,
};
@@ -383,6 +384,12 @@ struct wined3d_cs_stateblock
struct wined3d_state state;
struct wined3d_cs_sync
@@ -350,6 +351,12 @@ struct wined3d_cs_push_constants
BYTE constants[1];
};
+struct wined3d_cs_set_primitive_type
@ -32,33 +32,14 @@ index e9d238d262f..c6b7aa71ecd 100644
+ GLenum gl_primitive_type;
+};
+
static inline BOOL wined3d_cs_process_block(struct wined3d_cs *cs, struct wined3d_cs_block *block);
static void wined3d_cs_mt_submit(struct wined3d_cs *cs);
@@ -1200,7 +1207,6 @@ static UINT wined3d_cs_exec_transfer_stateblock(struct wined3d_cs *cs, const voi
static void wined3d_cs_exec_sync(struct wined3d_cs *cs, const void *data)
{
const struct wined3d_cs_stateblock *op = data;
- cs->state.gl_primitive_type = op->state.gl_primitive_type;
memcpy(cs->state.lights, op->state.lights, sizeof(cs->state.lights));
return sizeof(*op);
@@ -1213,10 +1219,6 @@ void wined3d_cs_emit_transfer_stateblock(struct wined3d_cs *cs, const struct win
op = cs->ops->require_space(cs, sizeof(*op));
op->opcode = WINED3D_CS_OP_STATEBLOCK;
- /* Don't memcpy the entire struct, we'll remove single items as we add dedicated
- * ops for setting states */
- op->state.gl_primitive_type = state->gl_primitive_type;
-
/* FIXME: This is not ideal. CS is still running synchronously, so this is ok.
* It will go away soon anyway. */
memcpy(op->state.lights, state->lights, sizeof(op->state.lights));
@@ -1848,6 +1850,32 @@ void wined3d_cs_emit_push_constants(struct wined3d_cs *cs, enum wined3d_push_con
}
@@ -1647,6 +1654,30 @@ void wined3d_cs_emit_push_constants(struct wined3d_cs *cs, enum wined3d_push_con
cs->ops->submit(cs);
}
+static UINT wined3d_cs_exec_set_primitive_type(struct wined3d_cs *cs, const void *data)
+static void wined3d_cs_exec_set_primitive_type(struct wined3d_cs *cs, const void *data)
+{
+ const struct wined3d_cs_set_primitive_type *op = data;
+ GLenum prev;
@ -69,8 +50,6 @@ index e9d238d262f..c6b7aa71ecd 100644
+ device_invalidate_state(cs->device, STATE_POINT_ENABLE);
+
+ cs->state.gl_primitive_type = op->gl_primitive_type;
+
+ return sizeof(*op);
+}
+
+void wined3d_cs_emit_set_primitive_type(struct wined3d_cs *cs, GLenum primitive_type)
@ -84,22 +63,22 @@ index e9d238d262f..c6b7aa71ecd 100644
+ cs->ops->submit(cs);
+}
+
static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void *data) =
static void (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void *data) =
{
/* WINED3D_CS_OP_FENCE */ wined3d_cs_exec_fence,
@@ -1890,6 +1918,7 @@ static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void
/* WINED3D_CS_OP_GLFINISH */ wined3d_cs_exec_glfinish,
/* WINED3D_CS_OP_SYNC */ wined3d_cs_exec_sync,
@@ -1687,6 +1718,7 @@ static void (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void
/* WINED3D_CS_OP_MAP */ wined3d_cs_exec_map,
/* WINED3D_CS_OP_UNMAP */ wined3d_cs_exec_unmap,
/* WINED3D_CS_OP_PUSH_CONSTANTS */ wined3d_cs_exec_push_constants,
/* WINED3D_CS_OP_STATEBLOCK */ wined3d_cs_exec_transfer_stateblock,
+ /* WINED3D_CS_OP_SET_PRIMITIVE_TYPE */ wined3d_cs_exec_set_primitive_type,
};
static void *wined3d_cs_st_require_space(struct wined3d_cs *cs, size_t size)
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index 268d1e93857..e01ef6e3753 100644
index 5e17ba185de..6fb09dfcf19 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -3630,8 +3630,8 @@ void CDECL wined3d_device_set_primitive_type(struct wined3d_device *device,
@@ -3574,8 +3574,8 @@ void CDECL wined3d_device_set_primitive_type(struct wined3d_device *device,
device->update_state->gl_primitive_type = gl_primitive_type;
if (device->recording)
device->recording->changed.primitive_type = TRUE;
@ -111,10 +90,10 @@ index 268d1e93857..e01ef6e3753 100644
void CDECL wined3d_device_get_primitive_type(const struct wined3d_device *device,
diff --git a/dlls/wined3d/stateblock.c b/dlls/wined3d/stateblock.c
index fd017524075..ed39a15c7be 100644
index 22e511fcec1..ad347082c4d 100644
--- a/dlls/wined3d/stateblock.c
+++ b/dlls/wined3d/stateblock.c
@@ -991,8 +991,8 @@ void CDECL wined3d_stateblock_apply(const struct wined3d_stateblock *stateblock)
@@ -1054,8 +1054,8 @@ void CDECL wined3d_stateblock_apply(const struct wined3d_stateblock *stateblock)
gl_primitive_type = stateblock->state.gl_primitive_type;
prev = device->update_state->gl_primitive_type;
device->update_state->gl_primitive_type = gl_primitive_type;
@ -126,10 +105,10 @@ index fd017524075..ed39a15c7be 100644
if (stateblock->changed.indices)
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 0085339d6a8..354f9fe62d0 100644
index df05dcb8fc8..514f162fefa 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -3191,6 +3191,8 @@ void wined3d_cs_emit_set_index_buffer(struct wined3d_cs *cs, struct wined3d_buff
@@ -3213,6 +3213,8 @@ void wined3d_cs_emit_set_index_buffer(struct wined3d_cs *cs, struct wined3d_buff
void wined3d_cs_emit_set_material(struct wined3d_cs *cs, const struct wined3d_material *material) DECLSPEC_HIDDEN;
void wined3d_cs_emit_set_predication(struct wined3d_cs *cs,
struct wined3d_query *predicate, BOOL value) DECLSPEC_HIDDEN;

View File

@ -1,237 +0,0 @@
From 52baf7a72c18b2949f3a6552ec38ffe7ef1c1451 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20D=C3=B6singer?= <stefan@codeweavers.com>
Date: Tue, 1 Oct 2013 15:30:26 +0200
Subject: wined3d: Give the cs its own state
---
dlls/wined3d/cs.c | 76 +++++++++++++++++++++++++++++-------------
dlls/wined3d/device.c | 4 +++
dlls/wined3d/wined3d_private.h | 4 ++-
3 files changed, 59 insertions(+), 25 deletions(-)
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
index 9501609da1f..a0c32dd65f8 100644
--- a/dlls/wined3d/cs.c
+++ b/dlls/wined3d/cs.c
@@ -76,6 +76,7 @@ enum wined3d_cs_op
WINED3D_CS_OP_UNMAP,
WINED3D_CS_OP_GLFINISH,
WINED3D_CS_OP_PUSH_CONSTANTS,
+ WINED3D_CS_OP_STATEBLOCK,
WINED3D_CS_OP_STOP,
};
@@ -377,6 +378,12 @@ struct wined3d_cs_push_constants
BYTE constants[1];
};
+struct wined3d_cs_stateblock
+{
+ enum wined3d_cs_op opcode;
+ struct wined3d_state state;
+};
+
static inline BOOL wined3d_cs_process_block(struct wined3d_cs *cs, struct wined3d_cs_block *block);
static void wined3d_cs_mt_submit(struct wined3d_cs *cs);
@@ -523,7 +530,7 @@ static UINT wined3d_cs_exec_clear(struct wined3d_cs *cs, const void *data)
size_t size = FIELD_OFFSET(struct wined3d_cs_clear, rects[op->rect_count]);
device = cs->device;
- state = &device->state;
+ state = &cs->state;
wined3d_get_draw_rect(state, &draw_rect);
device_clear_render_targets(device, device->adapter->gl_info.limits.buffers,
&device->fb, op->rect_count, op->rects, &draw_rect, op->flags,
@@ -681,7 +688,7 @@ static void release_unordered_access_resources(const struct wined3d_shader *shad
static UINT wined3d_cs_exec_dispatch(struct wined3d_cs *cs, const void *data)
{
- struct wined3d_state *state = &cs->device->state;
+ struct wined3d_state *state = &cs->state;
const struct wined3d_cs_dispatch *op = data;
dispatch_compute(cs->device, state,
@@ -715,7 +722,7 @@ void wined3d_cs_emit_dispatch(struct wined3d_cs *cs,
static UINT wined3d_cs_exec_draw(struct wined3d_cs *cs, const void *data)
{
- struct wined3d_state *state = &cs->device->state;
+ struct wined3d_state *state = &cs->state;
const struct wined3d_cs_draw *op = data;
unsigned int i;
@@ -1210,6 +1217,34 @@ void wined3d_cs_emit_set_texture(struct wined3d_cs *cs, UINT stage, struct wined
cs->ops->submit(cs);
}
+static UINT wined3d_cs_exec_transfer_stateblock(struct wined3d_cs *cs, const void *data)
+{
+ const struct wined3d_cs_stateblock *op = data;
+
+ cs->state.gl_primitive_type = op->state.gl_primitive_type;
+ memcpy(cs->state.lights, op->state.lights, sizeof(cs->state.lights));
+
+ return sizeof(*op);
+}
+
+void wined3d_cs_emit_transfer_stateblock(struct wined3d_cs *cs, const struct wined3d_state *state)
+{
+ struct wined3d_cs_stateblock *op;
+
+ op = cs->ops->require_space(cs, sizeof(*op));
+ op->opcode = WINED3D_CS_OP_STATEBLOCK;
+
+ /* Don't memcpy the entire struct, we'll remove single items as we add dedicated
+ * ops for setting states */
+ op->state.gl_primitive_type = state->gl_primitive_type;
+
+ /* FIXME: This is not ideal. CS is still running synchronously, so this is ok.
+ * It will go away soon anyway. */
+ memcpy(op->state.lights, state->lights, sizeof(op->state.lights));
+
+ cs->ops->submit(cs);
+}
+
static UINT wined3d_cs_exec_set_shader_resource_view(struct wined3d_cs *cs, const void *data)
{
const struct wined3d_cs_set_shader_resource_view *op = data;
@@ -1878,6 +1913,7 @@ static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void
/* WINED3D_CS_OP_UNMAP */ wined3d_cs_exec_unmap,
/* WINED3D_CS_OP_GLFINISH */ wined3d_cs_exec_glfinish,
/* WINED3D_CS_OP_PUSH_CONSTANTS */ wined3d_cs_exec_push_constants,
+ /* WINED3D_CS_OP_STATEBLOCK */ wined3d_cs_exec_transfer_stateblock,
};
static void *wined3d_cs_st_require_space(struct wined3d_cs *cs, size_t size)
@@ -2022,6 +2058,7 @@ struct wined3d_cs *wined3d_cs_create(struct wined3d_device *device)
if (!(cs = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*cs))))
return NULL;
+ cs->tls_idx = TLS_OUT_OF_INDEXES;
if (!(cs->fb.render_targets = wined3d_calloc(gl_info->limits.buffers, sizeof(*cs->fb.render_targets))))
{
@@ -2037,21 +2074,12 @@ struct wined3d_cs *wined3d_cs_create(struct wined3d_device *device)
cs->data_size = WINED3D_INITIAL_CS_SIZE;
if (!(cs->data = HeapAlloc(GetProcessHeap(), 0, cs->data_size)))
- {
- state_cleanup(&cs->state);
- HeapFree(GetProcessHeap(), 0, cs->fb.render_targets);
- HeapFree(GetProcessHeap(), 0, cs);
- return NULL;
- }
+ goto err;
if ((cs->tls_idx = TlsAlloc()) == TLS_OUT_OF_INDEXES)
{
ERR("Failed to allocate cs TLS index, err %#x.\n", GetLastError());
- state_cleanup(&cs->state);
- HeapFree(GetProcessHeap(), 0, cs->fb.render_targets);
- HeapFree(GetProcessHeap(), 0, cs->data);
- HeapFree(GetProcessHeap(), 0, cs);
- return NULL;
+ goto err;
}
if (wined3d_settings.cs_multithreaded)
@@ -2064,17 +2092,19 @@ struct wined3d_cs *wined3d_cs_create(struct wined3d_device *device)
if (!(cs->thread = CreateThread(NULL, 0, wined3d_cs_run, cs, 0, &cs->thread_id)))
{
ERR("Failed to create wined3d command stream thread.\n");
- if (!TlsFree(cs->tls_idx))
- ERR("Failed to free cs TLS index, err %#x.\n", GetLastError());
- state_cleanup(&cs->state);
- HeapFree(GetProcessHeap(), 0, cs->fb.render_targets);
- HeapFree(GetProcessHeap(), 0, cs->data);
- HeapFree(GetProcessHeap(), 0, cs);
- return NULL;
+ goto err;
}
}
return cs;
+
+err:
+ state_cleanup(&cs->state);
+ if (cs->tls_idx != TLS_OUT_OF_INDEXES) TlsFree(cs->tls_idx);
+ HeapFree(GetProcessHeap(), 0, cs->fb.render_targets);
+ HeapFree(GetProcessHeap(), 0, cs->data);
+ HeapFree(GetProcessHeap(), 0, cs);
+ return NULL;
}
void wined3d_cs_destroy(struct wined3d_cs *cs)
@@ -2099,9 +2129,7 @@ void wined3d_cs_destroy(struct wined3d_cs *cs)
#endif
}
- if (!TlsFree(cs->tls_idx))
- ERR("Failed to free cs TLS index, err %#x.\n", GetLastError());
-
+ TlsFree(cs->tls_idx);
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 df80b784749..35b107306c0 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -3662,6 +3662,7 @@ HRESULT CDECL wined3d_device_draw_primitive(struct wined3d_device *device, UINT
{
TRACE("device %p, start_vertex %u, vertex_count %u.\n", device, start_vertex, vertex_count);
+ wined3d_cs_emit_transfer_stateblock(device->cs, &device->state);
wined3d_cs_emit_draw(device->cs, 0, start_vertex, vertex_count, 0, 0, FALSE);
return WINED3D_OK;
@@ -3673,6 +3674,7 @@ void CDECL wined3d_device_draw_primitive_instanced(struct wined3d_device *device
TRACE("device %p, start_vertex %u, vertex_count %u, start_instance %u, instance_count %u.\n",
device, start_vertex, vertex_count, start_instance, instance_count);
+ wined3d_cs_emit_transfer_stateblock(device->cs, &device->state);
wined3d_cs_emit_draw(device->cs, 0, start_vertex, vertex_count, start_instance, instance_count, FALSE);
}
@@ -3690,6 +3692,7 @@ HRESULT CDECL wined3d_device_draw_indexed_primitive(struct wined3d_device *devic
return WINED3DERR_INVALIDCALL;
}
+ wined3d_cs_emit_transfer_stateblock(device->cs, &device->state);
wined3d_cs_emit_draw(device->cs, device->state.base_vertex_index, start_idx, index_count, 0, 0, TRUE);
return WINED3D_OK;
@@ -3701,6 +3704,7 @@ void CDECL wined3d_device_draw_indexed_primitive_instanced(struct wined3d_device
TRACE("device %p, start_idx %u, index_count %u, start_instance %u, instance_count %u.\n",
device, start_idx, index_count, start_instance, instance_count);
+ wined3d_cs_emit_transfer_stateblock(device->cs, &device->state);
wined3d_cs_emit_draw(device->cs, device->state.base_vertex_index,
start_idx, index_count, start_instance, instance_count, TRUE);
}
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 03cbdf7daae..1c7f8ecad73 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -3163,7 +3163,7 @@ struct wined3d_cs_block
{
struct list entry;
UINT pos;
- BYTE data[0x4000]; /* FIXME? The size is somewhat arbitrary. */
+ BYTE data[sizeof(struct wined3d_state) * 2]; /* FIXME? The size is somewhat arbitrary. */
};
struct wined3d_cs_ops
@@ -3221,6 +3221,8 @@ void wined3d_cs_emit_set_color_key(struct wined3d_cs *cs, struct wined3d_texture
WORD flags, const struct wined3d_color_key *color_key) DECLSPEC_HIDDEN;
void wined3d_cs_emit_set_constant_buffer(struct wined3d_cs *cs, enum wined3d_shader_type type,
UINT cb_idx, struct wined3d_buffer *buffer) DECLSPEC_HIDDEN;
+void wined3d_cs_emit_transfer_stateblock(struct wined3d_cs *cs,
+ const struct wined3d_state *state) DECLSPEC_HIDDEN;
void wined3d_cs_emit_set_depth_stencil_view(struct wined3d_cs *cs,
struct wined3d_rendertarget_view *view) DECLSPEC_HIDDEN;
void wined3d_cs_emit_set_index_buffer(struct wined3d_cs *cs, struct wined3d_buffer *buffer,
--
2.11.0

View File

@ -0,0 +1,213 @@
From e9de3bb5f8aa7b31dc4caee4bd53a75c84ec42f2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20D=C3=B6singer?= <stefan@codeweavers.com>
Date: Wed, 10 Apr 2013 17:16:02 +0200
Subject: wined3d: Send light updates through the command stream
---
dlls/wined3d/cs.c | 100 +++++++++++++++++++++++++++++++++++++++++
dlls/wined3d/device.c | 21 +++------
dlls/wined3d/wined3d_private.h | 2 +
3 files changed, 108 insertions(+), 15 deletions(-)
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
index 7490b36a827..594a4b5b175 100644
--- a/dlls/wined3d/cs.c
+++ b/dlls/wined3d/cs.c
@@ -65,6 +65,8 @@ enum wined3d_cs_op
WINED3D_CS_OP_UNMAP,
WINED3D_CS_OP_PUSH_CONSTANTS,
WINED3D_CS_OP_SET_PRIMITIVE_TYPE,
+ WINED3D_CS_OP_SET_LIGHT,
+ WINED3D_CS_OP_SET_LIGHT_ENABLE,
};
struct wined3d_cs_sync
@@ -357,6 +359,19 @@ struct wined3d_cs_set_primitive_type
GLenum gl_primitive_type;
};
+struct wined3d_cs_set_light
+{
+ enum wined3d_cs_op opcode;
+ struct wined3d_light_info light;
+};
+
+struct wined3d_cs_set_light_enable
+{
+ enum wined3d_cs_op opcode;
+ UINT idx;
+ BOOL enable;
+};
+
static void wined3d_cs_exec_sync(struct wined3d_cs *cs, const void *data)
{
}
@@ -1678,6 +1693,89 @@ void wined3d_cs_emit_set_primitive_type(struct wined3d_cs *cs, GLenum primitive_
cs->ops->submit(cs);
}
+static void wined3d_cs_exec_set_light(struct wined3d_cs *cs, const void *data)
+{
+ const struct wined3d_cs_set_light *op = data;
+ UINT light_idx = op->light.OriginalIndex;
+ UINT hash_idx = LIGHTMAP_HASHFUNC(op->light.OriginalIndex);
+ struct wined3d_light_info *object;
+
+ if (!(object = wined3d_state_get_light(&cs->state, light_idx)))
+ {
+ TRACE("Adding new light\n");
+ object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
+ if (!object)
+ {
+ ERR("Out of memory!\n");
+ return;
+ }
+
+ list_add_head(&cs->state.light_map[hash_idx], &object->entry);
+ object->glIndex = -1;
+ object->OriginalIndex = light_idx;
+ }
+
+ /* Update the live definitions if the light is currently assigned a glIndex. */
+ if (object->glIndex != -1)
+ {
+ if (object->OriginalParms.type != op->light.OriginalParms.type)
+ device_invalidate_state(cs->device, STATE_LIGHT_TYPE);
+ device_invalidate_state(cs->device, STATE_ACTIVELIGHT(object->glIndex));
+ }
+
+ object->OriginalParms = op->light.OriginalParms;
+ object->position = op->light.position;
+ object->direction = op->light.direction;
+ object->exponent = op->light.exponent;
+ object->cutoff = op->light.cutoff;
+}
+
+void wined3d_cs_emit_set_light(struct wined3d_cs *cs, const struct wined3d_light_info *light)
+{
+ struct wined3d_cs_set_light *op;
+
+ op = cs->ops->require_space(cs, sizeof(*op));
+ op->opcode = WINED3D_CS_OP_SET_LIGHT;
+ op->light = *light;
+
+ cs->ops->submit(cs);
+}
+
+static void wined3d_cs_exec_set_light_enable(struct wined3d_cs *cs, const void *data)
+{
+ const struct wined3d_cs_set_light_enable *op = data;
+ struct wined3d_light_info *light_info;
+ struct wined3d_device *device = cs->device;
+ int prev_idx;
+
+ /* Should be handled by the device by emitting a set_light op */
+ if (!(light_info = wined3d_state_get_light(&cs->state, op->idx)))
+ {
+ ERR("Light enabled requested but light not defined in cs state!\n");
+ return;
+ }
+
+ prev_idx = light_info->glIndex;
+ wined3d_state_enable_light(&cs->state, &device->adapter->d3d_info, light_info, op->enable);
+ if (light_info->glIndex != prev_idx)
+ {
+ device_invalidate_state(device, STATE_LIGHT_TYPE);
+ device_invalidate_state(device, STATE_ACTIVELIGHT(op->enable ? light_info->glIndex : prev_idx));
+ }
+}
+
+void wined3d_cs_emit_set_light_enable(struct wined3d_cs *cs, UINT idx, BOOL enable)
+{
+ struct wined3d_cs_set_light_enable *op;
+
+ op = cs->ops->require_space(cs, sizeof(*op));
+ op->opcode = WINED3D_CS_OP_SET_LIGHT_ENABLE;
+ op->idx = idx;
+ op->enable = enable;
+
+ 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,
@@ -1719,6 +1817,8 @@ static void (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void
/* WINED3D_CS_OP_UNMAP */ wined3d_cs_exec_unmap,
/* WINED3D_CS_OP_PUSH_CONSTANTS */ wined3d_cs_exec_push_constants,
/* WINED3D_CS_OP_SET_PRIMITIVE_TYPE */ wined3d_cs_exec_set_primitive_type,
+ /* WINED3D_CS_OP_SET_LIGHT */ wined3d_cs_exec_set_light,
+ /* WINED3D_CS_OP_SET_LIGHT_ENABLE */ wined3d_cs_exec_set_light_enable,
};
static void *wined3d_cs_st_require_space(struct wined3d_cs *cs, size_t size)
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index 6fb09dfcf19..dd8943d2e3e 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -1619,14 +1619,6 @@ HRESULT CDECL wined3d_device_set_light(struct wined3d_device *device,
light->direction.x, light->direction.y, light->direction.z,
light->range, light->falloff, light->theta, light->phi);
- /* Update the live definitions if the light is currently assigned a glIndex. */
- if (object->glIndex != -1 && !device->recording)
- {
- if (object->OriginalParms.type != light->type)
- device_invalidate_state(device, STATE_LIGHT_TYPE);
- device_invalidate_state(device, STATE_ACTIVELIGHT(object->glIndex));
- }
-
/* Save away the information. */
object->OriginalParms = *light;
@@ -1706,6 +1698,9 @@ HRESULT CDECL wined3d_device_set_light(struct wined3d_device *device,
FIXME("Unrecognized light type %#x.\n", light->type);
}
+ if (!device->recording)
+ wined3d_cs_emit_set_light(device->cs, object);
+
return WINED3D_OK;
}
@@ -1729,7 +1724,6 @@ HRESULT CDECL wined3d_device_get_light(const struct wined3d_device *device,
HRESULT CDECL wined3d_device_set_light_enable(struct wined3d_device *device, UINT light_idx, BOOL enable)
{
struct wined3d_light_info *light_info;
- int prev_idx;
TRACE("device %p, light_idx %u, enable %#x.\n", device, light_idx, enable);
@@ -1746,13 +1740,10 @@ HRESULT CDECL wined3d_device_set_light_enable(struct wined3d_device *device, UIN
}
}
- prev_idx = light_info->glIndex;
wined3d_state_enable_light(device->update_state, &device->adapter->d3d_info, light_info, enable);
- if (!device->recording && light_info->glIndex != prev_idx)
- {
- device_invalidate_state(device, STATE_LIGHT_TYPE);
- device_invalidate_state(device, STATE_ACTIVELIGHT(enable ? light_info->glIndex : prev_idx));
- }
+
+ if (!device->recording)
+ wined3d_cs_emit_set_light_enable(device->cs, light_idx, enable);
return WINED3D_OK;
}
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 514f162fefa..df3c92cb568 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -3210,6 +3210,8 @@ void wined3d_cs_emit_set_depth_stencil_view(struct wined3d_cs *cs,
struct wined3d_rendertarget_view *view) DECLSPEC_HIDDEN;
void wined3d_cs_emit_set_index_buffer(struct wined3d_cs *cs, struct wined3d_buffer *buffer,
enum wined3d_format_id format_id, unsigned int offset) DECLSPEC_HIDDEN;
+void wined3d_cs_emit_set_light(struct wined3d_cs *cs, const struct wined3d_light_info *light) DECLSPEC_HIDDEN;
+void wined3d_cs_emit_set_light_enable(struct wined3d_cs *cs, UINT idx, BOOL enable) DECLSPEC_HIDDEN;
void wined3d_cs_emit_set_material(struct wined3d_cs *cs, const struct wined3d_material *material) DECLSPEC_HIDDEN;
void wined3d_cs_emit_set_predication(struct wined3d_cs *cs,
struct wined3d_query *predicate, BOOL value) DECLSPEC_HIDDEN;
--
2.11.0

View File

@ -0,0 +1,43 @@
From 6dbf3379c1262b61c6730d2228c40b85ef751773 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20D=C3=B6singer?= <stefan@codeweavers.com>
Date: Tue, 1 Oct 2013 15:30:26 +0200
Subject: wined3d: Give the cs its own state
---
dlls/wined3d/cs.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
index 594a4b5b175..53c1cc48728 100644
--- a/dlls/wined3d/cs.c
+++ b/dlls/wined3d/cs.c
@@ -454,7 +454,7 @@ static void wined3d_cs_exec_clear(struct wined3d_cs *cs, const void *data)
RECT draw_rect;
device = cs->device;
- state = &device->state;
+ state = &cs->state;
wined3d_get_draw_rect(state, &draw_rect);
device_clear_render_targets(device, device->adapter->gl_info.limits.buffers,
&device->fb, op->rect_count, op->rects, &draw_rect, op->flags,
@@ -610,7 +610,7 @@ static void release_unordered_access_resources(const struct wined3d_shader *shad
static void wined3d_cs_exec_dispatch(struct wined3d_cs *cs, const void *data)
{
- struct wined3d_state *state = &cs->device->state;
+ struct wined3d_state *state = &cs->state;
const struct wined3d_cs_dispatch *op = data;
dispatch_compute(cs->device, state,
@@ -642,7 +642,7 @@ void wined3d_cs_emit_dispatch(struct wined3d_cs *cs,
static void wined3d_cs_exec_draw(struct wined3d_cs *cs, const void *data)
{
- struct wined3d_state *state = &cs->device->state;
+ struct wined3d_state *state = &cs->state;
const struct wined3d_cs_draw *op = data;
unsigned int i;
--
2.11.0

View File

@ -1,4 +1,4 @@
From 04a17416b1f76b1b0dc6929c637dca4d995dc991 Mon Sep 17 00:00:00 2001
From 818d79add5b67b17199f656bc9286405878e9179 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20D=C3=B6singer?= <stefan@codeweavers.com>
Date: Thu, 4 Apr 2013 14:52:24 +0200
Subject: wined3d: Pass the depth stencil to swapchain->present
@ -12,10 +12,10 @@ DS or the implicit DS.
3 files changed, 11 insertions(+), 8 deletions(-)
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
index 727b7d81e9b..d3dc29cd7c1 100644
index 53c1cc48728..d6e5179235b 100644
--- a/dlls/wined3d/cs.c
+++ b/dlls/wined3d/cs.c
@@ -500,7 +500,8 @@ static UINT wined3d_cs_exec_present(struct wined3d_cs *cs, const void *data)
@@ -413,7 +413,8 @@ static void wined3d_cs_exec_present(struct wined3d_cs *cs, const void *data)
swapchain = op->swapchain;
wined3d_swapchain_set_window(swapchain, op->dst_window_override);
@ -26,10 +26,10 @@ index 727b7d81e9b..d3dc29cd7c1 100644
wined3d_resource_release(&swapchain->front_buffer->resource);
for (i = 0; i < swapchain->desc.backbuffer_count; ++i)
diff --git a/dlls/wined3d/swapchain.c b/dlls/wined3d/swapchain.c
index ae82ff0cf23..932d4076b93 100644
index ad2d6e26d53..7e48b5d12b5 100644
--- a/dlls/wined3d/swapchain.c
+++ b/dlls/wined3d/swapchain.c
@@ -485,10 +485,10 @@ static void wined3d_swapchain_rotate(struct wined3d_swapchain *swapchain, struct
@@ -488,10 +488,10 @@ static void wined3d_swapchain_rotate(struct wined3d_swapchain *swapchain, struct
}
static void swapchain_gl_present(struct wined3d_swapchain *swapchain,
@ -42,7 +42,7 @@ index ae82ff0cf23..932d4076b93 100644
const struct wined3d_gl_info *gl_info;
struct wined3d_texture *logo_texture;
struct wined3d_context *context;
@@ -619,14 +619,14 @@ static void swapchain_gl_present(struct wined3d_swapchain *swapchain,
@@ -622,14 +622,14 @@ static void swapchain_gl_present(struct wined3d_swapchain *swapchain,
wined3d_texture_validate_location(swapchain->back_buffers[swapchain->desc.backbuffer_count - 1],
0, WINED3D_LOCATION_DISCARDED);
@ -60,7 +60,7 @@ index ae82ff0cf23..932d4076b93 100644
}
context_release(context);
@@ -692,7 +692,8 @@ static void swapchain_gdi_frontbuffer_updated(struct wined3d_swapchain *swapchai
@@ -695,7 +695,8 @@ static void swapchain_gdi_frontbuffer_updated(struct wined3d_swapchain *swapchai
}
static void swapchain_gdi_present(struct wined3d_swapchain *swapchain,
@ -71,10 +71,10 @@ index ae82ff0cf23..932d4076b93 100644
struct wined3d_surface *front, *back;
HBITMAP bitmap;
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 0164de77eec..a098d7e62df 100644
index df3c92cb568..4986cb33465 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -3364,7 +3364,8 @@ void wined3d_unordered_access_view_invalidate_location(struct wined3d_unordered_
@@ -3393,7 +3393,8 @@ void wined3d_unordered_access_view_invalidate_location(struct wined3d_unordered_
struct wined3d_swapchain_ops
{
void (*swapchain_present)(struct wined3d_swapchain *swapchain,

View File

@ -1,377 +0,0 @@
From cc805e309ac623c64037c11868ab663b6e830fa5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20D=C3=B6singer?= <stefan@codeweavers.com>
Date: Wed, 10 Apr 2013 17:16:02 +0200
Subject: wined3d: Send light updates through the command stream
---
dlls/wined3d/cs.c | 194 +++++++++++++++++++++++++++++++++++------
dlls/wined3d/device.c | 31 ++-----
dlls/wined3d/wined3d_private.h | 6 +-
3 files changed, 174 insertions(+), 57 deletions(-)
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
index c6b7aa71ecd..727b7d81e9b 100644
--- a/dlls/wined3d/cs.c
+++ b/dlls/wined3d/cs.c
@@ -76,8 +76,9 @@ enum wined3d_cs_op
WINED3D_CS_OP_UNMAP,
WINED3D_CS_OP_GLFINISH,
WINED3D_CS_OP_PUSH_CONSTANTS,
- WINED3D_CS_OP_STATEBLOCK,
WINED3D_CS_OP_SET_PRIMITIVE_TYPE,
+ WINED3D_CS_OP_SET_LIGHT,
+ WINED3D_CS_OP_SET_LIGHT_ENABLE,
WINED3D_CS_OP_STOP,
};
@@ -378,16 +379,23 @@ struct wined3d_cs_push_constants
BYTE constants[1];
};
-struct wined3d_cs_stateblock
+struct wined3d_cs_set_primitive_type
{
enum wined3d_cs_op opcode;
- struct wined3d_state state;
+ GLenum gl_primitive_type;
};
-struct wined3d_cs_set_primitive_type
+struct wined3d_cs_set_light
{
enum wined3d_cs_op opcode;
- GLenum gl_primitive_type;
+ struct wined3d_light_info light;
+};
+
+struct wined3d_cs_set_light_enable
+{
+ enum wined3d_cs_op opcode;
+ UINT idx;
+ BOOL enable;
};
static inline BOOL wined3d_cs_process_block(struct wined3d_cs *cs, struct wined3d_cs_block *block);
@@ -1203,29 +1211,6 @@ void wined3d_cs_emit_set_texture(struct wined3d_cs *cs, UINT stage, struct wined
cs->ops->submit(cs);
}
-static UINT wined3d_cs_exec_transfer_stateblock(struct wined3d_cs *cs, const void *data)
-{
- const struct wined3d_cs_stateblock *op = data;
-
- memcpy(cs->state.lights, op->state.lights, sizeof(cs->state.lights));
-
- return sizeof(*op);
-}
-
-void wined3d_cs_emit_transfer_stateblock(struct wined3d_cs *cs, const struct wined3d_state *state)
-{
- struct wined3d_cs_stateblock *op;
-
- op = cs->ops->require_space(cs, sizeof(*op));
- op->opcode = WINED3D_CS_OP_STATEBLOCK;
-
- /* FIXME: This is not ideal. CS is still running synchronously, so this is ok.
- * It will go away soon anyway. */
- memcpy(op->state.lights, state->lights, sizeof(op->state.lights));
-
- cs->ops->submit(cs);
-}
-
static UINT wined3d_cs_exec_set_shader_resource_view(struct wined3d_cs *cs, const void *data)
{
const struct wined3d_cs_set_shader_resource_view *op = data;
@@ -1876,6 +1861,156 @@ void wined3d_cs_emit_set_primitive_type(struct wined3d_cs *cs, GLenum primitive_
cs->ops->submit(cs);
}
+static UINT wined3d_cs_exec_set_light(struct wined3d_cs *cs, const void *data)
+{
+ const struct wined3d_cs_set_light *op = data;
+
+ UINT light_idx = op->light.OriginalIndex;
+ UINT hash_idx = LIGHTMAP_HASHFUNC(op->light.OriginalIndex);
+ struct wined3d_light_info *object = NULL;
+ struct list *e;
+
+ LIST_FOR_EACH(e, &cs->state.light_map[hash_idx])
+ {
+ object = LIST_ENTRY(e, struct wined3d_light_info, entry);
+ if (object->OriginalIndex == light_idx)
+ break;
+ object = NULL;
+ }
+
+ if (!object)
+ {
+ TRACE("Adding new light\n");
+ object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
+ if (!object)
+ {
+ ERR("Out of memory!\n");
+ return sizeof(*op);
+ }
+
+ list_add_head(&cs->state.light_map[hash_idx], &object->entry);
+ object->glIndex = -1;
+ object->OriginalIndex = light_idx;
+ }
+
+ /* Update the live definitions if the light is currently assigned a glIndex. */
+ if (object->glIndex != -1)
+ {
+ if (object->OriginalParms.type != op->light.OriginalParms.type)
+ device_invalidate_state(cs->device, STATE_LIGHT_TYPE);
+ device_invalidate_state(cs->device, STATE_ACTIVELIGHT(object->glIndex));
+ }
+
+ object->OriginalParms = op->light.OriginalParms;
+ object->position = op->light.position;
+ object->direction = op->light.direction;
+ object->exponent = op->light.exponent;
+ object->cutoff = op->light.cutoff;
+
+ return sizeof(*op);
+}
+
+void wined3d_cs_emit_set_light(struct wined3d_cs *cs, const struct wined3d_light_info *light)
+{
+ struct wined3d_cs_set_light *op;
+
+ op = cs->ops->require_space(cs, sizeof(*op));
+ op->opcode = WINED3D_CS_OP_SET_LIGHT;
+ op->light = *light;
+
+ cs->ops->submit(cs);
+}
+
+static UINT wined3d_cs_exec_set_light_enable(struct wined3d_cs *cs, const void *data)
+{
+ const struct wined3d_cs_set_light_enable *op = data;
+ UINT hash_idx = LIGHTMAP_HASHFUNC(op->idx);
+ struct wined3d_light_info *light_info = NULL;
+ struct list *e;
+ struct wined3d_device *device = cs->device;
+
+ LIST_FOR_EACH(e, &cs->state.light_map[hash_idx])
+ {
+ light_info = LIST_ENTRY(e, struct wined3d_light_info, entry);
+ if (light_info->OriginalIndex == op->idx)
+ break;
+ light_info = NULL;
+ }
+ TRACE("Found light %p.\n", light_info);
+
+ /* Should be handled by the device by emitting a set_light op */
+ if (!light_info)
+ {
+ ERR("Light enabled requested but light not defined in cs state!\n");
+ return sizeof(*op);
+ }
+
+ if (!op->enable)
+ {
+ if (light_info->glIndex != -1)
+ {
+ device_invalidate_state(device, STATE_LIGHT_TYPE);
+ device_invalidate_state(device, STATE_ACTIVELIGHT(light_info->glIndex));
+ cs->state.lights[light_info->glIndex] = NULL;
+ light_info->glIndex = -1;
+ }
+ else
+ {
+ TRACE("Light already disabled, nothing to do\n");
+ }
+ light_info->enabled = FALSE;
+ }
+ else
+ {
+ light_info->enabled = TRUE;
+ if (light_info->glIndex != -1)
+ {
+ TRACE("Nothing to do as light was enabled\n");
+ }
+ else
+ {
+ unsigned int light_count = device->adapter->d3d_info.limits.active_light_count;
+ unsigned int i;
+
+ /* Find a free GL light. */
+ for (i = 0; i < light_count; ++i)
+ {
+ if (!cs->state.lights[i])
+ {
+ cs->state.lights[i] = light_info;
+ light_info->glIndex = i;
+ break;
+ }
+ }
+ if (light_info->glIndex == -1)
+ {
+ /* Should be caught by the device before emitting
+ * the light_enable op */
+ ERR("Too many concurrently active lights in cs\n");
+ return sizeof(*op);
+ }
+
+ /* i == light_info->glIndex */
+ device_invalidate_state(device, STATE_LIGHT_TYPE);
+ device_invalidate_state(device, STATE_ACTIVELIGHT(i));
+ }
+ }
+
+ return sizeof(*op);
+}
+
+void wined3d_cs_emit_set_light_enable(struct wined3d_cs *cs, UINT idx, BOOL enable)
+{
+ struct wined3d_cs_set_light_enable *op;
+
+ op = cs->ops->require_space(cs, sizeof(*op));
+ op->opcode = WINED3D_CS_OP_SET_LIGHT_ENABLE;
+ op->idx = idx;
+ op->enable = enable;
+
+ cs->ops->submit(cs);
+}
+
static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void *data) =
{
/* WINED3D_CS_OP_FENCE */ wined3d_cs_exec_fence,
@@ -1917,8 +2052,9 @@ static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void
/* WINED3D_CS_OP_UNMAP */ wined3d_cs_exec_unmap,
/* WINED3D_CS_OP_GLFINISH */ wined3d_cs_exec_glfinish,
/* WINED3D_CS_OP_PUSH_CONSTANTS */ wined3d_cs_exec_push_constants,
- /* WINED3D_CS_OP_STATEBLOCK */ wined3d_cs_exec_transfer_stateblock,
/* WINED3D_CS_OP_SET_PRIMITIVE_TYPE */ wined3d_cs_exec_set_primitive_type,
+ /* WINED3D_CS_OP_SET_LIGHT */ wined3d_cs_exec_set_light,
+ /* WINED3D_CS_OP_SET_LIGHT_ENABLE */ wined3d_cs_exec_set_light_enable,
};
static void *wined3d_cs_st_require_space(struct wined3d_cs *cs, size_t size)
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index e01ef6e3753..d20906e7cc5 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -1597,14 +1597,6 @@ HRESULT CDECL wined3d_device_set_light(struct wined3d_device *device,
light->direction.x, light->direction.y, light->direction.z,
light->range, light->falloff, light->theta, light->phi);
- /* Update the live definitions if the light is currently assigned a glIndex. */
- if (object->glIndex != -1 && !device->recording)
- {
- if (object->OriginalParms.type != light->type)
- device_invalidate_state(device, STATE_LIGHT_TYPE);
- device_invalidate_state(device, STATE_ACTIVELIGHT(object->glIndex));
- }
-
/* Save away the information. */
object->OriginalParms = *light;
@@ -1684,6 +1676,9 @@ HRESULT CDECL wined3d_device_set_light(struct wined3d_device *device,
FIXME("Unrecognized light type %#x.\n", light->type);
}
+ if (!device->recording)
+ wined3d_cs_emit_set_light(device->cs, object);
+
return WINED3D_OK;
}
@@ -1756,12 +1751,6 @@ HRESULT CDECL wined3d_device_set_light_enable(struct wined3d_device *device, UIN
{
if (light_info->glIndex != -1)
{
- if (!device->recording)
- {
- device_invalidate_state(device, STATE_LIGHT_TYPE);
- device_invalidate_state(device, STATE_ACTIVELIGHT(light_info->glIndex));
- }
-
device->update_state->lights[light_info->glIndex] = NULL;
light_info->glIndex = -1;
}
@@ -1804,16 +1793,12 @@ HRESULT CDECL wined3d_device_set_light_enable(struct wined3d_device *device, UIN
WARN("Too many concurrently active lights\n");
return WINED3D_OK;
}
-
- /* i == light_info->glIndex */
- if (!device->recording)
- {
- device_invalidate_state(device, STATE_LIGHT_TYPE);
- device_invalidate_state(device, STATE_ACTIVELIGHT(i));
- }
}
}
+ if (!device->recording)
+ wined3d_cs_emit_set_light_enable(device->cs, light_idx, enable);
+
return WINED3D_OK;
}
@@ -3648,7 +3633,6 @@ HRESULT CDECL wined3d_device_draw_primitive(struct wined3d_device *device, UINT
{
TRACE("device %p, start_vertex %u, vertex_count %u.\n", device, start_vertex, vertex_count);
- wined3d_cs_emit_transfer_stateblock(device->cs, &device->state);
wined3d_cs_emit_draw(device->cs, 0, start_vertex, vertex_count, 0, 0, FALSE);
return WINED3D_OK;
@@ -3660,7 +3644,6 @@ void CDECL wined3d_device_draw_primitive_instanced(struct wined3d_device *device
TRACE("device %p, start_vertex %u, vertex_count %u, start_instance %u, instance_count %u.\n",
device, start_vertex, vertex_count, start_instance, instance_count);
- wined3d_cs_emit_transfer_stateblock(device->cs, &device->state);
wined3d_cs_emit_draw(device->cs, 0, start_vertex, vertex_count, start_instance, instance_count, FALSE);
}
@@ -3678,7 +3661,6 @@ HRESULT CDECL wined3d_device_draw_indexed_primitive(struct wined3d_device *devic
return WINED3DERR_INVALIDCALL;
}
- wined3d_cs_emit_transfer_stateblock(device->cs, &device->state);
wined3d_cs_emit_draw(device->cs, device->state.base_vertex_index, start_idx, index_count, 0, 0, TRUE);
return WINED3D_OK;
@@ -3690,7 +3672,6 @@ void CDECL wined3d_device_draw_indexed_primitive_instanced(struct wined3d_device
TRACE("device %p, start_idx %u, index_count %u, start_instance %u, instance_count %u.\n",
device, start_idx, index_count, start_instance, instance_count);
- wined3d_cs_emit_transfer_stateblock(device->cs, &device->state);
wined3d_cs_emit_draw(device->cs, device->state.base_vertex_index,
start_idx, index_count, start_instance, instance_count, TRUE);
}
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 354f9fe62d0..0164de77eec 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -3124,7 +3124,7 @@ struct wined3d_cs_block
{
struct list entry;
UINT pos;
- BYTE data[sizeof(struct wined3d_state) * 2]; /* FIXME? The size is somewhat arbitrary. */
+ BYTE data[0x4000]; /* FIXME? The size is somewhat arbitrary. */
};
struct wined3d_cs_ops
@@ -3182,12 +3182,12 @@ void wined3d_cs_emit_set_color_key(struct wined3d_cs *cs, struct wined3d_texture
WORD flags, const struct wined3d_color_key *color_key) DECLSPEC_HIDDEN;
void wined3d_cs_emit_set_constant_buffer(struct wined3d_cs *cs, enum wined3d_shader_type type,
UINT cb_idx, struct wined3d_buffer *buffer) DECLSPEC_HIDDEN;
-void wined3d_cs_emit_transfer_stateblock(struct wined3d_cs *cs,
- const struct wined3d_state *state) DECLSPEC_HIDDEN;
void wined3d_cs_emit_set_depth_stencil_view(struct wined3d_cs *cs,
struct wined3d_rendertarget_view *view) DECLSPEC_HIDDEN;
void wined3d_cs_emit_set_index_buffer(struct wined3d_cs *cs, struct wined3d_buffer *buffer,
enum wined3d_format_id format_id, unsigned int offset) DECLSPEC_HIDDEN;
+void wined3d_cs_emit_set_light(struct wined3d_cs *cs, const struct wined3d_light_info *light) DECLSPEC_HIDDEN;
+void wined3d_cs_emit_set_light_enable(struct wined3d_cs *cs, UINT idx, BOOL enable) DECLSPEC_HIDDEN;
void wined3d_cs_emit_set_material(struct wined3d_cs *cs, const struct wined3d_material *material) DECLSPEC_HIDDEN;
void wined3d_cs_emit_set_predication(struct wined3d_cs *cs,
struct wined3d_query *predicate, BOOL value) DECLSPEC_HIDDEN;
--
2.11.0

View File

@ -1,4 +1,4 @@
From fa711d72c0f46697e7faecfb5ad128d19254d767 Mon Sep 17 00:00:00 2001
From 7e1cd67f99767509847f9914eb1ad37973f9034c 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 d3dc29cd7c1..e738c6ff058 100644
index d6e5179235b..66f7034686f 100644
--- a/dlls/wined3d/cs.c
+++ b/dlls/wined3d/cs.c
@@ -503,6 +503,8 @@ static UINT wined3d_cs_exec_present(struct wined3d_cs *cs, const void *data)
@@ -416,6 +416,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,
cs->state.fb->depth_stencil);
@ -21,7 +21,7 @@ index d3dc29cd7c1..e738c6ff058 100644
wined3d_resource_release(&swapchain->front_buffer->resource);
for (i = 0; i < swapchain->desc.backbuffer_count; ++i)
{
@@ -517,6 +519,7 @@ void wined3d_cs_emit_present(struct wined3d_cs *cs, struct wined3d_swapchain *sw
@@ -428,6 +430,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 d3dc29cd7c1..e738c6ff058 100644
op = cs->ops->require_space(cs, sizeof(*op));
op->opcode = WINED3D_CS_OP_PRESENT;
@@ -532,7 +535,20 @@ void wined3d_cs_emit_present(struct wined3d_cs *cs, struct wined3d_swapchain *sw
@@ -443,7 +446,20 @@ void wined3d_cs_emit_present(struct wined3d_cs *cs, struct wined3d_swapchain *sw
wined3d_resource_acquire(&swapchain->back_buffers[i]->resource);
}
@ -49,20 +49,20 @@ index d3dc29cd7c1..e738c6ff058 100644
+ pending = InterlockedCompareExchange(&cs->pending_presents, 0, 0);
}
static UINT wined3d_cs_exec_clear(struct wined3d_cs *cs, const void *data)
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 a098d7e62df..c28dd691a14 100644
index 4986cb33465..772a8492fb0 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -3148,6 +3148,8 @@ struct wined3d_cs
@@ -3180,6 +3180,8 @@ struct wined3d_cs
struct wined3d_cs_list free_list;
struct wined3d_cs_list exec_list;
size_t data_size, start, end;
void *data;
+
+ LONG pending_presents;
};
static inline void wined3d_resource_wait_idle(struct wined3d_resource *resource)
struct wined3d_cs *wined3d_cs_create(struct wined3d_device *device) DECLSPEC_HIDDEN;
--
2.11.0

View File

@ -1,4 +1,4 @@
From 72a55c637885a2362af6c091a82bf9e0b0f313bb Mon Sep 17 00:00:00 2001
From 878bdfc42f19e26f2e4dbefdb9bd0b50bd341d97 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20D=C3=B6singer?= <stefan@codeweavers.com>
Date: Mon, 29 Apr 2013 18:49:53 +0200
Subject: wined3d: Send blits through the command stream.
@ -6,52 +6,25 @@ Subject: wined3d: Send blits through the command stream.
This needs more work. This patch breaks error handling, and the split
between surface_blt and surface_blt_ugly isn't particularly nice.
---
dlls/d3d11/tests/d3d11.c | 6 +-
dlls/wined3d/cs.c | 54 +++++++++
dlls/wined3d/cs.c | 52 +++++++++
dlls/wined3d/device.c | 26 +++++
dlls/wined3d/surface.c | 249 +++++++++++++++++++++++++----------------
dlls/wined3d/surface.c | 240 ++++++++++++++++++++++++-----------------
dlls/wined3d/wined3d_private.h | 7 ++
5 files changed, 242 insertions(+), 100 deletions(-)
4 files changed, 228 insertions(+), 97 deletions(-)
diff --git a/dlls/d3d11/tests/d3d11.c b/dlls/d3d11/tests/d3d11.c
index c1a99ce0ab9..a05dcb1fae3 100644
--- a/dlls/d3d11/tests/d3d11.c
+++ b/dlls/d3d11/tests/d3d11.c
@@ -9533,7 +9533,7 @@ static void test_draw_uav_only(void)
draw_quad(&test_context);
draw_quad(&test_context);
draw_quad(&test_context);
- todo_wine check_texture_color(texture, 500, 1);
+ check_texture_color(texture, 500, 1);
ID3D11PixelShader_Release(ps);
ID3D11Texture2D_Release(texture);
@@ -13463,10 +13463,10 @@ static void test_ps_cs_uav_binding(void)
input.x = 4.0f;
ID3D11DeviceContext_UpdateSubresource(context, (ID3D11Resource *)ps_cb, 0, NULL, &input, 0, 0);
ID3D11DeviceContext_Dispatch(context, 1, 1, 1);
- todo_wine check_texture_float(cs_texture, 8.0f, 2);
+ check_texture_float(cs_texture, 8.0f, 2);
check_texture_float(ps_texture, 2.0f, 2);
draw_quad(&test_context);
- todo_wine check_texture_float(cs_texture, 8.0f, 2);
+ check_texture_float(cs_texture, 8.0f, 2);
check_texture_float(ps_texture, 4.0f, 2);
ID3D11ComputeShader_Release(cs);
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
index 1fa4fe7eb83..ceef9294cd8 100644
index 66f7034686f..6bea12aa713 100644
--- a/dlls/wined3d/cs.c
+++ b/dlls/wined3d/cs.c
@@ -79,6 +79,7 @@ enum wined3d_cs_op
@@ -67,6 +67,7 @@ enum wined3d_cs_op
WINED3D_CS_OP_SET_PRIMITIVE_TYPE,
WINED3D_CS_OP_SET_LIGHT,
WINED3D_CS_OP_SET_LIGHT_ENABLE,
+ WINED3D_CS_OP_BLT,
WINED3D_CS_OP_STOP,
};
@@ -399,6 +400,18 @@ struct wined3d_cs_set_light_enable
struct wined3d_cs_sync
@@ -372,6 +373,18 @@ struct wined3d_cs_set_light_enable
BOOL enable;
};
@ -67,14 +40,14 @@ index 1fa4fe7eb83..ceef9294cd8 100644
+ enum wined3d_texture_filter_type filter;
+};
+
static inline BOOL wined3d_cs_process_block(struct wined3d_cs *cs, struct wined3d_cs_block *block);
static void wined3d_cs_mt_submit(struct wined3d_cs *cs);
@@ -2052,6 +2065,46 @@ void wined3d_cs_emit_set_light_enable(struct wined3d_cs *cs, UINT idx, BOOL enab
static void wined3d_cs_exec_sync(struct wined3d_cs *cs, const void *data)
{
}
@@ -1793,6 +1806,44 @@ void wined3d_cs_emit_set_light_enable(struct wined3d_cs *cs, UINT idx, BOOL enab
cs->ops->submit(cs);
}
+static UINT wined3d_cs_exec_blt(struct wined3d_cs *cs, const void *data)
+static void wined3d_cs_exec_blt(struct wined3d_cs *cs, const void *data)
+{
+ const struct wined3d_cs_blt *op = data;
+
@ -85,8 +58,6 @@ index 1fa4fe7eb83..ceef9294cd8 100644
+ wined3d_resource_release(&op->dst_surface->container->resource);
+ if (op->src_surface && op->src_surface != op->dst_surface)
+ wined3d_resource_release(&op->src_surface->container->resource);
+
+ return sizeof(*op);
+}
+
+void wined3d_cs_emit_blt(struct wined3d_cs *cs, struct wined3d_surface *dst_surface,
@ -114,10 +85,10 @@ index 1fa4fe7eb83..ceef9294cd8 100644
+ cs->ops->submit(cs);
+}
+
static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void *data) =
static void (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void *data) =
{
/* WINED3D_CS_OP_FENCE */ wined3d_cs_exec_fence,
@@ -2096,6 +2149,7 @@ static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void
/* WINED3D_CS_OP_SYNC */ wined3d_cs_exec_sync,
@@ -1836,6 +1887,7 @@ static void (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void
/* WINED3D_CS_OP_SET_PRIMITIVE_TYPE */ wined3d_cs_exec_set_primitive_type,
/* WINED3D_CS_OP_SET_LIGHT */ wined3d_cs_exec_set_light,
/* WINED3D_CS_OP_SET_LIGHT_ENABLE */ wined3d_cs_exec_set_light_enable,
@ -126,10 +97,10 @@ index 1fa4fe7eb83..ceef9294cd8 100644
static void *wined3d_cs_st_require_space(struct wined3d_cs *cs, size_t size)
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index 07543965df2..5ae2d202c83 100644
index dd8943d2e3e..66815f80647 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -4084,6 +4084,7 @@ HRESULT CDECL wined3d_device_copy_sub_resource_region(struct wined3d_device *dev
@@ -4017,6 +4017,7 @@ HRESULT CDECL wined3d_device_copy_sub_resource_region(struct wined3d_device *dev
struct wined3d_texture *dst_texture, *src_texture;
RECT dst_rect, src_rect;
HRESULT hr;
@ -137,7 +108,7 @@ index 07543965df2..5ae2d202c83 100644
TRACE("device %p, dst_resource %p, dst_sub_resource_idx %u, dst_x %u, dst_y %u, dst_z %u, "
"src_resource %p, src_sub_resource_idx %u, src_box %s.\n",
@@ -4171,6 +4172,14 @@ HRESULT CDECL wined3d_device_copy_sub_resource_region(struct wined3d_device *dev
@@ -4104,6 +4105,14 @@ HRESULT CDECL wined3d_device_copy_sub_resource_region(struct wined3d_device *dev
if (src_box)
{
@ -152,7 +123,7 @@ index 07543965df2..5ae2d202c83 100644
SetRect(&src_rect, src_box->left, src_box->top, src_box->right, src_box->bottom);
}
else
@@ -4184,6 +4193,23 @@ HRESULT CDECL wined3d_device_copy_sub_resource_region(struct wined3d_device *dev
@@ -4117,6 +4126,23 @@ HRESULT CDECL wined3d_device_copy_sub_resource_region(struct wined3d_device *dev
SetRect(&dst_rect, dst_x, dst_y, dst_x + (src_rect.right - src_rect.left),
dst_y + (src_rect.bottom - src_rect.top));
@ -177,10 +148,10 @@ index 07543965df2..5ae2d202c83 100644
src_texture, src_sub_resource_idx, &src_rect, 0, NULL, WINED3D_TEXF_POINT)))
WARN("Failed to blit, hr %#x.\n", hr);
diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
index 4fe16917296..4ddcdcb58b8 100644
index 19d6aa74373..5b8434d63b8 100644
--- a/dlls/wined3d/surface.c
+++ b/dlls/wined3d/surface.c
@@ -3891,7 +3891,7 @@ const struct blit_shader cpu_blit = {
@@ -3794,7 +3794,7 @@ const struct blit_shader cpu_blit = {
cpu_blit_blit_surface,
};
@ -189,7 +160,7 @@ index 4fe16917296..4ddcdcb58b8 100644
struct wined3d_surface *src_surface, const RECT *src_rect, DWORD flags,
const struct wined3d_blt_fx *fx, enum wined3d_texture_filter_type filter)
{
@@ -3901,9 +3901,8 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst
@@ -3804,9 +3804,8 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst
struct wined3d_texture *dst_texture = dst_surface->container;
struct wined3d_device *device = dst_texture->resource.device;
struct wined3d_swapchain *src_swapchain, *dst_swapchain;
@ -201,7 +172,7 @@ index 4fe16917296..4ddcdcb58b8 100644
DWORD src_ds_flags, dst_ds_flags;
BOOL scale, convert;
@@ -3916,84 +3915,17 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst
@@ -3819,84 +3818,17 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst
| WINED3D_BLT_DO_NOT_WAIT
| WINED3D_BLT_ALPHA_TEST;
@ -291,7 +262,7 @@ index 4fe16917296..4ddcdcb58b8 100644
}
if (!device->d3d_initialized)
@@ -4018,11 +3950,6 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst
@@ -3921,11 +3853,6 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst
goto fallback;
}
@ -303,7 +274,7 @@ index 4fe16917296..4ddcdcb58b8 100644
dst_swapchain = dst_texture->swapchain;
/* This isn't strictly needed. FBO blits for example could deal with
@@ -4058,22 +3985,16 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst
@@ -3961,22 +3888,16 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst
TRACE("Depth fill.\n");
if (!surface_convert_depth_to_float(dst_surface, fx->fill_color, &depth))
@ -329,7 +300,7 @@ index 4fe16917296..4ddcdcb58b8 100644
}
}
else
@@ -4109,7 +4030,7 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst
@@ -4012,7 +3933,7 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst
goto fallback;
if (SUCCEEDED(surface_color_fill(dst_surface, dst_rect, &color)))
@ -338,7 +309,7 @@ index 4fe16917296..4ddcdcb58b8 100644
}
else
{
@@ -4152,7 +4073,7 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst
@@ -4056,7 +3977,7 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst
context, dst_texture->resource.draw_binding);
context_release(context);
}
@ -347,7 +318,7 @@ index 4fe16917296..4ddcdcb58b8 100644
}
}
}
@@ -4176,7 +4097,7 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst
@@ -4080,7 +4001,7 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst
wined3d_swapchain_present(dst_swapchain, NULL, NULL, dst_swapchain->win_handle, 0);
dst_swapchain->desc.swap_effect = swap_effect;
@ -356,7 +327,7 @@ index 4fe16917296..4ddcdcb58b8 100644
}
if (fbo_blit_supported(&device->adapter->gl_info, blit_op,
@@ -4197,7 +4118,7 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst
@@ -4101,7 +4022,7 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst
wined3d_texture_invalidate_location(dst_texture, dst_sub_resource_idx,
~dst_texture->resource.draw_binding);
@ -365,7 +336,7 @@ index 4fe16917296..4ddcdcb58b8 100644
}
blitter = wined3d_select_blitter(&device->adapter->gl_info, &device->adapter->d3d_info, blit_op,
@@ -4207,7 +4128,7 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst
@@ -4111,7 +4032,7 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst
{
blitter->blit_surface(device, blit_op, filter, src_surface,
src_rect, dst_surface, dst_rect, color_key);
@ -374,7 +345,7 @@ index 4fe16917296..4ddcdcb58b8 100644
}
}
}
@@ -4215,9 +4136,143 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst
@@ -4119,9 +4040,134 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst
fallback:
/* Special cases for render targets. */
if (SUCCEEDED(surface_blt_special(dst_surface, dst_rect, src_surface, src_rect, flags, fx, filter)))
@ -425,16 +396,7 @@ index 4fe16917296..4ddcdcb58b8 100644
+
+ if (dst_sub_resource->map_count || (src_sub_resource && src_sub_resource->map_count))
+ {
+ /* TODO: Separate application maps from internal maps */
+ if (!wined3d_settings.cs_multithreaded)
+ {
+ WARN("Surface is busy, returning WINEDDERR_SURFACEBUSY.\n");
+ return WINEDDERR_SURFACEBUSY;
+ }
+
+ wined3d_cs_emit_glfinish(device->cs);
+ device->cs->ops->submit_and_wait(device->cs);
+
+ wined3d_cs_emit_sync(device->cs);
+ if (dst_sub_resource->map_count || (src_sub_resource && src_sub_resource->map_count))
+ {
+ WARN("Surface is busy, returning WINEDDERR_SURFACEBUSY.\n");
@ -521,10 +483,10 @@ index 4fe16917296..4ddcdcb58b8 100644
+ return WINED3D_OK;
+}
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index d8fcecb82d9..605e2bf50d0 100644
index 772a8492fb0..8dc18c856c9 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -3030,6 +3030,9 @@ HRESULT surface_upload_from_surface(struct wined3d_surface *dst_surface, const P
@@ -3036,6 +3036,9 @@ HRESULT surface_upload_from_surface(struct wined3d_surface *dst_surface, const P
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;
@ -534,17 +496,17 @@ index d8fcecb82d9..605e2bf50d0 100644
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;
@@ -3200,6 +3203,10 @@ static inline void wined3d_resource_wait_idle(struct wined3d_resource *resource)
struct wined3d_cs *wined3d_cs_create(struct wined3d_device *device) DECLSPEC_HIDDEN;
@@ -3188,6 +3191,10 @@ struct wined3d_cs *wined3d_cs_create(struct wined3d_device *device) DECLSPEC_HID
void wined3d_cs_destroy(struct wined3d_cs *cs) DECLSPEC_HIDDEN;
void wined3d_cs_destroy_object(struct wined3d_cs *cs,
void (*callback)(void *object), void *object) DECLSPEC_HIDDEN;
+void wined3d_cs_emit_blt(struct wined3d_cs *cs, struct wined3d_surface *dst_surface,
+ const RECT *dst_rect, struct wined3d_surface *src_surface,
+ const RECT *src_rect, DWORD flags, const struct wined3d_blt_fx *fx,
+ enum wined3d_texture_filter_type filter) DECLSPEC_HIDDEN;
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;
void wined3d_cs_emit_destroy_object(struct wined3d_cs *cs,
void wined3d_cs_emit_dispatch(struct wined3d_cs *cs,
--
2.11.0

View File

@ -1,45 +1,17 @@
From 84d03d3dd23a3f1f9f80297a2cb30a6c383ab7bb Mon Sep 17 00:00:00 2001
From 057495030f198c62cefb1f93c0d73e6ce714f7f9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20D=C3=B6singer?= <stefan@codeweavers.com>
Date: Thu, 4 Jul 2013 21:10:16 +0200
Subject: wined3d: Send render target view clears through the command stream
---
dlls/d3d10core/tests/device.c | 2 +-
dlls/d3d11/tests/d3d11.c | 2 +-
dlls/d3d9/tests/visual.c | 2 +-
dlls/wined3d/cs.c | 51 ++++++++++++++++++++++++++++++++++++++++++
dlls/wined3d/device.c | 6 ++---
dlls/wined3d/cs.c | 49 ++++++++++++++++++++++++++++++++++++++++++
dlls/wined3d/device.c | 6 ++----
dlls/wined3d/wined3d_private.h | 3 +++
6 files changed, 59 insertions(+), 7 deletions(-)
4 files changed, 55 insertions(+), 5 deletions(-)
diff --git a/dlls/d3d10core/tests/device.c b/dlls/d3d10core/tests/device.c
index 5ca4a14fa6a..c1dbe9e835f 100644
--- a/dlls/d3d10core/tests/device.c
+++ b/dlls/d3d10core/tests/device.c
@@ -3759,7 +3759,7 @@ static void test_occlusion_query(void)
memset(&data, 0xff, sizeof(data));
hr = ID3D10Asynchronous_GetData(query, &data, sizeof(data), 0);
ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
- todo_wine ok(data.uint == 640 * 480, "Got unexpected query result 0x%08x%08x.\n", data.dword[1], data.dword[0]);
+ ok(data.uint == 640 * 480, "Got unexpected query result 0x%08x%08x.\n", data.dword[1], data.dword[0]);
memset(&data, 0xff, sizeof(data));
hr = ID3D10Asynchronous_GetData(query, &data, sizeof(DWORD), 0);
diff --git a/dlls/d3d11/tests/d3d11.c b/dlls/d3d11/tests/d3d11.c
index eb67dfc07fd..a63a4ea507b 100644
--- a/dlls/d3d11/tests/d3d11.c
+++ b/dlls/d3d11/tests/d3d11.c
@@ -5245,7 +5245,7 @@ static void test_occlusion_query(void)
memset(&data, 0xff, sizeof(data));
hr = ID3D11DeviceContext_GetData(context, query, &data, sizeof(data), 0);
ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
- todo_wine ok(data.uint == 640 * 480, "Got unexpected query result 0x%08x%08x.\n", data.dword[1], data.dword[0]);
+ ok(data.uint == 640 * 480, "Got unexpected query result 0x%08x%08x.\n", data.dword[1], data.dword[0]);
memset(&data, 0xff, sizeof(data));
hr = ID3D11DeviceContext_GetData(context, query, &data, sizeof(DWORD), 0);
diff --git a/dlls/d3d9/tests/visual.c b/dlls/d3d9/tests/visual.c
index 3543db7173c..e85f1ca7f0f 100644
index 7fb3dbb7fe8..0aa4939e92b 100644
--- a/dlls/d3d9/tests/visual.c
+++ b/dlls/d3d9/tests/visual.c
@@ -1337,7 +1337,7 @@ static void color_fill_test(void)
@ -52,18 +24,18 @@ index 3543db7173c..e85f1ca7f0f 100644
* supported as offscreen plain surfaces and do not support D3DUSAGE_RENDERTARGET
* when created as texture. */
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
index 30020d62c0c..3747197a26e 100644
index 6bea12aa713..85eff68043d 100644
--- a/dlls/wined3d/cs.c
+++ b/dlls/wined3d/cs.c
@@ -80,6 +80,7 @@ enum wined3d_cs_op
@@ -68,6 +68,7 @@ enum wined3d_cs_op
WINED3D_CS_OP_SET_LIGHT,
WINED3D_CS_OP_SET_LIGHT_ENABLE,
WINED3D_CS_OP_BLT,
+ WINED3D_CS_OP_CLEAR_RTV,
WINED3D_CS_OP_STOP,
};
@@ -411,6 +412,18 @@ struct wined3d_cs_blt
struct wined3d_cs_sync
@@ -385,6 +386,18 @@ struct wined3d_cs_blt
enum wined3d_texture_filter_type filter;
};
@ -79,14 +51,14 @@ index 30020d62c0c..3747197a26e 100644
+ const struct blit_shader *blitter;
+};
+
static inline BOOL wined3d_cs_process_block(struct wined3d_cs *cs, struct wined3d_cs_block *block);
static void wined3d_cs_mt_submit(struct wined3d_cs *cs);
@@ -2081,6 +2094,43 @@ void wined3d_cs_emit_blt(struct wined3d_cs *cs, struct wined3d_surface *dst_surf
static void wined3d_cs_exec_sync(struct wined3d_cs *cs, const void *data)
{
}
@@ -1844,6 +1857,41 @@ void wined3d_cs_emit_blt(struct wined3d_cs *cs, struct wined3d_surface *dst_surf
cs->ops->submit(cs);
}
+static UINT wined3d_cs_exec_clear_rtv(struct wined3d_cs *cs, const void *data)
+static void wined3d_cs_exec_clear_rtv(struct wined3d_cs *cs, const void *data)
+{
+ const struct wined3d_cs_clear_rtv *op = data;
+ struct wined3d_device *device = cs->device;
@ -97,8 +69,6 @@ index 30020d62c0c..3747197a26e 100644
+ op->blitter->depth_fill(device, op->view, &op->rect, op->flags, op->depth, op->stencil);
+
+ wined3d_resource_release(op->view->resource);
+
+ return sizeof(*op);
+}
+
+void wined3d_cs_emit_clear_rtv(struct wined3d_cs *cs, struct wined3d_rendertarget_view *view,
@ -123,10 +93,10 @@ index 30020d62c0c..3747197a26e 100644
+ cs->ops->submit(cs);
+}
+
static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void *data) =
static void (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void *data) =
{
/* WINED3D_CS_OP_FENCE */ wined3d_cs_exec_fence,
@@ -2126,6 +2176,7 @@ static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void
/* WINED3D_CS_OP_SYNC */ wined3d_cs_exec_sync,
@@ -1888,6 +1936,7 @@ static void (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void
/* WINED3D_CS_OP_SET_LIGHT */ wined3d_cs_exec_set_light,
/* WINED3D_CS_OP_SET_LIGHT_ENABLE */ wined3d_cs_exec_set_light_enable,
/* WINED3D_CS_OP_BLT */ wined3d_cs_exec_blt,
@ -135,10 +105,10 @@ index 30020d62c0c..3747197a26e 100644
static void *wined3d_cs_st_require_space(struct wined3d_cs *cs, size_t size)
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index e1a02212900..4fcc496bb2d 100644
index 66815f80647..3176aed1ddc 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -4333,10 +4333,8 @@ HRESULT CDECL wined3d_device_clear_rendertarget_view(struct wined3d_device *devi
@@ -4273,10 +4273,8 @@ HRESULT CDECL wined3d_device_clear_rendertarget_view(struct wined3d_device *devi
return WINED3DERR_INVALIDCALL;
}
@ -152,19 +122,19 @@ index e1a02212900..4fcc496bb2d 100644
struct wined3d_rendertarget_view * CDECL wined3d_device_get_rendertarget_view(const struct wined3d_device *device,
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 84c592249aa..f3f356e2f66 100644
index 8dc18c856c9..2b3ac98c35e 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -3170,6 +3170,9 @@ void wined3d_cs_emit_blt(struct wined3d_cs *cs, struct wined3d_surface *dst_surf
@@ -3197,6 +3197,9 @@ void wined3d_cs_emit_blt(struct wined3d_cs *cs, struct wined3d_surface *dst_surf
enum wined3d_texture_filter_type filter) DECLSPEC_HIDDEN;
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;
+void wined3d_cs_emit_clear_rtv(struct wined3d_cs *cs, struct wined3d_rendertarget_view *view,
+ const RECT *rect, DWORD flags, const struct wined3d_color *color, float depth, DWORD stencil,
+ const struct blit_shader *blitter) DECLSPEC_HIDDEN;
void wined3d_cs_emit_destroy_object(struct wined3d_cs *cs,
void (*callback)(void *object), void *object) DECLSPEC_HIDDEN;
void wined3d_cs_emit_dispatch(struct wined3d_cs *cs,
unsigned int group_count_x, unsigned int group_count_y, unsigned int group_count_z) DECLSPEC_HIDDEN;
void wined3d_cs_emit_draw(struct wined3d_cs *cs, int base_vertex_idx, unsigned int start_idx, unsigned int index_count,
--
2.11.0

View File

@ -1,4 +1,4 @@
From 411975471c98c4783b827dfdc075afdc7653eba8 Mon Sep 17 00:00:00 2001
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
@ -11,10 +11,10 @@ impact.
1 file changed, 9 deletions(-)
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index 4fcc496bb2d..e236edd97f2 100644
index 3176aed1ddc..69f88b3420c 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -3510,8 +3510,6 @@ HRESULT CDECL wined3d_device_begin_scene(struct wined3d_device *device)
@@ -3457,8 +3457,6 @@ HRESULT CDECL wined3d_device_begin_scene(struct wined3d_device *device)
HRESULT CDECL wined3d_device_end_scene(struct wined3d_device *device)
{
@ -23,7 +23,7 @@ index 4fcc496bb2d..e236edd97f2 100644
TRACE("device %p.\n", device);
if (!device->inScene)
@@ -3520,13 +3518,6 @@ HRESULT CDECL wined3d_device_end_scene(struct wined3d_device *device)
@@ -3467,13 +3465,6 @@ HRESULT CDECL wined3d_device_end_scene(struct wined3d_device *device)
return WINED3DERR_INVALIDCALL;
}

View File

@ -1,28 +1,28 @@
From 10b5913937a14ede48139d7476ffe14de6f89c6a Mon Sep 17 00:00:00 2001
From 4066f34901ea2c033f4b873822fd6cca421debf5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20D=C3=B6singer?= <stefan@codeweavers.com>
Date: Thu, 1 Aug 2013 00:33:48 +0200
Subject: wined3d: Send update_texture calls through the CS
FIXME: This logic duplication is ugly.
---
dlls/wined3d/cs.c | 39 +++++++++
dlls/wined3d/cs.c | 37 +++++++++
dlls/wined3d/device.c | 175 +++++++++++++++++++++++------------------
dlls/wined3d/wined3d_private.h | 4 +
3 files changed, 143 insertions(+), 75 deletions(-)
3 files changed, 141 insertions(+), 75 deletions(-)
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
index 3747197a26e..9f7f8455a01 100644
index 85eff68043d..6ffdd920403 100644
--- a/dlls/wined3d/cs.c
+++ b/dlls/wined3d/cs.c
@@ -81,6 +81,7 @@ enum wined3d_cs_op
@@ -69,6 +69,7 @@ enum wined3d_cs_op
WINED3D_CS_OP_SET_LIGHT_ENABLE,
WINED3D_CS_OP_BLT,
WINED3D_CS_OP_CLEAR_RTV,
+ WINED3D_CS_OP_UPDATE_TEXTURE,
WINED3D_CS_OP_STOP,
};
@@ -424,6 +425,12 @@ struct wined3d_cs_clear_rtv
struct wined3d_cs_sync
@@ -398,6 +399,12 @@ struct wined3d_cs_clear_rtv
const struct blit_shader *blitter;
};
@ -32,14 +32,14 @@ index 3747197a26e..9f7f8455a01 100644
+ struct wined3d_texture *src, *dst;
+};
+
static inline BOOL wined3d_cs_process_block(struct wined3d_cs *cs, struct wined3d_cs_block *block);
static void wined3d_cs_mt_submit(struct wined3d_cs *cs);
@@ -2131,6 +2138,37 @@ void wined3d_cs_emit_clear_rtv(struct wined3d_cs *cs, struct wined3d_rendertarge
static void wined3d_cs_exec_sync(struct wined3d_cs *cs, const void *data)
{
}
@@ -1892,6 +1899,35 @@ void wined3d_cs_emit_clear_rtv(struct wined3d_cs *cs, struct wined3d_rendertarge
cs->ops->submit(cs);
}
+static UINT wined3d_cs_exec_update_texture(struct wined3d_cs *cs, const void *data)
+static void wined3d_cs_exec_update_texture(struct wined3d_cs *cs, const void *data)
+{
+ const struct wined3d_cs_update_texture *op = data;
+ struct wined3d_context *context;
@ -50,8 +50,6 @@ index 3747197a26e..9f7f8455a01 100644
+
+ wined3d_resource_release(&op->src->resource);
+ wined3d_resource_release(&op->dst->resource);
+
+ return sizeof(*op);
+}
+
+void wined3d_cs_emit_update_texture(struct wined3d_cs *cs, struct wined3d_texture *src,
@ -70,10 +68,10 @@ index 3747197a26e..9f7f8455a01 100644
+ cs->ops->submit(cs);
+}
+
static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void *data) =
static void (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void *data) =
{
/* WINED3D_CS_OP_FENCE */ wined3d_cs_exec_fence,
@@ -2177,6 +2215,7 @@ static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void
/* WINED3D_CS_OP_SYNC */ wined3d_cs_exec_sync,
@@ -1937,6 +1973,7 @@ static void (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void
/* WINED3D_CS_OP_SET_LIGHT_ENABLE */ wined3d_cs_exec_set_light_enable,
/* WINED3D_CS_OP_BLT */ wined3d_cs_exec_blt,
/* WINED3D_CS_OP_CLEAR_RTV */ wined3d_cs_exec_clear_rtv,
@ -82,10 +80,10 @@ index 3747197a26e..9f7f8455a01 100644
static void *wined3d_cs_st_require_space(struct wined3d_cs *cs, size_t size)
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index e236edd97f2..f712113e86e 100644
index 69f88b3420c..6e7d4f800b3 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -3670,34 +3670,17 @@ void CDECL wined3d_device_draw_indexed_primitive_instanced(struct wined3d_device
@@ -3617,34 +3617,17 @@ void CDECL wined3d_device_draw_indexed_primitive_instanced(struct wined3d_device
start_idx, index_count, start_instance, instance_count, TRUE);
}
@ -124,7 +122,7 @@ index e236edd97f2..f712113e86e 100644
/* Only a prepare, since we're uploading entire volumes. */
wined3d_texture_prepare_texture(dst_texture, context, FALSE);
@@ -3705,32 +3688,89 @@ static HRESULT wined3d_device_update_texture_3d(struct wined3d_device *device,
@@ -3652,32 +3635,89 @@ static HRESULT wined3d_device_update_texture_3d(struct wined3d_device *device,
for (i = 0; i < level_count; ++i)
{
@ -224,7 +222,7 @@ index e236edd97f2..f712113e86e 100644
TRACE("device %p, src_texture %p, dst_texture %p.\n", device, src_texture, dst_texture);
@@ -3767,63 +3807,48 @@ HRESULT CDECL wined3d_device_update_texture(struct wined3d_device *device,
@@ -3714,63 +3754,48 @@ HRESULT CDECL wined3d_device_update_texture(struct wined3d_device *device,
return WINED3DERR_INVALIDCALL;
}
@ -318,10 +316,10 @@ index e236edd97f2..f712113e86e 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 f3f356e2f66..ff8c4e88bd4 100644
index 2b3ac98c35e..9e2c272eeda 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -2631,6 +2631,8 @@ LRESULT device_process_message(struct wined3d_device *device, HWND window, BOOL
@@ -2671,6 +2671,8 @@ LRESULT device_process_message(struct wined3d_device *device, HWND window, BOOL
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;
void device_invalidate_state(const struct wined3d_device *device, DWORD state) DECLSPEC_HIDDEN;
@ -330,15 +328,15 @@ index f3f356e2f66..ff8c4e88bd4 100644
static inline BOOL isStateDirty(const struct wined3d_context *context, DWORD state)
{
@@ -3237,6 +3239,8 @@ void wined3d_cs_emit_set_vertex_declaration(struct wined3d_cs *cs,
struct wined3d_vertex_declaration *declaration) DECLSPEC_HIDDEN;
@@ -3262,6 +3264,8 @@ void wined3d_cs_emit_set_vertex_declaration(struct wined3d_cs *cs,
void wined3d_cs_emit_set_viewport(struct wined3d_cs *cs, const struct wined3d_viewport *viewport) DECLSPEC_HIDDEN;
void wined3d_cs_emit_sync(struct wined3d_cs *cs);
void wined3d_cs_emit_unload_resource(struct wined3d_cs *cs, struct wined3d_resource *resource) DECLSPEC_HIDDEN;
+void wined3d_cs_emit_update_texture(struct wined3d_cs *cs, struct wined3d_texture *src,
+ struct wined3d_texture *dst) DECLSPEC_HIDDEN;
void wined3d_cs_init_object(struct wined3d_cs *cs,
void (*callback)(void *object), void *object) DECLSPEC_HIDDEN;
HRESULT wined3d_cs_map(struct wined3d_cs *cs, struct wined3d_resource *resource, unsigned int sub_resource_idx,
struct wined3d_map_desc *map_desc, const struct wined3d_box *box, unsigned int flags) DECLSPEC_HIDDEN;
HRESULT wined3d_cs_unmap(struct wined3d_cs *cs, struct wined3d_resource *resource,
--
2.11.0

View File

@ -1,28 +1,28 @@
From a210ef716ab19691b52d1bbaf78d39afbf906d5f Mon Sep 17 00:00:00 2001
From 816ad331869dde6ef0c3326e010ef672e55e8b9a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20D=C3=B6singer?= <stefan@codeweavers.com>
Date: Fri, 4 Sep 2015 15:22:49 +0200
Subject: wined3d: Send update_sub_resource calls through the command stream.
---
dlls/wined3d/cs.c | 69 ++++++++++++++++++++++++++++++++++++++++++
dlls/wined3d/cs.c | 67 ++++++++++++++++++++++++++++++++++++++++++
dlls/wined3d/device.c | 22 +-------------
dlls/wined3d/texture.c | 2 +-
dlls/wined3d/wined3d_private.h | 5 +++
4 files changed, 76 insertions(+), 22 deletions(-)
dlls/wined3d/wined3d_private.h | 5 ++++
4 files changed, 74 insertions(+), 22 deletions(-)
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
index 9f7f8455a01..f021b9320e5 100644
index 6ffdd920403..ac9e09345dd 100644
--- a/dlls/wined3d/cs.c
+++ b/dlls/wined3d/cs.c
@@ -82,6 +82,7 @@ enum wined3d_cs_op
@@ -70,6 +70,7 @@ enum wined3d_cs_op
WINED3D_CS_OP_BLT,
WINED3D_CS_OP_CLEAR_RTV,
WINED3D_CS_OP_UPDATE_TEXTURE,
+ WINED3D_CS_OP_UPDATE_SUB_RESOURCE,
WINED3D_CS_OP_STOP,
};
@@ -431,6 +432,15 @@ struct wined3d_cs_update_texture
struct wined3d_cs_sync
@@ -405,6 +406,15 @@ struct wined3d_cs_update_texture
struct wined3d_texture *src, *dst;
};
@ -35,14 +35,14 @@ index 9f7f8455a01..f021b9320e5 100644
+ const void *data;
+};
+
static inline BOOL wined3d_cs_process_block(struct wined3d_cs *cs, struct wined3d_cs_block *block);
static void wined3d_cs_mt_submit(struct wined3d_cs *cs);
@@ -2169,6 +2179,64 @@ void wined3d_cs_emit_update_texture(struct wined3d_cs *cs, struct wined3d_textur
static void wined3d_cs_exec_sync(struct wined3d_cs *cs, const void *data)
{
}
@@ -1928,6 +1938,62 @@ void wined3d_cs_emit_update_texture(struct wined3d_cs *cs, struct wined3d_textur
cs->ops->submit(cs);
}
+static UINT wined3d_cs_exec_update_sub_resource(struct wined3d_cs *cs, const void *data)
+static void wined3d_cs_exec_update_sub_resource(struct wined3d_cs *cs, const void *data)
+{
+ const struct wined3d_cs_update_sub_resource *op = data;
+ struct wined3d_const_bo_address addr;
@ -76,8 +76,6 @@ index 9f7f8455a01..f021b9320e5 100644
+
+ wined3d_texture_validate_location(texture, op->sub_resource_idx, WINED3D_LOCATION_TEXTURE_RGB);
+ wined3d_texture_invalidate_location(texture, op->sub_resource_idx, ~WINED3D_LOCATION_TEXTURE_RGB);
+
+ return sizeof(*op);
+}
+
+void wined3d_cs_emit_update_sub_resource(struct wined3d_cs *cs, struct wined3d_resource *resource,
@ -100,10 +98,10 @@ index 9f7f8455a01..f021b9320e5 100644
+ cs->ops->submit_and_wait(cs);
+}
+
static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void *data) =
static void (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void *data) =
{
/* WINED3D_CS_OP_FENCE */ wined3d_cs_exec_fence,
@@ -2216,6 +2284,7 @@ static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void
/* WINED3D_CS_OP_SYNC */ wined3d_cs_exec_sync,
@@ -1974,6 +2040,7 @@ static void (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void
/* WINED3D_CS_OP_BLT */ wined3d_cs_exec_blt,
/* WINED3D_CS_OP_CLEAR_RTV */ wined3d_cs_exec_clear_rtv,
/* WINED3D_CS_OP_UPDATE_TEXTURE */ wined3d_cs_exec_update_texture,
@ -112,10 +110,10 @@ index 9f7f8455a01..f021b9320e5 100644
static void *wined3d_cs_st_require_space(struct wined3d_cs *cs, size_t size)
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index 4f4221c1223..a6b2996f112 100644
index 6e7d4f800b3..86b1808463e 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -4148,8 +4148,6 @@ void CDECL wined3d_device_update_sub_resource(struct wined3d_device *device, str
@@ -4171,8 +4171,6 @@ void CDECL wined3d_device_update_sub_resource(struct wined3d_device *device, str
unsigned int depth_pitch)
{
unsigned int width, height, depth, level;
@ -124,7 +122,7 @@ index 4f4221c1223..a6b2996f112 100644
struct wined3d_texture *texture;
TRACE("device %p, resource %p, sub_resource_idx %u, box %s, data %p, row_pitch %u, depth_pitch %u.\n",
@@ -4199,25 +4197,7 @@ void CDECL wined3d_device_update_sub_resource(struct wined3d_device *device, str
@@ -4222,25 +4220,7 @@ void CDECL wined3d_device_update_sub_resource(struct wined3d_device *device, str
return;
}
@ -152,10 +150,10 @@ index 4f4221c1223..a6b2996f112 100644
HRESULT CDECL wined3d_device_clear_rendertarget_view(struct wined3d_device *device,
diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c
index 3e7922e8c8e..1b4fa46b55e 100644
index 74b1ca2c546..5673a93f791 100644
--- a/dlls/wined3d/texture.c
+++ b/dlls/wined3d/texture.c
@@ -1401,7 +1401,7 @@ void CDECL wined3d_texture_generate_mipmaps(struct wined3d_texture *texture)
@@ -1498,7 +1498,7 @@ void CDECL wined3d_texture_generate_mipmaps(struct wined3d_texture *texture)
FIXME("texture %p stub!\n", texture);
}
@ -165,10 +163,10 @@ index 3e7922e8c8e..1b4fa46b55e 100644
{
UINT sub_count = texture->level_count * texture->layer_count;
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 9a1b183dfaf..c8801cbaa09 100644
index 9e2c272eeda..17cb43771d8 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -2873,6 +2873,8 @@ BOOL wined3d_texture_check_block_align(const struct wined3d_texture *texture,
@@ -2919,6 +2919,8 @@ BOOL wined3d_texture_check_block_align(const struct wined3d_texture *texture,
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) DECLSPEC_HIDDEN;
@ -177,16 +175,16 @@ index 9a1b183dfaf..c8801cbaa09 100644
void wined3d_texture_invalidate_location(struct wined3d_texture *texture,
unsigned int sub_resource_idx, DWORD location) DECLSPEC_HIDDEN;
void wined3d_texture_load(struct wined3d_texture *texture,
@@ -3238,6 +3240,9 @@ void wined3d_cs_emit_set_vertex_declaration(struct wined3d_cs *cs,
struct wined3d_vertex_declaration *declaration) DECLSPEC_HIDDEN;
@@ -3264,6 +3266,9 @@ void wined3d_cs_emit_set_vertex_declaration(struct wined3d_cs *cs,
void wined3d_cs_emit_set_viewport(struct wined3d_cs *cs, const struct wined3d_viewport *viewport) DECLSPEC_HIDDEN;
void wined3d_cs_emit_sync(struct wined3d_cs *cs);
void wined3d_cs_emit_unload_resource(struct wined3d_cs *cs, struct wined3d_resource *resource) DECLSPEC_HIDDEN;
+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;
void wined3d_cs_emit_update_texture(struct wined3d_cs *cs, struct wined3d_texture *src,
struct wined3d_texture *dst) DECLSPEC_HIDDEN;
HRESULT wined3d_cs_map(struct wined3d_cs *cs, struct wined3d_resource *resource, unsigned int sub_resource_idx,
void wined3d_cs_init_object(struct wined3d_cs *cs,
--
2.11.0

View File

@ -1,29 +1,29 @@
From 9ace1ec0a9608d2aa2944472b1134635ed69e724 Mon Sep 17 00:00:00 2001
From 5d761db7832335a902459846f73ad5a88af92860 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20D=C3=B6singer?= <stefan@codeweavers.com>
Date: Sun, 16 Mar 2014 14:13:42 +0100
Subject: wined3d: Send getdc and releasedc through the command stream.
Another hacky patch to avoid using GL outside the worker thread.
---
dlls/wined3d/cs.c | 64 +++++++++++++++++++++++++++++++++
dlls/wined3d/cs.c | 60 +++++++++++++++++++++++++++++++
dlls/wined3d/texture.c | 81 +++++++++++++++++++++++++++---------------
dlls/wined3d/wined3d_private.h | 7 ++++
3 files changed, 123 insertions(+), 29 deletions(-)
3 files changed, 119 insertions(+), 29 deletions(-)
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
index f021b9320e5..abc509b6e3b 100644
index ac9e09345dd..29b27176d34 100644
--- a/dlls/wined3d/cs.c
+++ b/dlls/wined3d/cs.c
@@ -83,6 +83,8 @@ enum wined3d_cs_op
@@ -71,6 +71,8 @@ enum wined3d_cs_op
WINED3D_CS_OP_CLEAR_RTV,
WINED3D_CS_OP_UPDATE_TEXTURE,
WINED3D_CS_OP_UPDATE_SUB_RESOURCE,
+ WINED3D_CS_OP_GET_DC,
+ WINED3D_CS_OP_RELEASE_DC,
WINED3D_CS_OP_STOP,
};
@@ -441,6 +443,14 @@ struct wined3d_cs_update_sub_resource
struct wined3d_cs_sync
@@ -415,6 +417,14 @@ struct wined3d_cs_update_sub_resource
const void *data;
};
@ -35,20 +35,18 @@ index f021b9320e5..abc509b6e3b 100644
+ HRESULT *hr;
+};
+
static inline BOOL wined3d_cs_process_block(struct wined3d_cs *cs, struct wined3d_cs_block *block);
static void wined3d_cs_mt_submit(struct wined3d_cs *cs);
@@ -2237,6 +2247,58 @@ void wined3d_cs_emit_update_sub_resource(struct wined3d_cs *cs, struct wined3d_r
static void wined3d_cs_exec_sync(struct wined3d_cs *cs, const void *data)
{
}
@@ -1994,6 +2004,54 @@ void wined3d_cs_emit_update_sub_resource(struct wined3d_cs *cs, struct wined3d_r
cs->ops->submit_and_wait(cs);
}
+static UINT wined3d_cs_exec_get_dc(struct wined3d_cs *cs, const void *data)
+static void wined3d_cs_exec_get_dc(struct wined3d_cs *cs, const void *data)
+{
+ const struct wined3d_cs_get_release_dc *op = data;
+
+ *op->hr = wined3d_texture_get_dc_cs(op->texture, op->sub_resource_idx);
+
+ return sizeof(*op);
+}
+
+HRESULT wined3d_cs_emit_get_dc(struct wined3d_cs *cs, struct wined3d_texture *texture,
@ -68,13 +66,11 @@ index f021b9320e5..abc509b6e3b 100644
+ return hr;
+}
+
+static UINT wined3d_cs_exec_release_dc(struct wined3d_cs *cs, const void *data)
+static void wined3d_cs_exec_release_dc(struct wined3d_cs *cs, const void *data)
+{
+ const struct wined3d_cs_get_release_dc *op = data;
+
+ *op->hr = wined3d_texture_release_dc_cs(op->texture, op->sub_resource_idx);
+
+ return sizeof(*op);
+}
+
+HRESULT wined3d_cs_emit_release_dc(struct wined3d_cs *cs, struct wined3d_texture *texture,
@ -94,10 +90,10 @@ index f021b9320e5..abc509b6e3b 100644
+ return hr;
+}
+
static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void *data) =
static void (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void *data) =
{
/* WINED3D_CS_OP_FENCE */ wined3d_cs_exec_fence,
@@ -2285,6 +2347,8 @@ static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void
/* WINED3D_CS_OP_SYNC */ wined3d_cs_exec_sync,
@@ -2041,6 +2099,8 @@ static void (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void
/* WINED3D_CS_OP_CLEAR_RTV */ wined3d_cs_exec_clear_rtv,
/* WINED3D_CS_OP_UPDATE_TEXTURE */ wined3d_cs_exec_update_texture,
/* WINED3D_CS_OP_UPDATE_SUB_RESOURCE */ wined3d_cs_exec_update_sub_resource,
@ -107,10 +103,10 @@ index f021b9320e5..abc509b6e3b 100644
static void *wined3d_cs_st_require_space(struct wined3d_cs *cs, size_t size)
diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c
index 1b4fa46b55e..e9641b95099 100644
index 5673a93f791..2360c589902 100644
--- a/dlls/wined3d/texture.c
+++ b/dlls/wined3d/texture.c
@@ -3421,13 +3421,41 @@ HRESULT CDECL wined3d_texture_create(struct wined3d_device *device, const struct
@@ -3489,13 +3489,41 @@ HRESULT CDECL wined3d_texture_create(struct wined3d_device *device, const struct
return WINED3D_OK;
}
@ -154,7 +150,7 @@ index 1b4fa46b55e..e9641b95099 100644
TRACE("texture %p, sub_resource_idx %u, dc %p.\n", texture, sub_resource_idx, dc);
@@ -3452,28 +3480,32 @@ HRESULT CDECL wined3d_texture_get_dc(struct wined3d_texture *texture, unsigned i
@@ -3520,28 +3548,32 @@ HRESULT CDECL wined3d_texture_get_dc(struct wined3d_texture *texture, unsigned i
if (texture->resource.map_count && !(texture->flags & WINED3D_TEXTURE_GET_DC_LENIENT))
return WINED3DERR_INVALIDCALL;
@ -204,7 +200,7 @@ index 1b4fa46b55e..e9641b95099 100644
}
HRESULT CDECL wined3d_texture_release_dc(struct wined3d_texture *texture, unsigned int sub_resource_idx, HDC dc)
@@ -3504,14 +3536,5 @@ HRESULT CDECL wined3d_texture_release_dc(struct wined3d_texture *texture, unsign
@@ -3572,14 +3604,5 @@ HRESULT CDECL wined3d_texture_release_dc(struct wined3d_texture *texture, unsign
return WINED3DERR_INVALIDCALL;
}
@ -221,10 +217,10 @@ index 1b4fa46b55e..e9641b95099 100644
+ return wined3d_cs_emit_release_dc(device->cs, texture, sub_resource_idx);
}
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 85417862c60..a2b8a9ebf92 100644
index 17cb43771d8..da3ee393739 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -2871,6 +2871,7 @@ void wined3d_texture_bind_and_dirtify(struct wined3d_texture *texture,
@@ -2916,6 +2916,7 @@ void wined3d_texture_bind_and_dirtify(struct wined3d_texture *texture,
struct wined3d_context *context, BOOL srgb) DECLSPEC_HIDDEN;
BOOL wined3d_texture_check_block_align(const struct wined3d_texture *texture,
unsigned int level, const struct wined3d_box *box) DECLSPEC_HIDDEN;
@ -232,7 +228,7 @@ index 85417862c60..a2b8a9ebf92 100644
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) DECLSPEC_HIDDEN;
@@ -2888,6 +2889,8 @@ BOOL wined3d_texture_prepare_location(struct wined3d_texture *texture, unsigned
@@ -2933,6 +2934,8 @@ BOOL wined3d_texture_prepare_location(struct wined3d_texture *texture, unsigned
struct wined3d_context *context, DWORD location) DECLSPEC_HIDDEN;
void wined3d_texture_prepare_texture(struct wined3d_texture *texture,
struct wined3d_context *context, BOOL srgb) DECLSPEC_HIDDEN;
@ -241,7 +237,7 @@ index 85417862c60..a2b8a9ebf92 100644
void wined3d_texture_set_map_binding(struct wined3d_texture *texture, DWORD map_binding) DECLSPEC_HIDDEN;
void wined3d_texture_set_swapchain(struct wined3d_texture *texture,
struct wined3d_swapchain *swapchain) DECLSPEC_HIDDEN;
@@ -3183,6 +3186,8 @@ void wined3d_cs_emit_dispatch(struct wined3d_cs *cs,
@@ -3208,6 +3211,8 @@ void wined3d_cs_emit_dispatch(struct wined3d_cs *cs,
unsigned int group_count_x, unsigned int group_count_y, unsigned int group_count_z) DECLSPEC_HIDDEN;
void wined3d_cs_emit_draw(struct wined3d_cs *cs, int base_vertex_idx, unsigned int start_idx, unsigned int index_count,
unsigned int start_instance, unsigned int instance_count, BOOL indexed) DECLSPEC_HIDDEN;
@ -250,15 +246,15 @@ index 85417862c60..a2b8a9ebf92 100644
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,
@@ -3190,6 +3195,8 @@ void wined3d_cs_emit_present(struct wined3d_cs *cs, struct wined3d_swapchain *sw
@@ -3215,6 +3220,8 @@ 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;
+HRESULT wined3d_cs_emit_release_dc(struct wined3d_cs *cs, struct wined3d_texture *texture,
+ unsigned int sub_resource_idx) 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

View File

@ -0,0 +1,105 @@
From 9708948e10b9272abae5a4ffdad1b2e1be4b2dd4 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 29b27176d34..81deae77363 100644
--- a/dlls/wined3d/cs.c
+++ b/dlls/wined3d/cs.c
@@ -59,6 +59,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,
@@ -319,6 +320,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;
@@ -1584,6 +1593,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;
@@ -2087,6 +2120,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 bc3b15f30dd..15935ab4469 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 da3ee393739..91b2215f287 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -3220,6 +3220,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;
HRESULT wined3d_cs_emit_release_dc(struct wined3d_cs *cs, struct wined3d_texture *texture,
unsigned int sub_resource_idx) DECLSPEC_HIDDEN;
void wined3d_cs_emit_reset_state(struct wined3d_cs *cs) DECLSPEC_HIDDEN;
--
2.11.0

View File

@ -1,29 +1,29 @@
From 51d984fae9ac31c5526a406492b25f9f98f639ef Mon Sep 17 00:00:00 2001
From 04cdcd00a3c11da1292657739f22a016faa54435 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20D=C3=B6singer?= <stefan@codeweavers.com>
Date: Thu, 10 Oct 2013 16:43:19 +0200
Subject: wined3d: Create the initial context through the CS.
Very hacky.
---
dlls/wined3d/cs.c | 33 ++++++++++++
dlls/wined3d/cs.c | 31 +++++++++++
dlls/wined3d/swapchain.c | 119 ++++++++++++++++++++++-------------------
dlls/wined3d/wined3d_private.h | 4 ++
3 files changed, 102 insertions(+), 54 deletions(-)
3 files changed, 100 insertions(+), 54 deletions(-)
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
index 4316e1b767b..49222e15cb2 100644
index 81deae77363..4ee459f535a 100644
--- a/dlls/wined3d/cs.c
+++ b/dlls/wined3d/cs.c
@@ -86,6 +86,7 @@ enum wined3d_cs_op
@@ -74,6 +74,7 @@ enum wined3d_cs_op
WINED3D_CS_OP_UPDATE_SUB_RESOURCE,
WINED3D_CS_OP_GET_DC,
WINED3D_CS_OP_RELEASE_DC,
WINED3D_CS_OP_CREATE_DUMMY_TEXTURES,
+ WINED3D_CS_OP_CREATE_SWAPCHAIN_CONTEXT,
WINED3D_CS_OP_STOP,
};
@@ -457,6 +458,13 @@ struct wined3d_cs_create_dummy_textures
enum wined3d_cs_op opcode;
struct wined3d_cs_sync
@@ -434,6 +435,13 @@ struct wined3d_cs_get_release_dc
HRESULT *hr;
};
+struct wined3d_cs_create_swapchain_context
@ -33,20 +33,18 @@ index 4316e1b767b..49222e15cb2 100644
+ HRESULT *hr;
+};
+
static inline BOOL wined3d_cs_process_block(struct wined3d_cs *cs, struct wined3d_cs_block *block);
static void wined3d_cs_mt_submit(struct wined3d_cs *cs);
@@ -2326,6 +2334,30 @@ void wined3d_cs_emit_create_dummy_textures(struct wined3d_cs *cs)
cs->ops->submit_and_wait(cs);
static void wined3d_cs_exec_sync(struct wined3d_cs *cs, const void *data)
{
}
@@ -2085,6 +2093,28 @@ HRESULT wined3d_cs_emit_release_dc(struct wined3d_cs *cs, struct wined3d_texture
return hr;
}
+static UINT wined3d_cs_exec_create_swapchain_context(struct wined3d_cs *cs, const void *data)
+static void wined3d_cs_exec_create_swapchain_context(struct wined3d_cs *cs, const void *data)
+{
+ const struct wined3d_cs_create_swapchain_context *op = data;
+
+ *op->hr = swapchain_create_context_cs(cs->device, op->swapchain);
+
+ return sizeof(*op);
+}
+
+HRESULT wined3d_cs_emit_create_swapchain_context(struct wined3d_cs *cs, struct wined3d_swapchain *swapchain)
@ -64,22 +62,22 @@ index 4316e1b767b..49222e15cb2 100644
+ return hr;
+}
+
static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void *data) =
static void (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void *data) =
{
/* WINED3D_CS_OP_FENCE */ wined3d_cs_exec_fence,
@@ -2377,6 +2409,7 @@ static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void
/* WINED3D_CS_OP_SYNC */ wined3d_cs_exec_sync,
@@ -2135,6 +2165,7 @@ static void (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void
/* WINED3D_CS_OP_UPDATE_SUB_RESOURCE */ wined3d_cs_exec_update_sub_resource,
/* WINED3D_CS_OP_GET_DC */ wined3d_cs_exec_get_dc,
/* WINED3D_CS_OP_RELEASE_DC */ wined3d_cs_exec_release_dc,
/* WINED3D_CS_OP_CREATE_DUMMY_TEXTURES */ wined3d_cs_exec_create_dummy_textures,
+ /* WINED3D_CS_OP_CREATE_SWAPCHAIN_CONTEXT */ wined3d_cs_exec_create_swapchain_context,
};
static void *wined3d_cs_st_require_space(struct wined3d_cs *cs, size_t size)
diff --git a/dlls/wined3d/swapchain.c b/dlls/wined3d/swapchain.c
index 932d4076b93..a176300dd5e 100644
index 7e48b5d12b5..592cbd96db4 100644
--- a/dlls/wined3d/swapchain.c
+++ b/dlls/wined3d/swapchain.c
@@ -783,6 +783,69 @@ static void wined3d_swapchain_apply_sample_count_override(const struct wined3d_s
@@ -786,6 +786,69 @@ static void wined3d_swapchain_apply_sample_count_override(const struct wined3d_s
*quality = 0;
}
@ -149,7 +147,7 @@ index 932d4076b93..a176300dd5e 100644
static HRESULT swapchain_init(struct wined3d_swapchain *swapchain, struct wined3d_device *device,
struct wined3d_swapchain_desc *desc, void *parent, const struct wined3d_parent_ops *parent_ops)
{
@@ -905,61 +968,9 @@ static HRESULT swapchain_init(struct wined3d_swapchain *swapchain, struct wined3
@@ -912,61 +975,9 @@ static HRESULT swapchain_init(struct wined3d_swapchain *swapchain, struct wined3
if (!(device->wined3d->flags & WINED3D_NO3D))
{
@ -214,19 +212,19 @@ index 932d4076b93..a176300dd5e 100644
if (swapchain->desc.backbuffer_count > 0)
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 9d8268e8b32..9a100e7f2b2 100644
index 91b2215f287..b3995627850 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -3182,6 +3182,8 @@ void wined3d_cs_emit_clear_rtv(struct wined3d_cs *cs, struct wined3d_rendertarge
@@ -3207,6 +3207,8 @@ void wined3d_cs_emit_clear(struct wined3d_cs *cs, DWORD rect_count, const RECT *
void wined3d_cs_emit_clear_rtv(struct wined3d_cs *cs, struct wined3d_rendertarget_view *view,
const RECT *rect, DWORD flags, const struct wined3d_color *color, float depth, DWORD stencil,
const struct blit_shader *blitter) DECLSPEC_HIDDEN;
void wined3d_cs_emit_create_dummy_textures(struct wined3d_cs *cs) DECLSPEC_HIDDEN;
+HRESULT wined3d_cs_emit_create_swapchain_context(struct wined3d_cs *cs,
+ struct wined3d_swapchain *swapchain) DECLSPEC_HIDDEN;
void wined3d_cs_emit_destroy_object(struct wined3d_cs *cs,
void (*callback)(void *object), void *object) DECLSPEC_HIDDEN;
void wined3d_cs_emit_dispatch(struct wined3d_cs *cs,
@@ -3432,6 +3434,8 @@ struct wined3d_swapchain
unsigned int group_count_x, unsigned int group_count_y, unsigned int group_count_z) DECLSPEC_HIDDEN;
void wined3d_cs_emit_draw(struct wined3d_cs *cs, int base_vertex_idx, unsigned int start_idx, unsigned int index_count,
@@ -3460,6 +3462,8 @@ struct wined3d_swapchain
void wined3d_swapchain_activate(struct wined3d_swapchain *swapchain, BOOL activate) DECLSPEC_HIDDEN;
struct wined3d_context *swapchain_get_context(struct wined3d_swapchain *swapchain) DECLSPEC_HIDDEN;

View File

@ -1,26 +0,0 @@
From 8599235cc72aa10486d71a15e3059ef0c5478ddc Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20D=C3=B6singer?= <stefan@codeweavers.com>
Date: Wed, 2 Oct 2013 23:40:20 +0200
Subject: wined3d: Unload resources through the CS in device_reset.
---
dlls/wined3d/device.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index 082489c295e..7ad88637f08 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -4674,6 +4674,9 @@ static void delete_opengl_contexts(struct wined3d_device *device, struct wined3d
wined3d_cs_emit_unload_resource(device->cs, resource);
}
+ if (wined3d_settings.cs_multithreaded)
+ device->cs->ops->submit_and_wait(device->cs);
+
LIST_FOR_EACH_ENTRY(shader, &device->shaders, struct wined3d_shader, shader_list_entry)
{
device->shader_backend->shader_destroy(shader);
--
2.11.0

View File

@ -1,27 +1,27 @@
From af27672c94e6b15e5a7361a3823d14f9a76ed898 Mon Sep 17 00:00:00 2001
From 87dc42bd2a784e106d9898b5dcf3969e5c508fab Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20D=C3=B6singer?= <stefandoesinger@gmx.at>
Date: Sat, 7 May 2016 21:58:06 +0100
Subject: wined3d: Update the swap interval through the CS in reset.
---
dlls/wined3d/cs.c | 28 ++++++++++++++++++++++++++++
dlls/wined3d/cs.c | 26 ++++++++++++++++++++++++++
dlls/wined3d/device.c | 2 +-
dlls/wined3d/wined3d_private.h | 1 +
3 files changed, 30 insertions(+), 1 deletion(-)
3 files changed, 28 insertions(+), 1 deletion(-)
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
index 49222e15cb2..45da73823ec 100644
index 4ee459f535a..c7ed94f623c 100644
--- a/dlls/wined3d/cs.c
+++ b/dlls/wined3d/cs.c
@@ -87,6 +87,7 @@ enum wined3d_cs_op
@@ -75,6 +75,7 @@ enum wined3d_cs_op
WINED3D_CS_OP_GET_DC,
WINED3D_CS_OP_RELEASE_DC,
WINED3D_CS_OP_CREATE_DUMMY_TEXTURES,
WINED3D_CS_OP_CREATE_SWAPCHAIN_CONTEXT,
+ WINED3D_CS_OP_UPDATE_SWAP_INTERVAL,
WINED3D_CS_OP_STOP,
};
@@ -465,6 +466,12 @@ struct wined3d_cs_create_swapchain_context
struct wined3d_cs_sync
@@ -442,6 +443,12 @@ struct wined3d_cs_create_swapchain_context
HRESULT *hr;
};
@ -31,20 +31,18 @@ index 49222e15cb2..45da73823ec 100644
+ struct wined3d_swapchain *swapchain;
+};
+
static inline BOOL wined3d_cs_process_block(struct wined3d_cs *cs, struct wined3d_cs_block *block);
static void wined3d_cs_mt_submit(struct wined3d_cs *cs);
@@ -2358,6 +2365,26 @@ HRESULT wined3d_cs_emit_create_swapchain_context(struct wined3d_cs *cs, struct w
static void wined3d_cs_exec_sync(struct wined3d_cs *cs, const void *data)
{
}
@@ -2115,6 +2122,24 @@ HRESULT wined3d_cs_emit_create_swapchain_context(struct wined3d_cs *cs, struct w
return hr;
}
+static UINT wined3d_cs_exec_update_swap_interval(struct wined3d_cs *cs, const void *data)
+static void wined3d_cs_exec_update_swap_interval(struct wined3d_cs *cs, const void *data)
+{
+ const struct wined3d_cs_update_swap_interval *op = data;
+
+ swapchain_update_swap_interval(op->swapchain);
+
+ return sizeof(*op);
+}
+
+void wined3d_cs_emit_update_swap_interval(struct wined3d_cs *cs, struct wined3d_swapchain *swapchain)
@ -58,42 +56,42 @@ index 49222e15cb2..45da73823ec 100644
+ cs->ops->submit_and_wait(cs);
+}
+
static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void *data) =
static void (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void *data) =
{
/* WINED3D_CS_OP_FENCE */ wined3d_cs_exec_fence,
@@ -2410,6 +2437,7 @@ static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void
/* WINED3D_CS_OP_SYNC */ wined3d_cs_exec_sync,
@@ -2166,6 +2191,7 @@ static void (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void
/* WINED3D_CS_OP_GET_DC */ wined3d_cs_exec_get_dc,
/* WINED3D_CS_OP_RELEASE_DC */ wined3d_cs_exec_release_dc,
/* WINED3D_CS_OP_CREATE_DUMMY_TEXTURES */ wined3d_cs_exec_create_dummy_textures,
/* WINED3D_CS_OP_CREATE_SWAPCHAIN_CONTEXT */ wined3d_cs_exec_create_swapchain_context,
+ /* WINED3D_CS_OP_UPDATE_SWAP_INTERVAL */ wined3d_cs_exec_update_swap_interval,
};
static void *wined3d_cs_st_require_space(struct wined3d_cs *cs, size_t size)
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index 33955e3f3f4..19cdc8d1824 100644
index 86b1808463e..3e4a1790946 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -4975,7 +4975,7 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device,
@@ -4839,7 +4839,7 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device,
{
if (reset_state)
hr = create_primary_opengl_context(device, swapchain);
hr = wined3d_device_create_primary_opengl_context(device);
- swapchain_update_swap_interval(swapchain);
+ wined3d_cs_emit_update_swap_interval(device->cs, swapchain);
}
/* All done. There is no need to reload resources or shaders, this will happen automatically on the
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 9a100e7f2b2..6447643b87f 100644
index b3995627850..ce02d81914f 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -3255,6 +3255,7 @@ void wined3d_cs_emit_unload_resource(struct wined3d_cs *cs, struct wined3d_resou
@@ -3279,6 +3279,7 @@ void wined3d_cs_emit_unload_resource(struct wined3d_cs *cs, struct wined3d_resou
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;
+void wined3d_cs_emit_update_swap_interval(struct wined3d_cs *cs, struct wined3d_swapchain *swapchain) DECLSPEC_HIDDEN;
void wined3d_cs_emit_update_texture(struct wined3d_cs *cs, struct wined3d_texture *src,
struct wined3d_texture *dst) DECLSPEC_HIDDEN;
HRESULT wined3d_cs_map(struct wined3d_cs *cs, struct wined3d_resource *resource, unsigned int sub_resource_idx,
void wined3d_cs_init_object(struct wined3d_cs *cs,
--
2.11.0

View File

@ -1,4 +1,4 @@
From 6be6343e6d6939ccc4990239fac33be82cd90ef8 Mon Sep 17 00:00:00 2001
From 2aadab885c6dca2c21e7c7e598205d5e771f6538 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20D=C3=B6singer?= <stefandoesinger@gmx.at>
Date: Sat, 7 May 2016 22:31:28 +0100
Subject: wined3d: Create initial DCs through the CS.
@ -8,10 +8,10 @@ Subject: wined3d: Create initial DCs through the CS.
1 file changed, 13 insertions(+), 5 deletions(-)
diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c
index e9641b95099..b62fff8c503 100644
index 2360c589902..70c4590f74a 100644
--- a/dlls/wined3d/texture.c
+++ b/dlls/wined3d/texture.c
@@ -1217,7 +1217,11 @@ HRESULT CDECL wined3d_texture_update_desc(struct wined3d_texture *texture, UINT
@@ -1314,7 +1314,11 @@ HRESULT CDECL wined3d_texture_update_desc(struct wined3d_texture *texture, UINT
wined3d_texture_invalidate_location(texture, 0, ~valid_location);
if (create_dib)
@ -24,7 +24,7 @@ index e9641b95099..b62fff8c503 100644
return WINED3D_OK;
}
@@ -2631,11 +2635,15 @@ static HRESULT texture_init(struct wined3d_texture *texture, const struct wined3
@@ -2729,11 +2733,15 @@ static HRESULT texture_init(struct wined3d_texture *texture, const struct wined3
TRACE("Created surface level %u, layer %u @ %p.\n", i, j, surface);

View File

@ -1,252 +0,0 @@
From c3cc04eaa9c6274fdc189d39d995e2cfccab489a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20D=C3=B6singer?= <stefan@codeweavers.com>
Date: Thu, 10 Oct 2013 16:29:42 +0200
Subject: wined3d: Create dummy textures through the CS.
Hacky version. Just good enough to see if the double context during init is what makes fglrx
crash.
---
dlls/d3d11/tests/d3d11.c | 34 +++++++++++++++++-----------------
dlls/wined3d/cs.c | 28 ++++++++++++++++++++++++++++
dlls/wined3d/device.c | 10 ++++------
dlls/wined3d/wined3d_private.h | 2 ++
4 files changed, 51 insertions(+), 23 deletions(-)
diff --git a/dlls/d3d11/tests/d3d11.c b/dlls/d3d11/tests/d3d11.c
index 507496cace1..ab3fa83a103 100644
--- a/dlls/d3d11/tests/d3d11.c
+++ b/dlls/d3d11/tests/d3d11.c
@@ -13278,12 +13278,12 @@ static void test_cs_uav_store(void)
ID3D11DeviceContext_CSSetShader(context, cs, NULL, 0);
ID3D11DeviceContext_Dispatch(context, 1, 1, 1);
- todo_wine check_texture_float(texture, 1.0f, 2);
+ check_texture_float(texture, 1.0f, 2);
input.x = 0.5f;
ID3D11DeviceContext_UpdateSubresource(context, (ID3D11Resource *)cb, 0, NULL, &input, 0, 0);
ID3D11DeviceContext_Dispatch(context, 1, 1, 1);
- todo_wine check_texture_float(texture, 0.5f, 2);
+ check_texture_float(texture, 0.5f, 2);
ID3D11ComputeShader_Release(cs);
@@ -13291,19 +13291,19 @@ static void test_cs_uav_store(void)
ID3D11DeviceContext_UpdateSubresource(context, (ID3D11Resource *)cb, 0, NULL, &input, 0, 0);
ID3D11DeviceContext_CSSetShader(context, NULL, NULL, 0);
ID3D11DeviceContext_Dispatch(context, 1, 1, 1);
- todo_wine check_texture_float(texture, 0.5f, 2);
+ check_texture_float(texture, 0.5f, 2);
hr = ID3D11Device_CreateComputeShader(device, cs_1_group_code, sizeof(cs_1_group_code), NULL, &cs);
ok(SUCCEEDED(hr), "Failed to create compute shader, hr %#x.\n", hr);
ID3D11DeviceContext_CSSetShader(context, cs, NULL, 0);
ID3D11DeviceContext_Dispatch(context, 1, 1, 1);
- todo_wine check_texture_float(texture, 2.0f, 2);
+ check_texture_float(texture, 2.0f, 2);
input.x = 4.0f;
ID3D11DeviceContext_UpdateSubresource(context, (ID3D11Resource *)cb, 0, NULL, &input, 0, 0);
ID3D11DeviceContext_Dispatch(context, 1, 1, 1);
- todo_wine check_texture_float(texture, 4.0f, 2);
+ check_texture_float(texture, 4.0f, 2);
ID3D11ComputeShader_Release(cs);
@@ -13314,17 +13314,17 @@ static void test_cs_uav_store(void)
input.x = 1.0f;
ID3D11DeviceContext_UpdateSubresource(context, (ID3D11Resource *)cb, 0, NULL, &input, 0, 0);
ID3D11DeviceContext_Dispatch(context, texture_desc.Width, texture_desc.Height, 1);
- todo_wine check_texture_float(texture, 1.0f, 2);
+ check_texture_float(texture, 1.0f, 2);
input.x = 0.5f;
ID3D11DeviceContext_UpdateSubresource(context, (ID3D11Resource *)cb, 0, NULL, &input, 0, 0);
ID3D11DeviceContext_Dispatch(context, 16, 32, 1);
SetRect(&rect, 0, 0, 16, 32);
- todo_wine check_texture_sub_resource_float(texture, 0, &rect, 0.5f, 2);
+ check_texture_sub_resource_float(texture, 0, &rect, 0.5f, 2);
SetRect(&rect, 0, 32, texture_desc.Width, texture_desc.Height);
- todo_wine check_texture_sub_resource_float(texture, 0, &rect, 1.0f, 2);
+ check_texture_sub_resource_float(texture, 0, &rect, 1.0f, 2);
SetRect(&rect, 16, 0, texture_desc.Width, texture_desc.Height);
- todo_wine check_texture_sub_resource_float(texture, 0, &rect, 1.0f, 2);
+ check_texture_sub_resource_float(texture, 0, &rect, 1.0f, 2);
ID3D11ComputeShader_Release(cs);
@@ -13336,16 +13336,16 @@ static void test_cs_uav_store(void)
ID3D11DeviceContext_UpdateSubresource(context, (ID3D11Resource *)cb, 0, NULL, &input, 0, 0);
ID3D11DeviceContext_Dispatch(context, 15, 15, 1);
SetRect(&rect, 0, 0, 60, 60);
- todo_wine check_texture_sub_resource_float(texture, 0, &rect, 0.6f, 2);
+ check_texture_sub_resource_float(texture, 0, &rect, 0.6f, 2);
SetRect(&rect, 0, 60, texture_desc.Width, texture_desc.Height);
- todo_wine check_texture_sub_resource_float(texture, 0, &rect, 1.0f, 2);
+ check_texture_sub_resource_float(texture, 0, &rect, 1.0f, 2);
SetRect(&rect, 60, 0, texture_desc.Width, texture_desc.Height);
- todo_wine check_texture_sub_resource_float(texture, 0, &rect, 1.0f, 2);
+ check_texture_sub_resource_float(texture, 0, &rect, 1.0f, 2);
input.x = 0.7f;
ID3D11DeviceContext_UpdateSubresource(context, (ID3D11Resource *)cb, 0, NULL, &input, 0, 0);
ID3D11DeviceContext_Dispatch(context, 16, 16, 1);
- todo_wine check_texture_float(texture, 0.7f, 2);
+ check_texture_float(texture, 0.7f, 2);
ID3D11ComputeShader_Release(cs);
@@ -13356,12 +13356,12 @@ static void test_cs_uav_store(void)
input.x = 0.3f;
ID3D11DeviceContext_UpdateSubresource(context, (ID3D11Resource *)cb, 0, NULL, &input, 0, 0);
ID3D11DeviceContext_Dispatch(context, 1, 1, 1);
- todo_wine check_texture_float(texture, 0.3f, 2);
+ check_texture_float(texture, 0.3f, 2);
input.x = 0.1f;
ID3D11DeviceContext_UpdateSubresource(context, (ID3D11Resource *)cb, 0, NULL, &input, 0, 0);
ID3D11DeviceContext_Dispatch(context, 2, 2, 2);
- todo_wine check_texture_float(texture, 0.1f, 2);
+ check_texture_float(texture, 0.1f, 2);
ID3D11ComputeShader_Release(cs);
@@ -13514,10 +13514,10 @@ static void test_ps_cs_uav_binding(void)
ID3D11DeviceContext_PSSetShader(context, ps, NULL, 0);
ID3D11DeviceContext_Dispatch(context, 1, 1, 1);
- todo_wine check_texture_float(cs_texture, 1.0f, 2);
+ check_texture_float(cs_texture, 1.0f, 2);
check_texture_float(ps_texture, 0.0f, 2);
draw_quad(&test_context);
- todo_wine check_texture_float(cs_texture, 1.0f, 2);
+ check_texture_float(cs_texture, 1.0f, 2);
check_texture_float(ps_texture, 1.0f, 2);
input.x = 0.5f;
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
index 7f5339599d8..bf6adf4be71 100644
--- a/dlls/wined3d/cs.c
+++ b/dlls/wined3d/cs.c
@@ -85,6 +85,7 @@ enum wined3d_cs_op
WINED3D_CS_OP_UPDATE_SUB_RESOURCE,
WINED3D_CS_OP_GET_DC,
WINED3D_CS_OP_RELEASE_DC,
+ WINED3D_CS_OP_CREATE_DUMMY_TEXTURES,
WINED3D_CS_OP_STOP,
};
@@ -452,6 +453,11 @@ struct wined3d_cs_get_release_dc
HRESULT *hr;
};
+struct wined3d_cs_create_dummy_textures
+{
+ enum wined3d_cs_op opcode;
+};
+
static inline BOOL wined3d_cs_process_block(struct wined3d_cs *cs, struct wined3d_cs_block *block);
static void wined3d_cs_mt_submit(struct wined3d_cs *cs);
@@ -2331,6 +2337,27 @@ HRESULT wined3d_cs_emit_release_dc(struct wined3d_cs *cs, struct wined3d_texture
return hr;
}
+static UINT wined3d_cs_exec_create_dummy_textures(struct wined3d_cs *cs, const void *data)
+{
+ const struct wined3d_cs_create_dummy_textures *op = data;
+ struct wined3d_context *context = context_acquire(cs->device, NULL, 0);
+
+ device_create_dummy_textures(cs->device, context);
+
+ context_release(context);
+ return sizeof(*op);
+}
+
+void wined3d_cs_emit_create_dummy_textures(struct wined3d_cs *cs)
+{
+ struct wined3d_cs_create_dummy_textures *op;
+
+ op = cs->ops->require_space(cs, sizeof(*op));
+ op->opcode = WINED3D_CS_OP_CREATE_DUMMY_TEXTURES;
+
+ cs->ops->submit_and_wait(cs);
+}
+
static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void *data) =
{
/* WINED3D_CS_OP_FENCE */ wined3d_cs_exec_fence,
@@ -2381,6 +2408,7 @@ static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void
/* WINED3D_CS_OP_UPDATE_SUB_RESOURCE */ wined3d_cs_exec_update_sub_resource,
/* WINED3D_CS_OP_GET_DC */ wined3d_cs_exec_get_dc,
/* WINED3D_CS_OP_RELEASE_DC */ wined3d_cs_exec_release_dc,
+ /* WINED3D_CS_OP_CREATE_DUMMY_TEXTURES */ wined3d_cs_exec_create_dummy_textures,
};
static void *wined3d_cs_st_require_space(struct wined3d_cs *cs, size_t size)
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index 9c69d04c3f0..008be8ae010 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -610,7 +610,7 @@ out:
}
/* Context activation is done by the caller. */
-static void create_dummy_textures(struct wined3d_device *device, struct wined3d_context *context)
+void device_create_dummy_textures(struct wined3d_device *device, struct wined3d_context *context)
{
const struct wined3d_d3d_info *d3d_info = &device->adapter->d3d_info;
const struct wined3d_gl_info *gl_info = &device->adapter->gl_info;
@@ -1029,7 +1029,7 @@ static HRESULT create_primary_opengl_context(struct wined3d_device *device, stru
target = swapchain->back_buffers ? swapchain->back_buffers[0] : swapchain->front_buffer;
context = context_acquire(device, target, 0);
- create_dummy_textures(device, context);
+ device_create_dummy_textures(device, context);
create_default_samplers(device, context);
context_release(context);
@@ -1106,17 +1106,15 @@ HRESULT CDECL wined3d_device_init_3d(struct wined3d_device *device,
device->swapchains[0] = swapchain;
device_init_swapchain_state(device, swapchain);
+ wined3d_cs_emit_create_dummy_textures(device->cs);
context = context_acquire(device, NULL, 0);
-
- create_dummy_textures(device, context);
create_default_samplers(device, context);
+ context_release(context);
device->contexts[0]->last_was_rhw = 0;
TRACE("All defaults now set up, leaving 3D init.\n");
- context_release(context);
-
/* Clear the screen */
if (swapchain->back_buffers && swapchain->back_buffers[0])
clear_flags |= WINED3DCLEAR_TARGET;
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 2d0a97f706c..efd4a4dfd6d 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -2672,6 +2672,7 @@ void device_resource_released(struct wined3d_device *device, struct wined3d_reso
void device_invalidate_state(const struct wined3d_device *device, DWORD state) DECLSPEC_HIDDEN;
void device_exec_update_texture(struct wined3d_context *context, struct wined3d_texture *src_texture,
struct wined3d_texture *dst_texture) DECLSPEC_HIDDEN;
+void device_create_dummy_textures(struct wined3d_device *device, struct wined3d_context *context) DECLSPEC_HIDDEN;
static inline BOOL isStateDirty(const struct wined3d_context *context, DWORD state)
{
@@ -3219,6 +3220,7 @@ void wined3d_cs_emit_clear(struct wined3d_cs *cs, DWORD rect_count, const RECT *
void wined3d_cs_emit_clear_rtv(struct wined3d_cs *cs, struct wined3d_rendertarget_view *view,
const RECT *rect, DWORD flags, const struct wined3d_color *color, float depth, DWORD stencil,
const struct blit_shader *blitter) DECLSPEC_HIDDEN;
+void wined3d_cs_emit_create_dummy_textures(struct wined3d_cs *cs) DECLSPEC_HIDDEN;
void wined3d_cs_emit_destroy_object(struct wined3d_cs *cs,
void (*callback)(void *object), void *object) DECLSPEC_HIDDEN;
void wined3d_cs_emit_dispatch(struct wined3d_cs *cs,
--
2.11.0

View File

@ -1,28 +1,28 @@
From e3092488d343ac283dc9d8538c3a65914645c3d9 Mon Sep 17 00:00:00 2001
From a25b97bf63e04c95f9f2028f48db60d5fc511433 Mon Sep 17 00:00:00 2001
From: Nils Kuhnhenn <nils@volafile.io>
Date: Fri, 5 Aug 2016 20:28:46 +0200
Subject: wined3d: Fix context_acquire not being called from the command thread
in wined3d_texture_add_dirty_region.
---
dlls/wined3d/cs.c | 50 ++++++++++++++++++++++++++++++++++++++++++
dlls/wined3d/cs.c | 48 ++++++++++++++++++++++++++++++++++++++++++
dlls/wined3d/texture.c | 15 +------------
dlls/wined3d/wined3d_private.h | 2 ++
3 files changed, 53 insertions(+), 14 deletions(-)
3 files changed, 51 insertions(+), 14 deletions(-)
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
index 3e385ddf736..cdd11e41c91 100644
index c7ed94f623c..5b529d000f4 100644
--- a/dlls/wined3d/cs.c
+++ b/dlls/wined3d/cs.c
@@ -89,6 +89,7 @@ enum wined3d_cs_op
@@ -76,6 +76,7 @@ enum wined3d_cs_op
WINED3D_CS_OP_RELEASE_DC,
WINED3D_CS_OP_CREATE_SWAPCHAIN_CONTEXT,
WINED3D_CS_OP_UPDATE_SWAP_INTERVAL,
WINED3D_CS_OP_SAMPLER_INIT,
+ WINED3D_CS_OP_TEXTURE_ADD_DIRTY_REGION,
WINED3D_CS_OP_STOP,
};
@@ -479,6 +480,13 @@ struct wined3d_cs_update_swap_interval
struct wined3d_cs_sync
@@ -449,6 +450,13 @@ struct wined3d_cs_update_swap_interval
struct wined3d_swapchain *swapchain;
};
@ -33,14 +33,14 @@ index 3e385ddf736..cdd11e41c91 100644
+ unsigned int sub_resource_idx;
+};
+
static inline BOOL wined3d_cs_process_block(struct wined3d_cs *cs, struct wined3d_cs_block *block);
static void wined3d_cs_mt_submit(struct wined3d_cs *cs);
@@ -2412,6 +2420,47 @@ void wined3d_cs_emit_sampler_init(struct wined3d_cs *cs, struct wined3d_sampler
cs->ops->submit(cs);
static void wined3d_cs_exec_sync(struct wined3d_cs *cs, const void *data)
{
}
@@ -2140,6 +2148,45 @@ void wined3d_cs_emit_update_swap_interval(struct wined3d_cs *cs, struct wined3d_
cs->ops->submit_and_wait(cs);
}
+static UINT wined3d_cs_exec_texture_add_dirty_region(struct wined3d_cs *cs, const void *data)
+static void wined3d_cs_exec_texture_add_dirty_region(struct wined3d_cs *cs, const void *data)
+{
+ const struct wined3d_cs_texture_add_dirty_region *op = data;
+ struct wined3d_texture *texture = op->texture;
@ -58,8 +58,6 @@ index 3e385ddf736..cdd11e41c91 100644
+ context_release(context);
+
+ wined3d_resource_release(&texture->resource);
+
+ return sizeof(*op);
+}
+
+void wined3d_cs_emit_texture_add_dirty_region(struct wined3d_cs *cs,
@ -81,22 +79,22 @@ index 3e385ddf736..cdd11e41c91 100644
+ cs->ops->submit(cs);
+}
+
static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void *data) =
static void (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void *data) =
{
/* WINED3D_CS_OP_FENCE */ wined3d_cs_exec_fence,
@@ -2466,6 +2515,7 @@ static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void
/* WINED3D_CS_OP_SYNC */ wined3d_cs_exec_sync,
@@ -2192,6 +2239,7 @@ static void (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void
/* WINED3D_CS_OP_RELEASE_DC */ wined3d_cs_exec_release_dc,
/* WINED3D_CS_OP_CREATE_SWAPCHAIN_CONTEXT */ wined3d_cs_exec_create_swapchain_context,
/* WINED3D_CS_OP_UPDATE_SWAP_INTERVAL */ wined3d_cs_exec_update_swap_interval,
/* WINED3D_CS_OP_SAMPLER_INIT */ wined3d_cs_exec_sampler_init,
+ /* WINED3D_CS_OP_TEXTURE_ADD_DIRTY_REGION */ wined3d_cs_exec_texture_add_dirty_region,
};
static void *wined3d_cs_st_require_space(struct wined3d_cs *cs, size_t size)
diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c
index b62fff8c503..1ff9cbb87c3 100644
index 70c4590f74a..de118e4d564 100644
--- a/dlls/wined3d/texture.c
+++ b/dlls/wined3d/texture.c
@@ -1424,7 +1424,6 @@ struct wined3d_texture_sub_resource *wined3d_texture_get_sub_resource(struct win
@@ -1521,7 +1521,6 @@ struct wined3d_texture_sub_resource *wined3d_texture_get_sub_resource(struct win
HRESULT CDECL wined3d_texture_add_dirty_region(struct wined3d_texture *texture,
UINT layer, const struct wined3d_box *dirty_region)
{
@ -104,7 +102,7 @@ index b62fff8c503..1ff9cbb87c3 100644
unsigned int sub_resource_idx;
TRACE("texture %p, layer %u, dirty_region %s.\n", texture, layer, debug_box(dirty_region));
@@ -1436,19 +1435,7 @@ HRESULT CDECL wined3d_texture_add_dirty_region(struct wined3d_texture *texture,
@@ -1533,19 +1532,7 @@ HRESULT CDECL wined3d_texture_add_dirty_region(struct wined3d_texture *texture,
}
sub_resource_idx = layer * texture->level_count;
@ -126,18 +124,18 @@ index b62fff8c503..1ff9cbb87c3 100644
}
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index bf43ba4f8d9..9c6c94052a4 100644
index ce02d81914f..7cabc276a0b 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -3254,6 +3254,8 @@ void wined3d_cs_emit_set_unordered_access_view(struct wined3d_cs *cs, unsigned i
@@ -3274,6 +3274,8 @@ 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;
+void wined3d_cs_emit_texture_add_dirty_region(struct wined3d_cs *cs, struct wined3d_texture *texture,
+ unsigned int sub_resource_idx, const struct wined3d_box *dirty_region) DECLSPEC_HIDDEN;
void wined3d_cs_emit_sync(struct wined3d_cs *cs);
void wined3d_cs_emit_unload_resource(struct wined3d_cs *cs, struct wined3d_resource *resource) DECLSPEC_HIDDEN;
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

View File

@ -1,4 +1,4 @@
From 23739f9e906b066f50f553f0811c25135f44108c Mon Sep 17 00:00:00 2001
From a1ebeac4b7804415c3b1fd48f79fcf574576c645 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20D=C3=B6singer?= <stefan@codeweavers.com>
Date: Fri, 30 Aug 2013 17:00:35 +0200
Subject: wined3d: Wrap GL BOs in a structure
@ -13,10 +13,10 @@ them for DISCARD maps.
4 files changed, 92 insertions(+), 34 deletions(-)
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index 50ae4a928fc..151e41bb2e3 100644
index 3e4a1790946..bd3a132c496 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -5284,3 +5284,56 @@ LRESULT device_process_message(struct wined3d_device *device, HWND window, BOOL
@@ -5154,3 +5154,56 @@ LRESULT device_process_message(struct wined3d_device *device, HWND window, BOOL
else
return CallWindowProcA(proc, window, message, wparam, lparam);
}
@ -74,10 +74,10 @@ index 50ae4a928fc..151e41bb2e3 100644
+ wined3d_device_destroy_bo(device, context, bo);
+}
diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
index e19f63db4c2..05fb8357126 100644
index 5b8434d63b8..33a0ecf0327 100644
--- a/dlls/wined3d/surface.c
+++ b/dlls/wined3d/surface.c
@@ -2871,7 +2871,7 @@ static HRESULT surface_load_texture(struct wined3d_surface *surface,
@@ -2809,7 +2809,7 @@ static HRESULT surface_load_texture(struct wined3d_surface *surface,
/* Don't use PBOs for converted surfaces. During PBO conversion we look at
* WINED3D_TEXTURE_CONVERTED but it isn't set (yet) in all cases it is
* getting called. */
@ -87,10 +87,10 @@ index e19f63db4c2..05fb8357126 100644
TRACE("Removing the pbo attached to surface %p.\n", surface);
diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c
index 1ff9cbb87c3..02119dee645 100644
index de118e4d564..bff7452e773 100644
--- a/dlls/wined3d/texture.c
+++ b/dlls/wined3d/texture.c
@@ -240,7 +240,7 @@ void wined3d_texture_get_memory(struct wined3d_texture *texture, unsigned int su
@@ -337,7 +337,7 @@ void wined3d_texture_get_memory(struct wined3d_texture *texture, unsigned int su
if (locations & WINED3D_LOCATION_BUFFER)
{
data->addr = NULL;
@ -99,7 +99,7 @@ index 1ff9cbb87c3..02119dee645 100644
return;
}
if (locations & WINED3D_LOCATION_USER_MEMORY)
@@ -341,18 +341,17 @@ static HRESULT wined3d_texture_init(struct wined3d_texture *texture, const struc
@@ -438,18 +438,17 @@ static HRESULT wined3d_texture_init(struct wined3d_texture *texture, const struc
/* Context activation is done by the caller. */
static void wined3d_texture_remove_buffer_object(struct wined3d_texture *texture,
@ -124,7 +124,7 @@ index 1ff9cbb87c3..02119dee645 100644
}
static void wined3d_texture_update_map_binding(struct wined3d_texture *texture)
@@ -372,7 +371,7 @@ static void wined3d_texture_update_map_binding(struct wined3d_texture *texture)
@@ -469,7 +468,7 @@ static void wined3d_texture_update_map_binding(struct wined3d_texture *texture)
&& !wined3d_texture_load_location(texture, i, context, map_binding))
ERR("Failed to load location %s.\n", wined3d_debug_location(map_binding));
if (texture->resource.map_binding == WINED3D_LOCATION_BUFFER)
@ -133,7 +133,7 @@ index 1ff9cbb87c3..02119dee645 100644
}
if (context)
@@ -529,28 +528,25 @@ static void wined3d_texture_cleanup(struct wined3d_texture *texture)
@@ -626,28 +625,25 @@ static void wined3d_texture_cleanup(struct wined3d_texture *texture)
unsigned int sub_count = texture->level_count * texture->layer_count;
struct wined3d_device *device = texture->resource.device;
struct wined3d_context *context = NULL;
@ -167,7 +167,7 @@ index 1ff9cbb87c3..02119dee645 100644
}
if (context)
context_release(context);
@@ -1228,22 +1224,19 @@ HRESULT CDECL wined3d_texture_update_desc(struct wined3d_texture *texture, UINT
@@ -1325,22 +1321,19 @@ HRESULT CDECL wined3d_texture_update_desc(struct wined3d_texture *texture, UINT
/* Context activation is done by the caller. */
static void wined3d_texture_prepare_buffer_object(struct wined3d_texture *texture,
@ -195,7 +195,7 @@ index 1ff9cbb87c3..02119dee645 100644
}
static void wined3d_texture_force_reload(struct wined3d_texture *texture)
@@ -1369,7 +1362,7 @@ BOOL wined3d_texture_prepare_location(struct wined3d_texture *texture, unsigned
@@ -1466,7 +1459,7 @@ BOOL wined3d_texture_prepare_location(struct wined3d_texture *texture, unsigned
return TRUE;
case WINED3D_LOCATION_BUFFER:
@ -204,7 +204,7 @@ index 1ff9cbb87c3..02119dee645 100644
return TRUE;
case WINED3D_LOCATION_TEXTURE_RGB:
@@ -1669,7 +1662,7 @@ static BOOL texture1d_load_location(struct wined3d_texture *texture, unsigned in
@@ -1766,7 +1759,7 @@ static BOOL texture1d_load_location(struct wined3d_texture *texture, unsigned in
}
else if (sub_resource->locations & WINED3D_LOCATION_BUFFER)
{
@ -213,7 +213,7 @@ index 1ff9cbb87c3..02119dee645 100644
wined3d_texture_bind_and_dirtify(texture, context, location == WINED3D_LOCATION_TEXTURE_SRGB);
wined3d_texture_get_pitch(texture, sub_resource_idx, &row_pitch, &slice_pitch);
texture1d_upload_data(texture, sub_resource_idx, context, NULL, &data, row_pitch, slice_pitch);
@@ -1714,7 +1707,7 @@ static BOOL texture1d_load_location(struct wined3d_texture *texture, unsigned in
@@ -1811,7 +1804,7 @@ static BOOL texture1d_load_location(struct wined3d_texture *texture, unsigned in
case WINED3D_LOCATION_BUFFER:
if (sub_resource->locations & (WINED3D_LOCATION_TEXTURE_RGB | WINED3D_LOCATION_TEXTURE_SRGB))
{
@ -222,7 +222,7 @@ index 1ff9cbb87c3..02119dee645 100644
if (sub_resource->locations & WINED3D_LOCATION_TEXTURE_RGB)
wined3d_texture_bind_and_dirtify(texture, context, FALSE);
@@ -2008,8 +2001,8 @@ static void wined3d_texture_unload(struct wined3d_resource *resource)
@@ -2105,8 +2098,8 @@ static void wined3d_texture_unload(struct wined3d_resource *resource)
wined3d_texture_invalidate_location(texture, i, ~WINED3D_LOCATION_DISCARDED);
}
@ -233,7 +233,7 @@ index 1ff9cbb87c3..02119dee645 100644
if (resource->type == WINED3D_RTYPE_TEXTURE_2D)
{
@@ -2833,7 +2826,7 @@ static BOOL texture3d_load_location(struct wined3d_texture *texture, unsigned in
@@ -2904,7 +2897,7 @@ static BOOL texture3d_load_location(struct wined3d_texture *texture, unsigned in
}
else if (sub_resource->locations & WINED3D_LOCATION_BUFFER)
{
@ -242,7 +242,7 @@ index 1ff9cbb87c3..02119dee645 100644
wined3d_texture_bind_and_dirtify(texture, context,
location == WINED3D_LOCATION_TEXTURE_SRGB);
wined3d_texture_get_pitch(texture, sub_resource_idx, &row_pitch, &slice_pitch);
@@ -2879,7 +2872,7 @@ static BOOL texture3d_load_location(struct wined3d_texture *texture, unsigned in
@@ -2950,7 +2943,7 @@ static BOOL texture3d_load_location(struct wined3d_texture *texture, unsigned in
case WINED3D_LOCATION_BUFFER:
if (sub_resource->locations & (WINED3D_LOCATION_TEXTURE_RGB | WINED3D_LOCATION_TEXTURE_SRGB))
{
@ -252,10 +252,10 @@ index 1ff9cbb87c3..02119dee645 100644
if (sub_resource->locations & WINED3D_LOCATION_TEXTURE_RGB)
wined3d_texture_bind_and_dirtify(texture, context, FALSE);
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 9c6c94052a4..95bc6e0bcd5 100644
index 7cabc276a0b..e4474a7b2c5 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -2517,6 +2517,14 @@ struct wined3d_state
@@ -2560,6 +2560,14 @@ struct wined3d_state
struct wined3d_rasterizer_state *rasterizer_state;
};
@ -270,10 +270,10 @@ index 9c6c94052a4..95bc6e0bcd5 100644
#define WINED3D_UNMAPPED_STAGE ~0U
/* Multithreaded flag. Removed from the public header to signal that
@@ -2634,6 +2642,10 @@ void device_invalidate_state(const struct wined3d_device *device, DWORD state) D
@@ -2673,6 +2681,10 @@ void device_resource_released(struct wined3d_device *device, struct wined3d_reso
void device_invalidate_state(const struct wined3d_device *device, DWORD state) DECLSPEC_HIDDEN;
void device_exec_update_texture(struct wined3d_context *context, struct wined3d_texture *src_texture,
struct wined3d_texture *dst_texture) DECLSPEC_HIDDEN;
void device_create_dummy_textures(struct wined3d_device *device, struct wined3d_context *context) DECLSPEC_HIDDEN;
+struct wined3d_gl_bo *wined3d_device_get_bo(struct wined3d_device *device, UINT size, GLenum gl_usage,
+ GLenum type_hint, struct wined3d_context *context) DECLSPEC_HIDDEN;
+void wined3d_device_release_bo(struct wined3d_device *device, struct wined3d_gl_bo *bo,
@ -281,7 +281,7 @@ index 9c6c94052a4..95bc6e0bcd5 100644
static inline BOOL isStateDirty(const struct wined3d_context *context, DWORD state)
{
@@ -2819,7 +2831,7 @@ struct wined3d_texture
@@ -2863,7 +2875,7 @@ struct wined3d_texture
unsigned int map_count;
DWORD locations;

View File

@ -1,45 +0,0 @@
From 716641434adb8c9e8c9dc940d5a3a1f82c147de2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20D=C3=B6singer?= <stefan@codeweavers.com>
Date: Thu, 10 Oct 2013 18:40:04 +0200
Subject: wined3d: Recreate ctx and dummy textures through the CS after resets.
---
dlls/wined3d/device.c | 15 +++++++++++----
1 file changed, 11 insertions(+), 4 deletions(-)
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index 008be8ae010..1427e4c85ef 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -1010,7 +1010,6 @@ static void wined3d_device_delete_opengl_contexts(struct wined3d_device *device)
static HRESULT create_primary_opengl_context(struct wined3d_device *device, struct wined3d_swapchain *swapchain)
{
struct wined3d_context *context;
- struct wined3d_texture *target;
HRESULT hr;
if (FAILED(hr = device->shader_backend->shader_alloc_private(device,
@@ -1027,9 +1026,17 @@ static HRESULT create_primary_opengl_context(struct wined3d_device *device, stru
return hr;
}
- target = swapchain->back_buffers ? swapchain->back_buffers[0] : swapchain->front_buffer;
- context = context_acquire(device, target, 0);
- device_create_dummy_textures(device, context);
+ hr = wined3d_cs_emit_create_swapchain_context(device->cs, swapchain);
+ if (FAILED(hr))
+ {
+ WARN("Failed to create context.\n");
+ device->blitter->free_private(device);
+ device->shader_backend->shader_free_private(device);
+ return hr;
+ }
+
+ wined3d_cs_emit_create_dummy_textures(device->cs);
+ context = context_acquire(device, NULL, 0);
create_default_samplers(device, context);
context_release(context);
--
2.11.0

View File

@ -0,0 +1,59 @@
From 6f933585f6c0fb35a9e3ef65645c86f8ecb6f4da Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Tue, 7 Feb 2017 14:01:52 +0100
Subject: wined3d: Send buffer update subresource requests through CS.
---
dlls/wined3d/cs.c | 11 +++++++++++
dlls/wined3d/device.c | 7 +------
2 files changed, 12 insertions(+), 6 deletions(-)
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
index 5b529d000f4..7e032d8ec05 100644
--- a/dlls/wined3d/cs.c
+++ b/dlls/wined3d/cs.c
@@ -2012,6 +2012,17 @@ static void wined3d_cs_exec_update_sub_resource(struct wined3d_cs *cs, const voi
struct wined3d_texture *texture;
unsigned int width, height, depth, level;
+ if (op->resource->type == WINED3D_RTYPE_BUFFER)
+ {
+ struct wined3d_buffer *buffer = buffer_from_resource(op->resource);
+ HRESULT hr;
+
+ if (FAILED(hr = wined3d_buffer_upload_data(buffer, op->box, op->data)))
+ WARN("Failed to update buffer data, hr %#x.\n", hr);
+
+ return;
+ }
+
texture = wined3d_texture_from_resource(op->resource);
level = op->sub_resource_idx % texture->level_count;
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index bd3a132c496..bf647d5241c 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -4178,18 +4178,13 @@ void CDECL wined3d_device_update_sub_resource(struct wined3d_device *device, str
if (resource->type == WINED3D_RTYPE_BUFFER)
{
- struct wined3d_buffer *buffer = buffer_from_resource(resource);
- HRESULT hr;
-
if (sub_resource_idx > 0)
{
WARN("Invalid sub_resource_idx %u.\n", sub_resource_idx);
return;
}
- if (FAILED(hr = wined3d_buffer_upload_data(buffer, box, data)))
- WARN("Failed to update buffer data, hr %#x.\n", hr);
-
+ wined3d_cs_emit_update_sub_resource(device->cs, resource, sub_resource_idx, box, data, row_pitch, depth_pitch);
return;
}
--
2.11.0

View File

@ -1,141 +0,0 @@
From 0c7a163631a32c68e50a24a4353665edf19c8f4f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20D=C3=B6singer?= <stefandoesinger@gmx.at>
Date: Sat, 7 May 2016 21:16:47 +0100
Subject: wined3d: Call create_default_sampler from create_dummy_textures.
I should really rename it, don't feel like it now.
---
dlls/wined3d/device.c | 75 +++++++++++++++++++++++----------------------------
1 file changed, 34 insertions(+), 41 deletions(-)
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index 1427e4c85ef..7bb9895f90d 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -610,6 +610,39 @@ out:
}
/* Context activation is done by the caller. */
+static void create_default_samplers(struct wined3d_device *device, struct wined3d_context *context)
+{
+ const struct wined3d_gl_info *gl_info = context->gl_info;
+
+ if (gl_info->supported[ARB_SAMPLER_OBJECTS])
+ {
+ /* In SM4+ shaders there is a separation between resources and samplers. Some shader
+ * instructions allow access to resources without using samplers.
+ * In GLSL, resources are always accessed through sampler or image variables. The default
+ * sampler object is used to emulate the direct resource access when there is no sampler state
+ * to use.
+ */
+ GL_EXTCALL(glGenSamplers(1, &device->default_sampler));
+ GL_EXTCALL(glSamplerParameteri(device->default_sampler, GL_TEXTURE_MAG_FILTER, GL_NEAREST));
+ GL_EXTCALL(glSamplerParameteri(device->default_sampler, GL_TEXTURE_MIN_FILTER, GL_NEAREST));
+ checkGLcall("Create default sampler");
+
+ /* In D3D10+, a NULL sampler maps to the default sampler state. */
+ GL_EXTCALL(glGenSamplers(1, &device->null_sampler));
+ GL_EXTCALL(glSamplerParameteri(device->null_sampler, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR));
+ GL_EXTCALL(glSamplerParameteri(device->null_sampler, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE));
+ GL_EXTCALL(glSamplerParameteri(device->null_sampler, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE));
+ GL_EXTCALL(glSamplerParameteri(device->null_sampler, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_EDGE));
+ checkGLcall("Create null sampler");
+ }
+ else
+ {
+ device->default_sampler = 0;
+ device->null_sampler = 0;
+ }
+}
+
+/* Context activation is done by the caller. */
void device_create_dummy_textures(struct wined3d_device *device, struct wined3d_context *context)
{
const struct wined3d_d3d_info *d3d_info = &device->adapter->d3d_info;
@@ -744,6 +777,7 @@ void device_create_dummy_textures(struct wined3d_device *device, struct wined3d_
}
context_bind_dummy_textures(device, context);
+ create_default_samplers(device, context);
}
/* Context activation is done by the caller. */
@@ -778,39 +812,6 @@ static void destroy_dummy_textures(struct wined3d_device *device, struct wined3d
}
/* Context activation is done by the caller. */
-static void create_default_samplers(struct wined3d_device *device, struct wined3d_context *context)
-{
- const struct wined3d_gl_info *gl_info = context->gl_info;
-
- if (gl_info->supported[ARB_SAMPLER_OBJECTS])
- {
- /* In SM4+ shaders there is a separation between resources and samplers. Some shader
- * instructions allow access to resources without using samplers.
- * In GLSL, resources are always accessed through sampler or image variables. The default
- * sampler object is used to emulate the direct resource access when there is no sampler state
- * to use.
- */
- GL_EXTCALL(glGenSamplers(1, &device->default_sampler));
- GL_EXTCALL(glSamplerParameteri(device->default_sampler, GL_TEXTURE_MAG_FILTER, GL_NEAREST));
- GL_EXTCALL(glSamplerParameteri(device->default_sampler, GL_TEXTURE_MIN_FILTER, GL_NEAREST));
- checkGLcall("Create default sampler");
-
- /* In D3D10+, a NULL sampler maps to the default sampler state. */
- GL_EXTCALL(glGenSamplers(1, &device->null_sampler));
- GL_EXTCALL(glSamplerParameteri(device->null_sampler, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR));
- GL_EXTCALL(glSamplerParameteri(device->null_sampler, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE));
- GL_EXTCALL(glSamplerParameteri(device->null_sampler, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE));
- GL_EXTCALL(glSamplerParameteri(device->null_sampler, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_EDGE));
- checkGLcall("Create null sampler");
- }
- else
- {
- device->default_sampler = 0;
- device->null_sampler = 0;
- }
-}
-
-/* Context activation is done by the caller. */
static void destroy_default_samplers(struct wined3d_device *device, struct wined3d_context *context)
{
const struct wined3d_gl_info *gl_info = context->gl_info;
@@ -1009,7 +1010,6 @@ static void wined3d_device_delete_opengl_contexts(struct wined3d_device *device)
static HRESULT create_primary_opengl_context(struct wined3d_device *device, struct wined3d_swapchain *swapchain)
{
- struct wined3d_context *context;
HRESULT hr;
if (FAILED(hr = device->shader_backend->shader_alloc_private(device,
@@ -1036,9 +1036,6 @@ static HRESULT create_primary_opengl_context(struct wined3d_device *device, stru
}
wined3d_cs_emit_create_dummy_textures(device->cs);
- context = context_acquire(device, NULL, 0);
- create_default_samplers(device, context);
- context_release(context);
return WINED3D_OK;
}
@@ -1049,7 +1046,6 @@ HRESULT CDECL wined3d_device_init_3d(struct wined3d_device *device,
static const struct wined3d_color black = {0.0f, 0.0f, 0.0f, 0.0f};
const struct wined3d_gl_info *gl_info = &device->adapter->gl_info;
struct wined3d_swapchain *swapchain = NULL;
- struct wined3d_context *context;
DWORD clear_flags = 0;
HRESULT hr;
@@ -1114,9 +1110,6 @@ HRESULT CDECL wined3d_device_init_3d(struct wined3d_device *device,
device_init_swapchain_state(device, swapchain);
wined3d_cs_emit_create_dummy_textures(device->cs);
- context = context_acquire(device, NULL, 0);
- create_default_samplers(device, context);
- context_release(context);
device->contexts[0]->last_was_rhw = 0;
--
2.11.0

View File

@ -1,27 +1,27 @@
From 2a0f7ffbf6bea3d99cb3a3cba629545e195903dc Mon Sep 17 00:00:00 2001
From da62e3d0e77ffb6f420b1c460bc52b833955635c Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Tue, 7 Feb 2017 14:37:07 +0100
Subject: wined3d: Send buffer copy requests through CS.
---
dlls/wined3d/cs.c | 47 ++++++++++++++++++++++++++++++++++++++++++
dlls/wined3d/device.c | 8 +++----
dlls/wined3d/cs.c | 44 ++++++++++++++++++++++++++++++++++++++++++
dlls/wined3d/device.c | 8 ++++----
dlls/wined3d/wined3d_private.h | 3 +++
3 files changed, 54 insertions(+), 4 deletions(-)
3 files changed, 51 insertions(+), 4 deletions(-)
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
index 594662fbd83..1015baf99c5 100644
index 7e032d8ec05..381b7ca30ac 100644
--- a/dlls/wined3d/cs.c
+++ b/dlls/wined3d/cs.c
@@ -90,6 +90,7 @@ enum wined3d_cs_op
@@ -77,6 +77,7 @@ enum wined3d_cs_op
WINED3D_CS_OP_CREATE_SWAPCHAIN_CONTEXT,
WINED3D_CS_OP_UPDATE_SWAP_INTERVAL,
WINED3D_CS_OP_SAMPLER_INIT,
WINED3D_CS_OP_TEXTURE_ADD_DIRTY_REGION,
+ WINED3D_CS_OP_BUFFER_COPY,
WINED3D_CS_OP_STOP,
};
@@ -487,6 +488,16 @@ struct wined3d_cs_texture_add_dirty_region
struct wined3d_cs_sync
@@ -457,6 +458,16 @@ struct wined3d_cs_texture_add_dirty_region
unsigned int sub_resource_idx;
};
@ -35,15 +35,14 @@ index 594662fbd83..1015baf99c5 100644
+ unsigned int size;
+};
+
static inline BOOL wined3d_cs_process_block(struct wined3d_cs *cs, struct wined3d_cs_block *block);
static void wined3d_cs_mt_submit(struct wined3d_cs *cs);
@@ -2480,6 +2491,41 @@ void wined3d_cs_emit_texture_add_dirty_region(struct wined3d_cs *cs,
static void wined3d_cs_exec_sync(struct wined3d_cs *cs, const void *data)
{
}
@@ -2198,6 +2209,38 @@ void wined3d_cs_emit_texture_add_dirty_region(struct wined3d_cs *cs,
cs->ops->submit(cs);
}
+
+static UINT wined3d_cs_exec_buffer_copy(struct wined3d_cs *cs, const void *data)
+static void wined3d_cs_exec_buffer_copy(struct wined3d_cs *cs, const void *data)
+{
+ const struct wined3d_cs_buffer_copy *op = data;
+ HRESULT hr;
@ -53,8 +52,6 @@ index 594662fbd83..1015baf99c5 100644
+
+ wined3d_resource_release(&op->dst_buffer->resource);
+ wined3d_resource_release(&op->src_buffer->resource);
+
+ return sizeof(*op);
+}
+
+void wined3d_cs_emit_buffer_copy(struct wined3d_cs *cs, struct wined3d_buffer *dst_buffer,
@ -77,22 +74,22 @@ index 594662fbd83..1015baf99c5 100644
+ cs->ops->submit(cs);
+}
+
static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void *data) =
static void (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void *data) =
{
/* WINED3D_CS_OP_FENCE */ wined3d_cs_exec_fence,
@@ -2535,6 +2581,7 @@ static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void
/* WINED3D_CS_OP_SYNC */ wined3d_cs_exec_sync,
@@ -2251,6 +2294,7 @@ static void (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void
/* WINED3D_CS_OP_CREATE_SWAPCHAIN_CONTEXT */ wined3d_cs_exec_create_swapchain_context,
/* WINED3D_CS_OP_UPDATE_SWAP_INTERVAL */ wined3d_cs_exec_update_swap_interval,
/* WINED3D_CS_OP_SAMPLER_INIT */ wined3d_cs_exec_sampler_init,
/* WINED3D_CS_OP_TEXTURE_ADD_DIRTY_REGION */ wined3d_cs_exec_texture_add_dirty_region,
+ /* WINED3D_CS_OP_BUFFER_COPY */ wined3d_cs_exec_buffer_copy,
};
static void *wined3d_cs_st_require_space(struct wined3d_cs *cs, size_t size)
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index 5ac6e992bae..04736737ddd 100644
index bf647d5241c..625357e4407 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -4032,10 +4032,9 @@ void CDECL wined3d_device_copy_resource(struct wined3d_device *device,
@@ -3981,10 +3981,9 @@ void CDECL wined3d_device_copy_resource(struct wined3d_device *device,
if (dst_resource->type == WINED3D_RTYPE_BUFFER)
{
@ -105,7 +102,7 @@ index 5ac6e992bae..04736737ddd 100644
return;
}
@@ -4157,8 +4156,9 @@ HRESULT CDECL wined3d_device_copy_sub_resource_region(struct wined3d_device *dev
@@ -4106,8 +4105,9 @@ HRESULT CDECL wined3d_device_copy_sub_resource_region(struct wined3d_device *dev
return WINED3DERR_INVALIDCALL;
}
@ -117,10 +114,10 @@ index 5ac6e992bae..04736737ddd 100644
if (dst_resource->type != WINED3D_RTYPE_TEXTURE_2D)
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 95bc6e0bcd5..821b296a919 100644
index e4474a7b2c5..2b7b658a162 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -3190,6 +3190,9 @@ void wined3d_cs_emit_blt(struct wined3d_cs *cs, struct wined3d_surface *dst_surf
@@ -3214,6 +3214,9 @@ void wined3d_cs_emit_blt(struct wined3d_cs *cs, struct wined3d_surface *dst_surf
const RECT *dst_rect, struct wined3d_surface *src_surface,
const RECT *src_rect, DWORD flags, const struct wined3d_blt_fx *fx,
enum wined3d_texture_filter_type filter) DECLSPEC_HIDDEN;

View File

@ -1,4 +1,4 @@
From 83e81d1ca0c1a14e31f42253596859920f44ccb5 Mon Sep 17 00:00:00 2001
From 5d3ab1ff100c046961cbe2ccc7da231b845a1b5b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20D=C3=B6singer?= <stefan@codeweavers.com>
Date: Thu, 20 Dec 2012 13:09:17 +0100
Subject: wined3d: Move the framebuffer into wined3d_state
@ -19,7 +19,7 @@ Subject: wined3d: Move the framebuffer into wined3d_state
12 files changed, 182 insertions(+), 126 deletions(-)
diff --git a/dlls/wined3d/arb_program_shader.c b/dlls/wined3d/arb_program_shader.c
index 7ed83f4b609..86627090d29 100644
index 24dcb05d341..b5aa1037d77 100644
--- a/dlls/wined3d/arb_program_shader.c
+++ b/dlls/wined3d/arb_program_shader.c
@@ -701,7 +701,7 @@ static void shader_arb_load_constants_internal(struct shader_arb_priv *priv,
@ -41,10 +41,10 @@ index 7ed83f4b609..86627090d29 100644
}
diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c
index 8483a28283f..71e1191649e 100644
index 0115f1ba6da..bb65538ad7b 100644
--- a/dlls/wined3d/context.c
+++ b/dlls/wined3d/context.c
@@ -1723,6 +1723,11 @@ struct wined3d_context *context_create(struct wined3d_swapchain *swapchain,
@@ -1720,6 +1720,11 @@ struct wined3d_context *context_create(struct wined3d_swapchain *swapchain,
goto out;
}
@ -56,7 +56,7 @@ index 8483a28283f..71e1191649e 100644
/* Initialize the texture unit mapping to a 1:1 mapping */
for (s = 0; s < MAX_COMBINED_SAMPLERS; ++s)
{
@@ -2031,6 +2036,7 @@ out:
@@ -2028,6 +2033,7 @@ out:
if (hdc) wined3d_release_dc(swapchain->win_handle, hdc);
device->shader_backend->shader_free_context_data(ret);
device->adapter->fragment_pipe->free_context_data(ret);
@ -64,7 +64,7 @@ index 8483a28283f..71e1191649e 100644
HeapFree(GetProcessHeap(), 0, ret->free_event_queries);
HeapFree(GetProcessHeap(), 0, ret->free_occlusion_queries);
HeapFree(GetProcessHeap(), 0, ret->free_timestamp_queries);
@@ -2078,6 +2084,7 @@ void context_destroy(struct wined3d_device *device, struct wined3d_context *cont
@@ -2075,6 +2081,7 @@ void context_destroy(struct wined3d_device *device, struct wined3d_context *cont
device->shader_backend->shader_free_context_data(context);
device->adapter->fragment_pipe->free_context_data(context);
HeapFree(GetProcessHeap(), 0, context->fbo_key);
@ -72,7 +72,7 @@ index 8483a28283f..71e1191649e 100644
HeapFree(GetProcessHeap(), 0, context->draw_buffers);
HeapFree(GetProcessHeap(), 0, context->blit_targets);
device_context_remove(device, context);
@@ -2640,7 +2647,7 @@ BOOL context_apply_clear_state(struct wined3d_context *context, const struct win
@@ -2637,7 +2644,7 @@ BOOL context_apply_clear_state(struct wined3d_context *context, const struct win
DWORD rt_mask = 0, *cur_mask;
UINT i;
@ -81,7 +81,7 @@ index 8483a28283f..71e1191649e 100644
|| rt_count != gl_info->limits.buffers)
{
if (!context_validate_rt_config(rt_count, rts, dsv))
@@ -2685,6 +2692,8 @@ BOOL context_apply_clear_state(struct wined3d_context *context, const struct win
@@ -2682,6 +2689,8 @@ BOOL context_apply_clear_state(struct wined3d_context *context, const struct win
rt_mask = context_generate_rt_mask_no_fbo(context,
rt_count ? wined3d_rendertarget_view_get_surface(rts[0])->container : NULL);
}
@ -90,7 +90,7 @@ index 8483a28283f..71e1191649e 100644
}
else if (wined3d_settings.offscreen_rendering_mode == ORM_FBO
&& (!rt_count || wined3d_resource_is_offscreen(rts[0]->resource)))
@@ -2741,7 +2750,7 @@ BOOL context_apply_clear_state(struct wined3d_context *context, const struct win
@@ -2738,7 +2747,7 @@ BOOL context_apply_clear_state(struct wined3d_context *context, const struct win
static DWORD find_draw_buffers_mask(const struct wined3d_context *context, const struct wined3d_state *state)
{
@ -99,7 +99,7 @@ index 8483a28283f..71e1191649e 100644
struct wined3d_shader *ps = state->shader[WINED3D_SHADER_TYPE_PIXEL];
DWORD rt_mask, rt_mask_bits;
unsigned int i;
@@ -2771,7 +2780,7 @@ static DWORD find_draw_buffers_mask(const struct wined3d_context *context, const
@@ -2768,7 +2777,7 @@ static DWORD find_draw_buffers_mask(const struct wined3d_context *context, const
void context_state_fb(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
{
DWORD rt_mask = find_draw_buffers_mask(context, state);
@ -108,7 +108,7 @@ index 8483a28283f..71e1191649e 100644
DWORD *cur_mask;
if (wined3d_settings.offscreen_rendering_mode == ORM_FBO)
@@ -3060,6 +3069,8 @@ void context_state_drawbuf(struct wined3d_context *context, const struct wined3d
@@ -3057,6 +3066,8 @@ void context_state_drawbuf(struct wined3d_context *context, const struct wined3d
context_apply_draw_buffers(context, rt_mask);
*cur_mask = rt_mask;
}
@ -117,7 +117,7 @@ index 8483a28283f..71e1191649e 100644
}
static BOOL fixed_get_input(BYTE usage, BYTE usage_idx, unsigned int *regnum)
@@ -3504,7 +3515,7 @@ BOOL context_apply_draw_state(struct wined3d_context *context,
@@ -3501,7 +3512,7 @@ BOOL context_apply_draw_state(struct wined3d_context *context,
const struct wined3d_device *device, const struct wined3d_state *state)
{
const struct StateEntry *state_table = context->state_table;
@ -127,10 +127,10 @@ index 8483a28283f..71e1191649e 100644
WORD map;
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
index c9626180db1..55c175ef093 100644
index 381b7ca30ac..54b81f74f64 100644
--- a/dlls/wined3d/cs.c
+++ b/dlls/wined3d/cs.c
@@ -624,7 +624,7 @@ static UINT wined3d_cs_exec_present(struct wined3d_cs *cs, const void *data)
@@ -510,7 +510,7 @@ static void wined3d_cs_exec_present(struct wined3d_cs *cs, const void *data)
wined3d_swapchain_set_window(swapchain, op->dst_window_override);
swapchain->swapchain_ops->swapchain_present(swapchain, &op->src_rect, &op->dst_rect, op->flags,
@ -139,7 +139,7 @@ index c9626180db1..55c175ef093 100644
InterlockedDecrement(&cs->pending_presents);
@@ -687,19 +687,19 @@ static UINT wined3d_cs_exec_clear(struct wined3d_cs *cs, const void *data)
@@ -570,19 +570,19 @@ static void wined3d_cs_exec_clear(struct wined3d_cs *cs, const void *data)
state = &cs->state;
wined3d_get_draw_rect(state, &draw_rect);
device_clear_render_targets(device, device->adapter->gl_info.limits.buffers,
@ -160,10 +160,10 @@ index c9626180db1..55c175ef093 100644
if (op->flags & (WINED3DCLEAR_ZBUFFER | WINED3DCLEAR_STENCIL))
- wined3d_resource_release(state->fb->depth_stencil->resource);
+ wined3d_resource_release(state->fb.depth_stencil->resource);
return size;
}
@@ -724,12 +724,12 @@ void wined3d_cs_emit_clear(struct wined3d_cs *cs, DWORD rect_count, const RECT *
void wined3d_cs_emit_clear(struct wined3d_cs *cs, DWORD rect_count, const RECT *rects,
@@ -605,12 +605,12 @@ void wined3d_cs_emit_clear(struct wined3d_cs *cs, DWORD rect_count, const RECT *
{
for (i = 0; i < cs->device->adapter->gl_info.limits.buffers; ++i)
{
@ -179,7 +179,7 @@ index c9626180db1..55c175ef093 100644
cs->ops->submit(cs);
}
@@ -904,11 +904,11 @@ static UINT wined3d_cs_exec_draw(struct wined3d_cs *cs, const void *data)
@@ -783,11 +783,11 @@ static void wined3d_cs_exec_draw(struct wined3d_cs *cs, const void *data)
}
for (i = 0; i < cs->device->adapter->gl_info.limits.buffers; ++i)
{
@ -195,7 +195,7 @@ index c9626180db1..55c175ef093 100644
release_shader_resources(state, ~(1u << WINED3D_SHADER_TYPE_COMPUTE));
release_unordered_access_resources(state->shader[WINED3D_SHADER_TYPE_PIXEL],
state->unordered_access_view[WINED3D_PIPELINE_GRAPHICS]);
@@ -946,11 +946,11 @@ void wined3d_cs_emit_draw(struct wined3d_cs *cs, int base_vertex_idx, unsigned i
@@ -823,11 +823,11 @@ void wined3d_cs_emit_draw(struct wined3d_cs *cs, int base_vertex_idx, unsigned i
}
for (i = 0; i < cs->device->adapter->gl_info.limits.buffers; ++i)
{
@ -211,16 +211,16 @@ index c9626180db1..55c175ef093 100644
acquire_shader_resources(state, ~(1u << WINED3D_SHADER_TYPE_COMPUTE));
acquire_unordered_access_resources(state->shader[WINED3D_SHADER_TYPE_PIXEL],
state->unordered_access_view[WINED3D_PIPELINE_GRAPHICS]);
@@ -1026,7 +1026,7 @@ static UINT wined3d_cs_exec_set_rendertarget_view(struct wined3d_cs *cs, const v
@@ -897,7 +897,7 @@ static void wined3d_cs_exec_set_rendertarget_view(struct wined3d_cs *cs, const v
{
const struct wined3d_cs_set_rendertarget_view *op = data;
- cs->state.fb->render_targets[op->view_idx] = op->view;
+ cs->state.fb.render_targets[op->view_idx] = op->view;
device_invalidate_state(cs->device, STATE_FRAMEBUFFER);
}
return sizeof(*op);
@@ -1051,7 +1051,7 @@ static UINT wined3d_cs_exec_set_depth_stencil_view(struct wined3d_cs *cs, const
@@ -920,7 +920,7 @@ static void wined3d_cs_exec_set_depth_stencil_view(struct wined3d_cs *cs, const
struct wined3d_device *device = cs->device;
struct wined3d_rendertarget_view *prev;
@ -229,7 +229,7 @@ index c9626180db1..55c175ef093 100644
{
struct wined3d_surface *prev_surface = wined3d_rendertarget_view_get_surface(prev);
@@ -1063,7 +1063,7 @@ static UINT wined3d_cs_exec_set_depth_stencil_view(struct wined3d_cs *cs, const
@@ -932,7 +932,7 @@ static void wined3d_cs_exec_set_depth_stencil_view(struct wined3d_cs *cs, const
}
}
@ -238,8 +238,8 @@ index c9626180db1..55c175ef093 100644
if (!prev != !op->view)
{
@@ -1731,11 +1731,13 @@ void wined3d_cs_emit_set_material(struct wined3d_cs *cs, const struct wined3d_ma
static UINT wined3d_cs_exec_reset_state(struct wined3d_cs *cs, const void *data)
@@ -1561,11 +1561,13 @@ void wined3d_cs_emit_set_material(struct wined3d_cs *cs, const struct wined3d_ma
static void wined3d_cs_exec_reset_state(struct wined3d_cs *cs, const void *data)
{
struct wined3d_adapter *adapter = cs->device->adapter;
+ HRESULT hr;
@ -251,12 +251,12 @@ index c9626180db1..55c175ef093 100644
+ if (FAILED(hr = state_init(&cs->state, &adapter->gl_info, &adapter->d3d_info,
+ WINED3D_STATE_NO_REF | WINED3D_STATE_INIT_DEFAULT)))
+ ERR("Failed to initialize CS state, hr %#x.\n", hr);
return sizeof(struct wined3d_cs_reset_state);
}
@@ -2831,15 +2833,13 @@ struct wined3d_cs *wined3d_cs_create(struct wined3d_device *device)
void wined3d_cs_emit_reset_state(struct wined3d_cs *cs)
@@ -2356,15 +2358,13 @@ struct wined3d_cs *wined3d_cs_create(struct wined3d_device *device)
if (!(cs = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*cs))))
return NULL;
cs->tls_idx = TLS_OUT_OF_INDEXES;
- if (!(cs->fb.render_targets = wined3d_calloc(gl_info->limits.buffers, sizeof(*cs->fb.render_targets))))
+ if (FAILED(state_init(&cs->state, gl_info, &device->adapter->d3d_info,
@ -272,27 +272,27 @@ index c9626180db1..55c175ef093 100644
cs->ops = &wined3d_cs_st_ops;
cs->device = device;
@@ -2872,7 +2872,6 @@ struct wined3d_cs *wined3d_cs_create(struct wined3d_device *device)
err:
state_cleanup(&cs->state);
if (cs->tls_idx != TLS_OUT_OF_INDEXES) TlsFree(cs->tls_idx);
- HeapFree(GetProcessHeap(), 0, cs->fb.render_targets);
HeapFree(GetProcessHeap(), 0, cs->data);
HeapFree(GetProcessHeap(), 0, cs);
return NULL;
@@ -2901,7 +2900,6 @@ void wined3d_cs_destroy(struct wined3d_cs *cs)
@@ -2372,7 +2372,6 @@ struct wined3d_cs *wined3d_cs_create(struct wined3d_device *device)
if (!(cs->data = HeapAlloc(GetProcessHeap(), 0, cs->data_size)))
{
state_cleanup(&cs->state);
- HeapFree(GetProcessHeap(), 0, cs->fb.render_targets);
HeapFree(GetProcessHeap(), 0, cs);
return NULL;
}
TlsFree(cs->tls_idx);
@@ -2383,7 +2382,6 @@ struct wined3d_cs *wined3d_cs_create(struct wined3d_device *device)
void wined3d_cs_destroy(struct wined3d_cs *cs)
{
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 ec0f7d98ab7..3b619a37fee 100644
index 625357e4407..62abafd4125 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -958,7 +958,7 @@ static void device_init_swapchain_state(struct wined3d_device *device, struct wi
@@ -957,7 +957,7 @@ static void device_init_swapchain_state(struct wined3d_device *device, struct wi
BOOL ds_enable = !!swapchain->desc.enable_auto_depth_stencil;
unsigned int i;
@ -301,7 +301,7 @@ index ec0f7d98ab7..3b619a37fee 100644
{
for (i = 0; i < device->adapter->gl_info.limits.buffers; ++i)
{
@@ -1044,7 +1044,6 @@ HRESULT CDECL wined3d_device_init_3d(struct wined3d_device *device,
@@ -1055,7 +1055,6 @@ HRESULT CDECL wined3d_device_init_3d(struct wined3d_device *device,
struct wined3d_swapchain_desc *swapchain_desc)
{
static const struct wined3d_color black = {0.0f, 0.0f, 0.0f, 0.0f};
@ -309,25 +309,25 @@ index ec0f7d98ab7..3b619a37fee 100644
struct wined3d_swapchain *swapchain = NULL;
DWORD clear_flags = 0;
HRESULT hr;
@@ -1056,9 +1055,6 @@ HRESULT CDECL wined3d_device_init_3d(struct wined3d_device *device,
@@ -1067,9 +1066,6 @@ HRESULT CDECL wined3d_device_init_3d(struct wined3d_device *device,
if (device->wined3d->flags & WINED3D_NO3D)
return WINED3DERR_INVALIDCALL;
- if (!(device->fb.render_targets = wined3d_calloc(gl_info->limits.buffers, sizeof(*device->fb.render_targets))))
- return E_OUTOFMEMORY;
-
if (FAILED(hr = device->shader_backend->shader_alloc_private(device,
device->adapter->vertex_pipe, device->adapter->fragment_pipe)))
{
@@ -1130,7 +1126,6 @@ HRESULT CDECL wined3d_device_init_3d(struct wined3d_device *device,
return WINED3D_OK;
err_out:
/* Setup the implicit swapchain. This also initializes a context. */
TRACE("Creating implicit swapchain\n");
hr = device->device_parent->ops->create_swapchain(device->device_parent,
@@ -1136,7 +1132,6 @@ err_out:
wined3d_rendertarget_view_decref(device->back_buffer_view);
if (swapchain)
wined3d_swapchain_decref(swapchain);
- HeapFree(GetProcessHeap(), 0, device->fb.render_targets);
HeapFree(GetProcessHeap(), 0, device->swapchains);
device->swapchain_count = 0;
if (device->back_buffer_view)
@@ -1203,33 +1198,16 @@ HRESULT CDECL wined3d_device_uninit_3d(struct wined3d_device *device)
return hr;
}
@@ -1196,33 +1191,16 @@ HRESULT CDECL wined3d_device_uninit_3d(struct wined3d_device *device)
state_unbind_resources(&device->state);
@ -366,7 +366,7 @@ index ec0f7d98ab7..3b619a37fee 100644
if (device->back_buffer_view)
{
wined3d_rendertarget_view_decref(device->back_buffer_view);
@@ -1247,9 +1225,6 @@ HRESULT CDECL wined3d_device_uninit_3d(struct wined3d_device *device)
@@ -1240,9 +1218,6 @@ HRESULT CDECL wined3d_device_uninit_3d(struct wined3d_device *device)
device->swapchains = NULL;
device->swapchain_count = 0;
@ -376,7 +376,7 @@ index ec0f7d98ab7..3b619a37fee 100644
device->d3d_initialized = FALSE;
return WINED3D_OK;
@@ -2052,7 +2027,7 @@ static void resolve_depth_buffer(struct wined3d_state *state)
@@ -1950,7 +1925,7 @@ static void resolve_depth_buffer(struct wined3d_state *state)
|| !(dst_texture->resource.format_flags & WINED3DFMT_FLAG_DEPTH))
return;
@ -385,7 +385,7 @@ index ec0f7d98ab7..3b619a37fee 100644
return;
if (src_view->resource->type == WINED3D_RTYPE_BUFFER)
{
@@ -3574,6 +3549,8 @@ HRESULT CDECL wined3d_device_end_scene(struct wined3d_device *device)
@@ -3472,6 +3447,8 @@ HRESULT CDECL wined3d_device_end_scene(struct wined3d_device *device)
HRESULT CDECL wined3d_device_clear(struct wined3d_device *device, DWORD rect_count,
const RECT *rects, DWORD flags, const struct wined3d_color *color, float depth, DWORD stencil)
{
@ -394,7 +394,7 @@ index ec0f7d98ab7..3b619a37fee 100644
TRACE("device %p, rect_count %u, rects %p, flags %#x, color %s, depth %.8e, stencil %u.\n",
device, rect_count, rects, flags, debug_color(color), depth, stencil);
@@ -3585,7 +3562,7 @@ HRESULT CDECL wined3d_device_clear(struct wined3d_device *device, DWORD rect_cou
@@ -3483,7 +3460,7 @@ HRESULT CDECL wined3d_device_clear(struct wined3d_device *device, DWORD rect_cou
if (flags & (WINED3DCLEAR_ZBUFFER | WINED3DCLEAR_STENCIL))
{
@ -403,7 +403,7 @@ index ec0f7d98ab7..3b619a37fee 100644
if (!ds)
{
WARN("Clearing depth and/or stencil without a depth stencil buffer attached, returning WINED3DERR_INVALIDCALL\n");
@@ -3594,8 +3571,8 @@ HRESULT CDECL wined3d_device_clear(struct wined3d_device *device, DWORD rect_cou
@@ -3492,8 +3469,8 @@ HRESULT CDECL wined3d_device_clear(struct wined3d_device *device, DWORD rect_cou
}
else if (flags & WINED3DCLEAR_TARGET)
{
@ -414,7 +414,7 @@ index ec0f7d98ab7..3b619a37fee 100644
{
WARN("Silently ignoring depth and target clear with mismatching sizes\n");
return WINED3D_OK;
@@ -3945,8 +3922,8 @@ HRESULT CDECL wined3d_device_validate_device(const struct wined3d_device *device
@@ -3843,8 +3820,8 @@ HRESULT CDECL wined3d_device_validate_device(const struct wined3d_device *device
if (state->render_states[WINED3D_RS_ZENABLE] || state->render_states[WINED3D_RS_ZWRITEENABLE]
|| state->render_states[WINED3D_RS_STENCILENABLE])
{
@ -425,7 +425,7 @@ index ec0f7d98ab7..3b619a37fee 100644
if (ds && rt && (ds->width < rt->width || ds->height < rt->height))
{
@@ -4381,20 +4358,21 @@ struct wined3d_rendertarget_view * CDECL wined3d_device_get_rendertarget_view(co
@@ -4279,20 +4256,21 @@ struct wined3d_rendertarget_view * CDECL wined3d_device_get_rendertarget_view(co
return NULL;
}
@ -449,7 +449,7 @@ index ec0f7d98ab7..3b619a37fee 100644
TRACE("device %p, view_idx %u, view %p, set_viewport %#x.\n",
device, view_idx, view, set_viewport);
@@ -4431,13 +4409,13 @@ HRESULT CDECL wined3d_device_set_rendertarget_view(struct wined3d_device *device
@@ -4329,13 +4307,13 @@ HRESULT CDECL wined3d_device_set_rendertarget_view(struct wined3d_device *device
}
@ -465,7 +465,7 @@ index ec0f7d98ab7..3b619a37fee 100644
wined3d_cs_emit_set_rendertarget_view(device->cs, view_idx, view);
/* Release after the assignment, to prevent device_resource_released()
* from seeing the surface as still in use. */
@@ -4449,18 +4427,19 @@ HRESULT CDECL wined3d_device_set_rendertarget_view(struct wined3d_device *device
@@ -4347,18 +4325,19 @@ HRESULT CDECL wined3d_device_set_rendertarget_view(struct wined3d_device *device
void CDECL wined3d_device_set_depth_stencil_view(struct wined3d_device *device, struct wined3d_rendertarget_view *view)
{
@ -487,7 +487,7 @@ index ec0f7d98ab7..3b619a37fee 100644
wined3d_rendertarget_view_incref(view);
wined3d_cs_emit_set_depth_stencil_view(device->cs, view);
if (prev)
@@ -4726,10 +4705,9 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device,
@@ -4624,10 +4603,9 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device,
wined3d_texture_decref(device->cursor_texture);
device->cursor_texture = NULL;
}
@ -499,7 +499,7 @@ index ec0f7d98ab7..3b619a37fee 100644
{
for (i = 0; i < device->adapter->gl_info.limits.buffers; ++i)
{
@@ -4740,6 +4718,11 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device,
@@ -4638,6 +4616,11 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device,
if (reset_state)
{
@ -511,7 +511,7 @@ index ec0f7d98ab7..3b619a37fee 100644
LIST_FOR_EACH_ENTRY_SAFE(resource, cursor, &device->resources, struct wined3d_resource, resource_list_entry)
{
TRACE("Enumerating resource %p.\n", resource);
@@ -4911,27 +4894,28 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device,
@@ -4806,27 +4789,28 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device,
if (device->d3d_initialized)
wined3d_device_delete_opengl_contexts(device);
@ -547,7 +547,7 @@ index ec0f7d98ab7..3b619a37fee 100644
wined3d_cs_emit_set_scissor_rect(device->cs, &state->scissor_rect);
}
@@ -5023,11 +5007,11 @@ void device_resource_released(struct wined3d_device *device, struct wined3d_reso
@@ -4918,11 +4902,11 @@ void device_resource_released(struct wined3d_device *device, struct wined3d_reso
{
for (i = 0; i < device->adapter->gl_info.limits.buffers; ++i)
{
@ -561,7 +561,7 @@ index ec0f7d98ab7..3b619a37fee 100644
ERR("Resource %p is still in use as depth/stencil buffer.\n", resource);
}
@@ -5153,8 +5137,12 @@ HRESULT device_init(struct wined3d_device *device, struct wined3d *wined3d,
@@ -5048,8 +5032,12 @@ HRESULT device_init(struct wined3d_device *device, struct wined3d *wined3d,
device->blitter = adapter->blitter;
@ -590,7 +590,7 @@ index 48421ef545e..d8f2ad17f2e 100644
struct wined3d_event_query *ib_query = NULL;
struct wined3d_rendertarget_view *dsv, *rtv;
diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c
index de2c0006ae1..8e902aae935 100644
index 16cdd28a18d..b5d64421b42 100644
--- a/dlls/wined3d/glsl_shader.c
+++ b/dlls/wined3d/glsl_shader.c
@@ -1630,7 +1630,7 @@ static void shader_glsl_load_constants(void *shader_priv, struct wined3d_context
@ -603,10 +603,10 @@ index de2c0006ae1..8e902aae935 100644
0.0f,
0.0f,
diff --git a/dlls/wined3d/shader.c b/dlls/wined3d/shader.c
index 450e7913771..faf48a5126b 100644
index 6f012cd8953..7bb43754279 100644
--- a/dlls/wined3d/shader.c
+++ b/dlls/wined3d/shader.c
@@ -3265,7 +3265,7 @@ void find_ps_compile_args(const struct wined3d_state *state, const struct wined3
@@ -3267,7 +3267,7 @@ void find_ps_compile_args(const struct wined3d_state *state, const struct wined3
UINT i;
memset(args, 0, sizeof(*args)); /* FIXME: Make sure all bits are set. */
@ -616,7 +616,7 @@ index 450e7913771..faf48a5126b 100644
static unsigned int warned = 0;
diff --git a/dlls/wined3d/state.c b/dlls/wined3d/state.c
index d1884c8e354..985e24fb2d1 100644
index 0d6d83af7c3..dad58208c79 100644
--- a/dlls/wined3d/state.c
+++ b/dlls/wined3d/state.c
@@ -152,7 +152,7 @@ static void state_zenable(struct wined3d_context *context, const struct wined3d_
@ -720,7 +720,7 @@ index d1884c8e354..985e24fb2d1 100644
else
gl_info->gl_ops.gl.p_glDisable(GL_FRAMEBUFFER_SRGB);
diff --git a/dlls/wined3d/stateblock.c b/dlls/wined3d/stateblock.c
index 8221b99977d..3c7b4b8a664 100644
index ad347082c4d..a823ccb3168 100644
--- a/dlls/wined3d/stateblock.c
+++ b/dlls/wined3d/stateblock.c
@@ -431,6 +431,7 @@ void state_unbind_resources(struct wined3d_state *state)
@ -772,7 +772,7 @@ index 8221b99977d..3c7b4b8a664 100644
}
ULONG CDECL wined3d_stateblock_decref(struct wined3d_stateblock *stateblock)
@@ -1257,32 +1285,41 @@ static void state_init_default(struct wined3d_state *state, const struct wined3d
@@ -1317,32 +1345,41 @@ static void state_init_default(struct wined3d_state *state, const struct wined3d
}
}
@ -820,7 +820,7 @@ index 8221b99977d..3c7b4b8a664 100644
if (type == WINED3D_SBT_RECORDED)
return WINED3D_OK;
diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
index 15657ace57f..2753de76707 100644
index 33a0ecf0327..8d8142204ca 100644
--- a/dlls/wined3d/surface.c
+++ b/dlls/wined3d/surface.c
@@ -2518,7 +2518,7 @@ static HRESULT surface_blt_special(struct wined3d_surface *dst_surface, const RE
@ -855,10 +855,10 @@ index 48879bcd6a0..4b737ade91b 100644
|| !state->render_states[WINED3D_RS_CLIPPLANEENABLE])
{
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index f3116d2fb33..019dc1ddf07 100644
index 2b7b658a162..7d921011577 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -1554,6 +1554,36 @@ struct wined3d_timestamp_query
@@ -1555,6 +1555,36 @@ struct wined3d_timestamp_query
void context_alloc_timestamp_query(struct wined3d_context *context, struct wined3d_timestamp_query *query) DECLSPEC_HIDDEN;
void context_free_timestamp_query(struct wined3d_timestamp_query *query) DECLSPEC_HIDDEN;
@ -895,7 +895,7 @@ index f3116d2fb33..019dc1ddf07 100644
struct wined3d_context
{
const struct wined3d_gl_info *gl_info;
@@ -1569,6 +1599,7 @@ struct wined3d_context
@@ -1570,6 +1600,7 @@ struct wined3d_context
DWORD numDirtyEntries;
DWORD isStateDirty[STATE_HIGHEST / (sizeof(DWORD) * CHAR_BIT) + 1]; /* Bitmap to find out quickly if a state is dirty */
unsigned int dirty_compute_states[STATE_COMPUTE_COUNT / (sizeof(unsigned int) * CHAR_BIT) + 1];
@ -903,7 +903,7 @@ index f3116d2fb33..019dc1ddf07 100644
struct wined3d_device *device;
struct wined3d_swapchain *swapchain;
@@ -1682,12 +1713,6 @@ struct wined3d_context
@@ -1683,12 +1714,6 @@ struct wined3d_context
GLuint dummy_arbfp_prog;
};
@ -916,7 +916,7 @@ index f3116d2fb33..019dc1ddf07 100644
typedef void (*APPLYSTATEFUNC)(struct wined3d_context *ctx, const struct wined3d_state *state, DWORD state_id);
struct StateEntry
@@ -2511,7 +2536,7 @@ struct wined3d_stream_state
@@ -2512,7 +2537,7 @@ struct wined3d_stream_state
struct wined3d_state
{
DWORD flags;
@ -925,7 +925,7 @@ index f3116d2fb33..019dc1ddf07 100644
struct wined3d_vertex_declaration *vertex_declaration;
struct wined3d_stream_output stream_output[MAX_STREAM_OUT];
@@ -2625,7 +2650,6 @@ struct wined3d_device
@@ -2626,7 +2651,6 @@ struct wined3d_device
struct wine_rb_tree samplers;
/* Render Target Support */
@ -933,10 +933,10 @@ index f3116d2fb33..019dc1ddf07 100644
struct wined3d_rendertarget_view *auto_depth_stencil_view;
/* Cursor management */
@@ -3164,9 +3188,8 @@ struct wined3d_stateblock
void stateblock_init_contained_states(struct wined3d_stateblock *stateblock) DECLSPEC_HIDDEN;
void state_cleanup(struct wined3d_state *state) DECLSPEC_HIDDEN;
@@ -3171,9 +3195,8 @@ void wined3d_state_enable_light(struct wined3d_state *state, const struct wined3
struct wined3d_light_info *light_info, BOOL enable) DECLSPEC_HIDDEN;
struct wined3d_light_info *wined3d_state_get_light(const struct wined3d_state *state,
unsigned int idx) DECLSPEC_HIDDEN;
-void state_init(struct wined3d_state *state, struct wined3d_fb_state *fb,
- const struct wined3d_gl_info *gl_info, const struct wined3d_d3d_info *d3d_info,
- DWORD flags) DECLSPEC_HIDDEN;
@ -945,14 +945,14 @@ index f3116d2fb33..019dc1ddf07 100644
void state_unbind_resources(struct wined3d_state *state) DECLSPEC_HIDDEN;
enum wined3d_push_constants
@@ -3202,7 +3225,6 @@ struct wined3d_cs
@@ -3197,7 +3220,6 @@ struct wined3d_cs
{
const struct wined3d_cs_ops *ops;
struct wined3d_device *device;
- struct wined3d_fb_state fb;
struct wined3d_state state;
HANDLE thread;
DWORD tls_idx;
size_t data_size, start, end;
--
2.11.0

View File

@ -1,172 +0,0 @@
From 3a6b3d6e7b587578d5ad9ece67c0687b5021d5c5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20D=C3=B6singer?= <stefandoesinger@gmx.at>
Date: Sat, 7 May 2016 22:07:22 +0100
Subject: wined3d: Do the sampler GL init through the CS.
This extra parameter is barf-inducing.
---
dlls/wined3d/cs.c | 28 ++++++++++++++++++++++++++++
dlls/wined3d/sampler.c | 42 ++++++++++++++++++++----------------------
dlls/wined3d/wined3d_private.h | 3 +++
3 files changed, 51 insertions(+), 22 deletions(-)
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
index 45da73823ec..3e385ddf736 100644
--- a/dlls/wined3d/cs.c
+++ b/dlls/wined3d/cs.c
@@ -88,6 +88,7 @@ enum wined3d_cs_op
WINED3D_CS_OP_CREATE_DUMMY_TEXTURES,
WINED3D_CS_OP_CREATE_SWAPCHAIN_CONTEXT,
WINED3D_CS_OP_UPDATE_SWAP_INTERVAL,
+ WINED3D_CS_OP_SAMPLER_INIT,
WINED3D_CS_OP_STOP,
};
@@ -446,6 +447,12 @@ struct wined3d_cs_update_sub_resource
const void *data;
};
+struct wined3d_cs_sampler_init
+{
+ enum wined3d_cs_op opcode;
+ struct wined3d_sampler *sampler;
+};
+
struct wined3d_cs_get_release_dc
{
enum wined3d_cs_op opcode;
@@ -2385,6 +2392,26 @@ void wined3d_cs_emit_update_swap_interval(struct wined3d_cs *cs, struct wined3d_
cs->ops->submit_and_wait(cs);
}
+static UINT wined3d_cs_exec_sampler_init(struct wined3d_cs *cs, const void *data)
+{
+ const struct wined3d_cs_sampler_init *op = data;
+
+ wined3d_sampler_init(op->sampler);
+
+ return sizeof(*op);
+}
+
+void wined3d_cs_emit_sampler_init(struct wined3d_cs *cs, struct wined3d_sampler *sampler)
+{
+ struct wined3d_cs_sampler_init *op;
+
+ op = cs->ops->require_space(cs, sizeof(*op));
+ op->opcode = WINED3D_CS_OP_SAMPLER_INIT;
+ op->sampler = sampler;
+
+ cs->ops->submit(cs);
+}
+
static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void *data) =
{
/* WINED3D_CS_OP_FENCE */ wined3d_cs_exec_fence,
@@ -2438,6 +2465,7 @@ static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void
/* WINED3D_CS_OP_CREATE_DUMMY_TEXTURES */ wined3d_cs_exec_create_dummy_textures,
/* WINED3D_CS_OP_CREATE_SWAPCHAIN_CONTEXT */ wined3d_cs_exec_create_swapchain_context,
/* WINED3D_CS_OP_UPDATE_SWAP_INTERVAL */ wined3d_cs_exec_update_swap_interval,
+ /* WINED3D_CS_OP_SAMPLER_INIT */ wined3d_cs_exec_sampler_init,
};
static void *wined3d_cs_st_require_space(struct wined3d_cs *cs, size_t size)
diff --git a/dlls/wined3d/sampler.c b/dlls/wined3d/sampler.c
index 5902feb88fa..93730acb906 100644
--- a/dlls/wined3d/sampler.c
+++ b/dlls/wined3d/sampler.c
@@ -66,43 +66,37 @@ void * CDECL wined3d_sampler_get_parent(const struct wined3d_sampler *sampler)
return sampler->parent;
}
-static void wined3d_sampler_init(struct wined3d_sampler *sampler, struct wined3d_device *device,
- const struct wined3d_sampler_desc *desc, void *parent)
+void wined3d_sampler_init(struct wined3d_sampler *sampler)
{
const struct wined3d_gl_info *gl_info;
struct wined3d_context *context;
- sampler->refcount = 1;
- sampler->device = device;
- sampler->parent = parent;
- sampler->desc = *desc;
-
- context = context_acquire(device, NULL, 0);
+ context = context_acquire(sampler->device, NULL, 0);
gl_info = context->gl_info;
GL_EXTCALL(glGenSamplers(1, &sampler->name));
GL_EXTCALL(glSamplerParameteri(sampler->name, GL_TEXTURE_WRAP_S,
- gl_info->wrap_lookup[desc->address_u - WINED3D_TADDRESS_WRAP]));
+ gl_info->wrap_lookup[sampler->desc.address_u - WINED3D_TADDRESS_WRAP]));
GL_EXTCALL(glSamplerParameteri(sampler->name, GL_TEXTURE_WRAP_T,
- gl_info->wrap_lookup[desc->address_v - WINED3D_TADDRESS_WRAP]));
+ gl_info->wrap_lookup[sampler->desc.address_v - WINED3D_TADDRESS_WRAP]));
GL_EXTCALL(glSamplerParameteri(sampler->name, GL_TEXTURE_WRAP_R,
- gl_info->wrap_lookup[desc->address_w - WINED3D_TADDRESS_WRAP]));
- GL_EXTCALL(glSamplerParameterfv(sampler->name, GL_TEXTURE_BORDER_COLOR, &desc->border_color[0]));
+ gl_info->wrap_lookup[sampler->desc.address_w - WINED3D_TADDRESS_WRAP]));
+ GL_EXTCALL(glSamplerParameterfv(sampler->name, GL_TEXTURE_BORDER_COLOR, &sampler->desc.border_color[0]));
GL_EXTCALL(glSamplerParameteri(sampler->name, GL_TEXTURE_MAG_FILTER,
- wined3d_gl_mag_filter(desc->mag_filter)));
+ wined3d_gl_mag_filter(sampler->desc.mag_filter)));
GL_EXTCALL(glSamplerParameteri(sampler->name, GL_TEXTURE_MIN_FILTER,
- wined3d_gl_min_mip_filter(desc->min_filter, desc->mip_filter)));
- GL_EXTCALL(glSamplerParameterf(sampler->name, GL_TEXTURE_LOD_BIAS, desc->lod_bias));
- GL_EXTCALL(glSamplerParameterf(sampler->name, GL_TEXTURE_MIN_LOD, desc->min_lod));
- GL_EXTCALL(glSamplerParameterf(sampler->name, GL_TEXTURE_MAX_LOD, desc->max_lod));
+ wined3d_gl_min_mip_filter(sampler->desc.min_filter, sampler->desc.mip_filter)));
+ GL_EXTCALL(glSamplerParameterf(sampler->name, GL_TEXTURE_LOD_BIAS, sampler->desc.lod_bias));
+ GL_EXTCALL(glSamplerParameterf(sampler->name, GL_TEXTURE_MIN_LOD, sampler->desc.min_lod));
+ GL_EXTCALL(glSamplerParameterf(sampler->name, GL_TEXTURE_MAX_LOD, sampler->desc.max_lod));
if (gl_info->supported[EXT_TEXTURE_FILTER_ANISOTROPIC])
- GL_EXTCALL(glSamplerParameteri(sampler->name, GL_TEXTURE_MAX_ANISOTROPY_EXT, desc->max_anisotropy));
- if (desc->compare)
+ GL_EXTCALL(glSamplerParameteri(sampler->name, GL_TEXTURE_MAX_ANISOTROPY_EXT, sampler->desc.max_anisotropy));
+ if (sampler->desc.compare)
GL_EXTCALL(glSamplerParameteri(sampler->name, GL_TEXTURE_COMPARE_MODE, GL_COMPARE_R_TO_TEXTURE));
GL_EXTCALL(glSamplerParameteri(sampler->name, GL_TEXTURE_COMPARE_FUNC,
- wined3d_gl_compare_func(desc->comparison_func)));
+ wined3d_gl_compare_func(sampler->desc.comparison_func)));
if ((context->d3d_info->wined3d_creation_flags & WINED3D_SRGB_READ_WRITE_CONTROL)
- && gl_info->supported[EXT_TEXTURE_SRGB_DECODE] && !desc->srgb_decode)
+ && gl_info->supported[EXT_TEXTURE_SRGB_DECODE] && !sampler->desc.srgb_decode)
GL_EXTCALL(glSamplerParameteri(sampler->name, GL_TEXTURE_SRGB_DECODE_EXT, GL_SKIP_DECODE_EXT));
checkGLcall("sampler creation");
@@ -134,7 +128,11 @@ HRESULT CDECL wined3d_sampler_create(struct wined3d_device *device, const struct
if (!(object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object))))
return E_OUTOFMEMORY;
- wined3d_sampler_init(object, device, desc, parent);
+ object->refcount = 1;
+ object->device = device;
+ object->parent = parent;
+ object->desc = *desc;
+ wined3d_cs_emit_sampler_init(device->cs, object);
TRACE("Created sampler %p.\n", object);
*sampler = object;
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 6447643b87f..bf43ba4f8d9 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -3016,6 +3016,8 @@ struct wined3d_sampler
GLuint name;
};
+void wined3d_sampler_init(struct wined3d_sampler *sampler) DECLSPEC_HIDDEN;
+
struct wined3d_vertex_declaration_element
{
const struct wined3d_format *format;
@@ -3203,6 +3205,7 @@ HRESULT wined3d_cs_emit_release_dc(struct wined3d_cs *cs, struct wined3d_texture
unsigned int sub_resource_idx) 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_sampler_init(struct wined3d_cs *cs, struct wined3d_sampler *sampler) DECLSPEC_HIDDEN;
void wined3d_cs_emit_set_clip_plane(struct wined3d_cs *cs, UINT plane_idx,
const struct wined3d_vec4 *plane) DECLSPEC_HIDDEN;
void wined3d_cs_emit_set_color_key(struct wined3d_cs *cs, struct wined3d_texture *texture,
--
2.11.0

View File

@ -1,4 +1,4 @@
From 2280d5ed73ea601728cbf19c60a857ef9f37f4ae Mon Sep 17 00:00:00 2001
From fabdd4237545714b754ab6ddce9fcbca433d5876 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20D=C3=B6singer?= <stefandoesinger@gmx.at>
Date: Thu, 7 Apr 2016 19:51:54 +0100
Subject: wined3d: Don't access device state in clears.
@ -10,10 +10,10 @@ Subject: wined3d: Don't access device state in clears.
3 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c
index 82804d7b09b..dc2b0fbbacb 100644
index bb65538ad7b..adffe0127bc 100644
--- a/dlls/wined3d/context.c
+++ b/dlls/wined3d/context.c
@@ -2637,7 +2637,7 @@ static BOOL context_validate_rt_config(UINT rt_count, struct wined3d_rendertarge
@@ -2635,7 +2635,7 @@ static BOOL context_validate_rt_config(UINT rt_count, struct wined3d_rendertarge
}
/* Context activation is done by the caller. */
@ -22,7 +22,7 @@ index 82804d7b09b..dc2b0fbbacb 100644
UINT rt_count, const struct wined3d_fb_state *fb)
{
struct wined3d_rendertarget_view **rts = fb->render_targets;
@@ -2646,7 +2646,7 @@ BOOL context_apply_clear_state(struct wined3d_context *context, const struct win
@@ -2644,7 +2644,7 @@ BOOL context_apply_clear_state(struct wined3d_context *context, const struct win
DWORD rt_mask = 0, *cur_mask;
UINT i;
@ -31,7 +31,7 @@ index 82804d7b09b..dc2b0fbbacb 100644
|| rt_count != gl_info->limits.buffers)
{
if (!context_validate_rt_config(rt_count, rts, dsv))
@@ -2732,7 +2732,8 @@ BOOL context_apply_clear_state(struct wined3d_context *context, const struct win
@@ -2730,7 +2730,8 @@ BOOL context_apply_clear_state(struct wined3d_context *context, const struct win
gl_info->gl_ops.gl.p_glEnable(GL_SCISSOR_TEST);
if (rt_count && gl_info->supported[ARB_FRAMEBUFFER_SRGB])
{
@ -42,7 +42,7 @@ index 82804d7b09b..dc2b0fbbacb 100644
else
gl_info->gl_ops.gl.p_glDisable(GL_FRAMEBUFFER_SRGB);
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index 6e469b21014..3f5fd7988d4 100644
index 62abafd4125..32d25cd1d0f 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -223,7 +223,6 @@ void device_clear_render_targets(struct wined3d_device *device, UINT rt_count, c
@ -53,7 +53,7 @@ index 6e469b21014..3f5fd7988d4 100644
const struct wined3d_gl_info *gl_info;
UINT drawable_width, drawable_height;
struct wined3d_color corrected_color;
@@ -290,7 +289,7 @@ void device_clear_render_targets(struct wined3d_device *device, UINT rt_count, c
@@ -293,7 +292,7 @@ void device_clear_render_targets(struct wined3d_device *device, UINT rt_count, c
dsv->sub_resource_idx, context, location);
}
@ -62,7 +62,7 @@ index 6e469b21014..3f5fd7988d4 100644
{
context_release(context);
WARN("Failed to apply clear state, skipping clear.\n");
@@ -347,7 +346,7 @@ void device_clear_render_targets(struct wined3d_device *device, UINT rt_count, c
@@ -350,7 +349,7 @@ void device_clear_render_targets(struct wined3d_device *device, UINT rt_count, c
wined3d_texture_invalidate_location(texture, rtv->sub_resource_idx, ~rtv->resource->draw_binding);
}
@ -72,10 +72,10 @@ index 6e469b21014..3f5fd7988d4 100644
if (rt_count > 1)
WARN("Clearing multiple sRGB render targets with no GL_ARB_framebuffer_sRGB "
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 3b4cff500ab..7d361b2c7aa 100644
index 7d921011577..7ad99bca086 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -1850,7 +1850,7 @@ void context_alloc_event_query(struct wined3d_context *context,
@@ -1852,7 +1852,7 @@ void context_alloc_event_query(struct wined3d_context *context,
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;

View File

@ -1,4 +1,4 @@
From 84b38ba7ad883b284978cd76842fe04084012394 Mon Sep 17 00:00:00 2001
From 87fa7de2951f6de25293783ffe157f29cf18c1d7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20D=C3=B6singer?= <stefandoesinger@gmx.at>
Date: Thu, 7 Apr 2016 20:04:17 +0100
Subject: wined3d: Avoid destroying views in color and depth fills.
@ -8,10 +8,10 @@ Subject: wined3d: Avoid destroying views in color and depth fills.
1 file changed, 22 insertions(+), 32 deletions(-)
diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
index 5ad5e003c20..ac371a0fb35 100644
index 8d8142204ca..cc70506d803 100644
--- a/dlls/wined3d/surface.c
+++ b/dlls/wined3d/surface.c
@@ -675,8 +675,7 @@ static HRESULT wined3d_surface_depth_fill(struct wined3d_surface *surface, const
@@ -676,8 +676,7 @@ static HRESULT wined3d_surface_depth_fill(struct wined3d_surface *surface, const
{
struct wined3d_resource *resource = &surface->container->resource;
struct wined3d_device *device = resource->device;
@ -21,7 +21,7 @@ index 5ad5e003c20..ac371a0fb35 100644
const struct blit_shader *blitter;
HRESULT hr;
@@ -687,21 +686,17 @@ static HRESULT wined3d_surface_depth_fill(struct wined3d_surface *surface, const
@@ -688,21 +687,17 @@ static HRESULT wined3d_surface_depth_fill(struct wined3d_surface *surface, const
return WINED3DERR_INVALIDCALL;
}
@ -53,7 +53,7 @@ index 5ad5e003c20..ac371a0fb35 100644
return hr;
}
@@ -2476,8 +2471,7 @@ HRESULT surface_color_fill(struct wined3d_surface *s, const RECT *rect, const st
@@ -2481,8 +2476,7 @@ HRESULT surface_color_fill(struct wined3d_surface *s, const RECT *rect, const st
{
struct wined3d_resource *resource = &s->container->resource;
struct wined3d_device *device = resource->device;
@ -63,7 +63,7 @@ index 5ad5e003c20..ac371a0fb35 100644
const struct blit_shader *blitter;
HRESULT hr;
@@ -2488,21 +2482,17 @@ HRESULT surface_color_fill(struct wined3d_surface *s, const RECT *rect, const st
@@ -2493,21 +2487,17 @@ HRESULT surface_color_fill(struct wined3d_surface *s, const RECT *rect, const st
return WINED3DERR_INVALIDCALL;
}

View File

@ -1,32 +1,18 @@
From f468574b8d79c9c7ebe33ff29d7d73f26731aa1a Mon Sep 17 00:00:00 2001
From 31a69723040b5337806a75dc3b9706da2e4dbe08 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20D=C3=B6singer?= <stefan@codeweavers.com>
Date: Tue, 7 Feb 2017 15:44:57 +0100
Subject: wined3d: Run the cs asynchronously
Date: Sun, 19 Feb 2017 05:10:26 +0100
Subject: wined3d: Add a separate variable to check if queries are started.
---
dlls/wined3d/cs.c | 2 +-
dlls/wined3d/query.c | 6 ++++--
dlls/wined3d/wined3d_private.h | 1 +
3 files changed, 6 insertions(+), 3 deletions(-)
2 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
index 1809f3f3484..36b07d1a54a 100644
--- a/dlls/wined3d/cs.c
+++ b/dlls/wined3d/cs.c
@@ -2762,7 +2762,7 @@ static void wined3d_cs_mt_submit_and_wait(struct wined3d_cs *cs)
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,
};
diff --git a/dlls/wined3d/query.c b/dlls/wined3d/query.c
index abb4a664c1a..b26350ff2b5 100644
index 15935ab4469..70603367894 100644
--- a/dlls/wined3d/query.c
+++ b/dlls/wined3d/query.c
@@ -500,7 +500,7 @@ static void wined3d_occlusion_query_ops_issue(struct wined3d_query *query, DWORD
@@ -504,7 +504,7 @@ static void wined3d_occlusion_query_ops_issue(struct wined3d_query *query, DWORD
* restart. */
if (flags & WINED3DISSUE_BEGIN)
{
@ -35,7 +21,7 @@ index abb4a664c1a..b26350ff2b5 100644
{
if (oq->context->tid != GetCurrentThreadId())
{
@@ -530,13 +530,14 @@ static void wined3d_occlusion_query_ops_issue(struct wined3d_query *query, DWORD
@@ -535,13 +535,14 @@ static void wined3d_occlusion_query_ops_issue(struct wined3d_query *query, DWORD
checkGLcall("glBeginQuery()");
context_release(context);
@ -51,7 +37,7 @@ index abb4a664c1a..b26350ff2b5 100644
{
if (oq->context->tid != GetCurrentThreadId())
{
@@ -552,6 +553,7 @@ static void wined3d_occlusion_query_ops_issue(struct wined3d_query *query, DWORD
@@ -558,6 +559,7 @@ static void wined3d_occlusion_query_ops_issue(struct wined3d_query *query, DWORD
context_release(context);
}
}
@ -60,10 +46,10 @@ index abb4a664c1a..b26350ff2b5 100644
}
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index c7c212f294f..7035d537604 100644
index 7ad99bca086..9fa4d00c24f 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -1501,6 +1501,7 @@ struct wined3d_occlusion_query
@@ -1540,6 +1540,7 @@ struct wined3d_occlusion_query
GLuint id;
struct wined3d_context *context;
UINT64 samples;

View File

@ -1,26 +0,0 @@
From f302ec8c029b6abe1a925ce42707bdf1662a2102 Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Tue, 17 May 2016 12:49:00 +0200
Subject: wined3d: Do not query available GPU memory on main thread when CSMT
is enabled.
---
dlls/wined3d/device.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index 19cdc8d1824..50ae4a928fc 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -1257,7 +1257,7 @@ UINT CDECL wined3d_device_get_available_texture_mem(const struct wined3d_device
/* We can not acquire the context unless there is a swapchain. */
if (device->swapchains && gl_info->supported[NVX_GPU_MEMORY_INFO] &&
- !wined3d_settings.emulated_textureram)
+ !wined3d_settings.emulated_textureram && !wined3d_settings.cs_multithreaded)
{
GLint vram_free_kb;
UINT64 vram_free;
--
2.11.0

View File

@ -1,28 +1,28 @@
From 4f06f7af54f1be5fee2c40c9a8d79d6f3d393a4e Mon Sep 17 00:00:00 2001
From 24eb775d29ee3563667d35b3319dddcb7830eddf Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Tue, 7 Feb 2017 22:37:58 +0100
Subject: wined3d: Map vertex buffers through cs.
---
dlls/wined3d/cs.c | 73 ++++++++++++++++++++++++++++++++++++++++++
dlls/wined3d/cs.c | 71 ++++++++++++++++++++++++++++++++++++++++++
dlls/wined3d/device.c | 45 +-------------------------
dlls/wined3d/wined3d_private.h | 2 ++
3 files changed, 76 insertions(+), 44 deletions(-)
3 files changed, 74 insertions(+), 44 deletions(-)
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
index c71019b06bf..bd1ea2594b6 100644
index 54b81f74f64..b5c7432fec3 100644
--- a/dlls/wined3d/cs.c
+++ b/dlls/wined3d/cs.c
@@ -94,6 +94,7 @@ enum wined3d_cs_op
WINED3D_CS_OP_CREATE_BUFFER_VIEW,
WINED3D_CS_OP_CREATE_TEXTURE_VIEW,
WINED3D_CS_OP_DELETE_GL_CONTEXTS,
+ WINED3D_CS_OP_MAP_vertex_buffers,
WINED3D_CS_OP_STOP,
@@ -78,6 +78,7 @@ enum wined3d_cs_op
WINED3D_CS_OP_UPDATE_SWAP_INTERVAL,
WINED3D_CS_OP_TEXTURE_ADD_DIRTY_REGION,
WINED3D_CS_OP_BUFFER_COPY,
+ WINED3D_CS_OP_MAP_VERTEX_BUFFERS,
};
@@ -527,6 +528,13 @@ struct wined3d_cs_delete_gl_contexts
enum wined3d_cs_op opcode;
struct wined3d_cs_sync
@@ -468,6 +469,13 @@ struct wined3d_cs_buffer_copy
unsigned int size;
};
+struct wined3d_cs_map_vertex_buffers
@ -32,14 +32,14 @@ index c71019b06bf..bd1ea2594b6 100644
+ struct wined3d_stream_info *stream_info;
+};
+
static inline BOOL wined3d_cs_process_block(struct wined3d_cs *cs, struct wined3d_cs_block *block);
static void wined3d_cs_mt_submit(struct wined3d_cs *cs);
@@ -2653,6 +2661,70 @@ void wined3d_cs_emit_delete_opengl_contexts(struct wined3d_cs *cs)
cs->ops->submit_and_wait(cs);
static void wined3d_cs_exec_sync(struct wined3d_cs *cs, const void *data)
{
}
@@ -2243,6 +2251,68 @@ void wined3d_cs_emit_buffer_copy(struct wined3d_cs *cs, struct wined3d_buffer *d
cs->ops->submit(cs);
}
+static UINT wined3d_cs_exec_map_vertex_buffers(struct wined3d_cs *cs, const void *data)
+static void wined3d_cs_exec_map_vertex_buffers(struct wined3d_cs *cs, const void *data)
+{
+ const struct wined3d_cs_map_vertex_buffers *op = data;
+ struct wined3d_state *state = &cs->device->state;
@ -86,8 +86,6 @@ index c71019b06bf..bd1ea2594b6 100644
+ }
+
+ context_release(context);
+
+ return sizeof(*op);
+}
+
+void wined3d_cs_emit_map_vertex_buffers(struct wined3d_cs *cs, UINT src_start_idx,
@ -96,29 +94,29 @@ index c71019b06bf..bd1ea2594b6 100644
+ struct wined3d_cs_map_vertex_buffers *op;
+
+ op = cs->ops->require_space(cs, sizeof(*op));
+ op->opcode = WINED3D_CS_OP_MAP_vertex_buffers;
+ op->opcode = WINED3D_CS_OP_MAP_VERTEX_BUFFERS;
+ op->src_start_idx = src_start_idx;
+ op->stream_info = stream_info;
+
+ cs->ops->submit_and_wait(cs);
+}
+
static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void *data) =
static void (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void *data) =
{
/* WINED3D_CS_OP_FENCE */ wined3d_cs_exec_fence,
@@ -2712,6 +2784,7 @@ static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void
/* WINED3D_CS_OP_CREATE_BUFFER_VIEW */ wined3d_cs_exec_create_buffer_view,
/* WINED3D_CS_OP_CREATE_TEXTURE_VIEW */ wined3d_cs_exec_create_texture_view,
/* WINED3D_CS_OP_DELETE_GL_CONTEXTS */ wined3d_cs_exec_delete_gl_contexts,
+ /* WINED3D_CS_OP_MAP_vertex_buffers */ wined3d_cs_exec_map_vertex_buffers,
/* WINED3D_CS_OP_SYNC */ wined3d_cs_exec_sync,
@@ -2297,6 +2367,7 @@ static void (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void
/* WINED3D_CS_OP_UPDATE_SWAP_INTERVAL */ wined3d_cs_exec_update_swap_interval,
/* WINED3D_CS_OP_TEXTURE_ADD_DIRTY_REGION */ wined3d_cs_exec_texture_add_dirty_region,
/* WINED3D_CS_OP_BUFFER_COPY */ wined3d_cs_exec_buffer_copy,
+ /* WINED3D_CS_OP_MAP_VERTEX_BUFFERS */ wined3d_cs_exec_map_vertex_buffers,
};
static void *wined3d_cs_st_require_space(struct wined3d_cs *cs, size_t size)
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index 9752912b1b0..5ef2886df06 100644
index 32d25cd1d0f..cd0ffbe32f7 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -2916,7 +2916,6 @@ void CDECL wined3d_device_set_unordered_access_view(struct wined3d_device *devic
@@ -2811,7 +2811,6 @@ void CDECL wined3d_device_set_unordered_access_view(struct wined3d_device *devic
wined3d_device_set_pipeline_unordered_access_view(device, WINED3D_PIPELINE_GRAPHICS, idx, uav);
}
@ -126,7 +124,7 @@ index 9752912b1b0..5ef2886df06 100644
#define copy_and_next(dest, src, size) memcpy(dest, src, size); dest += (size)
static HRESULT process_vertices_strided(const struct wined3d_device *device, DWORD dwDestIndex, DWORD dwCount,
const struct wined3d_stream_info *stream_info, struct wined3d_buffer *dest, DWORD flags,
@@ -3192,14 +3191,8 @@ HRESULT CDECL wined3d_device_process_vertices(struct wined3d_device *device,
@@ -3087,14 +3086,8 @@ HRESULT CDECL wined3d_device_process_vertices(struct wined3d_device *device,
UINT src_start_idx, UINT dst_idx, UINT vertex_count, struct wined3d_buffer *dst_buffer,
const struct wined3d_vertex_declaration *declaration, DWORD flags, DWORD dst_fvf)
{
@ -141,7 +139,7 @@ index 9752912b1b0..5ef2886df06 100644
TRACE("device %p, src_start_idx %u, dst_idx %u, vertex_count %u, "
"dst_buffer %p, declaration %p, flags %#x, dst_fvf %#x.\n",
@@ -3209,47 +3202,11 @@ HRESULT CDECL wined3d_device_process_vertices(struct wined3d_device *device,
@@ -3104,47 +3097,11 @@ HRESULT CDECL wined3d_device_process_vertices(struct wined3d_device *device,
if (declaration)
FIXME("Output vertex declaration not implemented yet.\n");
@ -191,10 +189,10 @@ index 9752912b1b0..5ef2886df06 100644
}
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 6d8495f1993..aa54fc3a3e6 100644
index 9fa4d00c24f..38693a52b29 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -3354,6 +3354,8 @@ HRESULT wined3d_cs_map(struct wined3d_cs *cs, struct wined3d_resource *resource,
@@ -3328,6 +3328,8 @@ HRESULT wined3d_cs_map(struct wined3d_cs *cs, struct wined3d_resource *resource,
struct wined3d_map_desc *map_desc, const struct wined3d_box *box, unsigned int flags) DECLSPEC_HIDDEN;
HRESULT wined3d_cs_unmap(struct wined3d_cs *cs, struct wined3d_resource *resource,
unsigned int sub_resource_idx) DECLSPEC_HIDDEN;

View File

@ -1,22 +1,21 @@
From ff5e660a852ffa512b61f5bf3f8755376fec0370 Mon Sep 17 00:00:00 2001
From 35fd800789c10045216d6649ce568264f0cf68da Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20D=C3=B6singer?= <stefan@codeweavers.com>
Date: Wed, 10 Apr 2013 20:09:55 +0200
Subject: wined3d: Wait for the cs to finish before destroying the device
---
dlls/wined3d/device.c | 3 +++
1 file changed, 3 insertions(+)
dlls/wined3d/device.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index b1ecc73f9f3..a410e7e2be5 100644
index cd0ffbe32f7..61c862de138 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -1192,6 +1192,9 @@ HRESULT CDECL wined3d_device_uninit_3d(struct wined3d_device *device)
@@ -1183,6 +1183,8 @@ HRESULT CDECL wined3d_device_uninit_3d(struct wined3d_device *device)
if (!device->d3d_initialized)
return WINED3DERR_INVALIDCALL;
+ if (wined3d_settings.cs_multithreaded)
+ device->cs->ops->submit_and_wait(device->cs);
+ wined3d_cs_emit_sync(device->cs);
+
if (device->logo_texture)
wined3d_texture_decref(device->logo_texture);

View File

@ -1,29 +1,28 @@
From 1ca114c40f00162c717395c136fad2e3d1e811ac Mon Sep 17 00:00:00 2001
From 994f9e8861db01f02f2dc8724a27ee0e7eea5100 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20D=C3=B6singer?= <stefan@codeweavers.com>
Date: Thu, 5 Nov 2015 17:46:50 +0100
Subject: wined3d: Add swapchain waits.
---
dlls/wined3d/swapchain.c | 9 +++++++++
1 file changed, 9 insertions(+)
dlls/wined3d/swapchain.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/dlls/wined3d/swapchain.c b/dlls/wined3d/swapchain.c
index a176300dd5e..a54bcb41319 100644
index 592cbd96db4..1566d21a944 100644
--- a/dlls/wined3d/swapchain.c
+++ b/dlls/wined3d/swapchain.c
@@ -112,6 +112,11 @@ ULONG CDECL wined3d_swapchain_decref(struct wined3d_swapchain *swapchain)
@@ -112,6 +112,10 @@ ULONG CDECL wined3d_swapchain_decref(struct wined3d_swapchain *swapchain)
if (!refcount)
{
+ struct wined3d_device *device = swapchain->device;
+
+ if (wined3d_settings.cs_multithreaded)
+ device->cs->ops->submit_and_wait(device->cs);
+ wined3d_cs_emit_sync(device->cs);
+
swapchain_cleanup(swapchain);
swapchain->parent_ops->wined3d_object_destroyed(swapchain->parent);
HeapFree(GetProcessHeap(), 0, swapchain);
@@ -1298,6 +1303,7 @@ HRESULT CDECL wined3d_swapchain_resize_buffers(struct wined3d_swapchain *swapcha
@@ -1307,6 +1311,7 @@ HRESULT CDECL wined3d_swapchain_resize_buffers(struct wined3d_swapchain *swapcha
enum wined3d_multisample_type multisample_type, unsigned int multisample_quality)
{
BOOL update_desc = FALSE;
@ -31,12 +30,11 @@ index a176300dd5e..a54bcb41319 100644
TRACE("swapchain %p, buffer_count %u, width %u, height %u, format %s, "
"multisample_type %#x, multisample_quality %#x.\n",
@@ -1309,6 +1315,9 @@ HRESULT CDECL wined3d_swapchain_resize_buffers(struct wined3d_swapchain *swapcha
@@ -1318,6 +1323,8 @@ HRESULT CDECL wined3d_swapchain_resize_buffers(struct wined3d_swapchain *swapcha
if (buffer_count && buffer_count != swapchain->desc.backbuffer_count)
FIXME("Cannot change the back buffer count yet.\n");
+ if (wined3d_settings.cs_multithreaded)
+ device->cs->ops->submit_and_wait(device->cs);
+ wined3d_cs_emit_sync(device->cs);
+
if (!width || !height)
{

View File

@ -1,101 +0,0 @@
From f1ae6d0fecbb0b7da36e929c5a960a574b6044d5 Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Tue, 7 Feb 2017 14:01:52 +0100
Subject: wined3d: Send buffer update subresource requests through CS.
---
dlls/d3d10core/tests/device.c | 2 ++
dlls/d3d11/tests/d3d11.c | 2 ++
dlls/wined3d/cs.c | 11 +++++++++++
dlls/wined3d/device.c | 7 +------
4 files changed, 16 insertions(+), 6 deletions(-)
diff --git a/dlls/d3d10core/tests/device.c b/dlls/d3d10core/tests/device.c
index 8cb90b796b8..f918aaf41d7 100644
--- a/dlls/d3d10core/tests/device.c
+++ b/dlls/d3d10core/tests/device.c
@@ -7759,6 +7759,7 @@ float4 main(const ps_in v) : SV_TARGET
ID3D10Device_Draw(device, 4, 0);
color = get_texture_color(test_context.backbuffer, 319, 239);
+ todo_wine_if(test_data[i].index == 1)
ok(compare_color(color, test_data[i].expected, 1),
"Got unexpected color 0x%08x for index %d.\n", color, test_data[i].index);
}
@@ -9928,6 +9929,7 @@ static void test_line_antialiasing_blending(void)
ID3D10Device_ClearRenderTargetView(device, test_context.backbuffer_rtv, &green.x);
draw_color_quad(&test_context, &red);
+ todo_wine
check_texture_color(test_context.backbuffer, 0xe2007fcc, 1);
ID3D10Device_OMSetBlendState(device, NULL, NULL, D3D10_DEFAULT_SAMPLE_MASK);
diff --git a/dlls/d3d11/tests/d3d11.c b/dlls/d3d11/tests/d3d11.c
index e477f220817..ad78cb92c12 100644
--- a/dlls/d3d11/tests/d3d11.c
+++ b/dlls/d3d11/tests/d3d11.c
@@ -9709,6 +9709,7 @@ float4 main(const ps_in v) : SV_TARGET
ID3D11DeviceContext_UpdateSubresource(context, (ID3D11Resource *)index_cb, 0, NULL, &index, 0, 0);
draw_quad(&test_context);
+ todo_wine_if(test_data[i].index == 1)
check_texture_color(test_context.backbuffer, test_data[i].expected, 1);
}
@@ -11960,6 +11961,7 @@ static void test_line_antialiasing_blending(void)
ID3D11DeviceContext_ClearRenderTargetView(context, test_context.backbuffer_rtv, &green.x);
draw_color_quad(&test_context, &red);
+ todo_wine
check_texture_color(test_context.backbuffer, 0xe2007fcc, 1);
ID3D11DeviceContext_OMSetBlendState(context, NULL, NULL, D3D11_DEFAULT_SAMPLE_MASK);
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
index f030ff0a0d5..cb7ebaab416 100644
--- a/dlls/wined3d/cs.c
+++ b/dlls/wined3d/cs.c
@@ -2265,6 +2265,17 @@ static UINT wined3d_cs_exec_update_sub_resource(struct wined3d_cs *cs, const voi
struct wined3d_texture *texture;
unsigned int width, height, depth, level;
+ if (op->resource->type == WINED3D_RTYPE_BUFFER)
+ {
+ struct wined3d_buffer *buffer = buffer_from_resource(op->resource);
+ HRESULT hr;
+
+ if (FAILED(hr = wined3d_buffer_upload_data(buffer, op->box, op->data)))
+ WARN("Failed to update buffer data, hr %#x.\n", hr);
+
+ return sizeof(*op);
+ }
+
texture = wined3d_texture_from_resource(op->resource);
level = op->sub_resource_idx % texture->level_count;
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index 28b77725e4c..52c759426bf 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -4243,18 +4243,13 @@ void CDECL wined3d_device_update_sub_resource(struct wined3d_device *device, str
if (resource->type == WINED3D_RTYPE_BUFFER)
{
- struct wined3d_buffer *buffer = buffer_from_resource(resource);
- HRESULT hr;
-
if (sub_resource_idx > 0)
{
WARN("Invalid sub_resource_idx %u.\n", sub_resource_idx);
return;
}
- if (FAILED(hr = wined3d_buffer_upload_data(buffer, box, data)))
- WARN("Failed to update buffer data, hr %#x.\n", hr);
-
+ wined3d_cs_emit_update_sub_resource(device->cs, resource, sub_resource_idx, box, data, row_pitch, depth_pitch);
return;
}
--
2.11.0

View File

@ -0,0 +1,34 @@
From 13fe67e10d483f6fe5047f693949bdf6560758ed 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(-)
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
index c8394533a86..a656c93684a 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;
}
-/* 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 =
{
wined3d_cs_mt_require_space,
- wined3d_cs_mt_submit_and_wait, /* FIXME */
+ wined3d_cs_mt_submit,
wined3d_cs_mt_submit_and_wait,
};
--
2.11.0

View File

@ -1,239 +0,0 @@
From f7b258f07407779e76637835505a3c59b8466d8d Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Tue, 7 Feb 2017 15:02:44 +0100
Subject: wined3d: Send create_buffer_texture / create_texture_view through the
CS.
---
dlls/wined3d/cs.c | 81 +++++++++++++++++++++++++++++++++++++++++-
dlls/wined3d/view.c | 15 ++++----
dlls/wined3d/wined3d_private.h | 15 ++++++++
3 files changed, 103 insertions(+), 8 deletions(-)
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
index 5ecf15f5a01..9227a9c497c 100644
--- a/dlls/wined3d/cs.c
+++ b/dlls/wined3d/cs.c
@@ -91,6 +91,8 @@ enum wined3d_cs_op
WINED3D_CS_OP_SAMPLER_INIT,
WINED3D_CS_OP_TEXTURE_ADD_DIRTY_REGION,
WINED3D_CS_OP_BUFFER_COPY,
+ WINED3D_CS_OP_CREATE_BUFFER_VIEW,
+ WINED3D_CS_OP_CREATE_TEXTURE_VIEW,
WINED3D_CS_OP_STOP,
};
@@ -499,6 +501,26 @@ struct wined3d_cs_buffer_copy
unsigned int size;
};
+struct wined3d_cs_create_buffer_view
+{
+ enum wined3d_cs_op opcode;
+ struct wined3d_gl_view *view;
+ const struct wined3d_view_desc *desc;
+ struct wined3d_buffer *buffer;
+ const struct wined3d_format *view_format;
+ HRESULT *hr;
+};
+
+struct wined3d_cs_create_texture_view
+{
+ enum wined3d_cs_op opcode;
+ struct wined3d_gl_view *view;
+ GLenum view_target;
+ const struct wined3d_view_desc *desc;
+ struct wined3d_texture *texture;
+ const struct wined3d_format *view_format;
+};
+
static inline BOOL wined3d_cs_process_block(struct wined3d_cs *cs, struct wined3d_cs_block *block);
static void wined3d_cs_mt_submit(struct wined3d_cs *cs);
@@ -2515,7 +2537,6 @@ void wined3d_cs_emit_texture_add_dirty_region(struct wined3d_cs *cs,
cs->ops->submit(cs);
}
-
static UINT wined3d_cs_exec_buffer_copy(struct wined3d_cs *cs, const void *data)
{
const struct wined3d_cs_buffer_copy *op = data;
@@ -2550,6 +2571,61 @@ void wined3d_cs_emit_buffer_copy(struct wined3d_cs *cs, struct wined3d_buffer *d
cs->ops->submit(cs);
}
+static UINT wined3d_cs_exec_create_buffer_view(struct wined3d_cs *cs, const void *data)
+{
+ const struct wined3d_cs_create_buffer_view *op = data;
+
+ *op->hr = create_buffer_view(op->view, op->desc, op->buffer, op->view_format);
+
+ return sizeof(*op);
+}
+
+HRESULT wined3d_cs_emit_create_buffer_view(struct wined3d_cs *cs, struct wined3d_gl_view *view,
+ const struct wined3d_view_desc *desc, struct wined3d_buffer *buffer,
+ const struct wined3d_format *view_format)
+{
+ struct wined3d_cs_create_buffer_view *op;
+ HRESULT hr;
+
+ op = cs->ops->require_space(cs, sizeof(*op));
+ op->opcode = WINED3D_CS_OP_CREATE_BUFFER_VIEW;
+ op->view = view;
+ op->desc = desc;
+ op->buffer = buffer;
+ op->view_format = view_format;
+ op->hr = &hr;
+
+ cs->ops->submit_and_wait(cs);
+
+ return hr;
+}
+
+static UINT wined3d_cs_exec_create_texture_view(struct wined3d_cs *cs, const void *data)
+{
+ const struct wined3d_cs_create_texture_view *op = data;
+
+ create_texture_view(op->view, op->view_target, op->desc, op->texture, op->view_format);
+
+ return sizeof(*op);
+}
+
+void wined3d_cs_emit_create_texture_view(struct wined3d_cs *cs, struct wined3d_gl_view *view,
+ GLenum view_target, const struct wined3d_view_desc *desc, struct wined3d_texture *texture,
+ const struct wined3d_format *view_format)
+{
+ struct wined3d_cs_create_texture_view *op;
+
+ op = cs->ops->require_space(cs, sizeof(*op));
+ op->opcode = WINED3D_CS_OP_CREATE_TEXTURE_VIEW;
+ op->view = view;
+ op->view_target = view_target;
+ op->desc = desc;
+ op->texture = texture;
+ op->view_format = view_format;
+
+ cs->ops->submit_and_wait(cs);
+}
+
static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void *data) =
{
/* WINED3D_CS_OP_FENCE */ wined3d_cs_exec_fence,
@@ -2606,6 +2682,9 @@ static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void
/* WINED3D_CS_OP_SAMPLER_INIT */ wined3d_cs_exec_sampler_init,
/* WINED3D_CS_OP_TEXTURE_ADD_DIRTY_REGION */ wined3d_cs_exec_texture_add_dirty_region,
/* WINED3D_CS_OP_BUFFER_COPY */ wined3d_cs_exec_buffer_copy,
+ /* WINED3D_CS_OP_CREATE_BUFFER_VIEW */ wined3d_cs_exec_create_buffer_view,
+ /* WINED3D_CS_OP_CREATE_TEXTURE_VIEW */ wined3d_cs_exec_create_texture_view,
+
};
static void *wined3d_cs_st_require_space(struct wined3d_cs *cs, size_t size)
diff --git a/dlls/wined3d/view.c b/dlls/wined3d/view.c
index dd87f73b339..e62288f7b78 100644
--- a/dlls/wined3d/view.c
+++ b/dlls/wined3d/view.c
@@ -72,7 +72,7 @@ static GLenum get_texture_view_target(const struct wined3d_gl_info *gl_info,
return texture->target;
}
-static void create_texture_view(struct wined3d_gl_view *view, GLenum view_target,
+void create_texture_view(struct wined3d_gl_view *view, GLenum view_target,
const struct wined3d_view_desc *desc, struct wined3d_texture *texture,
const struct wined3d_format *view_format)
{
@@ -181,7 +181,7 @@ static void create_buffer_texture(struct wined3d_gl_view *view,
context_release(context);
}
-static HRESULT create_buffer_view(struct wined3d_gl_view *view,
+HRESULT create_buffer_view(struct wined3d_gl_view *view,
const struct wined3d_view_desc *desc, struct wined3d_buffer *buffer,
const struct wined3d_format *view_format)
{
@@ -515,7 +515,7 @@ static HRESULT wined3d_shader_resource_view_init(struct wined3d_shader_resource_
struct wined3d_buffer *buffer = buffer_from_resource(resource);
HRESULT hr;
- if (FAILED(hr = create_buffer_view(&view->gl_view, desc, buffer, view_format)))
+ if (FAILED(hr = wined3d_cs_emit_create_buffer_view(resource->device->cs, &view->gl_view, desc, buffer, view_format)))
return hr;
}
else
@@ -546,7 +546,8 @@ static HRESULT wined3d_shader_resource_view_init(struct wined3d_shader_resource_
else if (resource->format->typeless_id == view_format->typeless_id
&& resource->format->gl_view_class == view_format->gl_view_class)
{
- create_texture_view(&view->gl_view, view_target, desc, texture, view_format);
+ wined3d_cs_emit_create_texture_view(resource->device->cs, &view->gl_view, view_target,
+ desc, texture, view_format);
}
else
{
@@ -702,7 +703,7 @@ static HRESULT wined3d_unordered_access_view_init(struct wined3d_unordered_acces
struct wined3d_buffer *buffer = buffer_from_resource(resource);
HRESULT hr;
- if (FAILED(hr = create_buffer_view(&view->gl_view, desc, buffer, view->format)))
+ if (FAILED(hr = wined3d_cs_emit_create_buffer_view(resource->device->cs, &view->gl_view, desc, buffer, view->format)))
return hr;
}
else
@@ -724,8 +725,8 @@ static HRESULT wined3d_unordered_access_view_init(struct wined3d_unordered_acces
if (desc->u.texture.layer_idx || desc->u.texture.layer_count != depth_or_layer_count)
{
- create_texture_view(&view->gl_view, get_texture_view_target(gl_info, desc, texture),
- desc, texture, view->format);
+ wined3d_cs_emit_create_texture_view(resource->device->cs, &view->gl_view,
+ get_texture_view_target(gl_info, desc, texture), desc, texture, view->format);
}
view->layer_idx = desc->u.texture.layer_idx;
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 46660964eda..2cd708ca910 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -3225,6 +3225,8 @@ static inline void wined3d_resource_wait_idle(struct wined3d_resource *resource)
while (InterlockedCompareExchange(&resource->access_count, 0, 0));
}
+struct wined3d_gl_view;
+
struct wined3d_cs *wined3d_cs_create(struct wined3d_device *device) DECLSPEC_HIDDEN;
void wined3d_cs_destroy(struct wined3d_cs *cs) DECLSPEC_HIDDEN;
@@ -3240,9 +3242,15 @@ void wined3d_cs_emit_clear(struct wined3d_cs *cs, DWORD rect_count, const RECT *
void wined3d_cs_emit_clear_rtv(struct wined3d_cs *cs, struct wined3d_rendertarget_view *view,
const RECT *rect, DWORD flags, const struct wined3d_color *color, float depth, DWORD stencil,
const struct blit_shader *blitter) DECLSPEC_HIDDEN;
+HRESULT wined3d_cs_emit_create_buffer_view(struct wined3d_cs *cs, struct wined3d_gl_view *view,
+ const struct wined3d_view_desc *desc, struct wined3d_buffer *buffer,
+ const struct wined3d_format *view_format) DECLSPEC_HIDDEN;
void wined3d_cs_emit_create_dummy_textures(struct wined3d_cs *cs) DECLSPEC_HIDDEN;
HRESULT wined3d_cs_emit_create_swapchain_context(struct wined3d_cs *cs,
struct wined3d_swapchain *swapchain) DECLSPEC_HIDDEN;
+void wined3d_cs_emit_create_texture_view(struct wined3d_cs *cs, struct wined3d_gl_view *view,
+ GLenum view_target, const struct wined3d_view_desc *desc, struct wined3d_texture *texture,
+ const struct wined3d_format *view_format) DECLSPEC_HIDDEN;
void wined3d_cs_emit_destroy_object(struct wined3d_cs *cs,
void (*callback)(void *object), void *object) DECLSPEC_HIDDEN;
void wined3d_cs_emit_dispatch(struct wined3d_cs *cs,
@@ -3424,6 +3432,13 @@ struct wined3d_gl_view
GLuint name;
};
+HRESULT create_buffer_view(struct wined3d_gl_view *view,
+ const struct wined3d_view_desc *desc, struct wined3d_buffer *buffer,
+ const struct wined3d_format *view_format) DECLSPEC_HIDDEN;
+void create_texture_view(struct wined3d_gl_view *view, GLenum view_target,
+ const struct wined3d_view_desc *desc, struct wined3d_texture *texture,
+ const struct wined3d_format *view_format) DECLSPEC_HIDDEN;
+
struct wined3d_shader_resource_view
{
LONG refcount;
--
2.11.0

View File

@ -1,63 +1,36 @@
From 8082e2c1c4e3f605716f8b1b124e224b321f03e4 Mon Sep 17 00:00:00 2001
From 0c21b5789a1b288b28bdd31a199a87dc34f6a6c6 Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Wed, 8 Feb 2017 00:12:31 +0100
Subject: wined3d: Introduce a separate priority queue.
---
dlls/wined3d/cs.c | 143 ++++++++++++++++++++++-------------------
dlls/wined3d/cs.c | 133 ++++++++++++++++++++++-------------------
dlls/wined3d/wined3d_private.h | 4 +-
2 files changed, 79 insertions(+), 68 deletions(-)
2 files changed, 74 insertions(+), 63 deletions(-)
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
index 42f57a1b91a..9ba97650a15 100644
index a656c93684a..b874b1f41f2 100644
--- a/dlls/wined3d/cs.c
+++ b/dlls/wined3d/cs.c
@@ -565,14 +565,16 @@ static struct wined3d_cs_block *wined3d_cs_list_dequeue(struct wined3d_cs_list *
return LIST_ENTRY(head, struct wined3d_cs_block, entry);
}
-static struct wined3d_cs_block *wined3d_cs_list_dequeue_blocking(struct wined3d_cs_list *list)
+static struct wined3d_cs_block *wined3d_cs_dequeue_block(struct wined3d_cs *cs)
@@ -492,7 +492,7 @@ void wined3d_cs_emit_sync(struct wined3d_cs *cs)
{
struct wined3d_cs_block *block;
/* FIXME: Use an event to wait after a couple of spins. */
for (;;)
{
- if ((block = wined3d_cs_list_dequeue(list)))
+ if ((block = wined3d_cs_list_dequeue(&cs->exec_prio_list)))
+ return block;
+ if ((block = wined3d_cs_list_dequeue(&cs->exec_list)))
return block;
}
}
@@ -593,7 +595,7 @@ static void wined3d_cs_set_thread_block(const struct wined3d_cs *cs, struct wine
ERR("Failed to set thread block.\n");
}
-static struct wined3d_cs_block *wined3d_cs_get_block(struct wined3d_cs *cs)
+static struct wined3d_cs_block *wined3d_cs_get_block(struct wined3d_cs *cs, struct wined3d_cs_list *list)
{
struct wined3d_cs_block *block;
@@ -607,6 +609,7 @@ static struct wined3d_cs_block *wined3d_cs_get_block(struct wined3d_cs *cs)
}
block->pos = 0;
+ block->list = list;
return block;
}
@@ -626,7 +629,7 @@ static void wined3d_cs_emit_fence(struct wined3d_cs *cs, BOOL *signalled)
*signalled = FALSE;
struct wined3d_cs_sync *op;
- op = cs->ops->require_space(cs, sizeof(*op));
+ op = cs->ops->require_space(cs, sizeof(*op), 0);
op->opcode = WINED3D_CS_OP_FENCE;
op->signalled = signalled;
}
@@ -661,7 +664,7 @@ void wined3d_cs_emit_present(struct wined3d_cs *cs, struct wined3d_swapchain *sw
op->opcode = WINED3D_CS_OP_SYNC;
cs->ops->submit_and_wait(cs);
@@ -512,7 +512,7 @@ void wined3d_cs_emit_glfinish(struct wined3d_cs *cs)
{
struct wined3d_cs_glfinish *op;
- op = cs->ops->require_space(cs, sizeof(*op));
+ op = cs->ops->require_space(cs, sizeof(*op), 0);
op->opcode = WINED3D_CS_OP_GLFINISH;
cs->ops->submit_and_wait(cs);
@@ -548,7 +548,7 @@ void wined3d_cs_emit_present(struct wined3d_cs *cs, struct wined3d_swapchain *sw
unsigned int i;
LONG pending;
@ -66,7 +39,7 @@ index 42f57a1b91a..9ba97650a15 100644
op->opcode = WINED3D_CS_OP_PRESENT;
op->dst_window_override = dst_window_override;
op->swapchain = swapchain;
@@ -728,7 +731,7 @@ void wined3d_cs_emit_clear(struct wined3d_cs *cs, DWORD rect_count, const RECT *
@@ -615,7 +615,7 @@ void wined3d_cs_emit_clear(struct wined3d_cs *cs, DWORD rect_count, const RECT *
struct wined3d_cs_clear *op;
unsigned int i;
@ -75,7 +48,7 @@ index 42f57a1b91a..9ba97650a15 100644
op->opcode = WINED3D_CS_OP_CLEAR;
op->flags = flags;
op->color = *color;
@@ -878,7 +881,7 @@ void wined3d_cs_emit_dispatch(struct wined3d_cs *cs,
@@ -765,7 +765,7 @@ void wined3d_cs_emit_dispatch(struct wined3d_cs *cs,
const struct wined3d_state *state = &cs->device->state;
struct wined3d_cs_dispatch *op;
@ -84,7 +57,7 @@ index 42f57a1b91a..9ba97650a15 100644
op->opcode = WINED3D_CS_OP_DISPATCH;
op->group_count_x = group_count_x;
op->group_count_y = group_count_y;
@@ -940,7 +943,7 @@ void wined3d_cs_emit_draw(struct wined3d_cs *cs, int base_vertex_idx, unsigned i
@@ -827,7 +827,7 @@ void wined3d_cs_emit_draw(struct wined3d_cs *cs, int base_vertex_idx, unsigned i
struct wined3d_cs_draw *op;
unsigned int i;
@ -93,7 +66,7 @@ index 42f57a1b91a..9ba97650a15 100644
op->opcode = WINED3D_CS_OP_DRAW;
op->base_vertex_idx = base_vertex_idx;
op->start_idx = start_idx;
@@ -989,7 +992,7 @@ void wined3d_cs_emit_set_predication(struct wined3d_cs *cs, struct wined3d_query
@@ -876,7 +876,7 @@ void wined3d_cs_emit_set_predication(struct wined3d_cs *cs, struct wined3d_query
{
struct wined3d_cs_set_predication *op;
@ -102,7 +75,7 @@ index 42f57a1b91a..9ba97650a15 100644
op->opcode = WINED3D_CS_OP_SET_PREDICATION;
op->predicate = predicate;
op->value = value;
@@ -1011,7 +1014,7 @@ void wined3d_cs_emit_set_viewport(struct wined3d_cs *cs, const struct wined3d_vi
@@ -898,7 +898,7 @@ void wined3d_cs_emit_set_viewport(struct wined3d_cs *cs, const struct wined3d_vi
{
struct wined3d_cs_set_viewport *op;
@ -111,7 +84,7 @@ index 42f57a1b91a..9ba97650a15 100644
op->opcode = WINED3D_CS_OP_SET_VIEWPORT;
op->viewport = *viewport;
@@ -1032,7 +1035,7 @@ void wined3d_cs_emit_set_scissor_rect(struct wined3d_cs *cs, const RECT *rect)
@@ -919,7 +919,7 @@ void wined3d_cs_emit_set_scissor_rect(struct wined3d_cs *cs, const RECT *rect)
{
struct wined3d_cs_set_scissor_rect *op;
@ -120,7 +93,7 @@ index 42f57a1b91a..9ba97650a15 100644
op->opcode = WINED3D_CS_OP_SET_SCISSOR_RECT;
op->rect = *rect;
@@ -1054,7 +1057,7 @@ void wined3d_cs_emit_set_rendertarget_view(struct wined3d_cs *cs, unsigned int v
@@ -941,7 +941,7 @@ void wined3d_cs_emit_set_rendertarget_view(struct wined3d_cs *cs, unsigned int v
{
struct wined3d_cs_set_rendertarget_view *op;
@ -129,7 +102,7 @@ index 42f57a1b91a..9ba97650a15 100644
op->opcode = WINED3D_CS_OP_SET_RENDERTARGET_VIEW;
op->view_idx = view_idx;
op->view = view;
@@ -1105,7 +1108,7 @@ void wined3d_cs_emit_set_depth_stencil_view(struct wined3d_cs *cs, struct wined3
@@ -992,7 +992,7 @@ void wined3d_cs_emit_set_depth_stencil_view(struct wined3d_cs *cs, struct wined3
{
struct wined3d_cs_set_depth_stencil_view *op;
@ -138,7 +111,7 @@ index 42f57a1b91a..9ba97650a15 100644
op->opcode = WINED3D_CS_OP_SET_DEPTH_STENCIL_VIEW;
op->view = view;
@@ -1126,7 +1129,7 @@ void wined3d_cs_emit_set_vertex_declaration(struct wined3d_cs *cs, struct wined3
@@ -1013,7 +1013,7 @@ void wined3d_cs_emit_set_vertex_declaration(struct wined3d_cs *cs, struct wined3
{
struct wined3d_cs_set_vertex_declaration *op;
@ -147,7 +120,7 @@ index 42f57a1b91a..9ba97650a15 100644
op->opcode = WINED3D_CS_OP_SET_VERTEX_DECLARATION;
op->declaration = declaration;
@@ -1160,7 +1163,7 @@ void wined3d_cs_emit_set_stream_source(struct wined3d_cs *cs, UINT stream_idx,
@@ -1047,7 +1047,7 @@ void wined3d_cs_emit_set_stream_source(struct wined3d_cs *cs, UINT stream_idx,
{
struct wined3d_cs_set_stream_source *op;
@ -156,7 +129,7 @@ index 42f57a1b91a..9ba97650a15 100644
op->opcode = WINED3D_CS_OP_SET_STREAM_SOURCE;
op->stream_idx = stream_idx;
op->buffer = buffer;
@@ -1188,7 +1191,7 @@ void wined3d_cs_emit_set_stream_source_freq(struct wined3d_cs *cs, UINT stream_i
@@ -1075,7 +1075,7 @@ void wined3d_cs_emit_set_stream_source_freq(struct wined3d_cs *cs, UINT stream_i
{
struct wined3d_cs_set_stream_source_freq *op;
@ -165,7 +138,7 @@ index 42f57a1b91a..9ba97650a15 100644
op->opcode = WINED3D_CS_OP_SET_STREAM_SOURCE_FREQ;
op->stream_idx = stream_idx;
op->frequency = frequency;
@@ -1221,7 +1224,7 @@ void wined3d_cs_emit_set_stream_output(struct wined3d_cs *cs, UINT stream_idx,
@@ -1108,7 +1108,7 @@ void wined3d_cs_emit_set_stream_output(struct wined3d_cs *cs, UINT stream_idx,
{
struct wined3d_cs_set_stream_output *op;
@ -174,7 +147,7 @@ index 42f57a1b91a..9ba97650a15 100644
op->opcode = WINED3D_CS_OP_SET_STREAM_OUTPUT;
op->stream_idx = stream_idx;
op->buffer = buffer;
@@ -1255,7 +1258,7 @@ void wined3d_cs_emit_set_index_buffer(struct wined3d_cs *cs, struct wined3d_buff
@@ -1142,7 +1142,7 @@ void wined3d_cs_emit_set_index_buffer(struct wined3d_cs *cs, struct wined3d_buff
{
struct wined3d_cs_set_index_buffer *op;
@ -183,7 +156,7 @@ index 42f57a1b91a..9ba97650a15 100644
op->opcode = WINED3D_CS_OP_SET_INDEX_BUFFER;
op->buffer = buffer;
op->format_id = format_id;
@@ -1286,7 +1289,7 @@ void wined3d_cs_emit_set_constant_buffer(struct wined3d_cs *cs, enum wined3d_sha
@@ -1173,7 +1173,7 @@ void wined3d_cs_emit_set_constant_buffer(struct wined3d_cs *cs, enum wined3d_sha
{
struct wined3d_cs_set_constant_buffer *op;
@ -192,7 +165,7 @@ index 42f57a1b91a..9ba97650a15 100644
op->opcode = WINED3D_CS_OP_SET_CONSTANT_BUFFER;
op->type = type;
op->cb_idx = cb_idx;
@@ -1380,7 +1383,7 @@ void wined3d_cs_emit_set_texture(struct wined3d_cs *cs, UINT stage, struct wined
@@ -1267,7 +1267,7 @@ void wined3d_cs_emit_set_texture(struct wined3d_cs *cs, UINT stage, struct wined
{
struct wined3d_cs_set_texture *op;
@ -201,7 +174,7 @@ index 42f57a1b91a..9ba97650a15 100644
op->opcode = WINED3D_CS_OP_SET_TEXTURE;
op->stage = stage;
op->texture = texture;
@@ -1412,7 +1415,7 @@ void wined3d_cs_emit_set_shader_resource_view(struct wined3d_cs *cs, enum wined3
@@ -1299,7 +1299,7 @@ void wined3d_cs_emit_set_shader_resource_view(struct wined3d_cs *cs, enum wined3
{
struct wined3d_cs_set_shader_resource_view *op;
@ -210,7 +183,7 @@ index 42f57a1b91a..9ba97650a15 100644
op->opcode = WINED3D_CS_OP_SET_SHADER_RESOURCE_VIEW;
op->type = type;
op->view_idx = view_idx;
@@ -1444,7 +1447,7 @@ void wined3d_cs_emit_set_unordered_access_view(struct wined3d_cs *cs, enum wined
@@ -1331,7 +1331,7 @@ void wined3d_cs_emit_set_unordered_access_view(struct wined3d_cs *cs, enum wined
{
struct wined3d_cs_set_unordered_access_view *op;
@ -219,7 +192,7 @@ index 42f57a1b91a..9ba97650a15 100644
op->opcode = WINED3D_CS_OP_SET_UNORDERED_ACCESS_VIEW;
op->pipeline = pipeline;
op->view_idx = view_idx;
@@ -1468,7 +1471,7 @@ void wined3d_cs_emit_set_sampler(struct wined3d_cs *cs, enum wined3d_shader_type
@@ -1355,7 +1355,7 @@ void wined3d_cs_emit_set_sampler(struct wined3d_cs *cs, enum wined3d_shader_type
{
struct wined3d_cs_set_sampler *op;
@ -228,7 +201,7 @@ index 42f57a1b91a..9ba97650a15 100644
op->opcode = WINED3D_CS_OP_SET_SAMPLER;
op->type = type;
op->sampler_idx = sampler_idx;
@@ -1493,7 +1496,7 @@ void wined3d_cs_emit_set_shader(struct wined3d_cs *cs, enum wined3d_shader_type
@@ -1380,7 +1380,7 @@ void wined3d_cs_emit_set_shader(struct wined3d_cs *cs, enum wined3d_shader_type
{
struct wined3d_cs_set_shader *op;
@ -237,7 +210,7 @@ index 42f57a1b91a..9ba97650a15 100644
op->opcode = WINED3D_CS_OP_SET_SHADER;
op->type = type;
op->shader = shader;
@@ -1516,7 +1519,7 @@ void wined3d_cs_emit_set_rasterizer_state(struct wined3d_cs *cs,
@@ -1403,7 +1403,7 @@ void wined3d_cs_emit_set_rasterizer_state(struct wined3d_cs *cs,
{
struct wined3d_cs_set_rasterizer_state *op;
@ -246,7 +219,7 @@ index 42f57a1b91a..9ba97650a15 100644
op->opcode = WINED3D_CS_OP_SET_RASTERIZER_STATE;
op->state = rasterizer_state;
@@ -1537,7 +1540,7 @@ void wined3d_cs_emit_set_render_state(struct wined3d_cs *cs, enum wined3d_render
@@ -1424,7 +1424,7 @@ void wined3d_cs_emit_set_render_state(struct wined3d_cs *cs, enum wined3d_render
{
struct wined3d_cs_set_render_state *op;
@ -255,7 +228,7 @@ index 42f57a1b91a..9ba97650a15 100644
op->opcode = WINED3D_CS_OP_SET_RENDER_STATE;
op->state = state;
op->value = value;
@@ -1560,7 +1563,7 @@ void wined3d_cs_emit_set_texture_state(struct wined3d_cs *cs, UINT stage,
@@ -1447,7 +1447,7 @@ void wined3d_cs_emit_set_texture_state(struct wined3d_cs *cs, UINT stage,
{
struct wined3d_cs_set_texture_state *op;
@ -264,7 +237,7 @@ index 42f57a1b91a..9ba97650a15 100644
op->opcode = WINED3D_CS_OP_SET_TEXTURE_STATE;
op->stage = stage;
op->state = state;
@@ -1584,7 +1587,7 @@ void wined3d_cs_emit_set_sampler_state(struct wined3d_cs *cs, UINT sampler_idx,
@@ -1471,7 +1471,7 @@ void wined3d_cs_emit_set_sampler_state(struct wined3d_cs *cs, UINT sampler_idx,
{
struct wined3d_cs_set_sampler_state *op;
@ -273,7 +246,7 @@ index 42f57a1b91a..9ba97650a15 100644
op->opcode = WINED3D_CS_OP_SET_SAMPLER_STATE;
op->sampler_idx = sampler_idx;
op->state = state;
@@ -1609,7 +1612,7 @@ void wined3d_cs_emit_set_transform(struct wined3d_cs *cs, enum wined3d_transform
@@ -1496,7 +1496,7 @@ void wined3d_cs_emit_set_transform(struct wined3d_cs *cs, enum wined3d_transform
{
struct wined3d_cs_set_transform *op;
@ -282,7 +255,7 @@ index 42f57a1b91a..9ba97650a15 100644
op->opcode = WINED3D_CS_OP_SET_TRANSFORM;
op->state = state;
op->matrix = *matrix;
@@ -1631,7 +1634,7 @@ void wined3d_cs_emit_set_clip_plane(struct wined3d_cs *cs, UINT plane_idx, const
@@ -1518,7 +1518,7 @@ void wined3d_cs_emit_set_clip_plane(struct wined3d_cs *cs, UINT plane_idx, const
{
struct wined3d_cs_set_clip_plane *op;
@ -291,7 +264,7 @@ index 42f57a1b91a..9ba97650a15 100644
op->opcode = WINED3D_CS_OP_SET_CLIP_PLANE;
op->plane_idx = plane_idx;
op->plane = *plane;
@@ -1709,7 +1712,7 @@ void wined3d_cs_emit_set_color_key(struct wined3d_cs *cs, struct wined3d_texture
@@ -1596,7 +1596,7 @@ void wined3d_cs_emit_set_color_key(struct wined3d_cs *cs, struct wined3d_texture
{
struct wined3d_cs_set_color_key *op;
@ -300,7 +273,7 @@ index 42f57a1b91a..9ba97650a15 100644
op->opcode = WINED3D_CS_OP_SET_COLOR_KEY;
op->texture = texture;
op->flags = flags;
@@ -1738,7 +1741,7 @@ void wined3d_cs_emit_set_material(struct wined3d_cs *cs, const struct wined3d_ma
@@ -1625,7 +1625,7 @@ void wined3d_cs_emit_set_material(struct wined3d_cs *cs, const struct wined3d_ma
{
struct wined3d_cs_set_material *op;
@ -309,7 +282,7 @@ index 42f57a1b91a..9ba97650a15 100644
op->opcode = WINED3D_CS_OP_SET_MATERIAL;
op->material = *material;
@@ -1763,7 +1766,7 @@ void wined3d_cs_emit_reset_state(struct wined3d_cs *cs)
@@ -1650,7 +1650,7 @@ void wined3d_cs_emit_reset_state(struct wined3d_cs *cs)
{
struct wined3d_cs_reset_state *op;
@ -318,16 +291,16 @@ index 42f57a1b91a..9ba97650a15 100644
op->opcode = WINED3D_CS_OP_RESET_STATE;
cs->ops->submit(cs);
@@ -1782,7 +1785,7 @@ void wined3d_cs_emit_destroy_object(struct wined3d_cs *cs, void (*callback)(void
@@ -1669,7 +1669,7 @@ static void wined3d_cs_emit_callback(struct wined3d_cs *cs, void (*callback)(voi
{
struct wined3d_cs_destroy_object *op;
struct wined3d_cs_callback *op;
- op = cs->ops->require_space(cs, sizeof(*op));
+ op = cs->ops->require_space(cs, sizeof(*op), 0);
op->opcode = WINED3D_CS_OP_DESTROY_OBJECT;
op->opcode = WINED3D_CS_OP_CALLBACK;
op->callback = callback;
op->object = object;
@@ -1804,7 +1807,7 @@ void wined3d_cs_emit_query_issue(struct wined3d_cs *cs, struct wined3d_query *qu
@@ -1701,7 +1701,7 @@ void wined3d_cs_emit_query_issue(struct wined3d_cs *cs, struct wined3d_query *qu
{
struct wined3d_cs_query_issue *op;
@ -336,7 +309,7 @@ index 42f57a1b91a..9ba97650a15 100644
op->opcode = WINED3D_CS_OP_QUERY_ISSUE;
op->query = query;
op->flags = flags;
@@ -1827,7 +1830,7 @@ BOOL wined3d_cs_emit_query_poll(struct wined3d_cs *cs, struct wined3d_query *que
@@ -1724,7 +1724,7 @@ BOOL wined3d_cs_emit_query_poll(struct wined3d_cs *cs, struct wined3d_query *que
struct wined3d_cs_query_poll *op;
BOOL ret;
@ -345,7 +318,7 @@ index 42f57a1b91a..9ba97650a15 100644
op->opcode = WINED3D_CS_OP_QUERY_POLL;
op->query = query;
op->flags = flags;
@@ -1853,7 +1856,7 @@ void wined3d_cs_emit_preload_resource(struct wined3d_cs *cs, struct wined3d_reso
@@ -1750,7 +1750,7 @@ void wined3d_cs_emit_preload_resource(struct wined3d_cs *cs, struct wined3d_reso
{
struct wined3d_cs_preload_resource *op;
@ -354,7 +327,7 @@ index 42f57a1b91a..9ba97650a15 100644
op->opcode = WINED3D_CS_OP_PRELOAD_RESOURCE;
op->resource = resource;
@@ -1877,7 +1880,7 @@ void wined3d_cs_emit_unload_resource(struct wined3d_cs *cs, struct wined3d_resou
@@ -1774,7 +1774,7 @@ void wined3d_cs_emit_unload_resource(struct wined3d_cs *cs, struct wined3d_resou
{
struct wined3d_cs_unload_resource *op;
@ -363,7 +336,7 @@ index 42f57a1b91a..9ba97650a15 100644
op->opcode = WINED3D_CS_OP_UNLOAD_RESOURCE;
op->resource = resource;
@@ -1903,7 +1906,7 @@ HRESULT wined3d_cs_map(struct wined3d_cs *cs, struct wined3d_resource *resource,
@@ -1800,7 +1800,7 @@ HRESULT wined3d_cs_map(struct wined3d_cs *cs, struct wined3d_resource *resource,
struct wined3d_cs_map *op;
HRESULT hr;
@ -372,7 +345,7 @@ index 42f57a1b91a..9ba97650a15 100644
op->opcode = WINED3D_CS_OP_MAP;
op->resource = resource;
op->sub_resource_idx = sub_resource_idx;
@@ -1932,7 +1935,7 @@ HRESULT wined3d_cs_unmap(struct wined3d_cs *cs, struct wined3d_resource *resourc
@@ -1829,7 +1829,7 @@ HRESULT wined3d_cs_unmap(struct wined3d_cs *cs, struct wined3d_resource *resourc
struct wined3d_cs_unmap *op;
HRESULT hr;
@ -381,16 +354,7 @@ index 42f57a1b91a..9ba97650a15 100644
op->opcode = WINED3D_CS_OP_UNMAP;
op->resource = resource;
op->sub_resource_idx = sub_resource_idx;
@@ -1958,7 +1961,7 @@ void wined3d_cs_emit_glfinish(struct wined3d_cs *cs)
{
struct wined3d_cs_finish *op;
- op = cs->ops->require_space(cs, sizeof(*op));
+ op = cs->ops->require_space(cs, sizeof(*op), 0);
op->opcode = WINED3D_CS_OP_GLFINISH;
cs->ops->submit(cs);
@@ -2015,7 +2018,7 @@ void wined3d_cs_emit_push_constants(struct wined3d_cs *cs, enum wined3d_push_con
@@ -1891,7 +1891,7 @@ void wined3d_cs_emit_push_constants(struct wined3d_cs *cs, enum wined3d_push_con
{
struct wined3d_cs_push_constants *op;
@ -399,7 +363,7 @@ index 42f57a1b91a..9ba97650a15 100644
op->opcode = WINED3D_CS_OP_PUSH_CONSTANTS;
op->p = p;
op->start_idx = start_idx;
@@ -2044,7 +2047,7 @@ void wined3d_cs_emit_set_primitive_type(struct wined3d_cs *cs, GLenum primitive_
@@ -1920,7 +1920,7 @@ void wined3d_cs_emit_set_primitive_type(struct wined3d_cs *cs, GLenum primitive_
{
struct wined3d_cs_set_primitive_type *op;
@ -408,7 +372,7 @@ index 42f57a1b91a..9ba97650a15 100644
op->opcode = WINED3D_CS_OP_SET_PRIMITIVE_TYPE;
op->gl_primitive_type = primitive_type;
@@ -2104,7 +2107,7 @@ void wined3d_cs_emit_set_light(struct wined3d_cs *cs, const struct wined3d_light
@@ -1970,7 +1970,7 @@ void wined3d_cs_emit_set_light(struct wined3d_cs *cs, const struct wined3d_light
{
struct wined3d_cs_set_light *op;
@ -417,7 +381,7 @@ index 42f57a1b91a..9ba97650a15 100644
op->opcode = WINED3D_CS_OP_SET_LIGHT;
op->light = *light;
@@ -2193,7 +2196,7 @@ void wined3d_cs_emit_set_light_enable(struct wined3d_cs *cs, UINT idx, BOOL enab
@@ -2006,7 +2006,7 @@ void wined3d_cs_emit_set_light_enable(struct wined3d_cs *cs, UINT idx, BOOL enab
{
struct wined3d_cs_set_light_enable *op;
@ -426,7 +390,7 @@ index 42f57a1b91a..9ba97650a15 100644
op->opcode = WINED3D_CS_OP_SET_LIGHT_ENABLE;
op->idx = idx;
op->enable = enable;
@@ -2223,7 +2226,7 @@ void wined3d_cs_emit_blt(struct wined3d_cs *cs, struct wined3d_surface *dst_surf
@@ -2036,7 +2036,7 @@ void wined3d_cs_emit_blt(struct wined3d_cs *cs, struct wined3d_surface *dst_surf
{
struct wined3d_cs_blt *op;
@ -435,7 +399,7 @@ index 42f57a1b91a..9ba97650a15 100644
op->opcode = WINED3D_CS_OP_BLT;
op->dst_surface = dst_surface;
op->dst_rect = *dst_rect;
@@ -2262,7 +2265,7 @@ void wined3d_cs_emit_clear_rtv(struct wined3d_cs *cs, struct wined3d_rendertarge
@@ -2075,7 +2075,7 @@ void wined3d_cs_emit_clear_rtv(struct wined3d_cs *cs, struct wined3d_rendertarge
{
struct wined3d_cs_clear_rtv *op;
@ -444,7 +408,7 @@ index 42f57a1b91a..9ba97650a15 100644
op->opcode = WINED3D_CS_OP_CLEAR_RTV;
op->view = view;
op->rect = *rect;
@@ -2298,7 +2301,7 @@ void wined3d_cs_emit_update_texture(struct wined3d_cs *cs, struct wined3d_textur
@@ -2111,7 +2111,7 @@ void wined3d_cs_emit_update_texture(struct wined3d_cs *cs, struct wined3d_textur
{
struct wined3d_cs_update_texture *op;
@ -453,7 +417,7 @@ index 42f57a1b91a..9ba97650a15 100644
op->opcode = WINED3D_CS_OP_UPDATE_TEXTURE;
op->src = src;
op->dst = dst;
@@ -2364,7 +2367,7 @@ void wined3d_cs_emit_update_sub_resource(struct wined3d_cs *cs, struct wined3d_r
@@ -2177,7 +2177,7 @@ void wined3d_cs_emit_update_sub_resource(struct wined3d_cs *cs, struct wined3d_r
{
struct wined3d_cs_update_sub_resource *op;
@ -462,7 +426,7 @@ index 42f57a1b91a..9ba97650a15 100644
op->opcode = WINED3D_CS_OP_UPDATE_SUB_RESOURCE;
op->resource = resource;
op->sub_resource_idx = sub_resource_idx;
@@ -2393,7 +2396,7 @@ HRESULT wined3d_cs_emit_get_dc(struct wined3d_cs *cs, struct wined3d_texture *te
@@ -2206,7 +2206,7 @@ HRESULT wined3d_cs_emit_get_dc(struct wined3d_cs *cs, struct wined3d_texture *te
struct wined3d_cs_get_release_dc *op;
HRESULT hr;
@ -471,7 +435,7 @@ index 42f57a1b91a..9ba97650a15 100644
op->opcode = WINED3D_CS_OP_GET_DC;
op->texture = texture;
op->sub_resource_idx = sub_resource_idx;
@@ -2419,7 +2422,7 @@ HRESULT wined3d_cs_emit_release_dc(struct wined3d_cs *cs, struct wined3d_texture
@@ -2232,7 +2232,7 @@ HRESULT wined3d_cs_emit_release_dc(struct wined3d_cs *cs, struct wined3d_texture
struct wined3d_cs_get_release_dc *op;
HRESULT hr;
@ -480,16 +444,7 @@ index 42f57a1b91a..9ba97650a15 100644
op->opcode = WINED3D_CS_OP_RELEASE_DC;
op->texture = texture;
op->sub_resource_idx = sub_resource_idx;
@@ -2445,7 +2448,7 @@ void wined3d_cs_emit_create_dummy_textures(struct wined3d_cs *cs)
{
struct wined3d_cs_create_dummy_textures *op;
- op = cs->ops->require_space(cs, sizeof(*op));
+ op = cs->ops->require_space(cs, sizeof(*op), 0);
op->opcode = WINED3D_CS_OP_CREATE_DUMMY_TEXTURES;
cs->ops->submit_and_wait(cs);
@@ -2465,7 +2468,7 @@ HRESULT wined3d_cs_emit_create_swapchain_context(struct wined3d_cs *cs, struct w
@@ -2257,7 +2257,7 @@ HRESULT wined3d_cs_emit_create_swapchain_context(struct wined3d_cs *cs, struct w
struct wined3d_cs_create_swapchain_context *op;
HRESULT hr;
@ -498,7 +453,7 @@ index 42f57a1b91a..9ba97650a15 100644
op->opcode = WINED3D_CS_OP_CREATE_SWAPCHAIN_CONTEXT;
op->swapchain = swapchain;
op->hr = &hr;
@@ -2488,7 +2491,7 @@ void wined3d_cs_emit_update_swap_interval(struct wined3d_cs *cs, struct wined3d_
@@ -2280,7 +2280,7 @@ void wined3d_cs_emit_update_swap_interval(struct wined3d_cs *cs, struct wined3d_
{
struct wined3d_cs_update_swap_interval *op;
@ -507,16 +462,7 @@ index 42f57a1b91a..9ba97650a15 100644
op->opcode = WINED3D_CS_OP_UPDATE_SWAP_INTERVAL;
op->swapchain = swapchain;
@@ -2508,7 +2511,7 @@ void wined3d_cs_emit_sampler_init(struct wined3d_cs *cs, struct wined3d_sampler
{
struct wined3d_cs_sampler_init *op;
- op = cs->ops->require_space(cs, sizeof(*op));
+ op = cs->ops->require_space(cs, sizeof(*op), 0);
op->opcode = WINED3D_CS_OP_SAMPLER_INIT;
op->sampler = sampler;
@@ -2546,7 +2549,7 @@ void wined3d_cs_emit_texture_add_dirty_region(struct wined3d_cs *cs,
@@ -2318,7 +2318,7 @@ void wined3d_cs_emit_texture_add_dirty_region(struct wined3d_cs *cs,
if (dirty_region)
WARN("Ignoring dirty_region %s.\n", debug_box(dirty_region));
@ -525,7 +471,7 @@ index 42f57a1b91a..9ba97650a15 100644
op->opcode = WINED3D_CS_OP_TEXTURE_ADD_DIRTY_REGION;
op->texture = texture;
op->sub_resource_idx = sub_resource_idx;
@@ -2576,7 +2579,7 @@ void wined3d_cs_emit_buffer_copy(struct wined3d_cs *cs, struct wined3d_buffer *d
@@ -2348,7 +2348,7 @@ void wined3d_cs_emit_buffer_copy(struct wined3d_cs *cs, struct wined3d_buffer *d
{
struct wined3d_cs_buffer_copy *op;
@ -534,104 +480,109 @@ index 42f57a1b91a..9ba97650a15 100644
op->opcode = WINED3D_CS_OP_BUFFER_COPY;
op->dst_buffer = dst_buffer;
op->dst_offset = dst_offset;
@@ -2606,7 +2609,7 @@ HRESULT wined3d_cs_emit_create_buffer_view(struct wined3d_cs *cs, struct wined3d
struct wined3d_cs_create_buffer_view *op;
HRESULT hr;
- op = cs->ops->require_space(cs, sizeof(*op));
+ op = cs->ops->require_space(cs, sizeof(*op), 0);
op->opcode = WINED3D_CS_OP_CREATE_BUFFER_VIEW;
op->view = view;
op->desc = desc;
@@ -2634,7 +2637,7 @@ void wined3d_cs_emit_create_texture_view(struct wined3d_cs *cs, struct wined3d_g
{
struct wined3d_cs_create_texture_view *op;
- op = cs->ops->require_space(cs, sizeof(*op));
+ op = cs->ops->require_space(cs, sizeof(*op), 0);
op->opcode = WINED3D_CS_OP_CREATE_TEXTURE_VIEW;
op->view = view;
op->view_target = view_target;
@@ -2658,7 +2661,7 @@ void wined3d_cs_emit_delete_opengl_contexts(struct wined3d_cs *cs)
{
struct wined3d_cs_delete_gl_contexts *op;
- op = cs->ops->require_space(cs, sizeof(*op));
+ op = cs->ops->require_space(cs, sizeof(*op), 0);
op->opcode = WINED3D_CS_OP_DELETE_GL_CONTEXTS;
cs->ops->submit_and_wait(cs);
@@ -2720,7 +2723,7 @@ void wined3d_cs_emit_map_vertex_buffers(struct wined3d_cs *cs, UINT src_start_id
@@ -2418,7 +2418,7 @@ void wined3d_cs_emit_map_vertex_buffers(struct wined3d_cs *cs, UINT src_start_id
{
struct wined3d_cs_map_vertex_buffers *op;
- op = cs->ops->require_space(cs, sizeof(*op));
+ op = cs->ops->require_space(cs, sizeof(*op), 0);
op->opcode = WINED3D_CS_OP_MAP_vertex_buffers;
op->opcode = WINED3D_CS_OP_MAP_VERTEX_BUFFERS;
op->src_start_idx = src_start_idx;
op->stream_info = stream_info;
@@ -2790,7 +2793,7 @@ static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void
/* WINED3D_CS_OP_MAP_vertex_buffers */ wined3d_cs_exec_map_vertex_buffers,
@@ -2483,7 +2483,7 @@ static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void
/* WINED3D_CS_OP_MAP_VERTEX_BUFFERS */ wined3d_cs_exec_map_vertex_buffers,
};
-static void *wined3d_cs_st_require_space(struct wined3d_cs *cs, size_t size)
+static void *wined3d_cs_st_require_space(struct wined3d_cs *cs, size_t size, int priority)
{
if (size > cs->data_size)
if (size > (cs->data_size - cs->end))
{
@@ -2821,9 +2824,10 @@ static const struct wined3d_cs_ops wined3d_cs_st_ops =
wined3d_cs_st_submit,
};
@@ -2567,6 +2567,8 @@ static struct wined3d_cs_block *wined3d_cs_dequeue_command(struct wined3d_cs *cs
/* FIXME: Use an event to wait after a couple of spins. */
for (;;)
{
+ if ((block = wined3d_cs_list_dequeue(&cs->exec_prio_list)))
+ return block;
if ((block = wined3d_cs_list_dequeue(&cs->exec_list)))
return block;
}
@@ -2594,7 +2596,7 @@ static void wined3d_cs_list_cleanup(struct wined3d_cs_list *list)
DeleteCriticalSection(&list->lock);
}
-static struct wined3d_cs_block *wined3d_cs_get_block(struct wined3d_cs *cs)
+static struct wined3d_cs_block *wined3d_cs_get_block(struct wined3d_cs *cs, struct wined3d_cs_list *list)
{
struct wined3d_cs_block *block;
@@ -2608,26 +2610,28 @@ static struct wined3d_cs_block *wined3d_cs_get_block(struct wined3d_cs *cs)
}
block->pos = 0;
+ block->list = list;
block->fence = NULL;
return block;
}
-static void *wined3d_cs_mt_require_space(struct wined3d_cs *cs, size_t size)
+static void *wined3d_cs_mt_require_space(struct wined3d_cs *cs, size_t size, int priority)
{
struct wined3d_cs_block *block = wined3d_cs_get_thread_block(cs);
+ struct wined3d_cs_list *list = priority ? &cs->exec_prio_list : &cs->exec_list;
struct wined3d_cs_block *block;
void *data;
assert(size <= sizeof(block->data));
@@ -2831,8 +2835,11 @@ static void *wined3d_cs_mt_require_space(struct wined3d_cs *cs, size_t size)
if (!block || block->pos + size > sizeof(block->data))
if (cs->thread_id == GetCurrentThreadId())
- return wined3d_cs_st_require_space(cs, size);
+ return wined3d_cs_st_require_space(cs, size, priority);
assert(size < sizeof(block->data));
block = cs->current_block;
- if (!block || block->pos + size > sizeof(block->data))
+ if (!block || block->pos + size > sizeof(block->data) || block->list != list)
{
if (block)
+ {
+ list = block->list; /* send follow-up commands on the same list */
wined3d_cs_mt_submit(cs);
if (block) cs->ops->submit(cs);
- block = wined3d_cs_get_block(cs);
+ }
+ block = wined3d_cs_get_block(cs, list);
wined3d_cs_set_thread_block(cs, block);
cs->current_block = block;
}
@@ -2850,7 +2857,7 @@ static void wined3d_cs_mt_submit(struct wined3d_cs *cs)
@@ -2639,10 +2643,13 @@ static void *wined3d_cs_mt_require_space(struct wined3d_cs *cs, size_t size)
static void wined3d_cs_mt_submit(struct wined3d_cs *cs)
{
+ struct wined3d_cs_block *block;
+
if (cs->thread_id == GetCurrentThreadId())
wined3d_cs_process_block(cs, block);
else
- wined3d_cs_list_enqueue(&cs->exec_list, block);
+ wined3d_cs_list_enqueue(block->list, block);
return wined3d_cs_st_submit(cs);
- wined3d_cs_list_enqueue(&cs->exec_list, cs->current_block);
+ block = cs->current_block;
+ wined3d_cs_list_enqueue(block->list, block);
cs->current_block = NULL;
}
static void wined3d_cs_mt_submit_and_wait(struct wined3d_cs *cs)
@@ -2880,7 +2887,7 @@ static void wined3d_cs_emit_stop(struct wined3d_cs *cs)
@@ -2656,7 +2663,7 @@ static void wined3d_cs_mt_submit_and_wait(struct wined3d_cs *cs)
block = cs->current_block;
block->fence = &fence;
- wined3d_cs_list_enqueue(&cs->exec_list, block);
+ wined3d_cs_list_enqueue(block->list, block);
cs->current_block = NULL;
/* A busy wait should be fine, we're not supposed to have to wait very
@@ -2678,7 +2685,7 @@ static void wined3d_cs_mt_emit_stop(struct wined3d_cs *cs)
assert(cs->thread_id != GetCurrentThreadId());
assert(cs->ops == &wined3d_cs_mt_ops);
- op = wined3d_cs_mt_require_space(cs, sizeof(*op));
+ op = wined3d_cs_mt_require_space(cs, sizeof(*op), 0);
- op = cs->ops->require_space(cs, sizeof(*op));
+ op = cs->ops->require_space(cs, sizeof(*op), 0);
op->opcode = WINED3D_CS_OP_STOP;
wined3d_cs_mt_submit(cs);
@@ -2916,7 +2923,7 @@ static DWORD WINAPI wined3d_cs_run(void *thread_param)
for (;;)
{
struct wined3d_cs_block *block;
- block = wined3d_cs_list_dequeue_blocking(&cs->exec_list);
+ block = wined3d_cs_dequeue_block(cs);
if (!wined3d_cs_process_block(cs, block))
break;
}
@@ -2960,6 +2967,7 @@ struct wined3d_cs *wined3d_cs_create(struct wined3d_device *device)
cs->ops->submit(cs);
@@ -2761,6 +2768,7 @@ struct wined3d_cs *wined3d_cs_create(struct wined3d_device *device)
wined3d_cs_list_init(&cs->free_list);
wined3d_cs_list_init(&cs->exec_list);
@ -639,23 +590,24 @@ index 42f57a1b91a..9ba97650a15 100644
if (!(cs->thread = CreateThread(NULL, 0, wined3d_cs_run, cs, 0, &cs->thread_id)))
{
@@ -2995,6 +3003,7 @@ void wined3d_cs_destroy(struct wined3d_cs *cs)
@@ -2785,6 +2793,7 @@ void wined3d_cs_destroy(struct wined3d_cs *cs)
WaitForSingleObject(cs->thread, INFINITE);
CloseHandle(cs->thread);
/* FIXME: Cleanup the block lists on thread exit. */
#if 0
+ wined3d_cs_list_cleanup(&cs->exec_prio_list);
wined3d_cs_list_cleanup(&cs->exec_list);
wined3d_cs_list_cleanup(&cs->free_list);
#endif
}
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 831375b1efd..2d888a51f61 100644
index 5962fa7ea19..43b3146f6f8 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -3214,12 +3214,13 @@ struct wined3d_cs_block
@@ -3217,13 +3217,14 @@ struct wined3d_cs_block
{
struct list entry;
UINT pos;
+ struct wined3d_cs_list *list;
BOOL *fence;
BYTE data[0x4000]; /* FIXME? The size is somewhat arbitrary. */
};
@ -666,8 +618,8 @@ index 831375b1efd..2d888a51f61 100644
void (*submit)(struct wined3d_cs *cs);
void (*submit_and_wait)(struct wined3d_cs *cs);
};
@@ -3237,6 +3238,7 @@ struct wined3d_cs
@@ -3242,6 +3243,7 @@ struct wined3d_cs
struct wined3d_cs_block *current_block;
struct wined3d_cs_list free_list;
struct wined3d_cs_list exec_list;
+ struct wined3d_cs_list exec_prio_list;

View File

@ -1,4 +1,4 @@
From cd0503137f298188f2e99ab083b1cb3f4154d47b Mon Sep 17 00:00:00 2001
From 350f4d8f1a34b4408255a88062da792b76b18043 Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Wed, 8 Feb 2017 00:21:56 +0100
Subject: wined3d: Use priority queue for maps/unmaps.
@ -9,10 +9,10 @@ Subject: wined3d: Use priority queue for maps/unmaps.
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
index 2a255060dc4..573175ef3c7 100644
index b874b1f41f2..3e7defdeb1b 100644
--- a/dlls/wined3d/cs.c
+++ b/dlls/wined3d/cs.c
@@ -1873,7 +1873,7 @@ HRESULT wined3d_cs_map(struct wined3d_cs *cs, struct wined3d_resource *resource,
@@ -1800,7 +1800,7 @@ HRESULT wined3d_cs_map(struct wined3d_cs *cs, struct wined3d_resource *resource,
struct wined3d_cs_map *op;
HRESULT hr;
@ -21,7 +21,7 @@ index 2a255060dc4..573175ef3c7 100644
op->opcode = WINED3D_CS_OP_MAP;
op->resource = resource;
op->sub_resource_idx = sub_resource_idx;
@@ -1902,7 +1902,7 @@ HRESULT wined3d_cs_unmap(struct wined3d_cs *cs, struct wined3d_resource *resourc
@@ -1829,7 +1829,7 @@ HRESULT wined3d_cs_unmap(struct wined3d_cs *cs, struct wined3d_resource *resourc
struct wined3d_cs_unmap *op;
HRESULT hr;
@ -31,7 +31,7 @@ index 2a255060dc4..573175ef3c7 100644
op->resource = resource;
op->sub_resource_idx = sub_resource_idx;
diff --git a/dlls/wined3d/resource.c b/dlls/wined3d/resource.c
index 51da49077ed..1a2671ceb92 100644
index 1f465fa1f2f..b520af1bc27 100644
--- a/dlls/wined3d/resource.c
+++ b/dlls/wined3d/resource.c
@@ -356,6 +356,8 @@ HRESULT CDECL wined3d_resource_map(struct wined3d_resource *resource, unsigned i

View File

@ -1,141 +0,0 @@
From 6473e74391c83d4035556251a0ff2e0c6904d6be Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20D=C3=B6singer?= <stefan@codeweavers.com>
Date: Fri, 11 Oct 2013 10:11:13 +0200
Subject: wined3d: Delete GL contexts through the CS in reset.
Let's see if this fixes the remaining fglrx crashes...
---
dlls/wined3d/cs.c | 27 ++++++++++++++++++++++++++-
dlls/wined3d/device.c | 25 ++++++++++++++-----------
dlls/wined3d/wined3d_private.h | 2 ++
3 files changed, 42 insertions(+), 12 deletions(-)
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
index 55c175ef093..cf59192bc4f 100644
--- a/dlls/wined3d/cs.c
+++ b/dlls/wined3d/cs.c
@@ -93,6 +93,7 @@ enum wined3d_cs_op
WINED3D_CS_OP_BUFFER_COPY,
WINED3D_CS_OP_CREATE_BUFFER_VIEW,
WINED3D_CS_OP_CREATE_TEXTURE_VIEW,
+ WINED3D_CS_OP_DELETE_GL_CONTEXTS,
WINED3D_CS_OP_STOP,
};
@@ -521,6 +522,11 @@ struct wined3d_cs_create_texture_view
const struct wined3d_format *view_format;
};
+struct wined3d_cs_delete_gl_contexts
+{
+ enum wined3d_cs_op opcode;
+};
+
static inline BOOL wined3d_cs_process_block(struct wined3d_cs *cs, struct wined3d_cs_block *block);
static void wined3d_cs_mt_submit(struct wined3d_cs *cs);
@@ -2628,6 +2634,25 @@ void wined3d_cs_emit_create_texture_view(struct wined3d_cs *cs, struct wined3d_g
cs->ops->submit_and_wait(cs);
}
+static UINT wined3d_cs_exec_delete_gl_contexts(struct wined3d_cs *cs, const void *data)
+{
+ const struct wined3d_cs_delete_gl_contexts *op = data;
+
+ device_delete_opengl_contexts_cs(cs->device);
+
+ return sizeof(*op);
+}
+
+void wined3d_cs_emit_delete_opengl_contexts(struct wined3d_cs *cs)
+{
+ struct wined3d_cs_delete_gl_contexts *op;
+
+ op = cs->ops->require_space(cs, sizeof(*op));
+ op->opcode = WINED3D_CS_OP_DELETE_GL_CONTEXTS;
+
+ cs->ops->submit_and_wait(cs);
+}
+
static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void *data) =
{
/* WINED3D_CS_OP_FENCE */ wined3d_cs_exec_fence,
@@ -2686,7 +2711,7 @@ static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void
/* WINED3D_CS_OP_BUFFER_COPY */ wined3d_cs_exec_buffer_copy,
/* WINED3D_CS_OP_CREATE_BUFFER_VIEW */ wined3d_cs_exec_create_buffer_view,
/* WINED3D_CS_OP_CREATE_TEXTURE_VIEW */ wined3d_cs_exec_create_texture_view,
-
+ /* WINED3D_CS_OP_DELETE_GL_CONTEXTS */ wined3d_cs_exec_delete_gl_contexts,
};
static void *wined3d_cs_st_require_space(struct wined3d_cs *cs, size_t size)
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index adcd8dd2486..b95c7837139 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -971,21 +971,11 @@ static void device_init_swapchain_state(struct wined3d_device *device, struct wi
wined3d_device_set_render_state(device, WINED3D_RS_ZENABLE, ds_enable);
}
-static void wined3d_device_delete_opengl_contexts(struct wined3d_device *device)
+void device_delete_opengl_contexts_cs(struct wined3d_device *device)
{
- struct wined3d_resource *resource, *cursor;
struct wined3d_context *context;
struct wined3d_shader *shader;
- LIST_FOR_EACH_ENTRY_SAFE(resource, cursor, &device->resources, struct wined3d_resource, resource_list_entry)
- {
- TRACE("Unloading resource %p.\n", resource);
- wined3d_cs_emit_unload_resource(device->cs, resource);
- }
-
- if (wined3d_settings.cs_multithreaded)
- device->cs->ops->submit_and_wait(device->cs);
-
LIST_FOR_EACH_ENTRY(shader, &device->shaders, struct wined3d_shader, shader_list_entry)
{
device->shader_backend->shader_destroy(shader);
@@ -1007,6 +997,19 @@ static void wined3d_device_delete_opengl_contexts(struct wined3d_device *device)
}
}
+static void wined3d_device_delete_opengl_contexts(struct wined3d_device *device)
+{
+ struct wined3d_resource *resource, *cursor;
+
+ LIST_FOR_EACH_ENTRY_SAFE(resource, cursor, &device->resources, struct wined3d_resource, resource_list_entry)
+ {
+ TRACE("Unloading resource %p.\n", resource);
+ wined3d_cs_emit_unload_resource(device->cs, resource);
+ }
+
+ wined3d_cs_emit_delete_opengl_contexts(device->cs);
+}
+
static HRESULT create_primary_opengl_context(struct wined3d_device *device, struct wined3d_swapchain *swapchain)
{
HRESULT hr;
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index dad79e97ae2..abb4ce0ec52 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -2705,6 +2705,7 @@ void device_invalidate_state(const struct wined3d_device *device, DWORD state) D
void device_exec_update_texture(struct wined3d_context *context, struct wined3d_texture *src_texture,
struct wined3d_texture *dst_texture) DECLSPEC_HIDDEN;
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) DECLSPEC_HIDDEN;
struct wined3d_gl_bo *wined3d_device_get_bo(struct wined3d_device *device, UINT size, GLenum gl_usage,
GLenum type_hint, struct wined3d_context *context) DECLSPEC_HIDDEN;
void wined3d_device_release_bo(struct wined3d_device *device, struct wined3d_gl_bo *bo,
@@ -3267,6 +3268,7 @@ HRESULT wined3d_cs_emit_create_buffer_view(struct wined3d_cs *cs, struct wined3d
void wined3d_cs_emit_create_dummy_textures(struct wined3d_cs *cs) DECLSPEC_HIDDEN;
HRESULT wined3d_cs_emit_create_swapchain_context(struct wined3d_cs *cs,
struct wined3d_swapchain *swapchain) DECLSPEC_HIDDEN;
+void wined3d_cs_emit_delete_opengl_contexts(struct wined3d_cs *cs) DECLSPEC_HIDDEN;
void wined3d_cs_emit_create_texture_view(struct wined3d_cs *cs, struct wined3d_gl_view *view,
GLenum view_target, const struct wined3d_view_desc *desc, struct wined3d_texture *texture,
const struct wined3d_format *view_format) DECLSPEC_HIDDEN;
--
2.11.0

View File

@ -1,4 +1,4 @@
From 07c26b40498ac69317285d545f30856779a20330 Mon Sep 17 00:00:00 2001
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.
@ -10,10 +10,10 @@ Subject: wined3d: Use priority queue for query polls.
3 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
index 573175ef3c7..c4bedb48153 100644
index 3e7defdeb1b..a5a6fc0fa4a 100644
--- a/dlls/wined3d/cs.c
+++ b/dlls/wined3d/cs.c
@@ -1767,6 +1767,8 @@ static UINT wined3d_cs_exec_query_issue(struct wined3d_cs *cs, const void *data)
@@ -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);
@ -22,7 +22,7 @@ index 573175ef3c7..c4bedb48153 100644
return sizeof(*op);
}
@@ -1779,6 +1781,8 @@ void wined3d_cs_emit_query_issue(struct wined3d_cs *cs, struct wined3d_query *qu
@@ -1706,6 +1708,8 @@ void wined3d_cs_emit_query_issue(struct wined3d_cs *cs, struct wined3d_query *qu
op->query = query;
op->flags = flags;
@ -31,7 +31,7 @@ index 573175ef3c7..c4bedb48153 100644
cs->ops->submit(cs);
}
@@ -1797,7 +1801,7 @@ BOOL wined3d_cs_emit_query_poll(struct wined3d_cs *cs, struct wined3d_query *que
@@ -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;
@ -41,7 +41,7 @@ index 573175ef3c7..c4bedb48153 100644
op->query = query;
op->flags = flags;
diff --git a/dlls/wined3d/query.c b/dlls/wined3d/query.c
index b26350ff2b5..2d9999ef557 100644
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
@ -52,7 +52,7 @@ index b26350ff2b5..2d9999ef557 100644
}
static struct wined3d_event_query *wined3d_event_query_from_query(struct wined3d_query *query)
@@ -347,6 +348,8 @@ HRESULT CDECL wined3d_query_get_data(struct wined3d_query *query,
@@ -350,6 +351,8 @@ HRESULT CDECL wined3d_query_get_data(struct wined3d_query *query,
return WINED3DERR_INVALIDCALL;
}
@ -62,10 +62,10 @@ index b26350ff2b5..2d9999ef557 100644
return S_FALSE;
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 04241073afe..cfbd1e0b70d 100644
index 43b3146f6f8..ba371f13d8d 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -1460,6 +1460,7 @@ struct wined3d_query
@@ -1500,6 +1500,7 @@ struct wined3d_query
const void *data;
DWORD data_size;
const struct wined3d_query_ops *query_ops;

View File

@ -1,4 +1,4 @@
From 5052e38c2feb979efdc9cbaf52c061ce36972e1f Mon Sep 17 00:00:00 2001
From 4ae35339757ad700925f580929075f2395a8092e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20D=C3=B6singer?= <stefan@codeweavers.com>
Date: Thu, 4 Jul 2013 23:50:20 +0200
Subject: wined3d: Don't call glFinish before swapping
@ -10,10 +10,10 @@ is CSified. Right now I need it for performance testing.
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dlls/wined3d/swapchain.c b/dlls/wined3d/swapchain.c
index a54bcb41319..17fdf13e7bb 100644
index 1566d21a944..5963d7222f2 100644
--- a/dlls/wined3d/swapchain.c
+++ b/dlls/wined3d/swapchain.c
@@ -586,7 +586,7 @@ static void swapchain_gl_present(struct wined3d_swapchain *swapchain,
@@ -588,7 +588,7 @@ static void swapchain_gl_present(struct wined3d_swapchain *swapchain,
swapchain_blit(swapchain, context, src_rect, dst_rect);
}

View File

@ -1,4 +1,4 @@
From 83d8362bfb2253c31b57f3ef6f7b68b239427b4d Mon Sep 17 00:00:00 2001
From a0962ea827e829d8fe589cc0f8c3893341e2c3b6 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.
@ -29,15 +29,15 @@ 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 | 43 ++++++++++++++++++++++++++++++++++++++++++
dlls/wined3d/cs.c | 47 ++++++++++++++++++++++++++++++++++++++++++
dlls/wined3d/wined3d_private.h | 5 +++++
2 files changed, 48 insertions(+)
2 files changed, 52 insertions(+)
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
index c4bedb48153..95b86dc12a7 100644
index a5a6fc0fa4a..1c9d8e1d192 100644
--- a/dlls/wined3d/cs.c
+++ b/dlls/wined3d/cs.c
@@ -563,9 +563,33 @@ static struct wined3d_cs_block *wined3d_cs_list_dequeue(struct wined3d_cs_list *
@@ -2564,9 +2564,33 @@ static struct wined3d_cs_block *wined3d_cs_list_dequeue(struct wined3d_cs_list *
return LIST_ENTRY(head, struct wined3d_cs_block, entry);
}
@ -64,14 +64,14 @@ index c4bedb48153..95b86dc12a7 100644
+ }
+}
+
static struct wined3d_cs_block *wined3d_cs_dequeue_block(struct wined3d_cs *cs)
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 (;;)
@@ -574,6 +598,13 @@ static struct wined3d_cs_block *wined3d_cs_dequeue_block(struct wined3d_cs *cs)
@@ -2575,6 +2599,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;
@ -85,45 +85,62 @@ index c4bedb48153..95b86dc12a7 100644
}
}
@@ -2831,7 +2862,12 @@ static void wined3d_cs_mt_submit(struct wined3d_cs *cs)
if (cs->thread_id == GetCurrentThreadId())
wined3d_cs_process_block(cs, block);
else
+ {
wined3d_cs_list_enqueue(block->list, block);
@@ -2655,6 +2686,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);
+ }
+ if (InterlockedCompareExchange(&cs->waiting_for_event, FALSE, TRUE))
+ SetEvent(cs->event);
}
static void wined3d_cs_mt_submit_and_wait(struct wined3d_cs *cs)
@@ -2929,6 +2965,12 @@ struct wined3d_cs *wined3d_cs_create(struct wined3d_device *device)
if (!(cs->data = HeapAlloc(GetProcessHeap(), 0, cs->data_size)))
goto err;
@@ -2670,6 +2704,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));
@@ -2766,6 +2803,14 @@ struct wined3d_cs *wined3d_cs_create(struct wined3d_device *device)
return NULL;
}
+ if (!(cs->event = CreateEventW(NULL, FALSE, FALSE, NULL)))
+ {
+ ERR("Failed to allocate event, err %#x.\n", GetLastError());
+ goto err;
+ state_cleanup(&cs->state);
+ HeapFree(GetProcessHeap(), 0, cs->data);
+ HeapFree(GetProcessHeap(), 0, cs);
+ return NULL;
+ }
+
if ((cs->tls_idx = TlsAlloc()) == TLS_OUT_OF_INDEXES)
if (wined3d_settings.cs_multithreaded)
{
ERR("Failed to allocate cs TLS index, err %#x.\n", GetLastError());
@@ -2954,6 +2996,7 @@ struct wined3d_cs *wined3d_cs_create(struct wined3d_device *device)
cs->ops = &wined3d_cs_mt_ops;
@@ -2778,6 +2823,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->data);
HeapFree(GetProcessHeap(), 0, cs);
return NULL;
@@ -2802,6 +2848,7 @@ void wined3d_cs_destroy(struct wined3d_cs *cs)
wined3d_cs_list_cleanup(&cs->free_list);
}
err:
state_cleanup(&cs->state);
+ if (cs->event) CloseHandle(cs->event);
if (cs->tls_idx != TLS_OUT_OF_INDEXES) TlsFree(cs->tls_idx);
+ CloseHandle(cs->event);
HeapFree(GetProcessHeap(), 0, cs->data);
HeapFree(GetProcessHeap(), 0, cs);
}
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index cfbd1e0b70d..e1fdaa6574b 100644
index ba371f13d8d..10a7b4a8660 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -3188,6 +3188,8 @@ struct wined3d_cs_ops
@@ -3230,6 +3230,8 @@ struct wined3d_cs_ops
void (*submit_and_wait)(struct wined3d_cs *cs);
};
@ -132,7 +149,7 @@ index cfbd1e0b70d..e1fdaa6574b 100644
struct wined3d_cs
{
const struct wined3d_cs_ops *ops;
@@ -3204,6 +3206,9 @@ struct wined3d_cs
@@ -3247,6 +3249,9 @@ struct wined3d_cs
struct wined3d_cs_list exec_prio_list;
LONG pending_presents;

View File

@ -1,4 +1,4 @@
From 736ba31fcff8fccb5fee8c6e23dcb96529153579 Mon Sep 17 00:00:00 2001
From 061c839f5bc943c509341225fa95973767f57664 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20D=C3=B6singer?= <stefan@codeweavers.com>
Date: Tue, 1 Oct 2013 21:30:07 +0200
Subject: wined3d: Unset some objects in state_init_default.
@ -11,10 +11,10 @@ FIXME2: Is this still needed?
1 file changed, 8 insertions(+)
diff --git a/dlls/wined3d/stateblock.c b/dlls/wined3d/stateblock.c
index 913d630cf97..572cecdbc0c 100644
index a823ccb3168..463ccc91561 100644
--- a/dlls/wined3d/stateblock.c
+++ b/dlls/wined3d/stateblock.c
@@ -1279,7 +1279,15 @@ static void state_init_default(struct wined3d_state *state, const struct wined3d
@@ -1342,7 +1342,15 @@ static void state_init_default(struct wined3d_state *state, const struct wined3d
state->sampler_states[i][WINED3D_SAMP_ELEMENT_INDEX] = 0;
/* TODO: Vertex offset in the presampled displacement map. */
state->sampler_states[i][WINED3D_SAMP_DMAP_OFFSET] = 0;

View File

@ -1,4 +1,4 @@
From d9df2e94096c70f981ac65d3a687e3a2c67650a7 Mon Sep 17 00:00:00 2001
From 125cc8384a0f759df49cbf0e753877c3057ba2d1 Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Wed, 8 Feb 2017 11:57:52 +0100
Subject: wined3d: Use priority queue for get_dc / release_dc.
@ -9,10 +9,10 @@ Subject: wined3d: Use priority queue for get_dc / release_dc.
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
index 95b86dc12a7..444701544f9 100644
index 1c9d8e1d192..1d2d9d7b990 100644
--- a/dlls/wined3d/cs.c
+++ b/dlls/wined3d/cs.c
@@ -2406,7 +2406,7 @@ HRESULT wined3d_cs_emit_get_dc(struct wined3d_cs *cs, struct wined3d_texture *te
@@ -2210,7 +2210,7 @@ HRESULT wined3d_cs_emit_get_dc(struct wined3d_cs *cs, struct wined3d_texture *te
struct wined3d_cs_get_release_dc *op;
HRESULT hr;
@ -21,7 +21,7 @@ index 95b86dc12a7..444701544f9 100644
op->opcode = WINED3D_CS_OP_GET_DC;
op->texture = texture;
op->sub_resource_idx = sub_resource_idx;
@@ -2432,7 +2432,7 @@ HRESULT wined3d_cs_emit_release_dc(struct wined3d_cs *cs, struct wined3d_texture
@@ -2236,7 +2236,7 @@ HRESULT wined3d_cs_emit_release_dc(struct wined3d_cs *cs, struct wined3d_texture
struct wined3d_cs_get_release_dc *op;
HRESULT hr;
@ -31,10 +31,10 @@ index 95b86dc12a7..444701544f9 100644
op->texture = texture;
op->sub_resource_idx = sub_resource_idx;
diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c
index 02119dee645..72c790edf9b 100644
index bff7452e773..18ae2ae23cf 100644
--- a/dlls/wined3d/texture.c
+++ b/dlls/wined3d/texture.c
@@ -3468,6 +3468,8 @@ HRESULT CDECL wined3d_texture_get_dc(struct wined3d_texture *texture, unsigned i
@@ -3536,6 +3536,8 @@ HRESULT CDECL wined3d_texture_get_dc(struct wined3d_texture *texture, unsigned i
if (texture->resource.map_count && !(texture->flags & WINED3D_TEXTURE_GET_DC_LENIENT))
return WINED3DERR_INVALIDCALL;
@ -43,7 +43,7 @@ index 02119dee645..72c790edf9b 100644
hr = wined3d_cs_emit_get_dc(device->cs, texture, sub_resource_idx);
if (FAILED(hr))
return hr;
@@ -3524,5 +3526,7 @@ HRESULT CDECL wined3d_texture_release_dc(struct wined3d_texture *texture, unsign
@@ -3592,5 +3594,7 @@ HRESULT CDECL wined3d_texture_release_dc(struct wined3d_texture *texture, unsign
return WINED3DERR_INVALIDCALL;
}

View File

@ -1,4 +1,4 @@
From e1eaf7bf2dd1a7bfedad34b222aaa83423781191 Mon Sep 17 00:00:00 2001
From 6480f1d7a8241aaba2173ddf92d711cf0f479db4 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.
@ -8,10 +8,10 @@ Subject: wined3d: Do not immediately submit stateblock updates.
1 file changed, 58 deletions(-)
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
index 6ea1ef1b089..e108ab0bcbc 100644
index 1d2d9d7b990..1fbf48ec94b 100644
--- a/dlls/wined3d/cs.c
+++ b/dlls/wined3d/cs.c
@@ -1021,8 +1021,6 @@ void wined3d_cs_emit_set_predication(struct wined3d_cs *cs, struct wined3d_query
@@ -880,8 +880,6 @@ void wined3d_cs_emit_set_predication(struct wined3d_cs *cs, struct wined3d_query
op->opcode = WINED3D_CS_OP_SET_PREDICATION;
op->predicate = predicate;
op->value = value;
@ -20,7 +20,7 @@ index 6ea1ef1b089..e108ab0bcbc 100644
}
static UINT wined3d_cs_exec_set_viewport(struct wined3d_cs *cs, const void *data)
@@ -1042,8 +1040,6 @@ void wined3d_cs_emit_set_viewport(struct wined3d_cs *cs, const struct wined3d_vi
@@ -901,8 +899,6 @@ void wined3d_cs_emit_set_viewport(struct wined3d_cs *cs, const struct wined3d_vi
op = cs->ops->require_space(cs, sizeof(*op), 0);
op->opcode = WINED3D_CS_OP_SET_VIEWPORT;
op->viewport = *viewport;
@ -29,7 +29,7 @@ index 6ea1ef1b089..e108ab0bcbc 100644
}
static UINT wined3d_cs_exec_set_scissor_rect(struct wined3d_cs *cs, const void *data)
@@ -1063,8 +1059,6 @@ void wined3d_cs_emit_set_scissor_rect(struct wined3d_cs *cs, const RECT *rect)
@@ -922,8 +918,6 @@ void wined3d_cs_emit_set_scissor_rect(struct wined3d_cs *cs, const RECT *rect)
op = cs->ops->require_space(cs, sizeof(*op), 0);
op->opcode = WINED3D_CS_OP_SET_SCISSOR_RECT;
op->rect = *rect;
@ -38,7 +38,7 @@ index 6ea1ef1b089..e108ab0bcbc 100644
}
static UINT wined3d_cs_exec_set_rendertarget_view(struct wined3d_cs *cs, const void *data)
@@ -1086,8 +1080,6 @@ void wined3d_cs_emit_set_rendertarget_view(struct wined3d_cs *cs, unsigned int v
@@ -945,8 +939,6 @@ void wined3d_cs_emit_set_rendertarget_view(struct wined3d_cs *cs, unsigned int v
op->opcode = WINED3D_CS_OP_SET_RENDERTARGET_VIEW;
op->view_idx = view_idx;
op->view = view;
@ -47,7 +47,7 @@ index 6ea1ef1b089..e108ab0bcbc 100644
}
static UINT wined3d_cs_exec_set_depth_stencil_view(struct wined3d_cs *cs, const void *data)
@@ -1136,8 +1128,6 @@ void wined3d_cs_emit_set_depth_stencil_view(struct wined3d_cs *cs, struct wined3
@@ -995,8 +987,6 @@ void wined3d_cs_emit_set_depth_stencil_view(struct wined3d_cs *cs, struct wined3
op = cs->ops->require_space(cs, sizeof(*op), 0);
op->opcode = WINED3D_CS_OP_SET_DEPTH_STENCIL_VIEW;
op->view = view;
@ -56,7 +56,7 @@ index 6ea1ef1b089..e108ab0bcbc 100644
}
static UINT wined3d_cs_exec_set_vertex_declaration(struct wined3d_cs *cs, const void *data)
@@ -1157,8 +1147,6 @@ void wined3d_cs_emit_set_vertex_declaration(struct wined3d_cs *cs, struct wined3
@@ -1016,8 +1006,6 @@ void wined3d_cs_emit_set_vertex_declaration(struct wined3d_cs *cs, struct wined3
op = cs->ops->require_space(cs, sizeof(*op), 0);
op->opcode = WINED3D_CS_OP_SET_VERTEX_DECLARATION;
op->declaration = declaration;
@ -65,7 +65,7 @@ index 6ea1ef1b089..e108ab0bcbc 100644
}
static UINT wined3d_cs_exec_set_stream_source(struct wined3d_cs *cs, const void *data)
@@ -1194,8 +1182,6 @@ void wined3d_cs_emit_set_stream_source(struct wined3d_cs *cs, UINT stream_idx,
@@ -1053,8 +1041,6 @@ void wined3d_cs_emit_set_stream_source(struct wined3d_cs *cs, UINT stream_idx,
op->buffer = buffer;
op->offset = offset;
op->stride = stride;
@ -74,7 +74,7 @@ index 6ea1ef1b089..e108ab0bcbc 100644
}
static UINT wined3d_cs_exec_set_stream_source_freq(struct wined3d_cs *cs, const void *data)
@@ -1221,8 +1207,6 @@ void wined3d_cs_emit_set_stream_source_freq(struct wined3d_cs *cs, UINT stream_i
@@ -1080,8 +1066,6 @@ void wined3d_cs_emit_set_stream_source_freq(struct wined3d_cs *cs, UINT stream_i
op->stream_idx = stream_idx;
op->frequency = frequency;
op->flags = flags;
@ -83,7 +83,7 @@ index 6ea1ef1b089..e108ab0bcbc 100644
}
static UINT wined3d_cs_exec_set_stream_output(struct wined3d_cs *cs, const void *data)
@@ -1254,8 +1238,6 @@ void wined3d_cs_emit_set_stream_output(struct wined3d_cs *cs, UINT stream_idx,
@@ -1113,8 +1097,6 @@ void wined3d_cs_emit_set_stream_output(struct wined3d_cs *cs, UINT stream_idx,
op->stream_idx = stream_idx;
op->buffer = buffer;
op->offset = offset;
@ -92,7 +92,7 @@ index 6ea1ef1b089..e108ab0bcbc 100644
}
static UINT wined3d_cs_exec_set_index_buffer(struct wined3d_cs *cs, const void *data)
@@ -1288,8 +1270,6 @@ void wined3d_cs_emit_set_index_buffer(struct wined3d_cs *cs, struct wined3d_buff
@@ -1147,8 +1129,6 @@ void wined3d_cs_emit_set_index_buffer(struct wined3d_cs *cs, struct wined3d_buff
op->buffer = buffer;
op->format_id = format_id;
op->offset = offset;
@ -101,7 +101,7 @@ index 6ea1ef1b089..e108ab0bcbc 100644
}
static UINT wined3d_cs_exec_set_constant_buffer(struct wined3d_cs *cs, const void *data)
@@ -1319,8 +1299,6 @@ void wined3d_cs_emit_set_constant_buffer(struct wined3d_cs *cs, enum wined3d_sha
@@ -1178,8 +1158,6 @@ void wined3d_cs_emit_set_constant_buffer(struct wined3d_cs *cs, enum wined3d_sha
op->type = type;
op->cb_idx = cb_idx;
op->buffer = buffer;
@ -110,7 +110,7 @@ index 6ea1ef1b089..e108ab0bcbc 100644
}
static UINT wined3d_cs_exec_set_texture(struct wined3d_cs *cs, const void *data)
@@ -1412,8 +1390,6 @@ void wined3d_cs_emit_set_texture(struct wined3d_cs *cs, UINT stage, struct wined
@@ -1271,8 +1249,6 @@ void wined3d_cs_emit_set_texture(struct wined3d_cs *cs, UINT stage, struct wined
op->opcode = WINED3D_CS_OP_SET_TEXTURE;
op->stage = stage;
op->texture = texture;
@ -119,7 +119,7 @@ index 6ea1ef1b089..e108ab0bcbc 100644
}
static UINT wined3d_cs_exec_set_shader_resource_view(struct wined3d_cs *cs, const void *data)
@@ -1437,8 +1413,6 @@ void wined3d_cs_emit_set_shader_resource_view(struct wined3d_cs *cs, enum wined3
@@ -1304,8 +1280,6 @@ void wined3d_cs_emit_set_shader_resource_view(struct wined3d_cs *cs, enum wined3
op->type = type;
op->view_idx = view_idx;
op->view = view;
@ -128,7 +128,7 @@ index 6ea1ef1b089..e108ab0bcbc 100644
}
static UINT wined3d_cs_exec_set_unordered_access_view(struct wined3d_cs *cs, const void *data)
@@ -1469,8 +1443,6 @@ void wined3d_cs_emit_set_unordered_access_view(struct wined3d_cs *cs, enum wined
@@ -1336,8 +1310,6 @@ void wined3d_cs_emit_set_unordered_access_view(struct wined3d_cs *cs, enum wined
op->pipeline = pipeline;
op->view_idx = view_idx;
op->view = view;
@ -137,7 +137,7 @@ index 6ea1ef1b089..e108ab0bcbc 100644
}
static UINT wined3d_cs_exec_set_sampler(struct wined3d_cs *cs, const void *data)
@@ -1493,8 +1465,6 @@ void wined3d_cs_emit_set_sampler(struct wined3d_cs *cs, enum wined3d_shader_type
@@ -1360,8 +1332,6 @@ void wined3d_cs_emit_set_sampler(struct wined3d_cs *cs, enum wined3d_shader_type
op->type = type;
op->sampler_idx = sampler_idx;
op->sampler = sampler;
@ -146,7 +146,7 @@ index 6ea1ef1b089..e108ab0bcbc 100644
}
static UINT wined3d_cs_exec_set_shader(struct wined3d_cs *cs, const void *data)
@@ -1517,8 +1487,6 @@ void wined3d_cs_emit_set_shader(struct wined3d_cs *cs, enum wined3d_shader_type
@@ -1384,8 +1354,6 @@ void wined3d_cs_emit_set_shader(struct wined3d_cs *cs, enum wined3d_shader_type
op->opcode = WINED3D_CS_OP_SET_SHADER;
op->type = type;
op->shader = shader;
@ -155,7 +155,7 @@ index 6ea1ef1b089..e108ab0bcbc 100644
}
static UINT wined3d_cs_exec_set_rasterizer_state(struct wined3d_cs *cs, const void *data)
@@ -1539,8 +1507,6 @@ void wined3d_cs_emit_set_rasterizer_state(struct wined3d_cs *cs,
@@ -1406,8 +1374,6 @@ void wined3d_cs_emit_set_rasterizer_state(struct wined3d_cs *cs,
op = cs->ops->require_space(cs, sizeof(*op), 0);
op->opcode = WINED3D_CS_OP_SET_RASTERIZER_STATE;
op->state = rasterizer_state;
@ -164,7 +164,7 @@ index 6ea1ef1b089..e108ab0bcbc 100644
}
static UINT wined3d_cs_exec_set_render_state(struct wined3d_cs *cs, const void *data)
@@ -1561,8 +1527,6 @@ void wined3d_cs_emit_set_render_state(struct wined3d_cs *cs, enum wined3d_render
@@ -1428,8 +1394,6 @@ void wined3d_cs_emit_set_render_state(struct wined3d_cs *cs, enum wined3d_render
op->opcode = WINED3D_CS_OP_SET_RENDER_STATE;
op->state = state;
op->value = value;
@ -173,7 +173,7 @@ index 6ea1ef1b089..e108ab0bcbc 100644
}
static UINT wined3d_cs_exec_set_texture_state(struct wined3d_cs *cs, const void *data)
@@ -1585,8 +1549,6 @@ void wined3d_cs_emit_set_texture_state(struct wined3d_cs *cs, UINT stage,
@@ -1452,8 +1416,6 @@ void wined3d_cs_emit_set_texture_state(struct wined3d_cs *cs, UINT stage,
op->stage = stage;
op->state = state;
op->value = value;
@ -182,7 +182,7 @@ index 6ea1ef1b089..e108ab0bcbc 100644
}
static UINT wined3d_cs_exec_set_sampler_state(struct wined3d_cs *cs, const void *data)
@@ -1609,8 +1571,6 @@ void wined3d_cs_emit_set_sampler_state(struct wined3d_cs *cs, UINT sampler_idx,
@@ -1476,8 +1438,6 @@ void wined3d_cs_emit_set_sampler_state(struct wined3d_cs *cs, UINT sampler_idx,
op->sampler_idx = sampler_idx;
op->state = state;
op->value = value;
@ -191,7 +191,7 @@ index 6ea1ef1b089..e108ab0bcbc 100644
}
static UINT wined3d_cs_exec_set_transform(struct wined3d_cs *cs, const void *data)
@@ -1633,8 +1593,6 @@ void wined3d_cs_emit_set_transform(struct wined3d_cs *cs, enum wined3d_transform
@@ -1500,8 +1460,6 @@ void wined3d_cs_emit_set_transform(struct wined3d_cs *cs, enum wined3d_transform
op->opcode = WINED3D_CS_OP_SET_TRANSFORM;
op->state = state;
op->matrix = *matrix;
@ -200,7 +200,7 @@ index 6ea1ef1b089..e108ab0bcbc 100644
}
static UINT wined3d_cs_exec_set_clip_plane(struct wined3d_cs *cs, const void *data)
@@ -1655,8 +1613,6 @@ void wined3d_cs_emit_set_clip_plane(struct wined3d_cs *cs, UINT plane_idx, const
@@ -1522,8 +1480,6 @@ void wined3d_cs_emit_set_clip_plane(struct wined3d_cs *cs, UINT plane_idx, const
op->opcode = WINED3D_CS_OP_SET_CLIP_PLANE;
op->plane_idx = plane_idx;
op->plane = *plane;
@ -209,7 +209,7 @@ index 6ea1ef1b089..e108ab0bcbc 100644
}
static UINT wined3d_cs_exec_set_color_key(struct wined3d_cs *cs, const void *data)
@@ -1740,8 +1696,6 @@ void wined3d_cs_emit_set_color_key(struct wined3d_cs *cs, struct wined3d_texture
@@ -1607,8 +1563,6 @@ void wined3d_cs_emit_set_color_key(struct wined3d_cs *cs, struct wined3d_texture
}
else
op->set = 0;
@ -218,7 +218,7 @@ index 6ea1ef1b089..e108ab0bcbc 100644
}
static UINT wined3d_cs_exec_set_material(struct wined3d_cs *cs, const void *data)
@@ -1761,8 +1715,6 @@ void wined3d_cs_emit_set_material(struct wined3d_cs *cs, const struct wined3d_ma
@@ -1628,8 +1582,6 @@ void wined3d_cs_emit_set_material(struct wined3d_cs *cs, const struct wined3d_ma
op = cs->ops->require_space(cs, sizeof(*op), 0);
op->opcode = WINED3D_CS_OP_SET_MATERIAL;
op->material = *material;
@ -227,7 +227,7 @@ index 6ea1ef1b089..e108ab0bcbc 100644
}
static UINT wined3d_cs_exec_reset_state(struct wined3d_cs *cs, const void *data)
@@ -1785,8 +1737,6 @@ void wined3d_cs_emit_reset_state(struct wined3d_cs *cs)
@@ -1652,8 +1604,6 @@ 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;
@ -235,8 +235,8 @@ index 6ea1ef1b089..e108ab0bcbc 100644
- cs->ops->submit(cs);
}
static UINT wined3d_cs_exec_destroy_object(struct wined3d_cs *cs, const void *data)
@@ -2045,8 +1995,6 @@ void wined3d_cs_emit_push_constants(struct wined3d_cs *cs, enum wined3d_push_con
static UINT wined3d_cs_exec_callback(struct wined3d_cs *cs, const void *data)
@@ -1901,8 +1851,6 @@ void wined3d_cs_emit_push_constants(struct wined3d_cs *cs, enum wined3d_push_con
op->start_idx = start_idx;
op->count = count;
memcpy(op->constants, constants, count * push_constant_info[p].size);
@ -245,7 +245,7 @@ index 6ea1ef1b089..e108ab0bcbc 100644
}
static UINT wined3d_cs_exec_set_primitive_type(struct wined3d_cs *cs, const void *data)
@@ -2071,8 +2019,6 @@ void wined3d_cs_emit_set_primitive_type(struct wined3d_cs *cs, GLenum primitive_
@@ -1927,8 +1875,6 @@ void wined3d_cs_emit_set_primitive_type(struct wined3d_cs *cs, GLenum primitive_
op = cs->ops->require_space(cs, sizeof(*op), 0);
op->opcode = WINED3D_CS_OP_SET_PRIMITIVE_TYPE;
op->gl_primitive_type = primitive_type;
@ -254,7 +254,7 @@ index 6ea1ef1b089..e108ab0bcbc 100644
}
static UINT wined3d_cs_exec_set_light(struct wined3d_cs *cs, const void *data)
@@ -2131,8 +2077,6 @@ void wined3d_cs_emit_set_light(struct wined3d_cs *cs, const struct wined3d_light
@@ -1977,8 +1923,6 @@ void wined3d_cs_emit_set_light(struct wined3d_cs *cs, const struct wined3d_light
op = cs->ops->require_space(cs, sizeof(*op), 0);
op->opcode = WINED3D_CS_OP_SET_LIGHT;
op->light = *light;
@ -263,7 +263,7 @@ index 6ea1ef1b089..e108ab0bcbc 100644
}
static UINT wined3d_cs_exec_set_light_enable(struct wined3d_cs *cs, const void *data)
@@ -2221,8 +2165,6 @@ void wined3d_cs_emit_set_light_enable(struct wined3d_cs *cs, UINT idx, BOOL enab
@@ -2014,8 +1958,6 @@ void wined3d_cs_emit_set_light_enable(struct wined3d_cs *cs, UINT idx, BOOL enab
op->opcode = WINED3D_CS_OP_SET_LIGHT_ENABLE;
op->idx = idx;
op->enable = enable;

View File

@ -1,52 +0,0 @@
From 29e1173cde6166096974dabf1c6795ec41565e14 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Tue, 7 Feb 2017 23:06:10 +0100
Subject: wined3d: Optimize cs queue empty check.
---
dlls/wined3d/cs.c | 3 +++
dlls/wined3d/wined3d_private.h | 1 +
2 files changed, 4 insertions(+)
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
index 4cbab2a91f8..31c82b1b68c 100644
--- a/dlls/wined3d/cs.c
+++ b/dlls/wined3d/cs.c
@@ -542,12 +542,14 @@ static void wined3d_cs_list_enqueue(struct wined3d_cs_list *list, struct wined3d
EnterCriticalSection(&wined3d_cs_list_mutex);
list_add_tail(&list->blocks, &block->entry);
LeaveCriticalSection(&wined3d_cs_list_mutex);
+ InterlockedIncrement(&list->count);
}
static struct wined3d_cs_block *wined3d_cs_list_dequeue(struct wined3d_cs_list *list)
{
struct list *head;
+ if (!list->count) return NULL;
EnterCriticalSection(&wined3d_cs_list_mutex);
if (!(head = list_head(&list->blocks)))
{
@@ -556,6 +558,7 @@ static struct wined3d_cs_block *wined3d_cs_list_dequeue(struct wined3d_cs_list *
}
list_remove(head);
LeaveCriticalSection(&wined3d_cs_list_mutex);
+ InterlockedDecrement(&list->count);
return LIST_ENTRY(head, struct wined3d_cs_block, entry);
}
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 110fbfde605..a99a4513cef 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -3169,6 +3169,7 @@ enum wined3d_push_constants
struct wined3d_cs_list
{
struct list blocks;
+ LONG count;
};
struct wined3d_cs_block
--
2.11.0

View File

@ -1,4 +1,4 @@
From 61a6817b9406946c5ee42dd5e3c4ca4fd6f8415b Mon Sep 17 00:00:00 2001
From 01509cc439709029511b1781878bb6bd8c67a8ab Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Sun, 12 Feb 2017 00:08:28 +0100
Subject: wined3d: Use priority queue for update_sub_resource.
@ -9,10 +9,10 @@ Subject: wined3d: Use priority queue for update_sub_resource.
2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
index 09936328cf4..2aae8ca6a55 100644
index 1fbf48ec94b..7ee2fe18f49 100644
--- a/dlls/wined3d/cs.c
+++ b/dlls/wined3d/cs.c
@@ -2326,7 +2326,7 @@ void wined3d_cs_emit_update_sub_resource(struct wined3d_cs *cs, struct wined3d_r
@@ -2123,7 +2123,7 @@ void wined3d_cs_emit_update_sub_resource(struct wined3d_cs *cs, struct wined3d_r
{
struct wined3d_cs_update_sub_resource *op;
@ -22,10 +22,10 @@ index 09936328cf4..2aae8ca6a55 100644
op->resource = resource;
op->sub_resource_idx = sub_resource_idx;
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index b98780000b0..f5edbbba84b 100644
index 734f818692c..60d24c38319 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -4149,6 +4149,8 @@ void CDECL wined3d_device_update_sub_resource(struct wined3d_device *device, str
@@ -4111,6 +4111,8 @@ 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);

View File

@ -1,4 +1,4 @@
From c220cd6b2f2568bc1055f73f6d74ed6d4fd40988 Mon Sep 17 00:00:00 2001
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.
@ -8,10 +8,10 @@ Subject: wined3d: Use spin lock for cs list critical sections.
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
index 2aae8ca6a55..d78df546e59 100644
index 7ee2fe18f49..41167f49ace 100644
--- a/dlls/wined3d/cs.c
+++ b/dlls/wined3d/cs.c
@@ -600,7 +600,7 @@ static struct wined3d_cs_block *wined3d_cs_dequeue_block(struct wined3d_cs *cs)
@@ -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)
{

View File

@ -0,0 +1,106 @@
From 4e9409d9486ec3598e513f6f5a4a7f1188eb55c6 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/d3d10core/tests/device.c | 2 --
dlls/d3d11/tests/d3d11.c | 2 --
dlls/wined3d/cs.c | 4 ++++
dlls/wined3d/query.c | 6 +++++-
dlls/wined3d/wined3d_private.h | 1 +
5 files changed, 10 insertions(+), 5 deletions(-)
diff --git a/dlls/d3d10core/tests/device.c b/dlls/d3d10core/tests/device.c
index a4b6355d6b9..7b27d9f6a4c 100644
--- a/dlls/d3d10core/tests/device.c
+++ b/dlls/d3d10core/tests/device.c
@@ -7821,7 +7821,6 @@ float4 main(const ps_in v) : SV_TARGET
ID3D10Device_Draw(device, 4, 0);
color = get_texture_color(test_context.backbuffer, 319, 239);
- todo_wine_if(test_data[i].index == 1)
ok(compare_color(color, test_data[i].expected, 1),
"Got unexpected color 0x%08x for index %d.\n", color, test_data[i].index);
}
@@ -9990,7 +9989,6 @@ static void test_line_antialiasing_blending(void)
ID3D10Device_ClearRenderTargetView(device, test_context.backbuffer_rtv, &green.x);
draw_color_quad(&test_context, &red);
- todo_wine
check_texture_color(test_context.backbuffer, 0xe2007fcc, 1);
ID3D10Device_OMSetBlendState(device, NULL, NULL, D3D10_DEFAULT_SAMPLE_MASK);
diff --git a/dlls/d3d11/tests/d3d11.c b/dlls/d3d11/tests/d3d11.c
index bcaa5df3f39..4ebb82d98de 100644
--- a/dlls/d3d11/tests/d3d11.c
+++ b/dlls/d3d11/tests/d3d11.c
@@ -9776,7 +9776,6 @@ float4 main(const ps_in v) : SV_TARGET
ID3D11DeviceContext_UpdateSubresource(context, (ID3D11Resource *)index_cb, 0, NULL, &index, 0, 0);
draw_quad(&test_context);
- todo_wine_if(test_data[i].index == 1)
check_texture_color(test_context.backbuffer, test_data[i].expected, 1);
}
@@ -12028,7 +12027,6 @@ static void test_line_antialiasing_blending(void)
ID3D11DeviceContext_ClearRenderTargetView(context, test_context.backbuffer_rtv, &green.x);
draw_color_quad(&test_context, &red);
- todo_wine
check_texture_color(test_context.backbuffer, 0xe2007fcc, 1);
ID3D11DeviceContext_OMSetBlendState(context, NULL, NULL, D3D11_DEFAULT_SAMPLE_MASK);
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
index 41167f49ace..fba963f045d 100644
--- a/dlls/wined3d/cs.c
+++ b/dlls/wined3d/cs.c
@@ -1641,11 +1641,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 2db6fa8c10d..d6264cec01b 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 10a7b4a8660..7462a3382ca 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -1501,6 +1501,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

View File

@ -1,32 +0,0 @@
From 6c61ec4528c2d9898fe73fc8e8543179ce6a8950 Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Wed, 8 Feb 2017 00:27:11 +0100
Subject: wined3d: Do not allow to disable CSMT.
This would require a single-threaded impl with multiple buffers.
---
dlls/wined3d/wined3d_main.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/dlls/wined3d/wined3d_main.c b/dlls/wined3d/wined3d_main.c
index a8409cfd4b8..4af37efabb6 100644
--- a/dlls/wined3d/wined3d_main.c
+++ b/dlls/wined3d/wined3d_main.c
@@ -328,12 +328,14 @@ static BOOL wined3d_dll_init(HINSTANCE hInstDLL)
TRACE("Disabling 3D support.\n");
wined3d_settings.no_3d = TRUE;
}
+ /*
if (!get_config_key(hkey, appkey, "CSMT", buffer, size)
&& !strcmp(buffer,"disabled"))
{
TRACE("Disabling multithreaded command stream.\n");
wined3d_settings.cs_multithreaded = FALSE;
}
+ */
}
FIXME_(winediag)("Experimental wined3d CSMT feature is currently %s.\n",
--
2.11.0

View File

@ -0,0 +1,24 @@
From 1214019f4faa9b41852a33503f131c2cf86769dd Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Sun, 19 Feb 2017 08:29:23 +0100
Subject: wined3d: Reset context before destruction.
---
dlls/wined3d/device.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index 60d24c38319..c32d967df88 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -1200,6 +1200,7 @@ HRESULT CDECL wined3d_device_uninit_3d(struct wined3d_device *device)
wine_rb_clear(&device->samplers, device_free_sampler, NULL);
+ context_set_current(NULL);
wined3d_device_delete_opengl_contexts(device);
if (device->back_buffer_view)
--
2.11.0

View File

@ -0,0 +1,25 @@
From 8f135be1edd72169ffdf5f1e500909bc75661823 Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Sun, 19 Feb 2017 08:30:44 +0100
Subject: wined3d: Synchronize before resizing swapchain context array.
---
dlls/wined3d/swapchain.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/dlls/wined3d/swapchain.c b/dlls/wined3d/swapchain.c
index 5963d7222f2..f7acf81bde2 100644
--- a/dlls/wined3d/swapchain.c
+++ b/dlls/wined3d/swapchain.c
@@ -1125,6 +1125,8 @@ static struct wined3d_context *swapchain_create_context(struct wined3d_swapchain
TRACE("Creating a new context for swapchain %p, thread %u.\n", swapchain, GetCurrentThreadId());
+ wined3d_cs_emit_sync(swapchain->device->cs);
+
if (!(ctx = context_create(swapchain, swapchain->front_buffer, swapchain->ds_format)))
{
ERR("Failed to create a new context for the swapchain\n");
--
2.11.0

View File

@ -1,207 +0,0 @@
From 155bb71e1a529edabde58682a63e9cd4fb520206 Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Wed, 8 Feb 2017 12:16:37 +0100
Subject: wined3d: Simplify the fence handling.
---
dlls/wined3d/context.c | 2 +-
dlls/wined3d/cs.c | 40 ++++++++++++++++++----------------------
dlls/wined3d/device.c | 2 +-
dlls/wined3d/surface.c | 2 +-
dlls/wined3d/swapchain.c | 4 ++--
dlls/wined3d/wined3d_private.h | 2 ++
6 files changed, 25 insertions(+), 27 deletions(-)
diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c
index 3fac8562d36..d695786ef50 100644
--- a/dlls/wined3d/context.c
+++ b/dlls/wined3d/context.c
@@ -3677,7 +3677,7 @@ struct wined3d_context *context_acquire(const struct wined3d_device *device, str
{
FIXME("Acquiring a GL context from outside the CS thread.\n");
wined3d_cs_emit_glfinish(device->cs);
- device->cs->ops->submit_and_wait(device->cs);
+ wined3d_cs_emit_sync(device->cs);
}
if (current_context && current_context->destroyed)
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
index 444701544f9..dc1dfad5207 100644
--- a/dlls/wined3d/cs.c
+++ b/dlls/wined3d/cs.c
@@ -37,7 +37,7 @@ static CRITICAL_SECTION wined3d_cs_list_mutex = {&wined3d_cs_list_mutex_debug, -
enum wined3d_cs_op
{
- WINED3D_CS_OP_FENCE,
+ WINED3D_CS_OP_SYNC,
WINED3D_CS_OP_PRESENT,
WINED3D_CS_OP_CLEAR,
WINED3D_CS_OP_DISPATCH,
@@ -375,10 +375,9 @@ struct wined3d_cs_stop
enum wined3d_cs_op opcode;
};
-struct wined3d_cs_fence
+struct wined3d_cs_sync
{
enum wined3d_cs_op opcode;
- BOOL *signalled;
};
struct wined3d_cs_finish
@@ -639,28 +638,24 @@ static struct wined3d_cs_block *wined3d_cs_get_block(struct wined3d_cs *cs, stru
block->pos = 0;
block->list = list;
+ block->fence = NULL;
return block;
}
-static UINT wined3d_cs_exec_fence(struct wined3d_cs *cs, const void *data)
+static UINT wined3d_cs_exec_sync(struct wined3d_cs *cs, const void *data)
{
- const struct wined3d_cs_fence *op = data;
-
- InterlockedExchange(op->signalled, TRUE);
-
- return sizeof(*op);
+ return sizeof(struct wined3d_cs_sync);
}
-static void wined3d_cs_emit_fence(struct wined3d_cs *cs, BOOL *signalled)
+void wined3d_cs_emit_sync(struct wined3d_cs *cs)
{
- struct wined3d_cs_fence *op;
-
- *signalled = FALSE;
+ struct wined3d_cs_sync *op;
op = cs->ops->require_space(cs, sizeof(*op), 0);
- op->opcode = WINED3D_CS_OP_FENCE;
- op->signalled = signalled;
+ op->opcode = WINED3D_CS_OP_SYNC;
+
+ cs->ops->submit_and_wait(cs);
}
static UINT wined3d_cs_exec_present(struct wined3d_cs *cs, const void *data)
@@ -2738,7 +2733,7 @@ void wined3d_cs_emit_map_vertex_buffers(struct wined3d_cs *cs, UINT src_start_id
static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void *data) =
{
- /* WINED3D_CS_OP_FENCE */ wined3d_cs_exec_fence,
+ /* WINED3D_CS_OP_SYNC */ wined3d_cs_exec_sync,
/* WINED3D_CS_OP_PRESENT */ wined3d_cs_exec_present,
/* WINED3D_CS_OP_CLEAR */ wined3d_cs_exec_clear,
/* WINED3D_CS_OP_DISPATCH */ wined3d_cs_exec_dispatch,
@@ -2837,13 +2832,10 @@ static void *wined3d_cs_mt_require_space(struct wined3d_cs *cs, size_t size, int
assert(size <= sizeof(block->data));
- if (!block || block->pos + size > sizeof(block->data))
+ if (!block || block->pos + size > sizeof(block->data) || block->list != list)
{
if (block)
- {
- list = block->list; /* send follow-up commands on the same list */
wined3d_cs_mt_submit(cs);
- }
block = wined3d_cs_get_block(cs, list);
wined3d_cs_set_thread_block(cs, block);
}
@@ -2872,9 +2864,10 @@ static void wined3d_cs_mt_submit(struct wined3d_cs *cs)
static void wined3d_cs_mt_submit_and_wait(struct wined3d_cs *cs)
{
- BOOL fence;
+ struct wined3d_cs_block *block = wined3d_cs_get_thread_block(cs);
+ BOOL fence = FALSE;
- wined3d_cs_emit_fence(cs, &fence);
+ block->fence = &fence;
wined3d_cs_mt_submit(cs);
/* A busy wait should be fine, we're not supposed to have to wait very
@@ -2920,6 +2913,9 @@ static inline BOOL wined3d_cs_process_block(struct wined3d_cs *cs, struct wined3
pos += wined3d_cs_op_handlers[opcode](cs, &block->data[pos]);
}
+ if (block->fence)
+ InterlockedExchange(block->fence, TRUE);
+
wined3d_cs_list_enqueue(&cs->free_list, block);
return TRUE;
}
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index 1bafbcac067..6f0023d9052 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -1118,7 +1118,7 @@ HRESULT CDECL wined3d_device_uninit_3d(struct wined3d_device *device)
return WINED3DERR_INVALIDCALL;
if (wined3d_settings.cs_multithreaded)
- device->cs->ops->submit_and_wait(device->cs);
+ wined3d_cs_emit_sync(device->cs);
if (device->logo_texture)
wined3d_texture_decref(device->logo_texture);
diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
index ac371a0fb35..66ffab0fbd2 100644
--- a/dlls/wined3d/surface.c
+++ b/dlls/wined3d/surface.c
@@ -4174,7 +4174,7 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst
}
wined3d_cs_emit_glfinish(device->cs);
- device->cs->ops->submit_and_wait(device->cs);
+ wined3d_cs_emit_sync(device->cs);
if (dst_sub_resource->map_count || (src_sub_resource && src_sub_resource->map_count))
{
diff --git a/dlls/wined3d/swapchain.c b/dlls/wined3d/swapchain.c
index 17fdf13e7bb..02858afa08a 100644
--- a/dlls/wined3d/swapchain.c
+++ b/dlls/wined3d/swapchain.c
@@ -115,7 +115,7 @@ ULONG CDECL wined3d_swapchain_decref(struct wined3d_swapchain *swapchain)
struct wined3d_device *device = swapchain->device;
if (wined3d_settings.cs_multithreaded)
- device->cs->ops->submit_and_wait(device->cs);
+ wined3d_cs_emit_sync(device->cs);
swapchain_cleanup(swapchain);
swapchain->parent_ops->wined3d_object_destroyed(swapchain->parent);
@@ -1316,7 +1316,7 @@ HRESULT CDECL wined3d_swapchain_resize_buffers(struct wined3d_swapchain *swapcha
FIXME("Cannot change the back buffer count yet.\n");
if (wined3d_settings.cs_multithreaded)
- device->cs->ops->submit_and_wait(device->cs);
+ wined3d_cs_emit_sync(device->cs);
if (!width || !height)
{
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index e1fdaa6574b..8d0d591c62d 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -3178,6 +3178,7 @@ struct wined3d_cs_block
struct list entry;
UINT pos;
struct wined3d_cs_list *list;
+ BOOL *fence;
BYTE data[0x4000]; /* FIXME? The size is somewhat arbitrary. */
};
@@ -3312,6 +3313,7 @@ void wined3d_cs_emit_set_unordered_access_view(struct wined3d_cs *cs, unsigned i
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;
+void wined3d_cs_emit_sync(struct wined3d_cs *cs);
void wined3d_cs_emit_texture_add_dirty_region(struct wined3d_cs *cs, struct wined3d_texture *texture,
unsigned int sub_resource_idx, const struct wined3d_box *dirty_region) DECLSPEC_HIDDEN;
void wined3d_cs_emit_unload_resource(struct wined3d_cs *cs, struct wined3d_resource *resource) DECLSPEC_HIDDEN;
--
2.11.0

View File

@ -1,161 +0,0 @@
From dcd2476869c8a09f1c33e6761d42b8ba7e370efc Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Wed, 8 Feb 2017 13:20:19 +0100
Subject: wined3d: Get rid of TLS for command stream.
---
dlls/wined3d/cs.c | 61 ++++++++++++++++++++++--------------------
dlls/wined3d/wined3d_private.h | 3 ++-
2 files changed, 34 insertions(+), 30 deletions(-)
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
index da20da75a36..5c408ab4f75 100644
--- a/dlls/wined3d/cs.c
+++ b/dlls/wined3d/cs.c
@@ -612,17 +612,6 @@ static void wined3d_cs_list_init(struct wined3d_cs_list *list)
list_init(&list->blocks);
}
-static struct wined3d_cs_block *wined3d_cs_get_thread_block(const struct wined3d_cs *cs)
-{
- return TlsGetValue(cs->tls_idx);
-}
-
-static void wined3d_cs_set_thread_block(const struct wined3d_cs *cs, struct wined3d_cs_block *block)
-{
- if (!TlsSetValue(cs->tls_idx, block))
- ERR("Failed to set thread block.\n");
-}
-
static struct wined3d_cs_block *wined3d_cs_get_block(struct wined3d_cs *cs, struct wined3d_cs_list *list)
{
struct wined3d_cs_block *block;
@@ -2768,18 +2757,31 @@ static const struct wined3d_cs_ops wined3d_cs_st_ops =
static void *wined3d_cs_mt_require_space(struct wined3d_cs *cs, size_t size, int priority)
{
- struct wined3d_cs_block *block = wined3d_cs_get_thread_block(cs);
+ struct wined3d_cs_block *block;
struct wined3d_cs_list *list = priority ? &cs->exec_prio_list : &cs->exec_list;
void *data;
assert(size <= sizeof(block->data));
- if (!block || block->pos + size > sizeof(block->data) || block->list != list)
+ if (cs->thread_id == GetCurrentThreadId())
{
- if (block)
- wined3d_cs_mt_submit(cs);
- block = wined3d_cs_get_block(cs, list);
- wined3d_cs_set_thread_block(cs, block);
+ block = cs->block_worker;
+ if (!block || block->pos + size > sizeof(block->data) || block->list != list)
+ {
+ if (block) wined3d_cs_mt_submit(cs);
+ block = wined3d_cs_get_block(cs, list);
+ cs->block_worker = block;
+ }
+ }
+ else
+ {
+ block = cs->block_main;
+ if (!block || block->pos + size > sizeof(block->data) || block->list != list)
+ {
+ if (block) wined3d_cs_mt_submit(cs);
+ block = wined3d_cs_get_block(cs, list);
+ cs->block_main = block;
+ }
}
data = &block->data[block->pos];
@@ -2790,13 +2792,20 @@ static void *wined3d_cs_mt_require_space(struct wined3d_cs *cs, size_t size, int
static void wined3d_cs_mt_submit(struct wined3d_cs *cs)
{
- struct wined3d_cs_block *block = wined3d_cs_get_thread_block(cs);
- wined3d_cs_set_thread_block(cs, NULL);
+ struct wined3d_cs_block *block;
if (cs->thread_id == GetCurrentThreadId())
+ {
+ block = cs->block_worker;
+ cs->block_worker = NULL;
+
wined3d_cs_process_block(cs, block);
+ }
else
{
+ block = cs->block_main;
+ cs->block_main = NULL;
+
wined3d_cs_list_enqueue(block->list, block);
if (InterlockedCompareExchange(&cs->waiting_for_event, FALSE, TRUE))
@@ -2806,9 +2815,10 @@ static void wined3d_cs_mt_submit(struct wined3d_cs *cs)
static void wined3d_cs_mt_submit_and_wait(struct wined3d_cs *cs)
{
- struct wined3d_cs_block *block = wined3d_cs_get_thread_block(cs);
+ struct wined3d_cs_block *block;
BOOL fence = FALSE;
+ block = (cs->thread_id == GetCurrentThreadId()) ? cs->block_worker : cs->block_main;
block->fence = &fence;
wined3d_cs_mt_submit(cs);
@@ -2887,7 +2897,6 @@ struct wined3d_cs *wined3d_cs_create(struct wined3d_device *device)
if (!(cs = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*cs))))
return NULL;
- cs->tls_idx = TLS_OUT_OF_INDEXES;
if (FAILED(state_init(&cs->state, gl_info, &device->adapter->d3d_info,
WINED3D_STATE_NO_REF | WINED3D_STATE_INIT_DEFAULT)))
@@ -2909,12 +2918,6 @@ struct wined3d_cs *wined3d_cs_create(struct wined3d_device *device)
goto err;
}
- if ((cs->tls_idx = TlsAlloc()) == TLS_OUT_OF_INDEXES)
- {
- ERR("Failed to allocate cs TLS index, err %#x.\n", GetLastError());
- goto err;
- }
-
if (wined3d_settings.cs_multithreaded)
{
cs->ops = &wined3d_cs_mt_ops;
@@ -2935,7 +2938,6 @@ struct wined3d_cs *wined3d_cs_create(struct wined3d_device *device)
err:
state_cleanup(&cs->state);
if (cs->event) CloseHandle(cs->event);
- if (cs->tls_idx != TLS_OUT_OF_INDEXES) TlsFree(cs->tls_idx);
HeapFree(GetProcessHeap(), 0, cs->data);
HeapFree(GetProcessHeap(), 0, cs);
return NULL;
@@ -2964,7 +2966,8 @@ void wined3d_cs_destroy(struct wined3d_cs *cs)
#endif
}
- TlsFree(cs->tls_idx);
+ HeapFree(GetProcessHeap(), 0, cs->block_main);
+ HeapFree(GetProcessHeap(), 0, cs->block_worker);
HeapFree(GetProcessHeap(), 0, cs->data);
HeapFree(GetProcessHeap(), 0, cs);
}
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 8d0d591c62d..6c46aa04ebc 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -3197,7 +3197,8 @@ struct wined3d_cs
struct wined3d_device *device;
struct wined3d_state state;
HANDLE thread;
- DWORD tls_idx;
+ struct wined3d_cs_block *block_main;
+ struct wined3d_cs_block *block_worker;
DWORD thread_id;
size_t data_size;
void *data;
--
2.11.0

View File

@ -1,75 +0,0 @@
From b71ef3360bd48011fa26e8b9e33774d8d2fffb36 Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Wed, 8 Feb 2017 17:35:18 +0100
Subject: wined3d: Clean up cs lists on shutdown.
---
dlls/wined3d/cs.c | 21 ++++++++++++++++-----
1 file changed, 16 insertions(+), 5 deletions(-)
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
index 5c408ab4f75..218484e5fdd 100644
--- a/dlls/wined3d/cs.c
+++ b/dlls/wined3d/cs.c
@@ -612,6 +612,17 @@ static void wined3d_cs_list_init(struct wined3d_cs_list *list)
list_init(&list->blocks);
}
+static void wined3d_cs_list_cleanup(struct wined3d_cs_list *list)
+{
+ struct wined3d_cs_block *block, *next;
+
+ LIST_FOR_EACH_ENTRY_SAFE(block, next, &list->blocks, struct wined3d_cs_block, entry)
+ {
+ list_remove(&block->entry);
+ HeapFree(GetProcessHeap(), 0, block);
+ }
+}
+
static struct wined3d_cs_block *wined3d_cs_get_block(struct wined3d_cs *cs, struct wined3d_cs_list *list)
{
struct wined3d_cs_block *block;
@@ -2851,6 +2862,8 @@ static void wined3d_cs_emit_stop(struct wined3d_cs *cs)
static inline BOOL wined3d_cs_process_block(struct wined3d_cs *cs, struct wined3d_cs_block *block)
{
UINT pos = 0;
+ BOOL ret = TRUE;
+
while (pos < block->pos)
{
enum wined3d_cs_op opcode = *(const enum wined3d_cs_op *)&block->data[pos];
@@ -2859,7 +2872,8 @@ static inline BOOL wined3d_cs_process_block(struct wined3d_cs *cs, struct wined3
{
if (opcode > WINED3D_CS_OP_STOP)
ERR("Invalid opcode %#x.\n", opcode);
- return FALSE;
+ ret = FALSE;
+ break;
}
pos += wined3d_cs_op_handlers[opcode](cs, &block->data[pos]);
@@ -2869,7 +2883,7 @@ static inline BOOL wined3d_cs_process_block(struct wined3d_cs *cs, struct wined3
InterlockedExchange(block->fence, TRUE);
wined3d_cs_list_enqueue(&cs->free_list, block);
- return TRUE;
+ return ret;
}
static DWORD WINAPI wined3d_cs_run(void *thread_param)
@@ -2958,12 +2972,9 @@ void wined3d_cs_destroy(struct wined3d_cs *cs)
if (ret != WAIT_OBJECT_0)
ERR("Wait failed (%#x).\n", ret);
- /* FIXME: Cleanup the block lists on thread exit. */
-#if 0
wined3d_cs_list_cleanup(&cs->exec_prio_list);
wined3d_cs_list_cleanup(&cs->exec_list);
wined3d_cs_list_cleanup(&cs->free_list);
-#endif
}
HeapFree(GetProcessHeap(), 0, cs->block_main);
--
2.11.0

View File

@ -1,96 +0,0 @@
From 2f24beca349dd4f2aa5a408e2da5d09e6425583d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Thu, 9 Feb 2017 21:11:25 +0100
Subject: wined3d: Use a separate lock for each CS list.
---
dlls/wined3d/cs.c | 26 +++++++++++---------------
dlls/wined3d/wined3d_private.h | 1 +
2 files changed, 12 insertions(+), 15 deletions(-)
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
index f68bbd55663..09936328cf4 100644
--- a/dlls/wined3d/cs.c
+++ b/dlls/wined3d/cs.c
@@ -25,16 +25,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(d3d);
#define WINED3D_INITIAL_CS_SIZE 4096
-static CRITICAL_SECTION wined3d_cs_list_mutex;
-static CRITICAL_SECTION_DEBUG wined3d_cs_list_mutex_debug =
-{
- 0, 0, &wined3d_cs_list_mutex,
- {&wined3d_cs_list_mutex_debug.ProcessLocksList,
- &wined3d_cs_list_mutex_debug.ProcessLocksList},
- 0, 0, {(DWORD_PTR)(__FILE__ ": wined3d_cs_list_mutex")}
-};
-static CRITICAL_SECTION wined3d_cs_list_mutex = {&wined3d_cs_list_mutex_debug, -1, 0, 0, 0, 0};
-
enum wined3d_cs_op
{
WINED3D_CS_OP_SYNC,
@@ -539,9 +529,9 @@ static void wined3d_cs_mt_submit(struct wined3d_cs *cs);
/* FIXME: The list synchronization probably isn't particularly fast. */
static void wined3d_cs_list_enqueue(struct wined3d_cs_list *list, struct wined3d_cs_block *block)
{
- EnterCriticalSection(&wined3d_cs_list_mutex);
+ EnterCriticalSection(&list->lock);
list_add_tail(&list->blocks, &block->entry);
- LeaveCriticalSection(&wined3d_cs_list_mutex);
+ LeaveCriticalSection(&list->lock);
InterlockedIncrement(&list->count);
}
@@ -550,14 +540,14 @@ static struct wined3d_cs_block *wined3d_cs_list_dequeue(struct wined3d_cs_list *
struct list *head;
if (!list->count) return NULL;
- EnterCriticalSection(&wined3d_cs_list_mutex);
+ EnterCriticalSection(&list->lock);
if (!(head = list_head(&list->blocks)))
{
- LeaveCriticalSection(&wined3d_cs_list_mutex);
+ LeaveCriticalSection(&list->lock);
return NULL;
}
list_remove(head);
- LeaveCriticalSection(&wined3d_cs_list_mutex);
+ LeaveCriticalSection(&list->lock);
InterlockedDecrement(&list->count);
return LIST_ENTRY(head, struct wined3d_cs_block, entry);
@@ -610,6 +600,9 @@ static struct wined3d_cs_block *wined3d_cs_dequeue_block(struct wined3d_cs *cs)
static void wined3d_cs_list_init(struct wined3d_cs_list *list)
{
+ InitializeCriticalSection(&list->lock);
+ list->lock.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": wined3d_cs_list_lock");
+
list_init(&list->blocks);
}
@@ -622,6 +615,9 @@ static void wined3d_cs_list_cleanup(struct wined3d_cs_list *list)
list_remove(&block->entry);
HeapFree(GetProcessHeap(), 0, block);
}
+
+ list->lock.DebugInfo->Spare[0] = 0;
+ DeleteCriticalSection(&list->lock);
}
static struct wined3d_cs_block *wined3d_cs_get_block(struct wined3d_cs *cs, struct wined3d_cs_list *list)
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index e6b0d363cdd..d4f05b204fd 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -3207,6 +3207,7 @@ enum wined3d_push_constants
struct wined3d_cs_list
{
+ CRITICAL_SECTION lock;
struct list blocks;
LONG count;
};
--
2.11.0

View File

@ -1,30 +0,0 @@
From 9c3420b9d0fd92a9421e0b15177d4fb8b5a55601 Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Fri, 10 Feb 2017 20:31:21 +0100
Subject: wined3d: Don't crash in context_release when device was not fully
created.
---
dlls/wined3d/context.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c
index 1979a36d875..be5194daaf0 100644
--- a/dlls/wined3d/context.c
+++ b/dlls/wined3d/context.c
@@ -1353,8 +1353,11 @@ void context_release(struct wined3d_context *context)
WARN("Context %p is not the current context.\n", context);
}
- if (wined3d_settings.cs_multithreaded && context->device->cs->thread_id != GetCurrentThreadId())
+ if (wined3d_settings.cs_multithreaded && context->device &&
+ context->device->cs->thread_id != GetCurrentThreadId())
+ {
context->gl_info->gl_ops.gl.p_glFinish();
+ }
if (!--context->level)
{
--
2.11.0

File diff suppressed because it is too large Load Diff

View File

@ -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=---