mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2025-04-13 05:43:18 -07:00
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>
This commit is contained in:
parent
0282b2643c
commit
19b673923b
@ -423,7 +423,8 @@ static HRESULT d3d12_heap_map(struct d3d12_heap *heap, uint64_t offset,
|
|||||||
if ((rc = pthread_mutex_lock(&heap->mutex)))
|
if ((rc = pthread_mutex_lock(&heap->mutex)))
|
||||||
{
|
{
|
||||||
ERR("Failed to lock mutex, error %d.\n", rc);
|
ERR("Failed to lock mutex, error %d.\n", rc);
|
||||||
*data = NULL;
|
if (data)
|
||||||
|
*data = NULL;
|
||||||
return hresult_from_errno(rc);
|
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)
|
if (hr == S_OK)
|
||||||
{
|
{
|
||||||
assert(heap->map_ptr);
|
assert(heap->map_ptr);
|
||||||
*data = (BYTE *)heap->map_ptr + offset;
|
if (data)
|
||||||
|
*data = (BYTE *)heap->map_ptr + offset;
|
||||||
++resource->map_count;
|
++resource->map_count;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
assert(!heap->map_ptr);
|
assert(!heap->map_ptr);
|
||||||
*data = NULL;
|
if (data)
|
||||||
|
*data = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
pthread_mutex_unlock(&heap->mutex);
|
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)))
|
if (FAILED(hr = d3d12_heap_map(resource->heap, resource->heap_offset, resource, data)))
|
||||||
WARN("Failed to map resource %p, hr %#x.\n", resource, hr);
|
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;
|
return hr;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user