diff options
author | Hans-Kristian Arntzen <post@arntzen-software.no> | 2019-10-01 16:53:35 +0300 |
---|---|---|
committer | Alexandre Julliard <julliard@winehq.org> | 2019-10-01 20:16:04 +0300 |
commit | 19b673923bd75b642c4eea5eac6f37460202bc66 (patch) | |
tree | f23688c52d012ef7d98f65fd0b0c2723000bcd95 | |
parent | 0282b2643cc2ae3b7a00af96ceec052e2508296d (diff) |
vkd3d: Deal with Map out parameter being NULL.
It is possible to map a resource, but not disclose the VA to caller.
This is used for WriteToSubresource.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
-rw-r--r-- | libs/vkd3d/resource.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/libs/vkd3d/resource.c b/libs/vkd3d/resource.c index 88f184dc..f9738f36 100644 --- a/libs/vkd3d/resource.c +++ b/libs/vkd3d/resource.c @@ -423,7 +423,8 @@ static HRESULT d3d12_heap_map(struct d3d12_heap *heap, uint64_t offset, if ((rc = pthread_mutex_lock(&heap->mutex))) { ERR("Failed to lock mutex, error %d.\n", rc); - *data = NULL; + if (data) + *data = NULL; return hresult_from_errno(rc); } @@ -456,13 +457,15 @@ static HRESULT d3d12_heap_map(struct d3d12_heap *heap, uint64_t offset, if (hr == S_OK) { assert(heap->map_ptr); - *data = (BYTE *)heap->map_ptr + offset; + if (data) + *data = (BYTE *)heap->map_ptr + offset; ++resource->map_count; } else { assert(!heap->map_ptr); - *data = NULL; + if (data) + *data = NULL; } pthread_mutex_unlock(&heap->mutex); @@ -1235,7 +1238,8 @@ static HRESULT STDMETHODCALLTYPE d3d12_resource_Map(ID3D12Resource *iface, UINT if (FAILED(hr = d3d12_heap_map(resource->heap, resource->heap_offset, resource, data))) WARN("Failed to map resource %p, hr %#x.\n", resource, hr); - TRACE("Returning pointer %p.\n", *data); + if (data) + TRACE("Returning pointer %p.\n", *data); return hr; } |