{"record":{"id":"30d76d4c773984aa","repo":"stride3d/stride","slug":"invalid-shaderstage","errorCode":null,"errorMessage":"Invalid ShaderStage.","messagePattern":"Invalid ShaderStage\\.","errorType":"exception","errorClass":"ArgumentOutOfRangeException","httpStatus":null,"severity":"error","filePath":"sources/engine/Stride.Graphics/Direct3D12/PipelineState.Direct3D12.cs","lineNumber":709,"sourceCode":"\n                throw new NotSupportedException(\"Static Samplers can only have opaque black, opaque white or transparent black as border color.\");\n            }\n\n            //\n            // Returns the Direct3D 12 Shader Visibility for a Stride's ShaderStage.\n            //\n            static ShaderVisibility GetShaderVisibilityForStage(ShaderStage stage)\n            {\n                return stage switch\n                {\n                    ShaderStage.Vertex => ShaderVisibility.Vertex,\n                    ShaderStage.Hull => ShaderVisibility.Hull,\n                    ShaderStage.Domain => ShaderVisibility.Domain,\n                    ShaderStage.Geometry => ShaderVisibility.Geometry,\n                    ShaderStage.Pixel => ShaderVisibility.Pixel,\n                    ShaderStage.Compute => ShaderVisibility.All,\n\n                    _ => throw new ArgumentOutOfRangeException(nameof(stage), stage, \"Invalid ShaderStage.\")\n                };\n            }\n        }\n\n        /// <inheritdoc/>\n        protected internal override void OnDestroyed(bool immediately = false)\n        {\n            SafeRelease(ref nativeRootSignature);\n            SafeRelease(ref compiledPipelineState);\n\n            base.OnDestroyed(immediately);\n        }\n    }\n}\n\n#endif\n","sourceCodeStart":691,"sourceCodeEnd":726,"githubUrl":"https://github.com/stride3d/stride/blob/96fad776d210c221682aac1ccdf4c79dc046fc38/sources/engine/Stride.Graphics/Direct3D12/PipelineState.Direct3D12.cs#L691-L726","documentation":"When converting a Stride ShaderStage to a D3D12 ShaderVisibility for root signature parameters, only Vertex, Hull, Domain, Geometry, Pixel, and Compute (mapped to All) are handled. Any other/invalid stage value reaches the switch default and throws ArgumentOutOfRangeException naming 'stage'.","triggerScenarios":"An effect binding whose ShaderStage is undefined, corrupted, or a stage not in the handled set while building the root signature in the PipelineState constructor.","commonSituations":"Malformed effect bytecode metadata; enum cast from an int not matching any ShaderStage; backend mismatch after adding a new stage without updating the D3D12 mapping.","solutions":["Ensure effect bindings carry valid ShaderStage values","Recompile the effect so stage metadata is correct","Upgrade Stride if a newly introduced stage is not yet mapped in the D3D12 backend"],"exampleFix":"// before\nvar stage = (ShaderStage)42; // invalid\n// after\nvar stage = ShaderStage.Pixel;","handlingStrategy":"validation","validationCode":"if (!Enum.IsDefined(typeof(ShaderStage), stage)) throw new InvalidOperationException($\"Undefined ShaderStage: {stage}\");","typeGuard":"bool IsValidShaderStage(ShaderStage s) => s is ShaderStage.Vertex or ShaderStage.Hull or ShaderStage.Domain or ShaderStage.Geometry or ShaderStage.Pixel or ShaderStage.Compute;","tryCatchPattern":"try { state = PipelineState.New(device, desc); } catch (ArgumentOutOfRangeException) { /* invalid ShaderStage in effect binding */ throw; }","preventionTips":["Keep effect bytecode stage metadata generated by supported Stride versions","Never cast raw ints to ShaderStage without Enum.IsDefined checks"],"tags":["direct3d12","root-signature","shader-stage"],"backgroundTag":"invalid-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"}