{"record":{"id":"e242bc7738731d53","repo":"stride3d/stride","slug":"unsupported-domain-value-stringliteral-anyattribute","errorCode":null,"errorMessage":"Unsupported domain value '{((StringLiteral)anyAttribute.Parameters[0]).Value}'","messagePattern":"Unsupported domain value '(.+?)'","errorType":"exception","errorClass":"NotSupportedException","httpStatus":null,"severity":"error","filePath":"sources/shaders/Stride.Shaders.Parsers/Parsing/SDSL/AST/ShaderElements.MethodOrMember.cs","lineNumber":575,"sourceCode":"                    else if (anyAttribute.Name == \"patchconstantfunc\")\n                    {\n                        context.Add(new OpDecorateString(function.Id, Specification.Decoration.PatchConstantFuncSDSL, ((StringLiteral)anyAttribute.Parameters[0]).Value));\n                    }\n                    else if (anyAttribute.Name == \"domain\")\n                    {\n                        // Triangles/Quads/Isolines are valid on either TCS or TES per spec.\n                        // We emit them only on DSMain (TES), matching glslang's convention\n                        // and keeping the SPIR-V minimal. HLSL's [domain] on HS is therefore\n                        // skipped here; HLSL also requires [domain] on DS, so DSMain's own\n                        // [domain] attribute guarantees the mode ends up in the module.\n                        if (EntryPoint != EntryPoint.HullShader)\n                        {\n                            context.Add(new OpExecutionMode(function.Id, ((StringLiteral)anyAttribute.Parameters[0]).Value switch\n                            {\n                                \"tri\" => Specification.ExecutionMode.Triangles,\n                                \"quad\" => Specification.ExecutionMode.Quads,\n                                \"isolined\" => Specification.ExecutionMode.Isolines,\n                                _ => throw new NotSupportedException($\"Unsupported domain value '{((StringLiteral)anyAttribute.Parameters[0]).Value}'\"),\n                            }, []));\n                        }\n                    }\n                    else if (anyAttribute.Name == \"partitioning\")\n                    {\n                        // Spacing execution modes are only valid on TessellationEvaluation\n                        // per SPIR-V spec, but HLSL puts [partitioning] on the hull shader.\n                        // Emit the mode on DSMain's function id so the SPIR-V is spec-compliant.\n                        context.Add(new OpExecutionMode(GetTessEvaluationFunctionId(table, function.Id), ((StringLiteral)anyAttribute.Parameters[0]).Value switch\n                        {\n                            \"fractional_odd\" => Specification.ExecutionMode.SpacingFractionalOdd,\n                            \"fractional_even\" => Specification.ExecutionMode.SpacingFractionalEven,\n                            \"integer\" => Specification.ExecutionMode.SpacingEqual,\n                            \"pow2\" => throw new NotSupportedException(\"partitioning pow2 is not supported in SPIR-V\"),\n                            _ => throw new NotSupportedException($\"Unsupported partitioning value '{((StringLiteral)anyAttribute.Parameters[0]).Value}'\"),\n                        }, []));\n                    }\n                    else if (anyAttribute.Name == \"outputtopology\")","sourceCodeStart":557,"sourceCodeEnd":593,"githubUrl":"https://github.com/stride3d/stride/blob/96fad776d210c221682aac1ccdf4c79dc046fc38/sources/shaders/Stride.Shaders.Parsers/Parsing/SDSL/AST/ShaderElements.MethodOrMember.cs#L557-L593","documentation":"The [domain(...)] attribute on a tessellation stage accepts only 'tri', 'quad', or 'isolines'. Any other string has no SPIR-V ExecutionMode mapping, so the compiler throws NotSupportedException while emitting OpExecutionMode.","triggerScenarios":"A hull-shader method annotated with e.g. [domain(point)] or a case-mismatched value like [domain(Triangle)].","commonSituations":"Porting DirectX hull shader [domain(\"...\")] values whose casing differs ('Tri' vs 'tri'), or typos in the attribute string.","solutions":["Use one of the exact lowercase values: tri, quad, or isolines.","Fix casing/typos in the domain attribute string.","Restructure the tessellation setup if the desired domain is not representable in SPIR-V."],"exampleFix":"// before\n[domain(\"Triangle\")]\n// after\n[domain(\"tri\")]","handlingStrategy":"validation","validationCode":"var domains = new HashSet<string> { \"tri\", \"quad\", \"isolines\" };\nif (!domains.Contains(domainValue)) throw new ArgumentException($\"Invalid domain '{domainValue}'\");","typeGuard":null,"tryCatchPattern":"try { method.Compile(); }\ncatch (NotSupportedException ex) when (ex.Message.Contains(\"Unsupported domain value\"))\n{\n    // correct the domain attribute to tri/quad/isolines\n}","preventionTips":["Use only the exact lowercase domain strings tri, quad, isolines.","When porting HLSL, normalize domain casing during conversion."],"tags":["shader","sdsl","tessellation","attributes"],"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"}