Rebase against 351bd33f2cd1edd680176ef777d77a3d1256ab6d.

This commit is contained in:
Sebastian Lackner 2016-05-25 20:34:59 +02:00
parent 94419b1dad
commit a40017a010
7 changed files with 310 additions and 301 deletions

View File

@ -51,7 +51,7 @@ usage()
# Get the upstream commit sha
upstream_commit()
{
echo "698d4114677205c3e5a0df659d230fe982578757"
echo "351bd33f2cd1edd680176ef777d77a3d1256ab6d"
}
# Show version information

View File

@ -1,4 +1,4 @@
From d077ec3e4fbc53758d89e7d71598498c8057a2f3 Mon Sep 17 00:00:00 2001
From dac1dca251d6b4bcd4266a615f82a5e9ff1643a6 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, 180 insertions(+), 120 deletions(-)
diff --git a/dlls/wined3d/arb_program_shader.c b/dlls/wined3d/arb_program_shader.c
index d67bb5e..f6097b0 100644
index 11dac92..01367b8 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 d67bb5e..f6097b0 100644
}
diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c
index 49e1c56..a67aeca 100644
index 65e6bcc..eb86e89 100644
--- a/dlls/wined3d/context.c
+++ b/dlls/wined3d/context.c
@@ -1687,6 +1687,12 @@ struct wined3d_context *context_create(struct wined3d_swapchain *swapchain,
@@ -1680,6 +1680,12 @@ struct wined3d_context *context_create(struct wined3d_swapchain *swapchain,
goto out;
}
@ -58,7 +58,7 @@ index 49e1c56..a67aeca 100644
/* Initialize the texture unit mapping to a 1:1 mapping */
for (s = 0; s < MAX_COMBINED_SAMPLERS; ++s)
{
@@ -1991,6 +1997,7 @@ out:
@@ -1984,6 +1990,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);
@ -66,7 +66,7 @@ index 49e1c56..a67aeca 100644
HeapFree(GetProcessHeap(), 0, ret->free_event_queries);
HeapFree(GetProcessHeap(), 0, ret->free_occlusion_queries);
HeapFree(GetProcessHeap(), 0, ret->free_timestamp_queries);
@@ -2027,6 +2034,7 @@ void context_destroy(struct wined3d_device *device, struct wined3d_context *cont
@@ -2020,6 +2027,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);
@ -74,7 +74,7 @@ index 49e1c56..a67aeca 100644
HeapFree(GetProcessHeap(), 0, context->draw_buffers);
HeapFree(GetProcessHeap(), 0, context->blit_targets);
device_context_remove(device, context);
@@ -2563,7 +2571,7 @@ BOOL context_apply_clear_state(struct wined3d_context *context, const struct win
@@ -2556,7 +2564,7 @@ BOOL context_apply_clear_state(struct wined3d_context *context, const struct win
DWORD rt_mask = 0, *cur_mask;
UINT i;
@ -83,7 +83,7 @@ index 49e1c56..a67aeca 100644
|| rt_count != gl_info->limits.buffers)
{
if (!context_validate_rt_config(rt_count, rts, dsv))
@@ -2608,6 +2616,8 @@ BOOL context_apply_clear_state(struct wined3d_context *context, const struct win
@@ -2601,6 +2609,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);
}
@ -92,7 +92,7 @@ index 49e1c56..a67aeca 100644
}
else if (wined3d_settings.offscreen_rendering_mode == ORM_FBO
&& (!rt_count || wined3d_resource_is_offscreen(rts[0]->resource)))
@@ -2665,7 +2675,7 @@ BOOL context_apply_clear_state(struct wined3d_context *context, const struct win
@@ -2658,7 +2668,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)
{
@ -101,7 +101,7 @@ index 49e1c56..a67aeca 100644
struct wined3d_shader *ps = state->shader[WINED3D_SHADER_TYPE_PIXEL];
DWORD rt_mask, rt_mask_bits;
unsigned int i;
@@ -2695,7 +2705,7 @@ static DWORD find_draw_buffers_mask(const struct wined3d_context *context, const
@@ -2688,7 +2698,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);
@ -110,7 +110,7 @@ index 49e1c56..a67aeca 100644
DWORD *cur_mask;
if (wined3d_settings.offscreen_rendering_mode == ORM_FBO)
@@ -2726,6 +2736,8 @@ void context_state_fb(struct wined3d_context *context, const struct wined3d_stat
@@ -2719,6 +2729,8 @@ void context_state_fb(struct wined3d_context *context, const struct wined3d_stat
context_apply_draw_buffers(context, rt_mask);
*cur_mask = rt_mask;
}
@ -119,7 +119,7 @@ index 49e1c56..a67aeca 100644
}
static void context_map_stage(struct wined3d_context *context, DWORD stage, DWORD unit)
@@ -3369,7 +3381,7 @@ BOOL context_apply_draw_state(struct wined3d_context *context,
@@ -3366,7 +3378,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;
@ -129,7 +129,7 @@ index 49e1c56..a67aeca 100644
WORD map;
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
index ea4778c..3150f25 100644
index a5d0269..14dfefb 100644
--- a/dlls/wined3d/cs.c
+++ b/dlls/wined3d/cs.c
@@ -286,7 +286,7 @@ static void wined3d_cs_exec_clear(struct wined3d_cs *cs, const void *data)
@ -184,12 +184,11 @@ index ea4778c..3150f25 100644
}
void wined3d_cs_emit_reset_state(struct wined3d_cs *cs)
@@ -1084,16 +1086,13 @@ struct wined3d_cs *wined3d_cs_create(struct wined3d_device *device)
@@ -1084,15 +1086,13 @@ struct wined3d_cs *wined3d_cs_create(struct wined3d_device *device)
if (!(cs = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*cs))))
return NULL;
- if (!(cs->fb.render_targets = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
- sizeof(*cs->fb.render_targets) * gl_info->limits.buffers)))
- if (!(cs->fb.render_targets = wined3d_calloc(gl_info->limits.buffers, sizeof(*cs->fb.render_targets))))
+ if (FAILED(state_init(&cs->state, gl_info, &device->adapter->d3d_info,
+ WINED3D_STATE_NO_REF | WINED3D_STATE_INIT_DEFAULT)))
{
@ -203,7 +202,15 @@ index ea4778c..3150f25 100644
cs->ops = &wined3d_cs_st_ops;
cs->device = device;
@@ -1110,7 +1109,6 @@ struct wined3d_cs *wined3d_cs_create(struct wined3d_device *device)
@@ -1100,7 +1100,6 @@ struct wined3d_cs *wined3d_cs_create(struct wined3d_device *device)
if (!(cs->data = HeapAlloc(GetProcessHeap(), 0, cs->data_size)))
{
state_cleanup(&cs->state);
- HeapFree(GetProcessHeap(), 0, cs->fb.render_targets);
HeapFree(GetProcessHeap(), 0, cs);
return NULL;
}
@@ -1111,7 +1110,6 @@ struct wined3d_cs *wined3d_cs_create(struct wined3d_device *device)
void wined3d_cs_destroy(struct wined3d_cs *cs)
{
state_cleanup(&cs->state);
@ -212,10 +219,10 @@ index ea4778c..3150f25 100644
HeapFree(GetProcessHeap(), 0, cs);
}
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index f2aadf6..d4a8d35 100644
index 040f5ea..2d11549 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -974,7 +974,7 @@ static void device_init_swapchain_state(struct wined3d_device *device, struct wi
@@ -978,7 +978,7 @@ static void device_init_swapchain_state(struct wined3d_device *device, struct wi
BOOL ds_enable = !!swapchain->desc.enable_auto_depth_stencil;
unsigned int i;
@ -224,7 +231,7 @@ index f2aadf6..d4a8d35 100644
{
for (i = 0; i < device->adapter->gl_info.limits.buffers; ++i)
{
@@ -992,7 +992,6 @@ HRESULT CDECL wined3d_device_init_3d(struct wined3d_device *device,
@@ -996,7 +996,6 @@ HRESULT CDECL wined3d_device_init_3d(struct wined3d_device *device,
struct wined3d_swapchain_desc *swapchain_desc)
{
static const struct wined3d_color black = {0.0f, 0.0f, 0.0f, 0.0f};
@ -232,17 +239,17 @@ index f2aadf6..d4a8d35 100644
struct wined3d_swapchain *swapchain = NULL;
struct wined3d_context *context;
DWORD clear_flags = 0;
@@ -1005,9 +1004,6 @@ HRESULT CDECL wined3d_device_init_3d(struct wined3d_device *device,
@@ -1009,9 +1008,6 @@ HRESULT CDECL wined3d_device_init_3d(struct wined3d_device *device,
if (device->wined3d->flags & WINED3D_NO3D)
return WINED3DERR_INVALIDCALL;
- device->fb.render_targets = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
- sizeof(*device->fb.render_targets) * gl_info->limits.buffers);
- if (!(device->fb.render_targets = wined3d_calloc(gl_info->limits.buffers, sizeof(*device->fb.render_targets))))
- return E_OUTOFMEMORY;
-
if (FAILED(hr = device->shader_backend->shader_alloc_private(device,
device->adapter->vertex_pipe, device->adapter->fragment_pipe)))
{
@@ -1082,7 +1078,6 @@ HRESULT CDECL wined3d_device_init_3d(struct wined3d_device *device,
@@ -1085,7 +1081,6 @@ HRESULT CDECL wined3d_device_init_3d(struct wined3d_device *device,
return WINED3D_OK;
err_out:
@ -250,7 +257,7 @@ index f2aadf6..d4a8d35 100644
HeapFree(GetProcessHeap(), 0, device->swapchains);
device->swapchain_count = 0;
if (device->back_buffer_view)
@@ -1161,8 +1156,25 @@ HRESULT CDECL wined3d_device_uninit_3d(struct wined3d_device *device)
@@ -1163,8 +1158,25 @@ HRESULT CDECL wined3d_device_uninit_3d(struct wined3d_device *device)
if (device->cursor_texture)
wined3d_texture_decref(device->cursor_texture);
@ -276,7 +283,7 @@ index f2aadf6..d4a8d35 100644
/* Unload resources */
LIST_FOR_EACH_ENTRY_SAFE(resource, cursor, &device->resources, struct wined3d_resource, resource_list_entry)
{
@@ -1193,37 +1205,6 @@ HRESULT CDECL wined3d_device_uninit_3d(struct wined3d_device *device)
@@ -1195,37 +1207,6 @@ HRESULT CDECL wined3d_device_uninit_3d(struct wined3d_device *device)
* destroy the context. */
context_release(context);
@ -314,7 +321,7 @@ index f2aadf6..d4a8d35 100644
if (device->back_buffer_view)
{
wined3d_rendertarget_view_decref(device->back_buffer_view);
@@ -1241,9 +1222,6 @@ HRESULT CDECL wined3d_device_uninit_3d(struct wined3d_device *device)
@@ -1243,9 +1224,6 @@ HRESULT CDECL wined3d_device_uninit_3d(struct wined3d_device *device)
device->swapchains = NULL;
device->swapchain_count = 0;
@ -324,7 +331,7 @@ index f2aadf6..d4a8d35 100644
device->d3d_initialized = FALSE;
return WINED3D_OK;
@@ -2055,7 +2033,7 @@ static void resolve_depth_buffer(struct wined3d_state *state)
@@ -2057,7 +2035,7 @@ static void resolve_depth_buffer(struct wined3d_state *state)
|| !(dst_texture->resource.format_flags & WINED3DFMT_FLAG_DEPTH))
return;
@ -333,7 +340,7 @@ index f2aadf6..d4a8d35 100644
return;
if (src_view->resource->type == WINED3D_RTYPE_BUFFER)
{
@@ -3412,6 +3390,8 @@ HRESULT CDECL wined3d_device_end_scene(struct wined3d_device *device)
@@ -3426,6 +3404,8 @@ HRESULT CDECL wined3d_device_end_scene(struct wined3d_device *device)
HRESULT CDECL wined3d_device_clear(struct wined3d_device *device, DWORD rect_count,
const RECT *rects, DWORD flags, const struct wined3d_color *color, float depth, DWORD stencil)
{
@ -342,7 +349,7 @@ index f2aadf6..d4a8d35 100644
TRACE("device %p, rect_count %u, rects %p, flags %#x, color %s, depth %.8e, stencil %u.\n",
device, rect_count, rects, flags, debug_color(color), depth, stencil);
@@ -3423,7 +3403,7 @@ HRESULT CDECL wined3d_device_clear(struct wined3d_device *device, DWORD rect_cou
@@ -3437,7 +3417,7 @@ HRESULT CDECL wined3d_device_clear(struct wined3d_device *device, DWORD rect_cou
if (flags & (WINED3DCLEAR_ZBUFFER | WINED3DCLEAR_STENCIL))
{
@ -351,7 +358,7 @@ index f2aadf6..d4a8d35 100644
if (!ds)
{
WARN("Clearing depth and/or stencil without a depth stencil buffer attached, returning WINED3DERR_INVALIDCALL\n");
@@ -3432,8 +3412,8 @@ HRESULT CDECL wined3d_device_clear(struct wined3d_device *device, DWORD rect_cou
@@ -3446,8 +3426,8 @@ HRESULT CDECL wined3d_device_clear(struct wined3d_device *device, DWORD rect_cou
}
else if (flags & WINED3DCLEAR_TARGET)
{
@ -362,7 +369,7 @@ index f2aadf6..d4a8d35 100644
{
WARN("Silently ignoring depth and target clear with mismatching sizes\n");
return WINED3D_OK;
@@ -3775,8 +3755,8 @@ HRESULT CDECL wined3d_device_validate_device(const struct wined3d_device *device
@@ -3777,8 +3757,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])
{
@ -373,7 +380,7 @@ index f2aadf6..d4a8d35 100644
if (ds && rt && (ds->width < rt->width || ds->height < rt->height))
{
@@ -4234,20 +4214,21 @@ struct wined3d_rendertarget_view * CDECL wined3d_device_get_rendertarget_view(co
@@ -4236,20 +4216,21 @@ struct wined3d_rendertarget_view * CDECL wined3d_device_get_rendertarget_view(co
return NULL;
}
@ -397,7 +404,7 @@ index f2aadf6..d4a8d35 100644
TRACE("device %p, view_idx %u, view %p, set_viewport %#x.\n",
device, view_idx, view, set_viewport);
@@ -4287,13 +4268,13 @@ HRESULT CDECL wined3d_device_set_rendertarget_view(struct wined3d_device *device
@@ -4289,13 +4270,13 @@ HRESULT CDECL wined3d_device_set_rendertarget_view(struct wined3d_device *device
}
@ -413,7 +420,7 @@ index f2aadf6..d4a8d35 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. */
@@ -4305,18 +4286,19 @@ HRESULT CDECL wined3d_device_set_rendertarget_view(struct wined3d_device *device
@@ -4307,18 +4288,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)
{
@ -435,7 +442,7 @@ index f2aadf6..d4a8d35 100644
wined3d_rendertarget_view_incref(view);
wined3d_cs_emit_set_depth_stencil_view(device->cs, view);
if (prev)
@@ -4679,10 +4661,9 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device,
@@ -4681,10 +4663,9 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device,
wined3d_texture_decref(device->cursor_texture);
device->cursor_texture = NULL;
}
@ -447,7 +454,7 @@ index f2aadf6..d4a8d35 100644
{
for (i = 0; i < device->adapter->gl_info.limits.buffers; ++i)
{
@@ -4691,6 +4672,11 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device,
@@ -4693,6 +4674,11 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device,
}
wined3d_device_set_depth_stencil_view(device, NULL);
@ -459,7 +466,7 @@ index f2aadf6..d4a8d35 100644
if (device->onscreen_depth_stencil)
{
wined3d_texture_decref(device->onscreen_depth_stencil->container);
@@ -4914,30 +4900,30 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device,
@@ -4916,30 +4902,30 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device,
if (device->d3d_initialized)
delete_opengl_contexts(device, swapchain);
@ -498,7 +505,7 @@ index f2aadf6..d4a8d35 100644
wined3d_cs_emit_set_scissor_rect(device->cs, &state->scissor_rect);
}
@@ -5029,11 +5015,11 @@ void device_resource_released(struct wined3d_device *device, struct wined3d_reso
@@ -5031,11 +5017,11 @@ void device_resource_released(struct wined3d_device *device, struct wined3d_reso
for (i = 0; i < device->adapter->gl_info.limits.buffers; ++i)
{
@ -512,7 +519,7 @@ index f2aadf6..d4a8d35 100644
ERR("Resource %p is still in use as depth/stencil buffer.\n", resource);
switch (type)
@@ -5169,8 +5155,12 @@ HRESULT device_init(struct wined3d_device *device, struct wined3d *wined3d,
@@ -5171,8 +5157,12 @@ HRESULT device_init(struct wined3d_device *device, struct wined3d *wined3d,
device->blitter = adapter->blitter;
@ -528,7 +535,7 @@ index f2aadf6..d4a8d35 100644
if (!(device->cs = wined3d_cs_create(device)))
diff --git a/dlls/wined3d/drawprim.c b/dlls/wined3d/drawprim.c
index 83fe4c3..67d0fea 100644
index 9103d42..0b67c48 100644
--- a/dlls/wined3d/drawprim.c
+++ b/dlls/wined3d/drawprim.c
@@ -411,7 +411,7 @@ void draw_primitive(struct wined3d_device *device, const struct wined3d_state *s
@ -541,10 +548,10 @@ index 83fe4c3..67d0fea 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 c42668d..fdfe17d 100644
index ca41c76..bd8468a 100644
--- a/dlls/wined3d/glsl_shader.c
+++ b/dlls/wined3d/glsl_shader.c
@@ -1442,7 +1442,7 @@ static void shader_glsl_load_constants(void *shader_priv, struct wined3d_context
@@ -1448,7 +1448,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. */
@ -554,10 +561,10 @@ index c42668d..fdfe17d 100644
0.0f,
0.0f,
diff --git a/dlls/wined3d/shader.c b/dlls/wined3d/shader.c
index f8c335c..461bbd0 100644
index c843bc1..f5abf40 100644
--- a/dlls/wined3d/shader.c
+++ b/dlls/wined3d/shader.c
@@ -2888,7 +2888,7 @@ void find_ps_compile_args(const struct wined3d_state *state, const struct wined3
@@ -2913,7 +2913,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. */
@ -567,7 +574,7 @@ index f8c335c..461bbd0 100644
static unsigned int warned = 0;
diff --git a/dlls/wined3d/state.c b/dlls/wined3d/state.c
index fc97a95..67aae67 100644
index e4a089c..799d736 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_
@ -663,7 +670,7 @@ index fc97a95..67aae67 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 2b45d9c..849e749 100644
index cb5a141..e2adb92 100644
--- a/dlls/wined3d/stateblock.c
+++ b/dlls/wined3d/stateblock.c
@@ -430,6 +430,7 @@ void state_unbind_resources(struct wined3d_state *state)
@ -715,7 +722,7 @@ index 2b45d9c..849e749 100644
}
ULONG CDECL wined3d_stateblock_decref(struct wined3d_stateblock *stateblock)
@@ -1254,32 +1282,42 @@ static void state_init_default(struct wined3d_state *state, const struct wined3d
@@ -1241,32 +1269,42 @@ static void state_init_default(struct wined3d_state *state, const struct wined3d
}
}
@ -764,10 +771,10 @@ index 2b45d9c..849e749 100644
if (type == WINED3D_SBT_RECORDED)
return WINED3D_OK;
diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
index c974e1a..5873a4b 100644
index 0caf753..7b55e25 100644
--- a/dlls/wined3d/surface.c
+++ b/dlls/wined3d/surface.c
@@ -2574,7 +2574,7 @@ static HRESULT surface_blt_special(struct wined3d_surface *dst_surface, const RE
@@ -2570,7 +2570,7 @@ static HRESULT surface_blt_special(struct wined3d_surface *dst_surface, const RE
{
struct wined3d_texture *dst_texture = dst_surface->container;
struct wined3d_device *device = dst_texture->resource.device;
@ -777,7 +784,7 @@ index c974e1a..5873a4b 100644
struct wined3d_texture *src_texture;
diff --git a/dlls/wined3d/swapchain.c b/dlls/wined3d/swapchain.c
index df1155c..e69dadd 100644
index aba7ac0..92abd3b 100644
--- a/dlls/wined3d/swapchain.c
+++ b/dlls/wined3d/swapchain.c
@@ -481,7 +481,7 @@ static void swapchain_gl_present(struct wined3d_swapchain *swapchain,
@ -790,10 +797,10 @@ index df1155c..e69dadd 100644
struct wined3d_texture *logo_texture;
struct wined3d_context *context;
diff --git a/dlls/wined3d/utils.c b/dlls/wined3d/utils.c
index 70a4b03..3d158ec 100644
index 5c781cd..19fd942 100644
--- a/dlls/wined3d/utils.c
+++ b/dlls/wined3d/utils.c
@@ -4268,7 +4268,7 @@ void get_projection_matrix(const struct wined3d_context *context, const struct w
@@ -4313,7 +4313,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;
@ -802,7 +809,7 @@ index 70a4b03..3d158ec 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;
@@ -5066,7 +5066,7 @@ void gen_ffp_frag_op(const struct wined3d_context *context, const struct wined3d
@@ -5110,7 +5110,7 @@ void gen_ffp_frag_op(const struct wined3d_context *context, const struct wined3d
break;
}
}
@ -812,10 +819,10 @@ index 70a4b03..3d158ec 100644
|| !state->render_states[WINED3D_RS_CLIPPLANEENABLE])
{
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index aabfde6..acdd37d 100644
index 1b4d679..2e0482f 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -1318,6 +1318,36 @@ struct wined3d_timestamp_query
@@ -1335,6 +1335,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;
@ -852,7 +859,7 @@ index aabfde6..acdd37d 100644
struct wined3d_context
{
const struct wined3d_gl_info *gl_info;
@@ -1332,6 +1362,7 @@ struct wined3d_context
@@ -1349,6 +1379,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 */
@ -860,7 +867,7 @@ index aabfde6..acdd37d 100644
struct wined3d_swapchain *swapchain;
struct
@@ -1439,12 +1470,6 @@ struct wined3d_context
@@ -1456,12 +1487,6 @@ struct wined3d_context
GLuint dummy_arbfp_prog;
};
@ -873,7 +880,7 @@ index aabfde6..acdd37d 100644
typedef void (*APPLYSTATEFUNC)(struct wined3d_context *ctx, const struct wined3d_state *state, DWORD state_id);
struct StateEntry
@@ -2194,7 +2219,7 @@ struct wined3d_stream_state
@@ -2212,7 +2237,7 @@ struct wined3d_stream_state
struct wined3d_state
{
DWORD flags;
@ -882,7 +889,7 @@ index aabfde6..acdd37d 100644
struct wined3d_vertex_declaration *vertex_declaration;
struct wined3d_stream_output stream_output[MAX_STREAM_OUT];
@@ -2297,7 +2322,6 @@ struct wined3d_device
@@ -2315,7 +2340,6 @@ struct wined3d_device
struct wine_rb_tree samplers;
/* Render Target Support */
@ -890,7 +897,7 @@ index aabfde6..acdd37d 100644
struct wined3d_surface *onscreen_depth_stencil;
struct wined3d_rendertarget_view *auto_depth_stencil_view;
@@ -2836,9 +2860,8 @@ struct wined3d_stateblock
@@ -2850,9 +2874,8 @@ struct wined3d_stateblock
void stateblock_init_contained_states(struct wined3d_stateblock *stateblock) DECLSPEC_HIDDEN;
void state_cleanup(struct wined3d_state *state) DECLSPEC_HIDDEN;
@ -902,7 +909,7 @@ index aabfde6..acdd37d 100644
void state_unbind_resources(struct wined3d_state *state) DECLSPEC_HIDDEN;
struct wined3d_cs_ops
@@ -2851,7 +2874,6 @@ struct wined3d_cs
@@ -2865,7 +2888,6 @@ struct wined3d_cs
{
const struct wined3d_cs_ops *ops;
struct wined3d_device *device;

View File

@ -1,16 +1,16 @@
From ddb85bfb8372c694e661d3eb8c955057916a85a2 Mon Sep 17 00:00:00 2001
From c7b4f23f1e496b7cf3ee419e9f33fa308b297113 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20D=C3=B6singer?= <stefan@codeweavers.com>
Date: Tue, 1 Oct 2013 15:30:26 +0200
Subject: wined3d: Give the cs its own state
---
dlls/wined3d/cs.c | 92 +++++++++++++++++++++++++++++++++++-------
dlls/wined3d/cs.c | 93 ++++++++++++++++++++++++++++++++++--------
dlls/wined3d/device.c | 3 ++
dlls/wined3d/wined3d_private.h | 4 +-
3 files changed, 83 insertions(+), 16 deletions(-)
3 files changed, 83 insertions(+), 17 deletions(-)
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
index fe96c38..55cd5d6 100644
index ebb078a..55cd5d6 100644
--- a/dlls/wined3d/cs.c
+++ b/dlls/wined3d/cs.c
@@ -63,6 +63,7 @@ enum wined3d_cs_op
@ -137,10 +137,11 @@ index fe96c38..55cd5d6 100644
}
cs->ops = &wined3d_cs_st_ops;
@@ -1356,16 +1414,13 @@ struct wined3d_cs *wined3d_cs_create(struct wined3d_device *device)
@@ -1356,17 +1414,13 @@ struct wined3d_cs *wined3d_cs_create(struct wined3d_device *device)
cs->data_size = WINED3D_INITIAL_CS_SIZE;
if (!(cs->data = HeapAlloc(GetProcessHeap(), 0, cs->data_size)))
{
- state_cleanup(&cs->state);
- HeapFree(GetProcessHeap(), 0, cs);
- return NULL;
+ goto err;
@ -156,7 +157,7 @@ index fe96c38..55cd5d6 100644
}
if (wined3d_settings.cs_multithreaded)
@@ -1378,15 +1433,22 @@ struct wined3d_cs *wined3d_cs_create(struct wined3d_device *device)
@@ -1379,15 +1433,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");
@ -185,10 +186,10 @@ index fe96c38..55cd5d6 100644
void wined3d_cs_destroy(struct wined3d_cs *cs)
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index ccc773b..46cf23a 100644
index 4dddef1..7ca03fd 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -3502,6 +3502,7 @@ HRESULT CDECL wined3d_device_draw_primitive(struct wined3d_device *device, UINT
@@ -3510,6 +3510,7 @@ HRESULT CDECL wined3d_device_draw_primitive(struct wined3d_device *device, UINT
device_invalidate_state(device, STATE_BASEVERTEXINDEX);
}
@ -196,7 +197,7 @@ index ccc773b..46cf23a 100644
wined3d_cs_emit_draw(device->cs, start_vertex, vertex_count, 0, 0, FALSE);
return WINED3D_OK;
@@ -3545,6 +3546,7 @@ HRESULT CDECL wined3d_device_draw_indexed_primitive(struct wined3d_device *devic
@@ -3547,6 +3548,7 @@ HRESULT CDECL wined3d_device_draw_indexed_primitive(struct wined3d_device *devic
device_invalidate_state(device, STATE_BASEVERTEXINDEX);
}
@ -204,7 +205,7 @@ index ccc773b..46cf23a 100644
wined3d_cs_emit_draw(device->cs, start_idx, index_count, 0, 0, TRUE);
return WINED3D_OK;
@@ -3556,6 +3558,7 @@ void CDECL wined3d_device_draw_indexed_primitive_instanced(struct wined3d_device
@@ -3558,6 +3560,7 @@ void CDECL wined3d_device_draw_indexed_primitive_instanced(struct wined3d_device
TRACE("device %p, start_idx %u, index_count %u, start_instance %u, instance_count %u.\n",
device, start_idx, index_count, start_instance, instance_count);
@ -213,10 +214,10 @@ index ccc773b..46cf23a 100644
}
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 22f4b63..1a5f8fc 100644
index 05bf6da..046c9d9 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -2874,7 +2874,7 @@ struct wined3d_cs_block
@@ -2888,7 +2888,7 @@ struct wined3d_cs_block
{
struct list entry;
UINT pos;
@ -225,7 +226,7 @@ index 22f4b63..1a5f8fc 100644
};
struct wined3d_cs_ops
@@ -2915,6 +2915,8 @@ void wined3d_cs_emit_set_color_key(struct wined3d_cs *cs, struct wined3d_texture
@@ -2929,6 +2929,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 3aef880f23c9c43e315ea57087dac9c38dd09907 Mon Sep 17 00:00:00 2001
From 88fabe417bf9eacefc5b563c01320535365a6247 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
@ -112,10 +112,10 @@ index 12bbcff..bbe0d4f 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 10599bf..7e83e7c 100644
index 72dc4e2..7319a83 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -1970,6 +1970,9 @@ void CDECL wined3d_device_set_base_vertex_index(struct wined3d_device *device, I
@@ -1972,6 +1972,9 @@ void CDECL wined3d_device_set_base_vertex_index(struct wined3d_device *device, I
TRACE("device %p, base_index %d.\n", device, base_index);
device->update_state->base_vertex_index = base_index;
@ -125,9 +125,9 @@ index 10599bf..7e83e7c 100644
}
INT CDECL wined3d_device_get_base_vertex_index(const struct wined3d_device *device)
@@ -3497,12 +3500,6 @@ HRESULT CDECL wined3d_device_draw_primitive(struct wined3d_device *device, UINT
return WINED3DERR_INVALIDCALL;
}
@@ -3493,12 +3496,6 @@ HRESULT CDECL wined3d_device_draw_primitive(struct wined3d_device *device, UINT
{
TRACE("device %p, start_vertex %u, vertex_count %u.\n", device, start_vertex, vertex_count);
- if (device->state.load_base_vertex_index)
- {
@ -138,7 +138,7 @@ index 10599bf..7e83e7c 100644
wined3d_cs_emit_transfer_stateblock(device->cs, &device->state);
wined3d_cs_emit_draw(device->cs, start_vertex, vertex_count, 0, 0, FALSE);
@@ -3520,8 +3517,6 @@ void CDECL wined3d_device_draw_primitive_instanced(struct wined3d_device *device
@@ -3516,8 +3513,6 @@ void CDECL wined3d_device_draw_primitive_instanced(struct wined3d_device *device
HRESULT CDECL wined3d_device_draw_indexed_primitive(struct wined3d_device *device, UINT start_idx, UINT index_count)
{
@ -147,12 +147,12 @@ index 10599bf..7e83e7c 100644
TRACE("device %p, start_idx %u, index_count %u.\n", device, start_idx, index_count);
if (!device->state.index_buffer)
@@ -3540,12 +3535,6 @@ HRESULT CDECL wined3d_device_draw_indexed_primitive(struct wined3d_device *devic
@@ -3530,12 +3525,6 @@ HRESULT CDECL wined3d_device_draw_indexed_primitive(struct wined3d_device *devic
return WINED3DERR_INVALIDCALL;
}
- if (!gl_info->supported[ARB_DRAW_ELEMENTS_BASE_VERTEX] &&
- device->state.load_base_vertex_index != device->state.base_vertex_index)
- device->state.load_base_vertex_index != device->state.base_vertex_index)
- {
- device->state.load_base_vertex_index = device->state.base_vertex_index;
- device_invalidate_state(device, STATE_BASEVERTEXINDEX);
@ -161,10 +161,10 @@ index 10599bf..7e83e7c 100644
wined3d_cs_emit_transfer_stateblock(device->cs, &device->state);
wined3d_cs_emit_draw(device->cs, start_idx, index_count, 0, 0, TRUE);
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 55b8ad4..08fd9a8 100644
index 222a76a..a5f99ed 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -2950,6 +2950,8 @@ void wined3d_cs_emit_set_viewport(struct wined3d_cs *cs, const struct wined3d_vi
@@ -2966,6 +2966,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 92f3d474363e16b72f0edf94b7b4673c5df25e1c Mon Sep 17 00:00:00 2001
From 5efe6c30c29fba801d533fa5071aaae3d5652c47 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20D=C3=B6singer?= <stefan@codeweavers.com>
Date: Wed, 10 Apr 2013 17:16:02 +0200
Subject: wined3d: Send light updates through the command stream
@ -10,7 +10,7 @@ Subject: wined3d: Send light updates through the command stream
3 files changed, 174 insertions(+), 65 deletions(-)
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
index 86a8603..85337db 100644
index 03bed96..220f05f 100644
--- a/dlls/wined3d/cs.c
+++ b/dlls/wined3d/cs.c
@@ -63,7 +63,6 @@ enum wined3d_cs_op
@ -43,7 +43,7 @@ index 86a8603..85337db 100644
struct wined3d_cs_set_consts_f
{
enum wined3d_cs_op opcode;
@@ -327,6 +322,19 @@ struct wined3d_cs_set_primitive_type
@@ -330,6 +325,19 @@ struct wined3d_cs_set_primitive_type
GLenum gl_primitive_type;
};
@ -63,7 +63,7 @@ index 86a8603..85337db 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)
{
@@ -972,35 +980,6 @@ void wined3d_cs_emit_set_texture(struct wined3d_cs *cs, UINT stage, struct wined
@@ -975,35 +983,6 @@ void wined3d_cs_emit_set_texture(struct wined3d_cs *cs, UINT stage, struct wined
cs->ops->submit(cs);
}
@ -99,7 +99,7 @@ index 86a8603..85337db 100644
static UINT wined3d_cs_exec_set_shader_resource_view(struct wined3d_cs *cs, const void *data)
{
const struct wined3d_cs_set_shader_resource_view *op = data;
@@ -1568,6 +1547,152 @@ void wined3d_cs_emit_set_primitive_type(struct wined3d_cs *cs, GLenum primitive_
@@ -1562,6 +1541,152 @@ void wined3d_cs_emit_set_primitive_type(struct wined3d_cs *cs, GLenum primitive_
cs->ops->submit(cs);
}
@ -252,7 +252,7 @@ index 86a8603..85337db 100644
static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void *data) =
{
/* WINED3D_CS_OP_FENCE */ wined3d_cs_exec_fence,
@@ -1597,7 +1722,6 @@ static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void
@@ -1591,7 +1716,6 @@ static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void
/* 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,
@ -260,7 +260,7 @@ index 86a8603..85337db 100644
/* 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,
@@ -1607,6 +1731,8 @@ static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void
@@ -1601,6 +1725,8 @@ static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void
/* WINED3D_CS_OP_GLFINISH */ wined3d_cs_exec_glfinish,
/* WINED3D_CS_OP_SET_BASE_VERTEX_INDEX */ wined3d_cs_exec_set_base_vertex_index,
/* WINED3D_CS_OP_SET_PRIMITIVE_TYPE */ wined3d_cs_exec_set_primitive_type,
@ -270,10 +270,10 @@ index 86a8603..85337db 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 34d03ef..81cf94e 100644
index 6560687..b713dfc 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -1566,14 +1566,6 @@ HRESULT CDECL wined3d_device_set_light(struct wined3d_device *device,
@@ -1591,14 +1591,6 @@ HRESULT CDECL wined3d_device_set_light(struct wined3d_device *device,
light->direction.x, light->direction.y, light->direction.z,
light->range, light->falloff, light->theta, light->phi);
@ -288,7 +288,7 @@ index 34d03ef..81cf94e 100644
/* Save away the information. */
object->OriginalParms = *light;
@@ -1653,6 +1645,9 @@ HRESULT CDECL wined3d_device_set_light(struct wined3d_device *device,
@@ -1678,6 +1670,9 @@ HRESULT CDECL wined3d_device_set_light(struct wined3d_device *device,
FIXME("Unrecognized light type %#x.\n", light->type);
}
@ -298,7 +298,7 @@ index 34d03ef..81cf94e 100644
return WINED3D_OK;
}
@@ -1725,12 +1720,6 @@ HRESULT CDECL wined3d_device_set_light_enable(struct wined3d_device *device, UIN
@@ -1750,12 +1745,6 @@ HRESULT CDECL wined3d_device_set_light_enable(struct wined3d_device *device, UIN
{
if (light_info->glIndex != -1)
{
@ -311,7 +311,7 @@ index 34d03ef..81cf94e 100644
device->update_state->lights[light_info->glIndex] = NULL;
light_info->glIndex = -1;
}
@@ -1772,16 +1761,12 @@ HRESULT CDECL wined3d_device_set_light_enable(struct wined3d_device *device, UIN
@@ -1797,16 +1786,12 @@ HRESULT CDECL wined3d_device_set_light_enable(struct wined3d_device *device, UIN
WARN("Too many concurrently active lights\n");
return WINED3D_OK;
}
@ -331,15 +331,15 @@ index 34d03ef..81cf94e 100644
return WINED3D_OK;
}
@@ -3468,7 +3453,6 @@ HRESULT CDECL wined3d_device_draw_primitive(struct wined3d_device *device, UINT
return WINED3DERR_INVALIDCALL;
}
@@ -3499,7 +3484,6 @@ HRESULT CDECL wined3d_device_draw_primitive(struct wined3d_device *device, UINT
{
TRACE("device %p, start_vertex %u, vertex_count %u.\n", device, start_vertex, vertex_count);
- wined3d_cs_emit_transfer_stateblock(device->cs, &device->state);
wined3d_cs_emit_draw(device->cs, start_vertex, vertex_count, 0, 0, FALSE);
return WINED3D_OK;
@@ -3503,8 +3487,6 @@ HRESULT CDECL wined3d_device_draw_indexed_primitive(struct wined3d_device *devic
@@ -3528,8 +3512,6 @@ HRESULT CDECL wined3d_device_draw_indexed_primitive(struct wined3d_device *devic
return WINED3DERR_INVALIDCALL;
}
@ -348,7 +348,7 @@ index 34d03ef..81cf94e 100644
wined3d_cs_emit_draw(device->cs, start_idx, index_count, 0, 0, TRUE);
return WINED3D_OK;
@@ -3516,7 +3498,6 @@ void CDECL wined3d_device_draw_indexed_primitive_instanced(struct wined3d_device
@@ -3541,7 +3523,6 @@ void CDECL wined3d_device_draw_indexed_primitive_instanced(struct wined3d_device
TRACE("device %p, start_idx %u, index_count %u, start_instance %u, instance_count %u.\n",
device, start_idx, index_count, start_instance, instance_count);
@ -357,10 +357,10 @@ index 34d03ef..81cf94e 100644
}
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 04d17b1..a085783 100644
index c39fd9c..4a78bfa 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -2868,7 +2868,9 @@ struct wined3d_cs_block
@@ -2884,7 +2884,9 @@ struct wined3d_cs_block
{
struct list entry;
UINT pos;
@ -371,7 +371,7 @@ index 04d17b1..a085783 100644
};
struct wined3d_cs_ops
@@ -2912,8 +2914,6 @@ void wined3d_cs_emit_set_color_key(struct wined3d_cs *cs, struct wined3d_texture
@@ -2928,8 +2930,6 @@ 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;
@ -380,7 +380,7 @@ index 04d17b1..a085783 100644
void wined3d_cs_emit_set_depth_stencil_view(struct wined3d_cs *cs,
struct wined3d_rendertarget_view *view) DECLSPEC_HIDDEN;
void wined3d_cs_emit_set_index_buffer(struct wined3d_cs *cs, struct wined3d_buffer *buffer,
@@ -2959,6 +2959,8 @@ void wined3d_cs_emit_set_base_vertex_index(struct wined3d_cs *cs,
@@ -2975,6 +2975,8 @@ void wined3d_cs_emit_set_base_vertex_index(struct wined3d_cs *cs,
UINT base_vertex_index) DECLSPEC_HIDDEN;
void wined3d_cs_emit_set_primitive_type(struct wined3d_cs *cs,
GLenum primitive_type) DECLSPEC_HIDDEN;

View File

@ -1,4 +1,4 @@
From cc099c1c4fe340252f21a48aaee31db74e543af7 Mon Sep 17 00:00:00 2001
From 964c9547663bccec6e1dc8d1e6de8c66d1651d99 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20D=C3=B6singer?= <stefandoesinger@gmx.at>
Date: Sat, 7 May 2016 13:02:33 +0100
Subject: wined3d: Clean up textures through the command stream.
@ -11,7 +11,7 @@ FIXME: This HeapFree stuff when creation fails is ugly.
3 files changed, 72 insertions(+), 37 deletions(-)
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
index b08ca4b..54123ca 100644
index 5a521d3..452b16f 100644
--- a/dlls/wined3d/cs.c
+++ b/dlls/wined3d/cs.c
@@ -84,6 +84,7 @@ enum wined3d_cs_op
@ -22,7 +22,7 @@ index b08ca4b..54123ca 100644
WINED3D_CS_OP_STOP,
};
@@ -496,6 +497,12 @@ struct wined3d_cs_buffer_cleanup
@@ -499,6 +500,12 @@ struct wined3d_cs_buffer_cleanup
struct wined3d_buffer *buffer;
};
@ -35,7 +35,7 @@ index b08ca4b..54123ca 100644
static void wined3d_cs_mt_submit(struct wined3d_cs *cs, size_t size)
{
LONG new_val = (cs->queue.head + size) & (WINED3D_CS_QUEUE_SIZE - 1);
@@ -2502,6 +2509,26 @@ void wined3d_cs_emit_buffer_cleanup(struct wined3d_cs *cs, struct wined3d_buffer
@@ -2496,6 +2503,26 @@ void wined3d_cs_emit_buffer_cleanup(struct wined3d_cs *cs, struct wined3d_buffer
cs->ops->submit(cs, sizeof(*op));
}
@ -62,7 +62,7 @@ index b08ca4b..54123ca 100644
static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void *data) =
{
/* WINED3D_CS_OP_NOP */ wined3d_cs_exec_nop,
@@ -2564,6 +2591,7 @@ static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void
@@ -2558,6 +2585,7 @@ static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void
/* WINED3D_CS_OP_CREATE_VBO */ wined3d_cs_exec_create_vbo,
/* WINED3D_CS_OP_RESOURCE_CLEANUP */ wined3d_cs_exec_resource_cleanup,
/* WINED3D_CS_OP_BUFFER_CLEANUP */ wined3d_cs_exec_buffer_cleanup,
@ -71,10 +71,10 @@ index b08ca4b..54123ca 100644
static inline void *_wined3d_cs_mt_require_space(struct wined3d_cs *cs, size_t size, BOOL prio)
diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c
index 7953053..765192d 100644
index 4db6bb4..4a4c4f8 100644
--- a/dlls/wined3d/texture.c
+++ b/dlls/wined3d/texture.c
@@ -399,7 +399,7 @@ static void wined3d_texture_unload_gl_texture(struct wined3d_texture *texture)
@@ -404,7 +404,7 @@ static void wined3d_texture_unload_gl_texture(struct wined3d_texture *texture)
resource_unload(&texture->resource);
}
@ -83,7 +83,7 @@ index 7953053..765192d 100644
{
unsigned int sub_count = texture->level_count * texture->layer_count;
struct wined3d_device *device = texture->resource.device;
@@ -409,12 +409,6 @@ static void wined3d_texture_cleanup(struct wined3d_texture *texture)
@@ -414,12 +414,6 @@ static void wined3d_texture_cleanup(struct wined3d_texture *texture)
TRACE("texture %p.\n", texture);
@ -96,7 +96,7 @@ index 7953053..765192d 100644
for (i = 0; i < sub_count; ++i)
{
if (texture->sub_resources[i].buffer != texture->sub_resources[i].map_buffer)
@@ -440,9 +434,7 @@ static void wined3d_texture_cleanup(struct wined3d_texture *texture)
@@ -445,9 +439,7 @@ static void wined3d_texture_cleanup(struct wined3d_texture *texture)
texture->texture_ops->texture_cleanup_sub_resources(texture);
wined3d_texture_unload_gl_texture(texture);
@ -214,16 +214,16 @@ index 7953053..765192d 100644
return hr;
}
@@ -2048,7 +2062,7 @@ static HRESULT texture_init(struct wined3d_texture *texture, const struct wined3
if (!(surfaces = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*surfaces) * level_count * layer_count)))
@@ -2049,7 +2063,7 @@ static HRESULT texture_init(struct wined3d_texture *texture, const struct wined3
if (level_count > ~(SIZE_T)0 / layer_count
|| !(surfaces = wined3d_calloc(level_count * layer_count, sizeof(*surfaces))))
{
- wined3d_texture_cleanup(texture);
+ wined3d_texture_cleanup_main(texture);
return E_OUTOFMEMORY;
}
@@ -2091,7 +2105,7 @@ static HRESULT texture_init(struct wined3d_texture *texture, const struct wined3
@@ -2092,7 +2106,7 @@ static HRESULT texture_init(struct wined3d_texture *texture, const struct wined3
texture, idx, &sub_resource->parent, &sub_resource->parent_ops)))
{
WARN("Failed to create surface parent, hr %#x.\n", hr);
@ -232,7 +232,7 @@ index 7953053..765192d 100644
return hr;
}
@@ -2102,7 +2116,7 @@ static HRESULT texture_init(struct wined3d_texture *texture, const struct wined3
@@ -2103,7 +2117,7 @@ static HRESULT texture_init(struct wined3d_texture *texture, const struct wined3
if (((desc->usage & WINED3DUSAGE_OWNDC) || (device->wined3d->flags & WINED3D_NO3D))
&& FAILED(hr = wined3d_surface_create_dc(surface)))
{
@ -241,7 +241,7 @@ index 7953053..765192d 100644
return hr;
}
}
@@ -2159,21 +2173,6 @@ static void texture3d_prepare_texture(struct wined3d_texture *texture, struct wi
@@ -2160,21 +2174,6 @@ static void texture3d_prepare_texture(struct wined3d_texture *texture, struct wi
static void texture3d_cleanup_sub_resources(struct wined3d_texture *texture)
{
@ -263,7 +263,7 @@ index 7953053..765192d 100644
HeapFree(GetProcessHeap(), 0, texture->sub_resources[0].u.volume);
}
@@ -2227,6 +2226,7 @@ static HRESULT volumetexture_init(struct wined3d_texture *texture, const struct
@@ -2228,6 +2227,7 @@ static HRESULT volumetexture_init(struct wined3d_texture *texture, const struct
if (layer_count != 1)
{
ERR("Invalid layer count for volume texture.\n");
@ -271,7 +271,7 @@ index 7953053..765192d 100644
return E_INVALIDARG;
}
@@ -2235,12 +2235,14 @@ static HRESULT volumetexture_init(struct wined3d_texture *texture, const struct
@@ -2236,12 +2236,14 @@ static HRESULT volumetexture_init(struct wined3d_texture *texture, const struct
if (WINED3DFMT_UNKNOWN >= desc->format)
{
WARN("(%p) : Texture cannot be created with a format of WINED3DFMT_UNKNOWN.\n", texture);
@ -286,7 +286,7 @@ index 7953053..765192d 100644
return WINED3DERR_INVALIDCALL;
}
@@ -2250,12 +2252,14 @@ static HRESULT volumetexture_init(struct wined3d_texture *texture, const struct
@@ -2251,12 +2253,14 @@ static HRESULT volumetexture_init(struct wined3d_texture *texture, const struct
if (!gl_info->supported[SGIS_GENERATE_MIPMAP])
{
WARN("No mipmap generation support, returning D3DERR_INVALIDCALL.\n");
@ -301,7 +301,7 @@ index 7953053..765192d 100644
return WINED3DERR_INVALIDCALL;
}
}
@@ -2264,6 +2268,7 @@ static HRESULT volumetexture_init(struct wined3d_texture *texture, const struct
@@ -2265,6 +2269,7 @@ static HRESULT volumetexture_init(struct wined3d_texture *texture, const struct
|| desc->pool == WINED3D_POOL_SCRATCH))
{
WARN("Attempted to create a DYNAMIC texture in pool %s.\n", debug_d3dpool(desc->pool));
@ -309,7 +309,7 @@ index 7953053..765192d 100644
return WINED3DERR_INVALIDCALL;
}
@@ -2290,6 +2295,7 @@ static HRESULT volumetexture_init(struct wined3d_texture *texture, const struct
@@ -2291,6 +2296,7 @@ static HRESULT volumetexture_init(struct wined3d_texture *texture, const struct
{
WARN("Attempted to create a NPOT volume texture (%u, %u, %u) without GL support.\n",
desc->width, desc->height, desc->depth);
@ -317,7 +317,7 @@ index 7953053..765192d 100644
return WINED3DERR_INVALIDCALL;
}
}
@@ -2299,6 +2305,7 @@ static HRESULT volumetexture_init(struct wined3d_texture *texture, const struct
@@ -2300,6 +2306,7 @@ static HRESULT volumetexture_init(struct wined3d_texture *texture, const struct
0, device, parent, parent_ops, &texture_resource_ops)))
{
WARN("Failed to initialize texture, returning %#x.\n", hr);
@ -325,16 +325,16 @@ index 7953053..765192d 100644
return hr;
}
@@ -2317,7 +2324,7 @@ static HRESULT volumetexture_init(struct wined3d_texture *texture, const struct
@@ -2318,7 +2325,7 @@ static HRESULT volumetexture_init(struct wined3d_texture *texture, const struct
if (!(volumes = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*volumes) * level_count)))
if (!(volumes = wined3d_calloc(level_count, sizeof(*volumes))))
{
- wined3d_texture_cleanup(texture);
+ wined3d_texture_cleanup_main(texture);
return E_OUTOFMEMORY;
}
@@ -2339,7 +2346,7 @@ static HRESULT volumetexture_init(struct wined3d_texture *texture, const struct
@@ -2340,7 +2347,7 @@ static HRESULT volumetexture_init(struct wined3d_texture *texture, const struct
texture, i, &sub_resource->parent, &sub_resource->parent_ops)))
{
WARN("Failed to create volume parent, hr %#x.\n", hr);
@ -343,7 +343,7 @@ index 7953053..765192d 100644
return hr;
}
@@ -2636,7 +2643,6 @@ HRESULT CDECL wined3d_texture_create(struct wined3d_device *device, const struct
@@ -2637,7 +2644,6 @@ HRESULT CDECL wined3d_texture_create(struct wined3d_device *device, const struct
if (FAILED(hr))
{
WARN("Failed to initialize texture, returning %#x.\n", hr);
@ -351,7 +351,7 @@ index 7953053..765192d 100644
return hr;
}
@@ -2644,8 +2650,7 @@ HRESULT CDECL wined3d_texture_create(struct wined3d_device *device, const struct
@@ -2645,8 +2651,7 @@ HRESULT CDECL wined3d_texture_create(struct wined3d_device *device, const struct
* in this case. */
if (data && FAILED(hr = wined3d_texture_upload_data(object, data)))
{
@ -362,10 +362,10 @@ index 7953053..765192d 100644
}
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 3d972d3..0e4602c 100644
index b366807..6f0656e 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -2631,6 +2631,7 @@ void wined3d_texture_changed(struct wined3d_texture *texture,
@@ -2652,6 +2652,7 @@ void wined3d_texture_changed(struct wined3d_texture *texture,
void *swap_heap_memory) DECLSPEC_HIDDEN;
BOOL wined3d_texture_check_block_align(const struct wined3d_texture *texture,
unsigned int level, const struct wined3d_box *box) DECLSPEC_HIDDEN;
@ -373,7 +373,7 @@ index 3d972d3..0e4602c 100644
GLenum wined3d_texture_get_gl_buffer(const struct wined3d_texture *texture) DECLSPEC_HIDDEN;
void wined3d_texture_get_memory(struct wined3d_texture *texture, unsigned int sub_resource_idx,
struct wined3d_bo_address *data, DWORD locations, BOOL map) DECLSPEC_HIDDEN;
@@ -3049,6 +3050,7 @@ void wined3d_cs_emit_create_vbo(struct wined3d_cs *cs, struct wined3d_buffer *bu
@@ -3065,6 +3066,7 @@ void wined3d_cs_emit_create_vbo(struct wined3d_cs *cs, struct wined3d_buffer *bu
void wined3d_cs_emit_resource_cleanup(struct wined3d_cs *cs,
struct wined3d_resource *resource) DECLSPEC_HIDDEN;
void wined3d_cs_emit_buffer_cleanup(struct wined3d_cs *cs, struct wined3d_buffer *buffer) DECLSPEC_HIDDEN;

File diff suppressed because it is too large Load Diff