diff --git a/src/ComputeSharp/Graphics/Extensions/Interop/HResultExtensions.cs b/src/ComputeSharp/Graphics/Extensions/Interop/HResultExtensions.cs index 010957c9..1e4f4099 100644 --- a/src/ComputeSharp/Graphics/Extensions/Interop/HResultExtensions.cs +++ b/src/ComputeSharp/Graphics/Extensions/Interop/HResultExtensions.cs @@ -71,11 +71,15 @@ internal static class HResultExtensions if (result < 0) { + DeviceHelper.RaiseAllDeviceLostEventsIfNeeded(); + ThrowHelper.ThrowWin32Exception(result); } if (hasErrorsOrWarnings) { + DeviceHelper.RaiseAllDeviceLostEventsIfNeeded(); + ThrowHelper.ThrowWin32Exception("Warning or error detected by ID3D12InfoQueue."); } }