Browse Source

Added definition for quality preset variants

asr-console
Nico de Poel 11 months ago
parent
commit
ac0adc168b
  1. 11
      Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/Effects/Upscaling/ASR/Runtime/Asr.cs
  2. 18
      Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/Effects/Upscaling/ASR/Runtime/AsrPass.cs

11
Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/Effects/Upscaling/ASR/Runtime/Asr.cs

@ -33,7 +33,7 @@ namespace ArmASR
/// <summary> /// <summary>
/// Creates a new ASR context with standard parameters that are appropriate for the current platform. /// Creates a new ASR context with standard parameters that are appropriate for the current platform.
/// </summary> /// </summary>
public static AsrContext CreateContext(Vector2Int displaySize, Vector2Int maxRenderSize, AsrShaders shaders, InitializationFlags flags = 0)
public static AsrContext CreateContext(Variant variant, Vector2Int displaySize, Vector2Int maxRenderSize, AsrShaders shaders, InitializationFlags flags = 0)
{ {
if (SystemInfo.usesReversedZBuffer) if (SystemInfo.usesReversedZBuffer)
flags |= InitializationFlags.EnableDepthInverted; flags |= InitializationFlags.EnableDepthInverted;
@ -49,6 +49,7 @@ namespace ArmASR
var contextDescription = new ContextDescription var contextDescription = new ContextDescription
{ {
Flags = flags, Flags = flags,
Variant = variant,
DisplaySize = displaySize, DisplaySize = displaySize,
MaxRenderSize = maxRenderSize, MaxRenderSize = maxRenderSize,
Shaders = shaders, Shaders = shaders,
@ -172,6 +173,13 @@ namespace ArmASR
UnityEngine.Object.Destroy(obj); UnityEngine.Object.Destroy(obj);
#endif #endif
} }
public enum Variant
{
Quality, // Maintains the same image quality as the original FSR2.
Balanced, // Gives a significant improvement in both bandwidth savings and performance uplift while maintaining close image quality to the 'quality' preset.
Performance, // A more aggressive preset that will give you the highest performance with some quality sacrifices.
}
public enum QualityMode public enum QualityMode
{ {
@ -203,6 +211,7 @@ namespace ArmASR
public struct ContextDescription public struct ContextDescription
{ {
public InitializationFlags Flags; public InitializationFlags Flags;
public Variant Variant;
public Vector2Int MaxRenderSize; public Vector2Int MaxRenderSize;
public Vector2Int DisplaySize; public Vector2Int DisplaySize;
public AsrShaders Shaders; public AsrShaders Shaders;

18
Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/Effects/Upscaling/ASR/Runtime/AsrPass.cs

@ -263,12 +263,18 @@ namespace ArmASR
commandBuffer.SetGlobalTexture(AsrShaderIDs.SrvAutoExposure, Resources.AutoExposure); commandBuffer.SetGlobalTexture(AsrShaderIDs.SrvAutoExposure, Resources.AutoExposure);
commandBuffer.SetGlobalTexture(AsrShaderIDs.SrvLumaHistory, Resources.LumaHistory[frameIndex ^ 1]); commandBuffer.SetGlobalTexture(AsrShaderIDs.SrvLumaHistory, Resources.LumaHistory[frameIndex ^ 1]);
// TODO: these need to vary depending on the ASR preset used (below is for Quality preset)
_mrt[0] = Resources.InternalUpscaled[frameIndex]; // TODO: ColorAndWeight
_mrt[1] = Resources.LockStatus[frameIndex];
_mrt[2] = Resources.LumaHistory[frameIndex];
_mrt[3] = dispatchParams.EnableSharpening ? BuiltinRenderTextureType.None : dispatchParams.Output.RenderTarget;
if (ContextDescription.Variant == Asr.Variant.Quality)
{
_mrt[0] = Resources.InternalUpscaled[frameIndex]; // TODO: ColorAndWeight
_mrt[1] = Resources.LockStatus[frameIndex];
_mrt[2] = Resources.LumaHistory[frameIndex];
_mrt[3] = dispatchParams.EnableSharpening ? BuiltinRenderTextureType.None : dispatchParams.Output.RenderTarget;
}
else
{
// TODO: UpscaledColor, TemporalReactive, LockStatus, Color
}
FragmentProperties.SetConstantBuffer(AsrShaderIDs.CbFsr2, Constants, 0, Constants.stride); FragmentProperties.SetConstantBuffer(AsrShaderIDs.CbFsr2, Constants, 0, Constants.stride);
BlitFragment(commandBuffer, _mrt); BlitFragment(commandBuffer, _mrt);
} }

Loading…
Cancel
Save