1
0
mirror of https://github.com/EduApps-CDG/OpenDX synced 2024-12-30 09:45:37 +01:00

[d3d11] Handle MAP_MODE_STAGING when mapping images on the immediate context

This commit is contained in:
Philip Rebohle 2021-06-22 08:02:59 +02:00
parent 9e15831a2d
commit 596f65f75f
No known key found for this signature in database
GPG Key ID: C8CC613427A31C99

View File

@ -443,17 +443,24 @@ namespace dxvk {
mapPtr = physSlice.mapPtr; mapPtr = physSlice.mapPtr;
} else { } else {
// When using any map mode which requires the image contents bool wait = MapType != D3D11_MAP_WRITE_NO_OVERWRITE;
// to be preserved, and if the GPU has write access to the
// image, copy the current image contents into the buffer. if (mapMode == D3D11_COMMON_TEXTURE_MAP_MODE_BUFFER) {
if (pResource->Desc()->Usage == D3D11_USAGE_STAGING // When using any map mode which requires the image contents
&& !pResource->CanUpdateMappedBufferEarly()) { // to be preserved, and if the GPU has write access to the
UpdateMappedBuffer(pResource, subresource); // image, copy the current image contents into the buffer.
MapFlags &= ~D3D11_MAP_FLAG_DO_NOT_WAIT; if (pResource->Desc()->Usage == D3D11_USAGE_STAGING
&& !pResource->CanUpdateMappedBufferEarly()) {
UpdateMappedBuffer(pResource, subresource);
MapFlags &= ~D3D11_MAP_FLAG_DO_NOT_WAIT;
}
// Need to wait for any previous upload to finish anyway
wait = true;
} }
// Wait for mapped buffer to become available // Wait for mapped buffer to become available
if (!WaitForResource(mappedBuffer, MapType, MapFlags)) if (wait && !WaitForResource(mappedBuffer, MapType, MapFlags))
return DXGI_ERROR_WAS_STILL_DRAWING; return DXGI_ERROR_WAS_STILL_DRAWING;
mapPtr = pResource->GetMappedSlice(Subresource).mapPtr; mapPtr = pResource->GetMappedSlice(Subresource).mapPtr;