1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2025-01-18 20:52:10 +01:00

[d3d11] Check return value of Map in UpdateSubresource1

And fall back to a GPU-side copy if necessary.
This commit is contained in:
Philip Rebohle 2020-04-18 17:04:16 +02:00
parent 487ecd861c
commit 8c68236f70
No known key found for this signature in database
GPG Key ID: C8CC613427A31C99

View File

@ -1173,10 +1173,13 @@ namespace dxvk {
: D3D11_MAP_WRITE_DISCARD;
D3D11_MAPPED_SUBRESOURCE mappedSr;
Map(pDstResource, 0, mapType, 0, &mappedSr);
std::memcpy(reinterpret_cast<char*>(mappedSr.pData) + offset, pSrcData, size);
Unmap(pDstResource, 0);
} else {
if (likely(useMap = SUCCEEDED(Map(pDstResource, 0, mapType, 0, &mappedSr)))) {
std::memcpy(reinterpret_cast<char*>(mappedSr.pData) + offset, pSrcData, size);
Unmap(pDstResource, 0);
}
}
if (!useMap) {
DxvkDataSlice dataSlice = AllocUpdateBufferSlice(size);
std::memcpy(dataSlice.ptr(), pSrcData, size);