# Niagara Stateless FSimulationShaderDefaultCS crashes on live and fails to compile locally 

**URL:** <https://forums.unrealengine.com/t/niagara-stateless-fsimulationshaderdefaultcs-crashes-on-live-and-fails-to-compile-locally/2858985>\
**Category:** Rendering\
**Tags:** unreal-engine, Epic-Pro-Support, question\
**Created:** [October 20, 2026, 8:44pm UTC](https://forums.unrealengine.com/t/niagara-stateless-fsimulationshaderdefaultcs-crashes-on-live-and-fails-to-compile-locally/2858985 "2026-10-20T20:44:44Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![anonymous-edc](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous-edc](https://forums.unrealengine.com/u/anonymous-edc)\
**Post date:** [October 20, 2026, 8:44pm UTC](https://forums.unrealengine.com/t/niagara-stateless-fsimulationshaderdefaultcs-crashes-on-live-and-fails-to-compile-locally/2858985/1 "2026-10-20T20:44:44Z")

</div>

It’s unclear to me how FSimulationShaderDefaultCS is supposed to compile with SM5 set for the project, is it intended for SM6 only? This is what I’m seeing locally, so it’s unclear to me what’s happening differently during the cook process and consequently what’s going on in the runtime. But the end result is the runtime is encountering crashes, which once we managed to get lucky and have an internal repro with aftermath enabled, indicated FSimulationShaderDefaultCS as the culprit.

[Attachment Removed]

---

<div class="post-metadata">

**Author:** ![anonymous-edc](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous-edc](https://forums.unrealengine.com/u/anonymous-edc)\
**Post date:** [October 20, 2026, 8:44pm UTC](https://forums.unrealengine.com/t/niagara-stateless-fsimulationshaderdefaultcs-crashes-on-live-and-fails-to-compile-locally/2858985/2 "2026-10-20T20:44:51Z")

</div>

**Steps to Reproduce**  
We are seeing a high occurrence of GPU crashes due to an out of bounds memory access in FSimulationShaderDefaultCS. While attempting to get a local binary shader file for NSight, we’ve found that the shader doesn’t compile.

To reproduce the failed compilation:

1. Choose SM5 as the shader model for the project.
2. In the editor, run r.ShaderDevelopmentMode 1 and then recompileshaders NiagaraStatelessSimulationDefault.usf
3. This generates a Saved\ShaderDebugInfo\PCD3D\_SM5\Global\FSimulationShaderDefaultCS\0 folder, with DebugCompile.in, DebugCompileArgs.txt NiagaraStatelessSimulationDefault.usf, OutputHash.txt
4. Run \<root\>\Engine\Binaries\Win64\ShaderCompileWorker.exe “\<root\>/Projects/TFT/Saved/ShaderDebugInfo/PCD3D\_SM5/Global/FSimulationShaderDefaultCS/0” 0 “DebugCompile” DebugCompile.in DebugCompile.out -DebugSourceFiles=“NiagaraStatelessSimulationDefault.usf” -TimeToLive=0.0f -KeepInput
5. This generates CompileFXC.bat, NiagaraStatelessSimulationDefault.intermediate.spvasm, NiagaraStatelessSimulationDefault.intermediate.hlsl, Output.d3dasm
6. Modify CompileFXC.bat to point to an actual fxc.exe location
7. Run CompileFXC.bat

We see

```auto
/Plugin/FX/Niagara/Shared/NiagaraStatelessBuiltDistribution.h(32,9-14): error X3000: syntax error: unexpected token 'EFlags'

```

which makes sense because fxc doesn’t support enums.

[Attachment Removed]

---

<div class="post-metadata">

**Author:** ![Petrockets](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/petrockets/32/1142518_2.png) [@Petrockets](https://forums.unrealengine.com/u/Petrockets)\
**Post date:** [October 20, 2026, 11:13pm UTC](https://forums.unrealengine.com/t/niagara-stateless-fsimulationshaderdefaultcs-crashes-on-live-and-fails-to-compile-locally/2858985/3 "2026-10-20T23:13:45Z")

</div>

Hi!

Based on the provided info, the GPU crash in FSimulationShaderDefaultCS is likely due to one we have been investigating recently where:

**A GPU crash occurs from a speculative read of Niagara’s intentional -1 sentinel, exposed by Aftermath shader error reporting.**

The shader is **FSimulationShaderDefaultCS** , specifically **Scale Mesh Size**

- NiagaraStatelessModule\_ScaleMeshSize.ush:11 calls GetParameterBufferFloat3(ScaleMeshSize\_CurveScaleOffset, 0, ScaleMeshSize\_CurveScale)
- NiagaraStatelessCommon.ush:129 checks whether the offset is nonnegative before loading; otherwise it returns the default.
- The C++ module NiagaraStatelessModule\_ScaleMeshSize.cpp:16 initializes that offset to INDEX\_NONE
- **-1 is valid input here.**
- FXC flattens the guard. The resulting DXBC effectively does:

```auto
loaded = DynamicBuffer.Load3(offset * 4); // Executes even for -1
result = offset >= 0 ? loaded : defaultValue;

```

When the application is run with -nvAftermathAll, or specifically the [GFSDK\_Aftermath\_FeatureFlags\_EnableShaderErrorReporting](https://docs.nvidia.com/nsight-aftermath/SDK/index.html#application-instrumentation-with-event-markers) flag, it may relax the driver bounds checking or bounds handling and lead to the crash.

It’s likely adding a **BRANCH** to the helpers will fix the issue. We verified there were no initial performance regressions with the change but haven’t verified it fixes the issue yet.

The reason **CompileFXC.bat** doesn’t work is because it outputs the compile commands only for the most optimistic version - the one where FXC.exe works the first time because that debug bat file is generated early on in the function. **CompileAndProcessD3DShaderFXCExt** in **D3DShaderCompiler.cpp** actually has fallbacks if FXC.exe fails and it doesn’t always output to the log when the first compile attempt fails if the fallback succeeds. In the case of this shader it looks like it fell back to the DXC → SPIR-V → SPIRV-Cross HLSL 5.0 → FXC path and likely you can produce the final DXBC by changing the **CompileFXC.bat** so it uses the **NiagaraStatelessSimulationDefault.intermediate.hlsl** as input.

Also, one thing that came up during this investigation was the [Nsight only supports showing source/line association for shaders with DXIL, not DXBC](https://docs.nvidia.com/nsight-aftermath/ReleaseNotes/index.html#d3d) which is what FXC outputs for the SM5 shader compiler path.

[Attachment Removed]
