Browse Source

Added various controls for changing FSR2 settings at run-time

mac-autoexp
Nico de Poel 3 years ago
parent
commit
7798ae524c
  1. 50
      Assets/Scripts/Debug/DebugDumper.cs

50
Assets/Scripts/Debug/DebugDumper.cs

@ -24,10 +24,13 @@ using System.Collections.Generic;
using System.IO;
using System.Reflection;
using System.Text;
using FidelityFX;
using UnityEngine;
public class DebugDumper : MonoBehaviour
{
private Fsr2ImageEffect _fsr;
void Start()
{
var sb = new StringBuilder("SystemInfo:\n");
@ -37,6 +40,8 @@ public class DebugDumper : MonoBehaviour
}
Debug.Log(sb);
_fsr = GetComponent<Fsr2ImageEffect>();
}
void Update()
@ -47,5 +52,50 @@ public class DebugDumper : MonoBehaviour
ScreenCapture.CaptureScreenshot(path);
Debug.Log($"Screenshot saved to: {path}");
}
if (_fsr == null)
return;
if (Input.GetButtonDown("Fire1"))
{
_fsr.enabled = !_fsr.enabled;
}
if (Input.GetButtonDown("Fire2"))
{
int quality = (int)_fsr.qualityMode;
quality = (quality + 1) % Enum.GetValues(typeof(Fsr2.QualityMode)).Length;
_fsr.qualityMode = (Fsr2.QualityMode)quality;
}
if (Input.GetButtonDown("Fire3"))
{
_fsr.enableAutoExposure = !_fsr.enableAutoExposure;
}
if (Input.GetButtonDown("Jump"))
{
_fsr.ResetHistory();
}
}
private void OnGUI()
{
if (_fsr == null)
return;
float scale = Screen.height / 720f;
if (scale > Mathf.Epsilon)
{
GUI.matrix = Matrix4x4.Scale(new Vector3(scale, scale, scale));
}
GUILayout.Label($"FSR2: {(_fsr.enabled ? "Enabled" : "Disabled")}");
GUILayout.Label($"Quality: {_fsr.qualityMode}");
GUILayout.Label($"Auto-exposure: {(_fsr.enableAutoExposure ? "Enabled" : "Disabled")}");
if (Input.GetButton("Jump"))
{
GUILayout.Label("Reset");
}
}
}
Loading…
Cancel
Save