stride3d/stride · error · NotSupportedException

partitioning pow2 is not supported in SPIR-V

Error message

partitioning pow2 is not supported in SPIR-V

What it means

The [partitioning(...)] value 'pow2' has no corresponding SPIR-V spacing execution mode (only SpacingFractionalOdd, SpacingFractionalEven, SpacingEqual exist), so the compiler explicitly rejects it with NotSupportedException.

Solutions

  1. Change the partitioning to 'integer', 'fractional_even', or 'fractional_odd'.
  2. Pick 'fractional_even' as the closest visual approximation to pow2.
  3. Adjust tessellation factors in shader code to compensate for the changed partitioning scheme.

Example fix

// before
[partitioning("pow2")]
// after
[partitioning("fractional_even")]
Defensive patterns

Strategy: fallback

Validate before calling

if (partitioning == "pow2") partitioning = "fractional_even"; // SPIR-V has no pow2 spacing mode

Try / catch

try { method.Compile(); }
catch (NotSupportedException ex) when (ex.Message.Contains("pow2 is not supported"))
{
    // fall back to fractional_even or integer partitioning
}

Prevention

When it happens

Trigger: A tessellation stage annotated [partitioning(pow2)], which is legal in HLSL/D3D11 but has no SPIR-V equivalent.

Common situations: Porting D3D11 hull shaders that used pow2 partitioning directly to the SPIR-V backend.

Related errors


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

Appendix: source

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

                            {
                                "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}'"),
                            }, []));
                        }
                    }

View on GitHub (pinned to 96fad776d2)