=?UTF-8?Q?J=C3=B3zef=20Kucia=20?=: tests: Add more tests for mapping resources.
Alexandre Julliard
julliard at winehq.org
Tue Nov 13 13:54:59 CST 2018
Module: vkd3d
Branch: master
Commit: bebda782c8ee47de6956e06aa89faef4d0da58c2
URL: https://source.winehq.org/git/vkd3d.git/?a=commit;h=bebda782c8ee47de6956e06aa89faef4d0da58c2
Author: Józef Kucia <jkucia at codeweavers.com>
Date: Tue Nov 13 00:23:29 2018 +0100
tests: Add more tests for mapping resources.
Signed-off-by: Józef Kucia <jkucia at codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
tests/d3d12.c | 36 ++++++++++++++++++++++++++++++++++--
1 file changed, 34 insertions(+), 2 deletions(-)
diff --git a/tests/d3d12.c b/tests/d3d12.c
index 1ddf7c2..e98dbfa 100644
--- a/tests/d3d12.c
+++ b/tests/d3d12.c
@@ -5364,11 +5364,13 @@ static void test_map_resource(void)
hr = ID3D12Device_CreateCommittedResource(device, &heap_properties, D3D12_HEAP_FLAG_NONE,
&resource_desc, D3D12_RESOURCE_STATE_COMMON, NULL,
&IID_ID3D12Resource, (void **)&resource);
- ok(SUCCEEDED(hr), "Failed to create texture, hr %#x.\n", hr);
+ ok(hr == S_OK, "Failed to create texture, hr %#x.\n", hr);
/* Resources on a DEFAULT heap cannot be mapped. */
+ data = (void *)0xdeadbeef;
hr = ID3D12Resource_Map(resource, 0, NULL, &data);
ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr);
+ ok(data == (void *)0xdeadbeef, "Pointer was modified %p.\n", data);
ID3D12Resource_Release(resource);
@@ -5385,8 +5387,10 @@ static void test_map_resource(void)
else
{
/* The data pointer must be NULL for the UNKNOWN layout. */
+ data = (void *)0xdeadbeef;
hr = ID3D12Resource_Map(resource, 0, NULL, &data);
ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr);
+ ok(data == (void *)0xdeadbeef, "Pointer was modified %p.\n", data);
ID3D12Resource_Release(resource);
}
@@ -5401,11 +5405,39 @@ static void test_map_resource(void)
hr = ID3D12Device_CreateCommittedResource(device, &heap_properties, D3D12_HEAP_FLAG_NONE,
&resource_desc, D3D12_RESOURCE_STATE_COMMON, NULL,
&IID_ID3D12Resource, (void **)&resource);
- ok(SUCCEEDED(hr), "Failed to create committed resource, hr %#x.\n", hr);
+ ok(hr == S_OK, "Failed to create committed resource, hr %#x.\n", hr);
/* Resources on a DEFAULT heap cannot be mapped. */
+ data = (void *)0xdeadbeef;
+ hr = ID3D12Resource_Map(resource, 0, NULL, &data);
+ ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr);
+ ok(data == (void *)0xdeadbeef, "Pointer was modified %p.\n", data);
+
+ ID3D12Resource_Release(resource);
+
+ heap_properties.Type = D3D12_HEAP_TYPE_UPLOAD;
+ hr = ID3D12Device_CreateCommittedResource(device, &heap_properties, D3D12_HEAP_FLAG_NONE,
+ &resource_desc, D3D12_RESOURCE_STATE_GENERIC_READ, NULL,
+ &IID_ID3D12Resource, (void **)&resource);
+ ok(hr == S_OK, "Failed to create committed resource, hr %#x.\n", hr);
+
+ data = NULL;
hr = ID3D12Resource_Map(resource, 0, NULL, &data);
+ ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
+ ok(data, "Got NULL pointer.\n");
+ ID3D12Resource_Unmap(resource, 0, NULL);
+
+ data = (void *)0xdeadbeef;
+ hr = ID3D12Resource_Map(resource, 1, NULL, &data);
ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr);
+ ok(data == (void *)0xdeadbeef, "Pointer was modified %p.\n", data);
+
+ data = NULL;
+ hr = ID3D12Resource_Map(resource, 0, NULL, &data);
+ ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
+ ok(data, "Got NULL pointer.\n");
+ ID3D12Resource_Unmap(resource, 1, NULL);
+ ID3D12Resource_Unmap(resource, 0, NULL);
ID3D12Resource_Release(resource);
More information about the wine-cvs
mailing list