{"record":{"id":"99bed01ade86c958","repo":"stride3d/stride","slug":"partitioning-pow2-is-not-supported-in-spir-v","errorCode":null,"errorMessage":"partitioning pow2 is not supported in SPIR-V","messagePattern":"partitioning pow2 is not supported in SPIR-V","errorType":"exception","errorClass":"NotSupportedException","httpStatus":null,"severity":"error","filePath":"sources/shaders/Stride.Shaders.Parsers/Parsing/SDSL/AST/ShaderElements.MethodOrMember.cs","lineNumber":589,"sourceCode":"                            {\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\")\n                    {\n                        var value = ((StringLiteral)anyAttribute.Parameters[0]).Value;\n                        if (value != \"line\")\n                        {\n                            // VertexOrderCw/Ccw are only valid on TessellationEvaluation per\n                            // SPIR-V spec; route to DSMain (same reason as partitioning above).\n                            context.Add(new OpExecutionMode(GetTessEvaluationFunctionId(table, function.Id), ((StringLiteral)anyAttribute.Parameters[0]).Value switch\n                            {\n                                \"triangle_cw\" => Specification.ExecutionMode.VertexOrderCw,\n                                \"triangle_ccw\" => Specification.ExecutionMode.VertexOrderCcw,\n                                _ => throw new NotSupportedException($\"Unsupported output topology value '{((StringLiteral)anyAttribute.Parameters[0]).Value}'\"),\n                            }, []));\n                        }\n                    }","sourceCodeStart":571,"sourceCodeEnd":607,"githubUrl":"https://github.com/stride3d/stride/blob/96fad776d210c221682aac1ccdf4c79dc046fc38/sources/shaders/Stride.Shaders.Parsers/Parsing/SDSL/AST/ShaderElements.MethodOrMember.cs#L571-L607","documentation":"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.","triggerScenarios":"A tessellation stage annotated [partitioning(pow2)], which is legal in HLSL/D3D11 but has no SPIR-V equivalent.","commonSituations":"Porting D3D11 hull shaders that used pow2 partitioning directly to the SPIR-V backend.","solutions":["Change the partitioning to 'integer', 'fractional_even', or 'fractional_odd'.","Pick 'fractional_even' as the closest visual approximation to pow2.","Adjust tessellation factors in shader code to compensate for the changed partitioning scheme."],"exampleFix":"// before\n[partitioning(\"pow2\")]\n// after\n[partitioning(\"fractional_even\")]","handlingStrategy":"fallback","validationCode":"if (partitioning == \"pow2\") partitioning = \"fractional_even\"; // SPIR-V has no pow2 spacing mode","typeGuard":null,"tryCatchPattern":"try { method.Compile(); }\ncatch (NotSupportedException ex) when (ex.Message.Contains(\"pow2 is not supported\"))\n{\n    // fall back to fractional_even or integer partitioning\n}","preventionTips":["Avoid pow2 partitioning when targeting SPIR-V; use fractional_even or integer.","Adjust tessellation factors in code when migrating from D3D11 pow2 partitioning."],"tags":["shader","sdsl","tessellation","spirv","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"}