SHA256
Update Color Conversion Shader
This commit is contained in:
4 files changed
+299
-24
No files matched your search
@@ -438,19 +438,22 @@ namespace ADOFAIRenderer.Util.FFmpeg
|
||||
var qsvReady = false;
|
||||
int err;
|
||||
|
||||
// ── 전략 1: child_device_type=d3d11va 옵션 ──
|
||||
bool isWindows = System.Runtime.InteropServices.RuntimeInformation.IsOSPlatform(System.Runtime.InteropServices.OSPlatform.Windows);
|
||||
string childDeviceName = isWindows ? "d3d11va" : "vaapi";
|
||||
AVHWDeviceType childDeviceType = isWindows ? AVHWDeviceType.AV_HWDEVICE_TYPE_D3D11VA : AVHWDeviceType.AV_HWDEVICE_TYPE_VAAPI;
|
||||
|
||||
// ── 전략 1: child_device_type 옵션 ──
|
||||
// av_hwdevice_ctx_create에 "child_device_type" 딕셔너리를 전달하면
|
||||
// FFmpeg이 내부적으로 D3D11 디바이스를 생성하고 QSV 세션에 연결합니다.
|
||||
// 대부분의 최신 Intel 드라이버에서 가장 안정적으로 동작합니다.
|
||||
// FFmpeg이 내부적으로 적절한 하위 디바이스(Windows: D3D11, Linux: VAAPI)를 생성하고 QSV 세션에 연결합니다.
|
||||
{
|
||||
AVDictionary* opts = null;
|
||||
ffmpeg.av_dict_set(&opts, "child_device_type", "d3d11va", 0);
|
||||
ffmpeg.av_dict_set(&opts, "child_device_type", childDeviceName, 0);
|
||||
err = ffmpeg.av_hwdevice_ctx_create(&hwDeviceCtx, AVHWDeviceType.AV_HWDEVICE_TYPE_QSV, null, opts, 0);
|
||||
ffmpeg.av_dict_free(&opts);
|
||||
if (err >= 0)
|
||||
{
|
||||
qsvReady = true;
|
||||
Melon<RenderMod>.Logger.Msg($"{encoderName}: child_device_type=d3d11va 방식으로 QSV 디바이스 생성 성공");
|
||||
Melon<RenderMod>.Logger.Msg($"{encoderName}: child_device_type={childDeviceName} 방식으로 QSV 디바이스 생성 성공");
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -458,24 +461,22 @@ namespace ADOFAIRenderer.Util.FFmpeg
|
||||
}
|
||||
}
|
||||
|
||||
// ── 전략 2: D3D11VA → QSV 파생(derive) ──
|
||||
// D3D11VA 디바이스를 먼저 생성한 뒤,
|
||||
// ── 전략 2: 하위 디바이스 → QSV 파생(derive) ──
|
||||
// 하위 디바이스(D3D11VA / VAAPI)를 먼저 생성한 뒤,
|
||||
// av_hwdevice_ctx_create_derived로 QSV 디바이스를 파생시킵니다.
|
||||
// 두 디바이스가 동일한 GPU를 공유하게 됩니다.
|
||||
if (!qsvReady)
|
||||
{
|
||||
// ReSharper disable once InconsistentNaming
|
||||
AVBufferRef* d3d11DeviceCtx = null;
|
||||
err = ffmpeg.av_hwdevice_ctx_create(&d3d11DeviceCtx, AVHWDeviceType.AV_HWDEVICE_TYPE_D3D11VA, null, null, 0);
|
||||
AVBufferRef* childDeviceCtx = null;
|
||||
err = ffmpeg.av_hwdevice_ctx_create(&childDeviceCtx, childDeviceType, null, null, 0);
|
||||
if (err >= 0)
|
||||
{
|
||||
err = ffmpeg.av_hwdevice_ctx_create_derived(&hwDeviceCtx, AVHWDeviceType.AV_HWDEVICE_TYPE_QSV, d3d11DeviceCtx, 0);
|
||||
err = ffmpeg.av_hwdevice_ctx_create_derived(&hwDeviceCtx, AVHWDeviceType.AV_HWDEVICE_TYPE_QSV, childDeviceCtx, 0);
|
||||
if (err >= 0)
|
||||
{
|
||||
qsvReady = true;
|
||||
Melon<RenderMod>.Logger.Msg($"{encoderName}: D3D11VA → QSV 파생 방식으로 디바이스 생성 성공");
|
||||
Melon<RenderMod>.Logger.Msg($"{encoderName}: {childDeviceType} → QSV 파생 방식으로 디바이스 생성 성공");
|
||||
}
|
||||
ffmpeg.av_buffer_unref(&d3d11DeviceCtx);
|
||||
ffmpeg.av_buffer_unref(&childDeviceCtx);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user