@@ -47,12 +47,6 @@ enum Pass
47
47
48
48
int [ ] m_HistoryPingPong = new int [ k_NumEyes ] ;
49
49
50
- public TemporalAntialiasing ( )
51
- {
52
- m_HistoryTextures [ ( int ) Camera . StereoscopicEye . Left ] = new RenderTexture [ k_NumHistoryTextures ] ;
53
- m_HistoryTextures [ ( int ) Camera . StereoscopicEye . Right ] = new RenderTexture [ k_NumHistoryTextures ] ;
54
- }
55
-
56
50
public bool IsSupported ( )
57
51
{
58
52
return SystemInfo . supportedRenderTargetCount >= 2
@@ -160,7 +154,12 @@ void GenerateHistoryName(RenderTexture rt, int id, PostProcessRenderContext cont
160
154
161
155
RenderTexture CheckHistory ( int id , PostProcessRenderContext context )
162
156
{
163
- var rt = m_HistoryTextures [ context . xrActiveEye ] [ id ] ;
157
+ int activeEye = context . xrActiveEye ;
158
+
159
+ if ( m_HistoryTextures [ activeEye ] == null )
160
+ m_HistoryTextures [ activeEye ] = new RenderTexture [ k_NumHistoryTextures ] ;
161
+
162
+ var rt = m_HistoryTextures [ activeEye ] [ id ] ;
164
163
165
164
if ( m_ResetHistory || rt == null || ! rt . IsCreated ( ) )
166
165
{
@@ -170,7 +169,7 @@ RenderTexture CheckHistory(int id, PostProcessRenderContext context)
170
169
GenerateHistoryName ( rt , id , context ) ;
171
170
172
171
rt . filterMode = FilterMode . Bilinear ;
173
- m_HistoryTextures [ context . xrActiveEye ] [ id ] = rt ;
172
+ m_HistoryTextures [ activeEye ] [ id ] = rt ;
174
173
175
174
context . command . BlitFullscreenTriangle ( context . source , rt ) ;
176
175
}
@@ -182,13 +181,13 @@ RenderTexture CheckHistory(int id, PostProcessRenderContext context)
182
181
GenerateHistoryName ( rt2 , id , context ) ;
183
182
184
183
rt2 . filterMode = FilterMode . Bilinear ;
185
- m_HistoryTextures [ context . xrActiveEye ] [ id ] = rt2 ;
184
+ m_HistoryTextures [ activeEye ] [ id ] = rt2 ;
186
185
187
186
context . command . BlitFullscreenTriangle ( rt , rt2 ) ;
188
187
RenderTexture . ReleaseTemporary ( rt ) ;
189
188
}
190
189
191
- return m_HistoryTextures [ context . xrActiveEye ] [ id ] ;
190
+ return m_HistoryTextures [ activeEye ] [ id ] ;
192
191
}
193
192
194
193
internal void Render ( PostProcessRenderContext context )
@@ -221,14 +220,21 @@ internal void Render(PostProcessRenderContext context)
221
220
222
221
internal void Release ( )
223
222
{
224
- for ( int i = 0 ; i < m_HistoryTextures . Length ; i ++ )
223
+ if ( m_HistoryTextures != null )
225
224
{
226
- for ( int j = 0 ; j < m_HistoryTextures [ i ] . Length ; j ++ )
225
+ for ( int i = 0 ; i < m_HistoryTextures . Length ; i ++ )
227
226
{
228
- RenderTexture . ReleaseTemporary ( m_HistoryTextures [ i ] [ j ] ) ;
229
- m_HistoryTextures [ i ] [ j ] = null ;
227
+ if ( m_HistoryTextures [ i ] == null )
228
+ continue ;
229
+
230
+ for ( int j = 0 ; j < m_HistoryTextures [ i ] . Length ; j ++ )
231
+ {
232
+ RenderTexture . ReleaseTemporary ( m_HistoryTextures [ i ] [ j ] ) ;
233
+ m_HistoryTextures [ i ] [ j ] = null ;
234
+ }
235
+
236
+ m_HistoryTextures [ i ] = null ;
230
237
}
231
- m_HistoryTextures [ i ] = null ;
232
238
}
233
239
234
240
m_SampleIndex = 0 ;
0 commit comments