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

Some files were not shown because too many files have changed in this diff Show More