stride3d/stride · error · NotSupportedException

Unsupported domain value

Error message

Unsupported domain value '{((StringLiteral)anyAttribute.Parameters[0]).Value}'

What it means

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.

Solutions

  1. Use one of the exact lowercase values: tri, quad, or isolines.
  2. Fix casing/typos in the domain attribute string.
  3. Restructure the tessellation setup if the desired domain is not representable in SPIR-V.

Example fix

// before
[domain("Triangle")]
// after
[domain("tri")]
Defensive patterns

Strategy: validation

Validate before calling

var domains = new HashSet<string> { "tri", "quad", "isolines" };
if (!domains.Contains(domainValue)) throw new ArgumentException($"Invalid domain '{domainValue}'");

Try / catch

try { method.Compile(); }
catch (NotSupportedException ex) when (ex.Message.Contains("Unsupported domain value"))
{
    // correct the domain attribute to tri/quad/isolines
}

Prevention

When it happens

Trigger: A hull-shader method annotated with e.g. [domain(point)] or a case-mismatched value like [domain(Triangle)].

Common situations: Porting DirectX hull shader [domain("...")] values whose casing differs ('Tri' vs 'tri'), or typos in the attribute string.

Understand the failure class

Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.

Related errors


AI-assisted analysis of stride3d/stride@96fad776d2 (2026-09-14). Data as JSON: /api/errors/e242bc7738731d53. Report an issue: GitHub.

Appendix: source

Thrown at sources/shaders/Stride.Shaders.Parsers/Parsing/SDSL/AST/ShaderElements.MethodOrMember.cs:575

                    else if (anyAttribute.Name == "patchconstantfunc")
                    {
                        context.Add(new OpDecorateString(function.Id, Specification.Decoration.PatchConstantFuncSDSL, ((StringLiteral)anyAttribute.Parameters[0]).Value));
                    }
                    else if (anyAttribute.Name == "domain")
                    {
                        // Triangles/Quads/Isolines are valid on either TCS or TES per spec.
                        // We emit them only on DSMain (TES), matching glslang's convention
                        // and keeping the SPIR-V minimal. HLSL's [domain] on HS is therefore
                        // skipped here; HLSL also requires [domain] on DS, so DSMain's own
                        // [domain] attribute guarantees the mode ends up in the module.
                        if (EntryPoint != EntryPoint.HullShader)
                        {
                            context.Add(new OpExecutionMode(function.Id, ((StringLiteral)anyAttribute.Parameters[0]).Value switch
                            {
                                "tri" => Specification.ExecutionMode.Triangles,
                                "quad" => Specification.ExecutionMode.Quads,
                                "isolined" => Specification.ExecutionMode.Isolines,
                                _ => throw new NotSupportedException($"Unsupported domain value '{((StringLiteral)anyAttribute.Parameters[0]).Value}'"),
                            }, []));
                        }
                    }
                    else if (anyAttribute.Name == "partitioning")
                    {
                        // Spacing execution modes are only valid on TessellationEvaluation
                        // per SPIR-V spec, but HLSL puts [partitioning] on the hull shader.
                        // Emit the mode on DSMain's function id so the SPIR-V is spec-compliant.
                        context.Add(new OpExecutionMode(GetTessEvaluationFunctionId(table, function.Id), ((StringLiteral)anyAttribute.Parameters[0]).Value switch
                        {
                            "fractional_odd" => Specification.ExecutionMode.SpacingFractionalOdd,
                            "fractional_even" => Specification.ExecutionMode.SpacingFractionalEven,
                            "integer" => Specification.ExecutionMode.SpacingEqual,
                            "pow2" => throw new NotSupportedException("partitioning pow2 is not supported in SPIR-V"),
                            _ => throw new NotSupportedException($"Unsupported partitioning value '{((StringLiteral)anyAttribute.Parameters[0]).Value}'"),
                        }, []));
                    }
                    else if (anyAttribute.Name == "outputtopology")

View on GitHub (pinned to 96fad776d2)