Rebase against b47487af999f48ba2700b4dd5ff6cd47891d4787.

This commit is contained in:
Sebastian Lackner 2017-02-28 04:53:10 +01:00
parent 147562e3e1
commit 3dfeab6722
18 changed files with 518 additions and 2931 deletions

View File

@ -52,7 +52,7 @@ usage()
# Get the upstream commit sha
upstream_commit()
{
echo "adedebf47a9a02694b79965eb2aa670b3906b398"
echo "b47487af999f48ba2700b4dd5ff6cd47891d4787"
}
# Show version information
@ -8373,18 +8373,16 @@ fi
# | * [#11674] Support for CSMT (command stream) to increase graphic performance
# |
# | Modified files:
# | * dlls/d3d9/tests/visual.c, dlls/wined3d/arb_program_shader.c, dlls/wined3d/buffer.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
# | * dlls/d3d9/tests/visual.c, dlls/wined3d/buffer.c, dlls/wined3d/context.c, dlls/wined3d/cs.c, dlls/wined3d/device.c,
# | dlls/wined3d/query.c, dlls/wined3d/resource.c, dlls/wined3d/stateblock.c, dlls/wined3d/surface.c,
# | dlls/wined3d/swapchain.c, dlls/wined3d/texture.c, dlls/wined3d/view.c, dlls/wined3d/wined3d_main.c,
# | dlls/wined3d/wined3d_private.h
# |
if test "$enable_wined3d_CSMT_Main" -eq 1; then
patch_apply wined3d-CSMT_Main/9999-IfDefined.patch
(
printf '%s\n' '+ { "Sebastian Lackner", "wined3d: Add additional synchronization CS ops.", 1 },';
printf '%s\n' '+ { "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: 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 },';
@ -8402,8 +8400,6 @@ if test "$enable_wined3d_CSMT_Main" -eq 1; then
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 },';

View File

@ -1,4 +1,4 @@
From ac5bd002bbe0d7366b443e24baf04aed612e60d8 Mon Sep 17 00:00:00 2001
From 16a1078eca14d1a3b01144db70b440eeb1ba2458 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.
@ -11,7 +11,7 @@ Subject: wined3d: Add additional synchronization CS ops.
4 files changed, 60 insertions(+), 2 deletions(-)
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
index 763fda7153..8dd5352d8d 100644
index c6861818bce..060885dee7c 100644
--- a/dlls/wined3d/cs.c
+++ b/dlls/wined3d/cs.c
@@ -26,6 +26,8 @@ WINE_DEFAULT_DEBUG_CHANNEL(d3d);
@ -40,7 +40,7 @@ index 763fda7153..8dd5352d8d 100644
struct wined3d_cs_present
{
enum wined3d_cs_op opcode;
@@ -343,6 +355,38 @@ struct wined3d_cs_unmap
@@ -344,6 +356,38 @@ struct wined3d_cs_unmap
HRESULT *hr;
};
@ -79,7 +79,7 @@ index 763fda7153..8dd5352d8d 100644
static void wined3d_cs_exec_present(struct wined3d_cs *cs, const void *data)
{
const struct wined3d_cs_present *op = data;
@@ -1610,7 +1654,7 @@ HRESULT wined3d_cs_map(struct wined3d_cs *cs, struct wined3d_resource *resource,
@@ -1618,7 +1662,7 @@ HRESULT wined3d_cs_map(struct wined3d_cs *cs, struct wined3d_resource *resource,
op->flags = flags;
op->hr = &hr;
@ -88,7 +88,7 @@ index 763fda7153..8dd5352d8d 100644
return hr;
}
@@ -1634,13 +1678,15 @@ HRESULT wined3d_cs_unmap(struct wined3d_cs *cs, struct wined3d_resource *resourc
@@ -1642,13 +1686,15 @@ HRESULT wined3d_cs_unmap(struct wined3d_cs *cs, struct wined3d_resource *resourc
op->sub_resource_idx = sub_resource_idx;
op->hr = &hr;
@ -105,7 +105,7 @@ index 763fda7153..8dd5352d8d 100644
/* WINED3D_CS_OP_PRESENT */ wined3d_cs_exec_present,
/* WINED3D_CS_OP_CLEAR */ wined3d_cs_exec_clear,
/* WINED3D_CS_OP_DISPATCH */ wined3d_cs_exec_dispatch,
@@ -1771,6 +1817,7 @@ static const struct wined3d_cs_ops wined3d_cs_st_ops =
@@ -1779,6 +1825,7 @@ static const struct wined3d_cs_ops wined3d_cs_st_ops =
{
wined3d_cs_st_require_space,
wined3d_cs_st_submit,
@ -114,7 +114,7 @@ index 763fda7153..8dd5352d8d 100644
};
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index 6d844e7c40..fe74808492 100644
index eb626ba8a52..9f0ce923839 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)
@ -134,7 +134,7 @@ index 6d844e7c40..fe74808492 100644
return E_FAIL;
diff --git a/dlls/wined3d/view.c b/dlls/wined3d/view.c
index 02964e4a96..21aa8720e6 100644
index 02964e4a96b..21aa8720e65 100644
--- a/dlls/wined3d/view.c
+++ b/dlls/wined3d/view.c
@@ -598,6 +598,8 @@ static void wined3d_shader_resource_view_cs_init(void *object)
@ -172,10 +172,10 @@ index 02964e4a96..21aa8720e6 100644
return WINED3D_OK;
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 8b1a18ffcf..cfb971abdf 100644
index 38050527f8a..607fafe7804 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -3180,6 +3180,7 @@ struct wined3d_cs_ops
@@ -3179,6 +3179,7 @@ struct wined3d_cs_ops
{
void *(*require_space)(struct wined3d_cs *cs, size_t size);
void (*submit)(struct wined3d_cs *cs);
@ -184,9 +184,9 @@ index 8b1a18ffcf..cfb971abdf 100644
unsigned int start_idx, unsigned int count, const void *constants);
};
@@ -3205,6 +3206,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_draw(struct wined3d_cs *cs, GLenum primitive_type, int base_vertex_idx,
unsigned int start_idx, unsigned int index_count, unsigned int start_instance,
unsigned int instance_count, BOOL indexed) DECLSPEC_HIDDEN;
+void wined3d_cs_emit_glfinish(struct wined3d_cs *cs) DECLSPEC_HIDDEN;
void wined3d_cs_emit_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,

View File

@ -1,122 +0,0 @@
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 | 32 ++++++++++++++++++++++++++++++++
dlls/wined3d/device.c | 4 ++--
dlls/wined3d/stateblock.c | 4 ++--
dlls/wined3d/wined3d_private.h | 2 ++
4 files changed, 38 insertions(+), 4 deletions(-)
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
index 4612244ce0c..7490b36a827 100644
--- a/dlls/wined3d/cs.c
+++ b/dlls/wined3d/cs.c
@@ -64,6 +64,7 @@ enum wined3d_cs_op
WINED3D_CS_OP_MAP,
WINED3D_CS_OP_UNMAP,
WINED3D_CS_OP_PUSH_CONSTANTS,
+ WINED3D_CS_OP_SET_PRIMITIVE_TYPE,
};
struct wined3d_cs_sync
@@ -350,6 +351,12 @@ struct wined3d_cs_push_constants
BYTE constants[1];
};
+struct wined3d_cs_set_primitive_type
+{
+ enum wined3d_cs_op opcode;
+ GLenum gl_primitive_type;
+};
+
static void wined3d_cs_exec_sync(struct wined3d_cs *cs, const void *data)
{
}
@@ -1647,6 +1654,30 @@ void wined3d_cs_emit_push_constants(struct wined3d_cs *cs, enum wined3d_push_con
cs->ops->submit(cs);
}
+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;
+
+ prev = cs->state.gl_primitive_type;
+
+ if (op->gl_primitive_type == GL_POINTS || prev == GL_POINTS)
+ device_invalidate_state(cs->device, STATE_POINT_ENABLE);
+
+ cs->state.gl_primitive_type = op->gl_primitive_type;
+}
+
+void wined3d_cs_emit_set_primitive_type(struct wined3d_cs *cs, GLenum primitive_type)
+{
+ struct wined3d_cs_set_primitive_type *op;
+
+ op = cs->ops->require_space(cs, sizeof(*op));
+ op->opcode = WINED3D_CS_OP_SET_PRIMITIVE_TYPE;
+ op->gl_primitive_type = primitive_type;
+
+ 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,
@@ -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_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 5e17ba185de..6fb09dfcf19 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -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;
- else if (gl_primitive_type != prev && (gl_primitive_type == GL_POINTS || prev == GL_POINTS))
- device_invalidate_state(device, STATE_POINT_ENABLE);
+ else if (gl_primitive_type != prev)
+ wined3d_cs_emit_set_primitive_type(device->cs, gl_primitive_type);
}
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 22e511fcec1..ad347082c4d 100644
--- a/dlls/wined3d/stateblock.c
+++ b/dlls/wined3d/stateblock.c
@@ -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;
- if (gl_primitive_type != prev && (gl_primitive_type == GL_POINTS || prev == GL_POINTS))
- device_invalidate_state(device, STATE_POINT_ENABLE);
+ if (gl_primitive_type != prev)
+ wined3d_cs_emit_set_primitive_type(device->cs, gl_primitive_type);
}
if (stateblock->changed.indices)
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index df05dcb8fc8..514f162fefa 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -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;
+void wined3d_cs_emit_set_primitive_type(struct wined3d_cs *cs,
+ GLenum primitive_type) DECLSPEC_HIDDEN;
void wined3d_cs_emit_set_rasterizer_state(struct wined3d_cs *cs,
struct wined3d_rasterizer_state *rasterizer_state) DECLSPEC_HIDDEN;
void wined3d_cs_emit_set_render_state(struct wined3d_cs *cs,
--
2.11.0

View File

@ -1,26 +1,17 @@
From 6dbf3379c1262b61c6730d2228c40b85ef751773 Mon Sep 17 00:00:00 2001
From 890fa1752284ee9a459b29eeac7d875cd1a84015 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(-)
dlls/wined3d/cs.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
index 594a4b5b175..53c1cc48728 100644
index 73352d93b97..d3be8d1ef21 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
@@ -603,7 +603,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)
{
@ -29,7 +20,7 @@ index 594a4b5b175..53c1cc48728 100644
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,
@@ -635,7 +635,7 @@ void wined3d_cs_emit_dispatch(struct wined3d_cs *cs,
static void wined3d_cs_exec_draw(struct wined3d_cs *cs, const void *data)
{

View File

@ -1,4 +1,4 @@
From 06958496811f70af6507c8de08347d3aac61057b Mon Sep 17 00:00:00 2001
From c300fbe493da45c4767a7ebe73f9854a9a1101e8 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.
@ -13,19 +13,19 @@ between surface_blt and surface_blt_ugly isn't particularly nice.
4 files changed, 228 insertions(+), 97 deletions(-)
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
index 9934b74e150..b563dfbd080 100644
index ee3d9a79da0..1517df9da95 100644
--- a/dlls/wined3d/cs.c
+++ b/dlls/wined3d/cs.c
@@ -67,6 +67,7 @@ enum wined3d_cs_op
@@ -66,6 +66,7 @@ enum wined3d_cs_op
WINED3D_CS_OP_MAP,
WINED3D_CS_OP_UNMAP,
WINED3D_CS_OP_PUSH_CONSTANTS,
WINED3D_CS_OP_SET_PRIMITIVE_TYPE,
+ WINED3D_CS_OP_BLT,
};
struct wined3d_cs_sync
@@ -372,6 +373,18 @@ struct wined3d_cs_set_primitive_type
GLenum gl_primitive_type;
@@ -366,6 +367,18 @@ struct wined3d_cs_push_constants
BYTE constants[1];
};
+struct wined3d_cs_blt
@ -43,7 +43,7 @@ index 9934b74e150..b563dfbd080 100644
static void wined3d_cs_exec_sync(struct wined3d_cs *cs, const void *data)
{
}
@@ -1799,6 +1812,44 @@ void wined3d_cs_emit_set_primitive_type(struct wined3d_cs *cs, GLenum primitive_
@@ -1776,6 +1789,44 @@ void wined3d_cs_emit_push_constants(struct wined3d_cs *cs, enum wined3d_push_con
cs->ops->submit(cs);
}
@ -88,19 +88,19 @@ index 9934b74e150..b563dfbd080 100644
static void (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void *data) =
{
/* WINED3D_CS_OP_SYNC */ wined3d_cs_exec_sync,
@@ -1842,6 +1893,7 @@ static void (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void
@@ -1818,6 +1869,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_SET_PRIMITIVE_TYPE */ wined3d_cs_exec_set_primitive_type,
+ /* WINED3D_CS_OP_BLT */ wined3d_cs_exec_blt,
};
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 335ff016cf3..f4cdb5d9c10 100644
index 01f7f1b6d84..7644e2aa250 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -4032,6 +4032,7 @@ HRESULT CDECL wined3d_device_copy_sub_resource_region(struct wined3d_device *dev
@@ -4027,6 +4027,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;
@ -108,7 +108,7 @@ index 335ff016cf3..f4cdb5d9c10 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",
@@ -4119,6 +4120,14 @@ HRESULT CDECL wined3d_device_copy_sub_resource_region(struct wined3d_device *dev
@@ -4114,6 +4115,14 @@ HRESULT CDECL wined3d_device_copy_sub_resource_region(struct wined3d_device *dev
if (src_box)
{
@ -123,7 +123,7 @@ index 335ff016cf3..f4cdb5d9c10 100644
SetRect(&src_rect, src_box->left, src_box->top, src_box->right, src_box->bottom);
}
else
@@ -4132,6 +4141,23 @@ HRESULT CDECL wined3d_device_copy_sub_resource_region(struct wined3d_device *dev
@@ -4127,6 +4136,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));
@ -148,10 +148,10 @@ index 335ff016cf3..f4cdb5d9c10 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 87cf6727cf5..8c5624c8787 100644
index 347a8097484..c0b34e20b83 100644
--- a/dlls/wined3d/surface.c
+++ b/dlls/wined3d/surface.c
@@ -3775,7 +3775,7 @@ const struct blit_shader cpu_blit = {
@@ -3772,7 +3772,7 @@ const struct blit_shader cpu_blit = {
cpu_blit_blit_surface,
};
@ -160,7 +160,7 @@ index 87cf6727cf5..8c5624c8787 100644
struct wined3d_surface *src_surface, const RECT *src_rect, DWORD flags,
const struct wined3d_blt_fx *fx, enum wined3d_texture_filter_type filter)
{
@@ -3785,9 +3785,8 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst
@@ -3782,9 +3782,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;
@ -172,7 +172,7 @@ index 87cf6727cf5..8c5624c8787 100644
DWORD src_ds_flags, dst_ds_flags;
BOOL scale, convert;
@@ -3800,84 +3799,17 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst
@@ -3797,84 +3796,17 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst
| WINED3D_BLT_DO_NOT_WAIT
| WINED3D_BLT_ALPHA_TEST;
@ -262,7 +262,7 @@ index 87cf6727cf5..8c5624c8787 100644
}
if (!device->d3d_initialized)
@@ -3902,11 +3834,6 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst
@@ -3899,11 +3831,6 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst
goto fallback;
}
@ -274,7 +274,7 @@ index 87cf6727cf5..8c5624c8787 100644
dst_swapchain = dst_texture->swapchain;
/* This isn't strictly needed. FBO blits for example could deal with
@@ -3942,22 +3869,16 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst
@@ -3939,22 +3866,16 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst
TRACE("Depth fill.\n");
if (!wined3d_format_convert_color_to_float(dst_texture->resource.format, NULL, fx->fill_color, &color))
@ -300,7 +300,7 @@ index 87cf6727cf5..8c5624c8787 100644
}
}
else
@@ -3993,7 +3914,7 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst
@@ -3990,7 +3911,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)))
@ -309,7 +309,7 @@ index 87cf6727cf5..8c5624c8787 100644
}
else
{
@@ -4037,7 +3958,7 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst
@@ -4034,7 +3955,7 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst
context, dst_texture->resource.draw_binding);
context_release(context);
}
@ -318,7 +318,7 @@ index 87cf6727cf5..8c5624c8787 100644
}
}
}
@@ -4061,7 +3982,7 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst
@@ -4058,7 +3979,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;
@ -327,7 +327,7 @@ index 87cf6727cf5..8c5624c8787 100644
}
if (fbo_blit_supported(&device->adapter->gl_info, blit_op,
@@ -4082,7 +4003,7 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst
@@ -4079,7 +4000,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);
@ -336,7 +336,7 @@ index 87cf6727cf5..8c5624c8787 100644
}
blitter = wined3d_select_blitter(&device->adapter->gl_info, &device->adapter->d3d_info, blit_op,
@@ -4092,7 +4013,7 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst
@@ -4089,7 +4010,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);
@ -345,7 +345,7 @@ index 87cf6727cf5..8c5624c8787 100644
}
}
}
@@ -4100,9 +4021,134 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst
@@ -4097,9 +4018,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)))
@ -483,10 +483,10 @@ index 87cf6727cf5..8c5624c8787 100644
+ return WINED3D_OK;
+}
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 6fcfdcbe05c..a2663a10b82 100644
index c62c64e7d3d..62f9c484287 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -3047,6 +3047,9 @@ HRESULT surface_upload_from_surface(struct wined3d_surface *dst_surface, const P
@@ -3048,6 +3048,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;

View File

@ -1,4 +1,4 @@
From 1c832f8fd2760bff7b0a0234f68c11af66dba8d1 Mon Sep 17 00:00:00 2001
From 71236080e419dcf33176b5f8f54bbaf2dbefb630 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
@ -11,7 +11,7 @@ Subject: wined3d: Send render target view clears through the command stream
4 files changed, 55 insertions(+), 5 deletions(-)
diff --git a/dlls/d3d9/tests/visual.c b/dlls/d3d9/tests/visual.c
index f6eb188837d..5700577709e 100644
index 8e5be756654..88e0e44c4d3 100644
--- a/dlls/d3d9/tests/visual.c
+++ b/dlls/d3d9/tests/visual.c
@@ -1337,7 +1337,7 @@ static void color_fill_test(void)
@ -24,18 +24,18 @@ index f6eb188837d..5700577709e 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 420a2cc8327..1dff1ff8af6 100644
index 1517df9da95..ebc4e4f15e5 100644
--- a/dlls/wined3d/cs.c
+++ b/dlls/wined3d/cs.c
@@ -68,6 +68,7 @@ enum wined3d_cs_op
@@ -67,6 +67,7 @@ enum wined3d_cs_op
WINED3D_CS_OP_UNMAP,
WINED3D_CS_OP_PUSH_CONSTANTS,
WINED3D_CS_OP_SET_PRIMITIVE_TYPE,
WINED3D_CS_OP_BLT,
+ WINED3D_CS_OP_CLEAR_RTV,
};
struct wined3d_cs_sync
@@ -385,6 +386,18 @@ struct wined3d_cs_blt
@@ -379,6 +380,18 @@ struct wined3d_cs_blt
enum wined3d_texture_filter_type filter;
};
@ -54,7 +54,7 @@ index 420a2cc8327..1dff1ff8af6 100644
static void wined3d_cs_exec_sync(struct wined3d_cs *cs, const void *data)
{
}
@@ -1843,6 +1856,41 @@ void wined3d_cs_emit_blt(struct wined3d_cs *cs, struct wined3d_surface *dst_surf
@@ -1827,6 +1840,41 @@ void wined3d_cs_emit_blt(struct wined3d_cs *cs, struct wined3d_surface *dst_surf
cs->ops->submit(cs);
}
@ -96,19 +96,19 @@ index 420a2cc8327..1dff1ff8af6 100644
static void (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void *data) =
{
/* WINED3D_CS_OP_SYNC */ wined3d_cs_exec_sync,
@@ -1887,6 +1935,7 @@ static void (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void
@@ -1870,6 +1918,7 @@ 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_BLT */ wined3d_cs_exec_blt,
+ /* WINED3D_CS_OP_CLEAR_RTV */ wined3d_cs_exec_clear_rtv,
};
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 6195122ff10..1388dda5c78 100644
index 7644e2aa250..35c57ff7b94 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -4272,10 +4272,8 @@ HRESULT CDECL wined3d_device_clear_rendertarget_view(struct wined3d_device *devi
@@ -4283,10 +4283,8 @@ HRESULT CDECL wined3d_device_clear_rendertarget_view(struct wined3d_device *devi
return WINED3DERR_INVALIDCALL;
}
@ -122,10 +122,10 @@ index 6195122ff10..1388dda5c78 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 be01b6f3b6a..2b58f655c25 100644
index 62f9c484287..334cdf0fb8b 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -3199,6 +3199,9 @@ void wined3d_cs_emit_blt(struct wined3d_cs *cs, struct wined3d_surface *dst_surf
@@ -3208,6 +3208,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;
@ -134,7 +134,7 @@ index be01b6f3b6a..2b58f655c25 100644
+ const struct blit_shader *blitter) 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,
void wined3d_cs_emit_draw(struct wined3d_cs *cs, GLenum primitive_type, int base_vertex_idx,
--
2.11.0

View File

@ -1,4 +1,4 @@
From 8272b9dad0782ec04f08f6829f6f9a715c676d91 Mon Sep 17 00:00:00 2001
From 91f8e688a10e60bf4240ec172bc4a56d6c2f59d9 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
@ -11,18 +11,18 @@ FIXME: This logic duplication is ugly.
3 files changed, 141 insertions(+), 75 deletions(-)
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
index 1dff1ff8af6..c84bca1423f 100644
index ebc4e4f15e5..461ef30f17a 100644
--- a/dlls/wined3d/cs.c
+++ b/dlls/wined3d/cs.c
@@ -69,6 +69,7 @@ enum wined3d_cs_op
WINED3D_CS_OP_SET_PRIMITIVE_TYPE,
@@ -68,6 +68,7 @@ enum wined3d_cs_op
WINED3D_CS_OP_PUSH_CONSTANTS,
WINED3D_CS_OP_BLT,
WINED3D_CS_OP_CLEAR_RTV,
+ WINED3D_CS_OP_UPDATE_TEXTURE,
};
struct wined3d_cs_sync
@@ -398,6 +399,12 @@ struct wined3d_cs_clear_rtv
@@ -392,6 +393,12 @@ struct wined3d_cs_clear_rtv
const struct blit_shader *blitter;
};
@ -35,7 +35,7 @@ index 1dff1ff8af6..c84bca1423f 100644
static void wined3d_cs_exec_sync(struct wined3d_cs *cs, const void *data)
{
}
@@ -1891,6 +1898,35 @@ void wined3d_cs_emit_clear_rtv(struct wined3d_cs *cs, struct wined3d_rendertarge
@@ -1875,6 +1882,35 @@ void wined3d_cs_emit_clear_rtv(struct wined3d_cs *cs, struct wined3d_rendertarge
cs->ops->submit(cs);
}
@ -71,8 +71,8 @@ index 1dff1ff8af6..c84bca1423f 100644
static void (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void *data) =
{
/* WINED3D_CS_OP_SYNC */ wined3d_cs_exec_sync,
@@ -1936,6 +1972,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,
@@ -1919,6 +1955,7 @@ static void (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void
/* WINED3D_CS_OP_PUSH_CONSTANTS */ wined3d_cs_exec_push_constants,
/* 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,
@ -80,10 +80,10 @@ index 1dff1ff8af6..c84bca1423f 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 71c95bc3f5d..f135f6ad03b 100644
index 72cf63af27f..8f7640cadc2 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -3616,34 +3616,17 @@ void CDECL wined3d_device_draw_indexed_primitive_instanced(struct wined3d_device
@@ -3627,34 +3627,17 @@ void CDECL wined3d_device_draw_indexed_primitive_instanced(struct wined3d_device
start_idx, index_count, start_instance, instance_count, TRUE);
}
@ -122,7 +122,7 @@ index 71c95bc3f5d..f135f6ad03b 100644
/* Only a prepare, since we're uploading entire volumes. */
wined3d_texture_prepare_texture(dst_texture, context, FALSE);
@@ -3651,32 +3634,89 @@ static HRESULT wined3d_device_update_texture_3d(struct wined3d_device *device,
@@ -3662,32 +3645,89 @@ static HRESULT wined3d_device_update_texture_3d(struct wined3d_device *device,
for (i = 0; i < level_count; ++i)
{
@ -222,7 +222,7 @@ index 71c95bc3f5d..f135f6ad03b 100644
TRACE("device %p, src_texture %p, dst_texture %p.\n", device, src_texture, dst_texture);
@@ -3713,63 +3753,48 @@ HRESULT CDECL wined3d_device_update_texture(struct wined3d_device *device,
@@ -3724,63 +3764,48 @@ HRESULT CDECL wined3d_device_update_texture(struct wined3d_device *device,
return WINED3DERR_INVALIDCALL;
}
@ -316,10 +316,10 @@ index 71c95bc3f5d..f135f6ad03b 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 2b58f655c25..cfe8839d746 100644
index 334cdf0fb8b..81bcadc927f 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -2673,6 +2673,8 @@ LRESULT device_process_message(struct wined3d_device *device, HWND window, BOOL
@@ -2683,6 +2683,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;
@ -328,7 +328,7 @@ index 2b58f655c25..cfe8839d746 100644
static inline BOOL isStateDirty(const struct wined3d_context *context, DWORD state)
{
@@ -3264,6 +3266,8 @@ void wined3d_cs_emit_set_vertex_declaration(struct wined3d_cs *cs,
@@ -3272,6 +3274,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;

View File

@ -1,4 +1,4 @@
From 5d761db7832335a902459846f73ad5a88af92860 Mon Sep 17 00:00:00 2001
From 5cde9b1eaee021e59d3a7b17bfdc69270771003d 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.
@ -11,10 +11,10 @@ Another hacky patch to avoid using GL outside the worker thread.
3 files changed, 119 insertions(+), 29 deletions(-)
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
index ac9e09345dd..29b27176d34 100644
index e2b756eecb9..86ae7eb89c8 100644
--- a/dlls/wined3d/cs.c
+++ b/dlls/wined3d/cs.c
@@ -71,6 +71,8 @@ enum wined3d_cs_op
@@ -70,6 +70,8 @@ enum wined3d_cs_op
WINED3D_CS_OP_CLEAR_RTV,
WINED3D_CS_OP_UPDATE_TEXTURE,
WINED3D_CS_OP_UPDATE_SUB_RESOURCE,
@ -23,7 +23,7 @@ index ac9e09345dd..29b27176d34 100644
};
struct wined3d_cs_sync
@@ -415,6 +417,14 @@ struct wined3d_cs_update_sub_resource
@@ -409,6 +411,14 @@ struct wined3d_cs_update_sub_resource
const void *data;
};
@ -38,7 +38,7 @@ index ac9e09345dd..29b27176d34 100644
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
@@ -1977,6 +1987,54 @@ void wined3d_cs_emit_update_sub_resource(struct wined3d_cs *cs, struct wined3d_r
cs->ops->submit_and_wait(cs);
}
@ -93,7 +93,7 @@ index ac9e09345dd..29b27176d34 100644
static void (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void *data) =
{
/* 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
@@ -2023,6 +2081,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,
@ -103,10 +103,10 @@ index ac9e09345dd..29b27176d34 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 5673a93f791..2360c589902 100644
index 65777aad7be..644637696ea 100644
--- a/dlls/wined3d/texture.c
+++ b/dlls/wined3d/texture.c
@@ -3489,13 +3489,41 @@ HRESULT CDECL wined3d_texture_create(struct wined3d_device *device, const struct
@@ -3486,13 +3486,41 @@ HRESULT CDECL wined3d_texture_create(struct wined3d_device *device, const struct
return WINED3D_OK;
}
@ -150,7 +150,7 @@ index 5673a93f791..2360c589902 100644
TRACE("texture %p, sub_resource_idx %u, dc %p.\n", texture, sub_resource_idx, dc);
@@ -3520,28 +3548,32 @@ HRESULT CDECL wined3d_texture_get_dc(struct wined3d_texture *texture, unsigned i
@@ -3517,28 +3545,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;
@ -200,7 +200,7 @@ index 5673a93f791..2360c589902 100644
}
HRESULT CDECL wined3d_texture_release_dc(struct wined3d_texture *texture, unsigned int sub_resource_idx, HDC dc)
@@ -3572,14 +3604,5 @@ HRESULT CDECL wined3d_texture_release_dc(struct wined3d_texture *texture, unsign
@@ -3569,14 +3601,5 @@ HRESULT CDECL wined3d_texture_release_dc(struct wined3d_texture *texture, unsign
return WINED3DERR_INVALIDCALL;
}
@ -217,10 +217,10 @@ index 5673a93f791..2360c589902 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 17cb43771d8..da3ee393739 100644
index 9cd5c2e316a..822d951b80f 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -2916,6 +2916,7 @@ void wined3d_texture_bind_and_dirtify(struct wined3d_texture *texture,
@@ -2928,6 +2928,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;
@ -228,7 +228,7 @@ index 17cb43771d8..da3ee393739 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;
@@ -2933,6 +2934,8 @@ BOOL wined3d_texture_prepare_location(struct wined3d_texture *texture, unsigned
@@ -2945,6 +2946,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;
@ -237,16 +237,16 @@ index 17cb43771d8..da3ee393739 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;
@@ -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;
@@ -3220,6 +3223,8 @@ void wined3d_cs_emit_dispatch(struct wined3d_cs *cs,
void wined3d_cs_emit_draw(struct wined3d_cs *cs, GLenum primitive_type, int base_vertex_idx,
unsigned int start_idx, unsigned int index_count, unsigned int start_instance,
unsigned int instance_count, BOOL indexed) DECLSPEC_HIDDEN;
+HRESULT wined3d_cs_emit_get_dc(struct wined3d_cs *cs, struct wined3d_texture *texture,
+ unsigned int sub_resource_idx) 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,
@@ -3215,6 +3220,8 @@ void wined3d_cs_emit_present(struct wined3d_cs *cs, struct wined3d_swapchain *sw
@@ -3227,6 +3232,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;

View File

@ -1,4 +1,4 @@
From 04cdcd00a3c11da1292657739f22a016faa54435 Mon Sep 17 00:00:00 2001
From 28c54b09deec1d91899a2317f52931f0b1697f7e 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.
@ -11,10 +11,10 @@ Very hacky.
3 files changed, 100 insertions(+), 54 deletions(-)
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
index 81deae77363..4ee459f535a 100644
index 24051b16899..c9273e5508e 100644
--- a/dlls/wined3d/cs.c
+++ b/dlls/wined3d/cs.c
@@ -74,6 +74,7 @@ enum wined3d_cs_op
@@ -73,6 +73,7 @@ enum wined3d_cs_op
WINED3D_CS_OP_UPDATE_SUB_RESOURCE,
WINED3D_CS_OP_GET_DC,
WINED3D_CS_OP_RELEASE_DC,
@ -22,7 +22,7 @@ index 81deae77363..4ee459f535a 100644
};
struct wined3d_cs_sync
@@ -434,6 +435,13 @@ struct wined3d_cs_get_release_dc
@@ -428,6 +429,13 @@ struct wined3d_cs_get_release_dc
HRESULT *hr;
};
@ -36,7 +36,7 @@ index 81deae77363..4ee459f535a 100644
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
@@ -2068,6 +2076,28 @@ HRESULT wined3d_cs_emit_release_dc(struct wined3d_cs *cs, struct wined3d_texture
return hr;
}
@ -65,7 +65,7 @@ index 81deae77363..4ee459f535a 100644
static void (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void *data) =
{
/* 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
@@ -2117,6 +2147,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,
@ -212,10 +212,10 @@ index 7e48b5d12b5..592cbd96db4 100644
if (swapchain->desc.backbuffer_count > 0)
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 91b2215f287..b3995627850 100644
index 065f118fcb7..c4830e3ab44 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -3207,6 +3207,8 @@ void wined3d_cs_emit_clear(struct wined3d_cs *cs, DWORD rect_count, const RECT *
@@ -3218,6 +3218,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;
@ -223,8 +223,8 @@ index 91b2215f287..b3995627850 100644
+ struct wined3d_swapchain *swapchain) 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,
@@ -3460,6 +3462,8 @@ struct wined3d_swapchain
void wined3d_cs_emit_draw(struct wined3d_cs *cs, GLenum primitive_type, int base_vertex_idx,
@@ -3470,6 +3472,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,958 +0,0 @@
From a6f17f1f44e34d5a4658aa6d772e6c6283f5d98e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20D=C3=B6singer?= <stefan@codeweavers.com>
Date: Thu, 20 Dec 2012 13:09:17 +0100
Subject: wined3d: Move the framebuffer into wined3d_state
---
dlls/wined3d/arb_program_shader.c | 4 +-
dlls/wined3d/context.c | 19 ++++++--
dlls/wined3d/cs.c | 52 ++++++++++----------
dlls/wined3d/device.c | 100 +++++++++++++++++---------------------
dlls/wined3d/drawprim.c | 2 +-
dlls/wined3d/glsl_shader.c | 2 +-
dlls/wined3d/shader.c | 2 +-
dlls/wined3d/state.c | 28 +++++------
dlls/wined3d/stateblock.c | 47 ++++++++++++++++--
dlls/wined3d/surface.c | 2 +-
dlls/wined3d/utils.c | 4 +-
dlls/wined3d/wined3d_private.h | 46 +++++++++++++-----
12 files changed, 182 insertions(+), 126 deletions(-)
diff --git a/dlls/wined3d/arb_program_shader.c b/dlls/wined3d/arb_program_shader.c
index 18721005bc6..7879c6a2f7f 100644
--- a/dlls/wined3d/arb_program_shader.c
+++ b/dlls/wined3d/arb_program_shader.c
@@ -701,7 +701,7 @@ static void shader_arb_load_constants_internal(struct shader_arb_priv *priv,
{
const struct wined3d_shader *pshader = state->shader[WINED3D_SHADER_TYPE_PIXEL];
const struct arb_ps_compiled_shader *gl_shader = priv->compiled_fprog;
- UINT rt_height = state->fb->render_targets[0]->height;
+ UINT rt_height = state->fb.render_targets[0]->height;
/* Load DirectX 9 float constants for pixel shader */
priv->highest_dirty_ps_const = shader_arb_load_constants_f(pshader, gl_info, GL_FRAGMENT_PROGRAM_ARB,
@@ -4608,7 +4608,7 @@ static void shader_arb_select(void *shader_priv, struct wined3d_context *context
}
else
{
- UINT rt_height = state->fb->render_targets[0]->height;
+ UINT rt_height = state->fb.render_targets[0]->height;
shader_arb_ps_local_constants(compiled, context, state, rt_height);
}
diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c
index 511b1bd4216..8aa2a77a171 100644
--- a/dlls/wined3d/context.c
+++ b/dlls/wined3d/context.c
@@ -1720,6 +1720,11 @@ struct wined3d_context *context_create(struct wined3d_swapchain *swapchain,
goto out;
}
+ ret->current_fb.rt_size = gl_info->limits.buffers;
+ if (!(ret->current_fb.render_targets = wined3d_calloc(ret->current_fb.rt_size,
+ sizeof(*ret->current_fb.render_targets))))
+ goto out;
+
/* Initialize the texture unit mapping to a 1:1 mapping */
for (s = 0; s < MAX_COMBINED_SAMPLERS; ++s)
{
@@ -2032,6 +2037,7 @@ out:
device->shader_backend->shader_free_context_data(ret);
device->adapter->fragment_pipe->free_context_data(ret);
HeapFree(GetProcessHeap(), 0, ret->texture_type);
+ HeapFree(GetProcessHeap(), 0, ret->current_fb.render_targets);
HeapFree(GetProcessHeap(), 0, ret->free_event_queries);
HeapFree(GetProcessHeap(), 0, ret->free_occlusion_queries);
HeapFree(GetProcessHeap(), 0, ret->free_timestamp_queries);
@@ -2080,6 +2086,7 @@ void context_destroy(struct wined3d_device *device, struct wined3d_context *cont
device->adapter->fragment_pipe->free_context_data(context);
HeapFree(GetProcessHeap(), 0, context->texture_type);
HeapFree(GetProcessHeap(), 0, context->fbo_key);
+ HeapFree(GetProcessHeap(), 0, context->current_fb.render_targets);
HeapFree(GetProcessHeap(), 0, context->draw_buffers);
HeapFree(GetProcessHeap(), 0, context->blit_targets);
device_context_remove(device, context);
@@ -2642,7 +2649,7 @@ BOOL context_apply_clear_state(struct wined3d_context *context, const struct win
DWORD rt_mask = 0, *cur_mask;
UINT i;
- if (isStateDirty(context, STATE_FRAMEBUFFER) || fb != state->fb
+ if (isStateDirty(context, STATE_FRAMEBUFFER) || !wined3d_fb_equal(fb, &state->fb)
|| rt_count != gl_info->limits.buffers)
{
if (!context_validate_rt_config(rt_count, rts, dsv))
@@ -2687,6 +2694,8 @@ BOOL context_apply_clear_state(struct wined3d_context *context, const struct win
rt_mask = context_generate_rt_mask_no_fbo(context,
rt_count ? wined3d_rendertarget_view_get_surface(rts[0])->container : NULL);
}
+
+ wined3d_fb_copy(&context->current_fb, fb);
}
else if (wined3d_settings.offscreen_rendering_mode == ORM_FBO
&& (!rt_count || wined3d_resource_is_offscreen(rts[0]->resource)))
@@ -2743,7 +2752,7 @@ BOOL context_apply_clear_state(struct wined3d_context *context, const struct win
static DWORD find_draw_buffers_mask(const struct wined3d_context *context, const struct wined3d_state *state)
{
- struct wined3d_rendertarget_view **rts = state->fb->render_targets;
+ struct wined3d_rendertarget_view **rts = state->fb.render_targets;
struct wined3d_shader *ps = state->shader[WINED3D_SHADER_TYPE_PIXEL];
DWORD rt_mask, rt_mask_bits;
unsigned int i;
@@ -2773,7 +2782,7 @@ static DWORD find_draw_buffers_mask(const struct wined3d_context *context, const
void context_state_fb(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
{
DWORD rt_mask = find_draw_buffers_mask(context, state);
- const struct wined3d_fb_state *fb = state->fb;
+ const struct wined3d_fb_state *fb = &state->fb;
DWORD *cur_mask;
if (wined3d_settings.offscreen_rendering_mode == ORM_FBO)
@@ -3056,6 +3065,8 @@ void context_state_drawbuf(struct wined3d_context *context, const struct wined3d
context_apply_draw_buffers(context, rt_mask);
*cur_mask = rt_mask;
}
+
+ wined3d_fb_copy(&context->current_fb, &state->fb);
}
static BOOL fixed_get_input(BYTE usage, BYTE usage_idx, unsigned int *regnum)
@@ -3528,7 +3539,7 @@ BOOL context_apply_draw_state(struct wined3d_context *context,
{
const struct StateEntry *state_table = context->state_table;
const struct wined3d_gl_info *gl_info = context->gl_info;
- const struct wined3d_fb_state *fb = state->fb;
+ const struct wined3d_fb_state *fb = &state->fb;
unsigned int i;
WORD map;
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
index a6ee6dda110..5606c73c10b 100644
--- a/dlls/wined3d/cs.c
+++ b/dlls/wined3d/cs.c
@@ -510,7 +510,7 @@ static void wined3d_cs_exec_present(struct wined3d_cs *cs, const void *data)
wined3d_swapchain_set_window(swapchain, op->dst_window_override);
swapchain->swapchain_ops->swapchain_present(swapchain, &op->src_rect, &op->dst_rect, op->flags,
- cs->state.fb->depth_stencil);
+ cs->state.fb.depth_stencil);
InterlockedDecrement(&cs->pending_presents);
@@ -570,19 +570,19 @@ static void wined3d_cs_exec_clear(struct wined3d_cs *cs, const void *data)
state = &cs->state;
wined3d_get_draw_rect(state, &draw_rect);
device_clear_render_targets(device, device->adapter->gl_info.limits.buffers,
- &device->fb, op->rect_count, op->rects, &draw_rect, op->flags,
+ &cs->state.fb, op->rect_count, op->rects, &draw_rect, op->flags,
&op->color, op->depth, op->stencil);
if (op->flags & WINED3DCLEAR_TARGET)
{
for (i = 0; i < device->adapter->gl_info.limits.buffers; ++i)
{
- if (state->fb->render_targets[i])
- wined3d_resource_release(state->fb->render_targets[i]->resource);
+ if (state->fb.render_targets[i])
+ wined3d_resource_release(state->fb.render_targets[i]->resource);
}
}
if (op->flags & (WINED3DCLEAR_ZBUFFER | WINED3DCLEAR_STENCIL))
- wined3d_resource_release(state->fb->depth_stencil->resource);
+ wined3d_resource_release(state->fb.depth_stencil->resource);
}
void wined3d_cs_emit_clear(struct wined3d_cs *cs, DWORD rect_count, const RECT *rects,
@@ -605,12 +605,12 @@ void wined3d_cs_emit_clear(struct wined3d_cs *cs, DWORD rect_count, const RECT *
{
for (i = 0; i < cs->device->adapter->gl_info.limits.buffers; ++i)
{
- if (state->fb->render_targets[i])
- wined3d_resource_acquire(state->fb->render_targets[i]->resource);
+ if (state->fb.render_targets[i])
+ wined3d_resource_acquire(state->fb.render_targets[i]->resource);
}
}
if (flags & (WINED3DCLEAR_ZBUFFER | WINED3DCLEAR_STENCIL))
- wined3d_resource_acquire(state->fb->depth_stencil->resource);
+ wined3d_resource_acquire(state->fb.depth_stencil->resource);
cs->ops->submit(cs);
}
@@ -783,11 +783,11 @@ static void wined3d_cs_exec_draw(struct wined3d_cs *cs, const void *data)
}
for (i = 0; i < cs->device->adapter->gl_info.limits.buffers; ++i)
{
- if (state->fb->render_targets[i])
- wined3d_resource_release(state->fb->render_targets[i]->resource);
+ if (state->fb.render_targets[i])
+ wined3d_resource_release(state->fb.render_targets[i]->resource);
}
- if (state->fb->depth_stencil)
- wined3d_resource_release(state->fb->depth_stencil->resource);
+ if (state->fb.depth_stencil)
+ wined3d_resource_release(state->fb.depth_stencil->resource);
release_shader_resources(state, ~(1u << WINED3D_SHADER_TYPE_COMPUTE));
release_unordered_access_resources(state->shader[WINED3D_SHADER_TYPE_PIXEL],
state->unordered_access_view[WINED3D_PIPELINE_GRAPHICS]);
@@ -823,11 +823,11 @@ void wined3d_cs_emit_draw(struct wined3d_cs *cs, int base_vertex_idx, unsigned i
}
for (i = 0; i < cs->device->adapter->gl_info.limits.buffers; ++i)
{
- if (state->fb->render_targets[i])
- wined3d_resource_acquire(state->fb->render_targets[i]->resource);
+ if (state->fb.render_targets[i])
+ wined3d_resource_acquire(state->fb.render_targets[i]->resource);
}
- if (state->fb->depth_stencil)
- wined3d_resource_acquire(state->fb->depth_stencil->resource);
+ if (state->fb.depth_stencil)
+ wined3d_resource_acquire(state->fb.depth_stencil->resource);
acquire_shader_resources(state, ~(1u << WINED3D_SHADER_TYPE_COMPUTE));
acquire_unordered_access_resources(state->shader[WINED3D_SHADER_TYPE_PIXEL],
state->unordered_access_view[WINED3D_PIPELINE_GRAPHICS]);
@@ -897,7 +897,7 @@ static void wined3d_cs_exec_set_rendertarget_view(struct wined3d_cs *cs, const v
{
const struct wined3d_cs_set_rendertarget_view *op = data;
- cs->state.fb->render_targets[op->view_idx] = op->view;
+ cs->state.fb.render_targets[op->view_idx] = op->view;
device_invalidate_state(cs->device, STATE_FRAMEBUFFER);
}
@@ -920,7 +920,7 @@ static void wined3d_cs_exec_set_depth_stencil_view(struct wined3d_cs *cs, const
struct wined3d_device *device = cs->device;
struct wined3d_rendertarget_view *prev;
- if ((prev = cs->state.fb->depth_stencil))
+ if ((prev = cs->state.fb.depth_stencil))
{
struct wined3d_surface *prev_surface = wined3d_rendertarget_view_get_surface(prev);
@@ -932,7 +932,7 @@ static void wined3d_cs_exec_set_depth_stencil_view(struct wined3d_cs *cs, const
}
}
- cs->fb.depth_stencil = op->view;
+ cs->state.fb.depth_stencil = op->view;
if (!prev != !op->view)
{
@@ -1650,11 +1650,13 @@ void wined3d_cs_emit_set_light_enable(struct wined3d_cs *cs, unsigned int idx, B
static void wined3d_cs_exec_reset_state(struct wined3d_cs *cs, const void *data)
{
struct wined3d_adapter *adapter = cs->device->adapter;
+ HRESULT hr;
state_cleanup(&cs->state);
memset(&cs->state, 0, sizeof(cs->state));
- state_init(&cs->state, &cs->fb, &adapter->gl_info, &adapter->d3d_info,
- WINED3D_STATE_NO_REF | WINED3D_STATE_INIT_DEFAULT);
+ if (FAILED(hr = state_init(&cs->state, &adapter->gl_info, &adapter->d3d_info,
+ WINED3D_STATE_NO_REF | WINED3D_STATE_INIT_DEFAULT)))
+ ERR("Failed to initialize CS state, hr %#x.\n", hr);
}
void wined3d_cs_emit_reset_state(struct wined3d_cs *cs)
@@ -2362,15 +2364,13 @@ struct wined3d_cs *wined3d_cs_create(struct wined3d_device *device)
if (!(cs = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*cs))))
return NULL;
- if (!(cs->fb.render_targets = wined3d_calloc(gl_info->limits.buffers, sizeof(*cs->fb.render_targets))))
+ if (FAILED(state_init(&cs->state, gl_info, &device->adapter->d3d_info,
+ WINED3D_STATE_NO_REF | WINED3D_STATE_INIT_DEFAULT)))
{
HeapFree(GetProcessHeap(), 0, cs);
return NULL;
}
- state_init(&cs->state, &cs->fb, gl_info, &device->adapter->d3d_info,
- WINED3D_STATE_NO_REF | WINED3D_STATE_INIT_DEFAULT);
-
cs->ops = &wined3d_cs_st_ops;
cs->device = device;
@@ -2378,7 +2378,6 @@ struct wined3d_cs *wined3d_cs_create(struct wined3d_device *device)
if (!(cs->data = HeapAlloc(GetProcessHeap(), 0, cs->data_size)))
{
state_cleanup(&cs->state);
- HeapFree(GetProcessHeap(), 0, cs->fb.render_targets);
HeapFree(GetProcessHeap(), 0, cs);
return NULL;
}
@@ -2389,7 +2388,6 @@ struct wined3d_cs *wined3d_cs_create(struct wined3d_device *device)
void wined3d_cs_destroy(struct wined3d_cs *cs)
{
state_cleanup(&cs->state);
- HeapFree(GetProcessHeap(), 0, cs->fb.render_targets);
HeapFree(GetProcessHeap(), 0, cs->data);
HeapFree(GetProcessHeap(), 0, cs);
}
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index 914b99c3d29..78ba0435323 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -957,7 +957,7 @@ static void device_init_swapchain_state(struct wined3d_device *device, struct wi
BOOL ds_enable = !!swapchain->desc.enable_auto_depth_stencil;
unsigned int i;
- if (device->fb.render_targets)
+ if (device->state.fb.render_targets)
{
for (i = 0; i < device->adapter->gl_info.limits.buffers; ++i)
{
@@ -1055,7 +1055,6 @@ HRESULT CDECL wined3d_device_init_3d(struct wined3d_device *device,
struct wined3d_swapchain_desc *swapchain_desc)
{
static const struct wined3d_color black = {0.0f, 0.0f, 0.0f, 0.0f};
- const struct wined3d_gl_info *gl_info = &device->adapter->gl_info;
struct wined3d_swapchain *swapchain = NULL;
DWORD clear_flags = 0;
HRESULT hr;
@@ -1067,9 +1066,6 @@ HRESULT CDECL wined3d_device_init_3d(struct wined3d_device *device,
if (device->wined3d->flags & WINED3D_NO3D)
return WINED3DERR_INVALIDCALL;
- if (!(device->fb.render_targets = wined3d_calloc(gl_info->limits.buffers, sizeof(*device->fb.render_targets))))
- return E_OUTOFMEMORY;
-
/* Setup the implicit swapchain. This also initializes a context. */
TRACE("Creating implicit swapchain\n");
hr = device->device_parent->ops->create_swapchain(device->device_parent,
@@ -1136,7 +1132,6 @@ err_out:
wined3d_rendertarget_view_decref(device->back_buffer_view);
if (swapchain)
wined3d_swapchain_decref(swapchain);
- HeapFree(GetProcessHeap(), 0, device->fb.render_targets);
return hr;
}
@@ -1196,33 +1191,16 @@ HRESULT CDECL wined3d_device_uninit_3d(struct wined3d_device *device)
state_unbind_resources(&device->state);
- wine_rb_clear(&device->samplers, device_free_sampler, NULL);
-
- wined3d_device_delete_opengl_contexts(device);
-
- if (device->fb.depth_stencil)
- {
- struct wined3d_rendertarget_view *view = device->fb.depth_stencil;
-
- TRACE("Releasing depth/stencil view %p.\n", view);
-
- device->fb.depth_stencil = NULL;
- wined3d_rendertarget_view_decref(view);
- }
-
if (device->auto_depth_stencil_view)
{
- struct wined3d_rendertarget_view *view = device->auto_depth_stencil_view;
-
+ wined3d_rendertarget_view_decref(device->auto_depth_stencil_view);
device->auto_depth_stencil_view = NULL;
- if (wined3d_rendertarget_view_decref(view))
- ERR("Something's still holding the auto depth/stencil view (%p).\n", view);
}
- for (i = 0; i < device->adapter->gl_info.limits.buffers; ++i)
- {
- wined3d_device_set_rendertarget_view(device, i, NULL, FALSE);
- }
+ wine_rb_clear(&device->samplers, device_free_sampler, NULL);
+
+ wined3d_device_delete_opengl_contexts(device);
+
if (device->back_buffer_view)
{
wined3d_rendertarget_view_decref(device->back_buffer_view);
@@ -1240,9 +1218,6 @@ HRESULT CDECL wined3d_device_uninit_3d(struct wined3d_device *device)
device->swapchains = NULL;
device->swapchain_count = 0;
- HeapFree(GetProcessHeap(), 0, device->fb.render_targets);
- device->fb.render_targets = NULL;
-
device->d3d_initialized = FALSE;
return WINED3D_OK;
@@ -1949,7 +1924,7 @@ static void resolve_depth_buffer(struct wined3d_state *state)
|| !(dst_texture->resource.format_flags & WINED3DFMT_FLAG_DEPTH))
return;
- if (!(src_view = state->fb->depth_stencil))
+ if (!(src_view = state->fb.depth_stencil))
return;
if (src_view->resource->type == WINED3D_RTYPE_BUFFER)
{
@@ -3487,6 +3462,8 @@ HRESULT CDECL wined3d_device_end_scene(struct wined3d_device *device)
HRESULT CDECL wined3d_device_clear(struct wined3d_device *device, DWORD rect_count,
const RECT *rects, DWORD flags, const struct wined3d_color *color, float depth, DWORD stencil)
{
+ const struct wined3d_fb_state *fb = &device->state.fb;
+
TRACE("device %p, rect_count %u, rects %p, flags %#x, color %s, depth %.8e, stencil %u.\n",
device, rect_count, rects, flags, debug_color(color), depth, stencil);
@@ -3498,7 +3475,7 @@ HRESULT CDECL wined3d_device_clear(struct wined3d_device *device, DWORD rect_cou
if (flags & (WINED3DCLEAR_ZBUFFER | WINED3DCLEAR_STENCIL))
{
- struct wined3d_rendertarget_view *ds = device->fb.depth_stencil;
+ struct wined3d_rendertarget_view *ds = fb->depth_stencil;
if (!ds)
{
WARN("Clearing depth and/or stencil without a depth stencil buffer attached, returning WINED3DERR_INVALIDCALL\n");
@@ -3507,8 +3484,8 @@ HRESULT CDECL wined3d_device_clear(struct wined3d_device *device, DWORD rect_cou
}
else if (flags & WINED3DCLEAR_TARGET)
{
- if (ds->width < device->fb.render_targets[0]->width
- || ds->height < device->fb.render_targets[0]->height)
+ if (ds->width < fb->render_targets[0]->width
+ || ds->height < fb->render_targets[0]->height)
{
WARN("Silently ignoring depth and target clear with mismatching sizes\n");
return WINED3D_OK;
@@ -3858,8 +3835,8 @@ HRESULT CDECL wined3d_device_validate_device(const struct wined3d_device *device
if (state->render_states[WINED3D_RS_ZENABLE] || state->render_states[WINED3D_RS_ZWRITEENABLE]
|| state->render_states[WINED3D_RS_STENCILENABLE])
{
- struct wined3d_rendertarget_view *rt = device->fb.render_targets[0];
- struct wined3d_rendertarget_view *ds = device->fb.depth_stencil;
+ struct wined3d_rendertarget_view *rt = state->fb.render_targets[0];
+ struct wined3d_rendertarget_view *ds = state->fb.depth_stencil;
if (ds && rt && (ds->width < rt->width || ds->height < rt->height))
{
@@ -4294,20 +4271,21 @@ struct wined3d_rendertarget_view * CDECL wined3d_device_get_rendertarget_view(co
return NULL;
}
- return device->fb.render_targets[view_idx];
+ return device->state.fb.render_targets[view_idx];
}
struct wined3d_rendertarget_view * CDECL wined3d_device_get_depth_stencil_view(const struct wined3d_device *device)
{
TRACE("device %p.\n", device);
- return device->fb.depth_stencil;
+ return device->state.fb.depth_stencil;
}
HRESULT CDECL wined3d_device_set_rendertarget_view(struct wined3d_device *device,
unsigned int view_idx, struct wined3d_rendertarget_view *view, BOOL set_viewport)
{
struct wined3d_rendertarget_view *prev;
+ struct wined3d_fb_state *fb = &device->state.fb;
TRACE("device %p, view_idx %u, view %p, set_viewport %#x.\n",
device, view_idx, view, set_viewport);
@@ -4344,13 +4322,13 @@ HRESULT CDECL wined3d_device_set_rendertarget_view(struct wined3d_device *device
}
- prev = device->fb.render_targets[view_idx];
+ prev = fb->render_targets[view_idx];
if (view == prev)
return WINED3D_OK;
if (view)
wined3d_rendertarget_view_incref(view);
- device->fb.render_targets[view_idx] = view;
+ fb->render_targets[view_idx] = view;
wined3d_cs_emit_set_rendertarget_view(device->cs, view_idx, view);
/* Release after the assignment, to prevent device_resource_released()
* from seeing the surface as still in use. */
@@ -4362,18 +4340,19 @@ HRESULT CDECL wined3d_device_set_rendertarget_view(struct wined3d_device *device
void CDECL wined3d_device_set_depth_stencil_view(struct wined3d_device *device, struct wined3d_rendertarget_view *view)
{
+ struct wined3d_fb_state *fb = &device->state.fb;
struct wined3d_rendertarget_view *prev;
TRACE("device %p, view %p.\n", device, view);
- prev = device->fb.depth_stencil;
+ prev = fb->depth_stencil;
if (prev == view)
{
TRACE("Trying to do a NOP SetRenderTarget operation.\n");
return;
}
- if ((device->fb.depth_stencil = view))
+ if ((fb->depth_stencil = view))
wined3d_rendertarget_view_incref(view);
wined3d_cs_emit_set_depth_stencil_view(device->cs, view);
if (prev)
@@ -4639,10 +4618,9 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device,
wined3d_texture_decref(device->cursor_texture);
device->cursor_texture = NULL;
}
- state_unbind_resources(&device->state);
}
- if (device->fb.render_targets)
+ if (device->state.fb.render_targets)
{
for (i = 0; i < device->adapter->gl_info.limits.buffers; ++i)
{
@@ -4653,6 +4631,11 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device,
if (reset_state)
{
+ state_unbind_resources(&device->state);
+ }
+
+ if (reset_state)
+ {
LIST_FOR_EACH_ENTRY_SAFE(resource, cursor, &device->resources, struct wined3d_resource, resource_list_entry)
{
TRACE("Enumerating resource %p.\n", resource);
@@ -4821,27 +4804,28 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device,
if (device->d3d_initialized)
wined3d_device_delete_opengl_contexts(device);
- state_init(&device->state, &device->fb, &device->adapter->gl_info,
- &device->adapter->d3d_info, WINED3D_STATE_INIT_DEFAULT);
+ if (FAILED(hr = state_init(&device->state, &device->adapter->gl_info,
+ &device->adapter->d3d_info, WINED3D_STATE_INIT_DEFAULT)))
+ ERR("Failed to initialize device state, hr %#x.\n", hr);
device->update_state = &device->state;
device_init_swapchain_state(device, swapchain);
}
else if (device->back_buffer_view)
{
- struct wined3d_rendertarget_view *view = device->back_buffer_view;
struct wined3d_state *state = &device->state;
- wined3d_device_set_rendertarget_view(device, 0, view, FALSE);
+ wined3d_device_set_rendertarget_view(device, 0, device->back_buffer_view, FALSE);
/* Note the min_z / max_z is not reset. */
state->viewport.x = 0;
state->viewport.y = 0;
- state->viewport.width = view->width;
- state->viewport.height = view->height;
+ state->viewport.width = swapchain->desc.backbuffer_width;
+ state->viewport.height = swapchain->desc.backbuffer_height;
wined3d_cs_emit_set_viewport(device->cs, &state->viewport);
- SetRect(&state->scissor_rect, 0, 0, view->width, view->height);
+ SetRect(&state->scissor_rect, 0, 0,
+ swapchain->desc.backbuffer_width, swapchain->desc.backbuffer_height);
wined3d_cs_emit_set_scissor_rect(device->cs, &state->scissor_rect);
}
@@ -4933,11 +4917,11 @@ void device_resource_released(struct wined3d_device *device, struct wined3d_reso
{
for (i = 0; i < device->adapter->gl_info.limits.buffers; ++i)
{
- if ((rtv = device->fb.render_targets[i]) && rtv->resource == resource)
+ if ((rtv = device->state.fb.render_targets[i]) && rtv->resource == resource)
ERR("Resource %p is still in use as render target %u.\n", resource, i);
}
- if ((rtv = device->fb.depth_stencil) && rtv->resource == resource)
+ if ((rtv = device->state.fb.depth_stencil) && rtv->resource == resource)
ERR("Resource %p is still in use as depth/stencil buffer.\n", resource);
}
@@ -5063,8 +5047,12 @@ HRESULT device_init(struct wined3d_device *device, struct wined3d *wined3d,
device->blitter = adapter->blitter;
- state_init(&device->state, &device->fb, &adapter->gl_info,
- &adapter->d3d_info, WINED3D_STATE_INIT_DEFAULT);
+ if (FAILED(hr = state_init(&device->state, &adapter->gl_info,
+ &adapter->d3d_info, WINED3D_STATE_INIT_DEFAULT)))
+ {
+ ERR("Failed to initialize device state, hr %#x.\n", hr);
+ goto err;
+ }
device->update_state = &device->state;
if (!(device->cs = wined3d_cs_create(device)))
diff --git a/dlls/wined3d/drawprim.c b/dlls/wined3d/drawprim.c
index 48421ef545e..d8f2ad17f2e 100644
--- a/dlls/wined3d/drawprim.c
+++ b/dlls/wined3d/drawprim.c
@@ -411,7 +411,7 @@ void draw_primitive(struct wined3d_device *device, const struct wined3d_state *s
int base_vertex_idx, unsigned int start_idx, unsigned int index_count,
unsigned int start_instance, unsigned int instance_count, BOOL indexed)
{
- const struct wined3d_fb_state *fb = state->fb;
+ const struct wined3d_fb_state *fb = &state->fb;
const struct wined3d_stream_info *stream_info;
struct wined3d_event_query *ib_query = NULL;
struct wined3d_rendertarget_view *dsv, *rtv;
diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c
index e503d224655..ad3ef2672cf 100644
--- a/dlls/wined3d/glsl_shader.c
+++ b/dlls/wined3d/glsl_shader.c
@@ -1630,7 +1630,7 @@ static void shader_glsl_load_constants(void *shader_priv, struct wined3d_context
const struct wined3d_vec4 correction_params =
{
/* Position is relative to the framebuffer, not the viewport. */
- context->render_offscreen ? 0.0f : (float)state->fb->render_targets[0]->height,
+ context->render_offscreen ? 0.0f : (float)state->fb.render_targets[0]->height,
context->render_offscreen ? 1.0f : -1.0f,
0.0f,
0.0f,
diff --git a/dlls/wined3d/shader.c b/dlls/wined3d/shader.c
index 519d0293357..7230ab6453f 100644
--- a/dlls/wined3d/shader.c
+++ b/dlls/wined3d/shader.c
@@ -3271,7 +3271,7 @@ void find_ps_compile_args(const struct wined3d_state *state, const struct wined3
UINT i;
memset(args, 0, sizeof(*args)); /* FIXME: Make sure all bits are set. */
- if (!gl_info->supported[ARB_FRAMEBUFFER_SRGB] && needs_srgb_write(context, state, state->fb))
+ if (!gl_info->supported[ARB_FRAMEBUFFER_SRGB] && needs_srgb_write(context, state, &state->fb))
{
static unsigned int warned = 0;
diff --git a/dlls/wined3d/state.c b/dlls/wined3d/state.c
index 04a1c84b203..dff3d050b10 100644
--- a/dlls/wined3d/state.c
+++ b/dlls/wined3d/state.c
@@ -152,7 +152,7 @@ static void state_zenable(struct wined3d_context *context, const struct wined3d_
const struct wined3d_gl_info *gl_info = context->gl_info;
/* No z test without depth stencil buffers */
- if (!state->fb->depth_stencil)
+ if (!state->fb.depth_stencil)
{
TRACE("No Z buffer - disabling depth test\n");
zenable = WINED3D_ZB_FALSE;
@@ -474,11 +474,11 @@ static void state_blend(struct wined3d_context *context, const struct wined3d_st
checkGLcall("glDisable(GL_LINE_SMOOTH)");
}
- enable_blend = state->fb->render_targets[0] && state->render_states[WINED3D_RS_ALPHABLENDENABLE];
+ enable_blend = state->fb.render_targets[0] && state->render_states[WINED3D_RS_ALPHABLENDENABLE];
if (enable_blend)
{
- rt_format = state->fb->render_targets[0]->format;
- rt_fmt_flags = state->fb->render_targets[0]->format_flags;
+ rt_format = state->fb.render_targets[0]->format;
+ rt_fmt_flags = state->fb.render_targets[0]->format_flags;
/* Disable blending in all cases even without pixelshaders.
* With blending on we could face a big performance penalty.
@@ -869,7 +869,7 @@ static void state_stencil(struct wined3d_context *context, const struct wined3d_
GLint depthFail_back;
/* No stencil test without a stencil buffer. */
- if (!state->fb->depth_stencil)
+ if (!state->fb.depth_stencil)
{
gl_info->gl_ops.gl.p_glDisable(GL_STENCIL_TEST);
checkGLcall("glDisable GL_STENCIL_TEST");
@@ -965,7 +965,7 @@ static void state_stencil(struct wined3d_context *context, const struct wined3d_
static void state_stencilwrite2s(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
{
- DWORD mask = state->fb->depth_stencil ? state->render_states[WINED3D_RS_STENCILWRITEMASK] : 0;
+ DWORD mask = state->fb.depth_stencil ? state->render_states[WINED3D_RS_STENCILWRITEMASK] : 0;
const struct wined3d_gl_info *gl_info = context->gl_info;
GL_EXTCALL(glActiveStencilFaceEXT(GL_BACK));
@@ -979,7 +979,7 @@ static void state_stencilwrite2s(struct wined3d_context *context, const struct w
static void state_stencilwrite(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
{
- DWORD mask = state->fb->depth_stencil ? state->render_states[WINED3D_RS_STENCILWRITEMASK] : 0;
+ DWORD mask = state->fb.depth_stencil ? state->render_states[WINED3D_RS_STENCILWRITEMASK] : 0;
const struct wined3d_gl_info *gl_info = context->gl_info;
gl_info->gl_ops.gl.p_glStencilMask(mask);
@@ -1717,7 +1717,7 @@ static void state_depthbias(struct wined3d_context *context, const struct wined3
if (state->render_states[WINED3D_RS_SLOPESCALEDEPTHBIAS]
|| state->render_states[WINED3D_RS_DEPTHBIAS])
{
- const struct wined3d_rendertarget_view *depth = state->fb->depth_stencil;
+ const struct wined3d_rendertarget_view *depth = state->fb.depth_stencil;
float scale;
union
@@ -4635,8 +4635,8 @@ static void vertexdeclaration(struct wined3d_context *context, const struct wine
static void viewport_miscpart(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
{
- const struct wined3d_rendertarget_view *depth_stencil = state->fb->depth_stencil;
- const struct wined3d_rendertarget_view *target = state->fb->render_targets[0];
+ const struct wined3d_rendertarget_view *depth_stencil = state->fb.depth_stencil;
+ const struct wined3d_rendertarget_view *target = state->fb.render_targets[0];
const struct wined3d_gl_info *gl_info = context->gl_info;
struct wined3d_viewport vp = state->viewport;
unsigned int width, height;
@@ -4675,8 +4675,8 @@ static void viewport_miscpart(struct wined3d_context *context, const struct wine
static void viewport_miscpart_cc(struct wined3d_context *context,
const struct wined3d_state *state, DWORD state_id)
{
- const struct wined3d_rendertarget_view *depth_stencil = state->fb->depth_stencil;
- const struct wined3d_rendertarget_view *target = state->fb->render_targets[0];
+ const struct wined3d_rendertarget_view *depth_stencil = state->fb.depth_stencil;
+ const struct wined3d_rendertarget_view *target = state->fb.render_targets[0];
float pixel_center_offset = context->d3d_info->wined3d_creation_flags
& WINED3D_PIXEL_CENTER_INTEGER ? 0.5f : 0.0f;
const struct wined3d_gl_info *gl_info = context->gl_info;
@@ -4871,7 +4871,7 @@ static void scissorrect(struct wined3d_context *context, const struct wined3d_st
}
else
{
- const struct wined3d_rendertarget_view *target = state->fb->render_targets[0];
+ const struct wined3d_rendertarget_view *target = state->fb.render_targets[0];
UINT height;
UINT width;
@@ -4947,7 +4947,7 @@ void state_srgbwrite(struct wined3d_context *context, const struct wined3d_state
TRACE("context %p, state %p, state_id %#x.\n", context, state, state_id);
- if (needs_srgb_write(context, state, state->fb))
+ if (needs_srgb_write(context, state, &state->fb))
gl_info->gl_ops.gl.p_glEnable(GL_FRAMEBUFFER_SRGB);
else
gl_info->gl_ops.gl.p_glDisable(GL_FRAMEBUFFER_SRGB);
diff --git a/dlls/wined3d/stateblock.c b/dlls/wined3d/stateblock.c
index ad347082c4d..a823ccb3168 100644
--- a/dlls/wined3d/stateblock.c
+++ b/dlls/wined3d/stateblock.c
@@ -431,6 +431,7 @@ void state_unbind_resources(struct wined3d_state *state)
struct wined3d_texture *texture;
struct wined3d_buffer *buffer;
struct wined3d_shader *shader;
+ struct wined3d_rendertarget_view *view;
unsigned int i, j;
if ((decl = state->vertex_declaration))
@@ -519,6 +520,31 @@ void state_unbind_resources(struct wined3d_state *state)
}
}
}
+
+ if (state->fb.depth_stencil)
+ {
+ view = state->fb.depth_stencil;
+
+ TRACE("Releasing depth/stencil buffer %p.\n", view);
+
+ state->fb.depth_stencil = NULL;
+ wined3d_rendertarget_view_decref(view);
+ }
+
+ if (state->fb.render_targets)
+ {
+ for (i = 0; i < state->fb.rt_size; i++)
+ {
+ view = state->fb.render_targets[i];
+ TRACE("Setting rendertarget %u to NULL\n", i);
+ state->fb.render_targets[i] = NULL;
+ if (view)
+ {
+ TRACE("Releasing the rendertarget view at %p\n", view);
+ wined3d_rendertarget_view_decref(view);
+ }
+ }
+ }
}
void state_cleanup(struct wined3d_state *state)
@@ -543,6 +569,8 @@ void state_cleanup(struct wined3d_state *state)
HeapFree(GetProcessHeap(), 0, light);
}
}
+
+ HeapFree(GetProcessHeap(), 0, state->fb.render_targets);
}
ULONG CDECL wined3d_stateblock_decref(struct wined3d_stateblock *stateblock)
@@ -1317,32 +1345,41 @@ static void state_init_default(struct wined3d_state *state, const struct wined3d
}
}
-void state_init(struct wined3d_state *state, struct wined3d_fb_state *fb,
- const struct wined3d_gl_info *gl_info, const struct wined3d_d3d_info *d3d_info,
- DWORD flags)
+HRESULT state_init(struct wined3d_state *state, const struct wined3d_gl_info *gl_info,
+ const struct wined3d_d3d_info *d3d_info, DWORD flags)
{
unsigned int i;
state->flags = flags;
- state->fb = fb;
for (i = 0; i < LIGHTMAP_SIZE; i++)
{
list_init(&state->light_map[i]);
}
+ state->fb.rt_size = gl_info->limits.buffers;
+ if (!(state->fb.render_targets = wined3d_calloc(state->fb.rt_size,
+ sizeof(*state->fb.render_targets))))
+ return E_OUTOFMEMORY;
+
if (flags & WINED3D_STATE_INIT_DEFAULT)
state_init_default(state, gl_info);
+
+ return WINED3D_OK;
}
static HRESULT stateblock_init(struct wined3d_stateblock *stateblock,
struct wined3d_device *device, enum wined3d_stateblock_type type)
{
+ const struct wined3d_gl_info *gl_info = &device->adapter->gl_info;
const struct wined3d_d3d_info *d3d_info = &device->adapter->d3d_info;
+ HRESULT hr;
stateblock->ref = 1;
stateblock->device = device;
- state_init(&stateblock->state, NULL, &device->adapter->gl_info, d3d_info, 0);
+
+ if (FAILED(hr = state_init(&stateblock->state, gl_info, d3d_info, 0)))
+ return hr;
if (type == WINED3D_SBT_RECORDED)
return WINED3D_OK;
diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
index e641dcc8b80..086bd2d7403 100644
--- a/dlls/wined3d/surface.c
+++ b/dlls/wined3d/surface.c
@@ -2487,7 +2487,7 @@ static HRESULT surface_blt_special(struct wined3d_surface *dst_surface, const RE
{
struct wined3d_texture *dst_texture = dst_surface->container;
struct wined3d_device *device = dst_texture->resource.device;
- const struct wined3d_surface *rt = wined3d_rendertarget_view_get_surface(device->fb.render_targets[0]);
+ const struct wined3d_surface *rt = wined3d_rendertarget_view_get_surface(device->state.fb.render_targets[0]);
struct wined3d_swapchain *src_swapchain, *dst_swapchain;
struct wined3d_texture *src_texture;
diff --git a/dlls/wined3d/utils.c b/dlls/wined3d/utils.c
index 04ff2f7b50e..cd210b9f9b7 100644
--- a/dlls/wined3d/utils.c
+++ b/dlls/wined3d/utils.c
@@ -4642,7 +4642,7 @@ void get_projection_matrix(const struct wined3d_context *context, const struct w
float y_offset = flip
? (center_offset - (2.0f * y) - h) / h
: (center_offset - (2.0f * y) - h) / -h;
- enum wined3d_depth_buffer_type zenable = state->fb->depth_stencil ?
+ enum wined3d_depth_buffer_type zenable = state->fb.depth_stencil ?
state->render_states[WINED3D_RS_ZENABLE] : WINED3D_ZB_FALSE;
float z_scale = zenable ? clip_control ? 1.0f : 2.0f : 0.0f;
float z_offset = zenable ? clip_control ? 0.0f : -1.0f : 0.0f;
@@ -5454,7 +5454,7 @@ void gen_ffp_frag_op(const struct wined3d_context *context, const struct wined3d
break;
}
}
- settings->sRGB_write = !gl_info->supported[ARB_FRAMEBUFFER_SRGB] && needs_srgb_write(context, state, state->fb);
+ settings->sRGB_write = !gl_info->supported[ARB_FRAMEBUFFER_SRGB] && needs_srgb_write(context, state, &state->fb);
if (d3d_info->vs_clipping || !use_vs(state) || !state->render_states[WINED3D_RS_CLIPPING]
|| !state->render_states[WINED3D_RS_CLIPPLANEENABLE])
{
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index f384e6b7ae5..c9b40b190db 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -1560,6 +1560,36 @@ struct wined3d_timestamp_query
void context_alloc_timestamp_query(struct wined3d_context *context, struct wined3d_timestamp_query *query) DECLSPEC_HIDDEN;
void context_free_timestamp_query(struct wined3d_timestamp_query *query) DECLSPEC_HIDDEN;
+struct wined3d_fb_state
+{
+ struct wined3d_rendertarget_view **render_targets;
+ struct wined3d_rendertarget_view *depth_stencil;
+ UINT rt_size;
+};
+
+static inline BOOL wined3d_fb_equal(const struct wined3d_fb_state *fb1, const struct wined3d_fb_state *fb2)
+{
+ UINT i;
+
+ if (fb1->depth_stencil != fb2->depth_stencil)
+ return FALSE;
+ if (fb1->rt_size != fb2->rt_size)
+ return FALSE;
+ for (i = 0; i < fb1->rt_size; i++)
+ if (fb1->render_targets[i] != fb2->render_targets[i])
+ return FALSE;
+ return TRUE;
+}
+
+static inline void wined3d_fb_copy(struct wined3d_fb_state *dst, const struct wined3d_fb_state *src)
+{
+ UINT i;
+
+ dst->depth_stencil = src->depth_stencil;
+ for (i = 0; i < min(dst->rt_size, src->rt_size); i++)
+ dst->render_targets[i] = src->render_targets[i];
+}
+
struct wined3d_context
{
const struct wined3d_gl_info *gl_info;
@@ -1575,6 +1605,7 @@ struct wined3d_context
DWORD numDirtyEntries;
DWORD isStateDirty[STATE_HIGHEST / (sizeof(DWORD) * CHAR_BIT) + 1]; /* Bitmap to find out quickly if a state is dirty */
unsigned int dirty_compute_states[STATE_COMPUTE_COUNT / (sizeof(unsigned int) * CHAR_BIT) + 1];
+ struct wined3d_fb_state current_fb;
struct wined3d_device *device;
struct wined3d_swapchain *swapchain;
@@ -1689,12 +1720,6 @@ struct wined3d_context
GLuint dummy_arbfp_prog;
};
-struct wined3d_fb_state
-{
- struct wined3d_rendertarget_view **render_targets;
- struct wined3d_rendertarget_view *depth_stencil;
-};
-
typedef void (*APPLYSTATEFUNC)(struct wined3d_context *ctx, const struct wined3d_state *state, DWORD state_id);
struct StateEntry
@@ -2523,7 +2548,7 @@ struct wined3d_stream_state
struct wined3d_state
{
DWORD flags;
- const struct wined3d_fb_state *fb;
+ struct wined3d_fb_state fb;
struct wined3d_vertex_declaration *vertex_declaration;
struct wined3d_stream_output stream_output[MAX_STREAM_OUT];
@@ -2637,7 +2662,6 @@ struct wined3d_device
struct wine_rb_tree samplers;
/* Render Target Support */
- struct wined3d_fb_state fb;
struct wined3d_rendertarget_view *auto_depth_stencil_view;
/* Cursor management */
@@ -3182,9 +3206,8 @@ void wined3d_state_enable_light(struct wined3d_state *state, const struct wined3
struct wined3d_light_info *light_info, BOOL enable) DECLSPEC_HIDDEN;
struct wined3d_light_info *wined3d_state_get_light(const struct wined3d_state *state,
unsigned int idx) DECLSPEC_HIDDEN;
-void state_init(struct wined3d_state *state, struct wined3d_fb_state *fb,
- const struct wined3d_gl_info *gl_info, const struct wined3d_d3d_info *d3d_info,
- DWORD flags) DECLSPEC_HIDDEN;
+HRESULT state_init(struct wined3d_state *state, const struct wined3d_gl_info *gl_info,
+ const struct wined3d_d3d_info *d3d_info, DWORD flags) DECLSPEC_HIDDEN;
void state_unbind_resources(struct wined3d_state *state) DECLSPEC_HIDDEN;
enum wined3d_push_constants
@@ -3208,7 +3231,6 @@ struct wined3d_cs
{
const struct wined3d_cs_ops *ops;
struct wined3d_device *device;
- struct wined3d_fb_state fb;
struct wined3d_state state;
size_t data_size, start, end;
--
2.11.0

View File

@ -1,89 +0,0 @@
From fabdd4237545714b754ab6ddce9fcbca433d5876 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20D=C3=B6singer?= <stefandoesinger@gmx.at>
Date: Thu, 7 Apr 2016 19:51:54 +0100
Subject: wined3d: Don't access device state in clears.
---
dlls/wined3d/context.c | 7 ++++---
dlls/wined3d/device.c | 5 ++---
dlls/wined3d/wined3d_private.h | 2 +-
3 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c
index bb65538ad7b..adffe0127bc 100644
--- a/dlls/wined3d/context.c
+++ b/dlls/wined3d/context.c
@@ -2635,7 +2635,7 @@ static BOOL context_validate_rt_config(UINT rt_count, struct wined3d_rendertarge
}
/* Context activation is done by the caller. */
-BOOL context_apply_clear_state(struct wined3d_context *context, const struct wined3d_state *state,
+BOOL context_apply_clear_state(struct wined3d_context *context,
UINT rt_count, const struct wined3d_fb_state *fb)
{
struct wined3d_rendertarget_view **rts = fb->render_targets;
@@ -2644,7 +2644,7 @@ BOOL context_apply_clear_state(struct wined3d_context *context, const struct win
DWORD rt_mask = 0, *cur_mask;
UINT i;
- if (isStateDirty(context, STATE_FRAMEBUFFER) || !wined3d_fb_equal(fb, &state->fb)
+ if (isStateDirty(context, STATE_FRAMEBUFFER) || !wined3d_fb_equal(fb, &context->current_fb)
|| rt_count != gl_info->limits.buffers)
{
if (!context_validate_rt_config(rt_count, rts, dsv))
@@ -2730,7 +2730,8 @@ BOOL context_apply_clear_state(struct wined3d_context *context, const struct win
gl_info->gl_ops.gl.p_glEnable(GL_SCISSOR_TEST);
if (rt_count && gl_info->supported[ARB_FRAMEBUFFER_SRGB])
{
- if (needs_srgb_write(context, state, fb))
+ /* FIXME: The way to access the state is ugly. */
+ if (needs_srgb_write(context, &rts[0]->resource->device->cs->state, fb))
gl_info->gl_ops.gl.p_glEnable(GL_FRAMEBUFFER_SRGB);
else
gl_info->gl_ops.gl.p_glDisable(GL_FRAMEBUFFER_SRGB);
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index 62abafd4125..32d25cd1d0f 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -223,7 +223,6 @@ void device_clear_render_targets(struct wined3d_device *device, UINT rt_count, c
struct wined3d_surface *target = rtv ? wined3d_rendertarget_view_get_surface(rtv) : NULL;
struct wined3d_rendertarget_view *dsv = fb->depth_stencil;
struct wined3d_surface *depth_stencil = dsv ? wined3d_rendertarget_view_get_surface(dsv) : NULL;
- const struct wined3d_state *state = &device->state;
const struct wined3d_gl_info *gl_info;
UINT drawable_width, drawable_height;
struct wined3d_color corrected_color;
@@ -293,7 +292,7 @@ void device_clear_render_targets(struct wined3d_device *device, UINT rt_count, c
dsv->sub_resource_idx, context, location);
}
- if (!context_apply_clear_state(context, state, rt_count, fb))
+ if (!context_apply_clear_state(context, rt_count, fb))
{
context_release(context);
WARN("Failed to apply clear state, skipping clear.\n");
@@ -350,7 +349,7 @@ void device_clear_render_targets(struct wined3d_device *device, UINT rt_count, c
wined3d_texture_invalidate_location(texture, rtv->sub_resource_idx, ~rtv->resource->draw_binding);
}
- if (!gl_info->supported[ARB_FRAMEBUFFER_SRGB] && needs_srgb_write(context, state, fb))
+ if (!gl_info->supported[ARB_FRAMEBUFFER_SRGB] && needs_srgb_write(context, &device->cs->state, fb))
{
if (rt_count > 1)
WARN("Clearing multiple sRGB render targets with no GL_ARB_framebuffer_sRGB "
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 7d921011577..7ad99bca086 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -1852,7 +1852,7 @@ void context_alloc_event_query(struct wined3d_context *context,
void context_alloc_occlusion_query(struct wined3d_context *context,
struct wined3d_occlusion_query *query) DECLSPEC_HIDDEN;
void context_apply_blit_state(struct wined3d_context *context, const struct wined3d_device *device) DECLSPEC_HIDDEN;
-BOOL context_apply_clear_state(struct wined3d_context *context, const struct wined3d_state *state,
+BOOL context_apply_clear_state(struct wined3d_context *context,
UINT rt_count, const struct wined3d_fb_state *fb) DECLSPEC_HIDDEN;
void context_apply_compute_state(struct wined3d_context *context,
const struct wined3d_device *device, const struct wined3d_state *state) DECLSPEC_HIDDEN;
--
2.11.0

View File

@ -1,21 +1,21 @@
From 0d9d017dd3eb6404143209e1e91d8c55b3d24832 Mon Sep 17 00:00:00 2001
From 14c03f8d908801366664836b6a4b4191cf2eacb4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20D=C3=B6singer?= <stefan@codeweavers.com>
Date: Tue, 1 Oct 2013 14:31:56 +0200
Subject: wined3d: Hackily introduce a multithreaded command stream
---
dlls/wined3d/context.c | 3 +
dlls/wined3d/cs.c | 450 +++++++++++++++++++++++++++++++++++------
dlls/wined3d/cs.c | 447 +++++++++++++++++++++++++++++++++++------
dlls/wined3d/device.c | 2 +-
dlls/wined3d/wined3d_main.c | 10 +
dlls/wined3d/wined3d_private.h | 33 ++-
5 files changed, 435 insertions(+), 63 deletions(-)
5 files changed, 433 insertions(+), 62 deletions(-)
diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c
index af868464970..d0417e7644a 100644
index 511b1bd4216..61c338a7698 100644
--- a/dlls/wined3d/context.c
+++ b/dlls/wined3d/context.c
@@ -3758,6 +3758,9 @@ struct wined3d_context *context_acquire(const struct wined3d_device *device,
@@ -3746,6 +3746,9 @@ struct wined3d_context *context_acquire(const struct wined3d_device *device,
TRACE("device %p, texture %p, sub_resource_idx %u.\n", device, texture, sub_resource_idx);
@ -26,7 +26,7 @@ index af868464970..d0417e7644a 100644
current_context = NULL;
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
index 2f43fccfcc9..126c6c24431 100644
index f888c013127..0c751c3176d 100644
--- a/dlls/wined3d/cs.c
+++ b/dlls/wined3d/cs.c
@@ -18,6 +18,7 @@
@ -37,7 +37,7 @@ index 2f43fccfcc9..126c6c24431 100644
#include "wined3d_private.h"
WINE_DEFAULT_DEBUG_CHANNEL(d3d);
@@ -79,6 +80,7 @@ enum wined3d_cs_op
@@ -78,6 +79,7 @@ enum wined3d_cs_op
WINED3D_CS_OP_TEXTURE_ADD_DIRTY_REGION,
WINED3D_CS_OP_BUFFER_COPY,
WINED3D_CS_OP_MAP_VERTEX_BUFFERS,
@ -45,7 +45,7 @@ index 2f43fccfcc9..126c6c24431 100644
};
struct wined3d_cs_sync
@@ -476,8 +478,14 @@ struct wined3d_cs_map_vertex_buffers
@@ -470,8 +472,14 @@ struct wined3d_cs_map_vertex_buffers
struct wined3d_stream_info *stream_info;
};
@ -61,7 +61,7 @@ index 2f43fccfcc9..126c6c24431 100644
}
void wined3d_cs_emit_sync(struct wined3d_cs *cs)
@@ -490,12 +498,14 @@ void wined3d_cs_emit_sync(struct wined3d_cs *cs)
@@ -484,12 +492,14 @@ void wined3d_cs_emit_sync(struct wined3d_cs *cs)
cs->ops->submit_and_wait(cs);
}
@ -77,7 +77,7 @@ index 2f43fccfcc9..126c6c24431 100644
}
void wined3d_cs_emit_glfinish(struct wined3d_cs *cs)
@@ -508,7 +518,7 @@ void wined3d_cs_emit_glfinish(struct wined3d_cs *cs)
@@ -502,7 +512,7 @@ void wined3d_cs_emit_glfinish(struct wined3d_cs *cs)
cs->ops->submit_and_wait(cs);
}
@ -86,7 +86,7 @@ index 2f43fccfcc9..126c6c24431 100644
{
const struct wined3d_cs_present *op = data;
struct wined3d_swapchain *swapchain;
@@ -527,6 +537,8 @@ static void wined3d_cs_exec_present(struct wined3d_cs *cs, const void *data)
@@ -521,6 +531,8 @@ static void wined3d_cs_exec_present(struct wined3d_cs *cs, const void *data)
{
wined3d_resource_release(&swapchain->back_buffers[i]->resource);
}
@ -95,32 +95,32 @@ index 2f43fccfcc9..126c6c24431 100644
}
void wined3d_cs_emit_present(struct wined3d_cs *cs, struct wined3d_swapchain *swapchain,
@@ -566,13 +578,14 @@ void wined3d_cs_emit_present(struct wined3d_cs *cs, struct wined3d_swapchain *sw
@@ -560,13 +572,14 @@ void wined3d_cs_emit_present(struct wined3d_cs *cs, struct wined3d_swapchain *sw
pending = InterlockedCompareExchange(&cs->pending_presents, 0, 0);
}
-static void wined3d_cs_exec_clear(struct wined3d_cs *cs, const void *data)
+static UINT wined3d_cs_exec_clear(struct wined3d_cs *cs, const void *data)
{
const struct wined3d_state *state = &cs->state;
const struct wined3d_cs_clear *op = data;
const struct wined3d_state *state;
struct wined3d_device *device;
unsigned int i;
RECT draw_rect;
+ size_t size = FIELD_OFFSET(struct wined3d_cs_clear, rects[op->rect_count]);
device = cs->device;
state = &cs->state;
@@ -591,6 +604,8 @@ static void wined3d_cs_exec_clear(struct wined3d_cs *cs, const void *data)
wined3d_get_draw_rect(state, &draw_rect);
@@ -584,6 +597,8 @@ static void wined3d_cs_exec_clear(struct wined3d_cs *cs, const void *data)
}
if (op->flags & (WINED3DCLEAR_ZBUFFER | WINED3DCLEAR_STENCIL))
wined3d_resource_release(state->fb.depth_stencil->resource);
wined3d_resource_release(state->fb->depth_stencil->resource);
+
+ return size;
}
void wined3d_cs_emit_clear(struct wined3d_cs *cs, DWORD rect_count, const RECT *rects,
@@ -729,7 +744,7 @@ static void release_unordered_access_resources(const struct wined3d_shader *shad
@@ -722,7 +737,7 @@ static void release_unordered_access_resources(const struct wined3d_shader *shad
}
}
@ -129,7 +129,7 @@ index 2f43fccfcc9..126c6c24431 100644
{
struct wined3d_state *state = &cs->state;
const struct wined3d_cs_dispatch *op = data;
@@ -740,6 +755,8 @@ static void wined3d_cs_exec_dispatch(struct wined3d_cs *cs, const void *data)
@@ -733,6 +748,8 @@ static void wined3d_cs_exec_dispatch(struct wined3d_cs *cs, const void *data)
release_shader_resources(state, 1u << WINED3D_SHADER_TYPE_COMPUTE);
release_unordered_access_resources(state->shader[WINED3D_SHADER_TYPE_COMPUTE],
state->unordered_access_view[WINED3D_PIPELINE_COMPUTE]);
@ -138,7 +138,7 @@ index 2f43fccfcc9..126c6c24431 100644
}
void wined3d_cs_emit_dispatch(struct wined3d_cs *cs,
@@ -761,7 +778,7 @@ void wined3d_cs_emit_dispatch(struct wined3d_cs *cs,
@@ -754,7 +771,7 @@ void wined3d_cs_emit_dispatch(struct wined3d_cs *cs,
cs->ops->submit(cs);
}
@ -155,8 +155,8 @@ index 2f43fccfcc9..126c6c24431 100644
+ return sizeof(*op);
}
void wined3d_cs_emit_draw(struct wined3d_cs *cs, int base_vertex_idx, unsigned int start_idx,
@@ -843,12 +862,14 @@ void wined3d_cs_emit_draw(struct wined3d_cs *cs, int base_vertex_idx, unsigned i
void wined3d_cs_emit_draw(struct wined3d_cs *cs, GLenum primitive_type, int base_vertex_idx, unsigned int start_idx,
@@ -844,12 +863,14 @@ void wined3d_cs_emit_draw(struct wined3d_cs *cs, GLenum primitive_type, int base
cs->ops->submit(cs);
}
@ -172,7 +172,7 @@ index 2f43fccfcc9..126c6c24431 100644
}
void wined3d_cs_emit_set_predication(struct wined3d_cs *cs, struct wined3d_query *predicate, BOOL value)
@@ -863,12 +884,14 @@ void wined3d_cs_emit_set_predication(struct wined3d_cs *cs, struct wined3d_query
@@ -864,12 +885,14 @@ void wined3d_cs_emit_set_predication(struct wined3d_cs *cs, struct wined3d_query
cs->ops->submit(cs);
}
@ -188,7 +188,7 @@ index 2f43fccfcc9..126c6c24431 100644
}
void wined3d_cs_emit_set_viewport(struct wined3d_cs *cs, const struct wined3d_viewport *viewport)
@@ -882,12 +905,14 @@ void wined3d_cs_emit_set_viewport(struct wined3d_cs *cs, const struct wined3d_vi
@@ -883,12 +906,14 @@ void wined3d_cs_emit_set_viewport(struct wined3d_cs *cs, const struct wined3d_vi
cs->ops->submit(cs);
}
@ -204,7 +204,7 @@ index 2f43fccfcc9..126c6c24431 100644
}
void wined3d_cs_emit_set_scissor_rect(struct wined3d_cs *cs, const RECT *rect)
@@ -901,12 +926,14 @@ void wined3d_cs_emit_set_scissor_rect(struct wined3d_cs *cs, const RECT *rect)
@@ -902,12 +927,14 @@ void wined3d_cs_emit_set_scissor_rect(struct wined3d_cs *cs, const RECT *rect)
cs->ops->submit(cs);
}
@ -213,14 +213,14 @@ index 2f43fccfcc9..126c6c24431 100644
{
const struct wined3d_cs_set_rendertarget_view *op = data;
cs->state.fb.render_targets[op->view_idx] = op->view;
cs->state.fb->render_targets[op->view_idx] = op->view;
device_invalidate_state(cs->device, STATE_FRAMEBUFFER);
+
+ return sizeof(*op);
}
void wined3d_cs_emit_set_rendertarget_view(struct wined3d_cs *cs, unsigned int view_idx,
@@ -922,7 +949,7 @@ void wined3d_cs_emit_set_rendertarget_view(struct wined3d_cs *cs, unsigned int v
@@ -923,7 +950,7 @@ void wined3d_cs_emit_set_rendertarget_view(struct wined3d_cs *cs, unsigned int v
cs->ops->submit(cs);
}
@ -229,7 +229,7 @@ index 2f43fccfcc9..126c6c24431 100644
{
const struct wined3d_cs_set_depth_stencil_view *op = data;
struct wined3d_device *device = cs->device;
@@ -957,6 +984,8 @@ static void wined3d_cs_exec_set_depth_stencil_view(struct wined3d_cs *cs, const
@@ -958,6 +985,8 @@ static void wined3d_cs_exec_set_depth_stencil_view(struct wined3d_cs *cs, const
}
device_invalidate_state(device, STATE_FRAMEBUFFER);
@ -238,7 +238,7 @@ index 2f43fccfcc9..126c6c24431 100644
}
void wined3d_cs_emit_set_depth_stencil_view(struct wined3d_cs *cs, struct wined3d_rendertarget_view *view)
@@ -970,12 +999,14 @@ void wined3d_cs_emit_set_depth_stencil_view(struct wined3d_cs *cs, struct wined3
@@ -971,12 +1000,14 @@ void wined3d_cs_emit_set_depth_stencil_view(struct wined3d_cs *cs, struct wined3
cs->ops->submit(cs);
}
@ -254,7 +254,7 @@ index 2f43fccfcc9..126c6c24431 100644
}
void wined3d_cs_emit_set_vertex_declaration(struct wined3d_cs *cs, struct wined3d_vertex_declaration *declaration)
@@ -989,7 +1020,7 @@ void wined3d_cs_emit_set_vertex_declaration(struct wined3d_cs *cs, struct wined3
@@ -990,7 +1021,7 @@ void wined3d_cs_emit_set_vertex_declaration(struct wined3d_cs *cs, struct wined3
cs->ops->submit(cs);
}
@ -263,7 +263,7 @@ index 2f43fccfcc9..126c6c24431 100644
{
const struct wined3d_cs_set_stream_source *op = data;
struct wined3d_stream_state *stream;
@@ -1007,6 +1038,8 @@ static void wined3d_cs_exec_set_stream_source(struct wined3d_cs *cs, const void
@@ -1008,6 +1039,8 @@ static void wined3d_cs_exec_set_stream_source(struct wined3d_cs *cs, const void
InterlockedDecrement(&prev->resource.bind_count);
device_invalidate_state(cs->device, STATE_STREAMSRC);
@ -272,7 +272,7 @@ index 2f43fccfcc9..126c6c24431 100644
}
void wined3d_cs_emit_set_stream_source(struct wined3d_cs *cs, UINT stream_idx,
@@ -1024,7 +1057,7 @@ void wined3d_cs_emit_set_stream_source(struct wined3d_cs *cs, UINT stream_idx,
@@ -1025,7 +1058,7 @@ void wined3d_cs_emit_set_stream_source(struct wined3d_cs *cs, UINT stream_idx,
cs->ops->submit(cs);
}
@ -281,7 +281,7 @@ index 2f43fccfcc9..126c6c24431 100644
{
const struct wined3d_cs_set_stream_source_freq *op = data;
struct wined3d_stream_state *stream;
@@ -1034,6 +1067,8 @@ static void wined3d_cs_exec_set_stream_source_freq(struct wined3d_cs *cs, const
@@ -1035,6 +1068,8 @@ static void wined3d_cs_exec_set_stream_source_freq(struct wined3d_cs *cs, const
stream->flags = op->flags;
device_invalidate_state(cs->device, STATE_STREAMSRC);
@ -290,7 +290,7 @@ index 2f43fccfcc9..126c6c24431 100644
}
void wined3d_cs_emit_set_stream_source_freq(struct wined3d_cs *cs, UINT stream_idx, UINT frequency, UINT flags)
@@ -1049,7 +1084,7 @@ void wined3d_cs_emit_set_stream_source_freq(struct wined3d_cs *cs, UINT stream_i
@@ -1050,7 +1085,7 @@ void wined3d_cs_emit_set_stream_source_freq(struct wined3d_cs *cs, UINT stream_i
cs->ops->submit(cs);
}
@ -299,7 +299,7 @@ index 2f43fccfcc9..126c6c24431 100644
{
const struct wined3d_cs_set_stream_output *op = data;
struct wined3d_stream_output *stream;
@@ -1064,6 +1099,8 @@ static void wined3d_cs_exec_set_stream_output(struct wined3d_cs *cs, const void
@@ -1065,6 +1100,8 @@ static void wined3d_cs_exec_set_stream_output(struct wined3d_cs *cs, const void
InterlockedIncrement(&op->buffer->resource.bind_count);
if (prev)
InterlockedDecrement(&prev->resource.bind_count);
@ -308,7 +308,7 @@ index 2f43fccfcc9..126c6c24431 100644
}
void wined3d_cs_emit_set_stream_output(struct wined3d_cs *cs, UINT stream_idx,
@@ -1080,7 +1117,7 @@ void wined3d_cs_emit_set_stream_output(struct wined3d_cs *cs, UINT stream_idx,
@@ -1081,7 +1118,7 @@ void wined3d_cs_emit_set_stream_output(struct wined3d_cs *cs, UINT stream_idx,
cs->ops->submit(cs);
}
@ -317,7 +317,7 @@ index 2f43fccfcc9..126c6c24431 100644
{
const struct wined3d_cs_set_index_buffer *op = data;
struct wined3d_buffer *prev;
@@ -1096,6 +1133,8 @@ static void wined3d_cs_exec_set_index_buffer(struct wined3d_cs *cs, const void *
@@ -1097,6 +1134,8 @@ static void wined3d_cs_exec_set_index_buffer(struct wined3d_cs *cs, const void *
InterlockedDecrement(&prev->resource.bind_count);
device_invalidate_state(cs->device, STATE_INDEXBUFFER);
@ -326,7 +326,7 @@ index 2f43fccfcc9..126c6c24431 100644
}
void wined3d_cs_emit_set_index_buffer(struct wined3d_cs *cs, struct wined3d_buffer *buffer,
@@ -1112,7 +1151,7 @@ void wined3d_cs_emit_set_index_buffer(struct wined3d_cs *cs, struct wined3d_buff
@@ -1113,7 +1152,7 @@ void wined3d_cs_emit_set_index_buffer(struct wined3d_cs *cs, struct wined3d_buff
cs->ops->submit(cs);
}
@ -335,7 +335,7 @@ index 2f43fccfcc9..126c6c24431 100644
{
const struct wined3d_cs_set_constant_buffer *op = data;
struct wined3d_buffer *prev;
@@ -1126,6 +1165,7 @@ static void wined3d_cs_exec_set_constant_buffer(struct wined3d_cs *cs, const voi
@@ -1127,6 +1166,7 @@ static void wined3d_cs_exec_set_constant_buffer(struct wined3d_cs *cs, const voi
InterlockedDecrement(&prev->resource.bind_count);
device_invalidate_state(cs->device, STATE_CONSTANT_BUFFER(op->type));
@ -343,7 +343,7 @@ index 2f43fccfcc9..126c6c24431 100644
}
void wined3d_cs_emit_set_constant_buffer(struct wined3d_cs *cs, enum wined3d_shader_type type,
@@ -1142,7 +1182,7 @@ void wined3d_cs_emit_set_constant_buffer(struct wined3d_cs *cs, enum wined3d_sha
@@ -1143,7 +1183,7 @@ void wined3d_cs_emit_set_constant_buffer(struct wined3d_cs *cs, enum wined3d_sha
cs->ops->submit(cs);
}
@ -352,7 +352,7 @@ index 2f43fccfcc9..126c6c24431 100644
{
const struct wined3d_gl_info *gl_info = &cs->device->adapter->gl_info;
const struct wined3d_d3d_info *d3d_info = &cs->device->adapter->d3d_info;
@@ -1219,6 +1259,8 @@ static void wined3d_cs_exec_set_texture(struct wined3d_cs *cs, const void *data)
@@ -1220,6 +1260,8 @@ static void wined3d_cs_exec_set_texture(struct wined3d_cs *cs, const void *data)
if (new_use_color_key)
device_invalidate_state(cs->device, STATE_COLOR_KEY);
@ -361,7 +361,7 @@ index 2f43fccfcc9..126c6c24431 100644
}
void wined3d_cs_emit_set_texture(struct wined3d_cs *cs, UINT stage, struct wined3d_texture *texture)
@@ -1233,7 +1275,7 @@ void wined3d_cs_emit_set_texture(struct wined3d_cs *cs, UINT stage, struct wined
@@ -1234,7 +1276,7 @@ void wined3d_cs_emit_set_texture(struct wined3d_cs *cs, UINT stage, struct wined
cs->ops->submit(cs);
}
@ -370,7 +370,7 @@ index 2f43fccfcc9..126c6c24431 100644
{
const struct wined3d_cs_set_shader_resource_view *op = data;
struct wined3d_shader_resource_view *prev;
@@ -1250,6 +1292,8 @@ static void wined3d_cs_exec_set_shader_resource_view(struct wined3d_cs *cs, cons
@@ -1251,6 +1293,8 @@ static void wined3d_cs_exec_set_shader_resource_view(struct wined3d_cs *cs, cons
device_invalidate_state(cs->device, STATE_GRAPHICS_SHADER_RESOURCE_BINDING);
else
device_invalidate_state(cs->device, STATE_COMPUTE_SHADER_RESOURCE_BINDING);
@ -379,7 +379,7 @@ index 2f43fccfcc9..126c6c24431 100644
}
void wined3d_cs_emit_set_shader_resource_view(struct wined3d_cs *cs, enum wined3d_shader_type type,
@@ -1266,7 +1310,7 @@ void wined3d_cs_emit_set_shader_resource_view(struct wined3d_cs *cs, enum wined3
@@ -1267,7 +1311,7 @@ void wined3d_cs_emit_set_shader_resource_view(struct wined3d_cs *cs, enum wined3
cs->ops->submit(cs);
}
@ -388,7 +388,7 @@ index 2f43fccfcc9..126c6c24431 100644
{
const struct wined3d_cs_set_unordered_access_view *op = data;
struct wined3d_unordered_access_view *prev;
@@ -1280,6 +1324,8 @@ static void wined3d_cs_exec_set_unordered_access_view(struct wined3d_cs *cs, con
@@ -1281,6 +1325,8 @@ static void wined3d_cs_exec_set_unordered_access_view(struct wined3d_cs *cs, con
InterlockedDecrement(&prev->resource->bind_count);
device_invalidate_state(cs->device, STATE_UNORDERED_ACCESS_VIEW_BINDING(op->pipeline));
@ -397,7 +397,7 @@ index 2f43fccfcc9..126c6c24431 100644
}
void wined3d_cs_emit_set_unordered_access_view(struct wined3d_cs *cs, enum wined3d_pipeline pipeline,
@@ -1296,7 +1342,7 @@ void wined3d_cs_emit_set_unordered_access_view(struct wined3d_cs *cs, enum wined
@@ -1297,7 +1343,7 @@ void wined3d_cs_emit_set_unordered_access_view(struct wined3d_cs *cs, enum wined
cs->ops->submit(cs);
}
@ -406,7 +406,7 @@ index 2f43fccfcc9..126c6c24431 100644
{
const struct wined3d_cs_set_sampler *op = data;
@@ -1305,6 +1351,8 @@ static void wined3d_cs_exec_set_sampler(struct wined3d_cs *cs, const void *data)
@@ -1306,6 +1352,8 @@ static void wined3d_cs_exec_set_sampler(struct wined3d_cs *cs, const void *data)
device_invalidate_state(cs->device, STATE_GRAPHICS_SHADER_RESOURCE_BINDING);
else
device_invalidate_state(cs->device, STATE_COMPUTE_SHADER_RESOURCE_BINDING);
@ -415,7 +415,7 @@ index 2f43fccfcc9..126c6c24431 100644
}
void wined3d_cs_emit_set_sampler(struct wined3d_cs *cs, enum wined3d_shader_type type,
@@ -1321,7 +1369,7 @@ void wined3d_cs_emit_set_sampler(struct wined3d_cs *cs, enum wined3d_shader_type
@@ -1322,7 +1370,7 @@ void wined3d_cs_emit_set_sampler(struct wined3d_cs *cs, enum wined3d_shader_type
cs->ops->submit(cs);
}
@ -424,7 +424,7 @@ index 2f43fccfcc9..126c6c24431 100644
{
const struct wined3d_cs_set_shader *op = data;
@@ -1331,6 +1379,8 @@ static void wined3d_cs_exec_set_shader(struct wined3d_cs *cs, const void *data)
@@ -1332,6 +1380,8 @@ static void wined3d_cs_exec_set_shader(struct wined3d_cs *cs, const void *data)
device_invalidate_state(cs->device, STATE_GRAPHICS_SHADER_RESOURCE_BINDING);
else
device_invalidate_state(cs->device, STATE_COMPUTE_SHADER_RESOURCE_BINDING);
@ -433,7 +433,7 @@ index 2f43fccfcc9..126c6c24431 100644
}
void wined3d_cs_emit_set_shader(struct wined3d_cs *cs, enum wined3d_shader_type type, struct wined3d_shader *shader)
@@ -1345,12 +1395,14 @@ void wined3d_cs_emit_set_shader(struct wined3d_cs *cs, enum wined3d_shader_type
@@ -1346,12 +1396,14 @@ void wined3d_cs_emit_set_shader(struct wined3d_cs *cs, enum wined3d_shader_type
cs->ops->submit(cs);
}
@ -449,7 +449,7 @@ index 2f43fccfcc9..126c6c24431 100644
}
void wined3d_cs_emit_set_rasterizer_state(struct wined3d_cs *cs,
@@ -1365,12 +1417,14 @@ void wined3d_cs_emit_set_rasterizer_state(struct wined3d_cs *cs,
@@ -1366,12 +1418,14 @@ void wined3d_cs_emit_set_rasterizer_state(struct wined3d_cs *cs,
cs->ops->submit(cs);
}
@ -465,7 +465,7 @@ index 2f43fccfcc9..126c6c24431 100644
}
void wined3d_cs_emit_set_render_state(struct wined3d_cs *cs, enum wined3d_render_state state, DWORD value)
@@ -1385,12 +1439,14 @@ void wined3d_cs_emit_set_render_state(struct wined3d_cs *cs, enum wined3d_render
@@ -1386,12 +1440,14 @@ void wined3d_cs_emit_set_render_state(struct wined3d_cs *cs, enum wined3d_render
cs->ops->submit(cs);
}
@ -481,7 +481,7 @@ index 2f43fccfcc9..126c6c24431 100644
}
void wined3d_cs_emit_set_texture_state(struct wined3d_cs *cs, UINT stage,
@@ -1407,12 +1463,14 @@ void wined3d_cs_emit_set_texture_state(struct wined3d_cs *cs, UINT stage,
@@ -1408,12 +1464,14 @@ void wined3d_cs_emit_set_texture_state(struct wined3d_cs *cs, UINT stage,
cs->ops->submit(cs);
}
@ -497,7 +497,7 @@ index 2f43fccfcc9..126c6c24431 100644
}
void wined3d_cs_emit_set_sampler_state(struct wined3d_cs *cs, UINT sampler_idx,
@@ -1429,13 +1487,15 @@ void wined3d_cs_emit_set_sampler_state(struct wined3d_cs *cs, UINT sampler_idx,
@@ -1430,13 +1488,15 @@ void wined3d_cs_emit_set_sampler_state(struct wined3d_cs *cs, UINT sampler_idx,
cs->ops->submit(cs);
}
@ -514,7 +514,7 @@ index 2f43fccfcc9..126c6c24431 100644
}
void wined3d_cs_emit_set_transform(struct wined3d_cs *cs, enum wined3d_transform_state state,
@@ -1451,12 +1511,14 @@ void wined3d_cs_emit_set_transform(struct wined3d_cs *cs, enum wined3d_transform
@@ -1452,12 +1512,14 @@ void wined3d_cs_emit_set_transform(struct wined3d_cs *cs, enum wined3d_transform
cs->ops->submit(cs);
}
@ -530,7 +530,7 @@ index 2f43fccfcc9..126c6c24431 100644
}
void wined3d_cs_emit_set_clip_plane(struct wined3d_cs *cs, UINT plane_idx, const struct wined3d_vec4 *plane)
@@ -1471,7 +1533,7 @@ void wined3d_cs_emit_set_clip_plane(struct wined3d_cs *cs, UINT plane_idx, const
@@ -1472,7 +1534,7 @@ void wined3d_cs_emit_set_clip_plane(struct wined3d_cs *cs, UINT plane_idx, const
cs->ops->submit(cs);
}
@ -539,7 +539,7 @@ index 2f43fccfcc9..126c6c24431 100644
{
const struct wined3d_cs_set_color_key *op = data;
struct wined3d_texture *texture = op->texture;
@@ -1532,6 +1594,8 @@ static void wined3d_cs_exec_set_color_key(struct wined3d_cs *cs, const void *dat
@@ -1533,6 +1595,8 @@ static void wined3d_cs_exec_set_color_key(struct wined3d_cs *cs, const void *dat
break;
}
}
@ -548,7 +548,7 @@ index 2f43fccfcc9..126c6c24431 100644
}
void wined3d_cs_emit_set_color_key(struct wined3d_cs *cs, struct wined3d_texture *texture,
@@ -1554,12 +1618,14 @@ void wined3d_cs_emit_set_color_key(struct wined3d_cs *cs, struct wined3d_texture
@@ -1555,12 +1619,14 @@ void wined3d_cs_emit_set_color_key(struct wined3d_cs *cs, struct wined3d_texture
cs->ops->submit(cs);
}
@ -564,7 +564,7 @@ index 2f43fccfcc9..126c6c24431 100644
}
void wined3d_cs_emit_set_material(struct wined3d_cs *cs, const struct wined3d_material *material)
@@ -1573,7 +1639,7 @@ void wined3d_cs_emit_set_material(struct wined3d_cs *cs, const struct wined3d_ma
@@ -1574,7 +1640,7 @@ void wined3d_cs_emit_set_material(struct wined3d_cs *cs, const struct wined3d_ma
cs->ops->submit(cs);
}
@ -573,7 +573,7 @@ index 2f43fccfcc9..126c6c24431 100644
{
const struct wined3d_cs_set_light *op = data;
struct wined3d_light_info *light_info;
@@ -1587,7 +1653,7 @@ static void wined3d_cs_exec_set_light(struct wined3d_cs *cs, const void *data)
@@ -1588,7 +1654,7 @@ static void wined3d_cs_exec_set_light(struct wined3d_cs *cs, const void *data)
if (!(light_info = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*light_info))))
{
ERR("Failed to allocate light info.\n");
@ -582,7 +582,7 @@ index 2f43fccfcc9..126c6c24431 100644
}
hash_idx = LIGHTMAP_HASHFUNC(light_idx);
@@ -1608,6 +1674,8 @@ static void wined3d_cs_exec_set_light(struct wined3d_cs *cs, const void *data)
@@ -1609,6 +1675,8 @@ static void wined3d_cs_exec_set_light(struct wined3d_cs *cs, const void *data)
light_info->direction = op->light.direction;
light_info->exponent = op->light.exponent;
light_info->cutoff = op->light.cutoff;
@ -591,7 +591,7 @@ index 2f43fccfcc9..126c6c24431 100644
}
void wined3d_cs_emit_set_light(struct wined3d_cs *cs, const struct wined3d_light_info *light)
@@ -1621,7 +1689,7 @@ void wined3d_cs_emit_set_light(struct wined3d_cs *cs, const struct wined3d_light
@@ -1622,7 +1690,7 @@ void wined3d_cs_emit_set_light(struct wined3d_cs *cs, const struct wined3d_light
cs->ops->submit(cs);
}
@ -600,7 +600,7 @@ index 2f43fccfcc9..126c6c24431 100644
{
const struct wined3d_cs_set_light_enable *op = data;
struct wined3d_device *device = cs->device;
@@ -1631,7 +1699,7 @@ static void wined3d_cs_exec_set_light_enable(struct wined3d_cs *cs, const void *
@@ -1632,7 +1700,7 @@ static void wined3d_cs_exec_set_light_enable(struct wined3d_cs *cs, const void *
if (!(light_info = wined3d_state_get_light(&cs->state, op->idx)))
{
ERR("Light doesn't exist.\n");
@ -609,7 +609,7 @@ index 2f43fccfcc9..126c6c24431 100644
}
prev_idx = light_info->glIndex;
@@ -1641,6 +1709,8 @@ static void wined3d_cs_exec_set_light_enable(struct wined3d_cs *cs, const void *
@@ -1642,6 +1710,8 @@ static void wined3d_cs_exec_set_light_enable(struct wined3d_cs *cs, const void *
device_invalidate_state(device, STATE_LIGHT_TYPE);
device_invalidate_state(device, STATE_ACTIVELIGHT(op->enable ? light_info->glIndex : prev_idx));
}
@ -618,7 +618,7 @@ index 2f43fccfcc9..126c6c24431 100644
}
void wined3d_cs_emit_set_light_enable(struct wined3d_cs *cs, unsigned int idx, BOOL enable)
@@ -1655,7 +1725,7 @@ void wined3d_cs_emit_set_light_enable(struct wined3d_cs *cs, unsigned int idx, B
@@ -1656,7 +1726,7 @@ void wined3d_cs_emit_set_light_enable(struct wined3d_cs *cs, unsigned int idx, B
cs->ops->submit(cs);
}
@ -626,17 +626,17 @@ index 2f43fccfcc9..126c6c24431 100644
+static UINT wined3d_cs_exec_reset_state(struct wined3d_cs *cs, const void *data)
{
struct wined3d_adapter *adapter = cs->device->adapter;
HRESULT hr;
@@ -1665,6 +1735,8 @@ static void wined3d_cs_exec_reset_state(struct wined3d_cs *cs, const void *data)
if (FAILED(hr = state_init(&cs->state, &adapter->gl_info, &adapter->d3d_info,
WINED3D_STATE_NO_REF | WINED3D_STATE_INIT_DEFAULT)))
ERR("Failed to initialize CS state, hr %#x.\n", hr);
@@ -1664,6 +1734,8 @@ static void wined3d_cs_exec_reset_state(struct wined3d_cs *cs, const void *data)
memset(&cs->state, 0, sizeof(cs->state));
state_init(&cs->state, &cs->fb, &adapter->gl_info, &adapter->d3d_info,
WINED3D_STATE_NO_REF | WINED3D_STATE_INIT_DEFAULT);
+
+ return sizeof(struct wined3d_cs_reset_state);
}
void wined3d_cs_emit_reset_state(struct wined3d_cs *cs)
@@ -1677,11 +1749,13 @@ void wined3d_cs_emit_reset_state(struct wined3d_cs *cs)
@@ -1676,11 +1748,13 @@ void wined3d_cs_emit_reset_state(struct wined3d_cs *cs)
cs->ops->submit(cs);
}
@ -651,7 +651,7 @@ index 2f43fccfcc9..126c6c24431 100644
}
static void wined3d_cs_emit_callback(struct wined3d_cs *cs, void (*callback)(void *object), void *object)
@@ -1706,12 +1780,14 @@ void wined3d_cs_init_object(struct wined3d_cs *cs, void (*callback)(void *object
@@ -1705,12 +1779,14 @@ void wined3d_cs_init_object(struct wined3d_cs *cs, void (*callback)(void *object
wined3d_cs_emit_callback(cs, callback, object);
}
@ -667,7 +667,7 @@ index 2f43fccfcc9..126c6c24431 100644
}
void wined3d_cs_emit_query_issue(struct wined3d_cs *cs, struct wined3d_query *query, DWORD flags)
@@ -1726,12 +1802,14 @@ void wined3d_cs_emit_query_issue(struct wined3d_cs *cs, struct wined3d_query *qu
@@ -1725,12 +1801,14 @@ void wined3d_cs_emit_query_issue(struct wined3d_cs *cs, struct wined3d_query *qu
cs->ops->submit(cs);
}
@ -683,7 +683,7 @@ index 2f43fccfcc9..126c6c24431 100644
}
BOOL wined3d_cs_emit_query_poll(struct wined3d_cs *cs, struct wined3d_query *query, DWORD flags)
@@ -1750,13 +1828,15 @@ BOOL wined3d_cs_emit_query_poll(struct wined3d_cs *cs, struct wined3d_query *que
@@ -1749,13 +1827,15 @@ BOOL wined3d_cs_emit_query_poll(struct wined3d_cs *cs, struct wined3d_query *que
return ret;
}
@ -700,7 +700,7 @@ index 2f43fccfcc9..126c6c24431 100644
}
void wined3d_cs_emit_preload_resource(struct wined3d_cs *cs, struct wined3d_resource *resource)
@@ -1772,13 +1852,15 @@ void wined3d_cs_emit_preload_resource(struct wined3d_cs *cs, struct wined3d_reso
@@ -1771,13 +1851,15 @@ void wined3d_cs_emit_preload_resource(struct wined3d_cs *cs, struct wined3d_reso
cs->ops->submit(cs);
}
@ -717,7 +717,7 @@ index 2f43fccfcc9..126c6c24431 100644
}
void wined3d_cs_emit_unload_resource(struct wined3d_cs *cs, struct wined3d_resource *resource)
@@ -1794,13 +1876,15 @@ void wined3d_cs_emit_unload_resource(struct wined3d_cs *cs, struct wined3d_resou
@@ -1793,13 +1875,15 @@ void wined3d_cs_emit_unload_resource(struct wined3d_cs *cs, struct wined3d_resou
cs->ops->submit(cs);
}
@ -734,7 +734,7 @@ index 2f43fccfcc9..126c6c24431 100644
}
HRESULT wined3d_cs_map(struct wined3d_cs *cs, struct wined3d_resource *resource, unsigned int sub_resource_idx,
@@ -1823,12 +1907,14 @@ HRESULT wined3d_cs_map(struct wined3d_cs *cs, struct wined3d_resource *resource,
@@ -1822,12 +1906,14 @@ HRESULT wined3d_cs_map(struct wined3d_cs *cs, struct wined3d_resource *resource,
return hr;
}
@ -750,7 +750,7 @@ index 2f43fccfcc9..126c6c24431 100644
}
HRESULT wined3d_cs_unmap(struct wined3d_cs *cs, struct wined3d_resource *resource, unsigned int sub_resource_idx)
@@ -1869,10 +1955,11 @@ push_constant_info[] =
@@ -1868,10 +1954,11 @@ push_constant_info[] =
{FIELD_OFFSET(struct wined3d_state, ps_consts_b), sizeof(BOOL), WINED3D_SHADER_CONST_PS_B},
};
@ -763,7 +763,7 @@ index 2f43fccfcc9..126c6c24431 100644
unsigned int context_count;
unsigned int i;
size_t offset;
@@ -1888,6 +1975,8 @@ static void wined3d_cs_exec_push_constants(struct wined3d_cs *cs, const void *da
@@ -1887,6 +1974,8 @@ static void wined3d_cs_exec_push_constants(struct wined3d_cs *cs, const void *da
{
device->contexts[i]->constant_update_mask |= push_constant_info[op->p].mask;
}
@ -772,25 +772,7 @@ index 2f43fccfcc9..126c6c24431 100644
}
void wined3d_cs_emit_push_constants(struct wined3d_cs *cs, enum wined3d_push_constants p,
@@ -1905,7 +1994,7 @@ void wined3d_cs_emit_push_constants(struct wined3d_cs *cs, enum wined3d_push_con
cs->ops->submit(cs);
}
-static void wined3d_cs_exec_set_primitive_type(struct wined3d_cs *cs, const void *data)
+static UINT wined3d_cs_exec_set_primitive_type(struct wined3d_cs *cs, const void *data)
{
const struct wined3d_cs_set_primitive_type *op = data;
GLenum prev;
@@ -1916,6 +2005,8 @@ static void wined3d_cs_exec_set_primitive_type(struct wined3d_cs *cs, const void
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)
@@ -1929,7 +2020,7 @@ void wined3d_cs_emit_set_primitive_type(struct wined3d_cs *cs, GLenum primitive_
@@ -1904,7 +1993,7 @@ void wined3d_cs_emit_push_constants(struct wined3d_cs *cs, enum wined3d_push_con
cs->ops->submit(cs);
}
@ -799,7 +781,7 @@ index 2f43fccfcc9..126c6c24431 100644
{
const struct wined3d_cs_blt *op = data;
@@ -1940,6 +2031,8 @@ static void wined3d_cs_exec_blt(struct wined3d_cs *cs, const void *data)
@@ -1915,6 +2004,8 @@ static void wined3d_cs_exec_blt(struct wined3d_cs *cs, const void *data)
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);
@ -808,7 +790,7 @@ index 2f43fccfcc9..126c6c24431 100644
}
void wined3d_cs_emit_blt(struct wined3d_cs *cs, struct wined3d_surface *dst_surface,
@@ -1967,7 +2060,7 @@ void wined3d_cs_emit_blt(struct wined3d_cs *cs, struct wined3d_surface *dst_surf
@@ -1942,7 +2033,7 @@ void wined3d_cs_emit_blt(struct wined3d_cs *cs, struct wined3d_surface *dst_surf
cs->ops->submit(cs);
}
@ -817,7 +799,7 @@ index 2f43fccfcc9..126c6c24431 100644
{
const struct wined3d_cs_clear_rtv *op = data;
struct wined3d_device *device = cs->device;
@@ -1978,6 +2071,8 @@ static void wined3d_cs_exec_clear_rtv(struct wined3d_cs *cs, const void *data)
@@ -1953,6 +2044,8 @@ static void wined3d_cs_exec_clear_rtv(struct wined3d_cs *cs, const void *data)
op->blitter->depth_fill(device, op->view, &op->rect, op->flags, op->depth, op->stencil);
wined3d_resource_release(op->view->resource);
@ -826,7 +808,7 @@ index 2f43fccfcc9..126c6c24431 100644
}
void wined3d_cs_emit_clear_rtv(struct wined3d_cs *cs, struct wined3d_rendertarget_view *view,
@@ -2002,7 +2097,7 @@ void wined3d_cs_emit_clear_rtv(struct wined3d_cs *cs, struct wined3d_rendertarge
@@ -1977,7 +2070,7 @@ void wined3d_cs_emit_clear_rtv(struct wined3d_cs *cs, struct wined3d_rendertarge
cs->ops->submit(cs);
}
@ -835,7 +817,7 @@ index 2f43fccfcc9..126c6c24431 100644
{
const struct wined3d_cs_update_texture *op = data;
struct wined3d_context *context;
@@ -2013,6 +2108,8 @@ static void wined3d_cs_exec_update_texture(struct wined3d_cs *cs, const void *da
@@ -1988,6 +2081,8 @@ static void wined3d_cs_exec_update_texture(struct wined3d_cs *cs, const void *da
wined3d_resource_release(&op->src->resource);
wined3d_resource_release(&op->dst->resource);
@ -844,7 +826,7 @@ index 2f43fccfcc9..126c6c24431 100644
}
void wined3d_cs_emit_update_texture(struct wined3d_cs *cs, struct wined3d_texture *src,
@@ -2031,7 +2128,7 @@ void wined3d_cs_emit_update_texture(struct wined3d_cs *cs, struct wined3d_textur
@@ -2006,7 +2101,7 @@ void wined3d_cs_emit_update_texture(struct wined3d_cs *cs, struct wined3d_textur
cs->ops->submit(cs);
}
@ -853,7 +835,7 @@ index 2f43fccfcc9..126c6c24431 100644
{
const struct wined3d_cs_update_sub_resource *op = data;
struct wined3d_const_bo_address addr;
@@ -2047,7 +2144,7 @@ static void wined3d_cs_exec_update_sub_resource(struct wined3d_cs *cs, const voi
@@ -2022,7 +2117,7 @@ static void wined3d_cs_exec_update_sub_resource(struct wined3d_cs *cs, const voi
if (FAILED(hr = wined3d_buffer_upload_data(buffer, op->box, op->data)))
WARN("Failed to update buffer data, hr %#x.\n", hr);
@ -862,7 +844,7 @@ index 2f43fccfcc9..126c6c24431 100644
}
texture = wined3d_texture_from_resource(op->resource);
@@ -2076,6 +2173,8 @@ static void wined3d_cs_exec_update_sub_resource(struct wined3d_cs *cs, const voi
@@ -2051,6 +2146,8 @@ static void wined3d_cs_exec_update_sub_resource(struct wined3d_cs *cs, const voi
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);
@ -871,7 +853,7 @@ index 2f43fccfcc9..126c6c24431 100644
}
void wined3d_cs_emit_update_sub_resource(struct wined3d_cs *cs, struct wined3d_resource *resource,
@@ -2098,11 +2197,13 @@ void wined3d_cs_emit_update_sub_resource(struct wined3d_cs *cs, struct wined3d_r
@@ -2073,11 +2170,13 @@ void wined3d_cs_emit_update_sub_resource(struct wined3d_cs *cs, struct wined3d_r
cs->ops->submit_and_wait(cs);
}
@ -886,7 +868,7 @@ index 2f43fccfcc9..126c6c24431 100644
}
HRESULT wined3d_cs_emit_get_dc(struct wined3d_cs *cs, struct wined3d_texture *texture,
@@ -2122,11 +2223,13 @@ HRESULT wined3d_cs_emit_get_dc(struct wined3d_cs *cs, struct wined3d_texture *te
@@ -2097,11 +2196,13 @@ HRESULT wined3d_cs_emit_get_dc(struct wined3d_cs *cs, struct wined3d_texture *te
return hr;
}
@ -901,7 +883,7 @@ index 2f43fccfcc9..126c6c24431 100644
}
HRESULT wined3d_cs_emit_release_dc(struct wined3d_cs *cs, struct wined3d_texture *texture,
@@ -2146,11 +2249,13 @@ HRESULT wined3d_cs_emit_release_dc(struct wined3d_cs *cs, struct wined3d_texture
@@ -2121,11 +2222,13 @@ HRESULT wined3d_cs_emit_release_dc(struct wined3d_cs *cs, struct wined3d_texture
return hr;
}
@ -916,7 +898,7 @@ index 2f43fccfcc9..126c6c24431 100644
}
HRESULT wined3d_cs_emit_create_swapchain_context(struct wined3d_cs *cs, struct wined3d_swapchain *swapchain)
@@ -2168,11 +2273,13 @@ HRESULT wined3d_cs_emit_create_swapchain_context(struct wined3d_cs *cs, struct w
@@ -2143,11 +2246,13 @@ HRESULT wined3d_cs_emit_create_swapchain_context(struct wined3d_cs *cs, struct w
return hr;
}
@ -931,7 +913,7 @@ index 2f43fccfcc9..126c6c24431 100644
}
void wined3d_cs_emit_update_swap_interval(struct wined3d_cs *cs, struct wined3d_swapchain *swapchain)
@@ -2186,7 +2293,7 @@ void wined3d_cs_emit_update_swap_interval(struct wined3d_cs *cs, struct wined3d_
@@ -2161,7 +2266,7 @@ void wined3d_cs_emit_update_swap_interval(struct wined3d_cs *cs, struct wined3d_
cs->ops->submit_and_wait(cs);
}
@ -940,7 +922,7 @@ index 2f43fccfcc9..126c6c24431 100644
{
const struct wined3d_cs_texture_add_dirty_region *op = data;
struct wined3d_texture *texture = op->texture;
@@ -2204,6 +2311,8 @@ static void wined3d_cs_exec_texture_add_dirty_region(struct wined3d_cs *cs, cons
@@ -2179,6 +2284,8 @@ static void wined3d_cs_exec_texture_add_dirty_region(struct wined3d_cs *cs, cons
context_release(context);
wined3d_resource_release(&texture->resource);
@ -949,7 +931,7 @@ index 2f43fccfcc9..126c6c24431 100644
}
void wined3d_cs_emit_texture_add_dirty_region(struct wined3d_cs *cs,
@@ -2225,7 +2334,7 @@ void wined3d_cs_emit_texture_add_dirty_region(struct wined3d_cs *cs,
@@ -2200,7 +2307,7 @@ void wined3d_cs_emit_texture_add_dirty_region(struct wined3d_cs *cs,
cs->ops->submit(cs);
}
@ -958,7 +940,7 @@ index 2f43fccfcc9..126c6c24431 100644
{
const struct wined3d_cs_buffer_copy *op = data;
HRESULT hr;
@@ -2235,6 +2344,8 @@ static void wined3d_cs_exec_buffer_copy(struct wined3d_cs *cs, const void *data)
@@ -2210,6 +2317,8 @@ static void wined3d_cs_exec_buffer_copy(struct wined3d_cs *cs, const void *data)
wined3d_resource_release(&op->dst_buffer->resource);
wined3d_resource_release(&op->src_buffer->resource);
@ -967,7 +949,7 @@ index 2f43fccfcc9..126c6c24431 100644
}
void wined3d_cs_emit_buffer_copy(struct wined3d_cs *cs, struct wined3d_buffer *dst_buffer,
@@ -2257,7 +2368,7 @@ void wined3d_cs_emit_buffer_copy(struct wined3d_cs *cs, struct wined3d_buffer *d
@@ -2232,7 +2341,7 @@ void wined3d_cs_emit_buffer_copy(struct wined3d_cs *cs, struct wined3d_buffer *d
cs->ops->submit(cs);
}
@ -976,7 +958,7 @@ index 2f43fccfcc9..126c6c24431 100644
{
const struct wined3d_cs_map_vertex_buffers *op = data;
struct wined3d_state *state = &cs->device->state;
@@ -2304,6 +2415,8 @@ static void wined3d_cs_exec_map_vertex_buffers(struct wined3d_cs *cs, const void
@@ -2279,6 +2388,8 @@ static void wined3d_cs_exec_map_vertex_buffers(struct wined3d_cs *cs, const void
}
context_release(context);
@ -985,7 +967,7 @@ index 2f43fccfcc9..126c6c24431 100644
}
void wined3d_cs_emit_map_vertex_buffers(struct wined3d_cs *cs, UINT src_start_idx,
@@ -2319,7 +2432,7 @@ void wined3d_cs_emit_map_vertex_buffers(struct wined3d_cs *cs, UINT src_start_id
@@ -2294,7 +2405,7 @@ void wined3d_cs_emit_map_vertex_buffers(struct wined3d_cs *cs, UINT src_start_id
cs->ops->submit_and_wait(cs);
}
@ -994,7 +976,7 @@ index 2f43fccfcc9..126c6c24431 100644
{
/* WINED3D_CS_OP_SYNC */ wined3d_cs_exec_sync,
/* WINED3D_CS_OP_GLFINISH */ wined3d_cs_exec_glfinish,
@@ -2427,6 +2540,201 @@ static const struct wined3d_cs_ops wined3d_cs_st_ops =
@@ -2401,6 +2512,201 @@ static const struct wined3d_cs_ops wined3d_cs_st_ops =
wined3d_cs_st_submit,
};
@ -1196,7 +1178,7 @@ index 2f43fccfcc9..126c6c24431 100644
struct wined3d_cs *wined3d_cs_create(struct wined3d_device *device)
{
const struct wined3d_gl_info *gl_info = &device->adapter->gl_info;
@@ -2453,12 +2761,40 @@ struct wined3d_cs *wined3d_cs_create(struct wined3d_device *device)
@@ -2430,12 +2736,41 @@ struct wined3d_cs *wined3d_cs_create(struct wined3d_device *device)
return NULL;
}
@ -1211,6 +1193,7 @@ index 2f43fccfcc9..126c6c24431 100644
+ {
+ ERR("Failed to create wined3d command stream thread.\n");
+ state_cleanup(&cs->state);
+ HeapFree(GetProcessHeap(), 0, cs->fb.render_targets);
+ HeapFree(GetProcessHeap(), 0, cs->data);
+ HeapFree(GetProcessHeap(), 0, cs);
+ return NULL;
@ -1234,14 +1217,14 @@ index 2f43fccfcc9..126c6c24431 100644
+ wined3d_cs_list_cleanup(&cs->free_list);
+ }
+
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 4c2aa48b6c6..3961fcdc94d 100644
index e3a73a05658..25fa0f00f5c 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -1263,7 +1263,7 @@ UINT CDECL wined3d_device_get_available_texture_mem(const struct wined3d_device
@@ -1289,7 +1289,7 @@ UINT CDECL wined3d_device_get_available_texture_mem(const struct wined3d_device
/* We can not acquire the context unless there is a swapchain. */
if (device->swapchains && gl_info->supported[NVX_GPU_MEMORY_INFO] &&
@ -1281,7 +1264,7 @@ index e7962465279..a8409cfd4b8 100644
if (hkey) RegCloseKey( hkey );
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 5f027cf026c..44db7f1f96c 100644
index 8b5ea45ae61..e1516f0f0b0 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -306,6 +306,7 @@ struct wined3d_settings
@ -1292,7 +1275,7 @@ index 5f027cf026c..44db7f1f96c 100644
};
extern struct wined3d_settings wined3d_settings DECLSPEC_HIDDEN;
@@ -2796,11 +2797,6 @@ static inline void wined3d_resource_release(struct wined3d_resource *resource)
@@ -2773,11 +2774,6 @@ static inline void wined3d_resource_release(struct wined3d_resource *resource)
InterlockedDecrement(&resource->access_count);
}
@ -1304,7 +1287,7 @@ index 5f027cf026c..44db7f1f96c 100644
void resource_cleanup(struct wined3d_resource *resource) DECLSPEC_HIDDEN;
HRESULT resource_init(struct wined3d_resource *resource, struct wined3d_device *device,
enum wined3d_resource_type type, const struct wined3d_format *format,
@@ -3221,6 +3217,21 @@ enum wined3d_push_constants
@@ -3198,6 +3194,21 @@ enum wined3d_push_constants
WINED3D_PUSH_CONSTANTS_PS_B,
};
@ -1326,7 +1309,7 @@ index 5f027cf026c..44db7f1f96c 100644
struct wined3d_cs_ops
{
void *(*require_space)(struct wined3d_cs *cs, size_t size);
@@ -3237,9 +3248,21 @@ struct wined3d_cs
@@ -3215,9 +3226,21 @@ struct wined3d_cs
size_t data_size, start, end;
void *data;

View File

@ -1,18 +1,18 @@
From 7fcb1c399169868513e37a08051f7ae9dc59e18a Mon Sep 17 00:00:00 2001
From 89e52ae05f316cdbdf6d8026527aed0cdb11a193 Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Wed, 8 Feb 2017 00:12:31 +0100
Subject: wined3d: Introduce a separate priority queue.
---
dlls/wined3d/cs.c | 133 ++++++++++++++++++++++-------------------
dlls/wined3d/cs.c | 131 ++++++++++++++++++++++-------------------
dlls/wined3d/wined3d_private.h | 4 +-
2 files changed, 74 insertions(+), 63 deletions(-)
2 files changed, 73 insertions(+), 62 deletions(-)
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
index 6e7a4cb9857..34bae9d4e87 100644
index 3d762a55555..47f65a7e20c 100644
--- a/dlls/wined3d/cs.c
+++ b/dlls/wined3d/cs.c
@@ -492,7 +492,7 @@ void wined3d_cs_emit_sync(struct wined3d_cs *cs)
@@ -486,7 +486,7 @@ void wined3d_cs_emit_sync(struct wined3d_cs *cs)
{
struct wined3d_cs_sync *op;
@ -21,7 +21,7 @@ index 6e7a4cb9857..34bae9d4e87 100644
op->opcode = WINED3D_CS_OP_SYNC;
cs->ops->submit_and_wait(cs);
@@ -512,7 +512,7 @@ void wined3d_cs_emit_glfinish(struct wined3d_cs *cs)
@@ -506,7 +506,7 @@ void wined3d_cs_emit_glfinish(struct wined3d_cs *cs)
{
struct wined3d_cs_glfinish *op;
@ -30,7 +30,7 @@ index 6e7a4cb9857..34bae9d4e87 100644
op->opcode = WINED3D_CS_OP_GLFINISH;
cs->ops->submit_and_wait(cs);
@@ -548,7 +548,7 @@ void wined3d_cs_emit_present(struct wined3d_cs *cs, struct wined3d_swapchain *sw
@@ -542,7 +542,7 @@ void wined3d_cs_emit_present(struct wined3d_cs *cs, struct wined3d_swapchain *sw
unsigned int i;
LONG pending;
@ -39,7 +39,7 @@ index 6e7a4cb9857..34bae9d4e87 100644
op->opcode = WINED3D_CS_OP_PRESENT;
op->dst_window_override = dst_window_override;
op->swapchain = swapchain;
@@ -615,7 +615,7 @@ void wined3d_cs_emit_clear(struct wined3d_cs *cs, DWORD rect_count, const RECT *
@@ -608,7 +608,7 @@ void wined3d_cs_emit_clear(struct wined3d_cs *cs, DWORD rect_count, const RECT *
struct wined3d_cs_clear *op;
unsigned int i;
@ -48,7 +48,7 @@ index 6e7a4cb9857..34bae9d4e87 100644
op->opcode = WINED3D_CS_OP_CLEAR;
op->flags = flags;
op->color = *color;
@@ -765,7 +765,7 @@ void wined3d_cs_emit_dispatch(struct wined3d_cs *cs,
@@ -758,7 +758,7 @@ void wined3d_cs_emit_dispatch(struct wined3d_cs *cs,
const struct wined3d_state *state = &cs->device->state;
struct wined3d_cs_dispatch *op;
@ -57,16 +57,16 @@ index 6e7a4cb9857..34bae9d4e87 100644
op->opcode = WINED3D_CS_OP_DISPATCH;
op->group_count_x = group_count_x;
op->group_count_y = group_count_y;
@@ -827,7 +827,7 @@ void wined3d_cs_emit_draw(struct wined3d_cs *cs, int base_vertex_idx, unsigned i
@@ -827,7 +827,7 @@ void wined3d_cs_emit_draw(struct wined3d_cs *cs, GLenum primitive_type, int base
struct wined3d_cs_draw *op;
unsigned int i;
- op = cs->ops->require_space(cs, sizeof(*op));
+ op = cs->ops->require_space(cs, sizeof(*op), 0);
op->opcode = WINED3D_CS_OP_DRAW;
op->primitive_type = primitive_type;
op->base_vertex_idx = base_vertex_idx;
op->start_idx = start_idx;
@@ -876,7 +876,7 @@ void wined3d_cs_emit_set_predication(struct wined3d_cs *cs, struct wined3d_query
@@ -877,7 +877,7 @@ void wined3d_cs_emit_set_predication(struct wined3d_cs *cs, struct wined3d_query
{
struct wined3d_cs_set_predication *op;
@ -75,7 +75,7 @@ index 6e7a4cb9857..34bae9d4e87 100644
op->opcode = WINED3D_CS_OP_SET_PREDICATION;
op->predicate = predicate;
op->value = value;
@@ -898,7 +898,7 @@ void wined3d_cs_emit_set_viewport(struct wined3d_cs *cs, const struct wined3d_vi
@@ -899,7 +899,7 @@ void wined3d_cs_emit_set_viewport(struct wined3d_cs *cs, const struct wined3d_vi
{
struct wined3d_cs_set_viewport *op;
@ -84,7 +84,7 @@ index 6e7a4cb9857..34bae9d4e87 100644
op->opcode = WINED3D_CS_OP_SET_VIEWPORT;
op->viewport = *viewport;
@@ -919,7 +919,7 @@ void wined3d_cs_emit_set_scissor_rect(struct wined3d_cs *cs, const RECT *rect)
@@ -920,7 +920,7 @@ void wined3d_cs_emit_set_scissor_rect(struct wined3d_cs *cs, const RECT *rect)
{
struct wined3d_cs_set_scissor_rect *op;
@ -93,7 +93,7 @@ index 6e7a4cb9857..34bae9d4e87 100644
op->opcode = WINED3D_CS_OP_SET_SCISSOR_RECT;
op->rect = *rect;
@@ -941,7 +941,7 @@ void wined3d_cs_emit_set_rendertarget_view(struct wined3d_cs *cs, unsigned int v
@@ -942,7 +942,7 @@ void wined3d_cs_emit_set_rendertarget_view(struct wined3d_cs *cs, unsigned int v
{
struct wined3d_cs_set_rendertarget_view *op;
@ -102,7 +102,7 @@ index 6e7a4cb9857..34bae9d4e87 100644
op->opcode = WINED3D_CS_OP_SET_RENDERTARGET_VIEW;
op->view_idx = view_idx;
op->view = view;
@@ -992,7 +992,7 @@ void wined3d_cs_emit_set_depth_stencil_view(struct wined3d_cs *cs, struct wined3
@@ -993,7 +993,7 @@ void wined3d_cs_emit_set_depth_stencil_view(struct wined3d_cs *cs, struct wined3
{
struct wined3d_cs_set_depth_stencil_view *op;
@ -111,7 +111,7 @@ index 6e7a4cb9857..34bae9d4e87 100644
op->opcode = WINED3D_CS_OP_SET_DEPTH_STENCIL_VIEW;
op->view = view;
@@ -1013,7 +1013,7 @@ void wined3d_cs_emit_set_vertex_declaration(struct wined3d_cs *cs, struct wined3
@@ -1014,7 +1014,7 @@ void wined3d_cs_emit_set_vertex_declaration(struct wined3d_cs *cs, struct wined3
{
struct wined3d_cs_set_vertex_declaration *op;
@ -120,7 +120,7 @@ index 6e7a4cb9857..34bae9d4e87 100644
op->opcode = WINED3D_CS_OP_SET_VERTEX_DECLARATION;
op->declaration = declaration;
@@ -1047,7 +1047,7 @@ void wined3d_cs_emit_set_stream_source(struct wined3d_cs *cs, UINT stream_idx,
@@ -1048,7 +1048,7 @@ void wined3d_cs_emit_set_stream_source(struct wined3d_cs *cs, UINT stream_idx,
{
struct wined3d_cs_set_stream_source *op;
@ -129,7 +129,7 @@ index 6e7a4cb9857..34bae9d4e87 100644
op->opcode = WINED3D_CS_OP_SET_STREAM_SOURCE;
op->stream_idx = stream_idx;
op->buffer = buffer;
@@ -1075,7 +1075,7 @@ void wined3d_cs_emit_set_stream_source_freq(struct wined3d_cs *cs, UINT stream_i
@@ -1076,7 +1076,7 @@ void wined3d_cs_emit_set_stream_source_freq(struct wined3d_cs *cs, UINT stream_i
{
struct wined3d_cs_set_stream_source_freq *op;
@ -138,7 +138,7 @@ index 6e7a4cb9857..34bae9d4e87 100644
op->opcode = WINED3D_CS_OP_SET_STREAM_SOURCE_FREQ;
op->stream_idx = stream_idx;
op->frequency = frequency;
@@ -1108,7 +1108,7 @@ void wined3d_cs_emit_set_stream_output(struct wined3d_cs *cs, UINT stream_idx,
@@ -1109,7 +1109,7 @@ void wined3d_cs_emit_set_stream_output(struct wined3d_cs *cs, UINT stream_idx,
{
struct wined3d_cs_set_stream_output *op;
@ -147,7 +147,7 @@ index 6e7a4cb9857..34bae9d4e87 100644
op->opcode = WINED3D_CS_OP_SET_STREAM_OUTPUT;
op->stream_idx = stream_idx;
op->buffer = buffer;
@@ -1142,7 +1142,7 @@ void wined3d_cs_emit_set_index_buffer(struct wined3d_cs *cs, struct wined3d_buff
@@ -1143,7 +1143,7 @@ void wined3d_cs_emit_set_index_buffer(struct wined3d_cs *cs, struct wined3d_buff
{
struct wined3d_cs_set_index_buffer *op;
@ -156,7 +156,7 @@ index 6e7a4cb9857..34bae9d4e87 100644
op->opcode = WINED3D_CS_OP_SET_INDEX_BUFFER;
op->buffer = buffer;
op->format_id = format_id;
@@ -1173,7 +1173,7 @@ void wined3d_cs_emit_set_constant_buffer(struct wined3d_cs *cs, enum wined3d_sha
@@ -1174,7 +1174,7 @@ void wined3d_cs_emit_set_constant_buffer(struct wined3d_cs *cs, enum wined3d_sha
{
struct wined3d_cs_set_constant_buffer *op;
@ -165,7 +165,7 @@ index 6e7a4cb9857..34bae9d4e87 100644
op->opcode = WINED3D_CS_OP_SET_CONSTANT_BUFFER;
op->type = type;
op->cb_idx = cb_idx;
@@ -1267,7 +1267,7 @@ void wined3d_cs_emit_set_texture(struct wined3d_cs *cs, UINT stage, struct wined
@@ -1268,7 +1268,7 @@ void wined3d_cs_emit_set_texture(struct wined3d_cs *cs, UINT stage, struct wined
{
struct wined3d_cs_set_texture *op;
@ -174,7 +174,7 @@ index 6e7a4cb9857..34bae9d4e87 100644
op->opcode = WINED3D_CS_OP_SET_TEXTURE;
op->stage = stage;
op->texture = texture;
@@ -1299,7 +1299,7 @@ void wined3d_cs_emit_set_shader_resource_view(struct wined3d_cs *cs, enum wined3
@@ -1302,7 +1302,7 @@ void wined3d_cs_emit_set_shader_resource_view(struct wined3d_cs *cs, enum wined3
{
struct wined3d_cs_set_shader_resource_view *op;
@ -183,7 +183,7 @@ index 6e7a4cb9857..34bae9d4e87 100644
op->opcode = WINED3D_CS_OP_SET_SHADER_RESOURCE_VIEW;
op->type = type;
op->view_idx = view_idx;
@@ -1331,7 +1331,7 @@ void wined3d_cs_emit_set_unordered_access_view(struct wined3d_cs *cs, enum wined
@@ -1334,7 +1334,7 @@ void wined3d_cs_emit_set_unordered_access_view(struct wined3d_cs *cs, enum wined
{
struct wined3d_cs_set_unordered_access_view *op;
@ -192,7 +192,7 @@ index 6e7a4cb9857..34bae9d4e87 100644
op->opcode = WINED3D_CS_OP_SET_UNORDERED_ACCESS_VIEW;
op->pipeline = pipeline;
op->view_idx = view_idx;
@@ -1355,7 +1355,7 @@ void wined3d_cs_emit_set_sampler(struct wined3d_cs *cs, enum wined3d_shader_type
@@ -1361,7 +1361,7 @@ void wined3d_cs_emit_set_sampler(struct wined3d_cs *cs, enum wined3d_shader_type
{
struct wined3d_cs_set_sampler *op;
@ -201,7 +201,7 @@ index 6e7a4cb9857..34bae9d4e87 100644
op->opcode = WINED3D_CS_OP_SET_SAMPLER;
op->type = type;
op->sampler_idx = sampler_idx;
@@ -1380,7 +1380,7 @@ void wined3d_cs_emit_set_shader(struct wined3d_cs *cs, enum wined3d_shader_type
@@ -1388,7 +1388,7 @@ void wined3d_cs_emit_set_shader(struct wined3d_cs *cs, enum wined3d_shader_type
{
struct wined3d_cs_set_shader *op;
@ -210,7 +210,7 @@ index 6e7a4cb9857..34bae9d4e87 100644
op->opcode = WINED3D_CS_OP_SET_SHADER;
op->type = type;
op->shader = shader;
@@ -1403,7 +1403,7 @@ void wined3d_cs_emit_set_rasterizer_state(struct wined3d_cs *cs,
@@ -1411,7 +1411,7 @@ void wined3d_cs_emit_set_rasterizer_state(struct wined3d_cs *cs,
{
struct wined3d_cs_set_rasterizer_state *op;
@ -219,7 +219,7 @@ index 6e7a4cb9857..34bae9d4e87 100644
op->opcode = WINED3D_CS_OP_SET_RASTERIZER_STATE;
op->state = rasterizer_state;
@@ -1424,7 +1424,7 @@ void wined3d_cs_emit_set_render_state(struct wined3d_cs *cs, enum wined3d_render
@@ -1432,7 +1432,7 @@ void wined3d_cs_emit_set_render_state(struct wined3d_cs *cs, enum wined3d_render
{
struct wined3d_cs_set_render_state *op;
@ -228,7 +228,7 @@ index 6e7a4cb9857..34bae9d4e87 100644
op->opcode = WINED3D_CS_OP_SET_RENDER_STATE;
op->state = state;
op->value = value;
@@ -1447,7 +1447,7 @@ void wined3d_cs_emit_set_texture_state(struct wined3d_cs *cs, UINT stage,
@@ -1455,7 +1455,7 @@ void wined3d_cs_emit_set_texture_state(struct wined3d_cs *cs, UINT stage,
{
struct wined3d_cs_set_texture_state *op;
@ -237,7 +237,7 @@ index 6e7a4cb9857..34bae9d4e87 100644
op->opcode = WINED3D_CS_OP_SET_TEXTURE_STATE;
op->stage = stage;
op->state = state;
@@ -1471,7 +1471,7 @@ void wined3d_cs_emit_set_sampler_state(struct wined3d_cs *cs, UINT sampler_idx,
@@ -1479,7 +1479,7 @@ void wined3d_cs_emit_set_sampler_state(struct wined3d_cs *cs, UINT sampler_idx,
{
struct wined3d_cs_set_sampler_state *op;
@ -246,7 +246,7 @@ index 6e7a4cb9857..34bae9d4e87 100644
op->opcode = WINED3D_CS_OP_SET_SAMPLER_STATE;
op->sampler_idx = sampler_idx;
op->state = state;
@@ -1496,7 +1496,7 @@ void wined3d_cs_emit_set_transform(struct wined3d_cs *cs, enum wined3d_transform
@@ -1504,7 +1504,7 @@ void wined3d_cs_emit_set_transform(struct wined3d_cs *cs, enum wined3d_transform
{
struct wined3d_cs_set_transform *op;
@ -255,7 +255,7 @@ index 6e7a4cb9857..34bae9d4e87 100644
op->opcode = WINED3D_CS_OP_SET_TRANSFORM;
op->state = state;
op->matrix = *matrix;
@@ -1518,7 +1518,7 @@ void wined3d_cs_emit_set_clip_plane(struct wined3d_cs *cs, UINT plane_idx, const
@@ -1526,7 +1526,7 @@ void wined3d_cs_emit_set_clip_plane(struct wined3d_cs *cs, UINT plane_idx, const
{
struct wined3d_cs_set_clip_plane *op;
@ -264,7 +264,7 @@ index 6e7a4cb9857..34bae9d4e87 100644
op->opcode = WINED3D_CS_OP_SET_CLIP_PLANE;
op->plane_idx = plane_idx;
op->plane = *plane;
@@ -1596,7 +1596,7 @@ void wined3d_cs_emit_set_color_key(struct wined3d_cs *cs, struct wined3d_texture
@@ -1604,7 +1604,7 @@ void wined3d_cs_emit_set_color_key(struct wined3d_cs *cs, struct wined3d_texture
{
struct wined3d_cs_set_color_key *op;
@ -273,7 +273,7 @@ index 6e7a4cb9857..34bae9d4e87 100644
op->opcode = WINED3D_CS_OP_SET_COLOR_KEY;
op->texture = texture;
op->flags = flags;
@@ -1625,7 +1625,7 @@ void wined3d_cs_emit_set_material(struct wined3d_cs *cs, const struct wined3d_ma
@@ -1633,7 +1633,7 @@ void wined3d_cs_emit_set_material(struct wined3d_cs *cs, const struct wined3d_ma
{
struct wined3d_cs_set_material *op;
@ -282,7 +282,7 @@ index 6e7a4cb9857..34bae9d4e87 100644
op->opcode = WINED3D_CS_OP_SET_MATERIAL;
op->material = *material;
@@ -1675,7 +1675,7 @@ void wined3d_cs_emit_set_light(struct wined3d_cs *cs, const struct wined3d_light
@@ -1683,7 +1683,7 @@ void wined3d_cs_emit_set_light(struct wined3d_cs *cs, const struct wined3d_light
{
struct wined3d_cs_set_light *op;
@ -291,7 +291,7 @@ index 6e7a4cb9857..34bae9d4e87 100644
op->opcode = WINED3D_CS_OP_SET_LIGHT;
op->light = *light;
@@ -1710,7 +1710,7 @@ void wined3d_cs_emit_set_light_enable(struct wined3d_cs *cs, unsigned int idx, B
@@ -1718,7 +1718,7 @@ void wined3d_cs_emit_set_light_enable(struct wined3d_cs *cs, unsigned int idx, B
{
struct wined3d_cs_set_light_enable *op;
@ -300,7 +300,7 @@ index 6e7a4cb9857..34bae9d4e87 100644
op->opcode = WINED3D_CS_OP_SET_LIGHT_ENABLE;
op->idx = idx;
op->enable = enable;
@@ -1736,7 +1736,7 @@ void wined3d_cs_emit_reset_state(struct wined3d_cs *cs)
@@ -1742,7 +1742,7 @@ void wined3d_cs_emit_reset_state(struct wined3d_cs *cs)
{
struct wined3d_cs_reset_state *op;
@ -309,7 +309,7 @@ index 6e7a4cb9857..34bae9d4e87 100644
op->opcode = WINED3D_CS_OP_RESET_STATE;
cs->ops->submit(cs);
@@ -1755,7 +1755,7 @@ static void wined3d_cs_emit_callback(struct wined3d_cs *cs, void (*callback)(voi
@@ -1761,7 +1761,7 @@ static void wined3d_cs_emit_callback(struct wined3d_cs *cs, void (*callback)(voi
{
struct wined3d_cs_callback *op;
@ -318,7 +318,7 @@ index 6e7a4cb9857..34bae9d4e87 100644
op->opcode = WINED3D_CS_OP_CALLBACK;
op->callback = callback;
op->object = object;
@@ -1787,7 +1787,7 @@ void wined3d_cs_emit_query_issue(struct wined3d_cs *cs, struct wined3d_query *qu
@@ -1793,7 +1793,7 @@ void wined3d_cs_emit_query_issue(struct wined3d_cs *cs, struct wined3d_query *qu
{
struct wined3d_cs_query_issue *op;
@ -327,7 +327,7 @@ index 6e7a4cb9857..34bae9d4e87 100644
op->opcode = WINED3D_CS_OP_QUERY_ISSUE;
op->query = query;
op->flags = flags;
@@ -1810,7 +1810,7 @@ BOOL wined3d_cs_emit_query_poll(struct wined3d_cs *cs, struct wined3d_query *que
@@ -1816,7 +1816,7 @@ BOOL wined3d_cs_emit_query_poll(struct wined3d_cs *cs, struct wined3d_query *que
struct wined3d_cs_query_poll *op;
BOOL ret;
@ -336,7 +336,7 @@ index 6e7a4cb9857..34bae9d4e87 100644
op->opcode = WINED3D_CS_OP_QUERY_POLL;
op->query = query;
op->flags = flags;
@@ -1836,7 +1836,7 @@ void wined3d_cs_emit_preload_resource(struct wined3d_cs *cs, struct wined3d_reso
@@ -1842,7 +1842,7 @@ void wined3d_cs_emit_preload_resource(struct wined3d_cs *cs, struct wined3d_reso
{
struct wined3d_cs_preload_resource *op;
@ -345,7 +345,7 @@ index 6e7a4cb9857..34bae9d4e87 100644
op->opcode = WINED3D_CS_OP_PRELOAD_RESOURCE;
op->resource = resource;
@@ -1860,7 +1860,7 @@ void wined3d_cs_emit_unload_resource(struct wined3d_cs *cs, struct wined3d_resou
@@ -1866,7 +1866,7 @@ void wined3d_cs_emit_unload_resource(struct wined3d_cs *cs, struct wined3d_resou
{
struct wined3d_cs_unload_resource *op;
@ -354,7 +354,7 @@ index 6e7a4cb9857..34bae9d4e87 100644
op->opcode = WINED3D_CS_OP_UNLOAD_RESOURCE;
op->resource = resource;
@@ -1886,7 +1886,7 @@ HRESULT wined3d_cs_map(struct wined3d_cs *cs, struct wined3d_resource *resource,
@@ -1892,7 +1892,7 @@ HRESULT wined3d_cs_map(struct wined3d_cs *cs, struct wined3d_resource *resource,
struct wined3d_cs_map *op;
HRESULT hr;
@ -363,7 +363,7 @@ index 6e7a4cb9857..34bae9d4e87 100644
op->opcode = WINED3D_CS_OP_MAP;
op->resource = resource;
op->sub_resource_idx = sub_resource_idx;
@@ -1915,7 +1915,7 @@ HRESULT wined3d_cs_unmap(struct wined3d_cs *cs, struct wined3d_resource *resourc
@@ -1921,7 +1921,7 @@ HRESULT wined3d_cs_unmap(struct wined3d_cs *cs, struct wined3d_resource *resourc
struct wined3d_cs_unmap *op;
HRESULT hr;
@ -372,7 +372,7 @@ index 6e7a4cb9857..34bae9d4e87 100644
op->opcode = WINED3D_CS_OP_UNMAP;
op->resource = resource;
op->sub_resource_idx = sub_resource_idx;
@@ -1977,7 +1977,7 @@ void wined3d_cs_emit_push_constants(struct wined3d_cs *cs, enum wined3d_push_con
@@ -1983,7 +1983,7 @@ void wined3d_cs_emit_push_constants(struct wined3d_cs *cs, enum wined3d_push_con
{
struct wined3d_cs_push_constants *op;
@ -381,16 +381,7 @@ index 6e7a4cb9857..34bae9d4e87 100644
op->opcode = WINED3D_CS_OP_PUSH_CONSTANTS;
op->p = p;
op->start_idx = start_idx;
@@ -2006,7 +2006,7 @@ void wined3d_cs_emit_set_primitive_type(struct wined3d_cs *cs, GLenum primitive_
{
struct wined3d_cs_set_primitive_type *op;
- op = cs->ops->require_space(cs, sizeof(*op));
+ op = cs->ops->require_space(cs, sizeof(*op), 0);
op->opcode = WINED3D_CS_OP_SET_PRIMITIVE_TYPE;
op->gl_primitive_type = primitive_type;
@@ -2035,7 +2035,7 @@ void wined3d_cs_emit_blt(struct wined3d_cs *cs, struct wined3d_surface *dst_surf
@@ -2015,7 +2015,7 @@ void wined3d_cs_emit_blt(struct wined3d_cs *cs, struct wined3d_surface *dst_surf
{
struct wined3d_cs_blt *op;
@ -399,7 +390,7 @@ index 6e7a4cb9857..34bae9d4e87 100644
op->opcode = WINED3D_CS_OP_BLT;
op->dst_surface = dst_surface;
op->dst_rect = *dst_rect;
@@ -2074,7 +2074,7 @@ void wined3d_cs_emit_clear_rtv(struct wined3d_cs *cs, struct wined3d_rendertarge
@@ -2054,7 +2054,7 @@ void wined3d_cs_emit_clear_rtv(struct wined3d_cs *cs, struct wined3d_rendertarge
{
struct wined3d_cs_clear_rtv *op;
@ -408,7 +399,7 @@ index 6e7a4cb9857..34bae9d4e87 100644
op->opcode = WINED3D_CS_OP_CLEAR_RTV;
op->view = view;
op->rect = *rect;
@@ -2110,7 +2110,7 @@ void wined3d_cs_emit_update_texture(struct wined3d_cs *cs, struct wined3d_textur
@@ -2090,7 +2090,7 @@ void wined3d_cs_emit_update_texture(struct wined3d_cs *cs, struct wined3d_textur
{
struct wined3d_cs_update_texture *op;
@ -417,7 +408,7 @@ index 6e7a4cb9857..34bae9d4e87 100644
op->opcode = WINED3D_CS_OP_UPDATE_TEXTURE;
op->src = src;
op->dst = dst;
@@ -2176,7 +2176,7 @@ void wined3d_cs_emit_update_sub_resource(struct wined3d_cs *cs, struct wined3d_r
@@ -2156,7 +2156,7 @@ void wined3d_cs_emit_update_sub_resource(struct wined3d_cs *cs, struct wined3d_r
{
struct wined3d_cs_update_sub_resource *op;
@ -426,7 +417,7 @@ index 6e7a4cb9857..34bae9d4e87 100644
op->opcode = WINED3D_CS_OP_UPDATE_SUB_RESOURCE;
op->resource = resource;
op->sub_resource_idx = sub_resource_idx;
@@ -2205,7 +2205,7 @@ HRESULT wined3d_cs_emit_get_dc(struct wined3d_cs *cs, struct wined3d_texture *te
@@ -2185,7 +2185,7 @@ HRESULT wined3d_cs_emit_get_dc(struct wined3d_cs *cs, struct wined3d_texture *te
struct wined3d_cs_get_release_dc *op;
HRESULT hr;
@ -435,7 +426,7 @@ index 6e7a4cb9857..34bae9d4e87 100644
op->opcode = WINED3D_CS_OP_GET_DC;
op->texture = texture;
op->sub_resource_idx = sub_resource_idx;
@@ -2231,7 +2231,7 @@ HRESULT wined3d_cs_emit_release_dc(struct wined3d_cs *cs, struct wined3d_texture
@@ -2211,7 +2211,7 @@ HRESULT wined3d_cs_emit_release_dc(struct wined3d_cs *cs, struct wined3d_texture
struct wined3d_cs_get_release_dc *op;
HRESULT hr;
@ -444,7 +435,7 @@ index 6e7a4cb9857..34bae9d4e87 100644
op->opcode = WINED3D_CS_OP_RELEASE_DC;
op->texture = texture;
op->sub_resource_idx = sub_resource_idx;
@@ -2256,7 +2256,7 @@ HRESULT wined3d_cs_emit_create_swapchain_context(struct wined3d_cs *cs, struct w
@@ -2236,7 +2236,7 @@ HRESULT wined3d_cs_emit_create_swapchain_context(struct wined3d_cs *cs, struct w
struct wined3d_cs_create_swapchain_context *op;
HRESULT hr;
@ -453,7 +444,7 @@ index 6e7a4cb9857..34bae9d4e87 100644
op->opcode = WINED3D_CS_OP_CREATE_SWAPCHAIN_CONTEXT;
op->swapchain = swapchain;
op->hr = &hr;
@@ -2279,7 +2279,7 @@ void wined3d_cs_emit_update_swap_interval(struct wined3d_cs *cs, struct wined3d_
@@ -2259,7 +2259,7 @@ void wined3d_cs_emit_update_swap_interval(struct wined3d_cs *cs, struct wined3d_
{
struct wined3d_cs_update_swap_interval *op;
@ -462,7 +453,7 @@ index 6e7a4cb9857..34bae9d4e87 100644
op->opcode = WINED3D_CS_OP_UPDATE_SWAP_INTERVAL;
op->swapchain = swapchain;
@@ -2317,7 +2317,7 @@ void wined3d_cs_emit_texture_add_dirty_region(struct wined3d_cs *cs,
@@ -2297,7 +2297,7 @@ void wined3d_cs_emit_texture_add_dirty_region(struct wined3d_cs *cs,
if (dirty_region)
WARN("Ignoring dirty_region %s.\n", debug_box(dirty_region));
@ -471,7 +462,7 @@ index 6e7a4cb9857..34bae9d4e87 100644
op->opcode = WINED3D_CS_OP_TEXTURE_ADD_DIRTY_REGION;
op->texture = texture;
op->sub_resource_idx = sub_resource_idx;
@@ -2347,7 +2347,7 @@ void wined3d_cs_emit_buffer_copy(struct wined3d_cs *cs, struct wined3d_buffer *d
@@ -2327,7 +2327,7 @@ void wined3d_cs_emit_buffer_copy(struct wined3d_cs *cs, struct wined3d_buffer *d
{
struct wined3d_cs_buffer_copy *op;
@ -480,7 +471,7 @@ index 6e7a4cb9857..34bae9d4e87 100644
op->opcode = WINED3D_CS_OP_BUFFER_COPY;
op->dst_buffer = dst_buffer;
op->dst_offset = dst_offset;
@@ -2417,7 +2417,7 @@ void wined3d_cs_emit_map_vertex_buffers(struct wined3d_cs *cs, UINT src_start_id
@@ -2397,7 +2397,7 @@ void wined3d_cs_emit_map_vertex_buffers(struct wined3d_cs *cs, UINT src_start_id
{
struct wined3d_cs_map_vertex_buffers *op;
@ -489,7 +480,7 @@ index 6e7a4cb9857..34bae9d4e87 100644
op->opcode = WINED3D_CS_OP_MAP_VERTEX_BUFFERS;
op->src_start_idx = src_start_idx;
op->stream_info = stream_info;
@@ -2482,7 +2482,7 @@ static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void
@@ -2461,7 +2461,7 @@ static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void
/* WINED3D_CS_OP_MAP_VERTEX_BUFFERS */ wined3d_cs_exec_map_vertex_buffers,
};
@ -498,7 +489,7 @@ index 6e7a4cb9857..34bae9d4e87 100644
{
if (size > (cs->data_size - cs->end))
{
@@ -2566,6 +2566,8 @@ static struct wined3d_cs_block *wined3d_cs_dequeue_command(struct wined3d_cs *cs
@@ -2545,6 +2545,8 @@ static struct wined3d_cs_block *wined3d_cs_dequeue_command(struct wined3d_cs *cs
/* FIXME: Use an event to wait after a couple of spins. */
for (;;)
{
@ -507,7 +498,7 @@ index 6e7a4cb9857..34bae9d4e87 100644
if ((block = wined3d_cs_list_dequeue(&cs->exec_list)))
return block;
}
@@ -2593,7 +2595,7 @@ static void wined3d_cs_list_cleanup(struct wined3d_cs_list *list)
@@ -2572,7 +2574,7 @@ static void wined3d_cs_list_cleanup(struct wined3d_cs_list *list)
DeleteCriticalSection(&list->lock);
}
@ -516,7 +507,7 @@ index 6e7a4cb9857..34bae9d4e87 100644
{
struct wined3d_cs_block *block;
@@ -2607,26 +2609,28 @@ static struct wined3d_cs_block *wined3d_cs_get_block(struct wined3d_cs *cs)
@@ -2586,26 +2588,28 @@ static struct wined3d_cs_block *wined3d_cs_get_block(struct wined3d_cs *cs)
}
block->pos = 0;
@ -549,7 +540,7 @@ index 6e7a4cb9857..34bae9d4e87 100644
cs->current_block = block;
}
@@ -2638,10 +2642,13 @@ static void *wined3d_cs_mt_require_space(struct wined3d_cs *cs, size_t size)
@@ -2617,10 +2621,13 @@ static void *wined3d_cs_mt_require_space(struct wined3d_cs *cs, size_t size)
static void wined3d_cs_mt_submit(struct wined3d_cs *cs)
{
@ -564,7 +555,7 @@ index 6e7a4cb9857..34bae9d4e87 100644
cs->current_block = NULL;
}
@@ -2655,7 +2662,7 @@ static void wined3d_cs_mt_submit_and_wait(struct wined3d_cs *cs)
@@ -2634,7 +2641,7 @@ static void wined3d_cs_mt_submit_and_wait(struct wined3d_cs *cs)
block = cs->current_block;
block->fence = &fence;
@ -573,7 +564,7 @@ index 6e7a4cb9857..34bae9d4e87 100644
cs->current_block = NULL;
/* A busy wait should be fine, we're not supposed to have to wait very
@@ -2677,7 +2684,7 @@ static void wined3d_cs_mt_emit_stop(struct wined3d_cs *cs)
@@ -2656,7 +2663,7 @@ static void wined3d_cs_mt_emit_stop(struct wined3d_cs *cs)
assert(cs->thread_id != GetCurrentThreadId());
assert(cs->ops == &wined3d_cs_mt_ops);
@ -582,7 +573,7 @@ index 6e7a4cb9857..34bae9d4e87 100644
op->opcode = WINED3D_CS_OP_STOP;
cs->ops->submit(cs);
@@ -2760,6 +2767,7 @@ struct wined3d_cs *wined3d_cs_create(struct wined3d_device *device)
@@ -2742,6 +2749,7 @@ struct wined3d_cs *wined3d_cs_create(struct wined3d_device *device)
wined3d_cs_list_init(&cs->free_list);
wined3d_cs_list_init(&cs->exec_list);
@ -590,7 +581,7 @@ index 6e7a4cb9857..34bae9d4e87 100644
if (!(cs->thread = CreateThread(NULL, 0, wined3d_cs_run, cs, 0, &cs->thread_id)))
{
@@ -2784,6 +2792,7 @@ void wined3d_cs_destroy(struct wined3d_cs *cs)
@@ -2767,6 +2775,7 @@ void wined3d_cs_destroy(struct wined3d_cs *cs)
WaitForSingleObject(cs->thread, INFINITE);
CloseHandle(cs->thread);
@ -599,10 +590,10 @@ index 6e7a4cb9857..34bae9d4e87 100644
wined3d_cs_list_cleanup(&cs->free_list);
}
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 128e5be297e..22d4fde0ffa 100644
index e1516f0f0b0..d4c51d17bad 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -3219,13 +3219,14 @@ struct wined3d_cs_block
@@ -3205,13 +3205,14 @@ struct wined3d_cs_block
{
struct list entry;
UINT pos;
@ -618,7 +609,7 @@ index 128e5be297e..22d4fde0ffa 100644
void (*submit)(struct wined3d_cs *cs);
void (*submit_and_wait)(struct wined3d_cs *cs);
};
@@ -3244,6 +3245,7 @@ struct wined3d_cs
@@ -3231,6 +3232,7 @@ struct wined3d_cs
struct wined3d_cs_block *current_block;
struct wined3d_cs_list free_list;
struct wined3d_cs_list exec_list;

View File

@ -1,4 +1,4 @@
From a0962ea827e829d8fe589cc0f8c3893341e2c3b6 Mon Sep 17 00:00:00 2001
From c1afe12bb6d64352554ac5ca4e8599de2fae62f1 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20D=C3=B6singer?= <stefan@codeweavers.com>
Date: Thu, 24 Oct 2013 18:56:13 +0200
Subject: wined3d: Use an event to block the worker thread when it is idle.
@ -34,10 +34,10 @@ vsync is turned on.
2 files changed, 52 insertions(+)
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
index a5a6fc0fa4a..1c9d8e1d192 100644
index 74b8b024cc3..c47d918b81e 100644
--- a/dlls/wined3d/cs.c
+++ b/dlls/wined3d/cs.c
@@ -2564,9 +2564,33 @@ static struct wined3d_cs_block *wined3d_cs_list_dequeue(struct wined3d_cs_list *
@@ -2542,9 +2542,33 @@ static struct wined3d_cs_block *wined3d_cs_list_dequeue(struct wined3d_cs_list *
return LIST_ENTRY(head, struct wined3d_cs_block, entry);
}
@ -71,7 +71,7 @@ index a5a6fc0fa4a..1c9d8e1d192 100644
/* FIXME: Use an event to wait after a couple of spins. */
for (;;)
@@ -2575,6 +2599,13 @@ static struct wined3d_cs_block *wined3d_cs_dequeue_command(struct wined3d_cs *cs
@@ -2553,6 +2577,13 @@ static struct wined3d_cs_block *wined3d_cs_dequeue_command(struct wined3d_cs *cs
return block;
if ((block = wined3d_cs_list_dequeue(&cs->exec_list)))
return block;
@ -85,7 +85,7 @@ index a5a6fc0fa4a..1c9d8e1d192 100644
}
}
@@ -2655,6 +2686,9 @@ static void wined3d_cs_mt_submit(struct wined3d_cs *cs)
@@ -2633,6 +2664,9 @@ static void wined3d_cs_mt_submit(struct wined3d_cs *cs)
block = cs->current_block;
wined3d_cs_list_enqueue(block->list, block);
cs->current_block = NULL;
@ -95,7 +95,7 @@ index a5a6fc0fa4a..1c9d8e1d192 100644
}
static void wined3d_cs_mt_submit_and_wait(struct wined3d_cs *cs)
@@ -2670,6 +2704,9 @@ static void wined3d_cs_mt_submit_and_wait(struct wined3d_cs *cs)
@@ -2648,6 +2682,9 @@ static void wined3d_cs_mt_submit_and_wait(struct wined3d_cs *cs)
wined3d_cs_list_enqueue(block->list, block);
cs->current_block = NULL;
@ -105,7 +105,7 @@ index a5a6fc0fa4a..1c9d8e1d192 100644
/* A busy wait should be fine, we're not supposed to have to wait very
* long. */
while (!InterlockedCompareExchange(&fence, TRUE, TRUE));
@@ -2766,6 +2803,14 @@ struct wined3d_cs *wined3d_cs_create(struct wined3d_device *device)
@@ -2747,6 +2784,14 @@ struct wined3d_cs *wined3d_cs_create(struct wined3d_device *device)
return NULL;
}
@ -120,27 +120,27 @@ index a5a6fc0fa4a..1c9d8e1d192 100644
if (wined3d_settings.cs_multithreaded)
{
cs->ops = &wined3d_cs_mt_ops;
@@ -2778,6 +2823,7 @@ struct wined3d_cs *wined3d_cs_create(struct wined3d_device *device)
@@ -2759,6 +2804,7 @@ struct wined3d_cs *wined3d_cs_create(struct wined3d_device *device)
{
ERR("Failed to create wined3d command stream thread.\n");
state_cleanup(&cs->state);
+ CloseHandle(cs->event);
HeapFree(GetProcessHeap(), 0, cs->fb.render_targets);
HeapFree(GetProcessHeap(), 0, cs->data);
HeapFree(GetProcessHeap(), 0, cs);
return NULL;
@@ -2802,6 +2848,7 @@ void wined3d_cs_destroy(struct wined3d_cs *cs)
@@ -2784,6 +2830,7 @@ void wined3d_cs_destroy(struct wined3d_cs *cs)
wined3d_cs_list_cleanup(&cs->free_list);
}
+ CloseHandle(cs->event);
HeapFree(GetProcessHeap(), 0, cs->fb.render_targets);
HeapFree(GetProcessHeap(), 0, cs->data);
HeapFree(GetProcessHeap(), 0, cs);
}
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index ba371f13d8d..10a7b4a8660 100644
index c1919b314bc..e71dfbb2ca8 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -3230,6 +3230,8 @@ struct wined3d_cs_ops
@@ -3218,6 +3218,8 @@ struct wined3d_cs_ops
void (*submit_and_wait)(struct wined3d_cs *cs);
};
@ -149,7 +149,7 @@ index ba371f13d8d..10a7b4a8660 100644
struct wined3d_cs
{
const struct wined3d_cs_ops *ops;
@@ -3247,6 +3249,9 @@ struct wined3d_cs
@@ -3236,6 +3238,9 @@ struct wined3d_cs
struct wined3d_cs_list exec_prio_list;
LONG pending_presents;

View File

@ -1,18 +1,18 @@
From 534625394e8964ca4b36c9319fde24d74887e6f6 Mon Sep 17 00:00:00 2001
From 66849c6928010aa02b9d9d049fcc43c5a3823b0c Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Wed, 8 Feb 2017 12:32:55 +0100
Subject: wined3d: Do not immediately submit stateblock updates.
---
dlls/wined3d/cs.c | 65 +++++++++++++++++++++++-------------------
dlls/wined3d/cs.c | 63 +++++++++++++++++++++++-------------------
dlls/wined3d/wined3d_private.h | 1 +
2 files changed, 37 insertions(+), 29 deletions(-)
2 files changed, 36 insertions(+), 28 deletions(-)
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
index 7c58e67901e..6f00fe64848 100644
index 705d30b2879..25f833dfdce 100644
--- a/dlls/wined3d/cs.c
+++ b/dlls/wined3d/cs.c
@@ -881,7 +881,7 @@ void wined3d_cs_emit_set_predication(struct wined3d_cs *cs, struct wined3d_query
@@ -882,7 +882,7 @@ void wined3d_cs_emit_set_predication(struct wined3d_cs *cs, struct wined3d_query
op->predicate = predicate;
op->value = value;
@ -21,7 +21,7 @@ index 7c58e67901e..6f00fe64848 100644
}
static UINT wined3d_cs_exec_set_viewport(struct wined3d_cs *cs, const void *data)
@@ -902,7 +902,7 @@ void wined3d_cs_emit_set_viewport(struct wined3d_cs *cs, const struct wined3d_vi
@@ -903,7 +903,7 @@ void wined3d_cs_emit_set_viewport(struct wined3d_cs *cs, const struct wined3d_vi
op->opcode = WINED3D_CS_OP_SET_VIEWPORT;
op->viewport = *viewport;
@ -30,7 +30,7 @@ index 7c58e67901e..6f00fe64848 100644
}
static UINT wined3d_cs_exec_set_scissor_rect(struct wined3d_cs *cs, const void *data)
@@ -923,7 +923,7 @@ void wined3d_cs_emit_set_scissor_rect(struct wined3d_cs *cs, const RECT *rect)
@@ -924,7 +924,7 @@ void wined3d_cs_emit_set_scissor_rect(struct wined3d_cs *cs, const RECT *rect)
op->opcode = WINED3D_CS_OP_SET_SCISSOR_RECT;
op->rect = *rect;
@ -39,7 +39,7 @@ index 7c58e67901e..6f00fe64848 100644
}
static UINT wined3d_cs_exec_set_rendertarget_view(struct wined3d_cs *cs, const void *data)
@@ -946,7 +946,7 @@ void wined3d_cs_emit_set_rendertarget_view(struct wined3d_cs *cs, unsigned int v
@@ -947,7 +947,7 @@ void wined3d_cs_emit_set_rendertarget_view(struct wined3d_cs *cs, unsigned int v
op->view_idx = view_idx;
op->view = view;
@ -48,7 +48,7 @@ index 7c58e67901e..6f00fe64848 100644
}
static UINT wined3d_cs_exec_set_depth_stencil_view(struct wined3d_cs *cs, const void *data)
@@ -996,7 +996,7 @@ void wined3d_cs_emit_set_depth_stencil_view(struct wined3d_cs *cs, struct wined3
@@ -997,7 +997,7 @@ void wined3d_cs_emit_set_depth_stencil_view(struct wined3d_cs *cs, struct wined3
op->opcode = WINED3D_CS_OP_SET_DEPTH_STENCIL_VIEW;
op->view = view;
@ -57,7 +57,7 @@ index 7c58e67901e..6f00fe64848 100644
}
static UINT wined3d_cs_exec_set_vertex_declaration(struct wined3d_cs *cs, const void *data)
@@ -1017,7 +1017,7 @@ void wined3d_cs_emit_set_vertex_declaration(struct wined3d_cs *cs, struct wined3
@@ -1018,7 +1018,7 @@ void wined3d_cs_emit_set_vertex_declaration(struct wined3d_cs *cs, struct wined3
op->opcode = WINED3D_CS_OP_SET_VERTEX_DECLARATION;
op->declaration = declaration;
@ -66,7 +66,7 @@ index 7c58e67901e..6f00fe64848 100644
}
static UINT wined3d_cs_exec_set_stream_source(struct wined3d_cs *cs, const void *data)
@@ -1054,7 +1054,7 @@ void wined3d_cs_emit_set_stream_source(struct wined3d_cs *cs, UINT stream_idx,
@@ -1055,7 +1055,7 @@ void wined3d_cs_emit_set_stream_source(struct wined3d_cs *cs, UINT stream_idx,
op->offset = offset;
op->stride = stride;
@ -75,7 +75,7 @@ index 7c58e67901e..6f00fe64848 100644
}
static UINT wined3d_cs_exec_set_stream_source_freq(struct wined3d_cs *cs, const void *data)
@@ -1081,7 +1081,7 @@ void wined3d_cs_emit_set_stream_source_freq(struct wined3d_cs *cs, UINT stream_i
@@ -1082,7 +1082,7 @@ void wined3d_cs_emit_set_stream_source_freq(struct wined3d_cs *cs, UINT stream_i
op->frequency = frequency;
op->flags = flags;
@ -84,7 +84,7 @@ index 7c58e67901e..6f00fe64848 100644
}
static UINT wined3d_cs_exec_set_stream_output(struct wined3d_cs *cs, const void *data)
@@ -1114,7 +1114,7 @@ void wined3d_cs_emit_set_stream_output(struct wined3d_cs *cs, UINT stream_idx,
@@ -1115,7 +1115,7 @@ void wined3d_cs_emit_set_stream_output(struct wined3d_cs *cs, UINT stream_idx,
op->buffer = buffer;
op->offset = offset;
@ -93,7 +93,7 @@ index 7c58e67901e..6f00fe64848 100644
}
static UINT wined3d_cs_exec_set_index_buffer(struct wined3d_cs *cs, const void *data)
@@ -1148,7 +1148,7 @@ void wined3d_cs_emit_set_index_buffer(struct wined3d_cs *cs, struct wined3d_buff
@@ -1149,7 +1149,7 @@ void wined3d_cs_emit_set_index_buffer(struct wined3d_cs *cs, struct wined3d_buff
op->format_id = format_id;
op->offset = offset;
@ -102,7 +102,7 @@ index 7c58e67901e..6f00fe64848 100644
}
static UINT wined3d_cs_exec_set_constant_buffer(struct wined3d_cs *cs, const void *data)
@@ -1179,7 +1179,7 @@ void wined3d_cs_emit_set_constant_buffer(struct wined3d_cs *cs, enum wined3d_sha
@@ -1180,7 +1180,7 @@ void wined3d_cs_emit_set_constant_buffer(struct wined3d_cs *cs, enum wined3d_sha
op->cb_idx = cb_idx;
op->buffer = buffer;
@ -111,7 +111,7 @@ index 7c58e67901e..6f00fe64848 100644
}
static UINT wined3d_cs_exec_set_texture(struct wined3d_cs *cs, const void *data)
@@ -1272,7 +1272,7 @@ void wined3d_cs_emit_set_texture(struct wined3d_cs *cs, UINT stage, struct wined
@@ -1273,7 +1273,7 @@ void wined3d_cs_emit_set_texture(struct wined3d_cs *cs, UINT stage, struct wined
op->stage = stage;
op->texture = texture;
@ -120,7 +120,7 @@ index 7c58e67901e..6f00fe64848 100644
}
static UINT wined3d_cs_exec_set_shader_resource_view(struct wined3d_cs *cs, const void *data)
@@ -1305,7 +1305,7 @@ void wined3d_cs_emit_set_shader_resource_view(struct wined3d_cs *cs, enum wined3
@@ -1308,7 +1308,7 @@ void wined3d_cs_emit_set_shader_resource_view(struct wined3d_cs *cs, enum wined3
op->view_idx = view_idx;
op->view = view;
@ -129,7 +129,7 @@ index 7c58e67901e..6f00fe64848 100644
}
static UINT wined3d_cs_exec_set_unordered_access_view(struct wined3d_cs *cs, const void *data)
@@ -1337,7 +1337,7 @@ void wined3d_cs_emit_set_unordered_access_view(struct wined3d_cs *cs, enum wined
@@ -1340,7 +1340,7 @@ void wined3d_cs_emit_set_unordered_access_view(struct wined3d_cs *cs, enum wined
op->view_idx = view_idx;
op->view = view;
@ -138,7 +138,7 @@ index 7c58e67901e..6f00fe64848 100644
}
static UINT wined3d_cs_exec_set_sampler(struct wined3d_cs *cs, const void *data)
@@ -1361,7 +1361,7 @@ void wined3d_cs_emit_set_sampler(struct wined3d_cs *cs, enum wined3d_shader_type
@@ -1367,7 +1367,7 @@ void wined3d_cs_emit_set_sampler(struct wined3d_cs *cs, enum wined3d_shader_type
op->sampler_idx = sampler_idx;
op->sampler = sampler;
@ -147,7 +147,7 @@ index 7c58e67901e..6f00fe64848 100644
}
static UINT wined3d_cs_exec_set_shader(struct wined3d_cs *cs, const void *data)
@@ -1385,7 +1385,7 @@ void wined3d_cs_emit_set_shader(struct wined3d_cs *cs, enum wined3d_shader_type
@@ -1393,7 +1393,7 @@ void wined3d_cs_emit_set_shader(struct wined3d_cs *cs, enum wined3d_shader_type
op->type = type;
op->shader = shader;
@ -156,7 +156,7 @@ index 7c58e67901e..6f00fe64848 100644
}
static UINT wined3d_cs_exec_set_rasterizer_state(struct wined3d_cs *cs, const void *data)
@@ -1407,7 +1407,7 @@ void wined3d_cs_emit_set_rasterizer_state(struct wined3d_cs *cs,
@@ -1415,7 +1415,7 @@ void wined3d_cs_emit_set_rasterizer_state(struct wined3d_cs *cs,
op->opcode = WINED3D_CS_OP_SET_RASTERIZER_STATE;
op->state = rasterizer_state;
@ -165,7 +165,7 @@ index 7c58e67901e..6f00fe64848 100644
}
static UINT wined3d_cs_exec_set_render_state(struct wined3d_cs *cs, const void *data)
@@ -1429,7 +1429,7 @@ void wined3d_cs_emit_set_render_state(struct wined3d_cs *cs, enum wined3d_render
@@ -1437,7 +1437,7 @@ void wined3d_cs_emit_set_render_state(struct wined3d_cs *cs, enum wined3d_render
op->state = state;
op->value = value;
@ -174,7 +174,7 @@ index 7c58e67901e..6f00fe64848 100644
}
static UINT wined3d_cs_exec_set_texture_state(struct wined3d_cs *cs, const void *data)
@@ -1453,7 +1453,7 @@ void wined3d_cs_emit_set_texture_state(struct wined3d_cs *cs, UINT stage,
@@ -1461,7 +1461,7 @@ void wined3d_cs_emit_set_texture_state(struct wined3d_cs *cs, UINT stage,
op->state = state;
op->value = value;
@ -183,7 +183,7 @@ index 7c58e67901e..6f00fe64848 100644
}
static UINT wined3d_cs_exec_set_sampler_state(struct wined3d_cs *cs, const void *data)
@@ -1477,7 +1477,7 @@ void wined3d_cs_emit_set_sampler_state(struct wined3d_cs *cs, UINT sampler_idx,
@@ -1485,7 +1485,7 @@ void wined3d_cs_emit_set_sampler_state(struct wined3d_cs *cs, UINT sampler_idx,
op->state = state;
op->value = value;
@ -192,7 +192,7 @@ index 7c58e67901e..6f00fe64848 100644
}
static UINT wined3d_cs_exec_set_transform(struct wined3d_cs *cs, const void *data)
@@ -1501,7 +1501,7 @@ void wined3d_cs_emit_set_transform(struct wined3d_cs *cs, enum wined3d_transform
@@ -1509,7 +1509,7 @@ void wined3d_cs_emit_set_transform(struct wined3d_cs *cs, enum wined3d_transform
op->state = state;
op->matrix = *matrix;
@ -201,7 +201,7 @@ index 7c58e67901e..6f00fe64848 100644
}
static UINT wined3d_cs_exec_set_clip_plane(struct wined3d_cs *cs, const void *data)
@@ -1523,7 +1523,7 @@ void wined3d_cs_emit_set_clip_plane(struct wined3d_cs *cs, UINT plane_idx, const
@@ -1531,7 +1531,7 @@ void wined3d_cs_emit_set_clip_plane(struct wined3d_cs *cs, UINT plane_idx, const
op->plane_idx = plane_idx;
op->plane = *plane;
@ -210,7 +210,7 @@ index 7c58e67901e..6f00fe64848 100644
}
static UINT wined3d_cs_exec_set_color_key(struct wined3d_cs *cs, const void *data)
@@ -1608,7 +1608,7 @@ void wined3d_cs_emit_set_color_key(struct wined3d_cs *cs, struct wined3d_texture
@@ -1616,7 +1616,7 @@ void wined3d_cs_emit_set_color_key(struct wined3d_cs *cs, struct wined3d_texture
else
op->set = 0;
@ -219,7 +219,7 @@ index 7c58e67901e..6f00fe64848 100644
}
static UINT wined3d_cs_exec_set_material(struct wined3d_cs *cs, const void *data)
@@ -1629,7 +1629,7 @@ void wined3d_cs_emit_set_material(struct wined3d_cs *cs, const struct wined3d_ma
@@ -1637,7 +1637,7 @@ void wined3d_cs_emit_set_material(struct wined3d_cs *cs, const struct wined3d_ma
op->opcode = WINED3D_CS_OP_SET_MATERIAL;
op->material = *material;
@ -228,7 +228,7 @@ index 7c58e67901e..6f00fe64848 100644
}
static UINT wined3d_cs_exec_set_light(struct wined3d_cs *cs, const void *data)
@@ -1679,7 +1679,7 @@ void wined3d_cs_emit_set_light(struct wined3d_cs *cs, const struct wined3d_light
@@ -1687,7 +1687,7 @@ void wined3d_cs_emit_set_light(struct wined3d_cs *cs, const struct wined3d_light
op->opcode = WINED3D_CS_OP_SET_LIGHT;
op->light = *light;
@ -237,7 +237,7 @@ index 7c58e67901e..6f00fe64848 100644
}
static UINT wined3d_cs_exec_set_light_enable(struct wined3d_cs *cs, const void *data)
@@ -1715,7 +1715,7 @@ void wined3d_cs_emit_set_light_enable(struct wined3d_cs *cs, unsigned int idx, B
@@ -1723,7 +1723,7 @@ void wined3d_cs_emit_set_light_enable(struct wined3d_cs *cs, unsigned int idx, B
op->idx = idx;
op->enable = enable;
@ -246,7 +246,7 @@ index 7c58e67901e..6f00fe64848 100644
}
static UINT wined3d_cs_exec_reset_state(struct wined3d_cs *cs, const void *data)
@@ -1739,7 +1739,7 @@ void wined3d_cs_emit_reset_state(struct wined3d_cs *cs)
@@ -1745,7 +1745,7 @@ void wined3d_cs_emit_reset_state(struct wined3d_cs *cs)
op = cs->ops->require_space(cs, sizeof(*op), 0);
op->opcode = WINED3D_CS_OP_RESET_STATE;
@ -255,25 +255,16 @@ index 7c58e67901e..6f00fe64848 100644
}
static UINT wined3d_cs_exec_callback(struct wined3d_cs *cs, const void *data)
@@ -1988,7 +1988,7 @@ void wined3d_cs_emit_push_constants(struct wined3d_cs *cs, enum wined3d_push_con
@@ -1994,7 +1994,7 @@ void wined3d_cs_emit_push_constants(struct wined3d_cs *cs, enum wined3d_push_con
op->count = count;
memcpy(op->constants, constants, count * push_constant_info[p].size);
- cs->ops->submit(cs);
+ cs->ops->submit_delayed(cs);
}
static UINT wined3d_cs_exec_set_primitive_type(struct wined3d_cs *cs, const void *data)
@@ -2014,7 +2014,7 @@ void wined3d_cs_emit_set_primitive_type(struct wined3d_cs *cs, GLenum primitive_
op->opcode = WINED3D_CS_OP_SET_PRIMITIVE_TYPE;
op->gl_primitive_type = primitive_type;
- cs->ops->submit(cs);
+ cs->ops->submit_delayed(cs);
}
static UINT wined3d_cs_exec_blt(struct wined3d_cs *cs, const void *data)
@@ -2535,6 +2535,7 @@ static const struct wined3d_cs_ops wined3d_cs_st_ops =
@@ -2514,6 +2514,7 @@ static const struct wined3d_cs_ops wined3d_cs_st_ops =
wined3d_cs_st_require_space,
wined3d_cs_st_submit,
wined3d_cs_st_submit,
@ -281,7 +272,7 @@ index 7c58e67901e..6f00fe64848 100644
};
static void wined3d_cs_list_enqueue(struct wined3d_cs_list *list, struct wined3d_cs_block *block)
@@ -2711,11 +2712,17 @@ static void wined3d_cs_mt_submit_and_wait(struct wined3d_cs *cs)
@@ -2690,11 +2691,17 @@ static void wined3d_cs_mt_submit_and_wait(struct wined3d_cs *cs)
while (!InterlockedCompareExchange(&fence, TRUE, TRUE));
}
@ -300,10 +291,10 @@ index 7c58e67901e..6f00fe64848 100644
static void wined3d_cs_mt_emit_stop(struct wined3d_cs *cs)
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 6ed9ec6f557..b9db6e880b7 100644
index e71dfbb2ca8..b8c14275406 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -3230,6 +3230,7 @@ struct wined3d_cs_ops
@@ -3216,6 +3216,7 @@ struct wined3d_cs_ops
void *(*require_space)(struct wined3d_cs *cs, size_t size, int priority);
void (*submit)(struct wined3d_cs *cs);
void (*submit_and_wait)(struct wined3d_cs *cs);

View File

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

View File

@ -1,4 +1,4 @@
From e01ccb1f50492054732c4234a963832581a1aa8c Mon Sep 17 00:00:00 2001
From 3c4ecedb41a99b2ebe8cc5f1f6d6fe0341ff28bf Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Sun, 19 Feb 2017 17:38:00 +0100
Subject: wined3d: Set all default state values to zero.
@ -12,10 +12,10 @@ keying in the Motoracer 2.
1 file changed, 3 insertions(+)
diff --git a/dlls/wined3d/stateblock.c b/dlls/wined3d/stateblock.c
index 463ccc91561..263b200c762 100644
index 8b9135356f1..0b587f78889 100644
--- a/dlls/wined3d/stateblock.c
+++ b/dlls/wined3d/stateblock.c
@@ -1358,6 +1358,9 @@ HRESULT state_init(struct wined3d_state *state, const struct wined3d_gl_info *gl
@@ -1306,6 +1306,9 @@ void state_init(struct wined3d_state *state, struct wined3d_fb_state *fb,
{
unsigned int i;
@ -23,8 +23,8 @@ index 463ccc91561..263b200c762 100644
+ memset(state, 0, sizeof(*state));
+
state->flags = flags;
state->fb = fb;
for (i = 0; i < LIGHTMAP_SIZE; i++)
--
2.11.0

File diff suppressed because it is too large Load Diff