stride3d/stride · error · NotSupportedException
Unsupported parameter modifier
Error message
Unsupported parameter modifier '{str}' What it means
ToParameterModifiers is an extension method that maps SDSL parameter modifier keywords (in, out, inout, const, point, line, lineadj, triangle, triangleadj) to the ParameterModifiers enum. When the parser encounters a modifier token not in this switch table, it throws NotSupportedException naming the offending token. It indicates the shader source uses a parameter modifier the current parser does not recognize.
Solutions
- Check the exact modifier string in the message and correct the typo or remove the unsupported modifier from the shader source.
- If the modifier is a legitimate keyword, extend the switch in ToParameterModifiers (sources/shaders/Stride.Shaders.Parsers/Parsing/SDSL/AST/ShaderElements.cs:138) with a new ParameterModifiers case.
- Move semantics expressed by unsupported modifiers (e.g. interpolation modifiers) to attributes or TypeModifiers where the parser actually supports them.
Example fix
// before (shader source)
float4 main(linear float3 pos : POSITION) : SV_Position { ... }
// after — remove or use a supported modifier
float4 main(float3 pos : POSITION) : SV_Position { ... } Defensive patterns
Strategy: validation
Validate before calling
var supported = new[] { "in", "out", "inout", "const", "point", "line", "lineadj", "triangle", "triangleadj" };
if (!supported.Contains(modifier)) throw new FormatException($"Modifier '{modifier}' is not a supported SDSL parameter modifier"); Type guard
bool IsValidParameterModifier(string? m) => m is "in" or "out" or "inout" or "const" or "point" or "line" or "lineadj" or "triangle" or "triangleadj";
Try / catch
try { mods = str.ToParameterModifiers(); }
catch (NotSupportedException ex) { log(ex.Message); /* skip token or report diagnostic */ } Prevention
- Validate modifier tokens against the supported list before invoking parser APIs.
- Keep shaders free of HLSL-only interpolation modifiers on parameters.
- When the SDSL grammar changes, update the modifier table alongside it.
When it happens
Trigger: Parsing a shader whose stage parameter declarations contain a modifier string outside the nine handled keywords, e.g. an unsupported HLSL/SPIR-V modifier or a typo such as 'inoutt'.
Common situations: Porting HLSL shaders using modifiers not yet supported by the SDSL front-end (e.g. 'linear', 'nointerpolation', 'centroid' applied to parameters), typos in shader source, or new language keywords added to the grammar before this mapping was extended.
Related errors
- Attribute is not supported
- cbuffer have a mix of stage and non-stage members
- foreach: Array type is expected
- foreach: collection and variable type not matching
- Assign back to matrix swizzle is not implemented yet
AI-assisted analysis of stride3d/stride@96fad776d2 (2026-09-14).
Data as JSON: /api/errors/d6fa417f97090e34.
Report an issue: GitHub.
Appendix: source
Thrown at sources/shaders/Stride.Shaders.Parsers/Parsing/SDSL/AST/ShaderElements.cs:151
"column_major" => TypeModifier.ColumnMajor,
_ => TypeModifier.None
};
}
public static ParameterModifiers ToParameterModifiers(this string str)
{
return str switch
{
"in" => ParameterModifiers.In,
"out" => ParameterModifiers.Out,
"inout" => ParameterModifiers.InOut,
"const" => ParameterModifiers.Const,
"point" => ParameterModifiers.Point,
"line" => ParameterModifiers.Line,
"lineadj" => ParameterModifiers.LineAdjacency,
"triangle" => ParameterModifiers.Triangle,
"triangleadj" => ParameterModifiers.TriangleAdjacency,
_ => throw new NotSupportedException($"Unsupported parameter modifier '{str}'"),
};
}
}
public partial class TypeDef(TypeName type, Identifier name, TextLocation info) : ShaderElement(info)
{
public Identifier Name { get; set; } = name;
public TypeName TypeName { get; set; } = type;
public override string ToString()
{
return $"typedef {TypeName} {Name}";
}
}
public abstract class ShaderBuffer : ShaderElement
{
public string Name { get; set; }View on GitHub (pinned to 96fad776d2)