{"record":{"id":"46ed9efc73f4c95d","repo":"stride3d/stride","slug":"unsupported-size-permutation-value-name","errorCode":null,"errorMessage":"Unsupported size permutation value '{name}'","messagePattern":"Unsupported size permutation value '(.+?)'","errorType":"exception","errorClass":"NotSupportedException","httpStatus":null,"severity":"error","filePath":"sources/shaders/Stride.Shaders.Parsers/Parsing/SDSL/AST/IntrinsicTemplateExpander.cs","lineNumber":83,"sourceCode":"            {\n                List<BaseTypePermutationGenerator> baseTypePermutationGenerators = new();\n                List<SizePermutationGenerator> sizePermutationGenerators = new();\n\n                void AddVectorSizePermutation(int argument, int templateIndex, string name)\n                {\n                    SizePermutationGenerator? permutation;\n\n                    // name can be either a value (1,2,3,4,any) or a name (when multiple slots adjusted with same permutation, in which case value is [1,2,3,4]).\n                    switch (name)\n                    {\n                        case \"1\" or \"2\" or \"3\" or \"4\":\n                            permutation = new SizePermutationGenerator(null, name switch\n                            {\n                                \"1\" => [1],\n                                \"2\" => [2],\n                                \"3\" => [3],\n                                \"4\" => [4],\n                                _ => throw new NotSupportedException($\"Unsupported size permutation value '{name}'\"),\n                            }, new());\n                            sizePermutationGenerators.Add(permutation);\n                            break;\n                        default:\n                            // use name as key (and find existing one if already declared)\n                            // For \"any\", we use a synthetic key per dimension so that all <> occurrences\n                            // share the same size permutation (e.g. f16tof32: float<> and uint<> must match)\n                            var key = name == \"any\" ? $\"__any{templateIndex}\" : name;\n                            permutation = sizePermutationGenerators.FirstOrDefault(x => x.Name == key);\n                            if (permutation == null)\n                            {\n                                permutation = new SizePermutationGenerator(key, [1, 2, 3, 4], new());\n                                sizePermutationGenerators.Add(permutation);\n                            }\n                            break;\n                    }\n\n                    permutation.Locations.Add((argument, templateIndex));","sourceCodeStart":65,"sourceCodeEnd":101,"githubUrl":"https://github.com/stride3d/stride/blob/96fad776d210c221682aac1ccdf4c79dc046fc38/sources/shaders/Stride.Shaders.Parsers/Parsing/SDSL/AST/IntrinsicTemplateExpander.cs#L65-L101","documentation":"IntrinsicTemplateExpander expands SDSL intrinsic template declarations, and numeric placeholders like <1>..<4> create SizePermutationGenerators that expand the intrinsic over those vector sizes. When a numeric placeholder name is not 1, 2, 3 or 4, the expander cannot build a size permutation and throws NotSupportedException naming the offending placeholder.","triggerScenarios":"Declaring an intrinsic template with a size placeholder of 0, 5+, or another non-1..4 numeric value (e.g. MyIntrinsic<float, x> with x = 5), so the size permutation generator has no valid vector sizes to expand.","commonSituations":"Typing a wrong dimension in an intrinsic template; assuming vector sizes beyond 4 are supported in SDSL (they are not, unlike some other shading languages); copy-pasted template declarations edited to an invalid size.","solutions":["Use size placeholders 1, 2, 3, or 4 only in intrinsic template declarations.","If you need larger dimensions, implement the intrinsic without size-permutation templating or expand it manually.","For 'any' sizing, use the designated any/dimension syntax instead of a literal number outside 1..4.","If a new size should be legal, extend the switch in TryGetOrGenerateIntrinsicsDefinition to accept it."],"exampleFix":"// before (SDSL intrinsic template)\n<5> MyIntrinsic(...); // throws: Unsupported size permutation value '5'\n// after\n<4> MyIntrinsic(...); // or <2>/<3> etc.","handlingStrategy":"validation","validationCode":"bool IsValidSizePermutation(string name) =>\n    name is \"1\" or \"2\" or \"3\" or \"4\";\n\n// pre-check when parsing intrinsic templates:\nif (!IsValidSizePermutation(name))\n    throw new ArgumentException($\"Size placeholder must be 1-4, got '{name}'\");","typeGuard":null,"tryCatchPattern":"try { expander.TryGetOrGenerateIntrinsicsDefinition(...); }\ncatch (NotSupportedException ex) { /* report the template declaration with the bad size */ }","preventionTips":["Use only size placeholders 1-4 in intrinsic templates","Use the 'any' syntax for dimension-generic intrinsics","Validate template declarations in shader authoring lint before compilation"],"tags":["shader","sdsl","templates","permutation"],"backgroundTag":"invalid-argument-value","analyzedSha":"96fad776d210c221682aac1ccdf4c79dc046fc38","analyzedAt":"2026-09-14T02:59:31.279Z","contentChangedAt":"2026-09-14T02:59:31.279Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}