@@ -211,51 +211,52 @@ public void GenerateAOMap(CommandBuffer cmd, Camera camera, RenderTargetIdentifi
211
211
212
212
void PushAllocCommands ( CommandBuffer cmd , bool isMSAA , Camera camera )
213
213
{
214
+ bool dynamicResolutionEnabled = RuntimeUtilities . IsDynamicResolutionEnabled ( camera ) ;
214
215
if ( isMSAA )
215
216
{
216
- Alloc ( cmd , ShaderIDs . LinearDepth , MipLevel . Original , RenderTextureFormat . RGHalf , true , camera . allowDynamicResolution ) ;
217
-
218
- Alloc ( cmd , ShaderIDs . LowDepth1 , MipLevel . L1 , RenderTextureFormat . RGFloat , true , camera . allowDynamicResolution ) ;
219
- Alloc ( cmd , ShaderIDs . LowDepth2 , MipLevel . L2 , RenderTextureFormat . RGFloat , true , camera . allowDynamicResolution ) ;
220
- Alloc ( cmd , ShaderIDs . LowDepth3 , MipLevel . L3 , RenderTextureFormat . RGFloat , true , camera . allowDynamicResolution ) ;
221
- Alloc ( cmd , ShaderIDs . LowDepth4 , MipLevel . L4 , RenderTextureFormat . RGFloat , true , camera . allowDynamicResolution ) ;
222
-
223
- AllocArray ( cmd , ShaderIDs . TiledDepth1 , MipLevel . L3 , RenderTextureFormat . RGHalf , true , camera . allowDynamicResolution ) ;
224
- AllocArray ( cmd , ShaderIDs . TiledDepth2 , MipLevel . L4 , RenderTextureFormat . RGHalf , true , camera . allowDynamicResolution ) ;
225
- AllocArray ( cmd , ShaderIDs . TiledDepth3 , MipLevel . L5 , RenderTextureFormat . RGHalf , true , camera . allowDynamicResolution ) ;
226
- AllocArray ( cmd , ShaderIDs . TiledDepth4 , MipLevel . L6 , RenderTextureFormat . RGHalf , true , camera . allowDynamicResolution ) ;
227
-
228
- Alloc ( cmd , ShaderIDs . Occlusion1 , MipLevel . L1 , RenderTextureFormat . RG16 , true , camera . allowDynamicResolution ) ;
229
- Alloc ( cmd , ShaderIDs . Occlusion2 , MipLevel . L2 , RenderTextureFormat . RG16 , true , camera . allowDynamicResolution ) ;
230
- Alloc ( cmd , ShaderIDs . Occlusion3 , MipLevel . L3 , RenderTextureFormat . RG16 , true , camera . allowDynamicResolution ) ;
231
- Alloc ( cmd , ShaderIDs . Occlusion4 , MipLevel . L4 , RenderTextureFormat . RG16 , true , camera . allowDynamicResolution ) ;
232
-
233
- Alloc ( cmd , ShaderIDs . Combined1 , MipLevel . L1 , RenderTextureFormat . RG16 , true , camera . allowDynamicResolution ) ;
234
- Alloc ( cmd , ShaderIDs . Combined2 , MipLevel . L2 , RenderTextureFormat . RG16 , true , camera . allowDynamicResolution ) ;
235
- Alloc ( cmd , ShaderIDs . Combined3 , MipLevel . L3 , RenderTextureFormat . RG16 , true , camera . allowDynamicResolution ) ;
217
+ Alloc ( cmd , ShaderIDs . LinearDepth , MipLevel . Original , RenderTextureFormat . RGHalf , true , dynamicResolutionEnabled ) ;
218
+
219
+ Alloc ( cmd , ShaderIDs . LowDepth1 , MipLevel . L1 , RenderTextureFormat . RGFloat , true , dynamicResolutionEnabled ) ;
220
+ Alloc ( cmd , ShaderIDs . LowDepth2 , MipLevel . L2 , RenderTextureFormat . RGFloat , true , dynamicResolutionEnabled ) ;
221
+ Alloc ( cmd , ShaderIDs . LowDepth3 , MipLevel . L3 , RenderTextureFormat . RGFloat , true , dynamicResolutionEnabled ) ;
222
+ Alloc ( cmd , ShaderIDs . LowDepth4 , MipLevel . L4 , RenderTextureFormat . RGFloat , true , dynamicResolutionEnabled ) ;
223
+
224
+ AllocArray ( cmd , ShaderIDs . TiledDepth1 , MipLevel . L3 , RenderTextureFormat . RGHalf , true , dynamicResolutionEnabled ) ;
225
+ AllocArray ( cmd , ShaderIDs . TiledDepth2 , MipLevel . L4 , RenderTextureFormat . RGHalf , true , dynamicResolutionEnabled ) ;
226
+ AllocArray ( cmd , ShaderIDs . TiledDepth3 , MipLevel . L5 , RenderTextureFormat . RGHalf , true , dynamicResolutionEnabled ) ;
227
+ AllocArray ( cmd , ShaderIDs . TiledDepth4 , MipLevel . L6 , RenderTextureFormat . RGHalf , true , dynamicResolutionEnabled ) ;
228
+
229
+ Alloc ( cmd , ShaderIDs . Occlusion1 , MipLevel . L1 , RenderTextureFormat . RG16 , true , dynamicResolutionEnabled ) ;
230
+ Alloc ( cmd , ShaderIDs . Occlusion2 , MipLevel . L2 , RenderTextureFormat . RG16 , true , dynamicResolutionEnabled ) ;
231
+ Alloc ( cmd , ShaderIDs . Occlusion3 , MipLevel . L3 , RenderTextureFormat . RG16 , true , dynamicResolutionEnabled ) ;
232
+ Alloc ( cmd , ShaderIDs . Occlusion4 , MipLevel . L4 , RenderTextureFormat . RG16 , true , dynamicResolutionEnabled ) ;
233
+
234
+ Alloc ( cmd , ShaderIDs . Combined1 , MipLevel . L1 , RenderTextureFormat . RG16 , true , dynamicResolutionEnabled ) ;
235
+ Alloc ( cmd , ShaderIDs . Combined2 , MipLevel . L2 , RenderTextureFormat . RG16 , true , dynamicResolutionEnabled ) ;
236
+ Alloc ( cmd , ShaderIDs . Combined3 , MipLevel . L3 , RenderTextureFormat . RG16 , true , dynamicResolutionEnabled ) ;
236
237
}
237
238
else
238
239
{
239
- Alloc ( cmd , ShaderIDs . LinearDepth , MipLevel . Original , RenderTextureFormat . RHalf , true , camera . allowDynamicResolution ) ;
240
-
241
- Alloc ( cmd , ShaderIDs . LowDepth1 , MipLevel . L1 , RenderTextureFormat . RFloat , true , camera . allowDynamicResolution ) ;
242
- Alloc ( cmd , ShaderIDs . LowDepth2 , MipLevel . L2 , RenderTextureFormat . RFloat , true , camera . allowDynamicResolution ) ;
243
- Alloc ( cmd , ShaderIDs . LowDepth3 , MipLevel . L3 , RenderTextureFormat . RFloat , true , camera . allowDynamicResolution ) ;
244
- Alloc ( cmd , ShaderIDs . LowDepth4 , MipLevel . L4 , RenderTextureFormat . RFloat , true , camera . allowDynamicResolution ) ;
245
-
246
- AllocArray ( cmd , ShaderIDs . TiledDepth1 , MipLevel . L3 , RenderTextureFormat . RHalf , true , camera . allowDynamicResolution ) ;
247
- AllocArray ( cmd , ShaderIDs . TiledDepth2 , MipLevel . L4 , RenderTextureFormat . RHalf , true , camera . allowDynamicResolution ) ;
248
- AllocArray ( cmd , ShaderIDs . TiledDepth3 , MipLevel . L5 , RenderTextureFormat . RHalf , true , camera . allowDynamicResolution ) ;
249
- AllocArray ( cmd , ShaderIDs . TiledDepth4 , MipLevel . L6 , RenderTextureFormat . RHalf , true , camera . allowDynamicResolution ) ;
250
-
251
- Alloc ( cmd , ShaderIDs . Occlusion1 , MipLevel . L1 , RenderTextureFormat . R8 , true , camera . allowDynamicResolution ) ;
252
- Alloc ( cmd , ShaderIDs . Occlusion2 , MipLevel . L2 , RenderTextureFormat . R8 , true , camera . allowDynamicResolution ) ;
253
- Alloc ( cmd , ShaderIDs . Occlusion3 , MipLevel . L3 , RenderTextureFormat . R8 , true , camera . allowDynamicResolution ) ;
254
- Alloc ( cmd , ShaderIDs . Occlusion4 , MipLevel . L4 , RenderTextureFormat . R8 , true , camera . allowDynamicResolution ) ;
255
-
256
- Alloc ( cmd , ShaderIDs . Combined1 , MipLevel . L1 , RenderTextureFormat . R8 , true , camera . allowDynamicResolution ) ;
257
- Alloc ( cmd , ShaderIDs . Combined2 , MipLevel . L2 , RenderTextureFormat . R8 , true , camera . allowDynamicResolution ) ;
258
- Alloc ( cmd , ShaderIDs . Combined3 , MipLevel . L3 , RenderTextureFormat . R8 , true , camera . allowDynamicResolution ) ;
240
+ Alloc ( cmd , ShaderIDs . LinearDepth , MipLevel . Original , RenderTextureFormat . RHalf , true , dynamicResolutionEnabled ) ;
241
+
242
+ Alloc ( cmd , ShaderIDs . LowDepth1 , MipLevel . L1 , RenderTextureFormat . RFloat , true , dynamicResolutionEnabled ) ;
243
+ Alloc ( cmd , ShaderIDs . LowDepth2 , MipLevel . L2 , RenderTextureFormat . RFloat , true , dynamicResolutionEnabled ) ;
244
+ Alloc ( cmd , ShaderIDs . LowDepth3 , MipLevel . L3 , RenderTextureFormat . RFloat , true , dynamicResolutionEnabled ) ;
245
+ Alloc ( cmd , ShaderIDs . LowDepth4 , MipLevel . L4 , RenderTextureFormat . RFloat , true , dynamicResolutionEnabled ) ;
246
+
247
+ AllocArray ( cmd , ShaderIDs . TiledDepth1 , MipLevel . L3 , RenderTextureFormat . RHalf , true , dynamicResolutionEnabled ) ;
248
+ AllocArray ( cmd , ShaderIDs . TiledDepth2 , MipLevel . L4 , RenderTextureFormat . RHalf , true , dynamicResolutionEnabled ) ;
249
+ AllocArray ( cmd , ShaderIDs . TiledDepth3 , MipLevel . L5 , RenderTextureFormat . RHalf , true , dynamicResolutionEnabled ) ;
250
+ AllocArray ( cmd , ShaderIDs . TiledDepth4 , MipLevel . L6 , RenderTextureFormat . RHalf , true , dynamicResolutionEnabled ) ;
251
+
252
+ Alloc ( cmd , ShaderIDs . Occlusion1 , MipLevel . L1 , RenderTextureFormat . R8 , true , dynamicResolutionEnabled ) ;
253
+ Alloc ( cmd , ShaderIDs . Occlusion2 , MipLevel . L2 , RenderTextureFormat . R8 , true , dynamicResolutionEnabled ) ;
254
+ Alloc ( cmd , ShaderIDs . Occlusion3 , MipLevel . L3 , RenderTextureFormat . R8 , true , dynamicResolutionEnabled ) ;
255
+ Alloc ( cmd , ShaderIDs . Occlusion4 , MipLevel . L4 , RenderTextureFormat . R8 , true , dynamicResolutionEnabled ) ;
256
+
257
+ Alloc ( cmd , ShaderIDs . Combined1 , MipLevel . L1 , RenderTextureFormat . R8 , true , dynamicResolutionEnabled ) ;
258
+ Alloc ( cmd , ShaderIDs . Combined2 , MipLevel . L2 , RenderTextureFormat . R8 , true , dynamicResolutionEnabled ) ;
259
+ Alloc ( cmd , ShaderIDs . Combined3 , MipLevel . L3 , RenderTextureFormat . R8 , true , dynamicResolutionEnabled ) ;
259
260
}
260
261
}
261
262
@@ -274,7 +275,7 @@ void PushDownsampleCommands(CommandBuffer cmd, Camera camera, RenderTargetIdenti
274
275
// buffer (it's only available in some specific situations).
275
276
if ( ! RuntimeUtilities . IsResolvedDepthAvailable ( camera ) )
276
277
{
277
- Alloc ( cmd , ShaderIDs . DepthCopy , MipLevel . Original , RenderTextureFormat . RFloat , false , camera . allowDynamicResolution ) ;
278
+ Alloc ( cmd , ShaderIDs . DepthCopy , MipLevel . Original , RenderTextureFormat . RFloat , false , RuntimeUtilities . IsDynamicResolutionEnabled ( camera ) ) ;
278
279
depthMapId = new RenderTargetIdentifier ( ShaderIDs . DepthCopy ) ;
279
280
cmd . BlitFullscreenTriangle ( BuiltinRenderTextureType . None , depthMapId , m_PropertySheet , ( int ) Pass . DepthCopy ) ;
280
281
needDepthMapRelease = true ;
@@ -484,7 +485,8 @@ void CheckAOTexture(PostProcessRenderContext context)
484
485
{
485
486
bool AOUpdateNeeded = m_AmbientOnlyAO == null || ! m_AmbientOnlyAO . IsCreated ( ) || m_AmbientOnlyAO . width != context . width || m_AmbientOnlyAO . height != context . height ;
486
487
#if UNITY_2017_3_OR_NEWER
487
- AOUpdateNeeded = AOUpdateNeeded || m_AmbientOnlyAO . useDynamicScale != context . camera . allowDynamicResolution ;
488
+ bool dynamicResolutionEnabled = RuntimeUtilities . IsDynamicResolutionEnabled ( context . camera ) ;
489
+ AOUpdateNeeded = AOUpdateNeeded || m_AmbientOnlyAO . useDynamicScale != dynamicResolutionEnabled ;
488
490
#endif
489
491
if ( AOUpdateNeeded )
490
492
{
@@ -496,7 +498,7 @@ void CheckAOTexture(PostProcessRenderContext context)
496
498
filterMode = FilterMode . Point ,
497
499
enableRandomWrite = true ,
498
500
#if UNITY_2017_3_OR_NEWER
499
- useDynamicScale = context . camera . allowDynamicResolution
501
+ useDynamicScale = dynamicResolutionEnabled
500
502
#endif
501
503
} ;
502
504
m_AmbientOnlyAO . Create ( ) ;
0 commit comments