From ad1d6cdd506580ef89a3add53db18ca2b9c69196 Mon Sep 17 00:00:00 2001 From: routersys Date: Mon, 21 Sep 2026 10:33:33 +0900 Subject: [PATCH] =?UTF-8?q?GPU=E3=83=87=E3=83=90=E3=82=A4=E3=82=B9?= =?UTF-8?q?=E3=83=AD=E3=82=B9=E3=83=88=E3=82=92=E5=9B=BA=E6=9C=89=E3=81=AE?= =?UTF-8?q?=E5=A4=B1=E6=95=97=E3=81=A8=E3=81=97=E3=81=A6=E6=89=B1=E3=81=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ProxyForge/Encoding/ProxyEncodeException.cs | 1 + ProxyForge/Encoding/ProxyEncoder.cs | 8 ++++++++ ProxyForge/Texts.csv | 1 + ProxyForge/ViewModels/GenerationItemViewModel.cs | 1 + 4 files changed, 11 insertions(+) diff --git a/ProxyForge/Encoding/ProxyEncodeException.cs b/ProxyForge/Encoding/ProxyEncodeException.cs index 868c0ac..041b502 100644 --- a/ProxyForge/Encoding/ProxyEncodeException.cs +++ b/ProxyForge/Encoding/ProxyEncodeException.cs @@ -10,6 +10,7 @@ public enum ProxyEncodeFailure FFmpegFailed, NoOutput, SourceChanged, + GraphicsDeviceLost, } internal sealed class ProxyEncodeException(ProxyEncodeFailure failure, string message) : Exception(message) diff --git a/ProxyForge/Encoding/ProxyEncoder.cs b/ProxyForge/Encoding/ProxyEncoder.cs index fa86703..25f3716 100644 --- a/ProxyForge/Encoding/ProxyEncoder.cs +++ b/ProxyForge/Encoding/ProxyEncoder.cs @@ -3,6 +3,7 @@ using System.Diagnostics; using System.Globalization; using System.IO; using ProxyForge.Sources; +using Vortice.DXGI; using YukkuriMovieMaker.Commons; using YukkuriMovieMaker.Plugin.FileSource; @@ -95,6 +96,10 @@ internal sealed class ProxyEncoder(FFmpegExecutables executables, VideoSourceFac renderer = null; return session; } + catch (SharpGen.Runtime.SharpGenException exception) when (IsDeviceLost(exception.ResultCode)) + { + throw new ProxyEncodeException(ProxyEncodeFailure.GraphicsDeviceLost, "The GPU device was removed, hung, or reset."); + } finally { renderer?.Dispose(); @@ -104,6 +109,9 @@ internal sealed class ProxyEncoder(FFmpegExecutables executables, VideoSourceFac } } + static bool IsDeviceLost(SharpGen.Runtime.Result result) + => result == ResultCode.DeviceRemoved || result == ResultCode.DeviceHung || result == ResultCode.DeviceReset; + static void TryDelete(string path) { try diff --git a/ProxyForge/Texts.csv b/ProxyForge/Texts.csv index c706a58..53239c8 100644 --- a/ProxyForge/Texts.csv +++ b/ProxyForge/Texts.csv @@ -49,3 +49,4 @@ FailureTransparent,,透明を含むため対象外です,Excluded because it con FailureFFmpegFailed,,ffmpeg が失敗しました,ffmpeg failed,ffmpeg 失败,ffmpeg 失敗,ffmpeg가 실패했습니다,ffmpeg falló,فشل ffmpeg,ffmpeg gagal FailureNoOutput,,出力が作られませんでした,No output was produced,未生成输出,未產生輸出,출력이 만들어지지 않았습니다,No se produjo ninguna salida,لم يتم إنتاج أي مخرجات,Tidak ada keluaran yang dihasilkan FailureSourceChanged,,元の動画が変更されました,The source video was modified,源视频已被修改,來源影片已被修改,원본 동영상이 변경되었습니다,El vídeo de origen fue modificado,تم تعديل الفيديو المصدر,Video sumber telah diubah +FailureGraphicsDeviceLost,,GPU デバイスが失われました,The GPU device was lost,GPU 设备已丢失,GPU 裝置已遺失,GPU 디바이스가 제거되었습니다,Se perdió el dispositivo de la GPU,تم فقدان جهاز الرسومات,Perangkat GPU telah hilang diff --git a/ProxyForge/ViewModels/GenerationItemViewModel.cs b/ProxyForge/ViewModels/GenerationItemViewModel.cs index 5a88132..8de7179 100644 --- a/ProxyForge/ViewModels/GenerationItemViewModel.cs +++ b/ProxyForge/ViewModels/GenerationItemViewModel.cs @@ -44,6 +44,7 @@ internal sealed class GenerationItemViewModel : Bindable ProxyEncodeFailure.FFmpegFailed => Texts.FailureFFmpegFailed, ProxyEncodeFailure.NoOutput => Texts.FailureNoOutput, ProxyEncodeFailure.SourceChanged => Texts.FailureSourceChanged, + ProxyEncodeFailure.GraphicsDeviceLost => Texts.FailureGraphicsDeviceLost, _ => failure.ToString(), };