{"record":{"id":"e9c751e1f7e87aa0","repo":"stride3d/stride","slug":"unsupported-integer-suffix","errorCode":null,"errorMessage":"Unsupported integer suffix","messagePattern":"Unsupported integer suffix","errorType":"validation","errorClass":"NotImplementedException","httpStatus":null,"severity":"error","filePath":"sources/shaders/Stride.Shaders.Parsers/Spirv/Building/Context.Constants.cs","lineNumber":371,"sourceCode":"        return result;\n    }\n\n    public static ScalarType ComputeLiteralType(Literal literal)\n    {\n        return literal switch\n        {\n            BoolLiteral lit => ScalarType.Boolean,\n            IntegerLiteral lit => lit.Suffix switch\n            {\n                //{ Signed: true, Size: 8 } => ScalarType.SByte,\n                //{ Signed: true, Size: 16 } => ScalarType.Short,\n                { Signed: true, Size: 32 } => ScalarType.Int,\n                { Signed: true, Size: 64 } => ScalarType.Int64,\n                //{ Signed: false, Size: 8 } => ScalarType.UByte,\n                //{ Signed: false, Size: 16 } => ScalarType.UShort,\n                { Signed: false, Size: 32 } => ScalarType.UInt,\n                { Signed: false, Size: 64 } => ScalarType.UInt64,\n                _ => throw new NotImplementedException(\"Unsupported integer suffix\")\n            },\n            FloatLiteral lit => lit.Suffix.Size switch\n            {\n                //16 => ScalarType.Half,\n                32 => ScalarType.Float,\n                64 => ScalarType.Double,\n                _ => throw new NotImplementedException(\"Unsupported float\")\n            },\n            _ => throw new NotSupportedException($\"Unsupported literal type: {literal.GetType()}\"),\n        };\n    }\n}\n","sourceCodeStart":353,"sourceCodeEnd":384,"githubUrl":"https://github.com/stride3d/stride/blob/96fad776d210c221682aac1ccdf4c79dc046fc38/sources/shaders/Stride.Shaders.Parsers/Spirv/Building/Context.Constants.cs#L353-L384","documentation":"ComputeLiteralType maps an IntegerLiteral's suffix (bit Size and Signedness) to a ScalarType. 8-bit and 16-bit signed/unsigned arms are commented out, and only 32/64-bit are handled; any other suffix combination (e.g. Size 8 or 16, or an invalid Size like 48) throws NotImplementedException('Unsupported integer suffix').","triggerScenarios":"Creating an IntegerLiteral with Suffix Size 8 or 16 (whose mapping to ScalarType.SByte/Short/UByte/UShort is commented out) or a non-standard Size, then letting ComputeLiteralType run (literal.Type not pre-set) via CompileConstantLiteral.","commonSituations":"Constructing IntegerLiteral(new(8,...), ...) or new(16,...) for byte/short constants and passing them to CompileConstantLiteral without pre-assigning literal.Type; custom literal construction in tooling code.","solutions":["Use 32-bit or 64-bit integer literal suffixes (new(32,...) or new(64,...)) when creating IntegerLiterals for this pipeline","Pre-assign literal.Type before calling CompileConstantLiteral so ComputeLiteralType is skipped (literal.Type ??= ... in CompileConstantLiteral)","Uncomment/restore the 8/16-bit arms in ComputeLiteralType (Context.Constants.cs lines 363-368) if small integer types are needed"],"exampleFix":"// before\nvar lit = new IntegerLiteral(new(16, false, true), someShort, location);\nCompileConstantLiteral(lit); // throws: Unsupported integer suffix\n// after\nvar lit = new IntegerLiteral(new(32, false, true), (int)someShort, location);\nCompileConstantLiteral(lit); // ScalarType.Int","handlingStrategy":"validation","validationCode":"bool IsSupportedIntSuffix(LiteralSuffix s) =>\n    (s.Size == 32 || s.Size == 64) && (s.Signed || !s.Signed);","typeGuard":"static bool IsInt32Or64(IntegerLiteral l) => l.Suffix.Size is 32 or 64;","tryCatchPattern":"try\n{\n    var result = context.CompileConstantLiteral(intLiteral);\n}\ncatch (NotImplementedException ex) when (ex.Message == \"Unsupported integer suffix\")\n{\n    // widen to 32-bit and retry\n    var widened = new IntegerLiteral(new(32, false, intLiteral.Suffix.Signed), intLiteral.IntValue, default);\n    var result = context.CompileConstantLiteral(widened);\n}","preventionTips":["Use 32/64-bit suffixes when creating IntegerLiterals for SPIR-V emission","Set literal.Type explicitly if you need small-integer semantics so ComputeLiteralType is bypassed","Avoid byte/sbyte/short/ushort literals until the commented 8/16-bit arms are restored","Verify Suffix.Size is never 0 or a non-power-of-two value"],"tags":["literal","integer-suffix","not-implemented","shader-compilation"],"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-23T08:17:48.524Z"}