From a40017a01059c4f9ba7c71f5d33e08415a2f9bda Mon Sep 17 00:00:00 2001 From: Sebastian Lackner Date: Wed, 25 May 2016 20:34:59 +0200 Subject: [PATCH] Rebase against 351bd33f2cd1edd680176ef777d77a3d1256ab6d. --- patches/patchinstall.sh | 2 +- ...e-the-framebuffer-into-wined3d_state.patch | 131 +++---- ...14-wined3d-Give-the-cs-its-own-state.patch | 27 +- ...e-vertex-index-updates-through-the-c.patch | 22 +- ...ht-updates-through-the-command-strea.patch | 42 +-- ...-textures-through-the-command-stream.patch | 58 +-- .../wined3d-CSMT_Main/9999-IfDefined.patch | 329 +++++++++--------- 7 files changed, 310 insertions(+), 301 deletions(-) diff --git a/patches/patchinstall.sh b/patches/patchinstall.sh index 815db408..898d0fed 100755 --- a/patches/patchinstall.sh +++ b/patches/patchinstall.sh @@ -51,7 +51,7 @@ usage() # Get the upstream commit sha upstream_commit() { - echo "698d4114677205c3e5a0df659d230fe982578757" + echo "351bd33f2cd1edd680176ef777d77a3d1256ab6d" } # Show version information diff --git a/patches/wined3d-CSMT_Main/0008-wined3d-Move-the-framebuffer-into-wined3d_state.patch b/patches/wined3d-CSMT_Main/0008-wined3d-Move-the-framebuffer-into-wined3d_state.patch index c0d35943..0d13b756 100644 --- a/patches/wined3d-CSMT_Main/0008-wined3d-Move-the-framebuffer-into-wined3d_state.patch +++ b/patches/wined3d-CSMT_Main/0008-wined3d-Move-the-framebuffer-into-wined3d_state.patch @@ -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?= 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; diff --git a/patches/wined3d-CSMT_Main/0014-wined3d-Give-the-cs-its-own-state.patch b/patches/wined3d-CSMT_Main/0014-wined3d-Give-the-cs-its-own-state.patch index d2bba109..3a1893b6 100644 --- a/patches/wined3d-CSMT_Main/0014-wined3d-Give-the-cs-its-own-state.patch +++ b/patches/wined3d-CSMT_Main/0014-wined3d-Give-the-cs-its-own-state.patch @@ -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?= 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; diff --git a/patches/wined3d-CSMT_Main/0022-wined3d-Send-base-vertex-index-updates-through-the-c.patch b/patches/wined3d-CSMT_Main/0022-wined3d-Send-base-vertex-index-updates-through-the-c.patch index c8318fb5..295363d7 100644 --- a/patches/wined3d-CSMT_Main/0022-wined3d-Send-base-vertex-index-updates-through-the-c.patch +++ b/patches/wined3d-CSMT_Main/0022-wined3d-Send-base-vertex-index-updates-through-the-c.patch @@ -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?= 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; diff --git a/patches/wined3d-CSMT_Main/0026-wined3d-Send-light-updates-through-the-command-strea.patch b/patches/wined3d-CSMT_Main/0026-wined3d-Send-light-updates-through-the-command-strea.patch index 90d449cd..99eb50d7 100644 --- a/patches/wined3d-CSMT_Main/0026-wined3d-Send-light-updates-through-the-command-strea.patch +++ b/patches/wined3d-CSMT_Main/0026-wined3d-Send-light-updates-through-the-command-strea.patch @@ -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?= 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; diff --git a/patches/wined3d-CSMT_Main/0097-wined3d-Clean-up-textures-through-the-command-stream.patch b/patches/wined3d-CSMT_Main/0097-wined3d-Clean-up-textures-through-the-command-stream.patch index 21d6dabb..572ccbee 100644 --- a/patches/wined3d-CSMT_Main/0097-wined3d-Clean-up-textures-through-the-command-stream.patch +++ b/patches/wined3d-CSMT_Main/0097-wined3d-Clean-up-textures-through-the-command-stream.patch @@ -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?= 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; diff --git a/patches/wined3d-CSMT_Main/9999-IfDefined.patch b/patches/wined3d-CSMT_Main/9999-IfDefined.patch index ec209efc..7363d848 100644 --- a/patches/wined3d-CSMT_Main/9999-IfDefined.patch +++ b/patches/wined3d-CSMT_Main/9999-IfDefined.patch @@ -100,7 +100,7 @@ diff --git a/dlls/wined3d/arb_program_shader.c b/dlls/wined3d/arb_program_shader shader_arb_ps_local_constants(compiled, context, state, rt_height); } -@@ -7997,11 +8009,16 @@ +@@ -7996,11 +8008,16 @@ /* Leave the opengl state valid for blitting */ arbfp_blit_unset(context->gl_info); @@ -171,7 +171,7 @@ diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c return; -@@ -467,8 +483,12 @@ +@@ -466,8 +482,12 @@ data->buffer_object = buffer->buffer_object; if (!buffer->buffer_object) { @@ -184,7 +184,7 @@ diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c { buffer_create_buffer_object(buffer, context); buffer->flags &= ~WINED3D_BUFFER_CREATEBO; -@@ -507,7 +527,9 @@ +@@ -506,7 +526,9 @@ if (!wined3d_resource_allocate_sysmem(&buffer->resource)) ERR("Failed to allocate system memory.\n"); @@ -194,7 +194,7 @@ diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c buffer_bind(buffer, context); GL_EXTCALL(glGetBufferSubData(buffer->buffer_type_hint, 0, buffer->resource.size, buffer->resource.heap_memory)); -@@ -553,6 +575,7 @@ +@@ -552,6 +574,7 @@ resource_unload(resource); } @@ -202,7 +202,7 @@ diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c void wined3d_buffer_cleanup_cs(struct wined3d_buffer *buffer) { struct wined3d_context *context; -@@ -585,6 +608,30 @@ +@@ -584,6 +607,30 @@ buffer->resource.parent_ops->wined3d_object_destroyed(buffer->resource.parent); wined3d_cs_emit_buffer_cleanup(device->cs, buffer); @@ -233,7 +233,7 @@ diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c } return refcount; -@@ -669,6 +716,7 @@ +@@ -668,6 +715,7 @@ /* The caller provides a GL context */ static void buffer_direct_upload(struct wined3d_buffer *This, const struct wined3d_gl_info *gl_info, DWORD flags) { @@ -241,7 +241,7 @@ diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c UINT start = 0, len = 0; /* This potentially invalidates the element array buffer binding, but the -@@ -692,6 +740,45 @@ +@@ -691,6 +739,45 @@ GL_EXTCALL(glBufferParameteriAPPLE(This->buffer_type_hint, GL_BUFFER_SERIALIZED_MODIFY_APPLE, GL_TRUE)); checkGLcall("glBufferParameteriAPPLE(This->buffer_type_hint, GL_BUFFER_SERIALIZED_MODIFY_APPLE, GL_TRUE)"); This->flags &= ~WINED3D_BUFFER_APPLESYNC; @@ -287,7 +287,7 @@ diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c } while (This->modified_areas) -@@ -700,12 +787,33 @@ +@@ -699,12 +786,33 @@ start = This->maps[This->modified_areas].offset; len = This->maps[This->modified_areas].size; @@ -321,7 +321,7 @@ diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c { buffer->flags &= ~(WINED3D_BUFFER_SYNC | WINED3D_BUFFER_DISCARD); } -@@ -724,6 +832,14 @@ +@@ -723,6 +831,14 @@ TRACE("buffer %p.\n", buffer); @@ -336,7 +336,7 @@ diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c buffer_mark_used(buffer); if (!buffer->buffer_object) -@@ -912,6 +1028,7 @@ +@@ -911,6 +1027,7 @@ void CDECL wined3d_buffer_preload(struct wined3d_buffer *buffer) { @@ -344,7 +344,7 @@ diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c struct wined3d_device *device = buffer->resource.device; if (buffer->resource.map_count) -@@ -921,6 +1038,12 @@ +@@ -920,6 +1037,12 @@ } wined3d_cs_emit_buffer_preload(device->cs, buffer); @@ -357,7 +357,7 @@ diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c } struct wined3d_resource * CDECL wined3d_buffer_get_resource(struct wined3d_buffer *buffer) -@@ -934,6 +1057,7 @@ +@@ -933,6 +1056,7 @@ { LONG count; BYTE *base; @@ -365,7 +365,7 @@ diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c struct wined3d_device *device = buffer->resource.device; struct wined3d_context *context; -@@ -958,6 +1082,10 @@ +@@ -957,6 +1081,10 @@ wined3d_cs_emit_create_vbo(device->cs, buffer); buffer->flags &= ~WINED3D_BUFFER_CREATEBO; } @@ -376,7 +376,7 @@ diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c flags = wined3d_resource_sanitize_map_flags(&buffer->resource, flags); /* Filter redundant WINED3D_MAP_DISCARD maps. The 3DMark2001 multitexture -@@ -966,7 +1094,11 @@ +@@ -965,7 +1093,11 @@ * previous contents of the buffer. The r600g driver only does this when * the buffer is currently in use, while the proprietary NVIDIA driver * appears to do this unconditionally. */ @@ -388,7 +388,7 @@ diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c flags &= ~WINED3D_MAP_DISCARD; count = ++buffer->resource.map_count; -@@ -977,6 +1109,7 @@ +@@ -976,6 +1108,7 @@ * being uploaded in that case. Two such applications are Port Royale * and Darkstar One. */ if (flags & WINED3D_MAP_DISCARD) @@ -396,7 +396,7 @@ diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c wined3d_cs_emit_buffer_invalidate_bo_range(device->cs, buffer, 0, 0); else if (!(flags & WINED3D_MAP_READONLY)) wined3d_cs_emit_buffer_invalidate_bo_range(device->cs, buffer, offset, size); -@@ -994,6 +1127,19 @@ +@@ -993,6 +1126,19 @@ wined3d_cs_emit_glfinish(device->cs); device->cs->ops->finish(device->cs); } @@ -416,7 +416,7 @@ diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c context = context_acquire(device, NULL); gl_info = context->gl_info; -@@ -1042,6 +1188,7 @@ +@@ -1041,6 +1187,7 @@ buffer_get_sysmem(buffer, context); } TRACE("New pointer is %p.\n", buffer->resource.heap_memory); @@ -424,7 +424,7 @@ diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c } context_release(context); } -@@ -1081,6 +1228,21 @@ +@@ -1080,6 +1227,21 @@ } base = buffer->map_ptr ? buffer->map_ptr : buffer->resource.map_heap_memory; @@ -446,7 +446,7 @@ diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c *data = base + offset; TRACE("Returning memory at %p (base %p, offset %u).\n", *data, base, offset); -@@ -1143,6 +1305,7 @@ +@@ -1142,6 +1304,7 @@ } GL_EXTCALL(glUnmapBuffer(buffer->buffer_type_hint)); @@ -454,7 +454,7 @@ diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c if (wined3d_settings.cs_multithreaded) gl_info->gl_ops.gl.p_glFinish(); else if (wined3d_settings.strict_draw_ordering) -@@ -1151,6 +1314,18 @@ +@@ -1150,6 +1313,18 @@ buffer_clear_dirty_areas(buffer); buffer->map_ptr = NULL; @@ -473,7 +473,7 @@ diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c } } -@@ -1343,7 +1518,9 @@ +@@ -1342,7 +1517,9 @@ return hr; } buffer->buffer_type_hint = bind_hint; @@ -483,7 +483,7 @@ diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c TRACE("size %#x, usage %#x, format %s, memory @ %p, iface @ %p.\n", buffer->resource.size, buffer->resource.usage, debug_d3dformat(buffer->resource.format->id), buffer->resource.heap_memory, buffer); -@@ -1379,8 +1556,21 @@ +@@ -1378,8 +1555,21 @@ buffer->flags |= WINED3D_BUFFER_CREATEBO; } @@ -505,7 +505,7 @@ diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c buffer->maps = HeapAlloc(GetProcessHeap(), 0, sizeof(*buffer->maps)); if (!buffer->maps) -@@ -1388,6 +1578,7 @@ +@@ -1387,6 +1577,7 @@ ERR("Out of memory\n"); buffer_unload(&buffer->resource); resource_cleanup(&buffer->resource); @@ -513,7 +513,7 @@ diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c if (wined3d_settings.cs_multithreaded) buffer->resource.device->cs->ops->finish(buffer->resource.device->cs); return E_OUTOFMEMORY; -@@ -1407,6 +1598,11 @@ +@@ -1406,6 +1597,11 @@ return hr; } } @@ -525,7 +525,7 @@ diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c return WINED3D_OK; } -@@ -1515,6 +1711,7 @@ +@@ -1514,6 +1710,7 @@ return WINED3D_OK; } @@ -533,7 +533,7 @@ diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c void buffer_swap_mem(struct wined3d_buffer *buffer, BYTE *mem) { -@@ -1522,3 +1719,4 @@ +@@ -1521,3 +1718,4 @@ buffer->resource.heap_memory = mem; buffer->flags |= WINED3D_BUFFER_DISCARD; } @@ -541,7 +541,7 @@ diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c --- a/dlls/wined3d/context.c +++ b/dlls/wined3d/context.c -@@ -1687,12 +1687,14 @@ +@@ -1680,12 +1680,14 @@ goto out; } @@ -556,7 +556,7 @@ diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c /* Initialize the texture unit mapping to a 1:1 mapping */ for (s = 0; s < MAX_COMBINED_SAMPLERS; ++s) { -@@ -1997,7 +1999,9 @@ +@@ -1990,7 +1992,9 @@ 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); @@ -566,7 +566,7 @@ diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c HeapFree(GetProcessHeap(), 0, ret->free_event_queries); HeapFree(GetProcessHeap(), 0, ret->free_occlusion_queries); HeapFree(GetProcessHeap(), 0, ret->free_timestamp_queries); -@@ -2034,7 +2038,9 @@ +@@ -2027,7 +2031,9 @@ device->shader_backend->shader_free_context_data(context); device->adapter->fragment_pipe->free_context_data(context); HeapFree(GetProcessHeap(), 0, context->fbo_key); @@ -576,7 +576,7 @@ diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c HeapFree(GetProcessHeap(), 0, context->draw_buffers); HeapFree(GetProcessHeap(), 0, context->blit_targets); device_context_remove(device, context); -@@ -2450,6 +2456,9 @@ +@@ -2443,6 +2449,9 @@ { /* Onscreen surfaces are always in a swapchain */ struct wined3d_swapchain *swapchain = context->current_rt.texture->swapchain; @@ -586,7 +586,7 @@ diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c if (context->render_offscreen || !depth_stencil) return; if (match_depth_stencil_format(swapchain->ds_format, depth_stencil->format)) return; -@@ -2460,8 +2469,13 @@ +@@ -2453,8 +2462,13 @@ WARN("Depth stencil format is not supported by WGL, rendering the backbuffer in an FBO\n"); /* The currently active context is the necessary context to access the swapchain's onscreen buffers */ @@ -600,7 +600,7 @@ diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c swapchain->render_to_fbo = TRUE; swapchain_update_draw_bindings(swapchain); context_set_render_offscreen(context, TRUE); -@@ -2562,7 +2576,11 @@ +@@ -2555,7 +2569,11 @@ } /* Context activation is done by the caller. */ @@ -612,7 +612,7 @@ diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c UINT rt_count, const struct wined3d_fb_state *fb) { struct wined3d_rendertarget_view **rts = fb->render_targets; -@@ -2571,7 +2589,11 @@ +@@ -2564,7 +2582,11 @@ DWORD rt_mask = 0, *cur_mask; UINT i; @@ -624,7 +624,7 @@ diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c || rt_count != gl_info->limits.buffers) { if (!context_validate_rt_config(rt_count, rts, dsv)) -@@ -2616,8 +2638,10 @@ +@@ -2609,8 +2631,10 @@ rt_mask = context_generate_rt_mask_no_fbo(context, rt_count ? wined3d_rendertarget_view_get_surface(rts[0])->container : NULL); } @@ -635,7 +635,7 @@ diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c } else if (wined3d_settings.offscreen_rendering_mode == ORM_FBO && (!rt_count || wined3d_resource_is_offscreen(rts[0]->resource))) -@@ -2658,8 +2682,12 @@ +@@ -2651,8 +2675,12 @@ gl_info->gl_ops.gl.p_glEnable(GL_SCISSOR_TEST); if (rt_count && gl_info->supported[ARB_FRAMEBUFFER_SRGB]) { @@ -648,7 +648,7 @@ diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c gl_info->gl_ops.gl.p_glEnable(GL_FRAMEBUFFER_SRGB); else gl_info->gl_ops.gl.p_glDisable(GL_FRAMEBUFFER_SRGB); -@@ -2676,7 +2704,11 @@ +@@ -2669,7 +2697,11 @@ static DWORD find_draw_buffers_mask(const struct wined3d_context *context, const struct wined3d_state *state) { @@ -660,7 +660,7 @@ diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c struct wined3d_shader *ps = state->shader[WINED3D_SHADER_TYPE_PIXEL]; DWORD rt_mask, rt_mask_bits; unsigned int i; -@@ -2706,7 +2738,11 @@ +@@ -2699,7 +2731,11 @@ 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); @@ -672,7 +672,7 @@ diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c DWORD *cur_mask; if (wined3d_settings.offscreen_rendering_mode == ORM_FBO) -@@ -2737,8 +2773,10 @@ +@@ -2730,8 +2766,10 @@ context_apply_draw_buffers(context, rt_mask); *cur_mask = rt_mask; } @@ -683,7 +683,7 @@ diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c } static void context_map_stage(struct wined3d_context *context, DWORD stage, DWORD unit) -@@ -3382,7 +3420,11 @@ +@@ -3379,7 +3417,11 @@ const struct wined3d_device *device, const struct wined3d_state *state) { const struct StateEntry *state_table = context->state_table; @@ -695,7 +695,7 @@ diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c unsigned int i; WORD map; -@@ -3415,12 +3457,17 @@ +@@ -3412,12 +3454,17 @@ for (i = 0, map = context->stream_info.use_map; map; map >>= 1, ++i) { if (map & 1) @@ -713,7 +713,7 @@ diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c } if (state->index_buffer) { -@@ -3539,9 +3586,11 @@ +@@ -3536,9 +3583,11 @@ TRACE("device %p, target %p.\n", device, target); @@ -1941,7 +1941,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c }; void wined3d_cs_switch_onscreen_ds(struct wined3d_cs *cs, -@@ -3204,5 +3985,119 @@ +@@ -3204,5 +3985,120 @@ ERR("Closing event failed.\n"); } @@ -2030,8 +2030,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c + 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)))) + { + HeapFree(GetProcessHeap(), 0, cs); + return NULL; @@ -2046,6 +2045,8 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c + 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; + } @@ -2267,14 +2268,14 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c return WINED3DERR_INVALIDCALL; +#if !defined(STAGING_CSMT) -+ 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; + +#endif /* STAGING_CSMT */ if (FAILED(hr = device->shader_backend->shader_alloc_private(device, device->adapter->vertex_pipe, device->adapter->fragment_pipe))) { -@@ -1037,11 +1136,24 @@ +@@ -1036,11 +1135,24 @@ device->swapchains[0] = swapchain; device_init_swapchain_state(device, swapchain); @@ -2299,7 +2300,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c /* Clear the screen */ if (swapchain->back_buffers && swapchain->back_buffers[0]) -@@ -1058,6 +1170,9 @@ +@@ -1057,6 +1169,9 @@ return WINED3D_OK; err_out: @@ -2309,7 +2310,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c HeapFree(GetProcessHeap(), 0, device->swapchains); device->swapchain_count = 0; if (device->back_buffer_view) -@@ -1115,6 +1230,10 @@ +@@ -1113,6 +1228,10 @@ HRESULT CDECL wined3d_device_uninit_3d(struct wined3d_device *device) { struct wined3d_resource *resource, *cursor; @@ -2320,7 +2321,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c struct wined3d_surface *surface; UINT i; -@@ -1123,6 +1242,7 @@ +@@ -1121,6 +1240,7 @@ if (!device->d3d_initialized) return WINED3DERR_INVALIDCALL; @@ -2328,7 +2329,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c if (wined3d_settings.cs_multithreaded) device->cs->ops->finish(device->cs); -@@ -1163,6 +1283,82 @@ +@@ -1161,6 +1281,82 @@ /* FIXME: Is this in the right place??? */ wined3d_cs_emit_delete_opengl_contexts(device->cs, device->swapchains[0]); @@ -2411,7 +2412,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c if (device->back_buffer_view) { wined3d_rendertarget_view_decref(device->back_buffer_view); -@@ -1180,6 +1376,11 @@ +@@ -1178,6 +1374,11 @@ device->swapchains = NULL; device->swapchain_count = 0; @@ -2423,7 +2424,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c device->d3d_initialized = FALSE; return WINED3D_OK; -@@ -1224,7 +1425,11 @@ +@@ -1222,7 +1423,11 @@ /* We can not acquire the context unless there is a swapchain. */ if (device->swapchains && gl_info->supported[NVX_GPU_MEMORY_INFO] && @@ -2435,7 +2436,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c { GLint vram_free_kb; UINT64 vram_free; -@@ -1565,6 +1770,16 @@ +@@ -1563,6 +1768,16 @@ light->direction.x, light->direction.y, light->direction.z, light->range, light->falloff, light->theta, light->phi); @@ -2452,7 +2453,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c /* Save away the information. */ object->OriginalParms = *light; -@@ -1644,9 +1859,11 @@ +@@ -1642,9 +1857,11 @@ FIXME("Unrecognized light type %#x.\n", light->type); } @@ -2464,7 +2465,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c return WINED3D_OK; } -@@ -1719,6 +1936,14 @@ +@@ -1717,6 +1934,14 @@ { if (light_info->glIndex != -1) { @@ -2479,7 +2480,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c device->update_state->lights[light_info->glIndex] = NULL; light_info->glIndex = -1; } -@@ -1760,11 +1985,23 @@ +@@ -1758,11 +1983,23 @@ WARN("Too many concurrently active lights\n"); return WINED3D_OK; } @@ -2503,7 +2504,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c return WINED3D_OK; } -@@ -1931,9 +2168,11 @@ +@@ -1929,9 +2166,11 @@ TRACE("device %p, base_index %d.\n", device, base_index); device->update_state->base_vertex_index = base_index; @@ -2515,7 +2516,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c } INT CDECL wined3d_device_get_base_vertex_index(const struct wined3d_device *device) -@@ -1979,7 +2218,11 @@ +@@ -1977,7 +2216,11 @@ || !(dst_texture->resource.format_flags & WINED3DFMT_FLAG_DEPTH)) return; @@ -2527,7 +2528,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c return; if (src_view->resource->type == WINED3D_RTYPE_BUFFER) { -@@ -2314,6 +2557,7 @@ +@@ -2312,6 +2555,7 @@ return device->state.sampler[WINED3D_SHADER_TYPE_VERTEX][idx]; } @@ -2535,7 +2536,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c void device_invalidate_shader_constants(const struct wined3d_device *device, DWORD mask) { UINT i; -@@ -2324,6 +2568,7 @@ +@@ -2322,6 +2566,7 @@ } } @@ -2543,7 +2544,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c HRESULT CDECL wined3d_device_set_vs_consts_b(struct wined3d_device *device, unsigned int start_idx, unsigned int count, const BOOL *constants) { -@@ -2351,8 +2596,12 @@ +@@ -2349,8 +2594,12 @@ } else { @@ -2556,7 +2557,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c } return WINED3D_OK; -@@ -2401,8 +2650,12 @@ +@@ -2399,8 +2648,12 @@ } else { @@ -2569,7 +2570,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c } return WINED3D_OK; -@@ -2447,8 +2700,12 @@ +@@ -2445,8 +2698,12 @@ memset(&device->recording->changed.vs_consts_f[start_idx], 1, count * sizeof(*device->recording->changed.vs_consts_f)); else @@ -2582,7 +2583,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c return WINED3D_OK; } -@@ -2587,8 +2844,12 @@ +@@ -2585,8 +2842,12 @@ } else { @@ -2595,7 +2596,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c } return WINED3D_OK; -@@ -2637,8 +2898,12 @@ +@@ -2635,8 +2896,12 @@ } else { @@ -2608,7 +2609,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c } return WINED3D_OK; -@@ -2684,8 +2949,12 @@ +@@ -2682,8 +2947,12 @@ memset(&device->recording->changed.ps_consts_f[start_idx], 1, count * sizeof(*device->recording->changed.ps_consts_f)); else @@ -2621,7 +2622,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c return WINED3D_OK; } -@@ -2845,6 +3114,7 @@ +@@ -2843,6 +3112,7 @@ return hr; } @@ -2629,7 +2630,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c if (wined3d_settings.cs_multithreaded) { FIXME("Waiting for cs.\n"); -@@ -2852,6 +3122,7 @@ +@@ -2850,6 +3120,7 @@ device->cs->ops->finish(device->cs); } @@ -2637,7 +2638,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c wined3d_device_get_transform(device, WINED3D_TS_VIEW, &view_mat); wined3d_device_get_transform(device, WINED3D_TS_PROJECTION, &proj_mat); wined3d_device_get_transform(device, WINED3D_TS_WORLD_MATRIX(0), &world_mat); -@@ -3337,6 +3608,10 @@ +@@ -3335,6 +3606,10 @@ HRESULT CDECL wined3d_device_end_scene(struct wined3d_device *device) { @@ -2648,7 +2649,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c TRACE("device %p.\n", device); if (!device->inScene) -@@ -3345,6 +3620,15 @@ +@@ -3343,6 +3618,15 @@ return WINED3DERR_INVALIDCALL; } @@ -2664,7 +2665,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c device->inScene = FALSE; return WINED3D_OK; } -@@ -3352,8 +3636,10 @@ +@@ -3350,8 +3634,10 @@ 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) { @@ -2675,7 +2676,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c 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); -@@ -3365,7 +3651,11 @@ +@@ -3363,7 +3649,11 @@ if (flags & (WINED3DCLEAR_ZBUFFER | WINED3DCLEAR_STENCIL)) { @@ -2687,7 +2688,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c if (!ds) { WARN("Clearing depth and/or stencil without a depth stencil buffer attached, returning WINED3DERR_INVALIDCALL\n"); -@@ -3374,8 +3664,13 @@ +@@ -3372,8 +3662,13 @@ } else if (flags & WINED3DCLEAR_TARGET) { @@ -2701,7 +2702,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c { WARN("Silently ignoring depth and target clear with mismatching sizes\n"); return WINED3D_OK; -@@ -3421,6 +3716,9 @@ +@@ -3419,6 +3714,9 @@ enum wined3d_primitive_type primitive_type) { GLenum gl_primitive_type, prev; @@ -2711,7 +2712,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c TRACE("device %p, primitive_type %s\n", device, debug_d3dprimitivetype(primitive_type)); gl_primitive_type = gl_primitive_type_from_d3d(primitive_type); -@@ -3428,8 +3726,13 @@ +@@ -3426,8 +3724,13 @@ device->update_state->gl_primitive_type = gl_primitive_type; if (device->recording) device->recording->changed.primitive_type = TRUE; @@ -2725,9 +2726,9 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c } void CDECL wined3d_device_get_primitive_type(const struct wined3d_device *device, -@@ -3452,6 +3755,14 @@ - return WINED3DERR_INVALIDCALL; - } +@@ -3444,6 +3747,14 @@ + { + TRACE("device %p, start_vertex %u, vertex_count %u.\n", device, start_vertex, vertex_count); +#if !defined(STAGING_CSMT) + if (device->state.load_base_vertex_index) @@ -2740,7 +2741,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c wined3d_cs_emit_draw(device->cs, start_vertex, vertex_count, 0, 0, FALSE); return WINED3D_OK; -@@ -3468,6 +3779,10 @@ +@@ -3460,6 +3771,10 @@ HRESULT CDECL wined3d_device_draw_indexed_primitive(struct wined3d_device *device, UINT start_idx, UINT index_count) { @@ -2751,13 +2752,13 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c TRACE("device %p, start_idx %u, index_count %u.\n", device, start_idx, index_count); if (!device->state.index_buffer) -@@ -3486,6 +3801,15 @@ +@@ -3472,6 +3787,15 @@ return WINED3DERR_INVALIDCALL; } +#if !defined(STAGING_CSMT) + 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); @@ -2767,7 +2768,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c wined3d_cs_emit_draw(device->cs, start_idx, index_count, 0, 0, TRUE); return WINED3D_OK; -@@ -3500,6 +3824,7 @@ +@@ -3486,6 +3810,7 @@ wined3d_cs_emit_draw(device->cs, start_idx, index_count, start_instance, instance_count, TRUE); } @@ -2775,7 +2776,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c /* Context activation is done by the caller. */ static void wined3d_device_update_texture_3d(struct wined3d_context *context, struct wined3d_texture *src_texture, unsigned int src_level, -@@ -3510,6 +3835,36 @@ +@@ -3496,6 +3821,36 @@ TRACE("context %p, src_texture %p, src_level %u, dst_texture %p, level_count %u.\n", context, src_texture, src_level, dst_texture, level_count); @@ -2812,7 +2813,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c /* Only a prepare, since we're uploading entire volumes. */ wined3d_texture_prepare_texture(dst_texture, context, FALSE); -@@ -3517,6 +3872,7 @@ +@@ -3503,6 +3858,7 @@ for (i = 0; i < level_count; ++i) { @@ -2820,7 +2821,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c wined3d_texture_get_memory(src_texture, src_level + i, &data, src_texture->resource.map_binding, FALSE); -@@ -3594,6 +3950,34 @@ +@@ -3580,6 +3936,34 @@ unsigned int src_size, dst_size, src_skip_levels = 0; unsigned int layer_count; enum wined3d_resource_type type; @@ -2855,7 +2856,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c TRACE("device %p, src_texture %p, dst_texture %p.\n", device, src_texture, dst_texture); -@@ -3630,6 +4014,7 @@ +@@ -3616,6 +4000,7 @@ return WINED3DERR_INVALIDCALL; } @@ -2863,7 +2864,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c /* FIXME: This isn't necessary for 2D textures, but currently surface_upload_from_surface * rejects mismatching formats, and we can't report the error back after dispatching the * call. */ -@@ -3672,6 +4057,65 @@ +@@ -3658,6 +4043,65 @@ wined3d_cs_emit_update_texture(device->cs, src_texture, dst_texture); return WINED3D_OK; @@ -2929,7 +2930,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c } HRESULT CDECL wined3d_device_validate_device(const struct wined3d_device *device, DWORD *num_passes) -@@ -3719,8 +4163,13 @@ +@@ -3705,8 +4149,13 @@ if (state->render_states[WINED3D_RS_ZENABLE] || state->render_states[WINED3D_RS_ZWRITEENABLE] || state->render_states[WINED3D_RS_STENCILENABLE]) { @@ -2943,7 +2944,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c if (ds && rt && (ds->width < rt->width || ds->height < rt->height)) { -@@ -3909,7 +4358,9 @@ +@@ -3895,7 +4344,9 @@ struct wined3d_texture *dst_texture, *src_texture; RECT dst_rect, src_rect; HRESULT hr; @@ -2953,7 +2954,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c TRACE("device %p, dst_resource %p, dst_sub_resource_idx %u, dst_x %u, dst_y %u, dst_z %u, " "src_resource %p, src_sub_resource_idx %u, src_box %s.\n", -@@ -3997,6 +4448,7 @@ +@@ -3983,6 +4434,7 @@ if (src_box) { @@ -2961,7 +2962,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c if ((src_texture->resource.format_flags & WINED3DFMT_FLAG_BLOCKS) && !wined3d_texture_check_block_align(src_texture, src_sub_resource_idx % src_texture->level_count, src_box)) -@@ -4005,6 +4457,7 @@ +@@ -3991,6 +4443,7 @@ return WINED3DERR_INVALIDCALL; } @@ -2969,7 +2970,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c SetRect(&src_rect, src_box->left, src_box->top, src_box->right, src_box->bottom); } else -@@ -4018,6 +4471,7 @@ +@@ -4004,6 +4457,7 @@ SetRect(&dst_rect, dst_x, dst_y, dst_x + (src_rect.right - src_rect.left), dst_y + (src_rect.bottom - src_rect.top)); @@ -2977,7 +2978,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c if (dst_texture->resource.format_flags & WINED3DFMT_FLAG_BLOCKS) { dst_box.left = dst_rect.left; -@@ -4035,6 +4489,7 @@ +@@ -4021,6 +4475,7 @@ } } @@ -2985,7 +2986,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c if (FAILED(hr = wined3d_texture_blt(dst_texture, dst_sub_resource_idx, &dst_rect, src_texture, src_sub_resource_idx, &src_rect, 0, NULL, WINED3D_TEXF_POINT))) WARN("Failed to blit, hr %#x.\n", hr); -@@ -4047,7 +4502,18 @@ +@@ -4033,7 +4488,18 @@ unsigned int depth_pitch) { struct wined3d_texture_sub_resource *sub_resource; @@ -3004,7 +3005,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c TRACE("device %p, resource %p, sub_resource_idx %u, box %s, data %p, row_pitch %u, depth_pitch %u.\n", device, resource, sub_resource_idx, debug_box(box), data, row_pitch, depth_pitch); -@@ -4081,6 +4547,7 @@ +@@ -4067,6 +4533,7 @@ WARN("Invalid sub_resource_idx %u.\n", sub_resource_idx); return; } @@ -3012,7 +3013,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c if (box) { -@@ -4090,6 +4557,18 @@ +@@ -4076,6 +4543,18 @@ width = wined3d_texture_get_level_width(texture, level); height = wined3d_texture_get_level_height(texture, level); @@ -3031,7 +3032,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c if (box->left >= box->right || box->right > width || box->top >= box->bottom || box->bottom > height || box->front >= box->back) -@@ -4097,9 +4576,46 @@ +@@ -4083,9 +4562,46 @@ WARN("Invalid box %s specified.\n", debug_box(box)); return; } @@ -3078,7 +3079,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c } HRESULT CDECL wined3d_device_clear_rendertarget_view(struct wined3d_device *device, -@@ -4108,8 +4624,13 @@ +@@ -4094,8 +4610,13 @@ { const struct blit_shader *blitter; struct wined3d_resource *resource; @@ -3092,7 +3093,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c TRACE("device %p, view %p, rect %s, flags %#x, color %s, depth %.8e, stencil %u.\n", device, view, wine_dbgstr_rect(rect), flags, debug_color(color), depth, stencil); -@@ -4148,8 +4669,15 @@ +@@ -4134,8 +4655,15 @@ return WINED3DERR_INVALIDCALL; } @@ -3108,7 +3109,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c } struct wined3d_rendertarget_view * CDECL wined3d_device_get_rendertarget_view(const struct wined3d_device *device, -@@ -4163,6 +4691,7 @@ +@@ -4149,6 +4677,7 @@ return NULL; } @@ -3116,7 +3117,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c return device->state.fb.render_targets[view_idx]; } -@@ -4178,6 +4707,22 @@ +@@ -4164,6 +4693,22 @@ { struct wined3d_rendertarget_view *prev; struct wined3d_fb_state *fb = &device->state.fb; @@ -3139,7 +3140,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c TRACE("device %p, view_idx %u, view %p, set_viewport %#x.\n", device, view_idx, view, set_viewport); -@@ -4217,6 +4762,7 @@ +@@ -4203,6 +4748,7 @@ } @@ -3147,7 +3148,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c prev = fb->render_targets[view_idx]; if (view == prev) return WINED3D_OK; -@@ -4224,6 +4770,15 @@ +@@ -4210,6 +4756,15 @@ if (view) wined3d_rendertarget_view_incref(view); fb->render_targets[view_idx] = view; @@ -3163,7 +3164,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c 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. */ -@@ -4235,6 +4790,7 @@ +@@ -4221,6 +4776,7 @@ void CDECL wined3d_device_set_depth_stencil_view(struct wined3d_device *device, struct wined3d_rendertarget_view *view) { @@ -3171,7 +3172,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c struct wined3d_fb_state *fb = &device->state.fb; struct wined3d_rendertarget_view *prev; -@@ -4248,6 +4804,20 @@ +@@ -4234,6 +4790,20 @@ } if ((fb->depth_stencil = view)) @@ -3192,7 +3193,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c wined3d_rendertarget_view_incref(view); wined3d_cs_emit_set_depth_stencil_view(device->cs, view); if (prev) -@@ -4469,8 +5039,10 @@ +@@ -4455,8 +5025,10 @@ TRACE("device %p.\n", device); @@ -3203,7 +3204,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c LIST_FOR_EACH_ENTRY_SAFE(resource, cursor, &device->resources, struct wined3d_resource, resource_list_entry) { TRACE("Checking resource %p for eviction.\n", resource); -@@ -4478,6 +5050,7 @@ +@@ -4464,6 +5036,7 @@ if (resource->pool == WINED3D_POOL_MANAGED && !resource->map_count) { TRACE("Evicting %p.\n", resource); @@ -3211,7 +3212,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c wined3d_cs_emit_evict_resource(device->cs, resource); } } -@@ -4496,6 +5069,36 @@ +@@ -4482,6 +5055,36 @@ context = context_acquire(device, NULL); gl_info = context->gl_info; @@ -3248,7 +3249,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c if (device->depth_blt_texture) { -@@ -4517,6 +5120,7 @@ +@@ -4503,6 +5106,7 @@ HeapFree(GetProcessHeap(), 0, swapchain->context); swapchain->context = NULL; @@ -3256,7 +3257,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c swapchain->num_contexts = 0; } -@@ -4535,6 +5139,14 @@ +@@ -4521,6 +5125,14 @@ static HRESULT create_primary_opengl_context(struct wined3d_device *device, struct wined3d_swapchain *swapchain) { @@ -3271,7 +3272,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c HRESULT hr; if (FAILED(hr = device->shader_backend->shader_alloc_private(device, -@@ -4551,6 +5163,7 @@ +@@ -4537,6 +5149,7 @@ return hr; } @@ -3279,7 +3280,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c hr = wined3d_cs_emit_create_swapchain_context(device->cs, swapchain); if (FAILED(hr)) { -@@ -4561,6 +5174,33 @@ +@@ -4547,6 +5160,33 @@ } wined3d_cs_emit_create_dummy_textures(device->cs); @@ -3313,7 +3314,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c return WINED3D_OK; } -@@ -4580,12 +5220,14 @@ +@@ -4566,12 +5206,14 @@ TRACE("device %p, swapchain_desc %p, mode %p, callback %p, reset_state %#x.\n", device, swapchain_desc, mode, callback, reset_state); @@ -3328,7 +3329,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c if (!(swapchain = wined3d_device_get_swapchain(device, 0))) { ERR("Failed to get the first implicit swapchain.\n"); -@@ -4605,9 +5247,16 @@ +@@ -4591,9 +5233,16 @@ wined3d_texture_decref(device->cursor_texture); device->cursor_texture = NULL; } @@ -3345,7 +3346,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c { for (i = 0; i < device->adapter->gl_info.limits.buffers; ++i) { -@@ -4616,6 +5265,7 @@ +@@ -4602,6 +5251,7 @@ } wined3d_device_set_depth_stencil_view(device, NULL); @@ -3353,7 +3354,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c if (reset_state) { state_unbind_resources(&device->state); -@@ -4625,6 +5275,12 @@ +@@ -4611,6 +5261,12 @@ { wined3d_texture_decref(device->cs->onscreen_depth_stencil->container); device->cs->onscreen_depth_stencil = NULL; @@ -3366,7 +3367,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c } if (reset_state) -@@ -4844,6 +5500,7 @@ +@@ -4830,6 +5486,7 @@ if (device->d3d_initialized) delete_opengl_contexts(device, swapchain); @@ -3374,7 +3375,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c if (FAILED(hr = state_init(&device->state, &device->adapter->gl_info, &device->adapter->d3d_info, WINED3D_STATE_INIT_DEFAULT))) ERR("Failed to initialize device state, hr %#x.\n", hr); -@@ -4868,6 +5525,32 @@ +@@ -4854,6 +5511,32 @@ state->scissor_rect.left = 0; state->scissor_rect.right = swapchain->desc.backbuffer_width; state->scissor_rect.bottom = swapchain->desc.backbuffer_height; @@ -3407,7 +3408,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c wined3d_cs_emit_set_scissor_rect(device->cs, &state->scissor_rect); } -@@ -4875,7 +5558,11 @@ +@@ -4861,7 +5544,11 @@ { if (reset_state) hr = create_primary_opengl_context(device, swapchain); @@ -3419,7 +3420,7 @@ 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 -@@ -4955,6 +5642,7 @@ +@@ -4941,6 +5628,7 @@ TRACE("device %p, resource %p, type %s.\n", device, resource, debug_d3dresourcetype(type)); @@ -3427,7 +3428,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c for (i = 0; i < device->adapter->gl_info.limits.buffers; ++i) { if ((rtv = device->state.fb.render_targets[i]) && rtv->resource == resource) -@@ -4962,6 +5650,17 @@ +@@ -4948,6 +5636,17 @@ } if ((rtv = device->state.fb.depth_stencil) && rtv->resource == resource) @@ -3445,7 +3446,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c ERR("Resource %p is still in use as depth/stencil buffer.\n", resource); switch (type) -@@ -5097,12 +5796,17 @@ +@@ -5083,12 +5782,17 @@ device->blitter = adapter->blitter; @@ -3463,7 +3464,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))) -@@ -5196,6 +5900,7 @@ +@@ -5182,6 +5886,7 @@ else return CallWindowProcA(proc, window, message, wparam, lparam); } @@ -3471,7 +3472,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c /* Context activation is done by the caller */ struct wined3d_gl_bo *wined3d_device_get_bo(struct wined3d_device *device, UINT size, GLenum gl_usage, -@@ -5249,3 +5954,4 @@ +@@ -5235,3 +5940,4 @@ wined3d_device_destroy_bo(device, context, bo); } @@ -3550,7 +3551,7 @@ diff --git a/dlls/wined3d/drawprim.c b/dlls/wined3d/drawprim.c diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c --- a/dlls/wined3d/glsl_shader.c +++ b/dlls/wined3d/glsl_shader.c -@@ -1449,7 +1449,11 @@ +@@ -1448,7 +1448,11 @@ const struct wined3d_vec4 correction_params = { /* Position is relative to the framebuffer, not the viewport. */ @@ -3562,7 +3563,7 @@ diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c context->render_offscreen ? 1.0f : -1.0f, 0.0f, 0.0f, -@@ -1555,11 +1559,13 @@ +@@ -1554,11 +1558,13 @@ { update_heap_entry(heap, i, priv->next_constant_version); } @@ -3576,7 +3577,7 @@ diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c } static void shader_glsl_update_float_pixel_constants(struct wined3d_device *device, UINT start, UINT count) -@@ -1572,11 +1578,13 @@ +@@ -1571,11 +1577,13 @@ { update_heap_entry(heap, i, priv->next_constant_version); } @@ -4345,7 +4346,7 @@ diff --git a/dlls/wined3d/sampler.c b/dlls/wined3d/sampler.c diff --git a/dlls/wined3d/shader.c b/dlls/wined3d/shader.c --- a/dlls/wined3d/shader.c +++ b/dlls/wined3d/shader.c -@@ -2323,7 +2323,11 @@ +@@ -2322,7 +2322,11 @@ string_buffer_free(&buffer); } @@ -4357,7 +4358,7 @@ diff --git a/dlls/wined3d/shader.c b/dlls/wined3d/shader.c { HeapFree(GetProcessHeap(), 0, shader->output_signature.elements); HeapFree(GetProcessHeap(), 0, shader->input_signature.elements); -@@ -2592,10 +2596,16 @@ +@@ -2590,10 +2594,16 @@ if (!refcount) { @@ -4374,7 +4375,7 @@ diff --git a/dlls/wined3d/shader.c b/dlls/wined3d/shader.c } return refcount; -@@ -2921,7 +2931,11 @@ +@@ -2914,7 +2924,11 @@ UINT i; memset(args, 0, sizeof(*args)); /* FIXME: Make sure all bits are set. */ @@ -5969,7 +5970,7 @@ diff --git a/dlls/wined3d/swapchain.c b/dlls/wined3d/swapchain.c } if (swapchain->desc.backbuffer_count > 0) -@@ -1325,7 +1456,9 @@ +@@ -1324,7 +1455,9 @@ enum wined3d_multisample_type multisample_type, unsigned int multisample_quality) { BOOL update_desc = FALSE; @@ -5979,7 +5980,7 @@ diff --git a/dlls/wined3d/swapchain.c b/dlls/wined3d/swapchain.c TRACE("swapchain %p, buffer_count %u, width %u, height %u, format %s, " "multisample_type %#x, multisample_quality %#x.\n", -@@ -1337,9 +1470,11 @@ +@@ -1336,9 +1469,11 @@ if (buffer_count && buffer_count != swapchain->desc.backbuffer_count) FIXME("Cannot change the back buffer count yet.\n"); @@ -6647,9 +6648,9 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c return hr; } -@@ -2085,7 +2366,11 @@ - - if (!(surfaces = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*surfaces) * level_count * layer_count))) +@@ -2086,7 +2367,11 @@ + if (level_count > ~(SIZE_T)0 / layer_count + || !(surfaces = wined3d_calloc(level_count * layer_count, sizeof(*surfaces)))) { +#if defined(STAGING_CSMT) wined3d_texture_cleanup_main(texture); @@ -6659,7 +6660,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c return E_OUTOFMEMORY; } -@@ -2128,7 +2413,11 @@ +@@ -2129,7 +2414,11 @@ texture, idx, &sub_resource->parent, &sub_resource->parent_ops))) { WARN("Failed to create surface parent, hr %#x.\n", hr); @@ -6671,7 +6672,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c return hr; } -@@ -2136,6 +2425,7 @@ +@@ -2137,6 +2426,7 @@ TRACE("Created surface level %u, layer %u @ %p.\n", i, j, surface); @@ -6679,7 +6680,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c if ((desc->usage & WINED3DUSAGE_OWNDC) || (device->wined3d->flags & WINED3D_NO3D)) { HDC dc; -@@ -2145,6 +2435,13 @@ +@@ -2146,6 +2436,13 @@ return hr; } wined3d_texture_release_dc(texture, idx, dc); @@ -6693,7 +6694,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c } } } -@@ -2152,7 +2449,9 @@ +@@ -2153,7 +2450,9 @@ return WINED3D_OK; } @@ -6703,7 +6704,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c static void texture3d_upload_data(struct wined3d_texture *texture, unsigned int sub_resource_idx, const struct wined3d_context *context, const struct wined3d_sub_resource_data *data) { -@@ -2200,6 +2499,23 @@ +@@ -2201,6 +2500,23 @@ static void texture3d_cleanup_sub_resources(struct wined3d_texture *texture) { @@ -6727,7 +6728,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c HeapFree(GetProcessHeap(), 0, texture->sub_resources[0].u.volume); } -@@ -2253,7 +2569,9 @@ +@@ -2254,7 +2570,9 @@ if (layer_count != 1) { ERR("Invalid layer count for volume texture.\n"); @@ -6737,7 +6738,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c return E_INVALIDARG; } -@@ -2262,6 +2580,7 @@ +@@ -2263,6 +2581,7 @@ if (WINED3DFMT_UNKNOWN >= desc->format) { WARN("(%p) : Texture cannot be created with a format of WINED3DFMT_UNKNOWN.\n", texture); @@ -6745,7 +6746,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c HeapFree(GetProcessHeap(), 0, texture); return WINED3DERR_INVALIDCALL; } -@@ -2270,6 +2589,14 @@ +@@ -2271,6 +2590,14 @@ { WARN("(%p) : Texture cannot be created - no volume texture support.\n", texture); HeapFree(GetProcessHeap(), 0, texture); @@ -6760,7 +6761,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c return WINED3DERR_INVALIDCALL; } -@@ -2279,6 +2606,7 @@ +@@ -2280,6 +2607,7 @@ if (!gl_info->supported[SGIS_GENERATE_MIPMAP]) { WARN("No mipmap generation support, returning D3DERR_INVALIDCALL.\n"); @@ -6768,7 +6769,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c HeapFree(GetProcessHeap(), 0, texture); return WINED3DERR_INVALIDCALL; } -@@ -2287,6 +2615,14 @@ +@@ -2288,6 +2616,14 @@ { WARN("WINED3DUSAGE_AUTOGENMIPMAP is set, and level count != 1, returning D3DERR_INVALIDCALL.\n"); HeapFree(GetProcessHeap(), 0, texture); @@ -6783,7 +6784,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c return WINED3DERR_INVALIDCALL; } } -@@ -2295,7 +2631,9 @@ +@@ -2296,7 +2632,9 @@ || desc->pool == WINED3D_POOL_SCRATCH)) { WARN("Attempted to create a DYNAMIC texture in pool %s.\n", debug_d3dpool(desc->pool)); @@ -6793,7 +6794,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c return WINED3DERR_INVALIDCALL; } -@@ -2322,7 +2660,9 @@ +@@ -2323,7 +2661,9 @@ { WARN("Attempted to create a NPOT volume texture (%u, %u, %u) without GL support.\n", desc->width, desc->height, desc->depth); @@ -6803,7 +6804,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c return WINED3DERR_INVALIDCALL; } } -@@ -2332,7 +2672,9 @@ +@@ -2333,7 +2673,9 @@ 0, device, parent, parent_ops, &texture_resource_ops))) { WARN("Failed to initialize texture, returning %#x.\n", hr); @@ -6813,7 +6814,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c return hr; } -@@ -2345,6 +2687,7 @@ +@@ -2346,6 +2688,7 @@ if (wined3d_texture_use_pbo(texture, gl_info)) { wined3d_resource_free_sysmem(&texture->resource); @@ -6821,22 +6822,22 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c texture->resource.map_heap_memory = NULL; texture->resource.map_binding = WINED3D_LOCATION_BUFFER; } -@@ -2352,6 +2695,14 @@ - if (!(volumes = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*volumes) * level_count))) +@@ -2353,6 +2696,14 @@ + if (!(volumes = wined3d_calloc(level_count, sizeof(*volumes)))) { wined3d_texture_cleanup_main(texture); +#else /* STAGING_CSMT */ + texture->resource.map_binding = WINED3D_LOCATION_BUFFER; + } + -+ if (!(volumes = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*volumes) * level_count))) ++ if (!(volumes = wined3d_calloc(level_count, sizeof(*volumes)))) + { + wined3d_texture_cleanup(texture); +#endif /* STAGING_CSMT */ return E_OUTOFMEMORY; } -@@ -2373,7 +2724,11 @@ +@@ -2374,7 +2725,11 @@ texture, i, &sub_resource->parent, &sub_resource->parent_ops))) { WARN("Failed to create volume parent, hr %#x.\n", hr); @@ -6848,7 +6849,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c return hr; } -@@ -2670,6 +3025,9 @@ +@@ -2671,6 +3026,9 @@ if (FAILED(hr)) { WARN("Failed to initialize texture, returning %#x.\n", hr); @@ -6858,7 +6859,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c return hr; } -@@ -2677,7 +3035,12 @@ +@@ -2678,7 +3036,12 @@ * in this case. */ if (data && FAILED(hr = wined3d_texture_upload_data(object, data))) { @@ -6871,7 +6872,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c return hr; } -@@ -2687,6 +3050,7 @@ +@@ -2688,6 +3051,7 @@ return WINED3D_OK; } @@ -6879,7 +6880,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c void wined3d_texture_get_dc_cs(struct wined3d_texture *texture, unsigned int sub_resource_idx) { struct wined3d_device *device = texture->resource.device; -@@ -2720,6 +3084,15 @@ +@@ -2721,6 +3085,15 @@ struct wined3d_device *device = texture->resource.device; struct wined3d_texture_sub_resource *sub_resource; struct wined3d_surface *surface; @@ -6895,7 +6896,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c TRACE("texture %p, sub_resource_idx %u, dc %p.\n", texture, sub_resource_idx, dc); -@@ -2737,6 +3110,7 @@ +@@ -2738,6 +3111,7 @@ if (texture->resource.map_count && !(texture->flags & WINED3D_TEXTURE_GET_DC_LENIENT)) return WINED3DERR_INVALIDCALL; @@ -6903,7 +6904,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c wined3d_cs_emit_get_dc(device->cs, texture, sub_resource_idx); if (FAILED(texture->dc_hr)) return texture->dc_hr; -@@ -2761,6 +3135,30 @@ +@@ -2762,6 +3136,30 @@ wined3d_texture_update_map_binding(texture); if (!(texture->flags & WINED3D_TEXTURE_GET_DC_LENIENT)) texture->flags &= ~WINED3D_TEXTURE_DC_IN_USE; @@ -6934,7 +6935,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c } HRESULT CDECL wined3d_texture_release_dc(struct wined3d_texture *texture, unsigned int sub_resource_idx, HDC dc) -@@ -2791,6 +3189,7 @@ +@@ -2792,6 +3190,7 @@ return WINED3DERR_INVALIDCALL; } @@ -6942,7 +6943,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c wined3d_cs_emit_release_dc(device->cs, texture, sub_resource_idx); return WINED3D_OK; -@@ -2924,4 +3323,16 @@ +@@ -2925,4 +3324,16 @@ } } return ret; @@ -6962,7 +6963,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c diff --git a/dlls/wined3d/utils.c b/dlls/wined3d/utils.c --- a/dlls/wined3d/utils.c +++ b/dlls/wined3d/utils.c -@@ -4314,7 +4314,11 @@ +@@ -4313,7 +4313,11 @@ float y_offset = context->render_offscreen ? (center_offset - (2.0f * y) - h) / h : (center_offset - (2.0f * y) - h) / -h; @@ -6974,7 +6975,7 @@ diff --git a/dlls/wined3d/utils.c b/dlls/wined3d/utils.c 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; -@@ -5111,7 +5115,11 @@ +@@ -5110,7 +5114,11 @@ break; } }