SHA256
Refactor Codec Map Code
This commit is contained in:
2 files changed
+8
-8
No files matched your search
+1
-1
@@ -7,7 +7,7 @@ using MelonLoader.Utils;
|
||||
using UnityEngine;
|
||||
using UnityEngine.EventSystems;
|
||||
|
||||
[assembly: MelonInfo(typeof(RenderMod), "ADOFAI Renderer", "0.1.0-BETA", "ADOFAI Editor Forum")]
|
||||
[assembly: MelonInfo(typeof(RenderMod), "ADOFAI Renderer", "0.0.4-INDEV", "ADOFAI Editor Forum")]
|
||||
[assembly: MelonGame("7th Beat Games", "A Dance of Fire and Ice")]
|
||||
|
||||
namespace ADOFAIRenderer
|
||||
|
||||
+7
-7
@@ -20,13 +20,13 @@ namespace ADOFAIRenderer.Util
|
||||
private const string IntelPattern =
|
||||
@"^Intel(?>\(R\))* (?>U*HD Graphics [0-9]+$|Arc\(TM\) [A-C][0-9]+ Graphics)";
|
||||
|
||||
private static Dictionary<Codec, List<(GPUVendor, string)>> _codecMap = new Dictionary<Codec, List<(GPUVendor, string)>>
|
||||
private static readonly Dictionary<Codec, List<(GPUVendor, string)>> CodecMap = new Dictionary<Codec, List<(GPUVendor, string)>>
|
||||
{
|
||||
{ Codec.H264, new List<(GPUVendor, string)> { (GPUVendor.NVIDIA, "h264_nvenc"), (GPUVendor.Intel, "h264_qsv"), (GPUVendor.AMD, "h264_amf"), (GPUVendor.Unknown, "libx264") } },
|
||||
{ Codec.H265, new List<(GPUVendor, string)> { (GPUVendor.NVIDIA, "hevc_nvenc"), (GPUVendor.Intel, "hevc_qsv"), (GPUVendor.AMD, "hevc_amf"), (GPUVendor.Unknown, "libx265") } },
|
||||
{ Codec.VP9, new List<(GPUVendor, string)> { (GPUVendor.NVIDIA, "vp9_nvenc"), (GPUVendor.Intel, "vp9_qsv"), (GPUVendor.Unknown, "libvpx-vp9") } },
|
||||
{ Codec.AV1, new List<(GPUVendor, string)> { (GPUVendor.NVIDIA, "av1_nvenc"), (GPUVendor.Intel, "av1_qsv"), (GPUVendor.AMD, "av1_amf"), (GPUVendor.Unknown, "libsvtav1"), (GPUVendor.Unknown, "libaom-av1") } },
|
||||
{ Codec.VVC, new List<(GPUVendor, string)> { (GPUVendor.Unknown, "libvvenc") }}
|
||||
[Codec.H264] = new List<(GPUVendor, string)> { (GPUVendor.NVIDIA, "h264_nvenc"), (GPUVendor.Intel, "h264_qsv"), (GPUVendor.AMD, "h264_amf"), (GPUVendor.Unknown, "libx264") },
|
||||
[Codec.H265] = new List<(GPUVendor, string)> { (GPUVendor.NVIDIA, "hevc_nvenc"), (GPUVendor.Intel, "hevc_qsv"), (GPUVendor.AMD, "hevc_amf"), (GPUVendor.Unknown, "libx265") },
|
||||
[Codec.VP9] = new List<(GPUVendor, string)> { (GPUVendor.NVIDIA, "vp9_nvenc"), (GPUVendor.Intel, "vp9_qsv"), (GPUVendor.Unknown, "libvpx-vp9") },
|
||||
[Codec.AV1] = new List<(GPUVendor, string)> { (GPUVendor.NVIDIA, "av1_nvenc"), (GPUVendor.Intel, "av1_qsv"), (GPUVendor.AMD, "av1_amf"), (GPUVendor.Unknown, "libsvtav1"), (GPUVendor.Unknown, "libaom-av1") },
|
||||
[Codec.VVC] = new List<(GPUVendor, string)> { (GPUVendor.Unknown, "libvvenc") }
|
||||
};
|
||||
|
||||
public static GPUVendor GetActiveGPUVendor()
|
||||
@@ -49,7 +49,7 @@ namespace ADOFAIRenderer.Util
|
||||
|
||||
public static List<string> GetPrioritizedEncoderCandidates(Codec codec)
|
||||
{
|
||||
if (!_codecMap.TryGetValue(codec, out var list)) return new List<string>();
|
||||
if (!CodecMap.TryGetValue(codec, out var list)) return new List<string>();
|
||||
|
||||
var vendor = GetActiveGPUVendor();
|
||||
var prioritized = new List<string>();
|
||||
|
||||
Reference in new issue
Block a user