Fix GPU Buffer Map/Unmap pair to prevent stall if map fails on DX11
#942
This commit is contained in:
@@ -377,12 +377,9 @@ void GPUBuffer::SetData(const void* data, uint32 size)
|
||||
Log::ArgumentOutOfRangeException(TEXT("Buffer.SetData"));
|
||||
return;
|
||||
}
|
||||
|
||||
void* mapped = Map(GPUResourceMapMode::Write);
|
||||
if (!mapped)
|
||||
{
|
||||
return;
|
||||
}
|
||||
Platform::MemoryCopy(mapped, data, size);
|
||||
Unmap();
|
||||
}
|
||||
|
||||
@@ -190,6 +190,7 @@ public:
|
||||
/// <summary>
|
||||
/// Gets a CPU pointer to the resource by mapping its contents. Denies the GPU access to that resource.
|
||||
/// </summary>
|
||||
/// <remarks>Always call Unmap if the returned pointer is valid to release resources.</remarks>
|
||||
/// <param name="mode">The map operation mode.</param>
|
||||
/// <returns>The pointer of the mapped CPU buffer with resource data or null if failed.</returns>
|
||||
API_FUNCTION() virtual void* Map(GPUResourceMapMode mode) = 0;
|
||||
|
||||
Reference in New Issue
Block a user