stride3d/stride · error · NotSupportedException

Unsupported partitioning value

Error message

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

What it means

The [partitioning(...)] attribute only recognizes 'fractional_odd', 'fractional_even', 'integer' (and 'pow2', which is explicitly rejected). Any other string has no SPIR-V spacing ExecutionMode and throws NotSupportedException from the switch's default arm.

Solutions

  1. Use one of the exact values: fractional_odd, fractional_even, integer (pow2 throws separately).
  2. Fix casing and spelling in the attribute string.
  3. Check the SPIR-V spacing execution modes to confirm the intended value.

Example fix

// before
[partitioning("equal")]
// after
[partitioning("integer")]
Defensive patterns

Strategy: validation

Validate before calling

var valid = new HashSet<string> { "fractional_odd", "fractional_even", "integer" };
if (!valid.Contains(partitioningValue)) throw new ArgumentException($"Unsupported partitioning '{partitioningValue}'");

Try / catch

try { method.Compile(); }
catch (NotSupportedException ex) when (ex.Message.Contains("Unsupported partitioning value"))
{
    // fix the attribute string to a supported partitioning value
}

Prevention

When it happens

Trigger: A tessellation stage annotated with a misspelled or unrecognized partitioning value, e.g. [partitioning(fractional)], [partitioning(equal)], or wrong casing.

Common situations: Porting FX/HLSL tessellation state blocks with different partitioning spellings, or typos when hand-writing the attribute.

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/b0a9c7dd6dd4b5fd. Report an issue: GitHub.

Appendix: source

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

                                "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")
                    {
                        var value = ((StringLiteral)anyAttribute.Parameters[0]).Value;
                        if (value != "line")
                        {
                            // VertexOrderCw/Ccw are only valid on TessellationEvaluation per
                            // SPIR-V spec; route to DSMain (same reason as partitioning above).
                            context.Add(new OpExecutionMode(GetTessEvaluationFunctionId(table, function.Id), ((StringLiteral)anyAttribute.Parameters[0]).Value switch
                            {
                                "triangle_cw" => Specification.ExecutionMode.VertexOrderCw,
                                "triangle_ccw" => Specification.ExecutionMode.VertexOrderCcw,
                                _ => throw new NotSupportedException($"Unsupported output topology value '{((StringLiteral)anyAttribute.Parameters[0]).Value}'"),
                            }, []));
                        }
                    }
                    else

View on GitHub (pinned to 96fad776d2)