{"record":{"id":"79bb36f2e64150d7","repo":"stride3d/stride","slug":"unsupported-int-vector-size-v-length","errorCode":null,"errorMessage":"Unsupported int vector size: {v.Length}","messagePattern":"Unsupported int vector size: (.+?)","errorType":"exception","errorClass":"NotSupportedException","httpStatus":null,"severity":"error","filePath":"sources/shaders/Stride.Shaders.Compilers/SDSL/ShaderMixer.CBuffers.cs","lineNumber":648,"sourceCode":"            if (value is not ConstantVector cv)\n                return value;\n\n            var v = cv.Values;\n            return v[0] switch\n            {\n                float => v.Length switch\n                {\n                    2 => new Vector2((float)v[0], (float)v[1]),\n                    3 => new Vector3((float)v[0], (float)v[1], (float)v[2]),\n                    4 => (object)new Vector4((float)v[0], (float)v[1], (float)v[2], (float)v[3]),\n                    _ => throw new NotSupportedException($\"Unsupported float vector size: {v.Length}\"),\n                },\n                int => v.Length switch\n                {\n                    2 => new Int2((int)v[0], (int)v[1]),\n                    3 => new Int3((int)v[0], (int)v[1], (int)v[2]),\n                    4 => (object)new Int4((int)v[0], (int)v[1], (int)v[2], (int)v[3]),\n                    _ => throw new NotSupportedException($\"Unsupported int vector size: {v.Length}\"),\n                },\n                uint => v.Length switch\n                {\n                    4 => (object)new UInt4((uint)v[0], (uint)v[1], (uint)v[2], (uint)v[3]),\n                    _ => throw new NotSupportedException($\"Unsupported uint vector size: {v.Length}\"),\n                },\n                _ => throw new NotSupportedException($\"Unsupported constant composite element type: {v[0]?.GetType()}\"),\n            };\n        }\n    }\n}\n","sourceCodeStart":630,"sourceCodeEnd":660,"githubUrl":"https://github.com/stride3d/stride/blob/96fad776d210c221682aac1ccdf4c79dc046fc38/sources/shaders/Stride.Shaders.Compilers/SDSL/ShaderMixer.CBuffers.cs#L630-L660","documentation":"ConvertDefaultValue only supports int vectors of length 2, 3, or 4 (Int2/Int3/Int4). An int-typed constant composite with any other component count falls through to the switch default and throws NotSupportedException.","triggerScenarios":"An int cbuffer member default with component count 1 or >4 (e.g. int5 composite); generated shader code emitting arbitrarily sized int composites that reach ComputeCBufferReflection.","commonSituations":"ivec1-style constructs ported from GLSL; codegen tools emitting int arrays as single composites; hand-written large int tuples used as defaults.","solutions":["Use int2/int3/int4 for the default value","Replace 1-component composites with a plain int scalar","Split bigger composites into multiple supported vectors"],"exampleFix":"// before\nint1 Flags = int1(3);\n// after\nint Flags = 3;","handlingStrategy":"validation","validationCode":"if (elemType == \"int\" && composite.Length is < 2 or > 4)\n    throw new ArgumentException(\"int default vectors must have 2-4 components\");","typeGuard":null,"tryCatchPattern":"try { result = mixer.MergeSDSL(tree); }\ncatch (NotSupportedException ex) when (ex.Message.StartsWith(\"Unsupported int vector size\")) {\n    fixDefaultValueType(memberName);\n}","preventionTips":["Use plain int for single values","Keep int default vectors at 2-4 components","Check generated shader code for oversized composites"],"tags":["shaders","sdsl","default-values","vectors"],"backgroundTag":"unsupported-dtype","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"}