[PATCH 0/1] MR10983: wined3d: Handle data aliasing when blitting to itself with FX transforms.
From: Paul Gofman <pgofman@codeweavers.com> --- dlls/wined3d/surface.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c index cf081a17c68..7a7fd625386 100644 --- a/dlls/wined3d/surface.c +++ b/dlls/wined3d/surface.c @@ -964,6 +964,22 @@ do { \ dBottomLeft = dTopLeft + ((dst_height - 1) * dst_map.row_pitch); dBottomRight = dBottomLeft + ((dst_width - 1) * bpp); + if (same_sub_resource && + !(dst_box->top < src_box->top || dst_box->right <= src_box->left || src_box->right <= dst_box->left) + && fx->fx & (WINEDDBLTFX_MIRRORLEFTRIGHT | WINEDDBLTFX_MIRRORUPDOWN | WINEDDBLTFX_ROTATE180 + | WINEDDBLTFX_ROTATE270 | WINEDDBLTFX_ROTATE90)) + { + if ((tmp_buffer = malloc(src_height * src_map.row_pitch))) + { + memcpy(tmp_buffer, sbase, src_height * src_map.row_pitch); + sbase = tmp_buffer; + } + } + else + { + tmp_buffer = NULL; + } + if (fx->fx & WINEDDBLTFX_ARITHSTRETCHY) { /* I don't think we need to do anything about this flag. */ @@ -1105,6 +1121,7 @@ do { \ goto error; #undef COPY_COLORKEY_FX } + free(tmp_buffer); } error: -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/10983
That helps War Hammer: Dark Omen (classic) with some garbled images (which it blits to the same surface with DDBLTFX_MIRRORUPDOWN flag). However, to get that far with this game more complicated changes to ddraw are need (which I am trying to finalize). -- https://gitlab.winehq.org/wine/wine/-/merge_requests/10983#note_141104
```diff @@ -964,6 +964,22 @@ do { \ dBottomLeft = dTopLeft + ((dst_height - 1) * dst_map.row_pitch); dBottomRight = dBottomLeft + ((dst_width - 1) * bpp);
+ if (same_sub_resource && + !(dst_box->top < src_box->top || dst_box->right <= src_box->left || src_box->right <= dst_box->left) + && fx->fx & (WINEDDBLTFX_MIRRORLEFTRIGHT | WINEDDBLTFX_MIRRORUPDOWN | WINEDDBLTFX_ROTATE180 + | WINEDDBLTFX_ROTATE270 | WINEDDBLTFX_ROTATE90)) + { + if ((tmp_buffer = malloc(src_height * src_map.row_pitch))) + { + memcpy(tmp_buffer, sbase, src_height * src_map.row_pitch); + sbase = tmp_buffer; + } + } + else + { + tmp_buffer = NULL; + } + if (fx->fx & WINEDDBLTFX_ARITHSTRETCHY) { /* I don't think we need to do anything about this flag. */ @@ -1105,6 +1121,7 @@ do { \ goto error; #undef COPY_COLORKEY_FX } + free(tmp_buffer); }
error: ```
Does this leak "tmp_buffer" when the "goto error;" path is taken above? -- https://gitlab.winehq.org/wine/wine/-/merge_requests/10983#note_141119
participants (3)
-
Henri Verbeet (@hverbeet) -
Paul Gofman -
Paul Gofman (@gofman)