Rebase against 1576dc3dd26c7bbb2ed8eb68f11799f1f1d8b6a2.

This commit is contained in:
Sebastian Lackner 2017-01-08 04:42:04 +01:00
parent cb8a0d2ffd
commit b51fe90caa
8 changed files with 487 additions and 250 deletions

View File

@ -1,4 +1,4 @@
From 26a7497a9fb1184080a1622f6a834bed50d2a239 Mon Sep 17 00:00:00 2001
From ff83c3ee1b422915d690411cda05db19ceacbdf1 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Wed, 3 Jun 2015 22:57:21 +0200
Subject: winex11.drv: Allow changing the opengl pixel format on the desktop
@ -18,7 +18,7 @@ it seems to be a suitable workaround as it fixes multiple applications.
4 files changed, 48 insertions(+), 7 deletions(-)
diff --git a/dlls/d3d10_1/tests/d3d10_1.c b/dlls/d3d10_1/tests/d3d10_1.c
index f5b1454..ac21f68 100644
index e1d6d4c97c2..bf6a9a138dd 100644
--- a/dlls/d3d10_1/tests/d3d10_1.c
+++ b/dlls/d3d10_1/tests/d3d10_1.c
@@ -226,8 +226,18 @@ static void test_create_device(void)
@ -43,10 +43,10 @@ index f5b1454..ac21f68 100644
swapchain = (IDXGISwapChain *)0xdeadbeef;
device = (ID3D10Device1 *)0xdeadbeef;
diff --git a/dlls/d3d11/tests/d3d11.c b/dlls/d3d11/tests/d3d11.c
index 04a369c..ee506f5 100644
index ac4393dd3b3..49356b398c1 100644
--- a/dlls/d3d11/tests/d3d11.c
+++ b/dlls/d3d11/tests/d3d11.c
@@ -805,10 +805,22 @@ static void test_create_device(void)
@@ -1451,10 +1451,22 @@ static void test_create_device(void)
hr = D3D11CreateDeviceAndSwapChain(NULL, D3D_DRIVER_TYPE_HARDWARE, NULL, 0, NULL, 0, D3D11_SDK_VERSION,
&swapchain_desc, &swapchain, &device, &feature_level, &immediate_context);
todo_wine ok(hr == DXGI_ERROR_INVALID_CALL, "D3D11CreateDeviceAndSwapChain returned %#x.\n", hr);
@ -74,10 +74,10 @@ index 04a369c..ee506f5 100644
swapchain = (IDXGISwapChain *)0xdeadbeef;
device = (ID3D11Device *)0xdeadbeef;
diff --git a/dlls/d3d9/tests/device.c b/dlls/d3d9/tests/device.c
index 4302f76..342f8d2 100644
index aa266a5186e..986000d0278 100644
--- a/dlls/d3d9/tests/device.c
+++ b/dlls/d3d9/tests/device.c
@@ -11171,6 +11171,21 @@ static void test_get_render_target_data(void)
@@ -11401,6 +11401,21 @@ static void test_render_target_device_mismatch(void)
DestroyWindow(window);
}
@ -99,19 +99,19 @@ index 4302f76..342f8d2 100644
START_TEST(device)
{
WNDCLASSA wc = {0};
@@ -11287,6 +11302,7 @@ START_TEST(device)
test_check_device_format();
@@ -11518,6 +11533,7 @@ START_TEST(device)
test_miptree_layout();
test_get_render_target_data();
test_render_target_device_mismatch();
+ test_desktop_window();
UnregisterClassA("d3d9_test_wc", GetModuleHandleA(NULL));
}
diff --git a/dlls/winex11.drv/opengl.c b/dlls/winex11.drv/opengl.c
index 0f7534e..613d1df 100644
index d89a19330f7..b5faac56ade 100644
--- a/dlls/winex11.drv/opengl.c
+++ b/dlls/winex11.drv/opengl.c
@@ -1457,12 +1457,15 @@ static BOOL set_pixel_format(HDC hdc, int format, BOOL allow_change)
@@ -1469,12 +1469,15 @@ static BOOL set_pixel_format(HDC hdc, int format, BOOL allow_change)
TRACE("(%p,%d)\n", hdc, format);
@ -129,5 +129,5 @@ index 0f7534e..613d1df 100644
if (!fmt)
{
--
2.8.0
2.11.0

View File

@ -52,7 +52,7 @@ usage()
# Get the upstream commit sha
upstream_commit()
{
echo "56959b18085ea22050d0226f669f112abfb37850"
echo "1576dc3dd26c7bbb2ed8eb68f11799f1f1d8b6a2"
}
# Show version information

View File

@ -1,4 +1,4 @@
From 9364fbffd1a4a65bb2b833f3d53cfa24bcf9a3b2 Mon Sep 17 00:00:00 2001
From a24f32505c70e8cb5a6961f69c1165d5806816ce 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
@ -20,7 +20,7 @@ Subject: wined3d: Move the framebuffer into wined3d_state
13 files changed, 194 insertions(+), 135 deletions(-)
diff --git a/dlls/wined3d/arb_program_shader.c b/dlls/wined3d/arb_program_shader.c
index 5de7c02..d3d35c5 100644
index 247bc360085..cb81f7f6ceb 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,10 +42,10 @@ index 5de7c02..d3d35c5 100644
}
diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c
index 0642766..0545e57 100644
index a7794fac2cb..1f991b63852 100644
--- a/dlls/wined3d/context.c
+++ b/dlls/wined3d/context.c
@@ -1706,6 +1706,11 @@ struct wined3d_context *context_create(struct wined3d_swapchain *swapchain,
@@ -1710,6 +1710,11 @@ struct wined3d_context *context_create(struct wined3d_swapchain *swapchain,
goto out;
}
@ -57,7 +57,7 @@ index 0642766..0545e57 100644
/* Initialize the texture unit mapping to a 1:1 mapping */
for (s = 0; s < MAX_COMBINED_SAMPLERS; ++s)
{
@@ -2026,6 +2031,7 @@ out:
@@ -2031,6 +2036,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 0642766..0545e57 100644
HeapFree(GetProcessHeap(), 0, ret->free_event_queries);
HeapFree(GetProcessHeap(), 0, ret->free_occlusion_queries);
HeapFree(GetProcessHeap(), 0, ret->free_timestamp_queries);
@@ -2073,6 +2079,7 @@ void context_destroy(struct wined3d_device *device, struct wined3d_context *cont
@@ -2078,6 +2084,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 0642766..0545e57 100644
HeapFree(GetProcessHeap(), 0, context->draw_buffers);
HeapFree(GetProcessHeap(), 0, context->blit_targets);
device_context_remove(device, context);
@@ -2627,7 +2634,7 @@ BOOL context_apply_clear_state(struct wined3d_context *context, const struct win
@@ -2632,7 +2639,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 0642766..0545e57 100644
|| rt_count != gl_info->limits.buffers)
{
if (!context_validate_rt_config(rt_count, rts, dsv))
@@ -2672,6 +2679,8 @@ BOOL context_apply_clear_state(struct wined3d_context *context, const struct win
@@ -2677,6 +2684,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 0642766..0545e57 100644
}
else if (wined3d_settings.offscreen_rendering_mode == ORM_FBO
&& (!rt_count || wined3d_resource_is_offscreen(rts[0]->resource)))
@@ -2729,7 +2738,7 @@ BOOL context_apply_clear_state(struct wined3d_context *context, const struct win
@@ -2734,7 +2743,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 0642766..0545e57 100644
struct wined3d_shader *ps = state->shader[WINED3D_SHADER_TYPE_PIXEL];
DWORD rt_mask, rt_mask_bits;
unsigned int i;
@@ -2759,7 +2768,7 @@ static DWORD find_draw_buffers_mask(const struct wined3d_context *context, const
@@ -2764,7 +2773,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 0642766..0545e57 100644
DWORD *cur_mask;
if (wined3d_settings.offscreen_rendering_mode == ORM_FBO)
@@ -3048,6 +3057,8 @@ void context_state_drawbuf(struct wined3d_context *context, const struct wined3d
@@ -3053,6 +3062,8 @@ void context_state_drawbuf(struct wined3d_context *context, const struct wined3d
context_apply_draw_buffers(context, rt_mask);
*cur_mask = rt_mask;
}
@ -118,7 +118,7 @@ index 0642766..0545e57 100644
}
static BOOL fixed_get_input(BYTE usage, BYTE usage_idx, unsigned int *regnum)
@@ -3479,7 +3490,7 @@ BOOL context_apply_draw_state(struct wined3d_context *context,
@@ -3484,7 +3495,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,7 +128,7 @@ index 0642766..0545e57 100644
WORD map;
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
index 1029c1a..3bca1bd 100644
index 1029c1a1810..3bca1bd882f 100644
--- a/dlls/wined3d/cs.c
+++ b/dlls/wined3d/cs.c
@@ -350,19 +350,19 @@ static void wined3d_cs_exec_clear(struct wined3d_cs *cs, const void *data)
@ -281,7 +281,7 @@ index 1029c1a..3bca1bd 100644
HeapFree(GetProcessHeap(), 0, cs);
}
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index 1ce6d76..9757cd5 100644
index 8d6cbe358ae..c5eed77293a 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -1004,7 +1004,7 @@ static void device_init_swapchain_state(struct wined3d_device *device, struct wi
@ -564,21 +564,21 @@ index 1ce6d76..9757cd5 100644
wined3d_cs_emit_set_scissor_rect(device->cs, &state->scissor_rect);
}
@@ -5021,11 +5008,11 @@ void device_resource_released(struct wined3d_device *device, struct wined3d_reso
for (i = 0; i < device->adapter->gl_info.limits.buffers; ++i)
@@ -5023,11 +5010,11 @@ void device_resource_released(struct wined3d_device *device, struct wined3d_reso
{
- if ((rtv = device->fb.render_targets[i]) && rtv->resource == resource)
+ if ((rtv = device->state.fb.render_targets[i]) && rtv->resource == resource)
ERR("Resource %p is still in use as render target %u.\n", resource, i);
for (i = 0; i < device->adapter->gl_info.limits.buffers; ++i)
{
- if ((rtv = device->fb.render_targets[i]) && rtv->resource == resource)
+ if ((rtv = device->state.fb.render_targets[i]) && rtv->resource == resource)
ERR("Resource %p is still in use as render target %u.\n", resource, i);
}
- if ((rtv = device->fb.depth_stencil) && rtv->resource == resource)
+ if ((rtv = device->state.fb.depth_stencil) && rtv->resource == resource)
ERR("Resource %p is still in use as depth/stencil buffer.\n", resource);
}
- if ((rtv = device->fb.depth_stencil) && rtv->resource == resource)
+ if ((rtv = device->state.fb.depth_stencil) && rtv->resource == resource)
ERR("Resource %p is still in use as depth/stencil buffer.\n", resource);
switch (type)
@@ -5150,8 +5137,12 @@ HRESULT device_init(struct wined3d_device *device, struct wined3d *wined3d,
@@ -5153,8 +5140,12 @@ HRESULT device_init(struct wined3d_device *device, struct wined3d *wined3d,
device->blitter = adapter->blitter;
@ -594,7 +594,7 @@ index 1ce6d76..9757cd5 100644
if (!(device->cs = wined3d_cs_create(device)))
diff --git a/dlls/wined3d/drawprim.c b/dlls/wined3d/drawprim.c
index 06c5bc9..fa92f25 100644
index 06c5bc9b491..fa92f25adb0 100644
--- a/dlls/wined3d/drawprim.c
+++ b/dlls/wined3d/drawprim.c
@@ -413,7 +413,7 @@ void draw_primitive(struct wined3d_device *device, const struct wined3d_state *s
@ -607,7 +607,7 @@ index 06c5bc9..fa92f25 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 a3c2190..4edeb01 100644
index fbecd167cb0..c54c4d9c325 100644
--- a/dlls/wined3d/glsl_shader.c
+++ b/dlls/wined3d/glsl_shader.c
@@ -1561,7 +1561,7 @@ static void shader_glsl_load_constants(void *shader_priv, struct wined3d_context
@ -620,10 +620,10 @@ index a3c2190..4edeb01 100644
0.0f,
0.0f,
diff --git a/dlls/wined3d/shader.c b/dlls/wined3d/shader.c
index 24051cc..5c28bff 100644
index 5e9b0de9cc2..f5bbb07f14b 100644
--- a/dlls/wined3d/shader.c
+++ b/dlls/wined3d/shader.c
@@ -3198,7 +3198,7 @@ void find_ps_compile_args(const struct wined3d_state *state, const struct wined3
@@ -3208,7 +3208,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. */
@ -633,7 +633,7 @@ index 24051cc..5c28bff 100644
static unsigned int warned = 0;
diff --git a/dlls/wined3d/state.c b/dlls/wined3d/state.c
index 6e89fbc..519c084 100644
index 6e89fbc92ac..519c084f47d 100644
--- a/dlls/wined3d/state.c
+++ b/dlls/wined3d/state.c
@@ -152,7 +152,7 @@ static void state_zenable(struct wined3d_context *context, const struct wined3d_
@ -737,7 +737,7 @@ index 6e89fbc..519c084 100644
else
gl_info->gl_ops.gl.p_glDisable(GL_FRAMEBUFFER_SRGB);
diff --git a/dlls/wined3d/stateblock.c b/dlls/wined3d/stateblock.c
index fd01752..2fd4ef4 100644
index fd017524075..2fd4ef494f7 100644
--- a/dlls/wined3d/stateblock.c
+++ b/dlls/wined3d/stateblock.c
@@ -431,6 +431,7 @@ void state_unbind_resources(struct wined3d_state *state)
@ -837,7 +837,7 @@ index fd01752..2fd4ef4 100644
if (type == WINED3D_SBT_RECORDED)
return WINED3D_OK;
diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
index d21b293..6db9ca8 100644
index 69122fbc3e5..35c5d489cc0 100644
--- a/dlls/wined3d/surface.c
+++ b/dlls/wined3d/surface.c
@@ -2572,7 +2572,7 @@ static HRESULT surface_blt_special(struct wined3d_surface *dst_surface, const RE
@ -850,7 +850,7 @@ index d21b293..6db9ca8 100644
struct wined3d_texture *src_texture;
diff --git a/dlls/wined3d/swapchain.c b/dlls/wined3d/swapchain.c
index dc7f5de..2773d2f 100644
index c95faddb42a..34558a8a1f2 100644
--- a/dlls/wined3d/swapchain.c
+++ b/dlls/wined3d/swapchain.c
@@ -488,7 +488,7 @@ static void swapchain_gl_present(struct wined3d_swapchain *swapchain,
@ -863,10 +863,10 @@ index dc7f5de..2773d2f 100644
struct wined3d_texture *logo_texture;
struct wined3d_context *context;
diff --git a/dlls/wined3d/utils.c b/dlls/wined3d/utils.c
index 3eed41a..ea4d94d 100644
index 715823bfd28..2442228a7d4 100644
--- a/dlls/wined3d/utils.c
+++ b/dlls/wined3d/utils.c
@@ -4583,7 +4583,7 @@ void get_projection_matrix(const struct wined3d_context *context, const struct w
@@ -4624,7 +4624,7 @@ void get_projection_matrix(const struct wined3d_context *context, const struct w
float y_offset = flip
? (center_offset - (2.0f * y) - h) / h
: (center_offset - (2.0f * y) - h) / -h;
@ -875,7 +875,7 @@ index 3eed41a..ea4d94d 100644
state->render_states[WINED3D_RS_ZENABLE] : WINED3D_ZB_FALSE;
float z_scale = zenable ? clip_control ? 1.0f : 2.0f : 0.0f;
float z_offset = zenable ? clip_control ? 0.0f : -1.0f : 0.0f;
@@ -5382,7 +5382,7 @@ void gen_ffp_frag_op(const struct wined3d_context *context, const struct wined3d
@@ -5423,7 +5423,7 @@ void gen_ffp_frag_op(const struct wined3d_context *context, const struct wined3d
break;
}
}
@ -885,10 +885,10 @@ index 3eed41a..ea4d94d 100644
|| !state->render_states[WINED3D_RS_CLIPPLANEENABLE])
{
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index df28689..497b79a 100644
index f6e287b1fbd..33d18326f2f 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -1504,6 +1504,36 @@ struct wined3d_timestamp_query
@@ -1508,6 +1508,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;
@ -925,7 +925,7 @@ index df28689..497b79a 100644
struct wined3d_context
{
const struct wined3d_gl_info *gl_info;
@@ -1518,6 +1548,7 @@ struct wined3d_context
@@ -1522,6 +1552,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 */
@ -933,7 +933,7 @@ index df28689..497b79a 100644
struct wined3d_device *device;
struct wined3d_swapchain *swapchain;
@@ -1630,12 +1661,6 @@ struct wined3d_context
@@ -1634,12 +1665,6 @@ struct wined3d_context
GLuint dummy_arbfp_prog;
};
@ -946,7 +946,7 @@ index df28689..497b79a 100644
typedef void (*APPLYSTATEFUNC)(struct wined3d_context *ctx, const struct wined3d_state *state, DWORD state_id);
struct StateEntry
@@ -2442,7 +2467,7 @@ struct wined3d_stream_state
@@ -2446,7 +2471,7 @@ struct wined3d_stream_state
struct wined3d_state
{
DWORD flags;
@ -955,7 +955,7 @@ index df28689..497b79a 100644
struct wined3d_vertex_declaration *vertex_declaration;
struct wined3d_stream_output stream_output[MAX_STREAM_OUT];
@@ -2548,7 +2573,6 @@ struct wined3d_device
@@ -2552,7 +2577,6 @@ struct wined3d_device
struct wine_rb_tree samplers;
/* Render Target Support */
@ -963,7 +963,7 @@ index df28689..497b79a 100644
struct wined3d_surface *onscreen_depth_stencil;
struct wined3d_rendertarget_view *auto_depth_stencil_view;
@@ -3098,9 +3122,8 @@ struct wined3d_stateblock
@@ -3102,9 +3126,8 @@ struct wined3d_stateblock
void stateblock_init_contained_states(struct wined3d_stateblock *stateblock) DECLSPEC_HIDDEN;
void state_cleanup(struct wined3d_state *state) DECLSPEC_HIDDEN;
@ -975,7 +975,7 @@ index df28689..497b79a 100644
void state_unbind_resources(struct wined3d_state *state) DECLSPEC_HIDDEN;
struct wined3d_cs_ops
@@ -3113,7 +3136,6 @@ struct wined3d_cs
@@ -3117,7 +3140,6 @@ struct wined3d_cs
{
const struct wined3d_cs_ops *ops;
struct wined3d_device *device;
@ -984,5 +984,5 @@ index df28689..497b79a 100644
size_t data_size;
--
2.9.0
2.11.0

View File

@ -1,16 +1,16 @@
From b5aa14996c4b4968eb011080fc0f9b6211c486aa Mon Sep 17 00:00:00 2001
From e5b486b16a916f4d08e671e8efb851aca39b1ade Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20D=C3=B6singer?= <stefan@codeweavers.com>
Date: Sat, 6 Jul 2013 18:26:11 +0200
Subject: wined3d: Add query support to the command stream
---
dlls/wined3d/cs.c | 36 ++++++++++++++++++++++++++++++++++++
dlls/wined3d/cs.c | 38 ++++++++++++++++++++++++++++++++++++++
dlls/wined3d/query.c | 15 +++++++++++----
dlls/wined3d/wined3d_private.h | 2 ++
3 files changed, 49 insertions(+), 4 deletions(-)
3 files changed, 51 insertions(+), 4 deletions(-)
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
index 2643713..ee57a56 100644
index 26437136163..b0a25f86374 100644
--- a/dlls/wined3d/cs.c
+++ b/dlls/wined3d/cs.c
@@ -74,6 +74,7 @@ enum wined3d_cs_op
@ -21,7 +21,7 @@ index 2643713..ee57a56 100644
WINED3D_CS_OP_STOP,
};
@@ -425,6 +426,13 @@ struct wined3d_cs_skip
@@ -425,6 +426,14 @@ struct wined3d_cs_skip
DWORD size;
};
@ -29,13 +29,14 @@ index 2643713..ee57a56 100644
+{
+ enum wined3d_cs_op opcode;
+ struct wined3d_query *query;
+ DWORD flags;
+ BOOL *ret;
+};
+
static void wined3d_cs_submit(struct wined3d_cs *cs, size_t size)
{
LONG new_val = (cs->queue.head + size) & (WINED3D_CS_QUEUE_SIZE - 1);
@@ -2131,6 +2139,33 @@ void wined3d_cs_emit_texture_unmap(struct wined3d_cs *cs, struct wined3d_texture
@@ -2131,6 +2140,34 @@ void wined3d_cs_emit_texture_unmap(struct wined3d_cs *cs, struct wined3d_texture
cs->ops->submit(cs, sizeof(*op));
}
@ -44,18 +45,19 @@ index 2643713..ee57a56 100644
+ const struct wined3d_cs_query_poll *op = data;
+ struct wined3d_query *query = op->query;
+
+ *op->ret = query->query_ops->query_poll(query);
+ *op->ret = query->query_ops->query_poll(query, op->flags);
+
+ return sizeof(*op);
+}
+
+void wined3d_cs_emit_query_poll(struct wined3d_cs *cs, struct wined3d_query *query, BOOL *ret)
+void wined3d_cs_emit_query_poll(struct wined3d_cs *cs, struct wined3d_query *query, DWORD flags, BOOL *ret)
+{
+ struct wined3d_cs_query_poll *op;
+
+ op = cs->ops->require_space(cs, sizeof(*op));
+ op->opcode = WINED3D_CS_OP_QUERY_POLL;
+ op->query = query;
+ op->flags = flags;
+ op->ret = ret;
+
+ cs->ops->submit(cs, sizeof(*op));
@ -69,7 +71,7 @@ index 2643713..ee57a56 100644
static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void *data) =
{
/* WINED3D_CS_OP_NOP */ wined3d_cs_exec_nop,
@@ -2183,6 +2218,7 @@ static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void
@@ -2183,6 +2220,7 @@ static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void
/* WINED3D_CS_OP_CLEAR_RTV */ wined3d_cs_exec_clear_rtv,
/* WINED3D_CS_OP_TEXTURE_MAP */ wined3d_cs_exec_texture_map,
/* WINED3D_CS_OP_TEXTURE_UNMAP */ wined3d_cs_exec_texture_unmap,
@ -78,26 +80,26 @@ index 2643713..ee57a56 100644
static void *wined3d_cs_mt_require_space(struct wined3d_cs *cs, size_t size)
diff --git a/dlls/wined3d/query.c b/dlls/wined3d/query.c
index 902e01a..d8cfb64 100644
index c5ca37d4878..c8dd76155d8 100644
--- a/dlls/wined3d/query.c
+++ b/dlls/wined3d/query.c
@@ -338,8 +338,13 @@ HRESULT CDECL wined3d_query_get_data(struct wined3d_query *query,
@@ -339,8 +339,13 @@ HRESULT CDECL wined3d_query_get_data(struct wined3d_query *query,
if (query->state == QUERY_CREATED)
WARN("Query wasn't started yet.\n");
- else if (!query->query_ops->query_poll(query))
- else if (!query->query_ops->query_poll(query, flags))
- return S_FALSE;
+ else
+ {
+ BOOL ret;
+ wined3d_cs_emit_query_poll(query->device->cs, query, &ret);
+ wined3d_cs_emit_query_poll(query->device->cs, query, flags, &ret);
+ if (!ret)
+ return S_FALSE;
+ }
if (data)
memcpy(data, query->data, min(data_size, query->data_size));
@@ -491,7 +496,7 @@ static void wined3d_occlusion_query_ops_issue(struct wined3d_query *query, DWORD
@@ -492,7 +497,7 @@ static void wined3d_occlusion_query_ops_issue(struct wined3d_query *query, DWORD
* restart. */
if (flags & WINED3DISSUE_BEGIN)
{
@ -106,7 +108,7 @@ index 902e01a..d8cfb64 100644
{
if (oq->context->tid != GetCurrentThreadId())
{
@@ -521,13 +526,14 @@ static void wined3d_occlusion_query_ops_issue(struct wined3d_query *query, DWORD
@@ -522,13 +527,14 @@ static void wined3d_occlusion_query_ops_issue(struct wined3d_query *query, DWORD
checkGLcall("glBeginQuery()");
context_release(context);
@ -122,7 +124,7 @@ index 902e01a..d8cfb64 100644
{
if (oq->context->tid != GetCurrentThreadId())
{
@@ -543,6 +549,7 @@ static void wined3d_occlusion_query_ops_issue(struct wined3d_query *query, DWORD
@@ -544,6 +550,7 @@ static void wined3d_occlusion_query_ops_issue(struct wined3d_query *query, DWORD
context_release(context);
}
}
@ -131,10 +133,10 @@ index 902e01a..d8cfb64 100644
}
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 12835d0..2f6a586 100644
index 6fff9e1674b..bf1ffb1e87c 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -1491,6 +1491,7 @@ struct wined3d_occlusion_query
@@ -1495,6 +1495,7 @@ struct wined3d_occlusion_query
GLuint id;
struct wined3d_context *context;
UINT64 samples;
@ -142,14 +144,14 @@ index 12835d0..2f6a586 100644
};
struct wined3d_timestamp_query
@@ -3187,6 +3188,7 @@ void wined3d_cs_emit_preload_resource(struct wined3d_cs *cs, struct wined3d_reso
@@ -3191,6 +3192,7 @@ void wined3d_cs_emit_preload_resource(struct wined3d_cs *cs, struct wined3d_reso
void wined3d_cs_emit_present(struct wined3d_cs *cs, struct wined3d_swapchain *swapchain,
const RECT *src_rect, const RECT *dst_rect, HWND dst_window_override, DWORD flags) DECLSPEC_HIDDEN;
void wined3d_cs_emit_query_issue(struct wined3d_cs *cs, struct wined3d_query *query, DWORD flags) DECLSPEC_HIDDEN;
+void wined3d_cs_emit_query_poll(struct wined3d_cs *cs, struct wined3d_query *query, BOOL *ret) DECLSPEC_HIDDEN;
+void wined3d_cs_emit_query_poll(struct wined3d_cs *cs, struct wined3d_query *query, DWORD flags, BOOL *ret) DECLSPEC_HIDDEN;
void wined3d_cs_emit_reset_state(struct wined3d_cs *cs) DECLSPEC_HIDDEN;
void wined3d_cs_emit_set_base_vertex_index(struct wined3d_cs *cs,
UINT base_vertex_index) DECLSPEC_HIDDEN;
--
2.9.0
2.11.0

View File

@ -1,19 +1,19 @@
From 30ac0963aabd73ccd9a2035f828cc10ad8e9dc76 Mon Sep 17 00:00:00 2001
From 374805ab329cba9e7695c1fe46ce9b13fa4e6fcd Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20D=C3=B6singer?= <stefan@codeweavers.com>
Date: Sat, 6 Jul 2013 19:18:48 +0200
Subject: wined3d: Poll queries automatically in the CS
---
dlls/wined3d/cs.c | 69 +++++++++++++++++++-----------------------
dlls/wined3d/query.c | 22 ++++++++------
dlls/wined3d/cs.c | 71 ++++++++++++++++++------------------------
dlls/wined3d/query.c | 23 ++++++++------
dlls/wined3d/wined3d_private.h | 5 +--
3 files changed, 46 insertions(+), 50 deletions(-)
3 files changed, 47 insertions(+), 52 deletions(-)
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
index 9054fc3..920f93d 100644
index c3bfda433b4..977e0ac3bda 100644
--- a/dlls/wined3d/cs.c
+++ b/dlls/wined3d/cs.c
@@ -72,7 +72,6 @@ enum wined3d_cs_op
@@ -74,7 +74,6 @@ enum wined3d_cs_op
WINED3D_CS_OP_CLEAR_RTV,
WINED3D_CS_OP_TEXTURE_MAP,
WINED3D_CS_OP_TEXTURE_UNMAP,
@ -21,7 +21,7 @@ index 9054fc3..920f93d 100644
WINED3D_CS_OP_STOP,
};
@@ -411,13 +410,6 @@ struct wined3d_cs_skip
@@ -426,14 +425,6 @@ struct wined3d_cs_skip
DWORD size;
};
@ -29,13 +29,14 @@ index 9054fc3..920f93d 100644
-{
- enum wined3d_cs_op opcode;
- struct wined3d_query *query;
- DWORD flags;
- BOOL *ret;
-};
-
static void wined3d_cs_submit(struct wined3d_cs *cs, size_t size)
{
LONG new_val = (cs->queue.head + size) & (WINED3D_CS_QUEUE_SIZE - 1);
@@ -1682,8 +1674,9 @@ static UINT wined3d_cs_exec_query_issue(struct wined3d_cs *cs, const void *data)
@@ -1737,8 +1728,9 @@ static UINT wined3d_cs_exec_query_issue(struct wined3d_cs *cs, const void *data)
query->query_ops->query_issue(query, op->flags);
@ -47,7 +48,7 @@ index 9054fc3..920f93d 100644
return sizeof(*op);
}
@@ -2061,33 +2054,6 @@ void wined3d_cs_emit_texture_unmap(struct wined3d_cs *cs, struct wined3d_texture
@@ -2143,34 +2135,6 @@ void wined3d_cs_emit_texture_unmap(struct wined3d_cs *cs, struct wined3d_texture
cs->ops->submit(cs, sizeof(*op));
}
@ -56,18 +57,19 @@ index 9054fc3..920f93d 100644
- const struct wined3d_cs_query_poll *op = data;
- struct wined3d_query *query = op->query;
-
- *op->ret = query->query_ops->query_poll(query);
- *op->ret = query->query_ops->query_poll(query, op->flags);
-
- return sizeof(*op);
-}
-
-void wined3d_cs_emit_query_poll(struct wined3d_cs *cs, struct wined3d_query *query, BOOL *ret)
-void wined3d_cs_emit_query_poll(struct wined3d_cs *cs, struct wined3d_query *query, DWORD flags, BOOL *ret)
-{
- struct wined3d_cs_query_poll *op;
-
- op = cs->ops->require_space(cs, sizeof(*op));
- op->opcode = WINED3D_CS_OP_QUERY_POLL;
- op->query = query;
- op->flags = flags;
- op->ret = ret;
-
- cs->ops->submit(cs, sizeof(*op));
@ -81,7 +83,7 @@ index 9054fc3..920f93d 100644
static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void *data) =
{
/* WINED3D_CS_OP_NOP */ wined3d_cs_exec_nop,
@@ -2138,7 +2104,6 @@ static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void
@@ -2223,7 +2187,6 @@ static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void
/* WINED3D_CS_OP_CLEAR_RTV */ wined3d_cs_exec_clear_rtv,
/* WINED3D_CS_OP_TEXTURE_MAP */ wined3d_cs_exec_texture_map,
/* WINED3D_CS_OP_TEXTURE_UNMAP */ wined3d_cs_exec_texture_unmap,
@ -89,7 +91,7 @@ index 9054fc3..920f93d 100644
};
static void *wined3d_cs_mt_require_space(struct wined3d_cs *cs, size_t size)
@@ -2257,17 +2222,45 @@ void wined3d_cs_switch_onscreen_ds(struct wined3d_cs *cs,
@@ -2342,17 +2305,45 @@ void wined3d_cs_switch_onscreen_ds(struct wined3d_cs *cs,
wined3d_texture_incref(cs->onscreen_depth_stencil->container);
}
@ -101,7 +103,7 @@ index 9054fc3..920f93d 100644
+ {
+ BOOL ret;
+
+ ret = query->query_ops->query_poll(query);
+ ret = query->query_ops->query_poll(query, 0);
+ if (ret)
+ {
+ list_remove(&query->poll_list_entry);
@ -136,7 +138,7 @@ index 9054fc3..920f93d 100644
{
continue;
diff --git a/dlls/wined3d/query.c b/dlls/wined3d/query.c
index 99a1411..b5e1fde 100644
index 001e7d1a9a9..e1ca7e7e01a 100644
--- a/dlls/wined3d/query.c
+++ b/dlls/wined3d/query.c
@@ -37,6 +37,7 @@ static void wined3d_query_init(struct wined3d_query *query, struct wined3d_devic
@ -147,7 +149,7 @@ index 99a1411..b5e1fde 100644
}
static struct wined3d_event_query *wined3d_event_query_from_query(struct wined3d_query *query)
@@ -266,6 +267,9 @@ static void wined3d_query_destroy_object(void *object)
@@ -267,6 +268,9 @@ static void wined3d_query_destroy_object(void *object)
{
struct wined3d_query *query = object;
@ -157,7 +159,7 @@ index 99a1411..b5e1fde 100644
/* Queries are specific to the GL context that created them. Not
* deleting the query will obviously leak it, but that's still better
* than potentially deleting a different query with the same id in this
@@ -330,12 +334,6 @@ HRESULT CDECL wined3d_query_get_data(struct wined3d_query *query,
@@ -331,12 +335,6 @@ HRESULT CDECL wined3d_query_get_data(struct wined3d_query *query,
if (flags)
WARN("Ignoring flags %#x.\n", flags);
@ -170,7 +172,7 @@ index 99a1411..b5e1fde 100644
if (query->state == QUERY_BUILDING)
{
WARN("Query is building, returning S_FALSE.\n");
@@ -343,14 +341,18 @@ HRESULT CDECL wined3d_query_get_data(struct wined3d_query *query,
@@ -344,14 +342,19 @@ HRESULT CDECL wined3d_query_get_data(struct wined3d_query *query,
}
if (query->state == QUERY_CREATED)
@ -181,23 +183,24 @@ index 99a1411..b5e1fde 100644
+ else if (!wined3d_settings.cs_multithreaded)
{
- BOOL ret;
- wined3d_cs_emit_query_poll(query->device->cs, query, &ret);
- wined3d_cs_emit_query_poll(query->device->cs, query, flags, &ret);
- if (!ret)
+ if (!query->query_ops->query_poll(query))
+ if (!query->query_ops->query_poll(query, flags))
return S_FALSE;
}
+ else if (query->counter_main != query->counter_retrieved)
+ {
+ /* FIXME: should flush */
+ return S_FALSE;
+ }
if (data)
memcpy(data, query->data, min(data_size, query->data_size));
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index d6518c7..83d270e 100644
index bb3595b2a6f..0abf4dbaa3c 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -1396,7 +1396,8 @@ struct wined3d_query
@@ -1454,7 +1454,8 @@ struct wined3d_query
const void *data;
DWORD data_size;
const struct wined3d_query_ops *query_ops;
@ -207,7 +210,7 @@ index d6518c7..83d270e 100644
};
union wined3d_gl_query_object
@@ -3067,6 +3068,7 @@ struct wined3d_cs
@@ -3168,6 +3169,7 @@ struct wined3d_cs
struct wined3d_cs_queue queue;
LONG pending_presents;
@ -215,14 +218,14 @@ index d6518c7..83d270e 100644
};
struct wined3d_cs *wined3d_cs_create(struct wined3d_device *device) DECLSPEC_HIDDEN;
@@ -3091,7 +3093,6 @@ void wined3d_cs_emit_glfinish(struct wined3d_cs *cs) DECLSPEC_HIDDEN;
@@ -3193,7 +3195,6 @@ void wined3d_cs_emit_preload_resource(struct wined3d_cs *cs, struct wined3d_reso
void wined3d_cs_emit_present(struct wined3d_cs *cs, struct wined3d_swapchain *swapchain,
const RECT *src_rect, const RECT *dst_rect, HWND dst_window_override, DWORD flags) DECLSPEC_HIDDEN;
void wined3d_cs_emit_query_issue(struct wined3d_cs *cs, struct wined3d_query *query, DWORD flags) DECLSPEC_HIDDEN;
-void wined3d_cs_emit_query_poll(struct wined3d_cs *cs, struct wined3d_query *query, BOOL *ret) DECLSPEC_HIDDEN;
-void wined3d_cs_emit_query_poll(struct wined3d_cs *cs, struct wined3d_query *query, DWORD flags, BOOL *ret) DECLSPEC_HIDDEN;
void wined3d_cs_emit_reset_state(struct wined3d_cs *cs) DECLSPEC_HIDDEN;
void wined3d_cs_emit_set_base_vertex_index(struct wined3d_cs *cs,
UINT base_vertex_index) DECLSPEC_HIDDEN;
--
2.9.0
2.11.0

View File

@ -1,4 +1,4 @@
From 48c046442f6e2ace49692a725e0b1ad2e67794d3 Mon Sep 17 00:00:00 2001
From 2551a777dc1ef94ae39b1ce075d1a347198886f4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20D=C3=B6singer?= <stefan@codeweavers.com>
Date: Wed, 24 Jul 2013 17:27:35 +0200
Subject: wined3d: Don't poll queries that failed to start
@ -10,10 +10,10 @@ Subject: wined3d: Don't poll queries that failed to start
3 files changed, 23 insertions(+), 9 deletions(-)
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
index fb55549..105cf45 100644
index 68a5c3a6fcf..35b0ce2e7b9 100644
--- a/dlls/wined3d/cs.c
+++ b/dlls/wined3d/cs.c
@@ -2013,10 +2013,11 @@ static UINT wined3d_cs_exec_query_issue(struct wined3d_cs *cs, const void *data)
@@ -1734,10 +1734,11 @@ static UINT wined3d_cs_exec_query_issue(struct wined3d_cs *cs, const void *data)
{
const struct wined3d_cs_query_issue *op = data;
struct wined3d_query *query = op->query;
@ -28,10 +28,10 @@ index fb55549..105cf45 100644
list_add_tail(&cs->query_poll_list, &query->poll_list_entry);
diff --git a/dlls/wined3d/query.c b/dlls/wined3d/query.c
index b5e1fde..164a60e 100644
index e1ca7e7e01a..5fa7f4cd83d 100644
--- a/dlls/wined3d/query.c
+++ b/dlls/wined3d/query.c
@@ -465,7 +465,7 @@ enum wined3d_query_type CDECL wined3d_query_get_type(const struct wined3d_query
@@ -479,7 +479,7 @@ enum wined3d_query_type CDECL wined3d_query_get_type(const struct wined3d_query
return query->type;
}
@ -40,7 +40,7 @@ index b5e1fde..164a60e 100644
{
TRACE("query %p, flags %#x.\n", query, flags);
@@ -474,20 +474,23 @@ static void wined3d_event_query_ops_issue(struct wined3d_query *query, DWORD fla
@@ -488,20 +488,23 @@ static void wined3d_event_query_ops_issue(struct wined3d_query *query, DWORD fla
struct wined3d_event_query *event_query = wined3d_event_query_from_query(query);
wined3d_event_query_issue(event_query, query->device);
@ -65,7 +65,7 @@ index b5e1fde..164a60e 100644
TRACE("query %p, flags %#x.\n", query, flags);
@@ -549,7 +552,10 @@ static void wined3d_occlusion_query_ops_issue(struct wined3d_query *query, DWORD
@@ -563,7 +566,10 @@ static void wined3d_occlusion_query_ops_issue(struct wined3d_query *query, DWORD
}
}
oq->started = FALSE;
@ -75,8 +75,8 @@ index b5e1fde..164a60e 100644
+ return poll;
}
static BOOL wined3d_timestamp_query_ops_poll(struct wined3d_query *query)
@@ -590,7 +596,7 @@ static BOOL wined3d_timestamp_query_ops_poll(struct wined3d_query *query)
static BOOL wined3d_timestamp_query_ops_poll(struct wined3d_query *query, DWORD flags)
@@ -604,7 +610,7 @@ static BOOL wined3d_timestamp_query_ops_poll(struct wined3d_query *query, DWORD
return available;
}
@ -85,7 +85,7 @@ index b5e1fde..164a60e 100644
{
struct wined3d_timestamp_query *tq = wined3d_timestamp_query_from_query(query);
const struct wined3d_gl_info *gl_info;
@@ -613,6 +619,10 @@ static void wined3d_timestamp_query_ops_issue(struct wined3d_query *query, DWORD
@@ -627,6 +633,10 @@ static void wined3d_timestamp_query_ops_issue(struct wined3d_query *query, DWORD
checkGLcall("glQueryCounter()");
context_release(context);
}
@ -95,8 +95,8 @@ index b5e1fde..164a60e 100644
+ return FALSE;
}
static BOOL wined3d_timestamp_disjoint_query_ops_poll(struct wined3d_query *query)
@@ -622,9 +632,10 @@ static BOOL wined3d_timestamp_disjoint_query_ops_poll(struct wined3d_query *quer
static BOOL wined3d_timestamp_disjoint_query_ops_poll(struct wined3d_query *query, DWORD flags)
@@ -636,9 +646,10 @@ static BOOL wined3d_timestamp_disjoint_query_ops_poll(struct wined3d_query *quer
return TRUE;
}
@ -107,8 +107,8 @@ index b5e1fde..164a60e 100644
+ return FALSE;
}
static BOOL wined3d_statistics_query_ops_poll(struct wined3d_query *query)
@@ -634,9 +645,10 @@ static BOOL wined3d_statistics_query_ops_poll(struct wined3d_query *query)
static BOOL wined3d_statistics_query_ops_poll(struct wined3d_query *query, DWORD flags)
@@ -648,9 +659,10 @@ static BOOL wined3d_statistics_query_ops_poll(struct wined3d_query *query, DWORD
return TRUE;
}
@ -119,8 +119,8 @@ index b5e1fde..164a60e 100644
+ return FALSE;
}
static HRESULT wined3d_overflow_query_ops_poll(struct wined3d_query *query)
@@ -646,9 +658,10 @@ static HRESULT wined3d_overflow_query_ops_poll(struct wined3d_query *query)
static HRESULT wined3d_overflow_query_ops_poll(struct wined3d_query *query, DWORD flags)
@@ -660,9 +672,10 @@ static HRESULT wined3d_overflow_query_ops_poll(struct wined3d_query *query, DWOR
return TRUE;
}
@ -133,18 +133,18 @@ index b5e1fde..164a60e 100644
static const struct wined3d_query_ops event_query_ops =
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 0da5480..0abb30b 100644
index 9e8b8ad14c5..aac56fe1848 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -1382,7 +1382,7 @@ enum wined3d_query_state
@@ -1440,7 +1440,7 @@ enum wined3d_query_state
struct wined3d_query_ops
{
BOOL (*query_poll)(struct wined3d_query *query);
BOOL (*query_poll)(struct wined3d_query *query, DWORD flags);
- void (*query_issue)(struct wined3d_query *query, DWORD flags);
+ BOOL (*query_issue)(struct wined3d_query *query, DWORD flags);
};
struct wined3d_query
--
2.9.0
2.11.0

View File

@ -2552,7 +2552,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)
@@ -1065,6 +1804,7 @@ void wined3d_cs_emit_set_render_state(struct wined3d_cs *cs, enum wined3d_render
@@ -1065,15 +1804,142 @@ void wined3d_cs_emit_set_render_state(struct wined3d_cs *cs, enum wined3d_render
op->state = state;
op->value = value;
@ -2560,10 +2560,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
cs->ops->submit(cs);
}
@@ -1096,6 +1836,159 @@ static void wined3d_cs_exec_set_sampler_state(struct wined3d_cs *cs, const void
cs->state.sampler_states[op->sampler_idx][op->state] = op->value;
device_invalidate_state(cs->device, STATE_SAMPLER(op->sampler_idx));
static void wined3d_cs_exec_set_texture_state(struct wined3d_cs *cs, const void *data)
+#else /* STAGING_CSMT */
+ cs->ops->submit(cs, sizeof(*op));
+}
@ -2685,42 +2682,47 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
+}
+
+static UINT wined3d_cs_exec_set_texture_state(struct wined3d_cs *cs, const void *data)
+{
+ const struct wined3d_cs_set_texture_state *op = data;
+
+ cs->state.texture_states[op->stage][op->state] = op->value;
+ device_invalidate_state(cs->device, STATE_TEXTURESTAGE(op->stage, op->state));
+#endif /* STAGING_CSMT */
{
const struct wined3d_cs_set_texture_state *op = data;
cs->state.texture_states[op->stage][op->state] = op->value;
device_invalidate_state(cs->device, STATE_TEXTURESTAGE(op->stage, op->state));
+#if defined(STAGING_CSMT)
+
+ return sizeof(*op);
+}
+
+void wined3d_cs_emit_set_texture_state(struct wined3d_cs *cs, UINT stage,
+ enum wined3d_texture_stage_state state, DWORD value)
+{
+ struct wined3d_cs_set_texture_state *op;
+
+ op = cs->ops->require_space(cs, sizeof(*op));
+ op->opcode = WINED3D_CS_OP_SET_TEXTURE_STATE;
+ op->stage = stage;
+ op->state = state;
+ op->value = value;
+
+#endif /* STAGING_CSMT */
}
void wined3d_cs_emit_set_texture_state(struct wined3d_cs *cs, UINT stage,
@@ -1087,15 +1953,26 @@ void wined3d_cs_emit_set_texture_state(struct wined3d_cs *cs, UINT stage,
op->state = state;
op->value = value;
+#if !defined(STAGING_CSMT)
cs->ops->submit(cs);
}
static void wined3d_cs_exec_set_sampler_state(struct wined3d_cs *cs, const void *data)
+#else /* STAGING_CSMT */
+ cs->ops->submit(cs, sizeof(*op));
+}
+
+static UINT wined3d_cs_exec_set_sampler_state(struct wined3d_cs *cs, const void *data)
+{
+ const struct wined3d_cs_set_sampler_state *op = data;
+
+ cs->state.sampler_states[op->sampler_idx][op->state] = op->value;
+ device_invalidate_state(cs->device, STATE_SAMPLER(op->sampler_idx));
+#endif /* STAGING_CSMT */
{
const struct wined3d_cs_set_sampler_state *op = data;
cs->state.sampler_states[op->sampler_idx][op->state] = op->value;
device_invalidate_state(cs->device, STATE_SAMPLER(op->sampler_idx));
+#if defined(STAGING_CSMT)
+
+ return sizeof(*op);
+#endif /* STAGING_CSMT */
}
void wined3d_cs_emit_set_sampler_state(struct wined3d_cs *cs, UINT sampler_idx,
@@ -1109,16 +2002,27 @@ void wined3d_cs_emit_set_sampler_state(struct wined3d_cs *cs, UINT sampler_idx,
@@ -1109,16 +1986,27 @@ void wined3d_cs_emit_set_sampler_state(struct wined3d_cs *cs, UINT sampler_idx,
op->state = state;
op->value = value;
@ -2748,7 +2750,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,
@@ -1131,15 +2035,26 @@ void wined3d_cs_emit_set_transform(struct wined3d_cs *cs, enum wined3d_transform
@@ -1131,15 +2019,26 @@ void wined3d_cs_emit_set_transform(struct wined3d_cs *cs, enum wined3d_transform
op->state = state;
op->matrix = *matrix;
@ -2775,7 +2777,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)
@@ -1151,10 +2066,17 @@ void wined3d_cs_emit_set_clip_plane(struct wined3d_cs *cs, UINT plane_idx, const
@@ -1151,10 +2050,17 @@ void wined3d_cs_emit_set_clip_plane(struct wined3d_cs *cs, UINT plane_idx, const
op->plane_idx = plane_idx;
op->plane = *plane;
@ -2793,7 +2795,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;
@@ -1215,6 +2137,10 @@ static void wined3d_cs_exec_set_color_key(struct wined3d_cs *cs, const void *dat
@@ -1215,6 +2121,10 @@ static void wined3d_cs_exec_set_color_key(struct wined3d_cs *cs, const void *dat
break;
}
}
@ -2804,7 +2806,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,
@@ -1234,15 +2160,26 @@ void wined3d_cs_emit_set_color_key(struct wined3d_cs *cs, struct wined3d_texture
@@ -1234,15 +2144,26 @@ void wined3d_cs_emit_set_color_key(struct wined3d_cs *cs, struct wined3d_texture
else
op->set = 0;
@ -2831,7 +2833,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)
@@ -1253,17 +2190,35 @@ void wined3d_cs_emit_set_material(struct wined3d_cs *cs, const struct wined3d_ma
@@ -1253,17 +2174,35 @@ void wined3d_cs_emit_set_material(struct wined3d_cs *cs, const struct wined3d_ma
op->opcode = WINED3D_CS_OP_SET_MATERIAL;
op->material = *material;
@ -2867,7 +2869,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
}
void wined3d_cs_emit_reset_state(struct wined3d_cs *cs)
@@ -1273,14 +2228,25 @@ void wined3d_cs_emit_reset_state(struct wined3d_cs *cs)
@@ -1273,14 +2212,25 @@ 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;
@ -2893,7 +2895,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)
@@ -1292,15 +2258,50 @@ void wined3d_cs_emit_destroy_object(struct wined3d_cs *cs, void (*callback)(void
@@ -1292,15 +2242,50 @@ void wined3d_cs_emit_destroy_object(struct wined3d_cs *cs, void (*callback)(void
op->callback = callback;
op->object = object;
@ -2944,7 +2946,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
}
void wined3d_cs_emit_query_issue(struct wined3d_cs *cs, struct wined3d_query *query, DWORD flags)
@@ -1312,16 +2313,27 @@ void wined3d_cs_emit_query_issue(struct wined3d_cs *cs, struct wined3d_query *qu
@@ -1312,16 +2297,27 @@ void wined3d_cs_emit_query_issue(struct wined3d_cs *cs, struct wined3d_query *qu
op->query = query;
op->flags = flags;
@ -2972,7 +2974,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
}
void wined3d_cs_emit_preload_resource(struct wined3d_cs *cs, struct wined3d_resource *resource)
@@ -1334,16 +2346,27 @@ void wined3d_cs_emit_preload_resource(struct wined3d_cs *cs, struct wined3d_reso
@@ -1334,16 +2330,27 @@ void wined3d_cs_emit_preload_resource(struct wined3d_cs *cs, struct wined3d_reso
wined3d_resource_acquire(resource);
@ -3000,7 +3002,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
}
void wined3d_cs_emit_unload_resource(struct wined3d_cs *cs, struct wined3d_resource *resource)
@@ -1356,6 +2379,7 @@ void wined3d_cs_emit_unload_resource(struct wined3d_cs *cs, struct wined3d_resou
@@ -1356,6 +2363,7 @@ void wined3d_cs_emit_unload_resource(struct wined3d_cs *cs, struct wined3d_resou
wined3d_resource_acquire(resource);
@ -3008,55 +3010,148 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
cs->ops->submit(cs);
}
@@ -1561,5 +2585,1175 @@ void wined3d_cs_destroy(struct wined3d_cs *cs)
state_cleanup(&cs->state);
HeapFree(GetProcessHeap(), 0, cs->fb.render_targets);
HeapFree(GetProcessHeap(), 0, cs->data);
@@ -1414,152 +2422,1286 @@ HRESULT wined3d_cs_unmap(struct wined3d_cs *cs, struct wined3d_resource *resourc
static void (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void *data) =
{
- /* WINED3D_CS_OP_PRESENT */ wined3d_cs_exec_present,
- /* WINED3D_CS_OP_CLEAR */ wined3d_cs_exec_clear,
- /* WINED3D_CS_OP_DRAW */ wined3d_cs_exec_draw,
- /* WINED3D_CS_OP_SET_PREDICATION */ wined3d_cs_exec_set_predication,
- /* WINED3D_CS_OP_SET_VIEWPORT */ wined3d_cs_exec_set_viewport,
- /* WINED3D_CS_OP_SET_SCISSOR_RECT */ wined3d_cs_exec_set_scissor_rect,
- /* WINED3D_CS_OP_SET_RENDERTARGET_VIEW */ wined3d_cs_exec_set_rendertarget_view,
- /* WINED3D_CS_OP_SET_DEPTH_STENCIL_VIEW */ wined3d_cs_exec_set_depth_stencil_view,
- /* WINED3D_CS_OP_SET_VERTEX_DECLARATION */ wined3d_cs_exec_set_vertex_declaration,
- /* WINED3D_CS_OP_SET_STREAM_SOURCE */ wined3d_cs_exec_set_stream_source,
- /* WINED3D_CS_OP_SET_STREAM_SOURCE_FREQ */ wined3d_cs_exec_set_stream_source_freq,
- /* WINED3D_CS_OP_SET_STREAM_OUTPUT */ wined3d_cs_exec_set_stream_output,
- /* WINED3D_CS_OP_SET_INDEX_BUFFER */ wined3d_cs_exec_set_index_buffer,
- /* WINED3D_CS_OP_SET_CONSTANT_BUFFER */ wined3d_cs_exec_set_constant_buffer,
- /* WINED3D_CS_OP_SET_TEXTURE */ wined3d_cs_exec_set_texture,
- /* WINED3D_CS_OP_SET_SHADER_RESOURCE_VIEW */ wined3d_cs_exec_set_shader_resource_view,
- /* WINED3D_CS_OP_SET_UNORDERED_ACCESS_VIEW */ wined3d_cs_exec_set_unordered_access_view,
- /* WINED3D_CS_OP_SET_SAMPLER */ wined3d_cs_exec_set_sampler,
- /* WINED3D_CS_OP_SET_SHADER */ wined3d_cs_exec_set_shader,
- /* WINED3D_CS_OP_SET_RASTERIZER_STATE */ wined3d_cs_exec_set_rasterizer_state,
- /* WINED3D_CS_OP_SET_RENDER_STATE */ wined3d_cs_exec_set_render_state,
- /* WINED3D_CS_OP_SET_TEXTURE_STATE */ wined3d_cs_exec_set_texture_state,
- /* WINED3D_CS_OP_SET_SAMPLER_STATE */ wined3d_cs_exec_set_sampler_state,
- /* WINED3D_CS_OP_SET_TRANSFORM */ wined3d_cs_exec_set_transform,
- /* WINED3D_CS_OP_SET_CLIP_PLANE */ wined3d_cs_exec_set_clip_plane,
- /* WINED3D_CS_OP_SET_COLOR_KEY */ wined3d_cs_exec_set_color_key,
- /* 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,
- /* WINED3D_CS_OP_QUERY_ISSUE */ wined3d_cs_exec_query_issue,
- /* WINED3D_CS_OP_PRELOAD_RESOURCE */ wined3d_cs_exec_preload_resource,
- /* WINED3D_CS_OP_UNLOAD_RESOURCE */ wined3d_cs_exec_unload_resource,
- /* WINED3D_CS_OP_MAP */ wined3d_cs_exec_map,
- /* WINED3D_CS_OP_UNMAP */ wined3d_cs_exec_unmap,
-};
+#else /* STAGING_CSMT */
+ cs->ops->submit(cs, sizeof(*op));
+}
+
-static void *wined3d_cs_st_require_space(struct wined3d_cs *cs, size_t size)
+static UINT wined3d_cs_exec_glfinish(struct wined3d_cs *cs, const void *data)
+{
{
- if (size > cs->data_size)
- {
- void *new_data;
+ const struct wined3d_cs_finish *op = data;
+ struct wined3d_device *device = cs->device;
+ struct wined3d_context *context;
+
- size = max( size, cs->data_size * 2 );
- if (!(new_data = HeapReAlloc(GetProcessHeap(), 0, cs->data, size)))
- return NULL;
+ if (!device->d3d_initialized)
+ return sizeof(*op);
+
- cs->data_size = size;
- cs->data = new_data;
- }
+ context = context_acquire(device, NULL);
+ context->gl_info->gl_ops.gl.p_glFinish();
+ context_release(context);
+
- return cs->data;
+ return sizeof(*op);
+}
+
}
-static void wined3d_cs_st_submit(struct wined3d_cs *cs)
+void wined3d_cs_emit_glfinish(struct wined3d_cs *cs)
+{
{
- enum wined3d_cs_op opcode = *(const enum wined3d_cs_op *)cs->data;
+ struct wined3d_cs_finish *op;
+
- wined3d_cs_op_handlers[opcode](cs, cs->data);
+ op = cs->ops->require_space(cs, sizeof(*op));
+ op->opcode = WINED3D_CS_OP_GLFINISH;
+
+ cs->ops->submit(cs, sizeof(*op));
+}
+
}
-static void wined3d_cs_st_push_constants(struct wined3d_cs *cs, enum wined3d_push_constants p,
- unsigned int start_idx, unsigned int count, const void *constants)
+static UINT wined3d_cs_exec_set_base_vertex_index(struct wined3d_cs *cs, const void *data)
+{
{
- struct wined3d_device *device = cs->device;
- unsigned int context_count;
- unsigned int i;
- size_t offset;
-
- static const struct
- {
- size_t offset;
- size_t size;
- DWORD mask;
- }
- push_constant_info[] =
- {
- /* WINED3D_PUSH_CONSTANTS_VS_F */
- {FIELD_OFFSET(struct wined3d_state, vs_consts_f), sizeof(struct wined3d_vec4), WINED3D_SHADER_CONST_VS_F},
- /* WINED3D_PUSH_CONSTANTS_PS_F */
- {FIELD_OFFSET(struct wined3d_state, ps_consts_f), sizeof(struct wined3d_vec4), WINED3D_SHADER_CONST_PS_F},
- /* WINED3D_PUSH_CONSTANTS_VS_I */
- {FIELD_OFFSET(struct wined3d_state, vs_consts_i), sizeof(struct wined3d_ivec4), WINED3D_SHADER_CONST_VS_I},
- /* WINED3D_PUSH_CONSTANTS_PS_I */
- {FIELD_OFFSET(struct wined3d_state, ps_consts_i), sizeof(struct wined3d_ivec4), WINED3D_SHADER_CONST_PS_I},
- /* WINED3D_PUSH_CONSTANTS_VS_B */
- {FIELD_OFFSET(struct wined3d_state, vs_consts_b), sizeof(BOOL), WINED3D_SHADER_CONST_VS_B},
- /* WINED3D_PUSH_CONSTANTS_PS_B */
- {FIELD_OFFSET(struct wined3d_state, ps_consts_b), sizeof(BOOL), WINED3D_SHADER_CONST_PS_B},
- };
+ const struct wined3d_cs_set_base_vertex_index *op = data;
+
- if (p == WINED3D_PUSH_CONSTANTS_VS_F)
- device->shader_backend->shader_update_float_vertex_constants(device, start_idx, count);
- else if (p == WINED3D_PUSH_CONSTANTS_PS_F)
- device->shader_backend->shader_update_float_pixel_constants(device, start_idx, count);
+ cs->state.base_vertex_index = op->base_vertex_index;
+ device_invalidate_state(cs->device, STATE_BASEVERTEXINDEX);
+
- offset = push_constant_info[p].offset + start_idx * push_constant_info[p].size;
- memcpy((BYTE *)&cs->state + offset, constants, count * push_constant_info[p].size);
- for (i = 0, context_count = device->context_count; i < context_count; ++i)
- {
- device->contexts[i]->constant_update_mask |= push_constant_info[p].mask;
- }
+ return sizeof(*op);
+}
+
}
-static const struct wined3d_cs_ops wined3d_cs_st_ops =
+void wined3d_cs_emit_set_base_vertex_index(struct wined3d_cs *cs,
+ UINT base_vertex_index)
+{
{
- wined3d_cs_st_require_space,
- wined3d_cs_st_submit,
- wined3d_cs_st_push_constants,
-};
+ struct wined3d_cs_set_base_vertex_index *op;
+
-struct wined3d_cs *wined3d_cs_create(struct wined3d_device *device)
+ op = cs->ops->require_space(cs, sizeof(*op));
+ op->opcode = WINED3D_CS_OP_SET_BASE_VERTEX_INDEX;
+ op->base_vertex_index = base_vertex_index;
@ -3065,33 +3160,58 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
+}
+
+static UINT wined3d_cs_exec_set_primitive_type(struct wined3d_cs *cs, const void *data)
+{
{
- const struct wined3d_gl_info *gl_info = &device->adapter->gl_info;
- struct wined3d_cs *cs;
+ const struct wined3d_cs_set_primitive_type *op = data;
+ GLenum prev;
+
- if (!(cs = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*cs))))
- return NULL;
+ prev = cs->state.gl_primitive_type;
+
- if (!(cs->fb.render_targets = wined3d_calloc(gl_info->limits.buffers, sizeof(*cs->fb.render_targets))))
- {
- HeapFree(GetProcessHeap(), 0, cs);
- return NULL;
- }
+ if (op->gl_primitive_type == GL_POINTS || prev == GL_POINTS)
+ device_invalidate_state(cs->device, STATE_POINT_ENABLE);
+
- state_init(&cs->state, &cs->fb, gl_info, &device->adapter->d3d_info,
- WINED3D_STATE_NO_REF | WINED3D_STATE_INIT_DEFAULT);
+ cs->state.gl_primitive_type = op->gl_primitive_type;
+
- cs->ops = &wined3d_cs_st_ops;
- cs->device = device;
+ return sizeof(*op);
+}
+
- cs->data_size = WINED3D_INITIAL_CS_SIZE;
- if (!(cs->data = HeapAlloc(GetProcessHeap(), 0, cs->data_size)))
- {
- state_cleanup(&cs->state);
- HeapFree(GetProcessHeap(), 0, cs->fb.render_targets);
- HeapFree(GetProcessHeap(), 0, cs);
- return NULL;
- }
+void wined3d_cs_emit_set_primitive_type(struct wined3d_cs *cs, GLenum primitive_type)
+{
+ struct wined3d_cs_set_primitive_type *op;
+
- return cs;
+ op = cs->ops->require_space(cs, sizeof(*op));
+ op->opcode = WINED3D_CS_OP_SET_PRIMITIVE_TYPE;
+ op->gl_primitive_type = primitive_type;
+
+ cs->ops->submit(cs, sizeof(*op));
+}
+
}
-void wined3d_cs_destroy(struct wined3d_cs *cs)
+static UINT wined3d_cs_exec_set_light(struct wined3d_cs *cs, const void *data)
+{
{
- state_cleanup(&cs->state);
- HeapFree(GetProcessHeap(), 0, cs->fb.render_targets);
+ const struct wined3d_cs_set_light *op = data;
+
+ UINT light_idx = op->light.OriginalIndex;
@ -3780,6 +3900,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
+ /* WINED3D_CS_OP_NOP */ wined3d_cs_exec_nop,
+ /* WINED3D_CS_OP_SKIP */ wined3d_cs_exec_skip,
+ /* WINED3D_CS_OP_FENCE */ wined3d_cs_exec_fence,
+#endif /* STAGING_CSMT */
+ /* WINED3D_CS_OP_PRESENT */ wined3d_cs_exec_present,
+ /* WINED3D_CS_OP_CLEAR */ wined3d_cs_exec_clear,
+ /* WINED3D_CS_OP_DRAW */ wined3d_cs_exec_draw,
@ -3812,6 +3933,77 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
+ /* WINED3D_CS_OP_QUERY_ISSUE */ wined3d_cs_exec_query_issue,
+ /* WINED3D_CS_OP_PRELOAD_RESOURCE */ wined3d_cs_exec_preload_resource,
+ /* WINED3D_CS_OP_UNLOAD_RESOURCE */ wined3d_cs_exec_unload_resource,
+#if !defined(STAGING_CSMT)
+ /* WINED3D_CS_OP_MAP */ wined3d_cs_exec_map,
+ /* WINED3D_CS_OP_UNMAP */ wined3d_cs_exec_unmap,
+};
+
+static void *wined3d_cs_st_require_space(struct wined3d_cs *cs, size_t size)
+{
+ if (size > cs->data_size)
+ {
+ void *new_data;
+
+ size = max( size, cs->data_size * 2 );
+ if (!(new_data = HeapReAlloc(GetProcessHeap(), 0, cs->data, size)))
+ return NULL;
+
+ cs->data_size = size;
+ cs->data = new_data;
+ }
+
+ return cs->data;
+}
+
+static void wined3d_cs_st_submit(struct wined3d_cs *cs)
+{
+ enum wined3d_cs_op opcode = *(const enum wined3d_cs_op *)cs->data;
+
+ wined3d_cs_op_handlers[opcode](cs, cs->data);
+}
+
+static void wined3d_cs_st_push_constants(struct wined3d_cs *cs, enum wined3d_push_constants p,
+ unsigned int start_idx, unsigned int count, const void *constants)
+{
+ struct wined3d_device *device = cs->device;
+ unsigned int context_count;
+ unsigned int i;
+ size_t offset;
+
+ static const struct
+ {
+ size_t offset;
+ size_t size;
+ DWORD mask;
+ }
+ push_constant_info[] =
+ {
+ /* WINED3D_PUSH_CONSTANTS_VS_F */
+ {FIELD_OFFSET(struct wined3d_state, vs_consts_f), sizeof(struct wined3d_vec4), WINED3D_SHADER_CONST_VS_F},
+ /* WINED3D_PUSH_CONSTANTS_PS_F */
+ {FIELD_OFFSET(struct wined3d_state, ps_consts_f), sizeof(struct wined3d_vec4), WINED3D_SHADER_CONST_PS_F},
+ /* WINED3D_PUSH_CONSTANTS_VS_I */
+ {FIELD_OFFSET(struct wined3d_state, vs_consts_i), sizeof(struct wined3d_ivec4), WINED3D_SHADER_CONST_VS_I},
+ /* WINED3D_PUSH_CONSTANTS_PS_I */
+ {FIELD_OFFSET(struct wined3d_state, ps_consts_i), sizeof(struct wined3d_ivec4), WINED3D_SHADER_CONST_PS_I},
+ /* WINED3D_PUSH_CONSTANTS_VS_B */
+ {FIELD_OFFSET(struct wined3d_state, vs_consts_b), sizeof(BOOL), WINED3D_SHADER_CONST_VS_B},
+ /* WINED3D_PUSH_CONSTANTS_PS_B */
+ {FIELD_OFFSET(struct wined3d_state, ps_consts_b), sizeof(BOOL), WINED3D_SHADER_CONST_PS_B},
+ };
+
+ if (p == WINED3D_PUSH_CONSTANTS_VS_F)
+ device->shader_backend->shader_update_float_vertex_constants(device, start_idx, count);
+ else if (p == WINED3D_PUSH_CONSTANTS_PS_F)
+ device->shader_backend->shader_update_float_pixel_constants(device, start_idx, count);
+
+ offset = push_constant_info[p].offset + start_idx * push_constant_info[p].size;
+ memcpy((BYTE *)&cs->state + offset, constants, count * push_constant_info[p].size);
+ for (i = 0, context_count = device->context_count; i < context_count; ++i)
+ {
+ device->contexts[i]->constant_update_mask |= push_constant_info[p].mask;
+ }
+#else /* STAGING_CSMT */
+ /* WINED3D_CS_OP_SET_VS_CONSTS_F */ wined3d_cs_exec_set_vs_consts_f,
+ /* WINED3D_CS_OP_SET_VS_CONSTS_B */ wined3d_cs_exec_set_vs_consts_b,
+ /* WINED3D_CS_OP_SET_VS_CONSTS_I */ wined3d_cs_exec_set_vs_consts_i,
@ -3982,11 +4174,17 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
+static void *wined3d_cs_st_require_space(struct wined3d_cs *cs, size_t size)
+{
+ return cs->queue.data;
+#endif /* STAGING_CSMT */
+}
+
+static const struct wined3d_cs_ops wined3d_cs_st_ops =
+{
+ wined3d_cs_st_require_space,
+#if !defined(STAGING_CSMT)
+ wined3d_cs_st_submit,
+ wined3d_cs_st_push_constants,
+};
+#else /* STAGING_CSMT */
+ wined3d_cs_st_require_space,
+ wined3d_cs_st_submit,
+ wined3d_cs_st_submit,
@ -4022,7 +4220,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
+ {
+ BOOL ret;
+
+ ret = query->query_ops->query_poll(query);
+ ret = query->query_ops->query_poll(query, 0);
+ if (ret)
+ {
+ list_remove(&query->poll_list_entry);
@ -4123,24 +4321,49 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
+ TRACE("Stopped.\n");
+ return 0;
+}
+#endif /* STAGING_CSMT */
+
+struct wined3d_cs *wined3d_cs_create(struct wined3d_device *device)
+{
+ const struct wined3d_gl_info *gl_info = &device->adapter->gl_info;
+#if !defined(STAGING_CSMT)
+ struct wined3d_cs *cs;
+#else /* STAGING_CSMT */
+ struct wined3d_cs *cs = NULL;
+#endif /* STAGING_CSMT */
+
+ if (!(cs = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*cs))))
+ return NULL;
+
+#if !defined(STAGING_CSMT)
+ if (!(cs->fb.render_targets = wined3d_calloc(gl_info->limits.buffers, sizeof(*cs->fb.render_targets))))
+ {
+ HeapFree(GetProcessHeap(), 0, cs);
+ return NULL;
+ }
+
+ state_init(&cs->state, &cs->fb, gl_info, &device->adapter->d3d_info,
+ WINED3D_STATE_NO_REF | WINED3D_STATE_INIT_DEFAULT);
+#else /* STAGING_CSMT */
+ if (FAILED(state_init(&cs->state, gl_info, &device->adapter->d3d_info,
+ WINED3D_STATE_NO_REF | WINED3D_STATE_INIT_DEFAULT)))
+ {
+ goto err;
+ }
+#endif /* STAGING_CSMT */
+
+ cs->ops = &wined3d_cs_st_ops;
+ cs->device = device;
+
+#if !defined(STAGING_CSMT)
+ cs->data_size = WINED3D_INITIAL_CS_SIZE;
+ if (!(cs->data = HeapAlloc(GetProcessHeap(), 0, cs->data_size)))
+ {
+ state_cleanup(&cs->state);
+ HeapFree(GetProcessHeap(), 0, cs->fb.render_targets);
+ HeapFree(GetProcessHeap(), 0, cs);
+ return NULL;
+#else /* STAGING_CSMT */
+ if (wined3d_settings.cs_multithreaded)
+ {
+ cs->ops = &wined3d_cs_mt_ops;
@ -4152,19 +4375,27 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
+ ERR("Failed to create wined3d command stream thread.\n");
+ goto err;
+ }
+#endif /* STAGING_CSMT */
+ }
+
+ return cs;
+#if defined(STAGING_CSMT)
+
+err:
+ if (cs)
+ state_cleanup(&cs->state);
+ HeapFree(GetProcessHeap(), 0, cs);
+ return NULL;
+#endif /* STAGING_CSMT */
+}
+
+void wined3d_cs_destroy(struct wined3d_cs *cs)
+{
+#if !defined(STAGING_CSMT)
+ state_cleanup(&cs->state);
+ HeapFree(GetProcessHeap(), 0, cs->fb.render_targets);
HeapFree(GetProcessHeap(), 0, cs->data);
+#else /* STAGING_CSMT */
+ DWORD ret;
+
+ state_cleanup(&cs->state);
@ -5470,27 +5701,27 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
}
/* All done. There is no need to reload resources or shaders, this will happen automatically on the
@@ -5086,11 +5634,19 @@ void device_resource_released(struct wined3d_device *device, struct wined3d_reso
for (i = 0; i < device->adapter->gl_info.limits.buffers; ++i)
@@ -5088,11 +5636,19 @@ void device_resource_released(struct wined3d_device *device, struct wined3d_reso
{
for (i = 0; i < device->adapter->gl_info.limits.buffers; ++i)
{
+#if !defined(STAGING_CSMT)
if ((rtv = device->fb.render_targets[i]) && rtv->resource == resource)
if ((rtv = device->fb.render_targets[i]) && rtv->resource == resource)
+#else /* STAGING_CSMT */
+ if ((rtv = device->state.fb.render_targets[i]) && rtv->resource == resource)
+ if ((rtv = device->state.fb.render_targets[i]) && rtv->resource == resource)
+#endif /* STAGING_CSMT */
ERR("Resource %p is still in use as render target %u.\n", resource, i);
ERR("Resource %p is still in use as render target %u.\n", resource, i);
}
+#if !defined(STAGING_CSMT)
if ((rtv = device->fb.depth_stencil) && rtv->resource == resource)
+#else /* STAGING_CSMT */
+ if ((rtv = device->state.fb.depth_stencil) && rtv->resource == resource)
+#endif /* STAGING_CSMT */
ERR("Resource %p is still in use as depth/stencil buffer.\n", resource);
}
+#if !defined(STAGING_CSMT)
if ((rtv = device->fb.depth_stencil) && rtv->resource == resource)
+#else /* STAGING_CSMT */
+ if ((rtv = device->state.fb.depth_stencil) && rtv->resource == resource)
+#endif /* STAGING_CSMT */
ERR("Resource %p is still in use as depth/stencil buffer.\n", resource);
switch (type)
@@ -5215,8 +5771,17 @@ HRESULT device_init(struct wined3d_device *device, struct wined3d *wined3d,
@@ -5218,8 +5774,17 @@ HRESULT device_init(struct wined3d_device *device, struct wined3d *wined3d,
device->blitter = adapter->blitter;
@ -5508,7 +5739,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
device->update_state = &device->state;
if (!(device->cs = wined3d_cs_create(device)))
@@ -5310,3 +5875,58 @@ LRESULT device_process_message(struct wined3d_device *device, HWND window, BOOL
@@ -5313,3 +5878,58 @@ LRESULT device_process_message(struct wined3d_device *device, HWND window, BOOL
else
return CallWindowProcA(proc, window, message, wparam, lparam);
}
@ -5672,7 +5903,7 @@ diff --git a/dlls/wined3d/query.c b/dlls/wined3d/query.c
}
static struct wined3d_event_query *wined3d_event_query_from_query(struct wined3d_query *query)
@@ -266,6 +269,11 @@ static void wined3d_query_destroy_object(void *object)
@@ -267,6 +270,11 @@ static void wined3d_query_destroy_object(void *object)
{
struct wined3d_query *query = object;
@ -5684,13 +5915,13 @@ diff --git a/dlls/wined3d/query.c b/dlls/wined3d/query.c
/* Queries are specific to the GL context that created them. Not
* deleting the query will obviously leak it, but that's still better
* than potentially deleting a different query with the same id in this
@@ -337,9 +345,24 @@ HRESULT CDECL wined3d_query_get_data(struct wined3d_query *query,
@@ -338,9 +346,25 @@ HRESULT CDECL wined3d_query_get_data(struct wined3d_query *query,
}
if (query->state == QUERY_CREATED)
+#if !defined(STAGING_CSMT)
WARN("Query wasn't started yet.\n");
else if (!query->query_ops->query_poll(query))
else if (!query->query_ops->query_poll(query, flags))
return S_FALSE;
+#else /* STAGING_CSMT */
+ {
@ -5698,18 +5929,19 @@ diff --git a/dlls/wined3d/query.c b/dlls/wined3d/query.c
+ }
+ else if (!wined3d_settings.cs_multithreaded)
+ {
+ if (!query->query_ops->query_poll(query))
+ if (!query->query_ops->query_poll(query, flags))
+ return S_FALSE;
+ }
+ else if (query->counter_main != query->counter_retrieved)
+ {
+ /* FIXME: should flush */
+ return S_FALSE;
+ }
+#endif /* STAGING_CSMT */
if (data)
memcpy(data, query->data, min(data_size, query->data_size));
@@ -358,6 +381,11 @@ HRESULT CDECL wined3d_query_issue(struct wined3d_query *query, DWORD flags)
@@ -359,6 +383,11 @@ HRESULT CDECL wined3d_query_issue(struct wined3d_query *query, DWORD flags)
{
TRACE("query %p, flags %#x.\n", query, flags);
@ -5721,7 +5953,7 @@ diff --git a/dlls/wined3d/query.c b/dlls/wined3d/query.c
wined3d_cs_emit_query_issue(query->device->cs, query, flags);
if (flags & WINED3DISSUE_BEGIN)
@@ -461,7 +489,11 @@ enum wined3d_query_type CDECL wined3d_query_get_type(const struct wined3d_query
@@ -462,7 +491,11 @@ enum wined3d_query_type CDECL wined3d_query_get_type(const struct wined3d_query
return query->type;
}
@ -5733,7 +5965,7 @@ diff --git a/dlls/wined3d/query.c b/dlls/wined3d/query.c
{
TRACE("query %p, flags %#x.\n", query, flags);
@@ -470,20 +502,33 @@ static void wined3d_event_query_ops_issue(struct wined3d_query *query, DWORD fla
@@ -471,20 +504,33 @@ static void wined3d_event_query_ops_issue(struct wined3d_query *query, DWORD fla
struct wined3d_event_query *event_query = wined3d_event_query_from_query(query);
wined3d_event_query_issue(event_query, query->device);
@ -5767,7 +5999,7 @@ diff --git a/dlls/wined3d/query.c b/dlls/wined3d/query.c
TRACE("query %p, flags %#x.\n", query, flags);
@@ -491,7 +536,11 @@ static void wined3d_occlusion_query_ops_issue(struct wined3d_query *query, DWORD
@@ -492,7 +538,11 @@ static void wined3d_occlusion_query_ops_issue(struct wined3d_query *query, DWORD
* restart. */
if (flags & WINED3DISSUE_BEGIN)
{
@ -5779,7 +6011,7 @@ diff --git a/dlls/wined3d/query.c b/dlls/wined3d/query.c
{
if (oq->context->tid != GetCurrentThreadId())
{
@@ -521,13 +570,20 @@ static void wined3d_occlusion_query_ops_issue(struct wined3d_query *query, DWORD
@@ -522,13 +572,20 @@ static void wined3d_occlusion_query_ops_issue(struct wined3d_query *query, DWORD
checkGLcall("glBeginQuery()");
context_release(context);
@ -5800,7 +6032,7 @@ diff --git a/dlls/wined3d/query.c b/dlls/wined3d/query.c
{
if (oq->context->tid != GetCurrentThreadId())
{
@@ -541,9 +597,19 @@ static void wined3d_occlusion_query_ops_issue(struct wined3d_query *query, DWORD
@@ -542,9 +599,19 @@ static void wined3d_occlusion_query_ops_issue(struct wined3d_query *query, DWORD
checkGLcall("glEndQuery()");
context_release(context);
@ -5819,8 +6051,8 @@ diff --git a/dlls/wined3d/query.c b/dlls/wined3d/query.c
+#endif /* STAGING_CSMT */
}
static BOOL wined3d_timestamp_query_ops_poll(struct wined3d_query *query)
@@ -584,7 +650,11 @@ static BOOL wined3d_timestamp_query_ops_poll(struct wined3d_query *query)
static BOOL wined3d_timestamp_query_ops_poll(struct wined3d_query *query, DWORD flags)
@@ -585,7 +652,11 @@ static BOOL wined3d_timestamp_query_ops_poll(struct wined3d_query *query, DWORD
return available;
}
@ -5832,7 +6064,7 @@ diff --git a/dlls/wined3d/query.c b/dlls/wined3d/query.c
{
struct wined3d_timestamp_query *tq = wined3d_timestamp_query_from_query(query);
const struct wined3d_gl_info *gl_info;
@@ -607,6 +677,12 @@ static void wined3d_timestamp_query_ops_issue(struct wined3d_query *query, DWORD
@@ -608,6 +679,12 @@ static void wined3d_timestamp_query_ops_issue(struct wined3d_query *query, DWORD
checkGLcall("glQueryCounter()");
context_release(context);
}
@ -5844,8 +6076,8 @@ diff --git a/dlls/wined3d/query.c b/dlls/wined3d/query.c
+#endif /* STAGING_CSMT */
}
static BOOL wined3d_timestamp_disjoint_query_ops_poll(struct wined3d_query *query)
@@ -616,9 +692,16 @@ static BOOL wined3d_timestamp_disjoint_query_ops_poll(struct wined3d_query *quer
static BOOL wined3d_timestamp_disjoint_query_ops_poll(struct wined3d_query *query, DWORD flags)
@@ -617,9 +694,16 @@ static BOOL wined3d_timestamp_disjoint_query_ops_poll(struct wined3d_query *quer
return TRUE;
}
@ -5861,8 +6093,8 @@ diff --git a/dlls/wined3d/query.c b/dlls/wined3d/query.c
+#endif /* STAGING_CSMT */
}
static BOOL wined3d_statistics_query_ops_poll(struct wined3d_query *query)
@@ -628,9 +711,16 @@ static BOOL wined3d_statistics_query_ops_poll(struct wined3d_query *query)
static BOOL wined3d_statistics_query_ops_poll(struct wined3d_query *query, DWORD flags)
@@ -629,9 +713,16 @@ static BOOL wined3d_statistics_query_ops_poll(struct wined3d_query *query, DWORD
return TRUE;
}
@ -5878,8 +6110,8 @@ diff --git a/dlls/wined3d/query.c b/dlls/wined3d/query.c
+#endif /* STAGING_CSMT */
}
static HRESULT wined3d_overflow_query_ops_poll(struct wined3d_query *query)
@@ -640,9 +730,16 @@ static HRESULT wined3d_overflow_query_ops_poll(struct wined3d_query *query)
static HRESULT wined3d_overflow_query_ops_poll(struct wined3d_query *query, DWORD flags)
@@ -641,9 +732,16 @@ static HRESULT wined3d_overflow_query_ops_poll(struct wined3d_query *query, DWOR
return TRUE;
}
@ -8881,7 +9113,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
@@ -1438,7 +1444,11 @@ enum wined3d_query_state
struct wined3d_query_ops
{
BOOL (*query_poll)(struct wined3d_query *query);
BOOL (*query_poll)(struct wined3d_query *query, DWORD flags);
+#if !defined(STAGING_CSMT)
void (*query_issue)(struct wined3d_query *query, DWORD flags);
+#else /* STAGING_CSMT */

View File

@ -1,4 +1,4 @@
From 40dce808e5579bd12a4a31eb93c0499000ae5f00 Mon Sep 17 00:00:00 2001
From 5237dd1b75bc109101d8476cdd0c8ce30cc628d4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Sat, 16 Apr 2016 18:18:54 +0200
Subject: wined3d: Add stubs for QUERY_TYPE_SO_STATISTICS and
@ -12,10 +12,10 @@ Subject: wined3d: Add stubs for QUERY_TYPE_SO_STATISTICS and
4 files changed, 100 insertions(+), 4 deletions(-)
diff --git a/dlls/d3d10core/tests/device.c b/dlls/d3d10core/tests/device.c
index f3c4ac8..d3ddef7 100644
index 0b38265c83f..3c47f9cbcdb 100644
--- a/dlls/d3d10core/tests/device.c
+++ b/dlls/d3d10core/tests/device.c
@@ -3539,8 +3539,8 @@ static void test_create_query(void)
@@ -3591,8 +3591,8 @@ static void test_create_query(void)
{D3D10_QUERY_TIMESTAMP_DISJOINT, FALSE, FALSE},
{D3D10_QUERY_PIPELINE_STATISTICS, FALSE, TRUE},
{D3D10_QUERY_OCCLUSION_PREDICATE, TRUE, FALSE},
@ -27,10 +27,10 @@ index f3c4ac8..d3ddef7 100644
ULONG refcount, expected_refcount;
diff --git a/dlls/d3d11/tests/d3d11.c b/dlls/d3d11/tests/d3d11.c
index 276f58f..648dc05 100644
index ac4393dd3b3..ac96918aed3 100644
--- a/dlls/d3d11/tests/d3d11.c
+++ b/dlls/d3d11/tests/d3d11.c
@@ -4525,8 +4525,8 @@ static void test_create_query(void)
@@ -4566,8 +4566,8 @@ static void test_create_query(void)
{D3D11_QUERY_TIMESTAMP_DISJOINT, D3D_FEATURE_LEVEL_10_0, FALSE, FALSE, FALSE},
{D3D11_QUERY_PIPELINE_STATISTICS, D3D_FEATURE_LEVEL_10_0, FALSE, FALSE, TRUE},
{D3D11_QUERY_OCCLUSION_PREDICATE, D3D_FEATURE_LEVEL_10_0, TRUE, TRUE, FALSE},
@ -42,10 +42,10 @@ index 276f58f..648dc05 100644
{D3D11_QUERY_SO_OVERFLOW_PREDICATE_STREAM0, D3D_FEATURE_LEVEL_11_0, TRUE, FALSE, TRUE},
{D3D11_QUERY_SO_STATISTICS_STREAM1, D3D_FEATURE_LEVEL_11_0, FALSE, FALSE, TRUE},
diff --git a/dlls/wined3d/query.c b/dlls/wined3d/query.c
index 55e63e9..aca5d85 100644
index 9f75a493d5f..c5ca37d4878 100644
--- a/dlls/wined3d/query.c
+++ b/dlls/wined3d/query.c
@@ -295,6 +295,14 @@ static void wined3d_query_destroy_object(void *object)
@@ -296,6 +296,14 @@ static void wined3d_query_destroy_object(void *object)
{
HeapFree(GetProcessHeap(), 0, query);
}
@ -60,13 +60,13 @@ index 55e63e9..aca5d85 100644
else
{
ERR("Query %p has invalid type %#x.\n", query, query->type);
@@ -601,6 +609,30 @@ static void wined3d_timestamp_disjoint_query_ops_issue(struct wined3d_query *que
@@ -614,6 +622,30 @@ static void wined3d_timestamp_disjoint_query_ops_issue(struct wined3d_query *que
TRACE("query %p, flags %#x.\n", query, flags);
}
+static BOOL wined3d_statistics_query_ops_poll(struct wined3d_query *query)
+static BOOL wined3d_statistics_query_ops_poll(struct wined3d_query *query, DWORD flags)
+{
+ TRACE("query %p.\n", query);
+ TRACE("query %p, flags %#x.\n", query, flags);
+
+ return TRUE;
+}
@ -76,9 +76,9 @@ index 55e63e9..aca5d85 100644
+ FIXME("query %p, flags %#x.\n", query, flags);
+}
+
+static HRESULT wined3d_overflow_query_ops_poll(struct wined3d_query *query)
+static HRESULT wined3d_overflow_query_ops_poll(struct wined3d_query *query, DWORD flags)
+{
+ TRACE("query %p.\n", query);
+ TRACE("query %p, flags %#x.\n", query, flags);
+
+ return TRUE;
+}
@ -91,7 +91,7 @@ index 55e63e9..aca5d85 100644
static const struct wined3d_query_ops event_query_ops =
{
wined3d_event_query_ops_poll,
@@ -741,6 +773,58 @@ static HRESULT wined3d_timestamp_disjoint_query_create(struct wined3d_device *de
@@ -754,6 +786,58 @@ static HRESULT wined3d_timestamp_disjoint_query_create(struct wined3d_device *de
return WINED3D_OK;
}
@ -150,7 +150,7 @@ index 55e63e9..aca5d85 100644
HRESULT CDECL wined3d_query_create(struct wined3d_device *device,
enum wined3d_query_type type, void *parent, struct wined3d_query **query)
{
@@ -761,6 +845,12 @@ HRESULT CDECL wined3d_query_create(struct wined3d_device *device,
@@ -774,6 +858,12 @@ HRESULT CDECL wined3d_query_create(struct wined3d_device *device,
case WINED3D_QUERY_TYPE_TIMESTAMP_FREQ:
return wined3d_timestamp_disjoint_query_create(device, type, parent, query);
@ -164,10 +164,10 @@ index 55e63e9..aca5d85 100644
FIXME("Unhandled query type %#x.\n", type);
return WINED3DERR_NOTAVAILABLE;
diff --git a/include/wine/wined3d.h b/include/wine/wined3d.h
index cd2dd3b..10b1ec2 100644
index 7271ec055ae..0357bfda6d8 100644
--- a/include/wine/wined3d.h
+++ b/include/wine/wined3d.h
@@ -702,6 +702,12 @@ struct wined3d_query_data_timestamp_disjoint
@@ -705,6 +705,12 @@ struct wined3d_query_data_timestamp_disjoint
BOOL disjoint;
};
@ -181,5 +181,5 @@ index cd2dd3b..10b1ec2 100644
#define WINED3DISSUE_END (1u << 0)
#define WINED3DGETDATA_FLUSH (1u << 0)
--
2.9.0
2.11.0