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

Commit 84610c1

Browse files
authored
Merge pull request #821 from Unity-Technologies/use-systeminfo-usesLoadStoreActions
Use SystemInfo.usesLoadStoreActions on 2019.3+ instead of Application…
2 parents 891a586 + e6c8428 commit 84610c1

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

PostProcessing/Runtime/PostProcessLayer.cs

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ void InitLegacy()
232232
m_Camera.AddCommandBuffer(CameraEvent.BeforeLighting, m_LegacyCmdBufferBeforeLighting);
233233
m_Camera.AddCommandBuffer(CameraEvent.BeforeImageEffectsOpaque, m_LegacyCmdBufferOpaque);
234234
m_Camera.AddCommandBuffer(CameraEvent.BeforeImageEffects, m_LegacyCmdBuffer);
235-
235+
236236
// Internal context used if no SRP is set
237237
m_CurrentContext = new PostProcessRenderContext();
238238
}
@@ -397,7 +397,11 @@ void OnPreCull()
397397
// and use LoadAction.DontCare freely, which will ruin the RT if we are using viewport.
398398
// It should actually check for having tiled architecture but this is not exposed to script,
399399
// so we are checking for mobile as a good substitute
400+
#if UNITY_2019_3_OR_NEWER
401+
if(SystemInfo.usesLoadStoreActions)
402+
#else
400403
if(Application.isMobilePlatform)
404+
#endif
401405
{
402406
Rect r = m_Camera.rect;
403407
if(Mathf.Abs(r.x) > 1e-6f || Mathf.Abs(r.y) > 1e-6f || Mathf.Abs(1.0f - r.width) > 1e-6f || Mathf.Abs(1.0f - r.height) > 1e-6f)
@@ -450,7 +454,7 @@ static bool RequiresInitialBlit(Camera camera, PostProcessRenderContext context)
450454
return true;
451455
if (RuntimeUtilities.scriptableRenderPipelineActive) // Should never be called from SRP
452456
return true;
453-
457+
454458
return false;
455459
#else
456460
return true;
@@ -561,7 +565,7 @@ void BuildCommandBuffers()
561565
cmd.BuiltinBlit(context.source, context.destination, RuntimeUtilities.copyStdMaterial, stopNaNPropagation ? 1 : 0);
562566
UpdateSrcDstForOpaqueOnly(ref srcTarget, ref dstTarget, context, cameraTarget, opaqueOnlyEffects);
563567
}
564-
568+
565569
if (isScreenSpaceReflectionsActive)
566570
{
567571
ssrRenderer.Render(context);
@@ -581,7 +585,7 @@ void BuildCommandBuffers()
581585

582586
cmd.ReleaseTemporaryRT(srcTarget);
583587
}
584-
588+
585589
// Post-transparency stack
586590
int tempRt = -1;
587591
bool forceNanKillPass = (!m_NaNKilled && stopNaNPropagation && RuntimeUtilities.isFloatingPointFormat(sourceFormat));
@@ -614,7 +618,7 @@ void BuildCommandBuffers()
614618
context.flip = true;
615619
context.destination = Display.main.colorBuffer;
616620
}
617-
}
621+
}
618622
#endif
619623

620624
context.command = m_LegacyCmdBuffer;
@@ -635,9 +639,9 @@ void OnPostRender()
635639
{
636640
#if UNITY_2018_2_OR_NEWER
637641
// TAA calls SetProjectionMatrix so if the camera projection mode was physical, it gets set to explicit. So we set it back to physical.
638-
if (m_CurrentContext.physicalCamera)
642+
if (m_CurrentContext.physicalCamera)
639643
m_Camera.usePhysicalProperties = true;
640-
else
644+
else
641645
#endif
642646
m_Camera.ResetProjectionMatrix();
643647

0 commit comments

Comments
 (0)