stride3d/stride · error · NotSupportedException
Unsupported integer type: width=
Error message
Unsupported integer type: width={intInstruction.Width}, signed={intInstruction.Signedness == 1} What it means
Thrown in ProcessNameAndTypes when translating an OpTypeInt SPIR-V instruction whose bit width / signedness combination is not one of the four supported integer types (32-bit or 64-bit, signed or unsigned). The SPIR-V module contains an integer type the SDSL type system cannot represent.
Solutions
- Regenerate/normalize the SPIR-V to use 32-bit (or 64-bit) integers only
- Avoid enabling 8/16-bit integer features in the producing compiler for code crossing this boundary
- Extend the mapping in ProcessNameAndTypes if narrow integer support is required
Example fix
// before %int8 = OpTypeInt 8 0 // unsupported width // after %int = OpTypeInt 32 0
Defensive patterns
Strategy: validation
Validate before calling
if (intInstruction.Width is not (32 or 64))
throw new NotSupportedException($"Only 32/64-bit integers supported, got {intInstruction.Width}"); Type guard
bool IsSupportedInt(uint width) => width is 32 or 64;
Try / catch
try { ProcessNameAndTypes(...); }
catch (NotSupportedException ex) { log.Error($"SPIR-V integer type unsupported: {ex.Message}"); throw; } Prevention
- Produce SPIR-V with 32-bit integers only
- Disable shaderInt8/shaderInt16 features in producing compilers
- Validate imported SPIR-V modules before processing
When it happens
Trigger: Processing an imported/generated SPIR-V module containing OpTypeInt with Width 8, 16, or any value other than 32/64 (e.g. 8-bit or 16-bit integers from external SPIR-V, or Signedness values other than 0/1 producing odd width data).
Common situations: Importing SPIR-V produced by other toolchains using 8/16-bit integer types (e.g. with shaderInt8/shaderInt16 features enabled); hand-authored or third-party SPIR-V binaries; interface-mismatch when mixing SPIR-V modules from different generators.
Related errors
- 64bit integers
- Binary operator not supported for element type
- BuildInheritanceListWithoutSelf: OpMixinInheritSDSL…
- Can't add type
- Can't cast between array of different sizes
AI-assisted analysis of stride3d/stride@96fad776d2 (2026-09-14).
Data as JSON: /api/errors/db143abc02e2e18e.
Report an issue: GitHub.
Appendix: source
Thrown at sources/shaders/Stride.Shaders.Parsers/Parsing/SDSL/AST/Shader.cs:171
RegisterType(floatInstruction.ResultId, floatInstruction.Width switch
{
16 => ScalarType.Half,
32 => ScalarType.Float,
64 => ScalarType.Double,
_ => throw new InvalidOperationException(),
});
}
else if (instruction.Op == Op.OpTypeInt)
{
OpTypeInt intInstruction = instruction;
RegisterType(intInstruction.ResultId, (intInstruction.Width, intInstruction.Signedness == 1) switch
{
(32, true) => ScalarType.Int,
(32, false) => ScalarType.UInt,
(64, true) => ScalarType.Int64,
(64, false) => ScalarType.UInt64,
_ => throw new NotSupportedException($"Unsupported integer type: width={intInstruction.Width}, signed={intInstruction.Signedness == 1}"),
});
}
else if (instruction.Op == Op.OpTypeBool)
{
OpTypeBool boolInstruction = instruction;
RegisterType(boolInstruction.ResultId, ScalarType.Boolean);
}
else if (instruction.Op == Op.OpTypePointer && (OpTypePointer)instruction is { } pointerInstruction)
{
var innerType = context.ReverseTypes[pointerInstruction.Type];
RegisterType(pointerInstruction.ResultId, new PointerType(innerType, pointerInstruction.StorageClass));
}
else if (instruction.Op == Op.OpTypeVoid && (OpTypeVoid)instruction is { } voidInstruction)
{
RegisterType(voidInstruction.ResultId, ScalarType.Void);
}
else if (instruction.Op == Op.OpTypeVector && (OpTypeVector)instruction is { } vectorInstruction)
{View on GitHub (pinned to 96fad776d2)