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

Commit 1e2630f

Browse files
committed
Fixed RT recycling happening too early
1 parent 976b23b commit 1e2630f

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

PostProcessing/Runtime/Components/DepthOfFieldComponent.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,6 @@ public void Prepare(RenderTexture source, Material uberMaterial, bool antialiasC
8989
material.SetFloat(Uniforms._RcpAspect, rcpAspect);
9090

9191
var rt1 = context.renderTextureFactory.Get(context.width / 2, context.height / 2, 0, RenderTextureFormat.ARGBHalf, filterMode: FilterMode.Point);
92-
var rt2 = context.renderTextureFactory.Get(context.width / 2, context.height / 2, 0, RenderTextureFormat.ARGBHalf, filterMode: FilterMode.Bilinear);
9392

9493
// Pass #1 - Downsampling, prefiltering and CoC calculation
9594
Graphics.Blit(source, rt1, material, 0);
@@ -124,11 +123,9 @@ public void Prepare(RenderTexture source, Material uberMaterial, bool antialiasC
124123
}
125124

126125
// Pass #3 - Bokeh simulation
126+
var rt2 = context.renderTextureFactory.Get(context.width / 2, context.height / 2, 0, RenderTextureFormat.ARGBHalf, filterMode: FilterMode.Bilinear);
127127
Graphics.Blit(pass, rt2, material, 1 + (int)settings.kernelSize);
128128

129-
if (antialiasCoC)
130-
context.renderTextureFactory.Release(pass);
131-
132129
if (context.profile.debugViews.IsModeActive(DebugMode.FocusPlane))
133130
{
134131
uberMaterial.SetTexture(Uniforms._DepthOfFieldTex, rt1);
@@ -142,6 +139,9 @@ public void Prepare(RenderTexture source, Material uberMaterial, bool antialiasC
142139
uberMaterial.EnableKeyword("DEPTH_OF_FIELD");
143140
}
144141

142+
if (antialiasCoC)
143+
context.renderTextureFactory.Release(pass);
144+
145145
context.renderTextureFactory.Release(rt1);
146146
}
147147

0 commit comments

Comments
 (0)