Document Render Core And API

This commit is contained in:
copecone committed 2026-10-15 16:17:13 +09:00
1 parent 354c42fdd9
commit 8deb64fd4d
22 files changed
+1241 -27

No files matched your search

+24
View File
@@ -4,14 +4,30 @@ using UnityEngine;
namespace ADOFAIRenderer.Core;
/// <summary>
/// MonoBehaviour that runs before every other script's Update (execution order int.MinValue; scripts run from the
/// lowest order to the highest). Lives on a DontDestroyOnLoad object created by RenderMod.
/// It performs the start-up checks (FFmpeg libraries present, NVIDIA driver version) and then advances the render
/// frame counter through RenderManager.OnPreUpdate once per Unity frame, so every other script of that frame sees
/// the same render time.
/// Reference: https://docs.unity3d.com/ScriptReference/DefaultExecutionOrder.html
/// </summary>
[DefaultExecutionOrder(int.MinValue)]
internal class FirstUpdateHook : MonoBehaviour
{
/// <summary>True once the FFmpeg libraries were found in UserLibs (after the download UI, if it was needed).</summary>
private bool _checkedFFmpeg;
/// <summary>True once the NVIDIA driver version check ran (it runs once per game session).</summary>
private bool _checkedNvidiaDriver;
/// <summary>
/// Main thread, every frame. The checks are done in order and each one blocks the following steps while its dialog
/// is open: the frame counter is not advanced until both checks are done.
/// </summary>
private void Update()
{
// 1. FFmpeg libraries: while the download UI is open, wait. When the libraries are missing, open the download UI.
if (!_checkedFFmpeg)
{
if (FFmpegDownloadUI.Instance) return;
@@ -24,6 +40,7 @@ internal class FirstUpdateHook : MonoBehaviour
_checkedFFmpeg = true;
}
// 2. NVIDIA driver version: waits until no other warning dialog is open, then runs once.
if (!_checkedNvidiaDriver)
{
if (CommonWarningDialogUI.Instance) return;
@@ -32,12 +49,19 @@ internal class FirstUpdateHook : MonoBehaviour
CheckNvidiaDriverWarning();
}
// 3. Render frame counter (only counts while a render is in the OnScene stage or later).
if (RenderManager.Instance)
{
RenderManager.Instance.OnPreUpdate();
}
}
/// <summary>
/// Shows a warning dialog when the active GPU is an NVIDIA GPU with a driver version below 610.00.
/// No dialog is shown when the GPU is not NVIDIA or the version cannot be determined (GPUUtil returns null).
/// Buttons: open the NVIDIA driver download page and quit the game, disable the render feature for this session
/// (RenderMod.IsFeatureDisabled), or continue.
/// </summary>
private void CheckNvidiaDriverWarning()
{
var driverVer = Util.GPUUtil.GetNvidiaDriverVersion();