|
|
@ -1,7 +1,9 @@ |
|
|
using UnityEngine; |
|
|
using UnityEngine; |
|
|
using UnityEngine.Rendering; |
|
|
using UnityEngine.Rendering; |
|
|
using System; |
|
|
using System; |
|
|
|
|
|
using System.Collections; |
|
|
using System.Diagnostics; |
|
|
using System.Diagnostics; |
|
|
|
|
|
using UnityEngine.Rendering.HighDefinition.AMD; |
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
/// <summary>
|
|
|
/// Component that controls dynamic resolution scaling in HDRP (High Definition Render Pipeline) via DRH (Dynamic Resolution Handler).
|
|
|
/// Component that controls dynamic resolution scaling in HDRP (High Definition Render Pipeline) via DRH (Dynamic Resolution Handler).
|
|
|
@ -194,14 +196,32 @@ public class HDDynamicResolution : MonoBehaviour |
|
|
|
|
|
|
|
|
void OnEnable() |
|
|
void OnEnable() |
|
|
{ |
|
|
{ |
|
|
|
|
|
StartCoroutine(CSwapUpscalers()); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
void OnDisable() |
|
|
void OnDisable() |
|
|
{ |
|
|
{ |
|
|
|
|
|
StopAllCoroutines(); |
|
|
|
|
|
|
|
|
ResetScale(); |
|
|
ResetScale(); |
|
|
ResetCounters(); |
|
|
ResetCounters(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
IEnumerator CSwapUpscalers() |
|
|
|
|
|
{ |
|
|
|
|
|
var wait = new WaitForSeconds(5f); |
|
|
|
|
|
int pluginIndex = 0; |
|
|
|
|
|
|
|
|
|
|
|
while (true) |
|
|
|
|
|
{ |
|
|
|
|
|
yield return wait; |
|
|
|
|
|
|
|
|
|
|
|
var plugins = AMDUnityPlugin.GetAvailablePlugins(); |
|
|
|
|
|
pluginIndex = (pluginIndex + 1) % plugins.Count; |
|
|
|
|
|
AMDUnityPlugin.SetActivePlugin(pluginIndex); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
void Start() |
|
|
void Start() |
|
|
{ |
|
|
{ |
|
|
} |
|
|
} |
|
|
@ -267,14 +287,15 @@ public class HDDynamicResolution : MonoBehaviour |
|
|
|
|
|
|
|
|
GUILayout.Label( |
|
|
GUILayout.Label( |
|
|
string.Format( |
|
|
string.Format( |
|
|
"Resolution: {0} x {1}\nScale: {2:F3}\nCPU: {3:F3}\nGPU Ave: {4:F3} Max: {5:F3} Min: {6:F3}", |
|
|
|
|
|
|
|
|
"Resolution: {0} x {1}\nScale: {2:F3}\nCPU: {3:F3}\nGPU Ave: {4:F3} Max: {5:F3} Min: {6:F3}\nUpscaler: {7}", |
|
|
drsWidth, |
|
|
drsWidth, |
|
|
drsHeight, |
|
|
drsHeight, |
|
|
scaleX, |
|
|
scaleX, |
|
|
m_SampledCPUFrameTime, |
|
|
m_SampledCPUFrameTime, |
|
|
m_GPUFrameTime, |
|
|
m_GPUFrameTime, |
|
|
m_SampledMaxGPUFrameTime, |
|
|
m_SampledMaxGPUFrameTime, |
|
|
m_SampledMinGPUFrameTime), |
|
|
|
|
|
|
|
|
m_SampledMinGPUFrameTime, |
|
|
|
|
|
AMDUnityPlugin.ActivePlugin?.name), |
|
|
m_DebugStyle); |
|
|
m_DebugStyle); |
|
|
} |
|
|
} |
|
|
#endif
|
|
|
#endif
|
|
|
|