{"record":{"id":"c18f3b1b6a2c880f","repo":"stride3d/stride","slug":"shader-stage-not-supported","errorCode":null,"errorMessage":"Shader Stage not supported.","messagePattern":"Shader Stage not supported\\.","errorType":"exception","errorClass":"ArgumentException","httpStatus":null,"severity":"error","filePath":"sources/shaders/Stride.Shaders.Compilers/Direct3D/ShaderCompiler.cs","lineNumber":148,"sourceCode":"\n            return bytecodeResult;\n\n\n            //\n            // Returns a string representation of the Shader stage.\n            //\n            static string ShaderStageToString(ShaderStage stage)\n            {\n                return stage switch\n                {\n                    ShaderStage.Compute => \"cs\",\n                    ShaderStage.Vertex => \"vs\",\n                    ShaderStage.Hull => \"hs\",\n                    ShaderStage.Domain => \"ds\",\n                    ShaderStage.Geometry => \"gs\",\n                    ShaderStage.Pixel => \"ps\",\n\n                    _ => throw new ArgumentException(\"Shader Stage not supported.\", nameof(stage))\n                };\n            }\n\n            //\n            // Returns the Shader profile string based on the specified Graphics Profile.\n            //\n            static string ShaderProfileFromGraphicsProfile(GraphicsProfile graphicsProfile)\n            {\n                return graphicsProfile switch\n                {\n                    GraphicsProfile.Level_9_1 => \"4_0_level_9_1\",\n                    GraphicsProfile.Level_9_2 => \"4_0_level_9_2\",\n                    GraphicsProfile.Level_9_3 => \"4_0_level_9_3\",\n                    GraphicsProfile.Level_10_0 => \"4_0\",\n                    GraphicsProfile.Level_10_1 => \"4_1\",\n                    GraphicsProfile.Level_11_0 or GraphicsProfile.Level_11_1 => \"5_0\",\n\n                    _ => throw new ArgumentException(\"Graphics Profile not supported.\", nameof(graphicsProfile))","sourceCodeStart":130,"sourceCodeEnd":166,"githubUrl":"https://github.com/stride3d/stride/blob/96fad776d210c221682aac1ccdf4c79dc046fc38/sources/shaders/Stride.Shaders.Compilers/Direct3D/ShaderCompiler.cs#L130-L166","documentation":"The Direct3D ShaderCompiler maps a ShaderStage to the D3D compiler target prefix (vs/hs/ds/gs/ps). If the stage is one not covered by the switch (e.g. Compute or an invalid value), the compiler cannot build a target name and throws ArgumentException for the 'stage' parameter.","triggerScenarios":"Calling ShaderCompiler.Compile with a ShaderStage other than Vertex/Hull/Domain/Geometry/Pixel — most commonly ShaderStage.Compute, or a default-initialized/invalid stage enum value.","commonSituations":"Compiling compute shaders through the D3D11-era compiler path; passing a stage variable that was never assigned; API changes that added new stages without updating this legacy switch.","solutions":["Use only Vertex/Hull/Domain/Geometry/Pixel stages with this D3D ShaderCompiler path.","Route compute shaders to the appropriate compiler path (e.g. EffectCompiler / newer backend) instead.","Validate/initialize the ShaderStage argument before calling Compile.","Check your Stride version — newer versions may support additional stages on this path."],"exampleFix":"// before\nvar result = ShaderCompiler.Compile(source, entryPoint, ShaderStage.Compute, profile);\n// after\nvar result = effectCompiler.Compile(source, entryPoint, ShaderStage.Compute, profile); // compute via EffectCompiler path","handlingStrategy":"validation","validationCode":"static readonly ShaderStage[] Supported = { ShaderStage.Vertex, ShaderStage.Hull, ShaderStage.Domain, ShaderStage.Geometry, ShaderStage.Pixel };\nif (Array.IndexOf(Supported, stage) >= 0) var bc = ShaderCompiler.Compile(src, ep, stage, profile);","typeGuard":"bool IsRasterStage(ShaderStage s) => s is ShaderStage.Vertex or ShaderStage.Hull or ShaderStage.Domain or ShaderStage.Geometry or ShaderStage.Pixel;","tryCatchPattern":"try { var bc = ShaderCompiler.Compile(src, ep, stage, profile); }\ncatch (ArgumentException ex) when (ex.ParamName == \"stage\") { /* route stage to another compiler path */ }","preventionTips":["Whitelist supported stages before compiling","Send compute shaders to EffectCompiler/newer backends","Initialize ShaderStage variables explicitly"],"tags":["shader","direct3d","unsupported-stage","graphics"],"backgroundTag":"unsupported-enum-value","analyzedSha":"96fad776d210c221682aac1ccdf4c79dc046fc38","analyzedAt":"2026-09-14T02:59:31.279Z","contentChangedAt":"2026-09-14T02:59:31.279Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}