Skip to content
This repository was archived by the owner on Nov 30, 2020. It is now read-only.

Commit f00c98f

Browse files
committed
Correction to logic in PostProcessLayer.OnRenderImage.
Moved logic into shared function.
1 parent 361863e commit f00c98f

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

PostProcessing/Runtime/PostProcessLayer.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -237,14 +237,18 @@ void InitLegacy()
237237
m_CurrentContext = new PostProcessRenderContext();
238238
}
239239

240+
bool DynamicResolutionAllowsFinalBlitToCameraTarget()
241+
{
242+
return (!m_Camera.allowDynamicResolution || (ScalableBufferManager.heightScaleFactor == 1.0 && ScalableBufferManager.widthScaleFactor == 1.0));
243+
}
240244

241245
#if UNITY_2019_1_OR_NEWER
242246
// We always use a CommandBuffer to blit to the final render target
243247
// OnRenderImage is used only to avoid the automatic blit from the RenderTexture of Camera.forceIntoRenderTexture to the actual target
244248
[ImageEffectUsesCommandBuffer]
245249
void OnRenderImage(RenderTexture src, RenderTexture dst)
246250
{
247-
if (finalBlitToCameraTarget && (m_Camera.allowDynamicResolution && ScalableBufferManager.heightScaleFactor == 1.0 && ScalableBufferManager.widthScaleFactor == 1.0))
251+
if (finalBlitToCameraTarget && DynamicResolutionAllowsFinalBlitToCameraTarget())
248252
RenderTexture.active = dst; // silence warning
249253
else
250254
Graphics.Blit(src, dst);
@@ -607,7 +611,7 @@ void BuildCommandBuffers()
607611
context.destination = cameraTarget;
608612

609613
#if UNITY_2019_1_OR_NEWER
610-
if (finalBlitToCameraTarget && !RuntimeUtilities.scriptableRenderPipelineActive && (!m_Camera.allowDynamicResolution || (ScalableBufferManager.heightScaleFactor == 1.0 && ScalableBufferManager.widthScaleFactor == 1.0)))
614+
if (finalBlitToCameraTarget && !RuntimeUtilities.scriptableRenderPipelineActive && DynamicResolutionAllowsFinalBlitToCameraTarget())
611615
{
612616
if (m_Camera.targetTexture)
613617
{

0 commit comments

Comments
 (0)