wined3d-CSMT_Main: Reenable patchset.

This commit is contained in:
Sebastian Lackner
2017-02-08 13:57:39 +01:00
parent 06886567bc
commit 74528271f3
157 changed files with 6459 additions and 16890 deletions

View File

@@ -1,79 +0,0 @@
From 103b66b00488084c7245407a61b2bb09d2c0cfdc Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Tue, 15 Nov 2016 22:07:19 +0100
Subject: Revert "wined3d: Return location from wined3d_buffer_get_memory()."
This reverts commit e2733ed7fbcc9ca205e5e9b7507f301021b742cc.
---
dlls/wined3d/buffer.c | 10 +++++-----
dlls/wined3d/wined3d_private.h | 2 +-
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c
index 58c273c..6b59965 100644
--- a/dlls/wined3d/buffer.c
+++ b/dlls/wined3d/buffer.c
@@ -631,7 +631,7 @@ BYTE *wined3d_buffer_load_sysmem(struct wined3d_buffer *buffer, struct wined3d_c
return buffer->resource.heap_memory;
}
-DWORD wined3d_buffer_get_memory(struct wined3d_buffer *buffer,
+void wined3d_buffer_get_memory(struct wined3d_buffer *buffer,
struct wined3d_bo_address *data, DWORD locations)
{
TRACE("buffer %p, data %p, locations %s.\n",
@@ -641,19 +641,18 @@ DWORD wined3d_buffer_get_memory(struct wined3d_buffer *buffer,
{
data->buffer_object = buffer->buffer_object;
data->addr = NULL;
- return WINED3D_LOCATION_BUFFER;
+ return;
}
if (locations & WINED3D_LOCATION_SYSMEM)
{
data->buffer_object = 0;
data->addr = buffer->resource.heap_memory;
- return WINED3D_LOCATION_SYSMEM;
+ return;
}
ERR("Unexpected locations %s.\n", wined3d_debug_location(locations));
data->buffer_object = 0;
data->addr = NULL;
- return 0;
}
static void buffer_unload(struct wined3d_resource *resource)
@@ -1275,7 +1274,7 @@ HRESULT wined3d_buffer_copy(struct wined3d_buffer *dst_buffer, unsigned int dst_
context = context_acquire(device, NULL);
gl_info = context->gl_info;
- dst_location = wined3d_buffer_get_memory(dst_buffer, &dst, dst_buffer->locations);
+ wined3d_buffer_get_memory(dst_buffer, &dst, dst_buffer->locations);
wined3d_buffer_get_memory(src_buffer, &src, src_buffer->locations);
if (dst.buffer_object && src.buffer_object)
@@ -1327,6 +1326,7 @@ HRESULT wined3d_buffer_copy(struct wined3d_buffer *dst_buffer, unsigned int dst_
memcpy(dst.addr + dst_offset, src.addr + src_offset, size);
}
+ dst_location = dst.buffer_object ? WINED3D_LOCATION_BUFFER : WINED3D_LOCATION_SYSMEM;
wined3d_buffer_invalidate_range(dst_buffer, ~dst_location, dst_offset, size);
context_release(context);
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 6e742f6..503f7f2 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -3179,7 +3179,7 @@ static inline struct wined3d_buffer *buffer_from_resource(struct wined3d_resourc
}
void buffer_mark_used(struct wined3d_buffer *buffer) DECLSPEC_HIDDEN;
-DWORD wined3d_buffer_get_memory(struct wined3d_buffer *buffer,
+void wined3d_buffer_get_memory(struct wined3d_buffer *buffer,
struct wined3d_bo_address *data, DWORD locations) DECLSPEC_HIDDEN;
void wined3d_buffer_invalidate_location(struct wined3d_buffer *buffer, DWORD location) DECLSPEC_HIDDEN;
void wined3d_buffer_load(struct wined3d_buffer *buffer, struct wined3d_context *context,
--
2.9.0

View File

@@ -0,0 +1,26 @@
From d08d8a1233fd4d1fcb269b6e364c2122183fdd3f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Sun, 5 Feb 2017 16:34:41 +0100
Subject: wined3d: Replace surface_load_location with texture_load_location.
---
dlls/wined3d/device.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index 74a4b09ab1a..4d0f6f2c4be 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -286,7 +286,8 @@ void device_clear_render_targets(struct wined3d_device *device, UINT rt_count, c
{
DWORD location = render_offscreen ? dsv->resource->draw_binding : WINED3D_LOCATION_DRAWABLE;
- surface_load_location(depth_stencil, context, location);
+ wined3d_texture_load_location(depth_stencil->container, dsv->sub_resource_idx,
+ context, location);
}
if (!context_apply_clear_state(context, state, rt_count, fb))
--
2.11.0

View File

@@ -1,80 +0,0 @@
From 2accc03254f24b7fb290d99d0bec7a689386c9e1 Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Tue, 15 Nov 2016 22:07:28 +0100
Subject: Revert "wined3d: Use unsynchronized buffer updates only if there has
been at least one buffer map."
This reverts commit 085ae6ed08710fedfdcd1febe580d04baeebd596.
---
dlls/wined3d/buffer.c | 14 ++++++--------
1 file changed, 6 insertions(+), 8 deletions(-)
diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c
index 6b59965..f686855 100644
--- a/dlls/wined3d/buffer.c
+++ b/dlls/wined3d/buffer.c
@@ -34,8 +34,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(d3d);
#define WINED3D_BUFFER_DOUBLEBUFFER 0x04 /* Keep both a buffer object and a system memory copy for this buffer. */
#define WINED3D_BUFFER_DISCARD 0x08 /* A DISCARD lock has occurred since the last preload. */
#define WINED3D_BUFFER_SYNC 0x10 /* There has been at least one synchronized map since the last preload. */
-#define WINED3D_BUFFER_MAP 0x20 /* There has been at least one map since the last preload. */
-#define WINED3D_BUFFER_APPLESYNC 0x40 /* Using sync as in GL_APPLE_flush_buffer_range. */
+#define WINED3D_BUFFER_APPLESYNC 0x20 /* Using sync as in GL_APPLE_flush_buffer_range. */
#define VB_MAXDECLCHANGES 100 /* After that number of decl changes we stop converting */
#define VB_RESETDECLCHANGE 1000 /* Reset the decl changecount after that number of draws */
@@ -819,7 +818,7 @@ static void buffer_direct_upload(struct wined3d_buffer *This, struct wined3d_con
mapflags = GL_MAP_WRITE_BIT | GL_MAP_FLUSH_EXPLICIT_BIT;
if (flags & WINED3D_BUFFER_DISCARD)
mapflags |= GL_MAP_INVALIDATE_BUFFER_BIT;
- else if (flags & WINED3D_BUFFER_MAP && !(flags & WINED3D_BUFFER_SYNC))
+ else if (!(flags & WINED3D_BUFFER_SYNC))
mapflags |= GL_MAP_UNSYNCHRONIZED_BIT;
map = GL_EXTCALL(glMapBufferRange(This->buffer_type_hint, 0,
This->resource.size, mapflags));
@@ -832,7 +831,7 @@ static void buffer_direct_upload(struct wined3d_buffer *This, struct wined3d_con
DWORD syncflags = 0;
if (flags & WINED3D_BUFFER_DISCARD)
syncflags |= WINED3D_MAP_DISCARD;
- else if (flags & WINED3D_BUFFER_MAP && !(flags & WINED3D_BUFFER_SYNC))
+ else if (!(flags & WINED3D_BUFFER_SYNC))
syncflags |= WINED3D_MAP_NOOVERWRITE;
buffer_sync_apple(This, syncflags, gl_info);
}
@@ -930,14 +929,14 @@ static void buffer_conversion_upload(struct wined3d_buffer *buffer, struct wined
void buffer_mark_used(struct wined3d_buffer *buffer)
{
- buffer->flags &= ~(WINED3D_BUFFER_MAP | WINED3D_BUFFER_SYNC | WINED3D_BUFFER_DISCARD);
+ buffer->flags &= ~(WINED3D_BUFFER_SYNC | WINED3D_BUFFER_DISCARD);
}
/* Context activation is done by the caller. */
void wined3d_buffer_load(struct wined3d_buffer *buffer, struct wined3d_context *context,
const struct wined3d_state *state)
{
- DWORD flags = buffer->flags & (WINED3D_BUFFER_MAP | WINED3D_BUFFER_SYNC | WINED3D_BUFFER_DISCARD);
+ DWORD flags = buffer->flags & (WINED3D_BUFFER_SYNC | WINED3D_BUFFER_DISCARD);
const struct wined3d_gl_info *gl_info = context->gl_info;
BOOL decl_changed = FALSE;
@@ -1012,7 +1011,7 @@ void wined3d_buffer_load(struct wined3d_buffer *buffer, struct wined3d_context *
/* Avoid unfenced updates, we might overwrite more areas of the buffer than the application
* cleared for unsynchronized updates.
*/
- flags = 0;
+ flags = WINED3D_BUFFER_SYNC;
}
else
{
@@ -1172,7 +1171,6 @@ static HRESULT wined3d_buffer_map(struct wined3d_buffer *buffer, UINT offset, UI
}
}
- buffer->flags |= WINED3D_BUFFER_MAP;
if (flags & WINED3D_MAP_DISCARD)
buffer->flags |= WINED3D_BUFFER_DISCARD;
else if (!(flags & WINED3D_MAP_NOOVERWRITE))
--
2.9.0

View File

@@ -1,30 +0,0 @@
From 289f21e74582e376903f3f987b839f2b66fe29af Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Tue, 15 Nov 2016 22:07:39 +0100
Subject: Revert "wined3d: Avoid unsynchronized buffer update when reloading
whole buffer."
This reverts commit c259854a0afc5e4fb8644af7c5c979f312f954f3.
---
dlls/wined3d/buffer.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c
index f686855..564b1fc 100644
--- a/dlls/wined3d/buffer.c
+++ b/dlls/wined3d/buffer.c
@@ -1009,9 +1009,9 @@ void wined3d_buffer_load(struct wined3d_buffer *buffer, struct wined3d_context *
buffer_invalidate_bo_range(buffer, 0, 0);
/* Avoid unfenced updates, we might overwrite more areas of the buffer than the application
- * cleared for unsynchronized updates.
+ * cleared for unsynchronized updates
*/
- flags = WINED3D_BUFFER_SYNC;
+ flags = 0;
}
else
{
--
2.9.0

View File

@@ -0,0 +1,293 @@
From 29cdf26fd35b1d309b9326c2eb8641ed5564e85b Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Mon, 6 Feb 2017 05:50:11 +0100
Subject: wined3d: Send push_constants through the CS.
---
dlls/wined3d/cs.c | 119 +++++++++++++++++++++++++----------------
dlls/wined3d/device.c | 12 ++---
dlls/wined3d/wined3d_private.h | 12 ++---
3 files changed, 83 insertions(+), 60 deletions(-)
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
index c0d8a5f2fd5..b832b7e0733 100644
--- a/dlls/wined3d/cs.c
+++ b/dlls/wined3d/cs.c
@@ -75,6 +75,7 @@ enum wined3d_cs_op
WINED3D_CS_OP_MAP,
WINED3D_CS_OP_UNMAP,
WINED3D_CS_OP_GLFINISH,
+ WINED3D_CS_OP_PUSH_CONSTANTS,
WINED3D_CS_OP_STOP,
};
@@ -366,6 +367,15 @@ struct wined3d_cs_finish
enum wined3d_cs_op opcode;
};
+struct wined3d_cs_push_constants
+{
+ enum wined3d_cs_op opcode;
+ enum wined3d_push_constants p;
+ unsigned int start_idx;
+ unsigned int count;
+ BYTE constants[1];
+};
+
static inline BOOL wined3d_cs_process_block(struct wined3d_cs *cs, struct wined3d_cs_block *block);
static void wined3d_cs_mt_submit(struct wined3d_cs *cs);
@@ -1742,6 +1752,67 @@ void wined3d_cs_emit_glfinish(struct wined3d_cs *cs)
cs->ops->submit(cs);
}
+static const struct
+{
+ size_t offset;
+ size_t size;
+ DWORD mask;
+}
+push_constant_info[] =
+{
+ /* WINED3D_PUSH_CONSTANTS_VS_F */
+ {FIELD_OFFSET(struct wined3d_state, vs_consts_f), sizeof(struct wined3d_vec4), WINED3D_SHADER_CONST_VS_F},
+ /* WINED3D_PUSH_CONSTANTS_PS_F */
+ {FIELD_OFFSET(struct wined3d_state, ps_consts_f), sizeof(struct wined3d_vec4), WINED3D_SHADER_CONST_PS_F},
+ /* WINED3D_PUSH_CONSTANTS_VS_I */
+ {FIELD_OFFSET(struct wined3d_state, vs_consts_i), sizeof(struct wined3d_ivec4), WINED3D_SHADER_CONST_VS_I},
+ /* WINED3D_PUSH_CONSTANTS_PS_I */
+ {FIELD_OFFSET(struct wined3d_state, ps_consts_i), sizeof(struct wined3d_ivec4), WINED3D_SHADER_CONST_PS_I},
+ /* WINED3D_PUSH_CONSTANTS_VS_B */
+ {FIELD_OFFSET(struct wined3d_state, vs_consts_b), sizeof(BOOL), WINED3D_SHADER_CONST_VS_B},
+ /* WINED3D_PUSH_CONSTANTS_PS_B */
+ {FIELD_OFFSET(struct wined3d_state, ps_consts_b), sizeof(BOOL), WINED3D_SHADER_CONST_PS_B},
+};
+
+static UINT wined3d_cs_exec_push_constants(struct wined3d_cs *cs, const void *data)
+{
+ const struct wined3d_cs_push_constants *op = data;
+ size_t size = FIELD_OFFSET(struct wined3d_cs_push_constants, constants[op->count * push_constant_info[op->p].size]);
+ struct wined3d_device *device = cs->device;
+ unsigned int context_count;
+ unsigned int i;
+ size_t offset;
+
+ if (op->p == WINED3D_PUSH_CONSTANTS_VS_F)
+ device->shader_backend->shader_update_float_vertex_constants(device, op->start_idx, op->count);
+ else if (op->p == WINED3D_PUSH_CONSTANTS_PS_F)
+ device->shader_backend->shader_update_float_pixel_constants(device, op->start_idx, op->count);
+
+ offset = push_constant_info[op->p].offset + op->start_idx * push_constant_info[op->p].size;
+ memcpy((BYTE *)&cs->state + offset, op->constants, op->count * push_constant_info[op->p].size);
+ for (i = 0, context_count = device->context_count; i < context_count; ++i)
+ {
+ device->contexts[i]->constant_update_mask |= push_constant_info[op->p].mask;
+ }
+
+ return size;
+}
+
+void wined3d_cs_emit_push_constants(struct wined3d_cs *cs, enum wined3d_push_constants p,
+ unsigned int start_idx, unsigned int count, const void *constants)
+{
+ struct wined3d_cs_push_constants *op;
+
+ op = cs->ops->require_space(cs, FIELD_OFFSET(struct wined3d_cs_push_constants, constants[count * push_constant_info[p].size]));
+ op->opcode = WINED3D_CS_OP_PUSH_CONSTANTS;
+ op->p = p;
+ op->start_idx = start_idx;
+ op->count = count;
+ memcpy(op->constants, constants, count * push_constant_info[p].size);
+
+ cs->ops->submit(cs);
+}
+
static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void *data) =
{
/* WINED3D_CS_OP_FENCE */ wined3d_cs_exec_fence,
@@ -1782,6 +1853,7 @@ static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void
/* WINED3D_CS_OP_MAP */ wined3d_cs_exec_map,
/* WINED3D_CS_OP_UNMAP */ wined3d_cs_exec_unmap,
/* WINED3D_CS_OP_GLFINISH */ wined3d_cs_exec_glfinish,
+ /* WINED3D_CS_OP_PUSH_CONSTANTS */ wined3d_cs_exec_push_constants,
};
static void *wined3d_cs_st_require_space(struct wined3d_cs *cs, size_t size)
@@ -1808,55 +1880,11 @@ static void wined3d_cs_st_submit(struct wined3d_cs *cs)
wined3d_cs_op_handlers[opcode](cs, cs->data);
}
-static void wined3d_cs_st_push_constants(struct wined3d_cs *cs, enum wined3d_push_constants p,
- unsigned int start_idx, unsigned int count, const void *constants)
-{
- struct wined3d_device *device = cs->device;
- unsigned int context_count;
- unsigned int i;
- size_t offset;
-
- static const struct
- {
- size_t offset;
- size_t size;
- DWORD mask;
- }
- push_constant_info[] =
- {
- /* WINED3D_PUSH_CONSTANTS_VS_F */
- {FIELD_OFFSET(struct wined3d_state, vs_consts_f), sizeof(struct wined3d_vec4), WINED3D_SHADER_CONST_VS_F},
- /* WINED3D_PUSH_CONSTANTS_PS_F */
- {FIELD_OFFSET(struct wined3d_state, ps_consts_f), sizeof(struct wined3d_vec4), WINED3D_SHADER_CONST_PS_F},
- /* WINED3D_PUSH_CONSTANTS_VS_I */
- {FIELD_OFFSET(struct wined3d_state, vs_consts_i), sizeof(struct wined3d_ivec4), WINED3D_SHADER_CONST_VS_I},
- /* WINED3D_PUSH_CONSTANTS_PS_I */
- {FIELD_OFFSET(struct wined3d_state, ps_consts_i), sizeof(struct wined3d_ivec4), WINED3D_SHADER_CONST_PS_I},
- /* WINED3D_PUSH_CONSTANTS_VS_B */
- {FIELD_OFFSET(struct wined3d_state, vs_consts_b), sizeof(BOOL), WINED3D_SHADER_CONST_VS_B},
- /* WINED3D_PUSH_CONSTANTS_PS_B */
- {FIELD_OFFSET(struct wined3d_state, ps_consts_b), sizeof(BOOL), WINED3D_SHADER_CONST_PS_B},
- };
-
- if (p == WINED3D_PUSH_CONSTANTS_VS_F)
- device->shader_backend->shader_update_float_vertex_constants(device, start_idx, count);
- else if (p == WINED3D_PUSH_CONSTANTS_PS_F)
- device->shader_backend->shader_update_float_pixel_constants(device, start_idx, count);
-
- offset = push_constant_info[p].offset + start_idx * push_constant_info[p].size;
- memcpy((BYTE *)&cs->state + offset, constants, count * push_constant_info[p].size);
- for (i = 0, context_count = device->context_count; i < context_count; ++i)
- {
- device->contexts[i]->constant_update_mask |= push_constant_info[p].mask;
- }
-}
-
static const struct wined3d_cs_ops wined3d_cs_st_ops =
{
wined3d_cs_st_require_space,
wined3d_cs_st_submit,
wined3d_cs_st_submit,
- wined3d_cs_st_push_constants,
};
static void *wined3d_cs_mt_require_space(struct wined3d_cs *cs, size_t size)
@@ -1864,6 +1892,8 @@ static void *wined3d_cs_mt_require_space(struct wined3d_cs *cs, size_t size)
struct wined3d_cs_block *block = wined3d_cs_get_thread_block(cs);
void *data;
+ assert(size <= sizeof(block->data));
+
if (!block || block->pos + size > sizeof(block->data))
{
if (block)
@@ -1906,7 +1936,6 @@ static const struct wined3d_cs_ops wined3d_cs_mt_ops =
wined3d_cs_mt_require_space,
wined3d_cs_mt_submit_and_wait, /* FIXME */
wined3d_cs_mt_submit_and_wait,
- wined3d_cs_st_push_constants, /* FIXME */
};
/* FIXME: wined3d_device_uninit_3d() should either flush and wait, or be an
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index 4d0f6f2c4be..831f36c9870 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -2417,7 +2417,7 @@ HRESULT CDECL wined3d_device_set_vs_consts_b(struct wined3d_device *device,
}
else
{
- wined3d_cs_push_constants(device->cs, WINED3D_PUSH_CONSTANTS_VS_B, start_idx, count, constants);
+ wined3d_cs_emit_push_constants(device->cs, WINED3D_PUSH_CONSTANTS_VS_B, start_idx, count, constants);
}
return WINED3D_OK;
@@ -2466,7 +2466,7 @@ HRESULT CDECL wined3d_device_set_vs_consts_i(struct wined3d_device *device,
}
else
{
- wined3d_cs_push_constants(device->cs, WINED3D_PUSH_CONSTANTS_VS_I, start_idx, count, constants);
+ wined3d_cs_emit_push_constants(device->cs, WINED3D_PUSH_CONSTANTS_VS_I, start_idx, count, constants);
}
return WINED3D_OK;
@@ -2511,7 +2511,7 @@ HRESULT CDECL wined3d_device_set_vs_consts_f(struct wined3d_device *device,
memset(&device->recording->changed.vs_consts_f[start_idx], 1,
count * sizeof(*device->recording->changed.vs_consts_f));
else
- wined3d_cs_push_constants(device->cs, WINED3D_PUSH_CONSTANTS_VS_F, start_idx, count, constants);
+ wined3d_cs_emit_push_constants(device->cs, WINED3D_PUSH_CONSTANTS_VS_F, start_idx, count, constants);
return WINED3D_OK;
}
@@ -2650,7 +2650,7 @@ HRESULT CDECL wined3d_device_set_ps_consts_b(struct wined3d_device *device,
}
else
{
- wined3d_cs_push_constants(device->cs, WINED3D_PUSH_CONSTANTS_PS_B, start_idx, count, constants);
+ wined3d_cs_emit_push_constants(device->cs, WINED3D_PUSH_CONSTANTS_PS_B, start_idx, count, constants);
}
return WINED3D_OK;
@@ -2699,7 +2699,7 @@ HRESULT CDECL wined3d_device_set_ps_consts_i(struct wined3d_device *device,
}
else
{
- wined3d_cs_push_constants(device->cs, WINED3D_PUSH_CONSTANTS_PS_I, start_idx, count, constants);
+ wined3d_cs_emit_push_constants(device->cs, WINED3D_PUSH_CONSTANTS_PS_I, start_idx, count, constants);
}
return WINED3D_OK;
@@ -2745,7 +2745,7 @@ HRESULT CDECL wined3d_device_set_ps_consts_f(struct wined3d_device *device,
memset(&device->recording->changed.ps_consts_f[start_idx], 1,
count * sizeof(*device->recording->changed.ps_consts_f));
else
- wined3d_cs_push_constants(device->cs, WINED3D_PUSH_CONSTANTS_PS_F, start_idx, count, constants);
+ wined3d_cs_emit_push_constants(device->cs, WINED3D_PUSH_CONSTANTS_PS_F, start_idx, count, constants);
return WINED3D_OK;
}
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index d225e85b909..e7437a38023 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -3124,7 +3124,7 @@ struct wined3d_cs_block
{
struct list entry;
UINT pos;
- BYTE data[4000]; /* FIXME? The size is somewhat arbitrary. */
+ BYTE data[0x4000]; /* FIXME? The size is somewhat arbitrary. */
};
struct wined3d_cs_ops
@@ -3132,8 +3132,6 @@ struct wined3d_cs_ops
void *(*require_space)(struct wined3d_cs *cs, size_t size);
void (*submit)(struct wined3d_cs *cs);
void (*submit_and_wait)(struct wined3d_cs *cs);
- void (*push_constants)(struct wined3d_cs *cs, enum wined3d_push_constants p,
- unsigned int start_idx, unsigned int count, const void *constants);
};
struct wined3d_cs
@@ -3173,6 +3171,8 @@ void wined3d_cs_emit_glfinish(struct wined3d_cs *cs) DECLSPEC_HIDDEN;
void wined3d_cs_emit_preload_resource(struct wined3d_cs *cs, struct wined3d_resource *resource) DECLSPEC_HIDDEN;
void wined3d_cs_emit_present(struct wined3d_cs *cs, struct wined3d_swapchain *swapchain,
const RECT *src_rect, const RECT *dst_rect, HWND dst_window_override, DWORD flags) DECLSPEC_HIDDEN;
+void wined3d_cs_emit_push_constants(struct wined3d_cs *cs, enum wined3d_push_constants p,
+ unsigned int start_idx, unsigned int count, const void *constants) DECLSPEC_HIDDEN;
void wined3d_cs_emit_query_issue(struct wined3d_cs *cs, struct wined3d_query *query, DWORD flags) DECLSPEC_HIDDEN;
BOOL wined3d_cs_emit_query_poll(struct wined3d_cs *cs, struct wined3d_query *query, DWORD flags) DECLSPEC_HIDDEN;
void wined3d_cs_emit_reset_state(struct wined3d_cs *cs) DECLSPEC_HIDDEN;
@@ -3226,12 +3226,6 @@ HRESULT wined3d_cs_map(struct wined3d_cs *cs, struct wined3d_resource *resource,
HRESULT wined3d_cs_unmap(struct wined3d_cs *cs, struct wined3d_resource *resource,
unsigned int sub_resource_idx) DECLSPEC_HIDDEN;
-static inline void wined3d_cs_push_constants(struct wined3d_cs *cs, enum wined3d_push_constants p,
- unsigned int start_idx, unsigned int count, const void *constants)
-{
- cs->ops->push_constants(cs, p, start_idx, count, constants);
-}
-
/* TODO: Add tests and support for FLOAT16_4 POSITIONT, D3DCOLOR position, other
* fixed function semantics as D3DCOLOR or FLOAT16 */
enum wined3d_buffer_conversion_type
--
2.11.0

View File

@@ -1,124 +0,0 @@
From c563899de22cc9420394ffb433e5541110025c50 Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Tue, 15 Nov 2016 22:07:56 +0100
Subject: Revert "wined3d: Introduce
wined3d_rendertarget_view_get_drawable_size() as replacement for
surface_get_drawable_size()."
This reverts commit 5cdb8f2486cf00a61c1aac20daef8c7cac0d8312.
---
dlls/wined3d/device.c | 5 ++---
dlls/wined3d/state.c | 6 +++---
dlls/wined3d/view.c | 17 +++--------------
dlls/wined3d/wined3d_private.h | 5 ++---
4 files changed, 10 insertions(+), 23 deletions(-)
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index e55372065ad..bb3a5f8da6f 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -291,8 +291,7 @@ void device_clear_render_targets(struct wined3d_device *device, UINT rt_count, c
UINT rect_count, const RECT *clear_rect, const RECT *draw_rect, DWORD flags, const struct wined3d_color *color,
float depth, DWORD stencil)
{
- struct wined3d_rendertarget_view *rtv = rt_count ? fb->render_targets[0] : NULL;
- struct wined3d_surface *target = rtv ? wined3d_rendertarget_view_get_surface(rtv) : NULL;
+ struct wined3d_surface *target = rt_count ? wined3d_rendertarget_view_get_surface(fb->render_targets[0]) : 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;
@@ -340,7 +339,7 @@ void device_clear_render_targets(struct wined3d_device *device, UINT rt_count, c
if (target)
{
render_offscreen = context->render_offscreen;
- wined3d_rendertarget_view_get_drawable_size(rtv, context, &drawable_width, &drawable_height);
+ surface_get_drawable_size(target, context, &drawable_width, &drawable_height);
}
else
{
diff --git a/dlls/wined3d/state.c b/dlls/wined3d/state.c
index 283e49760ee..f92aa8ff692 100644
--- a/dlls/wined3d/state.c
+++ b/dlls/wined3d/state.c
@@ -4637,7 +4637,7 @@ static void viewport_miscpart(struct wined3d_context *context, const struct wine
if (vp.height > target->height)
vp.height = target->height;
- wined3d_rendertarget_view_get_drawable_size(target, context, &width, &height);
+ surface_get_drawable_size(wined3d_rendertarget_view_get_surface(target), context, &width, &height);
}
else if (depth_stencil)
{
@@ -4679,7 +4679,7 @@ static void viewport_miscpart_cc(struct wined3d_context *context,
if (vp.height > target->height)
vp.height = target->height;
- wined3d_rendertarget_view_get_drawable_size(target, context, &width, &height);
+ surface_get_drawable_size(wined3d_rendertarget_view_get_surface(target), context, &width, &height);
}
else if (depth_stencil)
{
@@ -4864,7 +4864,7 @@ static void scissorrect(struct wined3d_context *context, const struct wined3d_st
UINT height;
UINT width;
- wined3d_rendertarget_view_get_drawable_size(target, context, &width, &height);
+ surface_get_drawable_size(wined3d_rendertarget_view_get_surface(target), context, &width, &height);
gl_info->gl_ops.gl.p_glScissor(r->left, height - r->bottom, r->right - r->left, r->bottom - r->top);
}
checkGLcall("glScissor");
diff --git a/dlls/wined3d/view.c b/dlls/wined3d/view.c
index 609f8f7365e..a0a46208343 100644
--- a/dlls/wined3d/view.c
+++ b/dlls/wined3d/view.c
@@ -195,21 +195,10 @@ struct wined3d_resource * CDECL wined3d_rendertarget_view_get_resource(const str
return view->resource;
}
-void wined3d_rendertarget_view_get_drawable_size(const struct wined3d_rendertarget_view *view,
- const struct wined3d_context *context, unsigned int *width, unsigned int *height)
+void surface_get_drawable_size(const struct wined3d_surface *surface, const struct wined3d_context *context,
+ unsigned int *width, unsigned int *height)
{
- const struct wined3d_texture *texture;
-
- if (view->resource->type != WINED3D_RTYPE_TEXTURE_2D)
- {
- FIXME("Not implemented for %s resources.\n", debug_d3dresourcetype(view->resource->type));
- *width = 0;
- *height = 0;
- return;
- }
-
- texture = texture_from_resource(view->resource);
- if (texture->swapchain)
+ if (surface->container->swapchain)
{
/* The drawable size of an onscreen drawable is the surface size.
* (Actually: The window size, but the surface is created in window
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 690f22c9dd0..45b1ea84dd6 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -2984,6 +2984,8 @@ HRESULT surface_color_fill(struct wined3d_surface *s,
const RECT *rect, const struct wined3d_color *color) DECLSPEC_HIDDEN;
HRESULT wined3d_surface_create_dc(struct wined3d_surface *surface) DECLSPEC_HIDDEN;
void wined3d_surface_destroy_dc(struct wined3d_surface *surface) DECLSPEC_HIDDEN;
+void surface_get_drawable_size(const struct wined3d_surface *surface, const struct wined3d_context *context,
+ unsigned int *width, unsigned int *height) DECLSPEC_HIDDEN;
void surface_load_fb_texture(struct wined3d_surface *surface, BOOL srgb,
struct wined3d_context *context) DECLSPEC_HIDDEN;
HRESULT surface_load_location(struct wined3d_surface *surface,
@@ -3299,9 +3301,6 @@ static inline struct wined3d_surface *wined3d_rendertarget_view_get_surface(
return texture->sub_resources[view->sub_resource_idx].u.surface;
}
-void wined3d_rendertarget_view_get_drawable_size(const struct wined3d_rendertarget_view *view,
- const struct wined3d_context *context, unsigned int *width, unsigned int *height) DECLSPEC_HIDDEN;
-
struct wined3d_gl_view
{
GLenum target;
--
2.11.0

View File

@@ -1,28 +1,28 @@
From eea4abcc9b804a74839b49364f0218402d2a6f8e Mon Sep 17 00:00:00 2001
From c17d78b9e0ee2ea345d74cfc1bb5b76c97ea4623 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 | 91 ++++++++++++++++++++++++++++++++++--------
dlls/wined3d/device.c | 3 ++
dlls/wined3d/wined3d_private.h | 4 +-
3 files changed, 81 insertions(+), 17 deletions(-)
dlls/wined3d/cs.c | 78 ++++++++++++++++++++++++++++--------------
dlls/wined3d/device.c | 4 +++
dlls/wined3d/wined3d_private.h | 4 ++-
3 files changed, 60 insertions(+), 26 deletions(-)
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
index 2aef776..be77b79 100644
index b832b7e0733..e9d238d262f 100644
--- a/dlls/wined3d/cs.c
+++ b/dlls/wined3d/cs.c
@@ -68,6 +68,7 @@ enum wined3d_cs_op
WINED3D_CS_OP_QUERY_ISSUE,
WINED3D_CS_OP_PRELOAD_RESOURCE,
WINED3D_CS_OP_UNLOAD_RESOURCE,
@@ -76,6 +76,7 @@ enum wined3d_cs_op
WINED3D_CS_OP_UNMAP,
WINED3D_CS_OP_GLFINISH,
WINED3D_CS_OP_PUSH_CONSTANTS,
+ WINED3D_CS_OP_STATEBLOCK,
WINED3D_CS_OP_STOP,
};
@@ -312,6 +313,12 @@ struct wined3d_cs_unload_resource
struct wined3d_resource *resource;
@@ -376,6 +377,12 @@ struct wined3d_cs_push_constants
BYTE constants[1];
};
+struct wined3d_cs_stateblock
@@ -31,10 +31,10 @@ index 2aef776..be77b79 100644
+ struct wined3d_state state;
+};
+
/* FIXME: The list synchronization probably isn't particularly fast. */
static void wined3d_cs_list_enqueue(struct wined3d_cs_list *list, struct wined3d_cs_block *block)
{
@@ -492,7 +499,7 @@ static UINT wined3d_cs_exec_clear(struct wined3d_cs *cs, const void *data)
static inline BOOL wined3d_cs_process_block(struct wined3d_cs *cs, struct wined3d_cs_block *block);
static void wined3d_cs_mt_submit(struct wined3d_cs *cs);
@@ -522,7 +529,7 @@ static UINT wined3d_cs_exec_clear(struct wined3d_cs *cs, const void *data)
size_t size = FIELD_OFFSET(struct wined3d_cs_clear, rects[op->rect_count]);
device = cs->device;
@@ -42,41 +42,38 @@ index 2aef776..be77b79 100644
+ state = &cs->state;
wined3d_get_draw_rect(state, &draw_rect);
device_clear_render_targets(device, device->adapter->gl_info.limits.buffers,
&cs->state.fb, op->rect_count, op->rects, &draw_rect, op->flags,
@@ -544,7 +551,7 @@ void wined3d_cs_emit_clear(struct wined3d_cs *cs, DWORD rect_count, const RECT *
&device->fb, op->rect_count, op->rects, &draw_rect, op->flags,
@@ -642,10 +649,10 @@ static UINT wined3d_cs_exec_dispatch(struct wined3d_cs *cs, const void *data)
{
const struct wined3d_cs_dispatch *op = data;
- dispatch_compute(cs->device, &cs->device->state,
+ dispatch_compute(cs->device, &cs->state,
op->group_count_x, op->group_count_y, op->group_count_z);
- release_shader_resources(&cs->device->state, 1u << WINED3D_SHADER_TYPE_COMPUTE);
+ release_shader_resources(&cs->state, 1u << WINED3D_SHADER_TYPE_COMPUTE);
return sizeof(*op);
}
@@ -668,7 +675,7 @@ void wined3d_cs_emit_dispatch(struct wined3d_cs *cs,
static UINT wined3d_cs_exec_draw(struct wined3d_cs *cs, const void *data)
{
- struct wined3d_state *state = &cs->device->state;
+ struct wined3d_state *state = &cs->state;
struct wined3d_shader_sampler_map_entry *entry;
struct wined3d_shader_resource_view *view;
const struct wined3d_cs_draw *op = data;
@@ -1081,6 +1088,55 @@ void wined3d_cs_emit_set_texture(struct wined3d_cs *cs, UINT stage, struct wined
op->opcode = WINED3D_CS_OP_SET_TEXTURE;
op->stage = stage;
op->texture = texture;
+ cs->ops->submit(cs);
+}
+
struct wined3d_shader *shader;
unsigned int i;
@@ -1189,6 +1196,34 @@ void wined3d_cs_emit_set_texture(struct wined3d_cs *cs, UINT stage, struct wined
cs->ops->submit(cs);
}
+static UINT wined3d_cs_exec_transfer_stateblock(struct wined3d_cs *cs, const void *data)
+{
+ const struct wined3d_cs_stateblock *op = data;
+
+ /* Don't memcpy the entire struct, we'll remove single items as we add dedicated
+ * ops for setting states */
+
+ cs->state.base_vertex_index = op->state.base_vertex_index;
+ cs->state.gl_primitive_type = op->state.gl_primitive_type;
+
+ memcpy(cs->state.vs_consts_b, op->state.vs_consts_b, sizeof(cs->state.vs_consts_b));
+ memcpy(cs->state.vs_consts_i, op->state.vs_consts_i, sizeof(cs->state.vs_consts_i));
+ memcpy(cs->state.vs_consts_f, op->state.vs_consts_f, sizeof(cs->state.vs_consts_f));
+
+ memcpy(cs->state.ps_consts_b, op->state.ps_consts_b, sizeof(cs->state.ps_consts_b));
+ memcpy(cs->state.ps_consts_i, op->state.ps_consts_i, sizeof(cs->state.ps_consts_i));
+ memcpy(cs->state.ps_consts_f, op->state.ps_consts_f, sizeof(cs->state.ps_consts_f));
+
+ memcpy(cs->state.lights, op->state.lights, sizeof(cs->state.lights));
+
+ return sizeof(*op);
@@ -91,63 +88,51 @@ index 2aef776..be77b79 100644
+
+ /* Don't memcpy the entire struct, we'll remove single items as we add dedicated
+ * ops for setting states */
+ op->state.base_vertex_index = state->base_vertex_index;
+ op->state.gl_primitive_type = state->gl_primitive_type;
+
+ memcpy(op->state.vs_consts_b, state->vs_consts_b, sizeof(op->state.vs_consts_b));
+ memcpy(op->state.vs_consts_i, state->vs_consts_i, sizeof(op->state.vs_consts_i));
+ memcpy(op->state.vs_consts_f, state->vs_consts_f, sizeof(op->state.vs_consts_f));
+
+ memcpy(op->state.ps_consts_b, state->ps_consts_b, sizeof(op->state.ps_consts_b));
+ memcpy(op->state.ps_consts_i, state->ps_consts_i, sizeof(op->state.ps_consts_i));
+ memcpy(op->state.ps_consts_f, state->ps_consts_f, sizeof(op->state.ps_consts_f));
+
+ /* FIXME: This is not ideal. CS is still running synchronously, so this is ok.
+ * It will go away soon anyway. */
+ memcpy(op->state.lights, state->lights, sizeof(op->state.lights));
cs->ops->submit(cs);
}
@@ -1549,6 +1605,7 @@ static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void
/* WINED3D_CS_OP_QUERY_ISSUE */ wined3d_cs_exec_query_issue,
/* WINED3D_CS_OP_PRELOAD_RESOURCE */ wined3d_cs_exec_preload_resource,
/* WINED3D_CS_OP_UNLOAD_RESOURCE */ wined3d_cs_exec_unload_resource,
+
+ cs->ops->submit(cs);
+}
+
static UINT wined3d_cs_exec_set_shader_resource_view(struct wined3d_cs *cs, const void *data)
{
const struct wined3d_cs_set_shader_resource_view *op = data;
@@ -1854,6 +1889,7 @@ static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void
/* WINED3D_CS_OP_UNMAP */ wined3d_cs_exec_unmap,
/* WINED3D_CS_OP_GLFINISH */ wined3d_cs_exec_glfinish,
/* WINED3D_CS_OP_PUSH_CONSTANTS */ wined3d_cs_exec_push_constants,
+ /* WINED3D_CS_OP_STATEBLOCK */ wined3d_cs_exec_transfer_stateblock,
};
static void *wined3d_cs_st_require_space(struct wined3d_cs *cs, size_t size)
@@ -1638,7 +1695,7 @@ done:
struct wined3d_cs *wined3d_cs_create(struct wined3d_device *device)
{
const struct wined3d_gl_info *gl_info = &device->adapter->gl_info;
- struct wined3d_cs *cs;
+ struct wined3d_cs *cs = NULL;
@@ -1998,6 +2034,7 @@ struct wined3d_cs *wined3d_cs_create(struct wined3d_device *device)
if (!(cs = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*cs))))
return NULL;
@@ -1646,8 +1703,7 @@ struct wined3d_cs *wined3d_cs_create(struct wined3d_device *device)
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;
+ goto err;
}
+ cs->tls_idx = TLS_OUT_OF_INDEXES;
if (!(cs->fb.render_targets = wined3d_calloc(gl_info->limits.buffers, sizeof(*cs->fb.render_targets))))
{
@@ -2013,21 +2050,12 @@ struct wined3d_cs *wined3d_cs_create(struct wined3d_device *device)
cs->ops = &wined3d_cs_st_ops;
@@ -1656,17 +1712,13 @@ struct wined3d_cs *wined3d_cs_create(struct wined3d_device *device)
cs->data_size = WINED3D_INITIAL_CS_SIZE;
if (!(cs->data = HeapAlloc(GetProcessHeap(), 0, cs->data_size)))
{
- {
- state_cleanup(&cs->state);
- HeapFree(GetProcessHeap(), 0, cs->fb.render_targets);
- HeapFree(GetProcessHeap(), 0, cs);
- return NULL;
- }
+ goto err;
}
if ((cs->tls_idx = TlsAlloc()) == TLS_OUT_OF_INDEXES)
{
ERR("Failed to allocate cs TLS index, err %#x.\n", GetLastError());
- state_cleanup(&cs->state);
- HeapFree(GetProcessHeap(), 0, cs->fb.render_targets);
- HeapFree(GetProcessHeap(), 0, cs->data);
- HeapFree(GetProcessHeap(), 0, cs);
- return NULL;
@@ -155,12 +140,14 @@ index 2aef776..be77b79 100644
}
if (wined3d_settings.cs_multithreaded)
@@ -1679,15 +1731,22 @@ struct wined3d_cs *wined3d_cs_create(struct wined3d_device *device)
if (!(cs->thread = CreateThread(NULL, 0, wined3d_cs_run, cs, 0, NULL)))
@@ -2040,17 +2068,19 @@ struct wined3d_cs *wined3d_cs_create(struct wined3d_device *device)
if (!(cs->thread = CreateThread(NULL, 0, wined3d_cs_run, cs, 0, &cs->thread_id)))
{
ERR("Failed to create wined3d command stream thread.\n");
- if (!TlsFree(cs->tls_idx))
- ERR("Failed to free cs TLS index, err %#x.\n", GetLastError());
- state_cleanup(&cs->state);
- HeapFree(GetProcessHeap(), 0, cs->fb.render_targets);
- HeapFree(GetProcessHeap(), 0, cs->data);
- HeapFree(GetProcessHeap(), 0, cs);
- return NULL;
@@ -171,23 +158,31 @@ index 2aef776..be77b79 100644
return cs;
+
+err:
+ if (cs)
+ {
+ state_cleanup(&cs->state);
+ if (cs->tls_idx != TLS_OUT_OF_INDEXES && !TlsFree(cs->tls_idx))
+ ERR("Failed to free cs TLS index, err %#x.\n", GetLastError());
+ HeapFree(GetProcessHeap(), 0, cs->data);
+ }
+ state_cleanup(&cs->state);
+ if (cs->tls_idx != TLS_OUT_OF_INDEXES) TlsFree(cs->tls_idx);
+ HeapFree(GetProcessHeap(), 0, cs->fb.render_targets);
+ HeapFree(GetProcessHeap(), 0, cs->data);
+ HeapFree(GetProcessHeap(), 0, cs);
+ return NULL;
}
void wined3d_cs_destroy(struct wined3d_cs *cs)
@@ -2075,9 +2105,7 @@ void wined3d_cs_destroy(struct wined3d_cs *cs)
#endif
}
- if (!TlsFree(cs->tls_idx))
- ERR("Failed to free cs TLS index, err %#x.\n", GetLastError());
-
+ TlsFree(cs->tls_idx);
HeapFree(GetProcessHeap(), 0, cs->fb.render_targets);
HeapFree(GetProcessHeap(), 0, cs->data);
HeapFree(GetProcessHeap(), 0, cs);
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index ae8bfad..dda5a03 100644
index 831f36c9870..268d1e93857 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -3554,6 +3554,7 @@ HRESULT CDECL wined3d_device_draw_primitive(struct wined3d_device *device, UINT
@@ -3648,6 +3648,7 @@ HRESULT CDECL wined3d_device_draw_primitive(struct wined3d_device *device, UINT
{
TRACE("device %p, start_vertex %u, vertex_count %u.\n", device, start_vertex, vertex_count);
@@ -195,7 +190,15 @@ index ae8bfad..dda5a03 100644
wined3d_cs_emit_draw(device->cs, 0, start_vertex, vertex_count, 0, 0, FALSE);
return WINED3D_OK;
@@ -3582,6 +3583,7 @@ HRESULT CDECL wined3d_device_draw_indexed_primitive(struct wined3d_device *devic
@@ -3659,6 +3660,7 @@ void CDECL wined3d_device_draw_primitive_instanced(struct wined3d_device *device
TRACE("device %p, start_vertex %u, vertex_count %u, start_instance %u, instance_count %u.\n",
device, start_vertex, vertex_count, start_instance, instance_count);
+ wined3d_cs_emit_transfer_stateblock(device->cs, &device->state);
wined3d_cs_emit_draw(device->cs, 0, start_vertex, vertex_count, start_instance, instance_count, FALSE);
}
@@ -3676,6 +3678,7 @@ HRESULT CDECL wined3d_device_draw_indexed_primitive(struct wined3d_device *devic
return WINED3DERR_INVALIDCALL;
}
@@ -203,7 +206,7 @@ index ae8bfad..dda5a03 100644
wined3d_cs_emit_draw(device->cs, device->state.base_vertex_index, start_idx, index_count, 0, 0, TRUE);
return WINED3D_OK;
@@ -3593,6 +3595,7 @@ void CDECL wined3d_device_draw_indexed_primitive_instanced(struct wined3d_device
@@ -3687,6 +3690,7 @@ void CDECL wined3d_device_draw_indexed_primitive_instanced(struct wined3d_device
TRACE("device %p, start_idx %u, index_count %u, start_instance %u, instance_count %u.\n",
device, start_idx, index_count, start_instance, instance_count);
@@ -212,19 +215,19 @@ index ae8bfad..dda5a03 100644
start_idx, index_count, start_instance, instance_count, TRUE);
}
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 3af4f8f..2a45171 100644
index e7437a38023..0085339d6a8 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -3043,7 +3043,7 @@ struct wined3d_cs_block
@@ -3124,7 +3124,7 @@ struct wined3d_cs_block
{
struct list entry;
UINT pos;
- BYTE data[4000]; /* FIXME? The size is somewhat arbitrary. */
- BYTE data[0x4000]; /* FIXME? The size is somewhat arbitrary. */
+ BYTE data[sizeof(struct wined3d_state) * 2]; /* FIXME? The size is somewhat arbitrary. */
};
struct wined3d_cs_ops
@@ -3088,6 +3088,8 @@ void wined3d_cs_emit_set_color_key(struct wined3d_cs *cs, struct wined3d_texture
@@ -3182,6 +3182,8 @@ void wined3d_cs_emit_set_color_key(struct wined3d_cs *cs, struct wined3d_texture
WORD flags, const struct wined3d_color_key *color_key) DECLSPEC_HIDDEN;
void wined3d_cs_emit_set_constant_buffer(struct wined3d_cs *cs, enum wined3d_shader_type type,
UINT cb_idx, struct wined3d_buffer *buffer) DECLSPEC_HIDDEN;
@@ -234,5 +237,5 @@ index 3af4f8f..2a45171 100644
struct wined3d_rendertarget_view *view) DECLSPEC_HIDDEN;
void wined3d_cs_emit_set_index_buffer(struct wined3d_cs *cs, struct wined3d_buffer *buffer,
--
2.9.0
2.11.0

View File

@@ -1,102 +0,0 @@
From 3d5e571fff02e6e1ca260c00025864230e9a058f Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Tue, 15 Nov 2016 22:08:06 +0100
Subject: Revert "wined3d: Move surface_get_drawable_size() to view.c file."
This reverts commit 4beb9e5922301b76c16f6ea885bc1cb604f9eb91.
---
dlls/wined3d/surface.c | 33 +++++++++++++++++++++++++++++++++
dlls/wined3d/view.c | 33 ---------------------------------
2 files changed, 33 insertions(+), 33 deletions(-)
diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
index 3fb3394..630d463 100644
--- a/dlls/wined3d/surface.c
+++ b/dlls/wined3d/surface.c
@@ -36,6 +36,39 @@ WINE_DECLARE_DEBUG_CHANNEL(d3d_perf);
static const DWORD surface_simple_locations = WINED3D_LOCATION_SYSMEM
| WINED3D_LOCATION_USER_MEMORY | WINED3D_LOCATION_BUFFER;
+void surface_get_drawable_size(const struct wined3d_surface *surface, const struct wined3d_context *context,
+ unsigned int *width, unsigned int *height)
+{
+ if (surface->container->swapchain)
+ {
+ /* The drawable size of an onscreen drawable is the surface size.
+ * (Actually: The window size, but the surface is created in window
+ * size.) */
+ *width = context->current_rt.texture->resource.width;
+ *height = context->current_rt.texture->resource.height;
+ }
+ else if (wined3d_settings.offscreen_rendering_mode == ORM_BACKBUFFER)
+ {
+ const struct wined3d_swapchain *swapchain = context->swapchain;
+
+ /* The drawable size of a backbuffer / aux buffer offscreen target is
+ * the size of the current context's drawable, which is the size of
+ * the back buffer of the swapchain the active context belongs to. */
+ *width = swapchain->desc.backbuffer_width;
+ *height = swapchain->desc.backbuffer_height;
+ }
+ else
+ {
+ struct wined3d_surface *rt;
+
+ /* The drawable size of an FBO target is the OpenGL texture size,
+ * which is the power of two size. */
+ rt = context->current_rt.texture->sub_resources[context->current_rt.sub_resource_idx].u.surface;
+ *width = wined3d_texture_get_level_pow2_width(rt->container, rt->texture_level);
+ *height = wined3d_texture_get_level_pow2_height(rt->container, rt->texture_level);
+ }
+}
+
struct blt_info
{
GLenum binding;
diff --git a/dlls/wined3d/view.c b/dlls/wined3d/view.c
index cfd2ce1..95f7453 100644
--- a/dlls/wined3d/view.c
+++ b/dlls/wined3d/view.c
@@ -195,39 +195,6 @@ struct wined3d_resource * CDECL wined3d_rendertarget_view_get_resource(const str
return view->resource;
}
-void surface_get_drawable_size(const struct wined3d_surface *surface, const struct wined3d_context *context,
- unsigned int *width, unsigned int *height)
-{
- if (surface->container->swapchain)
- {
- /* The drawable size of an onscreen drawable is the surface size.
- * (Actually: The window size, but the surface is created in window
- * size.) */
- *width = context->current_rt.texture->resource.width;
- *height = context->current_rt.texture->resource.height;
- }
- else if (wined3d_settings.offscreen_rendering_mode == ORM_BACKBUFFER)
- {
- const struct wined3d_swapchain *swapchain = context->swapchain;
-
- /* The drawable size of a backbuffer / aux buffer offscreen target is
- * the size of the current context's drawable, which is the size of
- * the back buffer of the swapchain the active context belongs to. */
- *width = swapchain->desc.backbuffer_width;
- *height = swapchain->desc.backbuffer_height;
- }
- else
- {
- struct wined3d_surface *rt;
-
- /* The drawable size of an FBO target is the OpenGL texture size,
- * which is the power of two size. */
- rt = context->current_rt.texture->sub_resources[context->current_rt.sub_resource_idx].u.surface;
- *width = wined3d_texture_get_level_pow2_width(rt->container, rt->texture_level);
- *height = wined3d_texture_get_level_pow2_height(rt->container, rt->texture_level);
- }
-}
-
static HRESULT wined3d_rendertarget_view_init(struct wined3d_rendertarget_view *view,
const struct wined3d_view_desc *desc, struct wined3d_resource *resource,
void *parent, const struct wined3d_parent_ops *parent_ops)
--
2.9.0

View File

@@ -1,29 +1,29 @@
From e5be3dd2d9e963f7f447fb379a2739a2f5428ccb Mon Sep 17 00:00:00 2001
From 54250a452e83961539ea9adecd5bee1f525feb94 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20D=C3=B6singer?= <stefan@codeweavers.com>
Date: Sun, 7 Apr 2013 17:53:43 +0200
Subject: wined3d: Send primitive type updates through the command stream
---
dlls/wined3d/cs.c | 39 ++++++++++++++++++++++++++++++++++-----
dlls/wined3d/device.c | 5 ++---
dlls/wined3d/device.c | 4 ++--
dlls/wined3d/stateblock.c | 4 ++--
dlls/wined3d/wined3d_private.h | 2 ++
4 files changed, 40 insertions(+), 10 deletions(-)
4 files changed, 40 insertions(+), 9 deletions(-)
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
index 5424965..d467911 100644
index e9d238d262f..c6b7aa71ecd 100644
--- a/dlls/wined3d/cs.c
+++ b/dlls/wined3d/cs.c
@@ -72,6 +72,7 @@ enum wined3d_cs_op
WINED3D_CS_OP_SET_PS_CONSTS_F,
@@ -77,6 +77,7 @@ enum wined3d_cs_op
WINED3D_CS_OP_GLFINISH,
WINED3D_CS_OP_SET_BASE_VERTEX_INDEX,
WINED3D_CS_OP_PUSH_CONSTANTS,
WINED3D_CS_OP_STATEBLOCK,
+ WINED3D_CS_OP_SET_PRIMITIVE_TYPE,
WINED3D_CS_OP_STOP,
};
@@ -335,6 +336,12 @@ struct wined3d_cs_set_base_vertex_index
UINT base_vertex_index;
@@ -383,6 +384,12 @@ struct wined3d_cs_stateblock
struct wined3d_state state;
};
+struct wined3d_cs_set_primitive_type
@@ -32,29 +32,29 @@ index 5424965..d467911 100644
+ GLenum gl_primitive_type;
+};
+
/* FIXME: The list synchronization probably isn't particularly fast. */
static void wined3d_cs_list_enqueue(struct wined3d_cs_list *list, struct wined3d_cs_block *block)
static inline BOOL wined3d_cs_process_block(struct wined3d_cs *cs, struct wined3d_cs_block *block);
static void wined3d_cs_mt_submit(struct wined3d_cs *cs);
@@ -1200,7 +1207,6 @@ static UINT wined3d_cs_exec_transfer_stateblock(struct wined3d_cs *cs, const voi
{
@@ -1129,9 +1136,6 @@ static UINT wined3d_cs_exec_transfer_stateblock(struct wined3d_cs *cs, const voi
const struct wined3d_cs_stateblock *op = data;
/* Don't memcpy the entire struct, we'll remove single items as we add dedicated
* ops for setting states */
-
- cs->state.gl_primitive_type = op->state.gl_primitive_type;
-
memcpy(cs->state.vs_consts_b, op->state.vs_consts_b, sizeof(cs->state.vs_consts_b));
memcpy(cs->state.vs_consts_i, op->state.vs_consts_i, sizeof(cs->state.vs_consts_i));
memcpy(cs->state.lights, op->state.lights, sizeof(cs->state.lights));
@@ -1152,8 +1156,6 @@ void wined3d_cs_emit_transfer_stateblock(struct wined3d_cs *cs, const struct win
return sizeof(*op);
@@ -1213,10 +1219,6 @@ void wined3d_cs_emit_transfer_stateblock(struct wined3d_cs *cs, const struct win
op = cs->ops->require_space(cs, sizeof(*op));
op->opcode = WINED3D_CS_OP_STATEBLOCK;
/* Don't memcpy the entire struct, we'll remove single items as we add dedicated
* ops for setting states */
- /* Don't memcpy the entire struct, we'll remove single items as we add dedicated
- * ops for setting states */
- op->state.gl_primitive_type = state->gl_primitive_type;
-
memcpy(op->state.vs_consts_b, state->vs_consts_b, sizeof(op->state.vs_consts_b));
memcpy(op->state.vs_consts_i, state->vs_consts_i, sizeof(op->state.vs_consts_i));
@@ -1674,6 +1676,32 @@ void wined3d_cs_emit_set_base_vertex_index(struct wined3d_cs *cs,
/* FIXME: This is not ideal. CS is still running synchronously, so this is ok.
* It will go away soon anyway. */
memcpy(op->state.lights, state->lights, sizeof(op->state.lights));
@@ -1848,6 +1850,32 @@ void wined3d_cs_emit_push_constants(struct wined3d_cs *cs, enum wined3d_push_con
cs->ops->submit(cs);
}
@@ -87,27 +87,19 @@ index 5424965..d467911 100644
static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void *data) =
{
/* WINED3D_CS_OP_FENCE */ wined3d_cs_exec_fence,
@@ -1712,6 +1740,7 @@ static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void
/* WINED3D_CS_OP_SET_PS_CONSTS_F */ wined3d_cs_exec_set_ps_consts_f,
@@ -1890,6 +1918,7 @@ static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void
/* WINED3D_CS_OP_GLFINISH */ wined3d_cs_exec_glfinish,
/* WINED3D_CS_OP_SET_BASE_VERTEX_INDEX */ wined3d_cs_exec_set_base_vertex_index,
/* WINED3D_CS_OP_PUSH_CONSTANTS */ wined3d_cs_exec_push_constants,
/* WINED3D_CS_OP_STATEBLOCK */ wined3d_cs_exec_transfer_stateblock,
+ /* WINED3D_CS_OP_SET_PRIMITIVE_TYPE */ wined3d_cs_exec_set_primitive_type,
};
static void *wined3d_cs_st_require_space(struct wined3d_cs *cs, size_t size)
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index 72266fb..7bd3994 100644
index 268d1e93857..e01ef6e3753 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -3520,7 +3520,6 @@ void CDECL wined3d_device_set_primitive_type(struct wined3d_device *device,
enum wined3d_primitive_type primitive_type)
{
GLenum gl_primitive_type, prev;
-
TRACE("device %p, primitive_type %s\n", device, debug_d3dprimitivetype(primitive_type));
gl_primitive_type = gl_primitive_type_from_d3d(primitive_type);
@@ -3528,8 +3527,8 @@ void CDECL wined3d_device_set_primitive_type(struct wined3d_device *device,
@@ -3630,8 +3630,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;
@@ -119,10 +111,10 @@ index 72266fb..7bd3994 100644
void CDECL wined3d_device_get_primitive_type(const struct wined3d_device *device,
diff --git a/dlls/wined3d/stateblock.c b/dlls/wined3d/stateblock.c
index bb3c0cc..732a45b 100644
index fd017524075..ed39a15c7be 100644
--- a/dlls/wined3d/stateblock.c
+++ b/dlls/wined3d/stateblock.c
@@ -1009,8 +1009,8 @@ void CDECL wined3d_stateblock_apply(const struct wined3d_stateblock *stateblock)
@@ -991,8 +991,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;
@@ -134,10 +126,10 @@ index bb3c0cc..732a45b 100644
if (stateblock->changed.indices)
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 0abec70..5648bda 100644
index 0085339d6a8..354f9fe62d0 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -3093,6 +3093,8 @@ void wined3d_cs_emit_set_index_buffer(struct wined3d_cs *cs, struct wined3d_buff
@@ -3191,6 +3191,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;
@@ -147,5 +139,5 @@ index 0abec70..5648bda 100644
struct wined3d_rasterizer_state *rasterizer_state) DECLSPEC_HIDDEN;
void wined3d_cs_emit_set_render_state(struct wined3d_cs *cs,
--
2.9.0
2.11.0

View File

@@ -1,27 +0,0 @@
From b80300afc09521dddf8d025ba5df8243bd044681 Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Tue, 15 Nov 2016 22:08:32 +0100
Subject: Revert "wined3d: Mark buffers as used in wined3d_buffer_copy()."
This reverts commit 20b989ef86de7e36b7ec9feee49b0bfa9f284b43.
---
dlls/wined3d/buffer.c | 3 ---
1 file changed, 3 deletions(-)
diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c
index 564b1fc..202ce32 100644
--- a/dlls/wined3d/buffer.c
+++ b/dlls/wined3d/buffer.c
@@ -1264,9 +1264,6 @@ HRESULT wined3d_buffer_copy(struct wined3d_buffer *dst_buffer, unsigned int dst_
DWORD dst_location;
HRESULT hr;
- buffer_mark_used(dst_buffer);
- buffer_mark_used(src_buffer);
-
device = dst_buffer->resource.device;
context = context_acquire(device, NULL);
--
2.9.0

View File

@@ -1,55 +1,46 @@
From 866ef0e0247fe28814e59268885ce97630750023 Mon Sep 17 00:00:00 2001
From cc805e309ac623c64037c11868ab663b6e830fa5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20D=C3=B6singer?= <stefan@codeweavers.com>
Date: Wed, 10 Apr 2013 17:16:02 +0200
Subject: wined3d: Send light updates through the command stream
---
dlls/wined3d/cs.c | 200 +++++++++++++++++++++++++++++++++--------
dlls/wined3d/device.c | 30 ++-----
dlls/wined3d/wined3d_private.h | 8 +-
3 files changed, 174 insertions(+), 64 deletions(-)
dlls/wined3d/cs.c | 194 +++++++++++++++++++++++++++++++++++------
dlls/wined3d/device.c | 31 ++-----
dlls/wined3d/wined3d_private.h | 6 +-
3 files changed, 174 insertions(+), 57 deletions(-)
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
index 22e9bb8..2f3b33d 100644
index c6b7aa71ecd..727b7d81e9b 100644
--- a/dlls/wined3d/cs.c
+++ b/dlls/wined3d/cs.c
@@ -68,7 +68,6 @@ enum wined3d_cs_op
WINED3D_CS_OP_QUERY_ISSUE,
WINED3D_CS_OP_PRELOAD_RESOURCE,
WINED3D_CS_OP_UNLOAD_RESOURCE,
- WINED3D_CS_OP_STATEBLOCK,
WINED3D_CS_OP_SET_VS_CONSTS_F,
WINED3D_CS_OP_SET_VS_CONSTS_B,
WINED3D_CS_OP_SET_VS_CONSTS_I,
@@ -78,6 +77,8 @@ enum wined3d_cs_op
@@ -76,8 +76,9 @@ enum wined3d_cs_op
WINED3D_CS_OP_UNMAP,
WINED3D_CS_OP_GLFINISH,
WINED3D_CS_OP_SET_BASE_VERTEX_INDEX,
WINED3D_CS_OP_PUSH_CONSTANTS,
- WINED3D_CS_OP_STATEBLOCK,
WINED3D_CS_OP_SET_PRIMITIVE_TYPE,
+ WINED3D_CS_OP_SET_LIGHT,
+ WINED3D_CS_OP_SET_LIGHT_ENABLE,
WINED3D_CS_OP_STOP,
};
@@ -322,12 +323,6 @@ struct wined3d_cs_unload_resource
struct wined3d_resource *resource;
@@ -378,16 +379,23 @@ struct wined3d_cs_push_constants
BYTE constants[1];
};
-struct wined3d_cs_stateblock
-{
- enum wined3d_cs_op opcode;
- struct wined3d_state state;
-};
-
struct wined3d_cs_set_consts_f
+struct wined3d_cs_set_primitive_type
{
enum wined3d_cs_op opcode;
@@ -369,6 +364,19 @@ struct wined3d_cs_set_primitive_type
GLenum gl_primitive_type;
- struct wined3d_state state;
+ GLenum gl_primitive_type;
};
-struct wined3d_cs_set_primitive_type
+struct wined3d_cs_set_light
+{
+ enum wined3d_cs_op opcode;
{
enum wined3d_cs_op opcode;
- GLenum gl_primitive_type;
+ struct wined3d_light_info light;
+};
+
@@ -58,12 +49,10 @@ index 22e9bb8..2f3b33d 100644
+ enum wined3d_cs_op opcode;
+ UINT idx;
+ BOOL enable;
+};
+
/* FIXME: The list synchronization probably isn't particularly fast. */
static void wined3d_cs_list_enqueue(struct wined3d_cs_list *list, struct wined3d_cs_block *block)
{
@@ -1157,35 +1165,6 @@ void wined3d_cs_emit_set_texture(struct wined3d_cs *cs, UINT stage, struct wined
};
static inline BOOL wined3d_cs_process_block(struct wined3d_cs *cs, struct wined3d_cs_block *block);
@@ -1203,29 +1211,6 @@ void wined3d_cs_emit_set_texture(struct wined3d_cs *cs, UINT stage, struct wined
cs->ops->submit(cs);
}
@@ -71,9 +60,6 @@ index 22e9bb8..2f3b33d 100644
-{
- const struct wined3d_cs_stateblock *op = data;
-
- /* Don't memcpy the entire struct, we'll remove single items as we add dedicated
- * ops for setting states */
-
- memcpy(cs->state.lights, op->state.lights, sizeof(cs->state.lights));
-
- return sizeof(*op);
@@ -86,9 +72,6 @@ index 22e9bb8..2f3b33d 100644
- op = cs->ops->require_space(cs, sizeof(*op));
- op->opcode = WINED3D_CS_OP_STATEBLOCK;
-
- /* Don't memcpy the entire struct, we'll remove single items as we add dedicated
- * ops for setting states */
-
- /* FIXME: This is not ideal. CS is still running synchronously, so this is ok.
- * It will go away soon anyway. */
- memcpy(op->state.lights, state->lights, sizeof(op->state.lights));
@@ -99,7 +82,7 @@ index 22e9bb8..2f3b33d 100644
static UINT wined3d_cs_exec_set_shader_resource_view(struct wined3d_cs *cs, const void *data)
{
const struct wined3d_cs_set_shader_resource_view *op = data;
@@ -1860,6 +1839,152 @@ void wined3d_cs_emit_set_primitive_type(struct wined3d_cs *cs, GLenum primitive_
@@ -1876,6 +1861,156 @@ void wined3d_cs_emit_set_primitive_type(struct wined3d_cs *cs, GLenum primitive_
cs->ops->submit(cs);
}
@@ -125,7 +108,10 @@ index 22e9bb8..2f3b33d 100644
+ TRACE("Adding new light\n");
+ object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
+ if (!object)
+ return E_OUTOFMEMORY;
+ {
+ ERR("Out of memory!\n");
+ return sizeof(*op);
+ }
+
+ list_add_head(&cs->state.light_map[hash_idx], &object->entry);
+ object->glIndex = -1;
@@ -208,10 +194,11 @@ index 22e9bb8..2f3b33d 100644
+ }
+ else
+ {
+ unsigned int light_count = device->adapter->d3d_info.limits.active_light_count;
+ unsigned int i;
+ const struct wined3d_gl_info *gl_info = &device->adapter->gl_info;
+
+ /* Find a free GL light. */
+ for (i = 0; i < gl_info->limits.lights; ++i)
+ for (i = 0; i < light_count; ++i)
+ {
+ if (!cs->state.lights[i])
+ {
@@ -252,17 +239,11 @@ index 22e9bb8..2f3b33d 100644
static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void *data) =
{
/* WINED3D_CS_OP_FENCE */ wined3d_cs_exec_fence,
@@ -1894,7 +2019,6 @@ static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void
/* WINED3D_CS_OP_QUERY_ISSUE */ wined3d_cs_exec_query_issue,
/* WINED3D_CS_OP_PRELOAD_RESOURCE */ wined3d_cs_exec_preload_resource,
/* WINED3D_CS_OP_UNLOAD_RESOURCE */ wined3d_cs_exec_unload_resource,
- /* WINED3D_CS_OP_STATEBLOCK */ wined3d_cs_exec_transfer_stateblock,
/* WINED3D_CS_OP_SET_VS_CONSTS_F */ wined3d_cs_exec_set_vs_consts_f,
/* WINED3D_CS_OP_SET_VS_CONSTS_B */ wined3d_cs_exec_set_vs_consts_b,
/* WINED3D_CS_OP_SET_VS_CONSTS_I */ wined3d_cs_exec_set_vs_consts_i,
@@ -1904,6 +2028,8 @@ static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void
@@ -1917,8 +2052,9 @@ static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void
/* WINED3D_CS_OP_UNMAP */ wined3d_cs_exec_unmap,
/* WINED3D_CS_OP_GLFINISH */ wined3d_cs_exec_glfinish,
/* WINED3D_CS_OP_SET_BASE_VERTEX_INDEX */ wined3d_cs_exec_set_base_vertex_index,
/* WINED3D_CS_OP_PUSH_CONSTANTS */ wined3d_cs_exec_push_constants,
- /* WINED3D_CS_OP_STATEBLOCK */ wined3d_cs_exec_transfer_stateblock,
/* WINED3D_CS_OP_SET_PRIMITIVE_TYPE */ wined3d_cs_exec_set_primitive_type,
+ /* WINED3D_CS_OP_SET_LIGHT */ wined3d_cs_exec_set_light,
+ /* WINED3D_CS_OP_SET_LIGHT_ENABLE */ wined3d_cs_exec_set_light_enable,
@@ -270,10 +251,10 @@ index 22e9bb8..2f3b33d 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 9db2365..c7226ae 100644
index e01ef6e3753..d20906e7cc5 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -1610,14 +1610,6 @@ HRESULT CDECL wined3d_device_set_light(struct wined3d_device *device,
@@ -1597,14 +1597,6 @@ HRESULT CDECL wined3d_device_set_light(struct wined3d_device *device,
light->direction.x, light->direction.y, light->direction.z,
light->range, light->falloff, light->theta, light->phi);
@@ -288,7 +269,7 @@ index 9db2365..c7226ae 100644
/* Save away the information. */
object->OriginalParms = *light;
@@ -1697,6 +1689,9 @@ HRESULT CDECL wined3d_device_set_light(struct wined3d_device *device,
@@ -1684,6 +1676,9 @@ HRESULT CDECL wined3d_device_set_light(struct wined3d_device *device,
FIXME("Unrecognized light type %#x.\n", light->type);
}
@@ -298,7 +279,7 @@ index 9db2365..c7226ae 100644
return WINED3D_OK;
}
@@ -1769,12 +1764,6 @@ HRESULT CDECL wined3d_device_set_light_enable(struct wined3d_device *device, UIN
@@ -1756,12 +1751,6 @@ HRESULT CDECL wined3d_device_set_light_enable(struct wined3d_device *device, UIN
{
if (light_info->glIndex != -1)
{
@@ -311,7 +292,7 @@ index 9db2365..c7226ae 100644
device->update_state->lights[light_info->glIndex] = NULL;
light_info->glIndex = -1;
}
@@ -1816,16 +1805,12 @@ HRESULT CDECL wined3d_device_set_light_enable(struct wined3d_device *device, UIN
@@ -1804,16 +1793,12 @@ HRESULT CDECL wined3d_device_set_light_enable(struct wined3d_device *device, UIN
WARN("Too many concurrently active lights\n");
return WINED3D_OK;
}
@@ -331,7 +312,7 @@ index 9db2365..c7226ae 100644
return WINED3D_OK;
}
@@ -3549,7 +3534,6 @@ HRESULT CDECL wined3d_device_draw_primitive(struct wined3d_device *device, UINT
@@ -3648,7 +3633,6 @@ HRESULT CDECL wined3d_device_draw_primitive(struct wined3d_device *device, UINT
{
TRACE("device %p, start_vertex %u, vertex_count %u.\n", device, start_vertex, vertex_count);
@@ -339,7 +320,15 @@ index 9db2365..c7226ae 100644
wined3d_cs_emit_draw(device->cs, 0, start_vertex, vertex_count, 0, 0, FALSE);
return WINED3D_OK;
@@ -3578,7 +3562,6 @@ HRESULT CDECL wined3d_device_draw_indexed_primitive(struct wined3d_device *devic
@@ -3660,7 +3644,6 @@ void CDECL wined3d_device_draw_primitive_instanced(struct wined3d_device *device
TRACE("device %p, start_vertex %u, vertex_count %u, start_instance %u, instance_count %u.\n",
device, start_vertex, vertex_count, start_instance, instance_count);
- wined3d_cs_emit_transfer_stateblock(device->cs, &device->state);
wined3d_cs_emit_draw(device->cs, 0, start_vertex, vertex_count, start_instance, instance_count, FALSE);
}
@@ -3678,7 +3661,6 @@ HRESULT CDECL wined3d_device_draw_indexed_primitive(struct wined3d_device *devic
return WINED3DERR_INVALIDCALL;
}
@@ -347,7 +336,7 @@ index 9db2365..c7226ae 100644
wined3d_cs_emit_draw(device->cs, device->state.base_vertex_index, start_idx, index_count, 0, 0, TRUE);
return WINED3D_OK;
@@ -3590,7 +3573,6 @@ void CDECL wined3d_device_draw_indexed_primitive_instanced(struct wined3d_device
@@ -3690,7 +3672,6 @@ void CDECL wined3d_device_draw_indexed_primitive_instanced(struct wined3d_device
TRACE("device %p, start_idx %u, index_count %u, start_instance %u, instance_count %u.\n",
device, start_idx, index_count, start_instance, instance_count);
@@ -356,24 +345,22 @@ index 9db2365..c7226ae 100644
start_idx, index_count, start_instance, instance_count, TRUE);
}
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index c29a4a1..77d4ac3 100644
index 354f9fe62d0..0164de77eec 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -3039,7 +3039,9 @@ struct wined3d_cs_block
@@ -3124,7 +3124,7 @@ struct wined3d_cs_block
{
struct list entry;
UINT pos;
- BYTE data[sizeof(struct wined3d_state) * 2]; /* FIXME? The size is somewhat arbitrary. */
+ /* FIXME? The size is somewhat arbitrary. It's big enough for huge
+ * shader constant set calls though */
+ BYTE data[sizeof(float) * 4 * 256 * 2];
+ BYTE data[0x4000]; /* FIXME? The size is somewhat arbitrary. */
};
struct wined3d_cs_ops
@@ -3096,12 +3098,12 @@ void wined3d_cs_emit_set_consts_f(struct wined3d_cs *cs, unsigned int start_idx,
unsigned int count, const struct wined3d_vec4 *constants, enum wined3d_shader_type type) DECLSPEC_HIDDEN;
void wined3d_cs_emit_set_consts_i(struct wined3d_cs *cs, unsigned int start_idx,
unsigned int count, const struct wined3d_ivec4 *constants, enum wined3d_shader_type type) DECLSPEC_HIDDEN;
@@ -3182,12 +3182,12 @@ void wined3d_cs_emit_set_color_key(struct wined3d_cs *cs, struct wined3d_texture
WORD flags, const struct wined3d_color_key *color_key) DECLSPEC_HIDDEN;
void wined3d_cs_emit_set_constant_buffer(struct wined3d_cs *cs, enum wined3d_shader_type type,
UINT cb_idx, struct wined3d_buffer *buffer) DECLSPEC_HIDDEN;
-void wined3d_cs_emit_transfer_stateblock(struct wined3d_cs *cs,
- const struct wined3d_state *state) DECLSPEC_HIDDEN;
void wined3d_cs_emit_set_depth_stencil_view(struct wined3d_cs *cs,
@@ -386,5 +373,5 @@ index c29a4a1..77d4ac3 100644
void wined3d_cs_emit_set_predication(struct wined3d_cs *cs,
struct wined3d_query *predicate, BOOL value) DECLSPEC_HIDDEN;
--
2.9.0
2.11.0

View File

@@ -1,54 +0,0 @@
From 01e29442c38eff41c69cc4b99d91d8eee5bcb5ef Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Tue, 15 Nov 2016 22:09:25 +0100
Subject: Revert "wined3d: Use wined3d_vec4 in fixup_transformed_pos()."
This reverts commit 07cfeac3dd7ca41d9d9fde3a490425451c4b26b7.
---
dlls/wined3d/buffer.c | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c
index 202ce32..aed9e26 100644
--- a/dlls/wined3d/buffer.c
+++ b/dlls/wined3d/buffer.c
@@ -509,19 +509,19 @@ static inline unsigned int fixup_d3dcolor(DWORD *dst_color)
return sizeof(*dst_color);
}
-static inline unsigned int fixup_transformed_pos(struct wined3d_vec4 *p)
+static inline unsigned int fixup_transformed_pos(float *p)
{
/* rhw conversion like in position_float4(). */
- if (p->w != 1.0f && p->w != 0.0f)
+ if (p[3] != 1.0f && p[3] != 0.0f)
{
- float w = 1.0f / p->w;
- p->x *= w;
- p->y *= w;
- p->z *= w;
- p->w = w;
+ float w = 1.0f / p[3];
+ p[0] *= w;
+ p[1] *= w;
+ p[2] *= w;
+ p[3] = w;
}
- return sizeof(*p);
+ return 4 * sizeof(*p);
}
ULONG CDECL wined3d_buffer_incref(struct wined3d_buffer *buffer)
@@ -909,7 +909,7 @@ static void buffer_conversion_upload(struct wined3d_buffer *buffer, struct wined
j += fixup_d3dcolor((DWORD *) (data + i * buffer->stride + j));
break;
case CONV_POSITIONT:
- j += fixup_transformed_pos((struct wined3d_vec4 *) (data + i * buffer->stride + j));
+ j += fixup_transformed_pos((float *) (data + i * buffer->stride + j));
break;
default:
FIXME("Unimplemented conversion %d in shifted conversion.\n", buffer->conversion_map[j]);
--
2.9.0

View File

@@ -1,4 +1,4 @@
From 896c9a5cbbf43da7bafda1c00169cb6b67c1a32a Mon Sep 17 00:00:00 2001
From 04a17416b1f76b1b0dc6929c637dca4d995dc991 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20D=C3=B6singer?= <stefan@codeweavers.com>
Date: Thu, 4 Apr 2013 14:52:24 +0200
Subject: wined3d: Pass the depth stencil to swapchain->present
@@ -12,21 +12,21 @@ DS or the implicit DS.
3 files changed, 11 insertions(+), 8 deletions(-)
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
index 095fa0e..cacafec 100644
index 727b7d81e9b..d3dc29cd7c1 100644
--- a/dlls/wined3d/cs.c
+++ b/dlls/wined3d/cs.c
@@ -457,7 +457,8 @@ static UINT wined3d_cs_exec_present(struct wined3d_cs *cs, const void *data)
@@ -500,7 +500,8 @@ static UINT wined3d_cs_exec_present(struct wined3d_cs *cs, const void *data)
swapchain = op->swapchain;
wined3d_swapchain_set_window(swapchain, op->dst_window_override);
- swapchain->swapchain_ops->swapchain_present(swapchain, &op->src_rect, &op->dst_rect, op->flags);
+ swapchain->swapchain_ops->swapchain_present(swapchain, &op->src_rect, &op->dst_rect, op->flags,
+ cs->state.fb.depth_stencil);
+ cs->state.fb->depth_stencil);
wined3d_resource_release(&swapchain->front_buffer->resource);
for (i = 0; i < swapchain->desc.backbuffer_count; ++i)
diff --git a/dlls/wined3d/swapchain.c b/dlls/wined3d/swapchain.c
index 7a3cdd2..dd0f17d 100644
index ae82ff0cf23..932d4076b93 100644
--- a/dlls/wined3d/swapchain.c
+++ b/dlls/wined3d/swapchain.c
@@ -485,10 +485,10 @@ static void wined3d_swapchain_rotate(struct wined3d_swapchain *swapchain, struct
@@ -38,11 +38,11 @@ index 7a3cdd2..dd0f17d 100644
+ struct wined3d_rendertarget_view *depth_stencil)
{
struct wined3d_texture *back_buffer = swapchain->back_buffers[0];
- const struct wined3d_fb_state *fb = &swapchain->device->state.fb;
- const struct wined3d_fb_state *fb = &swapchain->device->fb;
const struct wined3d_gl_info *gl_info;
struct wined3d_texture *logo_texture;
struct wined3d_context *context;
@@ -621,15 +621,15 @@ static void swapchain_gl_present(struct wined3d_swapchain *swapchain,
@@ -619,14 +619,14 @@ static void swapchain_gl_present(struct wined3d_swapchain *swapchain,
wined3d_texture_validate_location(swapchain->back_buffers[swapchain->desc.backbuffer_count - 1],
0, WINED3D_LOCATION_DISCARDED);
@@ -54,14 +54,13 @@ index 7a3cdd2..dd0f17d 100644
if (ds && (swapchain->desc.flags & WINED3D_SWAPCHAIN_DISCARD_DEPTHSTENCIL
|| ds->container->flags & WINED3D_TEXTURE_DISCARD))
{
surface_modify_ds_location(ds, WINED3D_LOCATION_DISCARDED,
- fb->depth_stencil->width, fb->depth_stencil->height);
+ depth_stencil->width, depth_stencil->height);
if (ds == swapchain->device->onscreen_depth_stencil)
{
wined3d_texture_decref(swapchain->device->onscreen_depth_stencil->container);
@@ -701,7 +701,8 @@ static void swapchain_gdi_frontbuffer_updated(struct wined3d_swapchain *swapchai
wined3d_texture_validate_location(ds->container,
- fb->depth_stencil->sub_resource_idx, WINED3D_LOCATION_DISCARDED);
+ depth_stencil->sub_resource_idx, WINED3D_LOCATION_DISCARDED);
}
context_release(context);
@@ -692,7 +692,8 @@ static void swapchain_gdi_frontbuffer_updated(struct wined3d_swapchain *swapchai
}
static void swapchain_gdi_present(struct wined3d_swapchain *swapchain,
@@ -72,10 +71,10 @@ index 7a3cdd2..dd0f17d 100644
struct wined3d_surface *front, *back;
HBITMAP bitmap;
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index f79a792..ed335d1 100644
index 0164de77eec..a098d7e62df 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -3239,7 +3239,8 @@ struct wined3d_unordered_access_view
@@ -3364,7 +3364,8 @@ void wined3d_unordered_access_view_invalidate_location(struct wined3d_unordered_
struct wined3d_swapchain_ops
{
void (*swapchain_present)(struct wined3d_swapchain *swapchain,
@@ -86,5 +85,5 @@ index f79a792..ed335d1 100644
};
--
2.9.0
2.11.0

View File

@@ -1,34 +0,0 @@
From 753504b584ef9c248fe9165cd07ec89b8ab401c2 Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Tue, 15 Nov 2016 22:09:45 +0100
Subject: Revert "wined3d: Invalidate STATE_CONSTANT_BUFFER(*) device state in
buffer_destroy_buffer_object() when needed."
This reverts commit de19ba7c23b3fd3c80ce7221bdb3ce138b3d4400.
---
dlls/wined3d/buffer.c | 9 ---------
1 file changed, 9 deletions(-)
diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c
index aed9e26..6e6d189 100644
--- a/dlls/wined3d/buffer.c
+++ b/dlls/wined3d/buffer.c
@@ -162,15 +162,6 @@ static void buffer_destroy_buffer_object(struct wined3d_buffer *buffer, const st
device_invalidate_state(resource->device, STATE_STREAMSRC);
if (buffer->bind_flags & WINED3D_BIND_INDEX_BUFFER)
device_invalidate_state(resource->device, STATE_INDEXBUFFER);
- if (buffer->bind_flags & WINED3D_BIND_CONSTANT_BUFFER)
- {
- device_invalidate_state(resource->device, STATE_CONSTANT_BUFFER(WINED3D_SHADER_TYPE_VERTEX));
- device_invalidate_state(resource->device, STATE_CONSTANT_BUFFER(WINED3D_SHADER_TYPE_HULL));
- device_invalidate_state(resource->device, STATE_CONSTANT_BUFFER(WINED3D_SHADER_TYPE_DOMAIN));
- device_invalidate_state(resource->device, STATE_CONSTANT_BUFFER(WINED3D_SHADER_TYPE_GEOMETRY));
- device_invalidate_state(resource->device, STATE_CONSTANT_BUFFER(WINED3D_SHADER_TYPE_PIXEL));
- device_invalidate_state(resource->device, STATE_CONSTANT_BUFFER(WINED3D_SHADER_TYPE_COMPUTE));
- }
}
if (buffer->query)
--
2.9.0

View File

@@ -1,4 +1,4 @@
From db37e592d76e30834d83029cdfdec6f42a322086 Mon Sep 17 00:00:00 2001
From fa711d72c0f46697e7faecfb5ad128d19254d767 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20D=C3=B6singer?= <stefan@codeweavers.com>
Date: Wed, 10 Apr 2013 19:10:41 +0200
Subject: wined3d: Prevent the command stream from running ahead too far
@@ -9,19 +9,19 @@ Subject: wined3d: Prevent the command stream from running ahead too far
2 files changed, 18 insertions(+)
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
index d03dd1c..7311ac5 100644
index d3dc29cd7c1..e738c6ff058 100644
--- a/dlls/wined3d/cs.c
+++ b/dlls/wined3d/cs.c
@@ -509,6 +509,8 @@ static UINT wined3d_cs_exec_present(struct wined3d_cs *cs, const void *data)
@@ -503,6 +503,8 @@ static UINT wined3d_cs_exec_present(struct wined3d_cs *cs, const void *data)
swapchain->swapchain_ops->swapchain_present(swapchain, &op->src_rect, &op->dst_rect, op->flags,
cs->state.fb.depth_stencil);
cs->state.fb->depth_stencil);
+ InterlockedDecrement(&cs->pending_presents);
+
wined3d_resource_release(&swapchain->front_buffer->resource);
for (i = 0; i < swapchain->desc.backbuffer_count; ++i)
{
@@ -523,6 +525,7 @@ void wined3d_cs_emit_present(struct wined3d_cs *cs, struct wined3d_swapchain *sw
@@ -517,6 +519,7 @@ void wined3d_cs_emit_present(struct wined3d_cs *cs, struct wined3d_swapchain *sw
{
struct wined3d_cs_present *op;
unsigned int i;
@@ -29,7 +29,7 @@ index d03dd1c..7311ac5 100644
op = cs->ops->require_space(cs, sizeof(*op));
op->opcode = WINED3D_CS_OP_PRESENT;
@@ -538,7 +541,20 @@ void wined3d_cs_emit_present(struct wined3d_cs *cs, struct wined3d_swapchain *sw
@@ -532,7 +535,20 @@ void wined3d_cs_emit_present(struct wined3d_cs *cs, struct wined3d_swapchain *sw
wined3d_resource_acquire(&swapchain->back_buffers[i]->resource);
}
@@ -51,10 +51,10 @@ index d03dd1c..7311ac5 100644
static UINT wined3d_cs_exec_clear(struct wined3d_cs *cs, const void *data)
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 4c57f7b..1d84bf9 100644
index a098d7e62df..c28dd691a14 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -3061,6 +3061,8 @@ struct wined3d_cs
@@ -3148,6 +3148,8 @@ struct wined3d_cs
struct wined3d_cs_list free_list;
struct wined3d_cs_list exec_list;
@@ -62,7 +62,7 @@ index 4c57f7b..1d84bf9 100644
+ LONG pending_presents;
};
struct wined3d_cs *wined3d_cs_create(struct wined3d_device *device) DECLSPEC_HIDDEN;
static inline void wined3d_resource_wait_idle(struct wined3d_resource *resource)
--
2.9.0
2.11.0

View File

@@ -1,92 +0,0 @@
From 7c6279ec1995b6987669524f9c03aac4423394d0 Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Tue, 15 Nov 2016 22:09:53 +0100
Subject: Revert "wined3d: Fix style issues in delete_gl_buffer()."
This reverts commit 01b8bea329a34d946aa2efbeabae9ad00a5e9868.
---
dlls/wined3d/buffer.c | 29 ++++++++++++++---------------
1 file changed, 14 insertions(+), 15 deletions(-)
diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c
index 6e6d189..a3d7dfd 100644
--- a/dlls/wined3d/buffer.c
+++ b/dlls/wined3d/buffer.c
@@ -139,17 +139,16 @@ static void buffer_bind(struct wined3d_buffer *buffer, struct wined3d_context *c
}
/* Context activation is done by the caller. */
-static void buffer_destroy_buffer_object(struct wined3d_buffer *buffer, const struct wined3d_context *context)
+static void delete_gl_buffer(struct wined3d_buffer *This, const struct wined3d_context *context)
{
const struct wined3d_gl_info *gl_info = context->gl_info;
- struct wined3d_resource *resource = &buffer->resource;
+ struct wined3d_resource *resource = &This->resource;
- if (!buffer->buffer_object)
- return;
+ if(!This->buffer_object) return;
- GL_EXTCALL(glDeleteBuffers(1, &buffer->buffer_object));
+ GL_EXTCALL(glDeleteBuffers(1, &This->buffer_object));
checkGLcall("glDeleteBuffers");
- buffer->buffer_object = 0;
+ This->buffer_object = 0;
/* The stream source state handler might have read the memory of the
* vertex buffer already and got the memory in the vbo which is not
@@ -158,18 +157,18 @@ static void buffer_destroy_buffer_object(struct wined3d_buffer *buffer, const st
* rarely. */
if (resource->bind_count)
{
- if (buffer->bind_flags & WINED3D_BIND_VERTEX_BUFFER)
+ if (This->bind_flags & WINED3D_BIND_VERTEX_BUFFER)
device_invalidate_state(resource->device, STATE_STREAMSRC);
- if (buffer->bind_flags & WINED3D_BIND_INDEX_BUFFER)
+ if (This->bind_flags & WINED3D_BIND_INDEX_BUFFER)
device_invalidate_state(resource->device, STATE_INDEXBUFFER);
}
- if (buffer->query)
+ if(This->query)
{
- wined3d_event_query_destroy(buffer->query);
- buffer->query = NULL;
+ wined3d_event_query_destroy(This->query);
+ This->query = NULL;
}
- buffer->flags &= ~WINED3D_BUFFER_APPLESYNC;
+ This->flags &= ~WINED3D_BUFFER_APPLESYNC;
}
/* Context activation is done by the caller. */
@@ -258,7 +257,7 @@ fail:
/* Clean up all BO init, but continue because we can work without a BO :-) */
ERR("Failed to create a buffer object. Continuing, but performance issues may occur.\n");
buffer->flags &= ~WINED3D_BUFFER_USE_BO;
- buffer_destroy_buffer_object(buffer, context);
+ delete_gl_buffer(buffer, context);
buffer_clear_dirty_areas(buffer);
return FALSE;
}
@@ -664,7 +663,7 @@ static void buffer_unload(struct wined3d_resource *resource)
buffer->flags &= ~WINED3D_BUFFER_DOUBLEBUFFER;
wined3d_buffer_invalidate_location(buffer, WINED3D_LOCATION_BUFFER);
- buffer_destroy_buffer_object(buffer, context);
+ delete_gl_buffer(buffer, context);
buffer_clear_dirty_areas(buffer);
context_release(context);
@@ -693,7 +692,7 @@ static void wined3d_buffer_destroy_object(void *object)
if (buffer->buffer_object)
{
context = context_acquire(buffer->resource.device, NULL);
- buffer_destroy_buffer_object(buffer, context);
+ delete_gl_buffer(buffer, context);
context_release(context);
HeapFree(GetProcessHeap(), 0, buffer->conversion_map);
--
2.9.0

View File

@@ -1,4 +1,4 @@
From b11582969b78a6699dc7776f4c49f25d787f67dc Mon Sep 17 00:00:00 2001
From 04ea21a9ee8a73a1c463118a26f315cbe83d5fbf Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20D=C3=B6singer?= <stefan@codeweavers.com>
Date: Wed, 10 Apr 2013 20:09:55 +0200
Subject: wined3d: Wait for the cs to finish before destroying the device
@@ -8,19 +8,19 @@ Subject: wined3d: Wait for the cs to finish before destroying the device
1 file changed, 3 insertions(+)
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index 81cf94e..0ce1c11 100644
index d20906e7cc5..71701a816da 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -1126,6 +1126,9 @@ HRESULT CDECL wined3d_device_uninit_3d(struct wined3d_device *device)
@@ -1130,6 +1130,9 @@ HRESULT CDECL wined3d_device_uninit_3d(struct wined3d_device *device)
if (!device->d3d_initialized)
return WINED3DERR_INVALIDCALL;
+ if (wined3d_settings.cs_multithreaded)
+ device->cs->ops->finish(device->cs);
+ device->cs->ops->submit_and_wait(device->cs);
+
/* I don't think that the interface guarantees that the device is destroyed from the same thread
* it was created. Thus make sure a context is active for the glDelete* calls
*/
--
2.8.0
2.11.0

View File

@@ -1,57 +0,0 @@
From d826efd7c8bce9cc50f79ab5589455d8e7882561 Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Tue, 15 Nov 2016 22:10:01 +0100
Subject: Revert "wined3d: Pass context to delete_gl_buffer()."
This reverts commit 20eb55fdefa9f0b7a0864dce3b4a12b132dba651.
---
dlls/wined3d/buffer.c | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c
index a3d7dfd..43b3366 100644
--- a/dlls/wined3d/buffer.c
+++ b/dlls/wined3d/buffer.c
@@ -138,10 +138,9 @@ static void buffer_bind(struct wined3d_buffer *buffer, struct wined3d_context *c
GL_EXTCALL(glBindBuffer(buffer->buffer_type_hint, buffer->buffer_object));
}
-/* Context activation is done by the caller. */
-static void delete_gl_buffer(struct wined3d_buffer *This, const struct wined3d_context *context)
+/* Context activation is done by the caller */
+static void delete_gl_buffer(struct wined3d_buffer *This, const struct wined3d_gl_info *gl_info)
{
- const struct wined3d_gl_info *gl_info = context->gl_info;
struct wined3d_resource *resource = &This->resource;
if(!This->buffer_object) return;
@@ -257,7 +256,7 @@ fail:
/* Clean up all BO init, but continue because we can work without a BO :-) */
ERR("Failed to create a buffer object. Continuing, but performance issues may occur.\n");
buffer->flags &= ~WINED3D_BUFFER_USE_BO;
- delete_gl_buffer(buffer, context);
+ delete_gl_buffer(buffer, gl_info);
buffer_clear_dirty_areas(buffer);
return FALSE;
}
@@ -663,7 +662,7 @@ static void buffer_unload(struct wined3d_resource *resource)
buffer->flags &= ~WINED3D_BUFFER_DOUBLEBUFFER;
wined3d_buffer_invalidate_location(buffer, WINED3D_LOCATION_BUFFER);
- delete_gl_buffer(buffer, context);
+ delete_gl_buffer(buffer, context->gl_info);
buffer_clear_dirty_areas(buffer);
context_release(context);
@@ -692,7 +691,7 @@ static void wined3d_buffer_destroy_object(void *object)
if (buffer->buffer_object)
{
context = context_acquire(buffer->resource.device, NULL);
- delete_gl_buffer(buffer, context);
+ delete_gl_buffer(buffer, context->gl_info);
context_release(context);
HeapFree(GetProcessHeap(), 0, buffer->conversion_map);
--
2.9.0

View File

@@ -1,4 +1,4 @@
From 9674800f8e960faf599b27ac2c72bed131fb02e7 Mon Sep 17 00:00:00 2001
From c0bc4f7688ba8dbc3458d78237d4b2b998901c40 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20D=C3=B6singer?= <stefan@codeweavers.com>
Date: Mon, 29 Apr 2013 18:49:53 +0200
Subject: wined3d: Send blits through the command stream.
@@ -6,16 +6,31 @@ Subject: wined3d: Send blits through the command stream.
This needs more work. This patch breaks error handling, and the split
between surface_blt and surface_blt_ugly isn't particularly nice.
---
dlls/wined3d/cs.c | 50 ++++++++
dlls/wined3d/surface.c | 253 ++++++++++++++++++++++++-----------------
dlls/wined3d/wined3d_private.h | 8 ++
3 files changed, 207 insertions(+), 104 deletions(-)
dlls/d3d11/tests/d3d11.c | 2 +-
dlls/wined3d/cs.c | 54 +++++++++
dlls/wined3d/device.c | 26 +++++
dlls/wined3d/surface.c | 249 +++++++++++++++++++++++++----------------
dlls/wined3d/wined3d_private.h | 7 ++
5 files changed, 240 insertions(+), 98 deletions(-)
diff --git a/dlls/d3d11/tests/d3d11.c b/dlls/d3d11/tests/d3d11.c
index 40e0241a463..eb67dfc07fd 100644
--- a/dlls/d3d11/tests/d3d11.c
+++ b/dlls/d3d11/tests/d3d11.c
@@ -9533,7 +9533,7 @@ static void test_draw_uav_only(void)
draw_quad(&test_context);
draw_quad(&test_context);
draw_quad(&test_context);
- todo_wine check_texture_color(texture, 500, 1);
+ check_texture_color(texture, 500, 1);
ID3D11PixelShader_Release(ps);
ID3D11Texture2D_Release(texture);
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
index 62e250c..3465f40 100644
index e738c6ff058..30020d62c0c 100644
--- a/dlls/wined3d/cs.c
+++ b/dlls/wined3d/cs.c
@@ -78,6 +78,7 @@ enum wined3d_cs_op
@@ -79,6 +79,7 @@ enum wined3d_cs_op
WINED3D_CS_OP_SET_PRIMITIVE_TYPE,
WINED3D_CS_OP_SET_LIGHT,
WINED3D_CS_OP_SET_LIGHT_ENABLE,
@@ -23,7 +38,7 @@ index 62e250c..3465f40 100644
WINED3D_CS_OP_STOP,
};
@@ -370,6 +371,18 @@ struct wined3d_cs_set_light_enable
@@ -398,6 +399,18 @@ struct wined3d_cs_set_light_enable
BOOL enable;
};
@@ -39,20 +54,10 @@ index 62e250c..3465f40 100644
+ enum wined3d_texture_filter_type filter;
+};
+
/* FIXME: The list synchronization probably isn't particularly fast. */
static void wined3d_cs_list_enqueue(struct wined3d_cs_list *list, struct wined3d_cs_block *block)
{
@@ -1756,6 +1769,9 @@ static UINT wined3d_cs_exec_glfinish(struct wined3d_cs *cs, const void *data)
struct wined3d_device *device = cs->device;
struct wined3d_context *context;
static inline BOOL wined3d_cs_process_block(struct wined3d_cs *cs, struct wined3d_cs_block *block);
static void wined3d_cs_mt_submit(struct wined3d_cs *cs);
+ if (!device->d3d_initialized)
+ return sizeof(*op);
+
context = context_acquire(device, NULL);
context->gl_info->gl_ops.gl.p_glFinish();
context_release(context);
@@ -1967,6 +1983,38 @@ void wined3d_cs_emit_set_light_enable(struct wined3d_cs *cs, UINT idx, BOOL enab
@@ -2028,6 +2041,46 @@ void wined3d_cs_emit_set_light_enable(struct wined3d_cs *cs, UINT idx, BOOL enab
cs->ops->submit(cs);
}
@@ -64,6 +69,10 @@ index 62e250c..3465f40 100644
+ op->src_surface, &op->src_rect,
+ op->flags, &op->fx, op->filter);
+
+ wined3d_resource_release(&op->dst_surface->container->resource);
+ if (op->src_surface && op->src_surface != op->dst_surface)
+ wined3d_resource_release(&op->src_surface->container->resource);
+
+ return sizeof(*op);
+}
+
@@ -85,13 +94,17 @@ index 62e250c..3465f40 100644
+ if (fx)
+ op->fx = *fx;
+
+ wined3d_resource_acquire(&dst_surface->container->resource);
+ if (src_surface && src_surface != dst_surface)
+ wined3d_resource_acquire(&src_surface->container->resource);
+
+ cs->ops->submit(cs);
+}
+
static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void *data) =
{
/* WINED3D_CS_OP_FENCE */ wined3d_cs_exec_fence,
@@ -2011,6 +2059,7 @@ static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void
@@ -2072,6 +2125,7 @@ static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void
/* WINED3D_CS_OP_SET_PRIMITIVE_TYPE */ wined3d_cs_exec_set_primitive_type,
/* WINED3D_CS_OP_SET_LIGHT */ wined3d_cs_exec_set_light,
/* WINED3D_CS_OP_SET_LIGHT_ENABLE */ wined3d_cs_exec_set_light_enable,
@@ -99,19 +112,62 @@ index 62e250c..3465f40 100644
};
static void *wined3d_cs_st_require_space(struct wined3d_cs *cs, size_t size)
@@ -2089,6 +2138,7 @@ static DWORD WINAPI wined3d_cs_run(void *thread_param)
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index 71701a816da..e1a02212900 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -4070,6 +4070,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;
+ struct wined3d_box dst_box;
TRACE("Started.\n");
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",
@@ -4157,6 +4158,14 @@ HRESULT CDECL wined3d_device_copy_sub_resource_region(struct wined3d_device *dev
+ cs->thread_id = GetCurrentThreadId();
for (;;)
if (src_box)
{
struct wined3d_cs_block *block;
+ if ((src_texture->resource.format_flags & WINED3DFMT_FLAG_BLOCKS)
+ && !wined3d_texture_check_block_align(src_texture,
+ src_sub_resource_idx % src_texture->level_count, src_box))
+ {
+ WARN("Source box not block-aligned.\n");
+ return WINED3DERR_INVALIDCALL;
+ }
+
SetRect(&src_rect, src_box->left, src_box->top, src_box->right, src_box->bottom);
}
else
@@ -4170,6 +4179,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));
+ if (dst_texture->resource.format_flags & WINED3DFMT_FLAG_BLOCKS)
+ {
+ dst_box.left = dst_rect.left;
+ dst_box.top = dst_rect.top;
+ dst_box.front = 0;
+ dst_box.right = dst_rect.right;
+ dst_box.bottom = dst_rect.bottom;
+ dst_box.back = 1;
+
+ if(!wined3d_texture_check_block_align(dst_texture,
+ dst_sub_resource_idx % dst_texture->level_count, &dst_box))
+ {
+ WARN("Destination box not block-aligned.\n");
+ return WINED3DERR_INVALIDCALL;
+ }
+ }
+
if (FAILED(hr = wined3d_texture_blt(dst_texture, dst_sub_resource_idx, &dst_rect,
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 5601804..ac6eddb 100644
index 3369d8777df..e19f63db4c2 100644
--- a/dlls/wined3d/surface.c
+++ b/dlls/wined3d/surface.c
@@ -4103,7 +4103,7 @@ const struct blit_shader cpu_blit = {
@@ -3886,7 +3886,7 @@ const struct blit_shader cpu_blit = {
cpu_blit_blit_surface,
};
@@ -120,7 +176,7 @@ index 5601804..ac6eddb 100644
struct wined3d_surface *src_surface, const RECT *src_rect, DWORD flags,
const struct wined3d_blt_fx *fx, enum wined3d_texture_filter_type filter)
{
@@ -4113,9 +4113,8 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst
@@ -3896,9 +3896,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;
@@ -132,7 +188,7 @@ index 5601804..ac6eddb 100644
DWORD src_ds_flags, dst_ds_flags;
BOOL scale, convert;
@@ -4128,91 +4127,17 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst
@@ -3911,84 +3910,17 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst
| WINED3D_BLT_DO_NOT_WAIT
| WINED3D_BLT_ALPHA_TEST;
@@ -209,27 +265,20 @@ index 5601804..ac6eddb 100644
-
- /* WINED3D_BLT_DO_NOT_WAIT appeared in DX7. */
- if (flags & WINED3D_BLT_DO_NOT_WAIT)
- {
+ else
{
- static unsigned int once;
-
- if (!once++)
- FIXME("Can't handle WINED3D_BLT_DO_NOT_WAIT flag.\n");
- flags &= ~WINED3D_BLT_DO_NOT_WAIT;
- }
-
- if (wined3d_settings.cs_multithreaded)
+ else
{
- FIXME("Waiting for cs.\n");
- wined3d_cs_emit_glfinish(device->cs);
- device->cs->ops->finish(device->cs);
+ src_texture = NULL;
+ src_sub_resource_idx = 0;
+ src_swapchain = NULL;
}
if (!device->d3d_initialized)
@@ -4237,11 +4162,6 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst
@@ -4013,11 +3945,6 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst
goto fallback;
}
@@ -241,7 +290,7 @@ index 5601804..ac6eddb 100644
dst_swapchain = dst_texture->swapchain;
/* This isn't strictly needed. FBO blits for example could deal with
@@ -4277,22 +4197,16 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst
@@ -4053,22 +3980,16 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst
TRACE("Depth fill.\n");
if (!surface_convert_depth_to_float(dst_surface, fx->fill_color, &depth))
@@ -267,7 +316,7 @@ index 5601804..ac6eddb 100644
}
}
else
@@ -4328,7 +4242,7 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst
@@ -4104,7 +4025,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)))
@@ -276,7 +325,7 @@ index 5601804..ac6eddb 100644
}
else
{
@@ -4371,7 +4285,7 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst
@@ -4147,7 +4068,7 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst
context, dst_texture->resource.draw_binding);
context_release(context);
}
@@ -285,7 +334,7 @@ index 5601804..ac6eddb 100644
}
}
}
@@ -4395,7 +4309,7 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst
@@ -4171,7 +4092,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;
@@ -294,7 +343,7 @@ index 5601804..ac6eddb 100644
}
if (fbo_blit_supported(&device->adapter->gl_info, blit_op,
@@ -4416,7 +4330,7 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst
@@ -4192,7 +4113,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);
@@ -303,7 +352,7 @@ index 5601804..ac6eddb 100644
}
blitter = wined3d_select_blitter(&device->adapter->gl_info, &device->adapter->d3d_info, blit_op,
@@ -4426,7 +4340,7 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst
@@ -4202,7 +4123,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);
@@ -312,7 +361,7 @@ index 5601804..ac6eddb 100644
}
}
}
@@ -4434,9 +4348,140 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst
@@ -4210,9 +4131,143 @@ 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)))
@@ -323,11 +372,10 @@ index 5601804..ac6eddb 100644
- return surface_cpu_blt(dst_texture, dst_sub_resource_idx, &dst_box,
+ surface_cpu_blt(dst_texture, dst_sub_resource_idx, &dst_box,
src_texture, src_sub_resource_idx, &src_box, flags, fx, filter);
+ return;
+}
}
+
+HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst_rect_in,
+ struct wined3d_surface *src_surface, const RECT *src_rect_in, DWORD flags,
+HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst_rect,
+ struct wined3d_surface *src_surface, const RECT *src_rect, DWORD flags,
+ const struct wined3d_blt_fx *fx, enum wined3d_texture_filter_type filter)
+{
+ struct wined3d_texture *dst_texture = dst_surface->container;
@@ -336,11 +384,11 @@ index 5601804..ac6eddb 100644
+ struct wined3d_texture_sub_resource *dst_sub_resource =
+ &dst_texture->sub_resources[dst_sub_resource_idx];
+ struct wined3d_texture_sub_resource *src_sub_resource = NULL;
+ RECT src_rect, dst_rect;
+ unsigned int dst_w, dst_h, src_w, src_h;
+ DWORD src_ds_flags, dst_ds_flags;
+
+ TRACE("dst_surface %p, dst_rect %s, src_surface %p, src_rect %s, flags %#x, fx %p, filter %s.\n",
+ dst_surface, wine_dbgstr_rect(dst_rect_in), src_surface, wine_dbgstr_rect(src_rect_in),
+ dst_surface, wine_dbgstr_rect(dst_rect), src_surface, wine_dbgstr_rect(src_rect),
+ flags, fx, debug_d3dtexturefiltertype(filter));
+ TRACE("Usage is %s.\n", debug_d3dusage(dst_texture->resource.usage));
+
@@ -372,7 +420,7 @@ index 5601804..ac6eddb 100644
+ }
+
+ wined3d_cs_emit_glfinish(device->cs);
+ device->cs->ops->finish(device->cs);
+ device->cs->ops->submit_and_wait(device->cs);
+
+ if (dst_sub_resource->map_count || (src_sub_resource && src_sub_resource->map_count))
+ {
@@ -381,15 +429,12 @@ index 5601804..ac6eddb 100644
+ }
+ }
+
+ surface_get_rect(dst_surface, dst_rect_in, &dst_rect);
+
+ dst_w = wined3d_texture_get_level_width(dst_texture, dst_surface->texture_level);
+ dst_h = wined3d_texture_get_level_height(dst_texture, dst_surface->texture_level);
+ if (IsRectEmpty(&dst_rect)
+ || dst_rect.left > dst_w || dst_rect.left < 0
+ || dst_rect.top > dst_h || dst_rect.top < 0
+ || dst_rect.right > dst_w || dst_rect.right < 0
+ || dst_rect.bottom > dst_h || dst_rect.bottom < 0)
+ if (IsRectEmpty(dst_rect) || dst_rect->left > dst_w || dst_rect->left < 0
+ || dst_rect->top > dst_h || dst_rect->top < 0
+ || dst_rect->right > dst_w || dst_rect->right < 0
+ || dst_rect->bottom > dst_h || dst_rect->bottom < 0)
+ {
+ WARN("The application gave us a bad destination rectangle.\n");
+ return WINEDDERR_INVALIDRECT;
@@ -397,31 +442,38 @@ index 5601804..ac6eddb 100644
+
+ if (src_surface)
+ {
+ DWORD src_ds_flags, dst_ds_flags;
+
+ surface_get_rect(src_surface, src_rect_in, &src_rect);
+
+ src_w = wined3d_texture_get_level_width(src_surface->container, src_surface->texture_level);
+ src_h = wined3d_texture_get_level_height(src_surface->container, src_surface->texture_level);
+ if (IsRectEmpty(&src_rect)
+ || src_rect.left > src_w || src_rect.left < 0
+ || src_rect.top > src_h || src_rect.top < 0
+ || src_rect.right > src_w || src_rect.right < 0
+ || src_rect.bottom > src_h || src_rect.bottom < 0)
+ if (IsRectEmpty(src_rect) || src_rect->left > src_w || src_rect->left < 0
+ || src_rect->top > src_h || src_rect->top < 0
+ || src_rect->right > src_w || src_rect->right < 0
+ || src_rect->bottom > src_h || src_rect->bottom < 0)
+ {
+ WARN("The application gave us a bad source rectangle.\n");
+ return WINEDDERR_INVALIDRECT;
+ }
+ }
+
+ dst_ds_flags = dst_texture->resource.format_flags
+ & (WINED3DFMT_FLAG_DEPTH | WINED3DFMT_FLAG_STENCIL);
+ dst_ds_flags = dst_texture->resource.format_flags
+ & (WINED3DFMT_FLAG_DEPTH | WINED3DFMT_FLAG_STENCIL);
+ if (src_surface)
+ src_ds_flags = src_surface->container->resource.format_flags
+ & (WINED3DFMT_FLAG_DEPTH | WINED3DFMT_FLAG_STENCIL);
+ if (src_ds_flags != dst_ds_flags)
+ {
+ WARN("Rejecting depth / stencil blit between incompatible formats.\n");
+ return WINED3DERR_INVALIDCALL;
+ }
+ else
+ src_ds_flags = 0;
+
+ if (!(flags & WINED3D_BLT_DEPTH_FILL) && (src_ds_flags != dst_ds_flags))
+ {
+ WARN("Rejecting depth / stencil blit between incompatible formats.\n");
+ return WINED3DERR_INVALIDCALL;
+ }
+
+ /* FIXME: We should select the blitter in the main thread, that way we can return an error if the blit
+ * is unsupported without duplicating all the checks... */
+ if (flags & WINED3D_BLT_COLOR_FILL && (dst_surface->container->resource.format_flags & WINED3DFMT_FLAG_BLOCKS))
+ {
+ WARN("Block color fill, returning WINED3DERR_INVALIDCALL\n");
+ return WINED3DERR_INVALIDCALL;
+ }
+
+ if (!fx || !(fx->fx))
@@ -450,16 +502,16 @@ index 5601804..ac6eddb 100644
+ }
+
+ TRACE("Emitting blit %p <== %p\n", dst_surface, src_surface);
+ wined3d_cs_emit_blt(device->cs, dst_surface, &dst_rect, src_surface, &src_rect,
+ wined3d_cs_emit_blt(device->cs, dst_surface, dst_rect, src_surface, src_rect,
+ flags, fx, filter);
+
+ return WINED3D_OK;
}
+}
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 1d84bf9..d632cfd 100644
index c28dd691a14..84c592249aa 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -2913,6 +2913,9 @@ HRESULT surface_upload_from_surface(struct wined3d_surface *dst_surface, const P
@@ -2991,6 +2991,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;
@@ -469,17 +521,9 @@ index 1d84bf9..d632cfd 100644
void draw_textured_quad(const struct wined3d_surface *src_surface, struct wined3d_context *context,
const RECT *src_rect, const RECT *dst_rect, enum wined3d_texture_filter_type filter) DECLSPEC_HIDDEN;
@@ -3053,6 +3056,7 @@ struct wined3d_cs
struct wined3d_device *device;
struct wined3d_state state;
HANDLE thread;
+ DWORD thread_id;
DWORD tls_idx;
struct wined3d_surface *onscreen_depth_stencil;
@@ -3070,6 +3074,10 @@ void wined3d_cs_destroy(struct wined3d_cs *cs) DECLSPEC_HIDDEN;
void wined3d_cs_switch_onscreen_ds(struct wined3d_cs *cs, struct wined3d_context *context,
struct wined3d_surface *depth_stencil) DECLSPEC_HIDDEN;
@@ -3161,6 +3164,10 @@ static inline void wined3d_resource_wait_idle(struct wined3d_resource *resource)
struct wined3d_cs *wined3d_cs_create(struct wined3d_device *device) DECLSPEC_HIDDEN;
void wined3d_cs_destroy(struct wined3d_cs *cs) DECLSPEC_HIDDEN;
+void wined3d_cs_emit_blt(struct wined3d_cs *cs, struct wined3d_surface *dst_surface,
+ const RECT *dst_rect, struct wined3d_surface *src_surface,
@@ -489,5 +533,5 @@ index 1d84bf9..d632cfd 100644
DWORD flags, const struct wined3d_color *color, float depth, DWORD stencil) DECLSPEC_HIDDEN;
void wined3d_cs_emit_destroy_object(struct wined3d_cs *cs,
--
2.9.0
2.11.0

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