Rebase against 1bcc7ce75f64f2894de43379674bc5c53c52bb3a.

This commit is contained in:
Sebastian Lackner 2016-07-11 02:01:00 +02:00
parent bd3563bdf1
commit 31baacffe2
16 changed files with 558 additions and 641 deletions

View File

@ -51,7 +51,7 @@ usage()
# Get the upstream commit sha
upstream_commit()
{
echo "0a3700e051f3e9473c5daa40a5cdd951b1310b8c"
echo "1bcc7ce75f64f2894de43379674bc5c53c52bb3a"
}
# Show version information
@ -7383,15 +7383,11 @@ if test "$enable_wined3d_CSMT_Main" -eq 1; then
patch_apply wined3d-CSMT_Main/0056-wined3d-Get-rid-of-the-surface_upload_data-glFinish.patch
patch_apply wined3d-CSMT_Main/0057-wined3d-Don-t-lock-the-src-volume-in-device_update_v.patch
patch_apply wined3d-CSMT_Main/0058-wined3d-Handle-evit_managed_resources-through-the-CS.patch
patch_apply wined3d-CSMT_Main/0059-wined3d-Introduce-resource-fencing.patch
patch_apply wined3d-CSMT_Main/0060-wined3d-Fence-update_texture-calls.patch
patch_apply wined3d-CSMT_Main/0061-wined3d-Dirtify-resources-on-unmap.patch
patch_apply wined3d-CSMT_Main/0062-wined3d-Fence-texture-reads-in-draws.patch
patch_apply wined3d-CSMT_Main/0063-wined3d-Fence-render-targets-and-depth-stencils.patch
patch_apply wined3d-CSMT_Main/0064-wined3d-Fence-blit-operations.patch
patch_apply wined3d-CSMT_Main/0065-wined3d-Fence-color_fill-operations.patch
patch_apply wined3d-CSMT_Main/0066-wined3d-Fence-clear-calls.patch
patch_apply wined3d-CSMT_Main/0067-wined3d-Fence-present-calls.patch
patch_apply wined3d-CSMT_Main/0068-d3d9-tests-Remove-a-TODO-that-has-been-hacked-away.patch
patch_apply wined3d-CSMT_Main/0069-wined3d-Make-resource-maps-and-unmaps-a-priority-com.patch
patch_apply wined3d-CSMT_Main/0070-wined3d-Send-update_sub_resource-calls-through-the-c.patch
@ -7506,15 +7502,11 @@ if test "$enable_wined3d_CSMT_Main" -eq 1; then
echo '+ { "Stefan Dösinger", "wined3d: Get rid of the surface_upload_data glFinish.", 1 },';
echo '+ { "Stefan Dösinger", "wined3d: Don'\''t lock the src volume in device_update_volume.", 1 },';
echo '+ { "Stefan Dösinger", "wined3d: Handle evit_managed_resources through the CS.", 1 },';
echo '+ { "Stefan Dösinger", "wined3d: Introduce resource fencing.", 1 },';
echo '+ { "Stefan Dösinger", "wined3d: Fence update_texture calls.", 1 },';
echo '+ { "Stefan Dösinger", "wined3d: Dirtify resources on unmap.", 1 },';
echo '+ { "Stefan Dösinger", "wined3d: Fence texture reads in draws.", 1 },';
echo '+ { "Stefan Dösinger", "wined3d: Fence render targets and depth stencils.", 1 },';
echo '+ { "Stefan Dösinger", "wined3d: Fence blit operations.", 1 },';
echo '+ { "Stefan Dösinger", "wined3d: Fence color_fill operations.", 1 },';
echo '+ { "Stefan Dösinger", "wined3d: Fence clear calls.", 1 },';
echo '+ { "Stefan Dösinger", "wined3d: Fence present calls.", 1 },';
echo '+ { "Stefan Dösinger", "d3d9/tests: Remove a TODO that has been hacked away.", 1 },';
echo '+ { "Stefan Dösinger", "wined3d: Make resource maps and unmaps a priority command.", 1 },';
echo '+ { "Stefan Dösinger", "wined3d: Send update_sub_resource calls through the command stream.", 1 },';

View File

@ -1,4 +1,4 @@
From fadbf97ae4a90df1342e5bc07707a8e8ee5bbd4e Mon Sep 17 00:00:00 2001
From 56b000bf2a5d8a0d47d5fd06d51f737cafdb9933 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20D=C3=B6singer?= <stefan@codeweavers.com>
Date: Thu, 20 Dec 2012 13:09:17 +0100
Subject: wined3d: Move the framebuffer into wined3d_state
@ -6,7 +6,7 @@ Subject: wined3d: Move the framebuffer into wined3d_state
---
dlls/wined3d/arb_program_shader.c | 4 +-
dlls/wined3d/context.c | 19 ++++--
dlls/wined3d/cs.c | 22 ++++---
dlls/wined3d/cs.c | 50 ++++++++--------
dlls/wined3d/device.c | 122 +++++++++++++++++---------------------
dlls/wined3d/drawprim.c | 2 +-
dlls/wined3d/glsl_shader.c | 2 +-
@ -17,10 +17,10 @@ Subject: wined3d: Move the framebuffer into wined3d_state
dlls/wined3d/swapchain.c | 2 +-
dlls/wined3d/utils.c | 4 +-
dlls/wined3d/wined3d_private.h | 46 ++++++++++----
13 files changed, 178 insertions(+), 120 deletions(-)
13 files changed, 192 insertions(+), 134 deletions(-)
diff --git a/dlls/wined3d/arb_program_shader.c b/dlls/wined3d/arb_program_shader.c
index 6a1c9d6..ef9e462 100644
index 2de6577..fdd981a 100644
--- a/dlls/wined3d/arb_program_shader.c
+++ b/dlls/wined3d/arb_program_shader.c
@@ -704,7 +704,7 @@ static void shader_arb_load_constants_internal(struct shader_arb_priv *priv,
@ -42,7 +42,7 @@ index 6a1c9d6..ef9e462 100644
}
diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c
index d49e2d0..f2425df 100644
index 20d7868..d8d6ce0 100644
--- a/dlls/wined3d/context.c
+++ b/dlls/wined3d/context.c
@@ -1699,6 +1699,11 @@ struct wined3d_context *context_create(struct wined3d_swapchain *swapchain,
@ -57,7 +57,7 @@ index d49e2d0..f2425df 100644
/* Initialize the texture unit mapping to a 1:1 mapping */
for (s = 0; s < MAX_COMBINED_SAMPLERS; ++s)
{
@@ -2003,6 +2008,7 @@ out:
@@ -2004,6 +2009,7 @@ out:
if (hdc) wined3d_release_dc(swapchain->win_handle, hdc);
device->shader_backend->shader_free_context_data(ret);
device->adapter->fragment_pipe->free_context_data(ret);
@ -65,7 +65,7 @@ index d49e2d0..f2425df 100644
HeapFree(GetProcessHeap(), 0, ret->free_event_queries);
HeapFree(GetProcessHeap(), 0, ret->free_occlusion_queries);
HeapFree(GetProcessHeap(), 0, ret->free_timestamp_queries);
@@ -2039,6 +2045,7 @@ void context_destroy(struct wined3d_device *device, struct wined3d_context *cont
@@ -2040,6 +2046,7 @@ void context_destroy(struct wined3d_device *device, struct wined3d_context *cont
device->shader_backend->shader_free_context_data(context);
device->adapter->fragment_pipe->free_context_data(context);
HeapFree(GetProcessHeap(), 0, context->fbo_key);
@ -73,7 +73,7 @@ index d49e2d0..f2425df 100644
HeapFree(GetProcessHeap(), 0, context->draw_buffers);
HeapFree(GetProcessHeap(), 0, context->blit_targets);
device_context_remove(device, context);
@@ -2575,7 +2582,7 @@ BOOL context_apply_clear_state(struct wined3d_context *context, const struct win
@@ -2576,7 +2583,7 @@ BOOL context_apply_clear_state(struct wined3d_context *context, const struct win
DWORD rt_mask = 0, *cur_mask;
UINT i;
@ -82,7 +82,7 @@ index d49e2d0..f2425df 100644
|| rt_count != gl_info->limits.buffers)
{
if (!context_validate_rt_config(rt_count, rts, dsv))
@@ -2620,6 +2627,8 @@ BOOL context_apply_clear_state(struct wined3d_context *context, const struct win
@@ -2621,6 +2628,8 @@ BOOL context_apply_clear_state(struct wined3d_context *context, const struct win
rt_mask = context_generate_rt_mask_no_fbo(context,
rt_count ? wined3d_rendertarget_view_get_surface(rts[0])->container : NULL);
}
@ -91,7 +91,7 @@ index d49e2d0..f2425df 100644
}
else if (wined3d_settings.offscreen_rendering_mode == ORM_FBO
&& (!rt_count || wined3d_resource_is_offscreen(rts[0]->resource)))
@@ -2677,7 +2686,7 @@ BOOL context_apply_clear_state(struct wined3d_context *context, const struct win
@@ -2678,7 +2687,7 @@ BOOL context_apply_clear_state(struct wined3d_context *context, const struct win
static DWORD find_draw_buffers_mask(const struct wined3d_context *context, const struct wined3d_state *state)
{
@ -100,7 +100,7 @@ index d49e2d0..f2425df 100644
struct wined3d_shader *ps = state->shader[WINED3D_SHADER_TYPE_PIXEL];
DWORD rt_mask, rt_mask_bits;
unsigned int i;
@@ -2707,7 +2716,7 @@ static DWORD find_draw_buffers_mask(const struct wined3d_context *context, const
@@ -2708,7 +2717,7 @@ static DWORD find_draw_buffers_mask(const struct wined3d_context *context, const
void context_state_fb(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
{
DWORD rt_mask = find_draw_buffers_mask(context, state);
@ -109,7 +109,7 @@ index d49e2d0..f2425df 100644
DWORD *cur_mask;
if (wined3d_settings.offscreen_rendering_mode == ORM_FBO)
@@ -2738,6 +2747,8 @@ void context_state_fb(struct wined3d_context *context, const struct wined3d_stat
@@ -2739,6 +2748,8 @@ void context_state_fb(struct wined3d_context *context, const struct wined3d_stat
context_apply_draw_buffers(context, rt_mask);
*cur_mask = rt_mask;
}
@ -118,7 +118,7 @@ index d49e2d0..f2425df 100644
}
static void context_map_stage(struct wined3d_context *context, DWORD stage, DWORD unit)
@@ -3369,7 +3380,7 @@ BOOL context_apply_draw_state(struct wined3d_context *context,
@@ -3370,7 +3381,7 @@ BOOL context_apply_draw_state(struct wined3d_context *context,
const struct wined3d_device *device, const struct wined3d_state *state)
{
const struct StateEntry *state_table = context->state_table;
@ -128,19 +128,82 @@ index d49e2d0..f2425df 100644
WORD map;
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
index d74b312..433145e 100644
index 5931569..0f2156b 100644
--- a/dlls/wined3d/cs.c
+++ b/dlls/wined3d/cs.c
@@ -288,7 +288,7 @@ static void wined3d_cs_exec_clear(struct wined3d_cs *cs, const void *data)
device = cs->device;
wined3d_get_draw_rect(&device->state, &draw_rect);
@@ -313,19 +313,19 @@ static void wined3d_cs_exec_clear(struct wined3d_cs *cs, const void *data)
state = &device->state;
wined3d_get_draw_rect(state, &draw_rect);
device_clear_render_targets(device, device->adapter->gl_info.limits.buffers,
- &device->fb, op->rect_count, op->rects, &draw_rect, op->flags,
+ &cs->state.fb, op->rect_count, op->rects, &draw_rect, op->flags,
&op->color, op->depth, op->stencil);
if (op->flags & WINED3DCLEAR_TARGET)
{
for (i = 0; i < device->adapter->gl_info.limits.buffers; ++i)
{
- if (state->fb->render_targets[i])
- wined3d_resource_release(state->fb->render_targets[i]->resource);
+ if (state->fb.render_targets[i])
+ wined3d_resource_release(state->fb.render_targets[i]->resource);
}
}
if (op->flags & (WINED3DCLEAR_ZBUFFER | WINED3DCLEAR_STENCIL))
- wined3d_resource_release(state->fb->depth_stencil->resource);
+ wined3d_resource_release(state->fb.depth_stencil->resource);
}
@@ -396,7 +396,7 @@ static void wined3d_cs_exec_set_rendertarget_view(struct wined3d_cs *cs, const v
void wined3d_cs_emit_clear(struct wined3d_cs *cs, DWORD rect_count, const RECT *rects,
@@ -348,12 +348,12 @@ void wined3d_cs_emit_clear(struct wined3d_cs *cs, DWORD rect_count, const RECT *
{
for (i = 0; i < cs->device->adapter->gl_info.limits.buffers; ++i)
{
- if (state->fb->render_targets[i])
- wined3d_resource_acquire(state->fb->render_targets[i]->resource);
+ if (state->fb.render_targets[i])
+ wined3d_resource_acquire(state->fb.render_targets[i]->resource);
}
}
if (flags & (WINED3DCLEAR_ZBUFFER | WINED3DCLEAR_STENCIL))
- wined3d_resource_acquire(state->fb->depth_stencil->resource);
+ wined3d_resource_acquire(state->fb.depth_stencil->resource);
cs->ops->submit(cs);
}
@@ -391,11 +391,11 @@ static void wined3d_cs_exec_draw(struct wined3d_cs *cs, const void *data)
}
for (i = 0; i < cs->device->adapter->gl_info.limits.buffers; ++i)
{
- if (state->fb->render_targets[i])
- wined3d_resource_release(state->fb->render_targets[i]->resource);
+ if (state->fb.render_targets[i])
+ wined3d_resource_release(state->fb.render_targets[i]->resource);
}
- if (state->fb->depth_stencil)
- wined3d_resource_release(state->fb->depth_stencil->resource);
+ if (state->fb.depth_stencil)
+ wined3d_resource_release(state->fb.depth_stencil->resource);
for (i = 0; i < WINED3D_SHADER_TYPE_COUNT; ++i)
{
if (!(shader = state->shader[i]))
@@ -452,11 +452,11 @@ void wined3d_cs_emit_draw(struct wined3d_cs *cs, int base_vertex_idx, unsigned i
}
for (i = 0; i < cs->device->adapter->gl_info.limits.buffers; ++i)
{
- if (state->fb->render_targets[i])
- wined3d_resource_acquire(state->fb->render_targets[i]->resource);
+ if (state->fb.render_targets[i])
+ wined3d_resource_acquire(state->fb.render_targets[i]->resource);
}
- if (state->fb->depth_stencil)
- wined3d_resource_acquire(state->fb->depth_stencil->resource);
+ if (state->fb.depth_stencil)
+ wined3d_resource_acquire(state->fb.depth_stencil->resource);
for (i = 0; i < WINED3D_SHADER_TYPE_COUNT; ++i)
{
if (!(shader = state->shader[i]))
@@ -544,7 +544,7 @@ static void wined3d_cs_exec_set_rendertarget_view(struct wined3d_cs *cs, const v
{
const struct wined3d_cs_set_rendertarget_view *op = data;
@ -149,7 +212,7 @@ index d74b312..433145e 100644
device_invalidate_state(cs->device, STATE_FRAMEBUFFER);
}
@@ -419,7 +419,7 @@ static void wined3d_cs_exec_set_depth_stencil_view(struct wined3d_cs *cs, const
@@ -567,7 +567,7 @@ static void wined3d_cs_exec_set_depth_stencil_view(struct wined3d_cs *cs, const
struct wined3d_device *device = cs->device;
struct wined3d_rendertarget_view *prev;
@ -158,7 +221,7 @@ index d74b312..433145e 100644
{
struct wined3d_surface *prev_surface = wined3d_rendertarget_view_get_surface(prev);
@@ -435,7 +435,7 @@ static void wined3d_cs_exec_set_depth_stencil_view(struct wined3d_cs *cs, const
@@ -583,7 +583,7 @@ static void wined3d_cs_exec_set_depth_stencil_view(struct wined3d_cs *cs, const
}
}
@ -167,7 +230,7 @@ index d74b312..433145e 100644
if (!prev != !op->view)
{
@@ -1004,11 +1004,13 @@ void wined3d_cs_emit_set_material(struct wined3d_cs *cs, const struct wined3d_ma
@@ -1152,11 +1152,13 @@ void wined3d_cs_emit_set_material(struct wined3d_cs *cs, const struct wined3d_ma
static void wined3d_cs_exec_reset_state(struct wined3d_cs *cs, const void *data)
{
struct wined3d_adapter *adapter = cs->device->adapter;
@ -183,7 +246,7 @@ index d74b312..433145e 100644
}
void wined3d_cs_emit_reset_state(struct wined3d_cs *cs)
@@ -1089,15 +1091,13 @@ struct wined3d_cs *wined3d_cs_create(struct wined3d_device *device)
@@ -1257,15 +1259,13 @@ struct wined3d_cs *wined3d_cs_create(struct wined3d_device *device)
if (!(cs = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*cs))))
return NULL;
@ -201,7 +264,7 @@ index d74b312..433145e 100644
cs->ops = &wined3d_cs_st_ops;
cs->device = device;
@@ -1105,7 +1105,6 @@ struct wined3d_cs *wined3d_cs_create(struct wined3d_device *device)
@@ -1273,7 +1273,6 @@ struct wined3d_cs *wined3d_cs_create(struct wined3d_device *device)
if (!(cs->data = HeapAlloc(GetProcessHeap(), 0, cs->data_size)))
{
state_cleanup(&cs->state);
@ -209,7 +272,7 @@ index d74b312..433145e 100644
HeapFree(GetProcessHeap(), 0, cs);
return NULL;
}
@@ -1116,7 +1115,6 @@ struct wined3d_cs *wined3d_cs_create(struct wined3d_device *device)
@@ -1284,7 +1283,6 @@ struct wined3d_cs *wined3d_cs_create(struct wined3d_device *device)
void wined3d_cs_destroy(struct wined3d_cs *cs)
{
state_cleanup(&cs->state);
@ -218,7 +281,7 @@ index d74b312..433145e 100644
HeapFree(GetProcessHeap(), 0, cs);
}
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index 7bec75a..c72c8b2 100644
index 4d0ff2e..602398e 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -987,7 +987,7 @@ static void device_init_swapchain_state(struct wined3d_device *device, struct wi
@ -368,7 +431,7 @@ index 7bec75a..c72c8b2 100644
{
WARN("Silently ignoring depth and target clear with mismatching sizes\n");
return WINED3D_OK;
@@ -3793,8 +3773,8 @@ HRESULT CDECL wined3d_device_validate_device(const struct wined3d_device *device
@@ -3778,8 +3758,8 @@ HRESULT CDECL wined3d_device_validate_device(const struct wined3d_device *device
if (state->render_states[WINED3D_RS_ZENABLE] || state->render_states[WINED3D_RS_ZWRITEENABLE]
|| state->render_states[WINED3D_RS_STENCILENABLE])
{
@ -379,7 +442,7 @@ index 7bec75a..c72c8b2 100644
if (ds && rt && (ds->width < rt->width || ds->height < rt->height))
{
@@ -4252,20 +4232,21 @@ struct wined3d_rendertarget_view * CDECL wined3d_device_get_rendertarget_view(co
@@ -4237,20 +4217,21 @@ struct wined3d_rendertarget_view * CDECL wined3d_device_get_rendertarget_view(co
return NULL;
}
@ -403,7 +466,7 @@ index 7bec75a..c72c8b2 100644
TRACE("device %p, view_idx %u, view %p, set_viewport %#x.\n",
device, view_idx, view, set_viewport);
@@ -4305,13 +4286,13 @@ HRESULT CDECL wined3d_device_set_rendertarget_view(struct wined3d_device *device
@@ -4290,13 +4271,13 @@ HRESULT CDECL wined3d_device_set_rendertarget_view(struct wined3d_device *device
}
@ -419,7 +482,7 @@ index 7bec75a..c72c8b2 100644
wined3d_cs_emit_set_rendertarget_view(device->cs, view_idx, view);
/* Release after the assignment, to prevent device_resource_released()
* from seeing the surface as still in use. */
@@ -4323,18 +4304,19 @@ HRESULT CDECL wined3d_device_set_rendertarget_view(struct wined3d_device *device
@@ -4308,18 +4289,19 @@ HRESULT CDECL wined3d_device_set_rendertarget_view(struct wined3d_device *device
void CDECL wined3d_device_set_depth_stencil_view(struct wined3d_device *device, struct wined3d_rendertarget_view *view)
{
@ -441,7 +504,7 @@ index 7bec75a..c72c8b2 100644
wined3d_rendertarget_view_incref(view);
wined3d_cs_emit_set_depth_stencil_view(device->cs, view);
if (prev)
@@ -4697,10 +4679,9 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device,
@@ -4682,10 +4664,9 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device,
wined3d_texture_decref(device->cursor_texture);
device->cursor_texture = NULL;
}
@ -453,7 +516,7 @@ index 7bec75a..c72c8b2 100644
{
for (i = 0; i < device->adapter->gl_info.limits.buffers; ++i)
{
@@ -4709,6 +4690,11 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device,
@@ -4694,6 +4675,11 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device,
}
wined3d_device_set_depth_stencil_view(device, NULL);
@ -465,7 +528,7 @@ index 7bec75a..c72c8b2 100644
if (device->onscreen_depth_stencil)
{
wined3d_texture_decref(device->onscreen_depth_stencil->container);
@@ -4934,30 +4920,30 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device,
@@ -4919,30 +4905,30 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device,
if (device->d3d_initialized)
delete_opengl_contexts(device, swapchain);
@ -504,7 +567,7 @@ index 7bec75a..c72c8b2 100644
wined3d_cs_emit_set_scissor_rect(device->cs, &state->scissor_rect);
}
@@ -5049,11 +5035,11 @@ void device_resource_released(struct wined3d_device *device, struct wined3d_reso
@@ -5032,11 +5018,11 @@ void device_resource_released(struct wined3d_device *device, struct wined3d_reso
for (i = 0; i < device->adapter->gl_info.limits.buffers; ++i)
{
@ -518,7 +581,7 @@ index 7bec75a..c72c8b2 100644
ERR("Resource %p is still in use as depth/stencil buffer.\n", resource);
switch (type)
@@ -5189,8 +5175,12 @@ HRESULT device_init(struct wined3d_device *device, struct wined3d *wined3d,
@@ -5172,8 +5158,12 @@ HRESULT device_init(struct wined3d_device *device, struct wined3d *wined3d,
device->blitter = adapter->blitter;
@ -547,10 +610,10 @@ index dd82654..dd0f1d9 100644
struct wined3d_event_query *ib_query = NULL;
struct wined3d_stream_info si_emulated;
diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c
index 889342d..5cfc3c9 100644
index 6b1ac34..c35bf0e 100644
--- a/dlls/wined3d/glsl_shader.c
+++ b/dlls/wined3d/glsl_shader.c
@@ -1470,7 +1470,7 @@ static void shader_glsl_load_constants(void *shader_priv, struct wined3d_context
@@ -1495,7 +1495,7 @@ static void shader_glsl_load_constants(void *shader_priv, struct wined3d_context
const struct wined3d_vec4 correction_params =
{
/* Position is relative to the framebuffer, not the viewport. */
@ -560,10 +623,10 @@ index 889342d..5cfc3c9 100644
0.0f,
0.0f,
diff --git a/dlls/wined3d/shader.c b/dlls/wined3d/shader.c
index 33c6280..9b0c811 100644
index 08cee35..fbad000 100644
--- a/dlls/wined3d/shader.c
+++ b/dlls/wined3d/shader.c
@@ -2943,7 +2943,7 @@ void find_ps_compile_args(const struct wined3d_state *state, const struct wined3
@@ -3057,7 +3057,7 @@ void find_ps_compile_args(const struct wined3d_state *state, const struct wined3
UINT i;
memset(args, 0, sizeof(*args)); /* FIXME: Make sure all bits are set. */
@ -573,7 +636,7 @@ index 33c6280..9b0c811 100644
static unsigned int warned = 0;
diff --git a/dlls/wined3d/state.c b/dlls/wined3d/state.c
index bd0eba2..ed578b8 100644
index ea8bd40..50cf6cd 100644
--- a/dlls/wined3d/state.c
+++ b/dlls/wined3d/state.c
@@ -105,7 +105,7 @@ static void state_zenable(struct wined3d_context *context, const struct wined3d_
@ -782,7 +845,7 @@ index 0caf753..7b55e25 100644
struct wined3d_texture *src_texture;
diff --git a/dlls/wined3d/swapchain.c b/dlls/wined3d/swapchain.c
index aba7ac0..92abd3b 100644
index cf3cb95..783a174 100644
--- a/dlls/wined3d/swapchain.c
+++ b/dlls/wined3d/swapchain.c
@@ -481,7 +481,7 @@ static void swapchain_gl_present(struct wined3d_swapchain *swapchain,
@ -795,10 +858,10 @@ index aba7ac0..92abd3b 100644
struct wined3d_texture *logo_texture;
struct wined3d_context *context;
diff --git a/dlls/wined3d/utils.c b/dlls/wined3d/utils.c
index 878de10..2da8399 100644
index e1a7952..1c5b55c 100644
--- a/dlls/wined3d/utils.c
+++ b/dlls/wined3d/utils.c
@@ -4465,7 +4465,7 @@ void get_projection_matrix(const struct wined3d_context *context, const struct w
@@ -4481,7 +4481,7 @@ void get_projection_matrix(const struct wined3d_context *context, const struct w
float y_offset = context->render_offscreen
? (center_offset - (2.0f * y) - h) / h
: (center_offset - (2.0f * y) - h) / -h;
@ -807,7 +870,7 @@ index 878de10..2da8399 100644
state->render_states[WINED3D_RS_ZENABLE] : WINED3D_ZB_FALSE;
float z_scale = zenable ? 2.0f : 0.0f;
float z_offset = zenable ? -1.0f : 0.0f;
@@ -5262,7 +5262,7 @@ void gen_ffp_frag_op(const struct wined3d_context *context, const struct wined3d
@@ -5278,7 +5278,7 @@ void gen_ffp_frag_op(const struct wined3d_context *context, const struct wined3d
break;
}
}
@ -817,10 +880,10 @@ index 878de10..2da8399 100644
|| !state->render_states[WINED3D_RS_CLIPPLANEENABLE])
{
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 45e4714..e804970 100644
index 39d3759..a4ea193 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -1354,6 +1354,36 @@ struct wined3d_timestamp_query
@@ -1405,6 +1405,36 @@ struct wined3d_timestamp_query
void context_alloc_timestamp_query(struct wined3d_context *context, struct wined3d_timestamp_query *query) DECLSPEC_HIDDEN;
void context_free_timestamp_query(struct wined3d_timestamp_query *query) DECLSPEC_HIDDEN;
@ -857,7 +920,7 @@ index 45e4714..e804970 100644
struct wined3d_context
{
const struct wined3d_gl_info *gl_info;
@@ -1368,6 +1398,7 @@ struct wined3d_context
@@ -1419,6 +1449,7 @@ struct wined3d_context
DWORD dirtyArray[STATE_HIGHEST + 1]; /* Won't get bigger than that, a state is never marked dirty 2 times */
DWORD numDirtyEntries;
DWORD isStateDirty[STATE_HIGHEST / (sizeof(DWORD) * CHAR_BIT) + 1]; /* Bitmap to find out quickly if a state is dirty */
@ -865,7 +928,7 @@ index 45e4714..e804970 100644
struct wined3d_swapchain *swapchain;
struct
@@ -1475,12 +1506,6 @@ struct wined3d_context
@@ -1526,12 +1557,6 @@ struct wined3d_context
GLuint dummy_arbfp_prog;
};
@ -878,7 +941,7 @@ index 45e4714..e804970 100644
typedef void (*APPLYSTATEFUNC)(struct wined3d_context *ctx, const struct wined3d_state *state, DWORD state_id);
struct StateEntry
@@ -2239,7 +2264,7 @@ struct wined3d_stream_state
@@ -2296,7 +2321,7 @@ struct wined3d_stream_state
struct wined3d_state
{
DWORD flags;
@ -887,7 +950,7 @@ index 45e4714..e804970 100644
struct wined3d_vertex_declaration *vertex_declaration;
struct wined3d_stream_output stream_output[MAX_STREAM_OUT];
@@ -2343,7 +2368,6 @@ struct wined3d_device
@@ -2400,7 +2425,6 @@ struct wined3d_device
struct wine_rb_tree samplers;
/* Render Target Support */
@ -895,7 +958,7 @@ index 45e4714..e804970 100644
struct wined3d_surface *onscreen_depth_stencil;
struct wined3d_rendertarget_view *auto_depth_stencil_view;
@@ -2879,9 +2903,8 @@ struct wined3d_stateblock
@@ -2952,9 +2976,8 @@ struct wined3d_stateblock
void stateblock_init_contained_states(struct wined3d_stateblock *stateblock) DECLSPEC_HIDDEN;
void state_cleanup(struct wined3d_state *state) DECLSPEC_HIDDEN;
@ -907,7 +970,7 @@ index 45e4714..e804970 100644
void state_unbind_resources(struct wined3d_state *state) DECLSPEC_HIDDEN;
struct wined3d_cs_ops
@@ -2894,7 +2917,6 @@ struct wined3d_cs
@@ -2967,7 +2990,6 @@ struct wined3d_cs
{
const struct wined3d_cs_ops *ops;
struct wined3d_device *device;

View File

@ -1,4 +1,4 @@
From 37e72e356c337dad588e39ddb603a4f17d9d2ddc Mon Sep 17 00:00:00 2001
From c8122e4e9084199c6ae10a4314beffd02c9479cd Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20D=C3=B6singer?= <stefan@codeweavers.com>
Date: Tue, 1 Oct 2013 14:31:56 +0200
Subject: wined3d: Hackily introduce a multithreaded command stream
@ -10,7 +10,7 @@ Subject: wined3d: Hackily introduce a multithreaded command stream
3 files changed, 360 insertions(+), 28 deletions(-)
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
index a83459c..3bcbf19 100644
index 0f2156b..ce3f475 100644
--- a/dlls/wined3d/cs.c
+++ b/dlls/wined3d/cs.c
@@ -24,8 +24,19 @@ WINE_DEFAULT_DEBUG_CHANNEL(d3d);
@ -188,16 +188,16 @@ index a83459c..3bcbf19 100644
{
const struct wined3d_cs_present *op = data;
struct wined3d_swapchain *swapchain;
@@ -269,6 +419,8 @@ static void wined3d_cs_exec_present(struct wined3d_cs *cs, const void *data)
wined3d_swapchain_set_window(swapchain, op->dst_window_override);
swapchain->swapchain_ops->swapchain_present(swapchain, &op->src_rect, &op->dst_rect, op->flags);
@@ -276,6 +426,8 @@ static void wined3d_cs_exec_present(struct wined3d_cs *cs, const void *data)
{
wined3d_resource_release(&swapchain->back_buffers[i]->resource);
}
+
+ return sizeof(*op);
}
void wined3d_cs_emit_present(struct wined3d_cs *cs, struct wined3d_swapchain *swapchain,
@@ -287,17 +439,20 @@ void wined3d_cs_emit_present(struct wined3d_cs *cs, struct wined3d_swapchain *sw
@@ -301,13 +453,14 @@ void wined3d_cs_emit_present(struct wined3d_cs *cs, struct wined3d_swapchain *sw
cs->ops->submit(cs);
}
@ -205,21 +205,24 @@ index a83459c..3bcbf19 100644
+static UINT wined3d_cs_exec_clear(struct wined3d_cs *cs, const void *data)
{
const struct wined3d_cs_clear *op = data;
const struct wined3d_state *state;
struct wined3d_device *device;
unsigned int i;
RECT draw_rect;
+ size_t size = FIELD_OFFSET(struct wined3d_cs_clear, rects[op->rect_count]);
device = cs->device;
wined3d_get_draw_rect(&device->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,
&op->color, op->depth, op->stencil);
state = &device->state;
@@ -326,6 +479,8 @@ static void wined3d_cs_exec_clear(struct wined3d_cs *cs, const void *data)
}
if (op->flags & (WINED3DCLEAR_ZBUFFER | WINED3DCLEAR_STENCIL))
wined3d_resource_release(state->fb.depth_stencil->resource);
+
+ return size;
}
void wined3d_cs_emit_clear(struct wined3d_cs *cs, DWORD rect_count, const RECT *rects,
@@ -317,7 +472,7 @@ void wined3d_cs_emit_clear(struct wined3d_cs *cs, DWORD rect_count, const RECT *
@@ -358,7 +513,7 @@ void wined3d_cs_emit_clear(struct wined3d_cs *cs, DWORD rect_count, const RECT *
cs->ops->submit(cs);
}
@ -227,17 +230,17 @@ index a83459c..3bcbf19 100644
+static UINT wined3d_cs_exec_draw(struct wined3d_cs *cs, const void *data)
{
struct wined3d_state *state = &cs->device->state;
const struct wined3d_cs_draw *op = data;
@@ -331,6 +486,8 @@ static void wined3d_cs_exec_draw(struct wined3d_cs *cs, const void *data)
draw_primitive(cs->device, state, op->base_vertex_idx, op->start_idx,
op->index_count, op->start_instance, op->instance_count, op->indexed);
struct wined3d_shader_sampler_map_entry *entry;
@@ -417,6 +572,8 @@ static void wined3d_cs_exec_draw(struct wined3d_cs *cs, const void *data)
wined3d_resource_release(view->resource);
}
}
+
+ return sizeof(*op);
}
void wined3d_cs_emit_draw(struct wined3d_cs *cs, int base_vertex_idx, unsigned int start_idx,
@@ -350,12 +507,14 @@ void wined3d_cs_emit_draw(struct wined3d_cs *cs, int base_vertex_idx, unsigned i
@@ -482,12 +639,14 @@ void wined3d_cs_emit_draw(struct wined3d_cs *cs, int base_vertex_idx, unsigned i
cs->ops->submit(cs);
}
@ -253,7 +256,7 @@ index a83459c..3bcbf19 100644
}
void wined3d_cs_emit_set_predication(struct wined3d_cs *cs, struct wined3d_query *predicate, BOOL value)
@@ -370,12 +529,14 @@ void wined3d_cs_emit_set_predication(struct wined3d_cs *cs, struct wined3d_query
@@ -502,12 +661,14 @@ void wined3d_cs_emit_set_predication(struct wined3d_cs *cs, struct wined3d_query
cs->ops->submit(cs);
}
@ -269,7 +272,7 @@ index a83459c..3bcbf19 100644
}
void wined3d_cs_emit_set_viewport(struct wined3d_cs *cs, const struct wined3d_viewport *viewport)
@@ -389,12 +550,14 @@ void wined3d_cs_emit_set_viewport(struct wined3d_cs *cs, const struct wined3d_vi
@@ -521,12 +682,14 @@ void wined3d_cs_emit_set_viewport(struct wined3d_cs *cs, const struct wined3d_vi
cs->ops->submit(cs);
}
@ -285,7 +288,7 @@ index a83459c..3bcbf19 100644
}
void wined3d_cs_emit_set_scissor_rect(struct wined3d_cs *cs, const RECT *rect)
@@ -408,12 +571,14 @@ void wined3d_cs_emit_set_scissor_rect(struct wined3d_cs *cs, const RECT *rect)
@@ -540,12 +703,14 @@ void wined3d_cs_emit_set_scissor_rect(struct wined3d_cs *cs, const RECT *rect)
cs->ops->submit(cs);
}
@ -301,7 +304,7 @@ index a83459c..3bcbf19 100644
}
void wined3d_cs_emit_set_rendertarget_view(struct wined3d_cs *cs, unsigned int view_idx,
@@ -429,7 +594,7 @@ void wined3d_cs_emit_set_rendertarget_view(struct wined3d_cs *cs, unsigned int v
@@ -561,7 +726,7 @@ void wined3d_cs_emit_set_rendertarget_view(struct wined3d_cs *cs, unsigned int v
cs->ops->submit(cs);
}
@ -310,7 +313,7 @@ index a83459c..3bcbf19 100644
{
const struct wined3d_cs_set_depth_stencil_view *op = data;
struct wined3d_device *device = cs->device;
@@ -468,6 +633,8 @@ static void wined3d_cs_exec_set_depth_stencil_view(struct wined3d_cs *cs, const
@@ -600,6 +765,8 @@ static void wined3d_cs_exec_set_depth_stencil_view(struct wined3d_cs *cs, const
}
device_invalidate_state(device, STATE_FRAMEBUFFER);
@ -319,7 +322,7 @@ index a83459c..3bcbf19 100644
}
void wined3d_cs_emit_set_depth_stencil_view(struct wined3d_cs *cs, struct wined3d_rendertarget_view *view)
@@ -481,12 +648,14 @@ void wined3d_cs_emit_set_depth_stencil_view(struct wined3d_cs *cs, struct wined3
@@ -613,12 +780,14 @@ void wined3d_cs_emit_set_depth_stencil_view(struct wined3d_cs *cs, struct wined3
cs->ops->submit(cs);
}
@ -335,7 +338,7 @@ index a83459c..3bcbf19 100644
}
void wined3d_cs_emit_set_vertex_declaration(struct wined3d_cs *cs, struct wined3d_vertex_declaration *declaration)
@@ -500,7 +669,7 @@ void wined3d_cs_emit_set_vertex_declaration(struct wined3d_cs *cs, struct wined3
@@ -632,7 +801,7 @@ void wined3d_cs_emit_set_vertex_declaration(struct wined3d_cs *cs, struct wined3
cs->ops->submit(cs);
}
@ -344,7 +347,7 @@ index a83459c..3bcbf19 100644
{
const struct wined3d_cs_set_stream_source *op = data;
struct wined3d_stream_state *stream;
@@ -518,6 +687,8 @@ static void wined3d_cs_exec_set_stream_source(struct wined3d_cs *cs, const void
@@ -650,6 +819,8 @@ static void wined3d_cs_exec_set_stream_source(struct wined3d_cs *cs, const void
InterlockedDecrement(&prev->resource.bind_count);
device_invalidate_state(cs->device, STATE_STREAMSRC);
@ -353,7 +356,7 @@ index a83459c..3bcbf19 100644
}
void wined3d_cs_emit_set_stream_source(struct wined3d_cs *cs, UINT stream_idx,
@@ -535,7 +706,7 @@ void wined3d_cs_emit_set_stream_source(struct wined3d_cs *cs, UINT stream_idx,
@@ -667,7 +838,7 @@ void wined3d_cs_emit_set_stream_source(struct wined3d_cs *cs, UINT stream_idx,
cs->ops->submit(cs);
}
@ -362,7 +365,7 @@ index a83459c..3bcbf19 100644
{
const struct wined3d_cs_set_stream_source_freq *op = data;
struct wined3d_stream_state *stream;
@@ -545,6 +716,8 @@ static void wined3d_cs_exec_set_stream_source_freq(struct wined3d_cs *cs, const
@@ -677,6 +848,8 @@ static void wined3d_cs_exec_set_stream_source_freq(struct wined3d_cs *cs, const
stream->flags = op->flags;
device_invalidate_state(cs->device, STATE_STREAMSRC);
@ -371,7 +374,7 @@ index a83459c..3bcbf19 100644
}
void wined3d_cs_emit_set_stream_source_freq(struct wined3d_cs *cs, UINT stream_idx, UINT frequency, UINT flags)
@@ -560,7 +733,7 @@ void wined3d_cs_emit_set_stream_source_freq(struct wined3d_cs *cs, UINT stream_i
@@ -692,7 +865,7 @@ void wined3d_cs_emit_set_stream_source_freq(struct wined3d_cs *cs, UINT stream_i
cs->ops->submit(cs);
}
@ -380,7 +383,7 @@ index a83459c..3bcbf19 100644
{
const struct wined3d_cs_set_stream_output *op = data;
struct wined3d_stream_output *stream;
@@ -575,6 +748,8 @@ static void wined3d_cs_exec_set_stream_output(struct wined3d_cs *cs, const void
@@ -707,6 +880,8 @@ static void wined3d_cs_exec_set_stream_output(struct wined3d_cs *cs, const void
InterlockedIncrement(&op->buffer->resource.bind_count);
if (prev)
InterlockedDecrement(&prev->resource.bind_count);
@ -389,7 +392,7 @@ index a83459c..3bcbf19 100644
}
void wined3d_cs_emit_set_stream_output(struct wined3d_cs *cs, UINT stream_idx,
@@ -591,7 +766,7 @@ void wined3d_cs_emit_set_stream_output(struct wined3d_cs *cs, UINT stream_idx,
@@ -723,7 +898,7 @@ void wined3d_cs_emit_set_stream_output(struct wined3d_cs *cs, UINT stream_idx,
cs->ops->submit(cs);
}
@ -398,7 +401,7 @@ index a83459c..3bcbf19 100644
{
const struct wined3d_cs_set_index_buffer *op = data;
struct wined3d_buffer *prev;
@@ -607,6 +782,8 @@ static void wined3d_cs_exec_set_index_buffer(struct wined3d_cs *cs, const void *
@@ -739,6 +914,8 @@ static void wined3d_cs_exec_set_index_buffer(struct wined3d_cs *cs, const void *
InterlockedDecrement(&prev->resource.bind_count);
device_invalidate_state(cs->device, STATE_INDEXBUFFER);
@ -407,7 +410,7 @@ index a83459c..3bcbf19 100644
}
void wined3d_cs_emit_set_index_buffer(struct wined3d_cs *cs, struct wined3d_buffer *buffer,
@@ -623,7 +800,7 @@ void wined3d_cs_emit_set_index_buffer(struct wined3d_cs *cs, struct wined3d_buff
@@ -755,7 +932,7 @@ void wined3d_cs_emit_set_index_buffer(struct wined3d_cs *cs, struct wined3d_buff
cs->ops->submit(cs);
}
@ -416,7 +419,7 @@ index a83459c..3bcbf19 100644
{
const struct wined3d_cs_set_constant_buffer *op = data;
struct wined3d_buffer *prev;
@@ -637,6 +814,7 @@ static void wined3d_cs_exec_set_constant_buffer(struct wined3d_cs *cs, const voi
@@ -769,6 +946,7 @@ static void wined3d_cs_exec_set_constant_buffer(struct wined3d_cs *cs, const voi
InterlockedDecrement(&prev->resource.bind_count);
device_invalidate_state(cs->device, STATE_CONSTANT_BUFFER(op->type));
@ -424,7 +427,7 @@ index a83459c..3bcbf19 100644
}
void wined3d_cs_emit_set_constant_buffer(struct wined3d_cs *cs, enum wined3d_shader_type type,
@@ -653,7 +831,7 @@ void wined3d_cs_emit_set_constant_buffer(struct wined3d_cs *cs, enum wined3d_sha
@@ -785,7 +963,7 @@ void wined3d_cs_emit_set_constant_buffer(struct wined3d_cs *cs, enum wined3d_sha
cs->ops->submit(cs);
}
@ -433,7 +436,7 @@ index a83459c..3bcbf19 100644
{
const struct wined3d_gl_info *gl_info = &cs->device->adapter->gl_info;
const struct wined3d_d3d_info *d3d_info = &cs->device->adapter->d3d_info;
@@ -730,6 +908,8 @@ static void wined3d_cs_exec_set_texture(struct wined3d_cs *cs, const void *data)
@@ -862,6 +1040,8 @@ static void wined3d_cs_exec_set_texture(struct wined3d_cs *cs, const void *data)
if (new_use_color_key)
device_invalidate_state(cs->device, STATE_COLOR_KEY);
@ -442,7 +445,7 @@ index a83459c..3bcbf19 100644
}
void wined3d_cs_emit_set_texture(struct wined3d_cs *cs, UINT stage, struct wined3d_texture *texture)
@@ -744,12 +924,14 @@ void wined3d_cs_emit_set_texture(struct wined3d_cs *cs, UINT stage, struct wined
@@ -876,12 +1056,14 @@ void wined3d_cs_emit_set_texture(struct wined3d_cs *cs, UINT stage, struct wined
cs->ops->submit(cs);
}
@ -458,7 +461,7 @@ index a83459c..3bcbf19 100644
}
void wined3d_cs_emit_set_shader_resource_view(struct wined3d_cs *cs, enum wined3d_shader_type type,
@@ -766,12 +948,14 @@ void wined3d_cs_emit_set_shader_resource_view(struct wined3d_cs *cs, enum wined3
@@ -898,12 +1080,14 @@ void wined3d_cs_emit_set_shader_resource_view(struct wined3d_cs *cs, enum wined3
cs->ops->submit(cs);
}
@ -474,7 +477,7 @@ index a83459c..3bcbf19 100644
}
void wined3d_cs_emit_set_sampler(struct wined3d_cs *cs, enum wined3d_shader_type type,
@@ -788,13 +972,15 @@ void wined3d_cs_emit_set_sampler(struct wined3d_cs *cs, enum wined3d_shader_type
@@ -920,13 +1104,15 @@ void wined3d_cs_emit_set_sampler(struct wined3d_cs *cs, enum wined3d_shader_type
cs->ops->submit(cs);
}
@ -491,7 +494,7 @@ index a83459c..3bcbf19 100644
}
void wined3d_cs_emit_set_shader(struct wined3d_cs *cs, enum wined3d_shader_type type, struct wined3d_shader *shader)
@@ -809,12 +995,14 @@ void wined3d_cs_emit_set_shader(struct wined3d_cs *cs, enum wined3d_shader_type
@@ -941,12 +1127,14 @@ void wined3d_cs_emit_set_shader(struct wined3d_cs *cs, enum wined3d_shader_type
cs->ops->submit(cs);
}
@ -507,7 +510,7 @@ index a83459c..3bcbf19 100644
}
void wined3d_cs_emit_set_render_state(struct wined3d_cs *cs, enum wined3d_render_state state, DWORD value)
@@ -829,12 +1017,14 @@ void wined3d_cs_emit_set_render_state(struct wined3d_cs *cs, enum wined3d_render
@@ -961,12 +1149,14 @@ void wined3d_cs_emit_set_render_state(struct wined3d_cs *cs, enum wined3d_render
cs->ops->submit(cs);
}
@ -523,7 +526,7 @@ index a83459c..3bcbf19 100644
}
void wined3d_cs_emit_set_texture_state(struct wined3d_cs *cs, UINT stage,
@@ -851,12 +1041,14 @@ void wined3d_cs_emit_set_texture_state(struct wined3d_cs *cs, UINT stage,
@@ -983,12 +1173,14 @@ void wined3d_cs_emit_set_texture_state(struct wined3d_cs *cs, UINT stage,
cs->ops->submit(cs);
}
@ -539,7 +542,7 @@ index a83459c..3bcbf19 100644
}
void wined3d_cs_emit_set_sampler_state(struct wined3d_cs *cs, UINT sampler_idx,
@@ -873,13 +1065,15 @@ void wined3d_cs_emit_set_sampler_state(struct wined3d_cs *cs, UINT sampler_idx,
@@ -1005,13 +1197,15 @@ void wined3d_cs_emit_set_sampler_state(struct wined3d_cs *cs, UINT sampler_idx,
cs->ops->submit(cs);
}
@ -556,7 +559,7 @@ index a83459c..3bcbf19 100644
}
void wined3d_cs_emit_set_transform(struct wined3d_cs *cs, enum wined3d_transform_state state,
@@ -895,12 +1089,14 @@ void wined3d_cs_emit_set_transform(struct wined3d_cs *cs, enum wined3d_transform
@@ -1027,12 +1221,14 @@ void wined3d_cs_emit_set_transform(struct wined3d_cs *cs, enum wined3d_transform
cs->ops->submit(cs);
}
@ -572,7 +575,7 @@ index a83459c..3bcbf19 100644
}
void wined3d_cs_emit_set_clip_plane(struct wined3d_cs *cs, UINT plane_idx, const struct wined3d_vec4 *plane)
@@ -915,7 +1111,7 @@ void wined3d_cs_emit_set_clip_plane(struct wined3d_cs *cs, UINT plane_idx, const
@@ -1047,7 +1243,7 @@ void wined3d_cs_emit_set_clip_plane(struct wined3d_cs *cs, UINT plane_idx, const
cs->ops->submit(cs);
}
@ -581,7 +584,7 @@ index a83459c..3bcbf19 100644
{
const struct wined3d_cs_set_color_key *op = data;
struct wined3d_texture *texture = op->texture;
@@ -976,6 +1172,8 @@ static void wined3d_cs_exec_set_color_key(struct wined3d_cs *cs, const void *dat
@@ -1108,6 +1304,8 @@ static void wined3d_cs_exec_set_color_key(struct wined3d_cs *cs, const void *dat
break;
}
}
@ -590,7 +593,7 @@ index a83459c..3bcbf19 100644
}
void wined3d_cs_emit_set_color_key(struct wined3d_cs *cs, struct wined3d_texture *texture,
@@ -998,12 +1196,14 @@ void wined3d_cs_emit_set_color_key(struct wined3d_cs *cs, struct wined3d_texture
@@ -1130,12 +1328,14 @@ void wined3d_cs_emit_set_color_key(struct wined3d_cs *cs, struct wined3d_texture
cs->ops->submit(cs);
}
@ -606,7 +609,7 @@ index a83459c..3bcbf19 100644
}
void wined3d_cs_emit_set_material(struct wined3d_cs *cs, const struct wined3d_material *material)
@@ -1017,7 +1217,7 @@ void wined3d_cs_emit_set_material(struct wined3d_cs *cs, const struct wined3d_ma
@@ -1149,7 +1349,7 @@ void wined3d_cs_emit_set_material(struct wined3d_cs *cs, const struct wined3d_ma
cs->ops->submit(cs);
}
@ -615,7 +618,7 @@ index a83459c..3bcbf19 100644
{
struct wined3d_adapter *adapter = cs->device->adapter;
HRESULT hr;
@@ -1027,6 +1227,8 @@ static void wined3d_cs_exec_reset_state(struct wined3d_cs *cs, const void *data)
@@ -1159,6 +1359,8 @@ static void wined3d_cs_exec_reset_state(struct wined3d_cs *cs, const void *data)
if (FAILED(hr = state_init(&cs->state, &adapter->gl_info, &adapter->d3d_info,
WINED3D_STATE_NO_REF | WINED3D_STATE_INIT_DEFAULT)))
ERR("Failed to initialize CS state, hr %#x.\n", hr);
@ -624,7 +627,7 @@ index a83459c..3bcbf19 100644
}
void wined3d_cs_emit_reset_state(struct wined3d_cs *cs)
@@ -1039,11 +1241,13 @@ void wined3d_cs_emit_reset_state(struct wined3d_cs *cs)
@@ -1171,11 +1373,13 @@ void wined3d_cs_emit_reset_state(struct wined3d_cs *cs)
cs->ops->submit(cs);
}
@ -639,7 +642,7 @@ index a83459c..3bcbf19 100644
}
void wined3d_cs_emit_destroy_object(struct wined3d_cs *cs, void (*callback)(void *object), void *object)
@@ -1058,8 +1262,9 @@ void wined3d_cs_emit_destroy_object(struct wined3d_cs *cs, void (*callback)(void
@@ -1190,8 +1394,9 @@ void wined3d_cs_emit_destroy_object(struct wined3d_cs *cs, void (*callback)(void
cs->ops->submit(cs);
}
@ -650,7 +653,7 @@ index a83459c..3bcbf19 100644
/* WINED3D_CS_OP_PRESENT */ wined3d_cs_exec_present,
/* WINED3D_CS_OP_CLEAR */ wined3d_cs_exec_clear,
/* WINED3D_CS_OP_DRAW */ wined3d_cs_exec_draw,
@@ -1119,6 +1324,58 @@ static const struct wined3d_cs_ops wined3d_cs_st_ops =
@@ -1251,6 +1456,58 @@ static const struct wined3d_cs_ops wined3d_cs_st_ops =
wined3d_cs_st_submit,
};
@ -709,7 +712,7 @@ index a83459c..3bcbf19 100644
struct wined3d_cs *wined3d_cs_create(struct wined3d_device *device)
{
const struct wined3d_gl_info *gl_info = &device->adapter->gl_info;
@@ -1145,12 +1402,60 @@ struct wined3d_cs *wined3d_cs_create(struct wined3d_device *device)
@@ -1277,12 +1534,60 @@ struct wined3d_cs *wined3d_cs_create(struct wined3d_device *device)
return NULL;
}
@ -798,7 +801,7 @@ index 1dd6a8b..f573dcb 100644
if (appkey) RegCloseKey( appkey );
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index edb4399..29f218e 100644
index 90629cf..cf28daf 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -310,6 +310,7 @@ struct wined3d_settings
@ -809,7 +812,7 @@ index edb4399..29f218e 100644
};
extern struct wined3d_settings wined3d_settings DECLSPEC_HIDDEN;
@@ -2921,6 +2922,18 @@ HRESULT state_init(struct wined3d_state *state, const struct wined3d_gl_info *gl
@@ -2980,6 +2981,18 @@ HRESULT state_init(struct wined3d_state *state, const struct wined3d_gl_info *gl
const struct wined3d_d3d_info *d3d_info, DWORD flags) DECLSPEC_HIDDEN;
void state_unbind_resources(struct wined3d_state *state) DECLSPEC_HIDDEN;
@ -828,7 +831,7 @@ index edb4399..29f218e 100644
struct wined3d_cs_ops
{
void *(*require_space)(struct wined3d_cs *cs, size_t size);
@@ -2932,9 +2945,14 @@ struct wined3d_cs
@@ -2991,9 +3004,14 @@ struct wined3d_cs
const struct wined3d_cs_ops *ops;
struct wined3d_device *device;
struct wined3d_state state;

View File

@ -1,4 +1,4 @@
From 6dab3b97a20b3b51219c2158309a303cd98898cb Mon Sep 17 00:00:00 2001
From 330cbea98b08af677c052b2491475a14f3e8e937 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20D=C3=B6singer?= <stefan@codeweavers.com>
Date: Wed, 3 Apr 2013 18:01:34 +0200
Subject: wined3d: Wait for the cs before destroying objects
@ -7,17 +7,15 @@ This is to avoid destroying objects that are still referenced in
commands in the cs. Later patches will migrate resource destruction to
the CS.
---
dlls/wined3d/buffer.c | 6 ++++++
dlls/wined3d/cs.c | 2 ++
dlls/wined3d/texture.c | 6 ++++++
dlls/wined3d/wined3d_private.h | 1 +
4 files changed, 15 insertions(+)
2 files changed, 3 insertions(+)
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
index 3bcbf19..185def9 100644
index ce3f475..6226cea 100644
--- a/dlls/wined3d/cs.c
+++ b/dlls/wined3d/cs.c
@@ -1322,12 +1322,14 @@ static const struct wined3d_cs_ops wined3d_cs_st_ops =
@@ -1454,12 +1454,14 @@ static const struct wined3d_cs_ops wined3d_cs_st_ops =
{
wined3d_cs_st_require_space,
wined3d_cs_st_submit,
@ -33,10 +31,10 @@ index 3bcbf19..185def9 100644
/* FIXME: wined3d_device_uninit_3d() should either flush and wait, or be an
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index cedb36d..e88f172 100644
index cf28daf..fafc1cb 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -2981,6 +2981,7 @@ struct wined3d_cs_ops
@@ -2997,6 +2997,7 @@ struct wined3d_cs_ops
{
void *(*require_space)(struct wined3d_cs *cs, size_t size);
void (*submit)(struct wined3d_cs *cs);

View File

@ -1,4 +1,4 @@
From d9d7cda0f5c3aae336843cceddecb3464db7e4f2 Mon Sep 17 00:00:00 2001
From 1236a4b57b6e2ce2a5a22e8ac1a88a048fed0a62 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
@ -10,7 +10,7 @@ Subject: wined3d: Give the cs its own state
3 files changed, 81 insertions(+), 17 deletions(-)
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
index 185def9..b128af1 100644
index 6226cea..d7895ca 100644
--- a/dlls/wined3d/cs.c
+++ b/dlls/wined3d/cs.c
@@ -64,6 +64,7 @@ enum wined3d_cs_op
@ -34,25 +34,25 @@ index 185def9..b128af1 100644
/* 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)
{
@@ -447,7 +454,7 @@ static UINT wined3d_cs_exec_clear(struct wined3d_cs *cs, const void *data)
@@ -463,7 +470,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;
- wined3d_get_draw_rect(&device->state, &draw_rect);
+ wined3d_get_draw_rect(&cs->state, &draw_rect);
- state = &device->state;
+ 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,
&op->color, op->depth, op->stencil);
@@ -474,7 +481,7 @@ void wined3d_cs_emit_clear(struct wined3d_cs *cs, DWORD rect_count, const RECT *
@@ -515,7 +522,7 @@ void wined3d_cs_emit_clear(struct wined3d_cs *cs, DWORD rect_count, const RECT *
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;
if (!cs->device->adapter->gl_info.supported[ARB_DRAW_ELEMENTS_BASE_VERTEX]
@@ -920,6 +927,55 @@ void wined3d_cs_emit_set_texture(struct wined3d_cs *cs, UINT stage, struct wined
@@ -1052,6 +1059,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;
@ -108,7 +108,7 @@ index 185def9..b128af1 100644
cs->ops->submit(cs);
}
@@ -1292,6 +1348,7 @@ static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void
@@ -1424,6 +1480,7 @@ static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void
/* WINED3D_CS_OP_SET_MATERIAL */ wined3d_cs_exec_set_material,
/* WINED3D_CS_OP_RESET_STATE */ wined3d_cs_exec_reset_state,
/* WINED3D_CS_OP_DESTROY_OBJECT */ wined3d_cs_exec_destroy_object,
@ -116,7 +116,7 @@ index 185def9..b128af1 100644
};
static void *wined3d_cs_st_require_space(struct wined3d_cs *cs, size_t size)
@@ -1381,7 +1438,7 @@ done:
@@ -1513,7 +1570,7 @@ done:
struct wined3d_cs *wined3d_cs_create(struct wined3d_device *device)
{
const struct wined3d_gl_info *gl_info = &device->adapter->gl_info;
@ -125,7 +125,7 @@ index 185def9..b128af1 100644
if (!(cs = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*cs))))
return NULL;
@@ -1389,8 +1446,7 @@ struct wined3d_cs *wined3d_cs_create(struct wined3d_device *device)
@@ -1521,8 +1578,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)))
{
@ -135,7 +135,7 @@ index 185def9..b128af1 100644
}
cs->ops = &wined3d_cs_st_ops;
@@ -1399,17 +1455,13 @@ struct wined3d_cs *wined3d_cs_create(struct wined3d_device *device)
@@ -1531,17 +1587,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)))
{
@ -155,7 +155,7 @@ index 185def9..b128af1 100644
}
if (wined3d_settings.cs_multithreaded)
@@ -1422,15 +1474,22 @@ struct wined3d_cs *wined3d_cs_create(struct wined3d_device *device)
@@ -1554,15 +1606,22 @@ struct wined3d_cs *wined3d_cs_create(struct wined3d_device *device)
if (!(cs->thread = CreateThread(NULL, 0, wined3d_cs_run, cs, 0, NULL)))
{
ERR("Failed to create wined3d command stream thread.\n");
@ -184,7 +184,7 @@ index 185def9..b128af1 100644
void wined3d_cs_destroy(struct wined3d_cs *cs)
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index d48fbfa..33b7fc3 100644
index 3461343..36efae2 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -3519,6 +3519,7 @@ HRESULT CDECL wined3d_device_draw_primitive(struct wined3d_device *device, UINT
@ -212,10 +212,10 @@ index d48fbfa..33b7fc3 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 d4903f7..f27dc4e 100644
index fafc1cb..4e39d98 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -2917,7 +2917,7 @@ struct wined3d_cs_block
@@ -2990,7 +2990,7 @@ struct wined3d_cs_block
{
struct list entry;
UINT pos;
@ -224,7 +224,7 @@ index d4903f7..f27dc4e 100644
};
struct wined3d_cs_ops
@@ -2960,6 +2960,8 @@ void wined3d_cs_emit_set_color_key(struct wined3d_cs *cs, struct wined3d_texture
@@ -3033,6 +3033,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;

View File

@ -1,4 +1,4 @@
From 588edfad4fcfed3a22a0156e66d2409a437e3f96 Mon Sep 17 00:00:00 2001
From 93e6c6e06461428cb9250bb04693e870cf1970b1 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20D=C3=B6singer?= <stefan@codeweavers.com>
Date: Thu, 4 Apr 2013 14:52:24 +0200
Subject: wined3d: Pass the depth stencil to swapchain->present
@ -12,10 +12,10 @@ DS or the implicit DS.
3 files changed, 11 insertions(+), 8 deletions(-)
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
index aefd308..e89445a 100644
index 02489fd..524fb45 100644
--- a/dlls/wined3d/cs.c
+++ b/dlls/wined3d/cs.c
@@ -431,7 +431,8 @@ static UINT wined3d_cs_exec_present(struct wined3d_cs *cs, const void *data)
@@ -442,7 +442,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);
@ -23,10 +23,10 @@ index aefd308..e89445a 100644
+ swapchain->swapchain_ops->swapchain_present(swapchain, &op->src_rect, &op->dst_rect, op->flags,
+ cs->state.fb.depth_stencil);
return sizeof(*op);
}
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 f25edc7..7a85b65 100644
index cb4d8b8..253ad66 100644
--- a/dlls/wined3d/swapchain.c
+++ b/dlls/wined3d/swapchain.c
@@ -478,10 +478,10 @@ static void wined3d_swapchain_rotate(struct wined3d_swapchain *swapchain, struct
@ -61,7 +61,7 @@ index f25edc7..7a85b65 100644
if (ds == swapchain->device->onscreen_depth_stencil)
{
wined3d_texture_decref(swapchain->device->onscreen_depth_stencil->container);
@@ -700,7 +700,8 @@ static void swapchain_gdi_frontbuffer_updated(struct wined3d_swapchain *swapchai
@@ -698,7 +698,8 @@ static void swapchain_gdi_frontbuffer_updated(struct wined3d_swapchain *swapchai
}
static void swapchain_gdi_present(struct wined3d_swapchain *swapchain,
@ -72,10 +72,10 @@ index f25edc7..7a85b65 100644
struct wined3d_surface *front, *back;
HBITMAP bitmap;
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index f0e9863..6388c16 100644
index 9089724..a6b6f80 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -3079,7 +3079,8 @@ struct wined3d_shader_resource_view
@@ -3216,7 +3216,8 @@ struct wined3d_unordered_access_view
struct wined3d_swapchain_ops
{
void (*swapchain_present)(struct wined3d_swapchain *swapchain,

View File

@ -1,4 +1,4 @@
From cd87357f0b178411a5290b836ce1bd5689e1816f Mon Sep 17 00:00:00 2001
From 2395e19d3954fa806523a7353275bc635fcbe73c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20D=C3=B6singer?= <stefan@codeweavers.com>
Date: Sun, 7 Apr 2013 17:33:20 +0200
Subject: wined3d: Send base vertex index updates through the cs
@ -10,10 +10,10 @@ Subject: wined3d: Send base vertex index updates through the cs
3 files changed, 50 insertions(+), 2 deletions(-)
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
index 3d2c4e3..14032bc 100644
index a68e9e6..0a3780b 100644
--- a/dlls/wined3d/cs.c
+++ b/dlls/wined3d/cs.c
@@ -67,6 +67,7 @@ enum wined3d_cs_op
@@ -68,6 +68,7 @@ enum wined3d_cs_op
WINED3D_CS_OP_SET_VS_CONSTS_F,
WINED3D_CS_OP_SET_PS_CONSTS_F,
WINED3D_CS_OP_GLFINISH,
@ -21,7 +21,7 @@ index 3d2c4e3..14032bc 100644
WINED3D_CS_OP_STOP,
};
@@ -298,6 +299,12 @@ struct wined3d_cs_finish
@@ -306,6 +307,12 @@ struct wined3d_cs_finish
enum wined3d_cs_op opcode;
};
@ -34,12 +34,14 @@ index 3d2c4e3..14032bc 100644
/* 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,6 +499,21 @@ static UINT wined3d_cs_exec_draw(struct wined3d_cs *cs, const void *data)
{
struct wined3d_state *state = &cs->state;
@@ -543,9 +550,24 @@ static UINT wined3d_cs_exec_draw(struct wined3d_cs *cs, const void *data)
struct wined3d_shader_sampler_map_entry *entry;
struct wined3d_shader_resource_view *view;
const struct wined3d_cs_draw *op = data;
+ const struct wined3d_gl_info *gl_info = &cs->device->adapter->gl_info;
+
struct wined3d_shader *shader;
unsigned int i, j;
+ if (op->indexed && !gl_info->supported[ARB_DRAW_ELEMENTS_BASE_VERTEX])
+ {
+ if (cs->state.load_base_vertex_index != cs->state.base_vertex_index)
@ -53,10 +55,11 @@ index 3d2c4e3..14032bc 100644
+ cs->state.load_base_vertex_index = 0;
+ device_invalidate_state(cs->device, STATE_BASEVERTEXINDEX);
+ }
+
if (!cs->device->adapter->gl_info.supported[ARB_DRAW_ELEMENTS_BASE_VERTEX]
&& state->load_base_vertex_index != op->base_vertex_idx)
@@ -946,7 +968,6 @@ static UINT wined3d_cs_exec_transfer_stateblock(struct wined3d_cs *cs, const voi
{
@@ -1086,7 +1108,6 @@ static UINT wined3d_cs_exec_transfer_stateblock(struct wined3d_cs *cs, const voi
/* Don't memcpy the entire struct, we'll remove single items as we add dedicated
* ops for setting states */
@ -64,7 +67,7 @@ index 3d2c4e3..14032bc 100644
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));
@@ -969,7 +990,6 @@ void wined3d_cs_emit_transfer_stateblock(struct wined3d_cs *cs, const struct win
@@ -1109,7 +1130,6 @@ void wined3d_cs_emit_transfer_stateblock(struct wined3d_cs *cs, const struct win
/* Don't memcpy the entire struct, we'll remove single items as we add dedicated
* ops for setting states */
@ -72,7 +75,7 @@ index 3d2c4e3..14032bc 100644
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));
@@ -1383,6 +1403,28 @@ void wined3d_cs_emit_glfinish(struct wined3d_cs *cs)
@@ -1545,6 +1565,28 @@ void wined3d_cs_emit_glfinish(struct wined3d_cs *cs)
cs->ops->submit(cs);
}
@ -101,7 +104,7 @@ index 3d2c4e3..14032bc 100644
static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void *data) =
{
/* WINED3D_CS_OP_FENCE */ wined3d_cs_exec_fence,
@@ -1416,6 +1458,7 @@ static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void
@@ -1579,6 +1621,7 @@ static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void
/* WINED3D_CS_OP_SET_VS_CONSTS_F */ wined3d_cs_exec_set_vs_consts_f,
/* WINED3D_CS_OP_SET_PS_CONSTS_F */ wined3d_cs_exec_set_ps_consts_f,
/* WINED3D_CS_OP_GLFINISH */ wined3d_cs_exec_glfinish,
@ -110,7 +113,7 @@ index 3d2c4e3..14032bc 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 e90588c..1df5cab 100644
index 7a43657..fcb8d7e 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -1987,6 +1987,9 @@ void CDECL wined3d_device_set_base_vertex_index(struct wined3d_device *device, I
@ -124,10 +127,10 @@ index e90588c..1df5cab 100644
INT CDECL wined3d_device_get_base_vertex_index(const struct wined3d_device *device)
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index b5f7937..6fe7b09 100644
index a325ee2..db70629 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -2995,6 +2995,8 @@ void wined3d_cs_emit_set_viewport(struct wined3d_cs *cs, const struct wined3d_vi
@@ -3070,6 +3070,8 @@ void wined3d_cs_emit_set_viewport(struct wined3d_cs *cs, const struct wined3d_vi
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_glfinish(struct wined3d_cs *cs) DECLSPEC_HIDDEN;

View File

@ -1,4 +1,4 @@
From ed255dd2796f1f6c5dfa6053256f4f2a4b43d7e9 Mon Sep 17 00:00:00 2001
From 902b45818f4c0d733065be2e253d8a39f41b1cfe 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,29 +9,29 @@ Subject: wined3d: Prevent the command stream from running ahead too far
2 files changed, 10 insertions(+)
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
index 85337db..c7bb109 100644
index 00c26b4..509ed82 100644
--- a/dlls/wined3d/cs.c
+++ b/dlls/wined3d/cs.c
@@ -473,6 +473,8 @@ static UINT wined3d_cs_exec_present(struct wined3d_cs *cs, const void *data)
@@ -487,6 +487,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);
+ InterlockedDecrement(&cs->pending_presents);
+
return sizeof(*op);
}
@@ -480,6 +482,7 @@ void wined3d_cs_emit_present(struct wined3d_cs *cs, struct wined3d_swapchain *sw
const RECT *src_rect, const RECT *dst_rect, HWND dst_window_override, DWORD flags)
wined3d_resource_release(&swapchain->front_buffer->resource);
for (i = 0; i < swapchain->desc.backbuffer_count; ++i)
{
@@ -501,6 +503,7 @@ void wined3d_cs_emit_present(struct wined3d_cs *cs, struct wined3d_swapchain *sw
{
struct wined3d_cs_present *op;
unsigned int i;
+ LONG pending;
op = cs->ops->require_space(cs, sizeof(*op));
op->opcode = WINED3D_CS_OP_PRESENT;
@@ -489,7 +492,12 @@ void wined3d_cs_emit_present(struct wined3d_cs *cs, struct wined3d_swapchain *sw
op->dst_rect = *dst_rect;
op->flags = flags;
@@ -516,7 +519,12 @@ void wined3d_cs_emit_present(struct wined3d_cs *cs, struct wined3d_swapchain *sw
wined3d_resource_acquire(&swapchain->back_buffers[i]->resource);
}
+ pending = InterlockedIncrement(&cs->pending_presents);
+
@ -43,10 +43,10 @@ index 85337db..c7bb109 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 a085783..925a326 100644
index 76c7fbf..b49ceaf 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -2894,6 +2894,8 @@ struct wined3d_cs
@@ -3012,6 +3012,8 @@ struct wined3d_cs
struct wined3d_cs_list free_list;
struct wined3d_cs_list exec_list;

View File

@ -1,4 +1,4 @@
From 3ffcccfe4b97290f5a206933ce25b0737806066b Mon Sep 17 00:00:00 2001
From 378d4c2fbd1babfcfa29255353300743f6f2ba43 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20D=C3=B6singer?= <stefan@codeweavers.com>
Date: Thu, 4 Jul 2013 23:33:14 +0200
Subject: wined3d: Replace the linked lists with a ringbuffer
@ -9,7 +9,7 @@ Subject: wined3d: Replace the linked lists with a ringbuffer
2 files changed, 162 insertions(+), 223 deletions(-)
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
index 68c7142..d1eb571 100644
index 03f7916..229be26 100644
--- a/dlls/wined3d/cs.c
+++ b/dlls/wined3d/cs.c
@@ -22,20 +22,10 @@
@ -166,7 +166,7 @@ index 68c7142..d1eb571 100644
/* A busy wait should be fine, we're not supposed to have to wait very
* long. */
@@ -551,7 +472,7 @@ void wined3d_cs_emit_present(struct wined3d_cs *cs, struct wined3d_swapchain *sw
@@ -565,7 +486,7 @@ void wined3d_cs_emit_present(struct wined3d_cs *cs, struct wined3d_swapchain *sw
pending = InterlockedIncrement(&cs->pending_presents);
@ -175,10 +175,10 @@ index 68c7142..d1eb571 100644
while (pending > 1)
pending = InterlockedCompareExchange(&cs->pending_presents, 0, 0);
@@ -577,8 +498,8 @@ void wined3d_cs_emit_clear(struct wined3d_cs *cs, DWORD rect_count, const RECT *
DWORD flags, const struct wined3d_color *color, float depth, DWORD stencil)
{
@@ -607,8 +528,8 @@ void wined3d_cs_emit_clear(struct wined3d_cs *cs, DWORD rect_count, const RECT *
const struct wined3d_state *state = &cs->device->state;
struct wined3d_cs_clear *op;
unsigned int i;
-
- op = cs->ops->require_space(cs, FIELD_OFFSET(struct wined3d_cs_clear, rects[rect_count]));
+ size_t size = FIELD_OFFSET(struct wined3d_cs_clear, rects[rect_count]);
@ -186,25 +186,25 @@ index 68c7142..d1eb571 100644
op->opcode = WINED3D_CS_OP_CLEAR;
op->flags = flags;
op->color = *color;
@@ -587,7 +508,7 @@ void wined3d_cs_emit_clear(struct wined3d_cs *cs, DWORD rect_count, const RECT *
op->rect_count = rect_count;
memcpy(op->rects, rects, sizeof(*rects) * rect_count);
@@ -628,7 +549,7 @@ void wined3d_cs_emit_clear(struct wined3d_cs *cs, DWORD rect_count, const RECT *
if (flags & (WINED3DCLEAR_ZBUFFER | WINED3DCLEAR_STENCIL))
wined3d_resource_acquire(state->fb.depth_stencil->resource);
- cs->ops->submit(cs);
+ cs->ops->submit(cs, size);
}
static UINT wined3d_cs_exec_draw(struct wined3d_cs *cs, const void *data)
@@ -637,7 +558,7 @@ void wined3d_cs_emit_draw(struct wined3d_cs *cs, int base_vertex_idx, unsigned i
op->instance_count = instance_count;
op->indexed = indexed;
@@ -769,7 +690,7 @@ void wined3d_cs_emit_draw(struct wined3d_cs *cs, int base_vertex_idx, unsigned i
}
}
- cs->ops->submit(cs);
+ cs->ops->submit(cs, sizeof(*op));
}
static UINT wined3d_cs_exec_set_predication(struct wined3d_cs *cs, const void *data)
@@ -659,7 +580,7 @@ void wined3d_cs_emit_set_predication(struct wined3d_cs *cs, struct wined3d_query
@@ -791,7 +712,7 @@ void wined3d_cs_emit_set_predication(struct wined3d_cs *cs, struct wined3d_query
op->predicate = predicate;
op->value = value;
@ -213,7 +213,7 @@ index 68c7142..d1eb571 100644
}
static UINT wined3d_cs_exec_set_viewport(struct wined3d_cs *cs, const void *data)
@@ -680,7 +601,7 @@ void wined3d_cs_emit_set_viewport(struct wined3d_cs *cs, const struct wined3d_vi
@@ -812,7 +733,7 @@ void wined3d_cs_emit_set_viewport(struct wined3d_cs *cs, const struct wined3d_vi
op->opcode = WINED3D_CS_OP_SET_VIEWPORT;
op->viewport = *viewport;
@ -222,7 +222,7 @@ index 68c7142..d1eb571 100644
}
static UINT wined3d_cs_exec_set_scissor_rect(struct wined3d_cs *cs, const void *data)
@@ -701,7 +622,7 @@ void wined3d_cs_emit_set_scissor_rect(struct wined3d_cs *cs, const RECT *rect)
@@ -833,7 +754,7 @@ void wined3d_cs_emit_set_scissor_rect(struct wined3d_cs *cs, const RECT *rect)
op->opcode = WINED3D_CS_OP_SET_SCISSOR_RECT;
op->rect = *rect;
@ -231,7 +231,7 @@ index 68c7142..d1eb571 100644
}
static UINT wined3d_cs_exec_set_rendertarget_view(struct wined3d_cs *cs, const void *data)
@@ -724,7 +645,7 @@ void wined3d_cs_emit_set_rendertarget_view(struct wined3d_cs *cs, unsigned int v
@@ -856,7 +777,7 @@ void wined3d_cs_emit_set_rendertarget_view(struct wined3d_cs *cs, unsigned int v
op->view_idx = view_idx;
op->view = view;
@ -240,7 +240,7 @@ index 68c7142..d1eb571 100644
}
static UINT wined3d_cs_exec_set_depth_stencil_view(struct wined3d_cs *cs, const void *data)
@@ -778,7 +699,7 @@ void wined3d_cs_emit_set_depth_stencil_view(struct wined3d_cs *cs, struct wined3
@@ -910,7 +831,7 @@ void wined3d_cs_emit_set_depth_stencil_view(struct wined3d_cs *cs, struct wined3
op->opcode = WINED3D_CS_OP_SET_DEPTH_STENCIL_VIEW;
op->view = view;
@ -249,7 +249,7 @@ index 68c7142..d1eb571 100644
}
static UINT wined3d_cs_exec_set_vertex_declaration(struct wined3d_cs *cs, const void *data)
@@ -799,7 +720,7 @@ void wined3d_cs_emit_set_vertex_declaration(struct wined3d_cs *cs, struct wined3
@@ -931,7 +852,7 @@ void wined3d_cs_emit_set_vertex_declaration(struct wined3d_cs *cs, struct wined3
op->opcode = WINED3D_CS_OP_SET_VERTEX_DECLARATION;
op->declaration = declaration;
@ -258,7 +258,7 @@ index 68c7142..d1eb571 100644
}
static UINT wined3d_cs_exec_set_stream_source(struct wined3d_cs *cs, const void *data)
@@ -836,7 +757,7 @@ void wined3d_cs_emit_set_stream_source(struct wined3d_cs *cs, UINT stream_idx,
@@ -968,7 +889,7 @@ void wined3d_cs_emit_set_stream_source(struct wined3d_cs *cs, UINT stream_idx,
op->offset = offset;
op->stride = stride;
@ -267,7 +267,7 @@ index 68c7142..d1eb571 100644
}
static UINT wined3d_cs_exec_set_stream_source_freq(struct wined3d_cs *cs, const void *data)
@@ -863,7 +784,7 @@ void wined3d_cs_emit_set_stream_source_freq(struct wined3d_cs *cs, UINT stream_i
@@ -995,7 +916,7 @@ void wined3d_cs_emit_set_stream_source_freq(struct wined3d_cs *cs, UINT stream_i
op->frequency = frequency;
op->flags = flags;
@ -276,7 +276,7 @@ index 68c7142..d1eb571 100644
}
static UINT wined3d_cs_exec_set_stream_output(struct wined3d_cs *cs, const void *data)
@@ -896,7 +817,7 @@ void wined3d_cs_emit_set_stream_output(struct wined3d_cs *cs, UINT stream_idx,
@@ -1028,7 +949,7 @@ void wined3d_cs_emit_set_stream_output(struct wined3d_cs *cs, UINT stream_idx,
op->buffer = buffer;
op->offset = offset;
@ -285,7 +285,7 @@ index 68c7142..d1eb571 100644
}
static UINT wined3d_cs_exec_set_index_buffer(struct wined3d_cs *cs, const void *data)
@@ -930,7 +851,7 @@ void wined3d_cs_emit_set_index_buffer(struct wined3d_cs *cs, struct wined3d_buff
@@ -1062,7 +983,7 @@ void wined3d_cs_emit_set_index_buffer(struct wined3d_cs *cs, struct wined3d_buff
op->format_id = format_id;
op->offset = offset;
@ -294,7 +294,7 @@ index 68c7142..d1eb571 100644
}
static UINT wined3d_cs_exec_set_constant_buffer(struct wined3d_cs *cs, const void *data)
@@ -961,7 +882,7 @@ void wined3d_cs_emit_set_constant_buffer(struct wined3d_cs *cs, enum wined3d_sha
@@ -1093,7 +1014,7 @@ void wined3d_cs_emit_set_constant_buffer(struct wined3d_cs *cs, enum wined3d_sha
op->cb_idx = cb_idx;
op->buffer = buffer;
@ -303,7 +303,7 @@ index 68c7142..d1eb571 100644
}
static UINT wined3d_cs_exec_set_texture(struct wined3d_cs *cs, const void *data)
@@ -1053,7 +974,7 @@ void wined3d_cs_emit_set_texture(struct wined3d_cs *cs, UINT stage, struct wined
@@ -1185,7 +1106,7 @@ 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;
@ -312,7 +312,7 @@ index 68c7142..d1eb571 100644
}
static UINT wined3d_cs_exec_set_shader_resource_view(struct wined3d_cs *cs, const void *data)
@@ -1077,7 +998,7 @@ void wined3d_cs_emit_set_shader_resource_view(struct wined3d_cs *cs, enum wined3
@@ -1209,7 +1130,7 @@ void wined3d_cs_emit_set_shader_resource_view(struct wined3d_cs *cs, enum wined3
op->view_idx = view_idx;
op->view = view;
@ -321,7 +321,7 @@ index 68c7142..d1eb571 100644
}
static UINT wined3d_cs_exec_set_sampler(struct wined3d_cs *cs, const void *data)
@@ -1101,7 +1022,7 @@ void wined3d_cs_emit_set_sampler(struct wined3d_cs *cs, enum wined3d_shader_type
@@ -1233,7 +1154,7 @@ void wined3d_cs_emit_set_sampler(struct wined3d_cs *cs, enum wined3d_shader_type
op->sampler_idx = sampler_idx;
op->sampler = sampler;
@ -330,7 +330,7 @@ index 68c7142..d1eb571 100644
}
static UINT wined3d_cs_exec_set_shader(struct wined3d_cs *cs, const void *data)
@@ -1124,7 +1045,7 @@ void wined3d_cs_emit_set_shader(struct wined3d_cs *cs, enum wined3d_shader_type
@@ -1256,7 +1177,7 @@ void wined3d_cs_emit_set_shader(struct wined3d_cs *cs, enum wined3d_shader_type
op->type = type;
op->shader = shader;
@ -339,7 +339,7 @@ index 68c7142..d1eb571 100644
}
static UINT wined3d_cs_exec_set_vs_consts_f(struct wined3d_cs *cs, const void *data)
@@ -1157,8 +1078,9 @@ void wined3d_cs_emit_set_consts_f(struct wined3d_cs *cs, unsigned int start_idx,
@@ -1289,8 +1210,9 @@ void wined3d_cs_emit_set_consts_f(struct wined3d_cs *cs, unsigned int start_idx,
const struct wined3d_vec4 *constants, enum wined3d_shader_type type)
{
struct wined3d_cs_set_consts_f *op;
@ -350,7 +350,7 @@ index 68c7142..d1eb571 100644
switch (type)
{
case WINED3D_SHADER_TYPE_PIXEL:
@@ -1182,7 +1104,7 @@ void wined3d_cs_emit_set_consts_f(struct wined3d_cs *cs, unsigned int start_idx,
@@ -1315,7 +1237,7 @@ void wined3d_cs_emit_set_consts_f(struct wined3d_cs *cs, unsigned int start_idx,
op->count = count;
memcpy(op->constants, constants, sizeof(op->constants[0]) * count);
@ -359,7 +359,7 @@ index 68c7142..d1eb571 100644
}
static UINT wined3d_cs_exec_set_render_state(struct wined3d_cs *cs, const void *data)
@@ -1204,8 +1126,8 @@ void wined3d_cs_emit_set_render_state(struct wined3d_cs *cs, enum wined3d_render
@@ -1337,8 +1259,8 @@ void wined3d_cs_emit_set_render_state(struct wined3d_cs *cs, enum wined3d_render
op->state = state;
op->value = value;
@ -370,7 +370,7 @@ index 68c7142..d1eb571 100644
static UINT wined3d_cs_exec_set_vs_consts_b(struct wined3d_cs *cs, const void *data)
{
@@ -1235,8 +1157,9 @@ void wined3d_cs_emit_set_consts_b(struct wined3d_cs *cs, unsigned int start_idx,
@@ -1368,8 +1290,9 @@ void wined3d_cs_emit_set_consts_b(struct wined3d_cs *cs, unsigned int start_idx,
unsigned int count, const BOOL *constants, enum wined3d_shader_type type)
{
struct wined3d_cs_set_consts_b *op;
@ -381,7 +381,7 @@ index 68c7142..d1eb571 100644
switch (type)
{
case WINED3D_SHADER_TYPE_PIXEL:
@@ -1260,7 +1183,7 @@ void wined3d_cs_emit_set_consts_b(struct wined3d_cs *cs, unsigned int start_idx,
@@ -1394,7 +1317,7 @@ void wined3d_cs_emit_set_consts_b(struct wined3d_cs *cs, unsigned int start_idx,
op->count = count;
memcpy(op->constants, constants, sizeof(op->constants[0]) * count);
@ -390,7 +390,7 @@ index 68c7142..d1eb571 100644
}
static UINT wined3d_cs_exec_set_vs_consts_i(struct wined3d_cs *cs, const void *data)
@@ -1291,8 +1214,9 @@ void wined3d_cs_emit_set_consts_i(struct wined3d_cs *cs, unsigned int start_idx,
@@ -1425,8 +1348,9 @@ void wined3d_cs_emit_set_consts_i(struct wined3d_cs *cs, unsigned int start_idx,
const struct wined3d_ivec4 *constants, enum wined3d_shader_type type)
{
struct wined3d_cs_set_consts_i *op;
@ -401,7 +401,7 @@ index 68c7142..d1eb571 100644
switch (type)
{
case WINED3D_SHADER_TYPE_PIXEL:
@@ -1316,7 +1240,7 @@ void wined3d_cs_emit_set_consts_i(struct wined3d_cs *cs, unsigned int start_idx,
@@ -1451,7 +1375,7 @@ void wined3d_cs_emit_set_consts_i(struct wined3d_cs *cs, unsigned int start_idx,
op->count = count;
memcpy(op->constants, constants, sizeof(op->constants[0]) * count);
@ -410,7 +410,7 @@ index 68c7142..d1eb571 100644
}
static UINT wined3d_cs_exec_set_texture_state(struct wined3d_cs *cs, const void *data)
@@ -1340,7 +1264,7 @@ void wined3d_cs_emit_set_texture_state(struct wined3d_cs *cs, UINT stage,
@@ -1475,7 +1399,7 @@ void wined3d_cs_emit_set_texture_state(struct wined3d_cs *cs, UINT stage,
op->state = state;
op->value = value;
@ -419,7 +419,7 @@ index 68c7142..d1eb571 100644
}
static UINT wined3d_cs_exec_set_sampler_state(struct wined3d_cs *cs, const void *data)
@@ -1364,7 +1288,7 @@ void wined3d_cs_emit_set_sampler_state(struct wined3d_cs *cs, UINT sampler_idx,
@@ -1499,7 +1423,7 @@ void wined3d_cs_emit_set_sampler_state(struct wined3d_cs *cs, UINT sampler_idx,
op->state = state;
op->value = value;
@ -428,7 +428,7 @@ index 68c7142..d1eb571 100644
}
static UINT wined3d_cs_exec_set_transform(struct wined3d_cs *cs, const void *data)
@@ -1388,7 +1312,7 @@ void wined3d_cs_emit_set_transform(struct wined3d_cs *cs, enum wined3d_transform
@@ -1523,7 +1447,7 @@ void wined3d_cs_emit_set_transform(struct wined3d_cs *cs, enum wined3d_transform
op->state = state;
op->matrix = *matrix;
@ -437,7 +437,7 @@ index 68c7142..d1eb571 100644
}
static UINT wined3d_cs_exec_set_clip_plane(struct wined3d_cs *cs, const void *data)
@@ -1410,7 +1334,7 @@ void wined3d_cs_emit_set_clip_plane(struct wined3d_cs *cs, UINT plane_idx, const
@@ -1545,7 +1469,7 @@ void wined3d_cs_emit_set_clip_plane(struct wined3d_cs *cs, UINT plane_idx, const
op->plane_idx = plane_idx;
op->plane = *plane;
@ -446,7 +446,7 @@ index 68c7142..d1eb571 100644
}
static UINT wined3d_cs_exec_set_color_key(struct wined3d_cs *cs, const void *data)
@@ -1495,7 +1419,7 @@ void wined3d_cs_emit_set_color_key(struct wined3d_cs *cs, struct wined3d_texture
@@ -1630,7 +1554,7 @@ void wined3d_cs_emit_set_color_key(struct wined3d_cs *cs, struct wined3d_texture
else
op->set = 0;
@ -455,7 +455,7 @@ index 68c7142..d1eb571 100644
}
static UINT wined3d_cs_exec_set_material(struct wined3d_cs *cs, const void *data)
@@ -1516,7 +1440,7 @@ void wined3d_cs_emit_set_material(struct wined3d_cs *cs, const struct wined3d_ma
@@ -1651,7 +1575,7 @@ void wined3d_cs_emit_set_material(struct wined3d_cs *cs, const struct wined3d_ma
op->opcode = WINED3D_CS_OP_SET_MATERIAL;
op->material = *material;
@ -464,7 +464,7 @@ index 68c7142..d1eb571 100644
}
static UINT wined3d_cs_exec_reset_state(struct wined3d_cs *cs, const void *data)
@@ -1540,7 +1464,7 @@ void wined3d_cs_emit_reset_state(struct wined3d_cs *cs)
@@ -1675,7 +1599,7 @@ void wined3d_cs_emit_reset_state(struct wined3d_cs *cs)
op = cs->ops->require_space(cs, sizeof(*op));
op->opcode = WINED3D_CS_OP_RESET_STATE;
@ -473,7 +473,7 @@ index 68c7142..d1eb571 100644
}
static UINT wined3d_cs_exec_destroy_object(struct wined3d_cs *cs, const void *data)
@@ -1561,7 +1485,7 @@ void wined3d_cs_emit_destroy_object(struct wined3d_cs *cs, void (*callback)(void
@@ -1696,7 +1620,7 @@ void wined3d_cs_emit_destroy_object(struct wined3d_cs *cs, void (*callback)(void
op->callback = callback;
op->object = object;
@ -482,7 +482,7 @@ index 68c7142..d1eb571 100644
}
static UINT wined3d_cs_exec_glfinish(struct wined3d_cs *cs, const void *data)
@@ -1587,7 +1511,7 @@ void wined3d_cs_emit_glfinish(struct wined3d_cs *cs)
@@ -1722,7 +1646,7 @@ void wined3d_cs_emit_glfinish(struct wined3d_cs *cs)
op = cs->ops->require_space(cs, sizeof(*op));
op->opcode = WINED3D_CS_OP_GLFINISH;
@ -491,7 +491,7 @@ index 68c7142..d1eb571 100644
}
static UINT wined3d_cs_exec_set_base_vertex_index(struct wined3d_cs *cs, const void *data)
@@ -1609,7 +1533,7 @@ void wined3d_cs_emit_set_base_vertex_index(struct wined3d_cs *cs,
@@ -1744,7 +1668,7 @@ void wined3d_cs_emit_set_base_vertex_index(struct wined3d_cs *cs,
op->opcode = WINED3D_CS_OP_SET_BASE_VERTEX_INDEX;
op->base_vertex_index = base_vertex_index;
@ -500,7 +500,7 @@ index 68c7142..d1eb571 100644
}
static UINT wined3d_cs_exec_set_primitive_type(struct wined3d_cs *cs, const void *data)
@@ -1635,7 +1559,7 @@ void wined3d_cs_emit_set_primitive_type(struct wined3d_cs *cs, GLenum primitive_
@@ -1770,7 +1694,7 @@ void wined3d_cs_emit_set_primitive_type(struct wined3d_cs *cs, GLenum primitive_
op->opcode = WINED3D_CS_OP_SET_PRIMITIVE_TYPE;
op->gl_primitive_type = primitive_type;
@ -509,7 +509,7 @@ index 68c7142..d1eb571 100644
}
static UINT wined3d_cs_exec_set_light(struct wined3d_cs *cs, const void *data)
@@ -1692,7 +1616,7 @@ void wined3d_cs_emit_set_light(struct wined3d_cs *cs, const struct wined3d_light
@@ -1827,7 +1751,7 @@ void wined3d_cs_emit_set_light(struct wined3d_cs *cs, const struct wined3d_light
op->opcode = WINED3D_CS_OP_SET_LIGHT;
op->light = *light;
@ -518,7 +518,7 @@ index 68c7142..d1eb571 100644
}
static UINT wined3d_cs_exec_set_light_enable(struct wined3d_cs *cs, const void *data)
@@ -1781,7 +1705,7 @@ void wined3d_cs_emit_set_light_enable(struct wined3d_cs *cs, UINT idx, BOOL enab
@@ -1916,7 +1840,7 @@ void wined3d_cs_emit_set_light_enable(struct wined3d_cs *cs, UINT idx, BOOL enab
op->idx = idx;
op->enable = enable;
@ -527,7 +527,7 @@ index 68c7142..d1eb571 100644
}
static UINT wined3d_cs_exec_blt(struct wined3d_cs *cs, const void *data)
@@ -1813,7 +1737,7 @@ void wined3d_cs_emit_blt(struct wined3d_cs *cs, struct wined3d_surface *dst_surf
@@ -1948,7 +1872,7 @@ void wined3d_cs_emit_blt(struct wined3d_cs *cs, struct wined3d_surface *dst_surf
if (fx)
op->fx = *fx;
@ -536,7 +536,7 @@ index 68c7142..d1eb571 100644
}
static UINT wined3d_cs_exec_clear_rtv(struct wined3d_cs *cs, const void *data)
@@ -1846,7 +1770,7 @@ void wined3d_cs_emit_clear_rtv(struct wined3d_cs *cs, struct wined3d_rendertarge
@@ -1981,7 +1905,7 @@ void wined3d_cs_emit_clear_rtv(struct wined3d_cs *cs, struct wined3d_rendertarge
op->stencil = stencil;
op->blitter = blitter;
@ -545,7 +545,7 @@ index 68c7142..d1eb571 100644
}
static UINT wined3d_cs_exec_texture_map(struct wined3d_cs *cs, const void *data)
@@ -1871,12 +1795,14 @@ void *wined3d_cs_emit_texture_map(struct wined3d_cs *cs, struct wined3d_texture
@@ -2006,12 +1930,14 @@ void *wined3d_cs_emit_texture_map(struct wined3d_cs *cs, struct wined3d_texture
op->flags = flags;
op->mem = &ret;
@ -561,7 +561,7 @@ index 68c7142..d1eb571 100644
return ret;
}
@@ -1899,11 +1825,13 @@ void wined3d_cs_emit_texture_unmap(struct wined3d_cs *cs, struct wined3d_texture
@@ -2034,11 +1960,13 @@ void wined3d_cs_emit_texture_unmap(struct wined3d_cs *cs, struct wined3d_texture
op->texture = texture;
op->sub_resource_idx = sub_resource_idx;
@ -576,7 +576,7 @@ index 68c7142..d1eb571 100644
/* WINED3D_CS_OP_FENCE */ wined3d_cs_exec_fence,
/* WINED3D_CS_OP_PRESENT */ wined3d_cs_exec_present,
/* WINED3D_CS_OP_CLEAR */ wined3d_cs_exec_clear,
@@ -1949,42 +1877,59 @@ static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void
@@ -2084,42 +2012,59 @@ static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void
/* WINED3D_CS_OP_TEXTURE_UNMAP */ wined3d_cs_exec_texture_unmap,
};
@ -659,7 +659,7 @@ index 68c7142..d1eb571 100644
};
/* FIXME: wined3d_device_uninit_3d() should either flush and wait, or be an
@@ -1996,9 +1941,38 @@ static void wined3d_cs_emit_stop(struct wined3d_cs *cs)
@@ -2131,9 +2076,38 @@ static void wined3d_cs_emit_stop(struct wined3d_cs *cs)
op = wined3d_cs_mt_require_space(cs, sizeof(*op));
op->opcode = WINED3D_CS_OP_STOP;
@ -678,12 +678,12 @@ index 68c7142..d1eb571 100644
+ }
+
+ wined3d_cs_op_handlers[opcode](cs, &cs->queue.data);
}
+static void wined3d_cs_st_finish(struct wined3d_cs *cs)
+{
+}
+
+static void wined3d_cs_st_finish(struct wined3d_cs *cs)
+{
}
+static void *wined3d_cs_st_require_space(struct wined3d_cs *cs, size_t size)
+{
+ return cs->queue.data;
@ -699,7 +699,7 @@ index 68c7142..d1eb571 100644
void wined3d_cs_switch_onscreen_ds(struct wined3d_cs *cs,
struct wined3d_context *context, struct wined3d_surface *depth_stencil)
{
@@ -2022,31 +1996,32 @@ void wined3d_cs_switch_onscreen_ds(struct wined3d_cs *cs,
@@ -2157,31 +2131,32 @@ void wined3d_cs_switch_onscreen_ds(struct wined3d_cs *cs,
static DWORD WINAPI wined3d_cs_run(void *thread_param)
{
struct wined3d_cs *cs = thread_param;
@ -746,7 +746,7 @@ index 68c7142..d1eb571 100644
}
done:
@@ -2071,25 +2046,10 @@ struct wined3d_cs *wined3d_cs_create(struct wined3d_device *device)
@@ -2206,25 +2181,10 @@ struct wined3d_cs *wined3d_cs_create(struct wined3d_device *device)
cs->ops = &wined3d_cs_st_ops;
cs->device = device;
@ -772,7 +772,7 @@ index 68c7142..d1eb571 100644
if (!(cs->thread = CreateThread(NULL, 0, wined3d_cs_run, cs, 0, NULL)))
{
ERR("Failed to create wined3d command stream thread.\n");
@@ -2101,12 +2061,7 @@ struct wined3d_cs *wined3d_cs_create(struct wined3d_device *device)
@@ -2236,12 +2196,7 @@ struct wined3d_cs *wined3d_cs_create(struct wined3d_device *device)
err:
if (cs)
@ -785,7 +785,7 @@ index 68c7142..d1eb571 100644
HeapFree(GetProcessHeap(), 0, cs);
return NULL;
}
@@ -2125,17 +2080,7 @@ void wined3d_cs_destroy(struct wined3d_cs *cs)
@@ -2260,17 +2215,7 @@ void wined3d_cs_destroy(struct wined3d_cs *cs)
CloseHandle(cs->thread);
if (ret != WAIT_OBJECT_0)
ERR("Wait failed (%#x).\n", ret);
@ -804,7 +804,7 @@ index 68c7142..d1eb571 100644
HeapFree(GetProcessHeap(), 0, cs);
}
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 159f79e..4ea1f51 100644
index f2f03c5..2f2c92e 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -31,6 +31,7 @@
@ -815,7 +815,7 @@ index 159f79e..4ea1f51 100644
#include <stdarg.h>
#include <math.h>
#include <limits.h>
@@ -2916,19 +2917,17 @@ struct wined3d_cs_list
@@ -2989,19 +2990,17 @@ struct wined3d_cs_list
struct list blocks;
};
@ -840,7 +840,7 @@ index 159f79e..4ea1f51 100644
void (*finish)(struct wined3d_cs *cs);
};
@@ -2939,14 +2938,9 @@ struct wined3d_cs
@@ -3012,14 +3011,9 @@ struct wined3d_cs
struct wined3d_state state;
HANDLE thread;
DWORD thread_id;

View File

@ -1,64 +0,0 @@
From 1eb816c58ca5ed8999d8914e2c5dee650e0bb2a4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20D=C3=B6singer?= <stefan@codeweavers.com>
Date: Wed, 20 Aug 2014 18:01:36 +0200
Subject: wined3d: Introduce resource fencing.
FIXME: The buffer part doesn't really make sense without dynamic buffer maps.
---
dlls/wined3d/cs.c | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
index f33cfa8..f196f72 100644
--- a/dlls/wined3d/cs.c
+++ b/dlls/wined3d/cs.c
@@ -554,6 +554,7 @@ static UINT wined3d_cs_exec_draw(struct wined3d_cs *cs, const void *data)
struct wined3d_state *state = &cs->state;
const struct wined3d_cs_draw *op = data;
const struct wined3d_gl_info *gl_info = &cs->device->adapter->gl_info;
+ unsigned int i;
if (op->indexed && !gl_info->supported[ARB_DRAW_ELEMENTS_BASE_VERTEX])
{
@@ -579,6 +580,14 @@ static UINT wined3d_cs_exec_draw(struct wined3d_cs *cs, const void *data)
draw_primitive(cs->device, state, op->base_vertex_idx, op->start_idx,
op->index_count, op->start_instance, op->instance_count, op->indexed);
+ if (op->indexed)
+ wined3d_resource_release(&cs->state.index_buffer->resource);
+ for (i = 0; i < sizeof(cs->state.streams) / sizeof(*cs->state.streams); i++)
+ {
+ if (cs->state.streams[i].buffer)
+ wined3d_resource_release(&cs->state.streams[i].buffer->resource);
+ }
+
return sizeof(*op);
}
@@ -586,6 +595,8 @@ void wined3d_cs_emit_draw(struct wined3d_cs *cs, int base_vertex_idx, unsigned i
unsigned int index_count, unsigned int start_instance, unsigned int instance_count, BOOL indexed)
{
struct wined3d_cs_draw *op;
+ unsigned int i;
+ const struct wined3d_state *state = &cs->device->state;
op = cs->ops->require_space(cs, sizeof(*op));
op->opcode = WINED3D_CS_OP_DRAW;
@@ -596,6 +607,14 @@ void wined3d_cs_emit_draw(struct wined3d_cs *cs, int base_vertex_idx, unsigned i
op->instance_count = instance_count;
op->indexed = indexed;
+ if (indexed)
+ wined3d_resource_acquire(&state->index_buffer->resource);
+ for (i = 0; i < sizeof(state->streams) / sizeof(*state->streams); i++)
+ {
+ if (state->streams[i].buffer)
+ wined3d_resource_acquire(&state->streams[i].buffer->resource);
+ }
+
cs->ops->submit(cs, sizeof(*op));
}
--
2.8.0

View File

@ -1,53 +0,0 @@
From 3fc3a3051fe8fc5ec3c06432b00754c8ec81158d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20D=C3=B6singer?= <stefan@codeweavers.com>
Date: Fri, 30 Aug 2013 22:42:33 +0200
Subject: wined3d: Fence texture reads in draws
This is probably stricter than necessary. GL BOs and allocated sysmem
are just staging resources. After they have been uploaded into the GL
texture, it's in theory OK to write new data buffer without interfering
with old draws. However, it is impossible to tell when if data has been
transfered into the texture because texture loads are delayed until draw
time. Specifically, it is difficult to separate two consecutive maps
from a map, draw, map sequence, where the draw hasn't been executed by
the time the second map occurs.
The other problem is that sRGB may cause a texture load from
buffer/sysmem even though the GL texture is thought to be loaded. This
is limited to situations where sRGB textures are supported, but
sRGB_decode isn't.
---
dlls/wined3d/cs.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
index ff559de..ffd5d72 100644
--- a/dlls/wined3d/cs.c
+++ b/dlls/wined3d/cs.c
@@ -587,6 +587,11 @@ static UINT wined3d_cs_exec_draw(struct wined3d_cs *cs, const void *data)
if (cs->state.streams[i].buffer)
wined3d_resource_release(&cs->state.streams[i].buffer->resource);
}
+ for (i = 0; i < sizeof(cs->state.textures) / sizeof(*cs->state.textures); i++)
+ {
+ if (cs->state.textures[i])
+ wined3d_resource_release(&cs->state.textures[i]->resource);
+ }
return sizeof(*op);
}
@@ -614,6 +619,11 @@ void wined3d_cs_emit_draw(struct wined3d_cs *cs, int base_vertex_idx, unsigned i
if (state->streams[i].buffer)
wined3d_resource_acquire(&state->streams[i].buffer->resource);
}
+ for (i = 0; i < sizeof(state->textures) / sizeof(*state->textures); i++)
+ {
+ if (state->textures[i])
+ wined3d_resource_acquire(&state->textures[i]->resource);
+ }
cs->ops->submit(cs, sizeof(*op));
}
--
2.8.0

View File

@ -1,17 +1,17 @@
From fa13f4317b9d869fd8a3847926bf5f2edc40b479 Mon Sep 17 00:00:00 2001
From 9aae8336cd11533f9433b2fc305b379d257e5a1a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20D=C3=B6singer?= <stefan@codeweavers.com>
Date: Fri, 27 Sep 2013 16:55:58 +0200
Subject: wined3d: Fence render targets and depth stencils
---
dlls/wined3d/cs.c | 38 ++++++++++++++++++++++++++++++++++++++
1 file changed, 38 insertions(+)
dlls/wined3d/cs.c | 32 ++++++++++++++++++++++++++++----
1 file changed, 28 insertions(+), 4 deletions(-)
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
index ffd5d72..329cdce 100644
index f65797f..070f538 100644
--- a/dlls/wined3d/cs.c
+++ b/dlls/wined3d/cs.c
@@ -549,6 +549,30 @@ void wined3d_cs_emit_clear(struct wined3d_cs *cs, DWORD rect_count, const RECT *
@@ -590,6 +590,30 @@ void wined3d_cs_emit_clear(struct wined3d_cs *cs, DWORD rect_count, const RECT *
cs->ops->submit(cs, size);
}
@ -42,34 +42,32 @@ index ffd5d72..329cdce 100644
static UINT wined3d_cs_exec_draw(struct wined3d_cs *cs, const void *data)
{
struct wined3d_state *state = &cs->state;
@@ -592,6 +616,13 @@ static UINT wined3d_cs_exec_draw(struct wined3d_cs *cs, const void *data)
if (cs->state.textures[i])
wined3d_resource_release(&cs->state.textures[i]->resource);
@@ -638,10 +662,10 @@ static UINT wined3d_cs_exec_draw(struct wined3d_cs *cs, const void *data)
}
+ for (i = 0; i < gl_info->limits.buffers; i++)
+ {
+ if (cs->state.fb.render_targets[i] && wined3d_cs_colorwrite_enabled(&cs->state, i))
+ wined3d_resource_release(cs->state.fb.render_targets[i]->resource);
+ }
+ if (cs->state.fb.depth_stencil && wined3d_cs_depth_stencil_enabled(&cs->state))
+ wined3d_resource_release(cs->state.fb.depth_stencil->resource);
return sizeof(*op);
}
@@ -624,6 +655,13 @@ void wined3d_cs_emit_draw(struct wined3d_cs *cs, int base_vertex_idx, unsigned i
if (state->textures[i])
wined3d_resource_acquire(&state->textures[i]->resource);
}
+ for (i = 0; i < cs->device->adapter->gl_info.limits.buffers; i++)
+ {
for (i = 0; i < cs->device->adapter->gl_info.limits.buffers; ++i)
{
- if (state->fb.render_targets[i])
+ if (state->fb.render_targets[i] && wined3d_cs_colorwrite_enabled(state, i))
+ wined3d_resource_acquire(state->fb.render_targets[i]->resource);
+ }
wined3d_resource_release(state->fb.render_targets[i]->resource);
}
- if (state->fb.depth_stencil)
+ if (state->fb.depth_stencil && wined3d_cs_depth_stencil_enabled(state))
+ wined3d_resource_acquire(state->fb.depth_stencil->resource);
cs->ops->submit(cs, sizeof(*op));
}
wined3d_resource_release(state->fb.depth_stencil->resource);
for (i = 0; i < WINED3D_SHADER_TYPE_COUNT; ++i)
{
@@ -701,10 +725,10 @@ void wined3d_cs_emit_draw(struct wined3d_cs *cs, int base_vertex_idx, unsigned i
}
for (i = 0; i < cs->device->adapter->gl_info.limits.buffers; ++i)
{
- if (state->fb.render_targets[i])
+ if (state->fb.render_targets[i] && wined3d_cs_colorwrite_enabled(state, i))
wined3d_resource_acquire(state->fb.render_targets[i]->resource);
}
- if (state->fb.depth_stencil)
+ if (state->fb.depth_stencil && wined3d_cs_depth_stencil_enabled(state))
wined3d_resource_acquire(state->fb.depth_stencil->resource);
for (i = 0; i < WINED3D_SHADER_TYPE_COUNT; ++i)
{
--
2.8.0

View File

@ -1,70 +0,0 @@
From cccdf39d6f6cc952455a999d466fe868b4640d91 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20D=C3=B6singer?= <stefan@codeweavers.com>
Date: Fri, 27 Sep 2013 17:04:47 +0200
Subject: wined3d: Fence clear calls.
---
dlls/wined3d/cs.c | 26 ++++++++++++++++++++++++++
1 file changed, 26 insertions(+)
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
index af10384..60ae4a3 100644
--- a/dlls/wined3d/cs.c
+++ b/dlls/wined3d/cs.c
@@ -522,6 +522,7 @@ static UINT wined3d_cs_exec_clear(struct wined3d_cs *cs, const void *data)
struct wined3d_device *device;
RECT draw_rect;
size_t size = FIELD_OFFSET(struct wined3d_cs_clear, rects[op->rect_count]);
+ unsigned int i;
device = cs->device;
wined3d_get_draw_rect(&cs->state, &draw_rect);
@@ -529,6 +530,17 @@ static UINT wined3d_cs_exec_clear(struct wined3d_cs *cs, const void *data)
&cs->state.fb, op->rect_count, op->rects, &draw_rect, op->flags,
&op->color, op->depth, op->stencil);
+ if (op->flags & WINED3DCLEAR_TARGET)
+ {
+ for (i = 0; i < device->adapter->gl_info.limits.buffers; i++)
+ {
+ if (cs->state.fb.render_targets[i])
+ wined3d_resource_release(cs->state.fb.render_targets[i]->resource);
+ }
+ }
+ if (op->flags & (WINED3DCLEAR_ZBUFFER | WINED3DCLEAR_STENCIL))
+ wined3d_resource_release(cs->state.fb.depth_stencil->resource);
+
return size;
}
@@ -537,6 +549,9 @@ void wined3d_cs_emit_clear(struct wined3d_cs *cs, DWORD rect_count, const RECT *
{
struct wined3d_cs_clear *op;
size_t size = FIELD_OFFSET(struct wined3d_cs_clear, rects[rect_count]);
+ const struct wined3d_state *state = &cs->device->state;
+ unsigned int i;
+
op = cs->ops->require_space(cs, size);
op->opcode = WINED3D_CS_OP_CLEAR;
op->flags = flags;
@@ -546,6 +561,17 @@ void wined3d_cs_emit_clear(struct wined3d_cs *cs, DWORD rect_count, const RECT *
op->rect_count = rect_count;
memcpy(op->rects, rects, sizeof(*rects) * rect_count);
+ if (flags & WINED3DCLEAR_TARGET)
+ {
+ for (i = 0; i < cs->device->adapter->gl_info.limits.buffers; i++)
+ {
+ if (state->fb.render_targets[i])
+ wined3d_resource_acquire(state->fb.render_targets[i]->resource);
+ }
+ }
+ if (flags & (WINED3DCLEAR_ZBUFFER | WINED3DCLEAR_STENCIL))
+ wined3d_resource_acquire(state->fb.depth_stencil->resource);
+
cs->ops->submit(cs, size);
}
--
2.8.0

View File

@ -1,54 +0,0 @@
From 5231563b7294c2c8d00cd28be3c7a6974af9de0c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20D=C3=B6singer?= <stefan@codeweavers.com>
Date: Fri, 27 Sep 2013 17:55:35 +0200
Subject: wined3d: Fence present calls.
---
dlls/wined3d/cs.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
index 60ae4a3..139d0c2 100644
--- a/dlls/wined3d/cs.c
+++ b/dlls/wined3d/cs.c
@@ -482,6 +482,7 @@ static UINT wined3d_cs_exec_present(struct wined3d_cs *cs, const void *data)
{
const struct wined3d_cs_present *op = data;
struct wined3d_swapchain *swapchain;
+ unsigned int i;
swapchain = op->swapchain;
wined3d_swapchain_set_window(swapchain, op->dst_window_override);
@@ -491,6 +492,10 @@ static UINT wined3d_cs_exec_present(struct wined3d_cs *cs, const void *data)
InterlockedDecrement(&cs->pending_presents);
+ wined3d_resource_release(&swapchain->front_buffer->resource);
+ for (i = 0; i < swapchain->desc.backbuffer_count; i++)
+ wined3d_resource_release(&swapchain->back_buffers[i]->resource);
+
return sizeof(*op);
}
@@ -499,6 +504,7 @@ void wined3d_cs_emit_present(struct wined3d_cs *cs, struct wined3d_swapchain *sw
{
struct wined3d_cs_present *op;
LONG pending;
+ unsigned int i;
op = cs->ops->require_space(cs, sizeof(*op));
op->opcode = WINED3D_CS_OP_PRESENT;
@@ -508,6 +514,10 @@ void wined3d_cs_emit_present(struct wined3d_cs *cs, struct wined3d_swapchain *sw
op->dst_rect = *dst_rect;
op->flags = flags;
+ wined3d_resource_acquire(&swapchain->front_buffer->resource);
+ for (i = 0; i < swapchain->desc.backbuffer_count; i++)
+ wined3d_resource_acquire(&swapchain->back_buffers[i]->resource);
+
pending = InterlockedIncrement(&cs->pending_presents);
cs->ops->submit(cs, sizeof(*op));
--
2.8.0

View File

@ -1,4 +1,4 @@
From 95ab414f54e4b6b157593c001a7bf047f74566a5 Mon Sep 17 00:00:00 2001
From f4ee680803cc4d5e1871796147a7839d8b5c9a2f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20D=C3=B6singer?= <stefan@codeweavers.com>
Date: Tue, 30 Jul 2013 22:17:10 +0200
Subject: wined3d: Separate GL buffer discard control from ignoring
@ -18,7 +18,7 @@ There are some problems left:
3 files changed, 28 insertions(+), 8 deletions(-)
diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c
index e3659b2..f939c57 100644
index 94913be..07dca47 100644
--- a/dlls/wined3d/buffer.c
+++ b/dlls/wined3d/buffer.c
@@ -32,7 +32,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(d3d);
@ -30,7 +30,7 @@ index e3659b2..f939c57 100644
#define WINED3D_BUFFER_SYNC 0x10 /* There has been at least one synchronized map since the last preload. */
#define WINED3D_BUFFER_APPLESYNC 0x20 /* Using sync as in GL_APPLE_flush_buffer_range. */
@@ -931,7 +931,7 @@ HRESULT CDECL wined3d_buffer_map(struct wined3d_buffer *buffer, UINT offset, UIN
@@ -925,7 +925,7 @@ HRESULT CDECL wined3d_buffer_map(struct wined3d_buffer *buffer, UINT offset, UIN
* previous contents of the buffer. The r600g driver only does this when
* the buffer is currently in use, while the proprietary NVIDIA driver
* appears to do this unconditionally. */
@ -39,7 +39,7 @@ index e3659b2..f939c57 100644
flags &= ~WINED3D_MAP_DISCARD;
count = ++buffer->resource.map_count;
@@ -1009,10 +1009,15 @@ HRESULT CDECL wined3d_buffer_map(struct wined3d_buffer *buffer, UINT offset, UIN
@@ -1003,10 +1003,15 @@ HRESULT CDECL wined3d_buffer_map(struct wined3d_buffer *buffer, UINT offset, UIN
context_release(context);
}
}
@ -59,7 +59,7 @@ index e3659b2..f939c57 100644
buffer->flags |= WINED3D_BUFFER_SYNC;
}
@@ -1021,6 +1026,7 @@ HRESULT CDECL wined3d_buffer_map(struct wined3d_buffer *buffer, UINT offset, UIN
@@ -1015,6 +1020,7 @@ HRESULT CDECL wined3d_buffer_map(struct wined3d_buffer *buffer, UINT offset, UIN
BOOL swvp = device->create_parms.flags & WINED3DCREATE_SOFTWARE_VERTEXPROCESSING;
if (flags & WINED3D_MAP_DISCARD && !swvp)
{
@ -67,7 +67,7 @@ index e3659b2..f939c57 100644
wined3d_resource_allocate_sysmem(&buffer->resource);
wined3d_cs_emit_buffer_swap_mem(device->cs, buffer, buffer->resource.map_heap_memory);
}
@@ -1459,3 +1465,10 @@ HRESULT CDECL wined3d_buffer_create_ib(struct wined3d_device *device, UINT size,
@@ -1453,3 +1459,10 @@ HRESULT CDECL wined3d_buffer_create_ib(struct wined3d_device *device, UINT size,
return WINED3D_OK;
}
@ -79,10 +79,10 @@ index e3659b2..f939c57 100644
+ buffer->flags |= WINED3D_BUFFER_DISCARD;
+}
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
index 9044495..4833fda 100644
index 577928e..991adbc 100644
--- a/dlls/wined3d/cs.c
+++ b/dlls/wined3d/cs.c
@@ -723,11 +723,17 @@ void wined3d_cs_emit_draw(struct wined3d_cs *cs, int base_vertex_idx, unsigned i
@@ -755,11 +755,17 @@ void wined3d_cs_emit_draw(struct wined3d_cs *cs, int base_vertex_idx, unsigned i
op->indexed = indexed;
if (indexed)
@ -90,7 +90,7 @@ index 9044495..4833fda 100644
wined3d_resource_acquire(&state->index_buffer->resource);
+ state->index_buffer->ignore_discard = FALSE;
+ }
for (i = 0; i < sizeof(state->streams) / sizeof(*state->streams); i++)
for (i = 0; i < ARRAY_SIZE(state->streams); ++i)
{
if (state->streams[i].buffer)
+ {
@ -98,9 +98,9 @@ index 9044495..4833fda 100644
+ state->streams[i].buffer->ignore_discard = FALSE;
+ }
}
for (i = 0; i < sizeof(state->textures) / sizeof(*state->textures); i++)
for (i = 0; i < ARRAY_SIZE(state->textures); ++i)
{
@@ -2270,8 +2276,7 @@ static UINT wined3d_cs_exec_buffer_swap_mem(struct wined3d_cs *cs, const void *d
@@ -2323,8 +2329,7 @@ static UINT wined3d_cs_exec_buffer_swap_mem(struct wined3d_cs *cs, const void *d
const struct wined3d_cs_buffer_swap_mem *op = data;
struct wined3d_buffer *buffer = op->buffer;
@ -111,7 +111,7 @@ index 9044495..4833fda 100644
if (!buffer->buffer_object && buffer->resource.bind_count)
{
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 748546f..2d8a2e6 100644
index 2b76e81..c13a553 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -3200,6 +3200,7 @@ struct wined3d_buffer

View File

@ -674,42 +674,62 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
struct wined3d_cs_set_consts_f
{
enum wined3d_cs_op opcode;
@@ -605,6 +615,23 @@ void wined3d_cs_emit_present(struct wined3d_cs *cs, struct wined3d_swapchain *sw
struct wined3d_cs_present *op;
LONG pending;
unsigned int i;
@@ -579,6 +589,9 @@ static void wined3d_cs_emit_fence_prio(struct wined3d_cs *cs, BOOL *signalled)
}
static UINT wined3d_cs_exec_present(struct wined3d_cs *cs, const void *data)
+#else /* STAGING_CSMT */
+static void wined3d_cs_exec_present(struct wined3d_cs *cs, const void *data)
+{
+ const struct wined3d_cs_present *op = data;
+ struct wined3d_swapchain *swapchain;
+
+ swapchain = op->swapchain;
+ wined3d_swapchain_set_window(swapchain, op->dst_window_override);
+
+#endif /* STAGING_CSMT */
{
const struct wined3d_cs_present *op = data;
struct wined3d_swapchain *swapchain;
@@ -587,6 +600,7 @@ 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);
+#if defined(STAGING_CSMT)
swapchain->swapchain_ops->swapchain_present(swapchain, &op->src_rect, &op->dst_rect, op->flags,
cs->state.fb.depth_stencil);
@@ -599,6 +613,15 @@ static UINT wined3d_cs_exec_present(struct wined3d_cs *cs, const void *data)
}
return sizeof(*op);
+#else /* STAGING_CSMT */
+ swapchain->swapchain_ops->swapchain_present(swapchain, &op->src_rect, &op->dst_rect, op->flags);
+}
+
+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)
+{
+ struct wined3d_cs_present *op;
+ wined3d_resource_release(&swapchain->front_buffer->resource);
+ for (i = 0; i < swapchain->desc.backbuffer_count; ++i)
+ {
+ wined3d_resource_release(&swapchain->back_buffers[i]->resource);
+ }
+#endif /* STAGING_CSMT */
}
void wined3d_cs_emit_present(struct wined3d_cs *cs, struct wined3d_swapchain *swapchain,
@@ -606,7 +629,9 @@ void wined3d_cs_emit_present(struct wined3d_cs *cs, struct wined3d_swapchain *sw
{
struct wined3d_cs_present *op;
unsigned int i;
+#if defined(STAGING_CSMT)
LONG pending;
+#endif /* STAGING_CSMT */
op = cs->ops->require_space(cs, sizeof(*op));
op->opcode = WINED3D_CS_OP_PRESENT;
@@ -614,6 +641,7 @@ void wined3d_cs_emit_present(struct wined3d_cs *cs, struct wined3d_swapchain *sw
op->dst_rect = *dst_rect;
op->flags = flags;
@@ -622,6 +647,7 @@ void wined3d_cs_emit_present(struct wined3d_cs *cs, struct wined3d_swapchain *sw
wined3d_resource_acquire(&swapchain->back_buffers[i]->resource);
}
+#if defined(STAGING_CSMT)
wined3d_resource_acquire(&swapchain->front_buffer->resource);
for (i = 0; i < swapchain->desc.backbuffer_count; i++)
wined3d_resource_acquire(&swapchain->back_buffers[i]->resource);
@@ -671,6 +699,30 @@ void wined3d_cs_emit_clear(struct wined3d_cs *cs, DWORD rect_count, const RECT *
unsigned int i;
pending = InterlockedIncrement(&cs->pending_presents);
op = cs->ops->require_space(cs, size);
cs->ops->submit(cs, sizeof(*op));
@@ -666,6 +692,36 @@ static UINT wined3d_cs_exec_clear(struct wined3d_cs *cs, const void *data)
wined3d_resource_release(state->fb.depth_stencil->resource);
return size;
+#else /* STAGING_CSMT */
+ cs->ops->submit(cs);
+}
@ -717,82 +737,163 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
+static void wined3d_cs_exec_clear(struct wined3d_cs *cs, const void *data)
+{
+ const struct wined3d_cs_clear *op = data;
+ const struct wined3d_state *state;
+ struct wined3d_device *device;
+ unsigned int i;
+ RECT draw_rect;
+
+ device = cs->device;
+ wined3d_get_draw_rect(&device->state, &draw_rect);
+ state = &device->state;
+ wined3d_get_draw_rect(state, &draw_rect);
+ device_clear_render_targets(device, device->adapter->gl_info.limits.buffers,
+ &device->fb, op->rect_count, op->rects, &draw_rect, op->flags,
+ &op->color, op->depth, op->stencil);
+}
+
+void wined3d_cs_emit_clear(struct wined3d_cs *cs, DWORD rect_count, const RECT *rects,
+ DWORD flags, const struct wined3d_color *color, float depth, DWORD stencil)
+{
+ struct wined3d_cs_clear *op;
+ if (op->flags & WINED3DCLEAR_TARGET)
+ {
+ for (i = 0; i < device->adapter->gl_info.limits.buffers; ++i)
+ {
+ if (state->fb->render_targets[i])
+ wined3d_resource_release(state->fb->render_targets[i]->resource);
+ }
+ }
+ if (op->flags & (WINED3DCLEAR_ZBUFFER | WINED3DCLEAR_STENCIL))
+ wined3d_resource_release(state->fb->depth_stencil->resource);
+#endif /* STAGING_CSMT */
}
void wined3d_cs_emit_clear(struct wined3d_cs *cs, DWORD rect_count, const RECT *rects,
@@ -674,8 +730,13 @@ void wined3d_cs_emit_clear(struct wined3d_cs *cs, DWORD rect_count, const RECT *
const struct wined3d_state *state = &cs->device->state;
struct wined3d_cs_clear *op;
unsigned int i;
+#if defined(STAGING_CSMT)
size_t size = FIELD_OFFSET(struct wined3d_cs_clear, rects[rect_count]);
op = cs->ops->require_space(cs, size);
+#else /* STAGING_CSMT */
+
+ op = cs->ops->require_space(cs, FIELD_OFFSET(struct wined3d_cs_clear, rects[rect_count]));
+#endif /* STAGING_CSMT */
op->opcode = WINED3D_CS_OP_CLEAR;
op->flags = flags;
op->color = *color;
@@ -679,6 +731,7 @@ void wined3d_cs_emit_clear(struct wined3d_cs *cs, DWORD rect_count, const RECT *
op->rect_count = rect_count;
memcpy(op->rects, rects, sizeof(*rects) * rect_count);
+#if defined(STAGING_CSMT)
if (flags & WINED3DCLEAR_TARGET)
@@ -688,6 +749,7 @@ void wined3d_cs_emit_clear(struct wined3d_cs *cs, DWORD rect_count, const RECT *
{
for (i = 0; i < cs->device->adapter->gl_info.limits.buffers; i++)
@@ -737,6 +790,15 @@ static UINT wined3d_cs_exec_draw(struct wined3d_cs *cs, const void *data)
for (i = 0; i < cs->device->adapter->gl_info.limits.buffers; ++i)
{
+#if defined(STAGING_CSMT)
if (state->fb.render_targets[i])
wined3d_resource_acquire(state->fb.render_targets[i]->resource);
}
@@ -745,6 +807,26 @@ static UINT wined3d_cs_exec_draw(struct wined3d_cs *cs, const void *data)
cs->state.load_base_vertex_index = 0;
device_invalidate_state(cs->device, STATE_BASEVERTEXINDEX);
}
+#else /* STAGING_CSMT */
+ if (state->fb->render_targets[i])
+ wined3d_resource_acquire(state->fb->render_targets[i]->resource);
+ }
+ }
+ if (flags & (WINED3DCLEAR_ZBUFFER | WINED3DCLEAR_STENCIL))
+ wined3d_resource_acquire(state->fb->depth_stencil->resource);
+
+ cs->ops->submit(cs);
+}
+
+static void wined3d_cs_exec_draw(struct wined3d_cs *cs, const void *data)
+{
+ struct wined3d_state *state = &cs->device->state;
+ struct wined3d_shader_sampler_map_entry *entry;
+ struct wined3d_shader_resource_view *view;
+ const struct wined3d_cs_draw *op = data;
+ struct wined3d_shader *shader;
+ unsigned int i, j;
+#endif /* STAGING_CSMT */
if (!cs->device->adapter->gl_info.supported[ARB_DRAW_ELEMENTS_BASE_VERTEX]
&& state->load_base_vertex_index != op->base_vertex_idx)
@@ -747,6 +809,7 @@ static UINT wined3d_cs_exec_draw(struct wined3d_cs *cs, const void *data)
draw_primitive(cs->device, state, op->base_vertex_idx, op->start_idx,
op->index_count, op->start_instance, op->instance_count, op->indexed);
@@ -770,11 +852,19 @@ static UINT wined3d_cs_exec_draw(struct wined3d_cs *cs, const void *data)
}
for (i = 0; i < cs->device->adapter->gl_info.limits.buffers; ++i)
{
+#if defined(STAGING_CSMT)
if (state->fb.render_targets[i] && wined3d_cs_colorwrite_enabled(state, i))
wined3d_resource_release(state->fb.render_targets[i]->resource);
}
if (state->fb.depth_stencil && wined3d_cs_depth_stencil_enabled(state))
wined3d_resource_release(state->fb.depth_stencil->resource);
+#else /* STAGING_CSMT */
+ if (state->fb->render_targets[i])
+ wined3d_resource_release(state->fb->render_targets[i]->resource);
+ }
+ if (state->fb->depth_stencil)
+ wined3d_resource_release(state->fb->depth_stencil->resource);
+#endif /* STAGING_CSMT */
for (i = 0; i < WINED3D_SHADER_TYPE_COUNT; ++i)
{
if (!(shader = state->shader[i]))
@@ -796,8 +886,10 @@ static UINT wined3d_cs_exec_draw(struct wined3d_cs *cs, const void *data)
wined3d_resource_release(view->resource);
}
}
+#if defined(STAGING_CSMT)
if (op->indexed)
wined3d_resource_release(&cs->state.index_buffer->resource);
@@ -777,6 +840,14 @@ void wined3d_cs_emit_draw(struct wined3d_cs *cs, int base_vertex_idx, unsigned i
struct wined3d_cs_draw *op;
unsigned int i;
const struct wined3d_state *state = &cs->device->state;
+#else /* STAGING_CSMT */
+}
+
+void wined3d_cs_emit_draw(struct wined3d_cs *cs, int base_vertex_idx, unsigned int start_idx,
+ unsigned int index_count, unsigned int start_instance, unsigned int instance_count, BOOL indexed)
+{
+ struct wined3d_cs_draw *op;
return sizeof(*op);
+#endif /* STAGING_CSMT */
}
op = cs->ops->require_space(cs, sizeof(*op));
op->opcode = WINED3D_CS_OP_DRAW;
@@ -787,6 +858,7 @@ void wined3d_cs_emit_draw(struct wined3d_cs *cs, int base_vertex_idx, unsigned i
op->instance_count = instance_count;
void wined3d_cs_emit_draw(struct wined3d_cs *cs, int base_vertex_idx, unsigned int start_idx,
@@ -820,6 +912,7 @@ void wined3d_cs_emit_draw(struct wined3d_cs *cs, int base_vertex_idx, unsigned i
op->indexed = indexed;
+#if defined(STAGING_CSMT)
if (indexed)
+#if defined(STAGING_CSMT)
{
wined3d_resource_acquire(&state->index_buffer->resource);
@@ -824,6 +896,17 @@ static UINT wined3d_cs_exec_set_predication(struct wined3d_cs *cs, const void *d
state->index_buffer->ignore_discard = FALSE;
@@ -831,6 +924,13 @@ void wined3d_cs_emit_draw(struct wined3d_cs *cs, int base_vertex_idx, unsigned i
wined3d_resource_acquire(&state->streams[i].buffer->resource);
state->streams[i].buffer->ignore_discard = FALSE;
}
+#else /* STAGING_CSMT */
+ wined3d_resource_acquire(&state->index_buffer->resource);
+ for (i = 0; i < ARRAY_SIZE(state->streams); ++i)
+ {
+ if (state->streams[i].buffer)
+ wined3d_resource_acquire(&state->streams[i].buffer->resource);
+#endif /* STAGING_CSMT */
}
for (i = 0; i < ARRAY_SIZE(state->textures); ++i)
{
@@ -839,11 +939,19 @@ void wined3d_cs_emit_draw(struct wined3d_cs *cs, int base_vertex_idx, unsigned i
}
for (i = 0; i < cs->device->adapter->gl_info.limits.buffers; ++i)
{
+#if defined(STAGING_CSMT)
if (state->fb.render_targets[i] && wined3d_cs_colorwrite_enabled(state, i))
wined3d_resource_acquire(state->fb.render_targets[i]->resource);
}
if (state->fb.depth_stencil && wined3d_cs_depth_stencil_enabled(state))
wined3d_resource_acquire(state->fb.depth_stencil->resource);
+#else /* STAGING_CSMT */
+ if (state->fb->render_targets[i])
+ wined3d_resource_acquire(state->fb->render_targets[i]->resource);
+ }
+ if (state->fb->depth_stencil)
+ wined3d_resource_acquire(state->fb->depth_stencil->resource);
+#endif /* STAGING_CSMT */
for (i = 0; i < WINED3D_SHADER_TYPE_COUNT; ++i)
{
if (!(shader = state->shader[i]))
@@ -866,6 +974,7 @@ void wined3d_cs_emit_draw(struct wined3d_cs *cs, int base_vertex_idx, unsigned i
}
}
+#if defined(STAGING_CSMT)
cs->ops->submit(cs, sizeof(*op));
}
@@ -877,6 +986,17 @@ static UINT wined3d_cs_exec_set_predication(struct wined3d_cs *cs, const void *d
cs->state.predicate_value = op->value;
return sizeof(*op);
@ -810,7 +911,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
}
void wined3d_cs_emit_set_predication(struct wined3d_cs *cs, struct wined3d_query *predicate, BOOL value)
@@ -835,6 +918,7 @@ void wined3d_cs_emit_set_predication(struct wined3d_cs *cs, struct wined3d_query
@@ -888,6 +1008,7 @@ void wined3d_cs_emit_set_predication(struct wined3d_cs *cs, struct wined3d_query
op->predicate = predicate;
op->value = value;
@ -818,7 +919,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
cs->ops->submit(cs, sizeof(*op));
}
@@ -846,6 +930,17 @@ static UINT wined3d_cs_exec_set_viewport(struct wined3d_cs *cs, const void *data
@@ -899,6 +1020,17 @@ static UINT wined3d_cs_exec_set_viewport(struct wined3d_cs *cs, const void *data
device_invalidate_state(cs->device, STATE_VIEWPORT);
return sizeof(*op);
@ -836,7 +937,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
}
void wined3d_cs_emit_set_viewport(struct wined3d_cs *cs, const struct wined3d_viewport *viewport)
@@ -856,6 +951,7 @@ void wined3d_cs_emit_set_viewport(struct wined3d_cs *cs, const struct wined3d_vi
@@ -909,6 +1041,7 @@ void wined3d_cs_emit_set_viewport(struct wined3d_cs *cs, const struct wined3d_vi
op->opcode = WINED3D_CS_OP_SET_VIEWPORT;
op->viewport = *viewport;
@ -844,7 +945,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
cs->ops->submit(cs, sizeof(*op));
}
@@ -867,6 +963,17 @@ static UINT wined3d_cs_exec_set_scissor_rect(struct wined3d_cs *cs, const void *
@@ -920,6 +1053,17 @@ static UINT wined3d_cs_exec_set_scissor_rect(struct wined3d_cs *cs, const void *
device_invalidate_state(cs->device, STATE_SCISSORRECT);
return sizeof(*op);
@ -862,7 +963,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
}
void wined3d_cs_emit_set_scissor_rect(struct wined3d_cs *cs, const RECT *rect)
@@ -877,6 +984,7 @@ void wined3d_cs_emit_set_scissor_rect(struct wined3d_cs *cs, const RECT *rect)
@@ -930,6 +1074,7 @@ void wined3d_cs_emit_set_scissor_rect(struct wined3d_cs *cs, const RECT *rect)
op->opcode = WINED3D_CS_OP_SET_SCISSOR_RECT;
op->rect = *rect;
@ -870,7 +971,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
cs->ops->submit(cs, sizeof(*op));
}
@@ -888,6 +996,17 @@ static UINT wined3d_cs_exec_set_rendertarget_view(struct wined3d_cs *cs, const v
@@ -941,6 +1086,17 @@ static UINT wined3d_cs_exec_set_rendertarget_view(struct wined3d_cs *cs, const v
device_invalidate_state(cs->device, STATE_FRAMEBUFFER);
return sizeof(*op);
@ -888,7 +989,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
}
void wined3d_cs_emit_set_rendertarget_view(struct wined3d_cs *cs, unsigned int view_idx,
@@ -900,6 +1019,7 @@ void wined3d_cs_emit_set_rendertarget_view(struct wined3d_cs *cs, unsigned int v
@@ -953,6 +1109,7 @@ void wined3d_cs_emit_set_rendertarget_view(struct wined3d_cs *cs, unsigned int v
op->view_idx = view_idx;
op->view = view;
@ -896,7 +997,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
cs->ops->submit(cs, sizeof(*op));
}
@@ -910,6 +1030,18 @@ static UINT wined3d_cs_exec_set_depth_stencil_view(struct wined3d_cs *cs, const
@@ -963,6 +1120,18 @@ static UINT wined3d_cs_exec_set_depth_stencil_view(struct wined3d_cs *cs, const
struct wined3d_rendertarget_view *prev;
if ((prev = cs->state.fb.depth_stencil))
@ -915,7 +1016,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
{
struct wined3d_surface *prev_surface = wined3d_rendertarget_view_get_surface(prev);
@@ -917,6 +1049,7 @@ static UINT wined3d_cs_exec_set_depth_stencil_view(struct wined3d_cs *cs, const
@@ -970,6 +1139,7 @@ static UINT wined3d_cs_exec_set_depth_stencil_view(struct wined3d_cs *cs, const
|| prev_surface->container->flags & WINED3D_TEXTURE_DISCARD))
{
surface_modify_ds_location(prev_surface, WINED3D_LOCATION_DISCARDED, prev->width, prev->height);
@ -923,7 +1024,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
if (prev_surface == cs->onscreen_depth_stencil)
{
wined3d_texture_decref(cs->onscreen_depth_stencil->container);
@@ -926,6 +1059,17 @@ static UINT wined3d_cs_exec_set_depth_stencil_view(struct wined3d_cs *cs, const
@@ -979,6 +1149,17 @@ static UINT wined3d_cs_exec_set_depth_stencil_view(struct wined3d_cs *cs, const
}
cs->state.fb.depth_stencil = op->view;
@ -941,7 +1042,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
if (!prev != !op->view)
{
@@ -942,8 +1086,10 @@ static UINT wined3d_cs_exec_set_depth_stencil_view(struct wined3d_cs *cs, const
@@ -995,8 +1176,10 @@ static UINT wined3d_cs_exec_set_depth_stencil_view(struct wined3d_cs *cs, const
}
device_invalidate_state(device, STATE_FRAMEBUFFER);
@ -952,7 +1053,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
}
void wined3d_cs_emit_set_depth_stencil_view(struct wined3d_cs *cs, struct wined3d_rendertarget_view *view)
@@ -954,6 +1100,7 @@ void wined3d_cs_emit_set_depth_stencil_view(struct wined3d_cs *cs, struct wined3
@@ -1007,6 +1190,7 @@ void wined3d_cs_emit_set_depth_stencil_view(struct wined3d_cs *cs, struct wined3
op->opcode = WINED3D_CS_OP_SET_DEPTH_STENCIL_VIEW;
op->view = view;
@ -960,7 +1061,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
cs->ops->submit(cs, sizeof(*op));
}
@@ -965,6 +1112,17 @@ static UINT wined3d_cs_exec_set_vertex_declaration(struct wined3d_cs *cs, const
@@ -1018,6 +1202,17 @@ static UINT wined3d_cs_exec_set_vertex_declaration(struct wined3d_cs *cs, const
device_invalidate_state(cs->device, STATE_VDECL);
return sizeof(*op);
@ -978,7 +1079,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
}
void wined3d_cs_emit_set_vertex_declaration(struct wined3d_cs *cs, struct wined3d_vertex_declaration *declaration)
@@ -975,10 +1133,17 @@ void wined3d_cs_emit_set_vertex_declaration(struct wined3d_cs *cs, struct wined3
@@ -1028,10 +1223,17 @@ void wined3d_cs_emit_set_vertex_declaration(struct wined3d_cs *cs, struct wined3
op->opcode = WINED3D_CS_OP_SET_VERTEX_DECLARATION;
op->declaration = declaration;
@ -996,7 +1097,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
{
const struct wined3d_cs_set_stream_source *op = data;
struct wined3d_stream_state *stream;
@@ -996,8 +1161,10 @@ static UINT wined3d_cs_exec_set_stream_source(struct wined3d_cs *cs, const void
@@ -1049,8 +1251,10 @@ static UINT wined3d_cs_exec_set_stream_source(struct wined3d_cs *cs, const void
InterlockedDecrement(&prev->resource.bind_count);
device_invalidate_state(cs->device, STATE_STREAMSRC);
@ -1007,7 +1108,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
}
void wined3d_cs_emit_set_stream_source(struct wined3d_cs *cs, UINT stream_idx,
@@ -1012,10 +1179,17 @@ void wined3d_cs_emit_set_stream_source(struct wined3d_cs *cs, UINT stream_idx,
@@ -1065,10 +1269,17 @@ void wined3d_cs_emit_set_stream_source(struct wined3d_cs *cs, UINT stream_idx,
op->offset = offset;
op->stride = stride;
@ -1025,7 +1126,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
{
const struct wined3d_cs_set_stream_source_freq *op = data;
struct wined3d_stream_state *stream;
@@ -1025,8 +1199,10 @@ static UINT wined3d_cs_exec_set_stream_source_freq(struct wined3d_cs *cs, const
@@ -1078,8 +1289,10 @@ static UINT wined3d_cs_exec_set_stream_source_freq(struct wined3d_cs *cs, const
stream->flags = op->flags;
device_invalidate_state(cs->device, STATE_STREAMSRC);
@ -1036,7 +1137,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
}
void wined3d_cs_emit_set_stream_source_freq(struct wined3d_cs *cs, UINT stream_idx, UINT frequency, UINT flags)
@@ -1039,10 +1215,17 @@ void wined3d_cs_emit_set_stream_source_freq(struct wined3d_cs *cs, UINT stream_i
@@ -1092,10 +1305,17 @@ void wined3d_cs_emit_set_stream_source_freq(struct wined3d_cs *cs, UINT stream_i
op->frequency = frequency;
op->flags = flags;
@ -1054,7 +1155,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
{
const struct wined3d_cs_set_stream_output *op = data;
struct wined3d_stream_output *stream;
@@ -1057,8 +1240,10 @@ static UINT wined3d_cs_exec_set_stream_output(struct wined3d_cs *cs, const void
@@ -1110,8 +1330,10 @@ static UINT wined3d_cs_exec_set_stream_output(struct wined3d_cs *cs, const void
InterlockedIncrement(&op->buffer->resource.bind_count);
if (prev)
InterlockedDecrement(&prev->resource.bind_count);
@ -1065,7 +1166,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
}
void wined3d_cs_emit_set_stream_output(struct wined3d_cs *cs, UINT stream_idx,
@@ -1072,10 +1257,17 @@ void wined3d_cs_emit_set_stream_output(struct wined3d_cs *cs, UINT stream_idx,
@@ -1125,10 +1347,17 @@ void wined3d_cs_emit_set_stream_output(struct wined3d_cs *cs, UINT stream_idx,
op->buffer = buffer;
op->offset = offset;
@ -1083,7 +1184,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
{
const struct wined3d_cs_set_index_buffer *op = data;
struct wined3d_buffer *prev;
@@ -1091,8 +1283,10 @@ static UINT wined3d_cs_exec_set_index_buffer(struct wined3d_cs *cs, const void *
@@ -1144,8 +1373,10 @@ static UINT wined3d_cs_exec_set_index_buffer(struct wined3d_cs *cs, const void *
InterlockedDecrement(&prev->resource.bind_count);
device_invalidate_state(cs->device, STATE_INDEXBUFFER);
@ -1094,7 +1195,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
}
void wined3d_cs_emit_set_index_buffer(struct wined3d_cs *cs, struct wined3d_buffer *buffer,
@@ -1106,10 +1300,17 @@ void wined3d_cs_emit_set_index_buffer(struct wined3d_cs *cs, struct wined3d_buff
@@ -1159,10 +1390,17 @@ void wined3d_cs_emit_set_index_buffer(struct wined3d_cs *cs, struct wined3d_buff
op->format_id = format_id;
op->offset = offset;
@ -1112,7 +1213,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
{
const struct wined3d_cs_set_constant_buffer *op = data;
struct wined3d_buffer *prev;
@@ -1123,7 +1324,9 @@ static UINT wined3d_cs_exec_set_constant_buffer(struct wined3d_cs *cs, const voi
@@ -1176,7 +1414,9 @@ static UINT wined3d_cs_exec_set_constant_buffer(struct wined3d_cs *cs, const voi
InterlockedDecrement(&prev->resource.bind_count);
device_invalidate_state(cs->device, STATE_CONSTANT_BUFFER(op->type));
@ -1122,7 +1223,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
}
void wined3d_cs_emit_set_constant_buffer(struct wined3d_cs *cs, enum wined3d_shader_type type,
@@ -1137,10 +1340,17 @@ void wined3d_cs_emit_set_constant_buffer(struct wined3d_cs *cs, enum wined3d_sha
@@ -1190,10 +1430,17 @@ void wined3d_cs_emit_set_constant_buffer(struct wined3d_cs *cs, enum wined3d_sha
op->cb_idx = cb_idx;
op->buffer = buffer;
@ -1140,7 +1241,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
{
const struct wined3d_gl_info *gl_info = &cs->device->adapter->gl_info;
const struct wined3d_d3d_info *d3d_info = &cs->device->adapter->d3d_info;
@@ -1217,8 +1427,10 @@ static UINT wined3d_cs_exec_set_texture(struct wined3d_cs *cs, const void *data)
@@ -1270,8 +1517,10 @@ static UINT wined3d_cs_exec_set_texture(struct wined3d_cs *cs, const void *data)
if (new_use_color_key)
device_invalidate_state(cs->device, STATE_COLOR_KEY);
@ -1151,7 +1252,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
}
void wined3d_cs_emit_set_texture(struct wined3d_cs *cs, UINT stage, struct wined3d_texture *texture)
@@ -1229,6 +1441,7 @@ void wined3d_cs_emit_set_texture(struct wined3d_cs *cs, UINT stage, struct wined
@@ -1282,6 +1531,7 @@ 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;
@ -1159,7 +1260,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
cs->ops->submit(cs, sizeof(*op));
}
@@ -1240,6 +1453,18 @@ static UINT wined3d_cs_exec_set_shader_resource_view(struct wined3d_cs *cs, cons
@@ -1293,6 +1543,18 @@ static UINT wined3d_cs_exec_set_shader_resource_view(struct wined3d_cs *cs, cons
device_invalidate_state(cs->device, STATE_SHADER_RESOURCE_BINDING);
return sizeof(*op);
@ -1178,7 +1279,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
}
void wined3d_cs_emit_set_shader_resource_view(struct wined3d_cs *cs, enum wined3d_shader_type type,
@@ -1253,6 +1478,7 @@ void wined3d_cs_emit_set_shader_resource_view(struct wined3d_cs *cs, enum wined3
@@ -1306,6 +1568,7 @@ void wined3d_cs_emit_set_shader_resource_view(struct wined3d_cs *cs, enum wined3
op->view_idx = view_idx;
op->view = view;
@ -1186,7 +1287,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
cs->ops->submit(cs, sizeof(*op));
}
@@ -1264,6 +1490,17 @@ static UINT wined3d_cs_exec_set_sampler(struct wined3d_cs *cs, const void *data)
@@ -1317,6 +1580,17 @@ static UINT wined3d_cs_exec_set_sampler(struct wined3d_cs *cs, const void *data)
device_invalidate_state(cs->device, STATE_SHADER_RESOURCE_BINDING);
return sizeof(*op);
@ -1204,7 +1305,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
}
void wined3d_cs_emit_set_sampler(struct wined3d_cs *cs, enum wined3d_shader_type type,
@@ -1277,6 +1514,7 @@ void wined3d_cs_emit_set_sampler(struct wined3d_cs *cs, enum wined3d_shader_type
@@ -1330,6 +1604,7 @@ void wined3d_cs_emit_set_sampler(struct wined3d_cs *cs, enum wined3d_shader_type
op->sampler_idx = sampler_idx;
op->sampler = sampler;
@ -1212,7 +1313,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
cs->ops->submit(cs, sizeof(*op));
}
@@ -1289,6 +1527,18 @@ static UINT wined3d_cs_exec_set_shader(struct wined3d_cs *cs, const void *data)
@@ -1342,6 +1617,18 @@ static UINT wined3d_cs_exec_set_shader(struct wined3d_cs *cs, const void *data)
device_invalidate_state(cs->device, STATE_SHADER_RESOURCE_BINDING);
return sizeof(*op);
@ -1231,7 +1332,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
}
void wined3d_cs_emit_set_shader(struct wined3d_cs *cs, enum wined3d_shader_type type, struct wined3d_shader *shader)
@@ -1300,6 +1550,7 @@ void wined3d_cs_emit_set_shader(struct wined3d_cs *cs, enum wined3d_shader_type
@@ -1353,6 +1640,7 @@ void wined3d_cs_emit_set_shader(struct wined3d_cs *cs, enum wined3d_shader_type
op->type = type;
op->shader = shader;
@ -1239,7 +1340,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
cs->ops->submit(cs, sizeof(*op));
}
@@ -1371,6 +1622,17 @@ static UINT wined3d_cs_exec_set_render_state(struct wined3d_cs *cs, const void *
@@ -1424,6 +1712,17 @@ static UINT wined3d_cs_exec_set_render_state(struct wined3d_cs *cs, const void *
device_invalidate_state(cs->device, STATE_RENDER(op->state));
return sizeof(*op);
@ -1257,7 +1358,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
}
void wined3d_cs_emit_set_render_state(struct wined3d_cs *cs, enum wined3d_render_state state, DWORD value)
@@ -1382,6 +1644,7 @@ void wined3d_cs_emit_set_render_state(struct wined3d_cs *cs, enum wined3d_render
@@ -1435,6 +1734,7 @@ void wined3d_cs_emit_set_render_state(struct wined3d_cs *cs, enum wined3d_render
op->state = state;
op->value = value;
@ -1265,7 +1366,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
cs->ops->submit(cs, sizeof(*op));
}
@@ -1509,6 +1772,17 @@ static UINT wined3d_cs_exec_set_texture_state(struct wined3d_cs *cs, const void
@@ -1562,6 +1862,17 @@ static UINT wined3d_cs_exec_set_texture_state(struct wined3d_cs *cs, const void
device_invalidate_state(cs->device, STATE_TEXTURESTAGE(op->stage, op->state));
return sizeof(*op);
@ -1283,7 +1384,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
}
void wined3d_cs_emit_set_texture_state(struct wined3d_cs *cs, UINT stage,
@@ -1522,6 +1796,7 @@ void wined3d_cs_emit_set_texture_state(struct wined3d_cs *cs, UINT stage,
@@ -1575,6 +1886,7 @@ void wined3d_cs_emit_set_texture_state(struct wined3d_cs *cs, UINT stage,
op->state = state;
op->value = value;
@ -1291,7 +1392,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
cs->ops->submit(cs, sizeof(*op));
}
@@ -1533,6 +1808,17 @@ static UINT wined3d_cs_exec_set_sampler_state(struct wined3d_cs *cs, const void
@@ -1586,6 +1898,17 @@ static UINT wined3d_cs_exec_set_sampler_state(struct wined3d_cs *cs, const void
device_invalidate_state(cs->device, STATE_SAMPLER(op->sampler_idx));
return sizeof(*op);
@ -1309,7 +1410,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
}
void wined3d_cs_emit_set_sampler_state(struct wined3d_cs *cs, UINT sampler_idx,
@@ -1546,6 +1832,7 @@ void wined3d_cs_emit_set_sampler_state(struct wined3d_cs *cs, UINT sampler_idx,
@@ -1599,6 +1922,7 @@ void wined3d_cs_emit_set_sampler_state(struct wined3d_cs *cs, UINT sampler_idx,
op->state = state;
op->value = value;
@ -1317,7 +1418,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
cs->ops->submit(cs, sizeof(*op));
}
@@ -1558,6 +1845,18 @@ static UINT wined3d_cs_exec_set_transform(struct wined3d_cs *cs, const void *dat
@@ -1611,6 +1935,18 @@ static UINT wined3d_cs_exec_set_transform(struct wined3d_cs *cs, const void *dat
device_invalidate_state(cs->device, STATE_TRANSFORM(op->state));
return sizeof(*op);
@ -1336,7 +1437,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
}
void wined3d_cs_emit_set_transform(struct wined3d_cs *cs, enum wined3d_transform_state state,
@@ -1570,6 +1869,7 @@ void wined3d_cs_emit_set_transform(struct wined3d_cs *cs, enum wined3d_transform
@@ -1623,6 +1959,7 @@ void wined3d_cs_emit_set_transform(struct wined3d_cs *cs, enum wined3d_transform
op->state = state;
op->matrix = *matrix;
@ -1344,7 +1445,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
cs->ops->submit(cs, sizeof(*op));
}
@@ -1581,6 +1881,17 @@ static UINT wined3d_cs_exec_set_clip_plane(struct wined3d_cs *cs, const void *da
@@ -1634,6 +1971,17 @@ static UINT wined3d_cs_exec_set_clip_plane(struct wined3d_cs *cs, const void *da
device_invalidate_state(cs->device, STATE_CLIPPLANE(op->plane_idx));
return sizeof(*op);
@ -1362,7 +1463,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
}
void wined3d_cs_emit_set_clip_plane(struct wined3d_cs *cs, UINT plane_idx, const struct wined3d_vec4 *plane)
@@ -1592,10 +1903,17 @@ void wined3d_cs_emit_set_clip_plane(struct wined3d_cs *cs, UINT plane_idx, const
@@ -1645,10 +1993,17 @@ void wined3d_cs_emit_set_clip_plane(struct wined3d_cs *cs, UINT plane_idx, const
op->plane_idx = plane_idx;
op->plane = *plane;
@ -1380,7 +1481,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
{
const struct wined3d_cs_set_color_key *op = data;
struct wined3d_texture *texture = op->texture;
@@ -1656,8 +1974,10 @@ static UINT wined3d_cs_exec_set_color_key(struct wined3d_cs *cs, const void *dat
@@ -1709,8 +2064,10 @@ static UINT wined3d_cs_exec_set_color_key(struct wined3d_cs *cs, const void *dat
break;
}
}
@ -1391,7 +1492,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
}
void wined3d_cs_emit_set_color_key(struct wined3d_cs *cs, struct wined3d_texture *texture,
@@ -1677,6 +1997,7 @@ void wined3d_cs_emit_set_color_key(struct wined3d_cs *cs, struct wined3d_texture
@@ -1730,6 +2087,7 @@ void wined3d_cs_emit_set_color_key(struct wined3d_cs *cs, struct wined3d_texture
else
op->set = 0;
@ -1399,7 +1500,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
cs->ops->submit(cs, sizeof(*op));
}
@@ -1688,6 +2009,17 @@ static UINT wined3d_cs_exec_set_material(struct wined3d_cs *cs, const void *data
@@ -1741,6 +2099,17 @@ static UINT wined3d_cs_exec_set_material(struct wined3d_cs *cs, const void *data
device_invalidate_state(cs->device, STATE_MATERIAL);
return sizeof(*op);
@ -1417,7 +1518,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
}
void wined3d_cs_emit_set_material(struct wined3d_cs *cs, const struct wined3d_material *material)
@@ -1698,6 +2030,7 @@ void wined3d_cs_emit_set_material(struct wined3d_cs *cs, const struct wined3d_ma
@@ -1751,6 +2120,7 @@ void wined3d_cs_emit_set_material(struct wined3d_cs *cs, const struct wined3d_ma
op->opcode = WINED3D_CS_OP_SET_MATERIAL;
op->material = *material;
@ -1425,7 +1526,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
cs->ops->submit(cs, sizeof(*op));
}
@@ -1713,6 +2046,19 @@ static UINT wined3d_cs_exec_reset_state(struct wined3d_cs *cs, const void *data)
@@ -1766,6 +2136,19 @@ static UINT wined3d_cs_exec_reset_state(struct wined3d_cs *cs, const void *data)
ERR("Failed to initialize CS state, hr %#x.\n", hr);
return sizeof(struct wined3d_cs_reset_state);
@ -1445,7 +1546,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
}
void wined3d_cs_emit_reset_state(struct wined3d_cs *cs)
@@ -1722,6 +2068,7 @@ void wined3d_cs_emit_reset_state(struct wined3d_cs *cs)
@@ -1775,6 +2158,7 @@ void wined3d_cs_emit_reset_state(struct wined3d_cs *cs)
op = cs->ops->require_space(cs, sizeof(*op));
op->opcode = WINED3D_CS_OP_RESET_STATE;
@ -1453,7 +1554,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
cs->ops->submit(cs, sizeof(*op));
}
@@ -1732,6 +2079,16 @@ static UINT wined3d_cs_exec_destroy_object(struct wined3d_cs *cs, const void *da
@@ -1785,6 +2169,16 @@ static UINT wined3d_cs_exec_destroy_object(struct wined3d_cs *cs, const void *da
op->callback(op->object);
return sizeof(*op);
@ -1470,7 +1571,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
}
void wined3d_cs_emit_destroy_object(struct wined3d_cs *cs, void (*callback)(void *object), void *object)
@@ -1743,6 +2100,7 @@ void wined3d_cs_emit_destroy_object(struct wined3d_cs *cs, void (*callback)(void
@@ -1796,6 +2190,7 @@ void wined3d_cs_emit_destroy_object(struct wined3d_cs *cs, void (*callback)(void
op->callback = callback;
op->object = object;
@ -1478,7 +1579,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
cs->ops->submit(cs, sizeof(*op));
}
@@ -2999,5 +3357,152 @@ void wined3d_cs_destroy(struct wined3d_cs *cs)
@@ -3052,5 +3447,152 @@ void wined3d_cs_destroy(struct wined3d_cs *cs)
ERR("Closing event failed.\n");
}