Commit 962e939a authored by Paul Gofman's avatar Paul Gofman Committed by Alexandre Julliard

d3d11: Avoid crash in _CopySubresourceRegion[1]() on NULL resources.

Marvel's Avengers randomly hits this case. Signed-off-by: 's avatarPaul Gofman <pgofman@codeweavers.com> Signed-off-by: 's avatarHenri Verbeet <hverbeet@codeweavers.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent 88f47823
......@@ -965,6 +965,9 @@ static void STDMETHODCALLTYPE d3d11_immediate_context_CopySubresourceRegion(ID3D
iface, dst_resource, dst_subresource_idx, dst_x, dst_y, dst_z,
src_resource, src_subresource_idx, src_box);
if (!dst_resource || !src_resource)
return;
if (src_box)
wined3d_box_set(&wined3d_src_box, src_box->left, src_box->top,
src_box->right, src_box->bottom, src_box->front, src_box->back);
......@@ -2438,6 +2441,9 @@ static void STDMETHODCALLTYPE d3d11_immediate_context_CopySubresourceRegion1(ID3
iface, dst_resource, dst_subresource_idx, dst_x, dst_y, dst_z,
src_resource, src_subresource_idx, src_box, flags);
if (!dst_resource || !src_resource)
return;
if (src_box)
wined3d_box_set(&wined3d_src_box, src_box->left, src_box->top,
src_box->right, src_box->bottom, src_box->front, src_box->back);
......@@ -4507,6 +4513,9 @@ static void STDMETHODCALLTYPE d3d10_device_CopySubresourceRegion(ID3D10Device1 *
iface, dst_resource, dst_subresource_idx, dst_x, dst_y, dst_z,
src_resource, src_subresource_idx, src_box);
if (!dst_resource || !src_resource)
return;
if (src_box)
wined3d_box_set(&wined3d_src_box, src_box->left, src_box->top,
src_box->right, src_box->bottom, src_box->front, src_box->back);
......
......@@ -12689,6 +12689,11 @@ static void test_copy_subresource_region(void)
ID3D11DeviceContext_ClearRenderTargetView(context, test_context.backbuffer_rtv, red);
ID3D11DeviceContext_CopySubresourceRegion(context, (ID3D11Resource *)dst_texture, 0,
1, 1, 0, NULL, 0, &box);
ID3D11DeviceContext_CopySubresourceRegion(context, NULL, 0,
1, 1, 0, (ID3D11Resource *)src_texture, 0, &box);
set_box(&box, 0, 0, 0, 2, 2, 1);
ID3D11DeviceContext_CopySubresourceRegion(context, (ID3D11Resource *)dst_texture, 0,
1, 1, 0, (ID3D11Resource *)src_texture, 0, &box);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment