@@ -44,6 +44,7 @@ internal class ShaderPreprocessor : IPreprocessShaders
4444 ShaderKeyword m_AdditionalLightsPixel = new ShaderKeyword ( ShaderKeywordStrings . AdditionalLightsPixel ) ;
4545 ShaderKeyword m_AdditionalLightShadows = new ShaderKeyword ( ShaderKeywordStrings . AdditionalLightShadows ) ;
4646 ShaderKeyword m_CascadeShadows = new ShaderKeyword ( ShaderKeywordStrings . MainLightShadowCascades ) ;
47+ ShaderKeyword m_CastingPunctualLightShadow = new ShaderKeyword ( ShaderKeywordStrings . CastingPunctualLightShadow ) ;
4748 ShaderKeyword m_SoftShadows = new ShaderKeyword ( ShaderKeywordStrings . SoftShadows ) ;
4849 ShaderKeyword m_MixedLightingSubtractive = new ShaderKeyword ( ShaderKeywordStrings . MixedLightingSubtractive ) ;
4950 ShaderKeyword m_Lightmap = new ShaderKeyword ( ShaderKeywordStrings . LIGHTMAP_ON ) ;
@@ -100,6 +101,9 @@ bool StripUnusedFeatures(ShaderFeatures features, Shader shader, ShaderSnippetDa
100101
101102 if ( compilerData . shaderKeywordSet . IsEnabled ( m_CascadeShadows ) )
102103 return true ;
104+
105+ if ( snippetData . passType == PassType . ShadowCaster && ! compilerData . shaderKeywordSet . IsEnabled ( m_CastingPunctualLightShadow ) )
106+ return true ;
103107 }
104108
105109 if ( ! IsFeatureEnabled ( features , ShaderFeatures . SoftShadows ) &&
@@ -110,11 +114,17 @@ bool StripUnusedFeatures(ShaderFeatures features, Shader shader, ShaderSnippetDa
110114 ! IsFeatureEnabled ( features , ShaderFeatures . MixedLighting ) )
111115 return true ;
112116
113- // No additional light shadows
114117 bool isAdditionalLightShadow = compilerData . shaderKeywordSet . IsEnabled ( m_AdditionalLightShadows ) ;
115- if ( ! IsFeatureEnabled ( features , ShaderFeatures . AdditionalLightShadows ) && isAdditionalLightShadow )
116- return true ;
117118
119+ // No additional light shadows
120+ if ( ! IsFeatureEnabled ( features , ShaderFeatures . AdditionalLightShadows ) )
121+ {
122+ if ( isAdditionalLightShadow )
123+ return true ;
124+
125+ if ( snippetData . passType == PassType . ShadowCaster && compilerData . shaderKeywordSet . IsEnabled ( m_CastingPunctualLightShadow ) )
126+ return true ;
127+ }
118128
119129 // Additional light are shaded per-vertex or per-pixel.
120130 bool isFeaturePerPixelLightingEnabled = IsFeatureEnabled ( features , ShaderFeatures . AdditionalLights ) ;
0 commit comments