|
|
@ -574,6 +574,13 @@ namespace UnityEngine.Rendering.PostProcessing |
|
|
m_LegacyCmdBuffer.Clear(); |
|
|
m_LegacyCmdBuffer.Clear(); |
|
|
|
|
|
|
|
|
SetupContext(context); |
|
|
SetupContext(context); |
|
|
|
|
|
|
|
|
|
|
|
// Modify internal rendering resolution for both the camera and the pre-upscaling post-processing effects
|
|
|
|
|
|
if (context.IsSuperResolutionActive()) |
|
|
|
|
|
{ |
|
|
|
|
|
superResolution.ConfigureCameraViewport(context); |
|
|
|
|
|
context.SetRenderSize(superResolution.renderSize); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
context.command = m_LegacyCmdBufferOpaque; |
|
|
context.command = m_LegacyCmdBufferOpaque; |
|
|
TextureLerper.instance.BeginFrame(context); |
|
|
TextureLerper.instance.BeginFrame(context); |
|
|
@ -620,6 +627,7 @@ namespace UnityEngine.Rendering.PostProcessing |
|
|
bool isFogActive = fog.IsEnabledAndSupported(context); |
|
|
bool isFogActive = fog.IsEnabledAndSupported(context); |
|
|
bool hasCustomOpaqueOnlyEffects = HasOpaqueOnlyEffects(context); |
|
|
bool hasCustomOpaqueOnlyEffects = HasOpaqueOnlyEffects(context); |
|
|
int opaqueOnlyEffects = 0; |
|
|
int opaqueOnlyEffects = 0; |
|
|
|
|
|
// TODO: if FSR2 is active, add opaque-only copy step
|
|
|
opaqueOnlyEffects += isScreenSpaceReflectionsActive ? 1 : 0; |
|
|
opaqueOnlyEffects += isScreenSpaceReflectionsActive ? 1 : 0; |
|
|
opaqueOnlyEffects += isFogActive ? 1 : 0; |
|
|
opaqueOnlyEffects += isFogActive ? 1 : 0; |
|
|
opaqueOnlyEffects += hasCustomOpaqueOnlyEffects ? 1 : 0; |
|
|
opaqueOnlyEffects += hasCustomOpaqueOnlyEffects ? 1 : 0; |
|
|
@ -643,6 +651,8 @@ namespace UnityEngine.Rendering.PostProcessing |
|
|
cmd.BuiltinBlit(context.source, context.destination, RuntimeUtilities.copyStdMaterial, stopNaNPropagation ? 1 : 0); |
|
|
cmd.BuiltinBlit(context.source, context.destination, RuntimeUtilities.copyStdMaterial, stopNaNPropagation ? 1 : 0); |
|
|
UpdateSrcDstForOpaqueOnly(ref srcTarget, ref dstTarget, context, cameraTarget, opaqueOnlyEffects); |
|
|
UpdateSrcDstForOpaqueOnly(ref srcTarget, ref dstTarget, context, cameraTarget, opaqueOnlyEffects); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// TODO: create opaque-only texture copy for FSR2 auto-reactive/TCR
|
|
|
|
|
|
|
|
|
if (isScreenSpaceReflectionsActive) |
|
|
if (isScreenSpaceReflectionsActive) |
|
|
{ |
|
|
{ |
|
|
@ -720,6 +730,12 @@ namespace UnityEngine.Rendering.PostProcessing |
|
|
if (RuntimeUtilities.scriptableRenderPipelineActive) |
|
|
if (RuntimeUtilities.scriptableRenderPipelineActive) |
|
|
return; |
|
|
return; |
|
|
|
|
|
|
|
|
|
|
|
// Set the camera back to its original parameters, so we can output at full display resolution
|
|
|
|
|
|
if (m_CurrentContext.IsSuperResolutionActive()) |
|
|
|
|
|
{ |
|
|
|
|
|
superResolution.ResetCameraViewport(m_CurrentContext); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
if (m_CurrentContext.IsTemporalAntialiasingActive() || m_CurrentContext.IsSuperResolutionActive()) |
|
|
if (m_CurrentContext.IsTemporalAntialiasingActive() || m_CurrentContext.IsSuperResolutionActive()) |
|
|
{ |
|
|
{ |
|
|
#if UNITY_2018_2_OR_NEWER
|
|
|
#if UNITY_2018_2_OR_NEWER
|
|
|
@ -862,6 +878,7 @@ namespace UnityEngine.Rendering.PostProcessing |
|
|
bundle.Value.ResetHistory(); |
|
|
bundle.Value.ResetHistory(); |
|
|
|
|
|
|
|
|
temporalAntialiasing.ResetHistory(); |
|
|
temporalAntialiasing.ResetHistory(); |
|
|
|
|
|
superResolution.ResetHistory(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
/// <summary>
|
|
|
@ -1098,10 +1115,11 @@ namespace UnityEngine.Rendering.PostProcessing |
|
|
} |
|
|
} |
|
|
else if (context.IsSuperResolutionActive()) |
|
|
else if (context.IsSuperResolutionActive()) |
|
|
{ |
|
|
{ |
|
|
// TODO: perform camera projection jitter
|
|
|
|
|
|
superResolution.ConfigureJitteredProjectionMatrix(context); |
|
|
superResolution.ConfigureJitteredProjectionMatrix(context); |
|
|
|
|
|
|
|
|
// TODO: setup source and destination render textures (temp RTs)
|
|
|
|
|
|
|
|
|
// Set the upscaler's output to full display resolution, as well as for all following post-processing effects
|
|
|
|
|
|
context.SetRenderSize(superResolution.displaySize); |
|
|
|
|
|
|
|
|
var fsrTarget = m_TargetPool.Get(); |
|
|
var fsrTarget = m_TargetPool.Get(); |
|
|
var finalDestination = context.destination; |
|
|
var finalDestination = context.destination; |
|
|
context.GetScreenSpaceTemporaryRT(cmd, fsrTarget, 0, context.sourceFormat); |
|
|
context.GetScreenSpaceTemporaryRT(cmd, fsrTarget, 0, context.sourceFormat); |
|
|
@ -1114,8 +1132,6 @@ namespace UnityEngine.Rendering.PostProcessing |
|
|
cmd.ReleaseTemporaryRT(lastTarget); |
|
|
cmd.ReleaseTemporaryRT(lastTarget); |
|
|
|
|
|
|
|
|
lastTarget = fsrTarget; |
|
|
lastTarget = fsrTarget; |
|
|
|
|
|
|
|
|
// TODO: this is probably where we perform the camera viewport trick as well
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
bool hasBeforeStackEffects = HasActiveEffects(PostProcessEvent.BeforeStack, context); |
|
|
bool hasBeforeStackEffects = HasActiveEffects(PostProcessEvent.BeforeStack, context); |
|
|
|