diff --git a/patches/patchinstall.sh b/patches/patchinstall.sh index 41df350a..fefe9d3d 100755 --- a/patches/patchinstall.sh +++ b/patches/patchinstall.sh @@ -51,7 +51,7 @@ usage() # Get the upstream commit sha upstream_commit() { - echo "a0c651cd7cf83c9fac6b8776de2d54a731fc4b29" + echo "0dcf255b51ef096d649a5b4daee7204409550376" } # Show version information diff --git a/patches/wined3d-CSMT_Main/0078-wined3d-Use-double-buffered-buffers-for-multithreade.patch b/patches/wined3d-CSMT_Main/0078-wined3d-Use-double-buffered-buffers-for-multithreade.patch index 934906e3..fbc331b3 100644 --- a/patches/wined3d-CSMT_Main/0078-wined3d-Use-double-buffered-buffers-for-multithreade.patch +++ b/patches/wined3d-CSMT_Main/0078-wined3d-Use-double-buffered-buffers-for-multithreade.patch @@ -1,54 +1,26 @@ -From 2290a66b052bb1a5b0e1af7befaeb8637adcfb8d Mon Sep 17 00:00:00 2001 +From d868b0b30b06dd1cc8133da99b8f6f60c57014b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20D=C3=B6singer?= Date: Thu, 4 Jul 2013 23:44:11 +0200 Subject: wined3d: Use double-buffered buffers for multithreaded CS --- - dlls/wined3d/buffer.c | 24 ++++++++++++++---------- - 1 file changed, 14 insertions(+), 10 deletions(-) + dlls/wined3d/buffer.c | 3 +++ + 1 file changed, 3 insertions(+) diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c -index f887ee6..6967697 100644 +index e8d1027..ce567be 100644 --- a/dlls/wined3d/buffer.c +++ b/dlls/wined3d/buffer.c -@@ -1360,16 +1360,8 @@ static HRESULT buffer_init(struct wined3d_buffer *buffer, struct wined3d_device +@@ -1353,6 +1353,9 @@ static HRESULT buffer_init(struct wined3d_buffer *buffer, struct wined3d_device buffer->flags |= WINED3D_BUFFER_CREATEBO; } -- if (data) -- { -- if (FAILED(hr = wined3d_buffer_upload_data(buffer, NULL, data->data))) -- { -- ERR("Failed to upload data, hr %#x.\n", hr); -- buffer_unload(&buffer->resource); -- resource_cleanup(&buffer->resource); -- return hr; -- } -- } + if (wined3d_settings.cs_multithreaded) + buffer->flags |= WINED3D_BUFFER_DOUBLEBUFFER; - - buffer->maps = HeapAlloc(GetProcessHeap(), 0, sizeof(*buffer->maps)); - if (!buffer->maps) -@@ -1381,6 +1373,18 @@ static HRESULT buffer_init(struct wined3d_buffer *buffer, struct wined3d_device - } - buffer->maps_size = 1; - -+ if (data) -+ { -+ if (FAILED(hr = wined3d_buffer_upload_data(buffer, NULL, data->data))) -+ { -+ ERR("Failed to upload data, hr %#x.\n", hr); -+ HeapFree(GetProcessHeap(), 0, buffer->maps); -+ buffer_unload(&buffer->resource); -+ resource_cleanup(&buffer->resource); -+ return hr; -+ } -+ } + - return WINED3D_OK; - } - + if (!(buffer->maps = HeapAlloc(GetProcessHeap(), 0, sizeof(*buffer->maps)))) + { + ERR("Out of memory.\n"); -- 2.8.0 diff --git a/patches/wined3d-CSMT_Main/0094-wined3d-Clean-up-resource-data-through-the-CS.patch b/patches/wined3d-CSMT_Main/0094-wined3d-Clean-up-resource-data-through-the-CS.patch index cdd96ce2..6ead0b43 100644 --- a/patches/wined3d-CSMT_Main/0094-wined3d-Clean-up-resource-data-through-the-CS.patch +++ b/patches/wined3d-CSMT_Main/0094-wined3d-Clean-up-resource-data-through-the-CS.patch @@ -1,4 +1,4 @@ -From 05080047f8c6b58cf0d53e4839c813ddf7e7cbf8 Mon Sep 17 00:00:00 2001 +From 790ed84dedaba0c7dbbb31c28d6d304cf92c312b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20D=C3=B6singer?= Date: Wed, 2 Oct 2013 22:38:51 +0200 Subject: wined3d: Clean up resource data through the CS. @@ -13,10 +13,10 @@ Subject: wined3d: Clean up resource data through the CS. 6 files changed, 48 insertions(+), 5 deletions(-) diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c -index 8e95d88..b06c502 100644 +index 62360c0..348a24a 100644 --- a/dlls/wined3d/buffer.c +++ b/dlls/wined3d/buffer.c -@@ -578,6 +578,9 @@ ULONG CDECL wined3d_buffer_decref(struct wined3d_buffer *buffer) +@@ -571,6 +571,9 @@ ULONG CDECL wined3d_buffer_decref(struct wined3d_buffer *buffer) } resource_cleanup(&buffer->resource); @@ -26,8 +26,8 @@ index 8e95d88..b06c502 100644 buffer->resource.parent_ops->wined3d_object_destroyed(buffer->resource.parent); HeapFree(GetProcessHeap(), 0, buffer->maps); HeapFree(GetProcessHeap(), 0, buffer); -@@ -1365,6 +1368,8 @@ static HRESULT buffer_init(struct wined3d_buffer *buffer, struct wined3d_device - ERR("Out of memory\n"); +@@ -1357,6 +1360,8 @@ static HRESULT buffer_init(struct wined3d_buffer *buffer, struct wined3d_device + ERR("Out of memory.\n"); buffer_unload(&buffer->resource); resource_cleanup(&buffer->resource); + if (wined3d_settings.cs_multithreaded) @@ -35,17 +35,17 @@ index 8e95d88..b06c502 100644 return E_OUTOFMEMORY; } buffer->maps_size = 1; -@@ -1377,6 +1382,8 @@ static HRESULT buffer_init(struct wined3d_buffer *buffer, struct wined3d_device - HeapFree(GetProcessHeap(), 0, buffer->maps); - buffer_unload(&buffer->resource); - resource_cleanup(&buffer->resource); -+ if (wined3d_settings.cs_multithreaded) -+ buffer->resource.device->cs->ops->finish(buffer->resource.device->cs); - return hr; - } +@@ -1367,6 +1372,8 @@ static HRESULT buffer_init(struct wined3d_buffer *buffer, struct wined3d_device + buffer_unload(&buffer->resource); + resource_cleanup(&buffer->resource); + HeapFree(GetProcessHeap(), 0, buffer->maps); ++ if (wined3d_settings.cs_multithreaded) ++ buffer->resource.device->cs->ops->finish(buffer->resource.device->cs); + return hr; } + diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c -index 65c5db3..f8c14ce 100644 +index badc0b1..d727e71 100644 --- a/dlls/wined3d/cs.c +++ b/dlls/wined3d/cs.c @@ -82,6 +82,7 @@ enum wined3d_cs_op @@ -56,7 +56,7 @@ index 65c5db3..f8c14ce 100644 WINED3D_CS_OP_STOP, }; -@@ -482,6 +483,12 @@ struct wined3d_cs_create_vbo +@@ -485,6 +486,12 @@ struct wined3d_cs_create_vbo struct wined3d_buffer *buffer; }; @@ -69,7 +69,7 @@ index 65c5db3..f8c14ce 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); -@@ -2448,6 +2455,26 @@ void wined3d_cs_emit_create_vbo(struct wined3d_cs *cs, struct wined3d_buffer *bu +@@ -2442,6 +2449,26 @@ void wined3d_cs_emit_create_vbo(struct wined3d_cs *cs, struct wined3d_buffer *bu cs->ops->finish_prio(cs); } @@ -96,7 +96,7 @@ index 65c5db3..f8c14ce 100644 static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void *data) = { /* WINED3D_CS_OP_NOP */ wined3d_cs_exec_nop, -@@ -2508,6 +2535,7 @@ static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void +@@ -2502,6 +2529,7 @@ static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void /* WINED3D_CS_OP_VDECL_DESTROY */ wined3d_cs_exec_vertex_declaration_destroy, /* WINED3D_CS_OP_SHADER_CLEANUP */ wined3d_cs_exec_shader_cleanup, /* WINED3D_CS_OP_CREATE_VBO */ wined3d_cs_exec_create_vbo, @@ -105,10 +105,10 @@ index 65c5db3..f8c14ce 100644 static inline void *_wined3d_cs_mt_require_space(struct wined3d_cs *cs, size_t size, BOOL prio) diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c -index 3ea4508..c22910d 100644 +index b35fa06..627eca6 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c -@@ -4957,8 +4957,6 @@ void device_resource_released(struct wined3d_device *device, struct wined3d_reso +@@ -4982,8 +4982,6 @@ void device_resource_released(struct wined3d_device *device, struct wined3d_reso TRACE("device %p, resource %p, type %s.\n", device, resource, debug_d3dresourcetype(type)); @@ -118,10 +118,10 @@ index 3ea4508..c22910d 100644 { if ((rtv = device->state.fb.render_targets[i]) && rtv->resource == resource) diff --git a/dlls/wined3d/resource.c b/dlls/wined3d/resource.c -index acbf7a6..53a8fff 100644 +index 9acc7be..3af6851 100644 --- a/dlls/wined3d/resource.c +++ b/dlls/wined3d/resource.c -@@ -234,6 +234,13 @@ HRESULT resource_init(struct wined3d_resource *resource, struct wined3d_device * +@@ -237,6 +237,13 @@ HRESULT resource_init(struct wined3d_resource *resource, struct wined3d_device * return WINED3D_OK; } @@ -135,7 +135,7 @@ index acbf7a6..53a8fff 100644 void resource_cleanup(struct wined3d_resource *resource) { const struct wined3d *d3d = resource->device->wined3d; -@@ -246,10 +253,8 @@ void resource_cleanup(struct wined3d_resource *resource) +@@ -249,10 +256,8 @@ void resource_cleanup(struct wined3d_resource *resource) adapter_adjust_memory(resource->device->adapter, (INT64)0 - resource->size); } @@ -148,10 +148,10 @@ index acbf7a6..53a8fff 100644 void resource_unload(struct wined3d_resource *resource) diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c -index bc1bb27..7953053 100644 +index eacdca1..8190279 100644 --- a/dlls/wined3d/texture.c +++ b/dlls/wined3d/texture.c -@@ -441,6 +441,8 @@ static void wined3d_texture_cleanup(struct wined3d_texture *texture) +@@ -521,6 +521,8 @@ static void wined3d_texture_cleanup(struct wined3d_texture *texture) texture->texture_ops->texture_cleanup_sub_resources(texture); wined3d_texture_unload_gl_texture(texture); resource_cleanup(&texture->resource); @@ -161,10 +161,10 @@ index bc1bb27..7953053 100644 void wined3d_texture_set_swapchain(struct wined3d_texture *texture, struct wined3d_swapchain *swapchain) diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h -index d46bb87..0f16e5f 100644 +index 0cfe28a..e0ce86e 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h -@@ -2457,6 +2457,7 @@ HRESULT resource_init(struct wined3d_resource *resource, struct wined3d_device * +@@ -2484,6 +2484,7 @@ HRESULT resource_init(struct wined3d_resource *resource, struct wined3d_device * const struct wined3d_resource_ops *resource_ops) DECLSPEC_HIDDEN; void resource_unload(struct wined3d_resource *resource) DECLSPEC_HIDDEN; BOOL wined3d_resource_allocate_sysmem(struct wined3d_resource *resource) DECLSPEC_HIDDEN; @@ -172,7 +172,7 @@ index d46bb87..0f16e5f 100644 void wined3d_resource_free_sysmem(struct wined3d_resource *resource) DECLSPEC_HIDDEN; GLbitfield wined3d_resource_gl_map_flags(DWORD d3d_flags) DECLSPEC_HIDDEN; GLenum wined3d_resource_gl_legacy_map_flags(DWORD d3d_flags) DECLSPEC_HIDDEN; -@@ -3045,6 +3046,8 @@ void wined3d_cs_emit_vertex_declaration_destroy(struct wined3d_cs *cs, +@@ -3067,6 +3068,8 @@ void wined3d_cs_emit_vertex_declaration_destroy(struct wined3d_cs *cs, struct wined3d_vertex_declaration *declaration) DECLSPEC_HIDDEN; void wined3d_cs_emit_shader_cleanup(struct wined3d_cs *cs, struct wined3d_shader *shader) DECLSPEC_HIDDEN; void wined3d_cs_emit_create_vbo(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 0c4f25c7..ccd79cda 100644 --- a/patches/wined3d-CSMT_Main/9999-IfDefined.patch +++ b/patches/wined3d-CSMT_Main/9999-IfDefined.patch @@ -144,7 +144,7 @@ diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c { if (!offset && (!size || size == buffer->resource.size)) goto invalidate_all; -@@ -128,7 +136,11 @@ +@@ -122,7 +130,11 @@ } /* Context activation is done by the caller. */ @@ -156,7 +156,7 @@ diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c { GLenum gl_usage = GL_STATIC_DRAW_ARB; GLenum error; -@@ -200,10 +212,14 @@ +@@ -194,10 +206,14 @@ if (This->flags & WINED3D_BUFFER_DOUBLEBUFFER) buffer_invalidate_bo_range(This, 0, 0); else @@ -171,7 +171,7 @@ diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c return; -@@ -466,8 +482,12 @@ +@@ -460,8 +476,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; -@@ -506,7 +526,9 @@ +@@ -500,7 +520,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)); -@@ -552,6 +574,7 @@ +@@ -546,6 +568,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; -@@ -584,6 +607,30 @@ +@@ -578,6 +601,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; -@@ -668,6 +715,7 @@ +@@ -662,6 +709,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 -@@ -691,6 +739,45 @@ +@@ -685,6 +733,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) -@@ -699,12 +786,33 @@ +@@ -693,12 +780,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); } -@@ -723,6 +831,14 @@ +@@ -717,6 +825,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) -@@ -911,6 +1027,7 @@ +@@ -905,6 +1021,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) -@@ -920,6 +1037,12 @@ +@@ -914,6 +1031,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) -@@ -933,6 +1056,7 @@ +@@ -927,6 +1050,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; -@@ -957,6 +1081,10 @@ +@@ -951,6 +1075,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 -@@ -965,7 +1093,11 @@ +@@ -959,7 +1087,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; -@@ -976,6 +1108,7 @@ +@@ -970,6 +1102,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); -@@ -993,6 +1126,19 @@ +@@ -987,6 +1120,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; -@@ -1041,6 +1187,7 @@ +@@ -1035,6 +1181,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); } -@@ -1080,6 +1227,21 @@ +@@ -1074,6 +1221,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); -@@ -1142,6 +1304,7 @@ +@@ -1136,6 +1298,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) -@@ -1150,6 +1313,18 @@ +@@ -1144,6 +1307,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 } } -@@ -1342,7 +1517,9 @@ +@@ -1336,7 +1511,9 @@ return hr; } buffer->buffer_type_hint = bind_hint; @@ -483,49 +483,40 @@ 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); -@@ -1378,8 +1555,21 @@ +@@ -1372,6 +1549,7 @@ buffer->flags |= WINED3D_BUFFER_CREATEBO; } +#if defined(STAGING_CSMT) if (wined3d_settings.cs_multithreaded) buffer->flags |= WINED3D_BUFFER_DOUBLEBUFFER; -+#else /* STAGING_CSMT */ -+ if (data) -+ { -+ if (FAILED(hr = wined3d_buffer_upload_data(buffer, NULL, data->data))) -+ { -+ ERR("Failed to upload data, hr %#x.\n", hr); -+ buffer_unload(&buffer->resource); -+ resource_cleanup(&buffer->resource); -+ return hr; -+ } -+ } -+#endif /* STAGING_CSMT */ - buffer->maps = HeapAlloc(GetProcessHeap(), 0, sizeof(*buffer->maps)); - if (!buffer->maps) -@@ -1387,6 +1577,7 @@ - ERR("Out of memory\n"); +@@ -1382,6 +1560,13 @@ + resource_cleanup(&buffer->resource); + if (wined3d_settings.cs_multithreaded) + buffer->resource.device->cs->ops->finish(buffer->resource.device->cs); ++#else /* STAGING_CSMT */ ++ if (!(buffer->maps = HeapAlloc(GetProcessHeap(), 0, sizeof(*buffer->maps)))) ++ { ++ ERR("Out of memory.\n"); ++ buffer_unload(&buffer->resource); ++ resource_cleanup(&buffer->resource); ++#endif /* STAGING_CSMT */ + return E_OUTOFMEMORY; + } + buffer->maps_size = 1; +@@ -1392,8 +1577,10 @@ buffer_unload(&buffer->resource); resource_cleanup(&buffer->resource); + HeapFree(GetProcessHeap(), 0, buffer->maps); +#if defined(STAGING_CSMT) if (wined3d_settings.cs_multithreaded) buffer->resource.device->cs->ops->finish(buffer->resource.device->cs); - return E_OUTOFMEMORY; -@@ -1406,6 +1597,11 @@ - return hr; - } - } -+#else /* STAGING_CSMT */ -+ return E_OUTOFMEMORY; -+ } -+ buffer->maps_size = 1; +#endif /* STAGING_CSMT */ + return hr; + } - return WINED3D_OK; - } -@@ -1514,6 +1710,7 @@ +@@ -1504,6 +1691,7 @@ return WINED3D_OK; } @@ -533,7 +524,7 @@ diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c void buffer_swap_mem(struct wined3d_buffer *buffer, BYTE *mem) { -@@ -1521,3 +1718,4 @@ +@@ -1511,3 +1699,4 @@ buffer->resource.heap_memory = mem; buffer->flags |= WINED3D_BUFFER_DISCARD; } @@ -6962,7 +6953,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 -@@ -4320,7 +4320,11 @@ +@@ -4324,7 +4324,11 @@ float y_offset = context->render_offscreen ? (center_offset - (2.0f * y) - h) / h : (center_offset - (2.0f * y) - h) / -h; @@ -6974,7 +6965,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; -@@ -5117,7 +5121,11 @@ +@@ -5121,7 +5125,11 @@ break; } }