From: Nikolay Sivov nsivov@codeweavers.com
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/d3d11/device.c | 15 +++++++++------ dlls/d3d11/tests/d3d11.c | 18 ++++++++++++++++++ 2 files changed, 27 insertions(+), 6 deletions(-)
diff --git a/dlls/d3d11/device.c b/dlls/d3d11/device.c index 3f08ae5f4f0..e93cdf74518 100644 --- a/dlls/d3d11/device.c +++ b/dlls/d3d11/device.c @@ -799,18 +799,21 @@ static HRESULT STDMETHODCALLTYPE d3d11_device_context_Map(ID3D11DeviceContext1 * if (map_flags) FIXME("Ignoring map_flags %#x.\n", map_flags);
+ mapped_subresource->pData = NULL; + if (context->type != D3D11_DEVICE_CONTEXT_IMMEDIATE && map_type != D3D11_MAP_WRITE_DISCARD && map_type != D3D11_MAP_WRITE_NO_OVERWRITE) return E_INVALIDARG;
wined3d_resource = wined3d_resource_from_d3d11_resource(resource);
- hr = wined3d_device_context_map(context->wined3d_context, wined3d_resource, subresource_idx, - &map_desc, NULL, wined3d_map_flags_from_d3d11_map_type(map_type)); - - mapped_subresource->pData = map_desc.data; - mapped_subresource->RowPitch = map_desc.row_pitch; - mapped_subresource->DepthPitch = map_desc.slice_pitch; + if (SUCCEEDED(hr = wined3d_device_context_map(context->wined3d_context, wined3d_resource, subresource_idx, + &map_desc, NULL, wined3d_map_flags_from_d3d11_map_type(map_type)))) + { + mapped_subresource->pData = map_desc.data; + mapped_subresource->RowPitch = map_desc.row_pitch; + mapped_subresource->DepthPitch = map_desc.slice_pitch; + }
return hr; } diff --git a/dlls/d3d11/tests/d3d11.c b/dlls/d3d11/tests/d3d11.c index 9a1bd88dc8b..a43e2bb0cc5 100644 --- a/dlls/d3d11/tests/d3d11.c +++ b/dlls/d3d11/tests/d3d11.c @@ -14934,8 +14934,14 @@ static void test_resource_map(void) hr = ID3D11Device_CreateBuffer(device, &buffer_desc, NULL, &buffer); ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
+ mapped_subresource.pData = (void *)0xdeadbeef; + mapped_subresource.RowPitch = 0xabab; + mapped_subresource.DepthPitch = 0xcdcd; hr = ID3D11DeviceContext_Map(context, (ID3D11Resource *)buffer, 1, D3D11_MAP_READ, 0, &mapped_subresource); ok(hr == E_INVALIDARG, "Got unexpected hr %#lx.\n", hr); + ok(!mapped_subresource.pData, "Unexpected pointer %p.\n", mapped_subresource.pData); + ok(mapped_subresource.RowPitch == 0xabab, "Unexpected row pitch value %u.\n", mapped_subresource.RowPitch); + ok(mapped_subresource.DepthPitch == 0xcdcd, "Unexpected depth pitch value %u.\n", mapped_subresource.DepthPitch);
memset(&mapped_subresource, 0, sizeof(mapped_subresource)); hr = ID3D11DeviceContext_Map(context, (ID3D11Resource *)buffer, 0, D3D11_MAP_WRITE, 0, &mapped_subresource); @@ -14972,8 +14978,14 @@ static void test_resource_map(void) hr = ID3D11Device_CreateTexture2D(device, &texture2d_desc, NULL, &texture2d); ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
+ mapped_subresource.pData = (void *)0xdeadbeef; + mapped_subresource.RowPitch = 0xabab; + mapped_subresource.DepthPitch = 0xcdcd; hr = ID3D11DeviceContext_Map(context, (ID3D11Resource *)texture2d, 1, D3D11_MAP_READ, 0, &mapped_subresource); ok(hr == E_INVALIDARG, "Got unexpected hr %#lx.\n", hr); + ok(!mapped_subresource.pData, "Unexpected pointer %p.\n", mapped_subresource.pData); + ok(mapped_subresource.RowPitch == 0xabab, "Unexpected row pitch value %u.\n", mapped_subresource.RowPitch); + ok(mapped_subresource.DepthPitch == 0xcdcd, "Unexpected depth pitch value %u.\n", mapped_subresource.DepthPitch);
memset(&mapped_subresource, 0, sizeof(mapped_subresource)); hr = ID3D11DeviceContext_Map(context, (ID3D11Resource *)texture2d, 0, D3D11_MAP_WRITE, 0, &mapped_subresource); @@ -33285,8 +33297,14 @@ static void test_deferred_context_map(void) hr = ID3D11Device_CreateBuffer(device, &buffer_desc, &resource_data, &buffer2); ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
+ map_desc.pData = (void *)0xdeadbeef; + map_desc.RowPitch = 0xabab; + map_desc.DepthPitch = 0xcdcd; hr = ID3D11DeviceContext_Map(deferred, (ID3D11Resource *)buffer, 0, D3D11_MAP_READ, 0, &map_desc); ok(hr == E_INVALIDARG, "Got unexpected hr %#lx.\n", hr); + ok(!map_desc.pData, "Unexpected pointer %p.\n", map_desc.pData); + ok(map_desc.RowPitch == 0xabab, "Unexpected row pitch value %u.\n", map_desc.RowPitch); + ok(map_desc.DepthPitch == 0xcdcd, "Unexpected depth pitch value %u.\n", map_desc.DepthPitch);
hr = ID3D11DeviceContext_Map(deferred, (ID3D11Resource *)buffer, 0, D3D11_MAP_READ_WRITE, 0, &map_desc); ok(hr == E_INVALIDARG, "Got unexpected hr %#lx.\n", hr);
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=116052
Your paranoid android.
=== build (build log) ===
WineRunBuild.pl:error: The build timed out