{"record":{"id":"85711132bd81698b","repo":"stride3d/stride","slug":"graphics-profile-not-supported","errorCode":null,"errorMessage":"Graphics Profile not supported.","messagePattern":"Graphics Profile not supported\\.","errorType":"exception","errorClass":"ArgumentException","httpStatus":null,"severity":"error","filePath":"sources/shaders/Stride.Shaders.Compilers/Direct3D/ShaderCompiler.cs","lineNumber":166,"sourceCode":"                    _ => 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))\n                };\n            }\n\n\n            //\n            // Compiles the Shader source code to byte-code for the specified Shader Model.\n            //\n            HResult Compile()\n            {\n                var shaderSourceSpan = shaderSource.GetAsciiSpan();\n                var shaderSourceLength = (nuint) shaderSourceSpan.Length;\n\n                ref var noSourceName = ref NullRef<byte>();\n\n                ref var noDefines = ref NullRef<D3DShaderMacro>();\n                var noIncludes = default(ComPtr<ID3DInclude>);\n\n                var entryPointSpan = entryPoint.GetUtf8Span();","sourceCodeStart":148,"sourceCodeEnd":184,"githubUrl":"https://github.com/stride3d/stride/blob/96fad776d210c221682aac1ccdf4c79dc046fc38/sources/shaders/Stride.Shaders.Compilers/Direct3D/ShaderCompiler.cs#L148-L184","documentation":"The compiler builds a D3D shader-model string (e.g. '4_0', '5_0') from the requested GraphicsProfile. Only Level_9_1 through Level_11_1 are mapped; any other profile (notably Level_12_x) is rejected with ArgumentException naming graphicsProfile.","triggerScenarios":"Calling ShaderCompiler.Compile with GraphicsProfile.Level_10_2?/Level_11_x-unmapped or Level_12_0/Level_12_1, or an out-of-range/cast enum value.","commonSituations":"Running with modern profiles (Level_12_*) that this legacy Direct3D compiler never supported; loading a serialized profile from a newer project; mismatched platform feature levels.","solutions":["Restrict rendering to GraphicsProfile.Level_9_1..Level_11_1 when using this D3D compiler path.","Route Level_12 profiles to the current EffectCompiler/backends that support SM 6.x.","Sanity-check the profile value loaded from config/serialization against supported enum values."],"exampleFix":"// before\nvar bc = ShaderCompiler.Compile(src, \"main\", ShaderStage.Pixel, GraphicsProfile.Level_12_0);\n// after\nvar bc = effectCompiler.Compile(src, \"main\", ShaderStage.Pixel, GraphicsProfile.Level_11_1); // or use SM6-capable backend","handlingStrategy":"validation","validationCode":"static readonly GraphicsProfile[] Supported = { GraphicsProfile.Level_9_1, GraphicsProfile.Level_9_2, GraphicsProfile.Level_9_3, GraphicsProfile.Level_10_0, GraphicsProfile.Level_10_1, GraphicsProfile.Level_11_0, GraphicsProfile.Level_11_1 };\nif (Array.IndexOf(Supported, profile) >= 0) var bc = ShaderCompiler.Compile(src, ep, stage, profile);","typeGuard":"bool IsLegacyProfile(GraphicsProfile p) => p is >= GraphicsProfile.Level_9_1 and <= GraphicsProfile.Level_11_1;","tryCatchPattern":"try { var bc = ShaderCompiler.Compile(src, ep, stage, profile); }\ncatch (ArgumentException ex) when (ex.ParamName == \"graphicsProfile\") { /* fall back to Level_11_1 or a newer backend */ }","preventionTips":["Clamp requested profiles to Level_9_1..Level_11_1 on this path","Validate profiles deserialized from project files","Use the modern EffectCompiler for SM 6.x / Level_12"],"tags":["shader","direct3d","graphics-profile","unsupported"],"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"}