@@ -32,9 +32,10 @@ private static class MainLightShadowConstantBuffer
32
32
33
33
int m_MainLightShadowmapID ;
34
34
internal RTHandle m_MainLightShadowmapTexture ;
35
- private RTHandle m_EmptyLightShadowmapTexture ;
35
+ private RTHandle m_EmptyMainLightShadowmapTexture ;
36
36
private const int k_EmptyShadowMapDimensions = 1 ;
37
- private const string k_EmptyShadowMapName = "_EmptyLightShadowmapTexture" ;
37
+ private const string k_MainLightShadowMapTextureName = "_MainLightShadowmapTexture" ;
38
+ private const string k_EmptyMainLightShadowMapTextureName = "_EmptyMainLightShadowmapTexture" ;
38
39
private static readonly Vector4 s_EmptyShadowParams = new Vector4 ( 1 , 0 , 1 , 0 ) ;
39
40
private static readonly Vector4 s_EmptyShadowmapSize = s_EmptyShadowmapSize = new Vector4 ( k_EmptyShadowMapDimensions , 1f / k_EmptyShadowMapDimensions , k_EmptyShadowMapDimensions , k_EmptyShadowMapDimensions ) ;
40
41
@@ -76,9 +77,7 @@ public MainLightShadowCasterPass(RenderPassEvent evt)
76
77
MainLightShadowConstantBuffer . _ShadowOffset1 = Shader . PropertyToID ( "_MainLightShadowOffset1" ) ;
77
78
MainLightShadowConstantBuffer . _ShadowmapSize = Shader . PropertyToID ( "_MainLightShadowmapSize" ) ;
78
79
79
- m_MainLightShadowmapID = Shader . PropertyToID ( "_MainLightShadowmapTexture" ) ;
80
-
81
- m_EmptyLightShadowmapTexture = ShadowUtils . AllocShadowRT ( k_EmptyShadowMapDimensions , k_EmptyShadowMapDimensions , k_ShadowmapBufferBits , 1 , 0 , name : k_EmptyShadowMapName ) ;
80
+ m_MainLightShadowmapID = Shader . PropertyToID ( k_MainLightShadowMapTextureName ) ;
82
81
m_EmptyShadowmapNeedsClear = true ;
83
82
}
84
83
@@ -88,7 +87,7 @@ public MainLightShadowCasterPass(RenderPassEvent evt)
88
87
public void Dispose ( )
89
88
{
90
89
m_MainLightShadowmapTexture ? . Release ( ) ;
91
- m_EmptyLightShadowmapTexture ? . Release ( ) ;
90
+ m_EmptyMainLightShadowmapTexture ? . Release ( ) ;
92
91
}
93
92
94
93
/// <summary>
@@ -141,8 +140,7 @@ public bool Setup(UniversalRenderingData renderingData, UniversalCameraData came
141
140
Debug . LogWarning ( "Only directional lights are supported as main light." ) ;
142
141
}
143
142
144
- Bounds bounds ;
145
- if ( ! renderingData . cullResults . GetShadowCasterBounds ( shadowLightIndex , out bounds ) )
143
+ if ( ! renderingData . cullResults . GetShadowCasterBounds ( shadowLightIndex , out Bounds _ ) )
146
144
return SetupForEmptyRendering ( cameraData . renderer . stripShadowsOffVariants ) ;
147
145
148
146
m_ShadowCasterCascadesCount = shadowData . mainLightShadowCascadesCount ;
@@ -161,7 +159,7 @@ public bool Setup(UniversalRenderingData renderingData, UniversalCameraData came
161
159
return SetupForEmptyRendering ( cameraData . renderer . stripShadowsOffVariants ) ;
162
160
}
163
161
164
- ShadowUtils . ShadowRTReAllocateIfNeeded ( ref m_MainLightShadowmapTexture , renderTargetWidth , renderTargetHeight , k_ShadowmapBufferBits , name : "_MainLightShadowmapTexture" ) ;
162
+ ShadowUtils . ShadowRTReAllocateIfNeeded ( ref m_MainLightShadowmapTexture , renderTargetWidth , renderTargetHeight , k_ShadowmapBufferBits , name : k_MainLightShadowMapTextureName ) ;
165
163
166
164
m_MaxShadowDistanceSq = cameraData . maxShadowDistance * cameraData . maxShadowDistance ;
167
165
m_CascadeBorder = shadowData . mainLightShadowCascadeBorder ;
@@ -180,7 +178,7 @@ bool SetupForEmptyRendering(bool stripShadowsOffVariants)
180
178
useNativeRenderPass = false ;
181
179
182
180
// Required for scene view camera(URP renderer not initialized)
183
- if ( ShadowUtils . ShadowRTReAllocateIfNeeded ( ref m_EmptyLightShadowmapTexture , k_EmptyShadowMapDimensions , k_EmptyShadowMapDimensions , k_ShadowmapBufferBits , name : k_EmptyShadowMapName ) )
181
+ if ( ShadowUtils . ShadowRTReAllocateIfNeeded ( ref m_EmptyMainLightShadowmapTexture , k_EmptyShadowMapDimensions , k_EmptyShadowMapDimensions , k_ShadowmapBufferBits , name : k_EmptyMainLightShadowMapTextureName ) )
184
182
m_EmptyShadowmapNeedsClear = true ;
185
183
186
184
return true ;
@@ -197,7 +195,7 @@ public override void Configure(CommandBuffer cmd, RenderTextureDescriptor camera
197
195
#pragma warning disable CS0618
198
196
if ( m_CreateEmptyShadowmap )
199
197
{
200
- ConfigureTarget ( m_EmptyLightShadowmapTexture ) ;
198
+ ConfigureTarget ( m_EmptyMainLightShadowmapTexture ) ;
201
199
m_EmptyShadowmapNeedsClear = false ;
202
200
}
203
201
else
@@ -220,8 +218,7 @@ public override void Execute(ScriptableRenderContext context, ref RenderingData
220
218
if ( m_CreateEmptyShadowmap )
221
219
{
222
220
SetEmptyMainLightCascadeShadowmap ( CommandBufferHelpers . GetRasterCommandBuffer ( universalRenderingData . commandBuffer ) ) ;
223
- universalRenderingData . commandBuffer . SetGlobalTexture ( m_MainLightShadowmapID , m_EmptyLightShadowmapTexture . nameID ) ;
224
-
221
+ universalRenderingData . commandBuffer . SetGlobalTexture ( m_MainLightShadowmapID , m_EmptyMainLightShadowmapTexture . nameID ) ;
225
222
return ;
226
223
}
227
224
0 commit comments