diff --git a/src/scene/shader-lib/programs/lit-shader.js b/src/scene/shader-lib/programs/lit-shader.js index 4b6643cbbf0..20500cb070a 100644 --- a/src/scene/shader-lib/programs/lit-shader.js +++ b/src/scene/shader-lib/programs/lit-shader.js @@ -430,9 +430,6 @@ class LitShader { const lightType = this.shaderPassInfo.lightType; let shadowType = this.shaderPassInfo.shadowType; - const shadowInfo = shadowTypeInfo.get(shadowType); - Debug.assert(shadowInfo); - const isVsm = shadowInfo?.vsm ?? false; // If not a directional light and using clustered, fall back to using PCF3x3 if shadow type isn't supported if (lightType !== LIGHTTYPE_DIRECTIONAL && options.clusteredLightingEnabled) { @@ -441,6 +438,10 @@ class LitShader { } } + const shadowInfo = shadowTypeInfo.get(shadowType); + Debug.assert(shadowInfo); + const isVsm = shadowInfo?.vsm ?? false; + let code = this._fsGetBeginCode(); if (shadowType === SHADOW_VSM_32F) {