{"record":{"id":"dd051b02e07b7087","repo":"stride3d/stride","slug":"unsupported-geometry-input-execution-mode-executionmode","errorCode":null,"errorMessage":"Unsupported geometry input execution mode: {executionMode}","messagePattern":"Unsupported geometry input execution mode: (.+?)","errorType":"validation","errorClass":"NotSupportedException","httpStatus":null,"severity":"error","filePath":"sources/shaders/Stride.Shaders.Parsers/Spirv/Processing/Interfaces/Generation/EntryPointWrapperGenerator.cs","lineNumber":371,"sourceCode":"                if (executionMode == ParameterModifiers.None)\n                    throw new InvalidOperationException(\"Execution mode primitive is missing for first parameter of geometry shader\");\n\n                // Extract output topology from the GeometryStreamType parameter before removing it\n                var outputStreamType = ((PointerType)entryPointFunctionType.ParameterTypes[1].Type).BaseType as GeometryStreamType\n                    ?? throw new InvalidOperationException(\"Second parameter of geometry shader must be a GeometryStreamType\");\n\n                entryPointFunctionType.ParameterTypes[0] = entryPointFunctionType.ParameterTypes[0] with { Modifiers = ParameterModifiers.None };\n                entryPointFunctionType.ParameterTypes.RemoveAt(1);\n\n                context.ReplaceType(entryPointFunctionType, entryPointTypeId);\n                context.Add(new OpExecutionMode(entryPoint.IdRef, executionMode switch\n                {\n                    ParameterModifiers.Point => ExecutionMode.InputPoints,\n                    ParameterModifiers.Line => ExecutionMode.InputLines,\n                    ParameterModifiers.LineAdjacency => ExecutionMode.InputLinesAdjacency,\n                    ParameterModifiers.Triangle => ExecutionMode.Triangles,\n                    ParameterModifiers.TriangleAdjacency => ExecutionMode.InputTrianglesAdjacency,\n                    _ => throw new NotSupportedException($\"Unsupported geometry input execution mode: {executionMode}\"),\n                }, []));\n                context.Add(new OpExecutionMode(entryPoint.IdRef, outputStreamType.Kind switch\n                {\n                    GeometryStreamOutputKindSDSL.Point => ExecutionMode.OutputPoints,\n                    GeometryStreamOutputKindSDSL.Line => ExecutionMode.OutputLineStrip,\n                    GeometryStreamOutputKindSDSL.Triangle => ExecutionMode.OutputTriangleStrip,\n                    _ => throw new NotSupportedException($\"Unsupported geometry stream output kind: {outputStreamType.Kind}\"),\n                }, []));\n\n                arguments[0] = inputsVariable;\n\n                // Call main(inputs) without 2nd argument\n                buffer.Add(new OpFunctionCall(voidType, context.Bound++, entryPoint.IdRef, [arguments[0], .. arguments[2..]]));\n            }\n        }\n        else\n        {\n            // We assume a void returning function and Input/Output is all handled with streams","sourceCodeStart":353,"sourceCodeEnd":389,"githubUrl":"https://github.com/stride3d/stride/blob/96fad776d210c221682aac1ccdf4c79dc046fc38/sources/shaders/Stride.Shaders.Parsers/Spirv/Processing/Interfaces/Generation/EntryPointWrapperGenerator.cs#L353-L389","documentation":"After reading the input primitive modifier from the first GS parameter, the generator maps it to a SPIR-V input execution mode via a switch over ParameterModifiers: Point, Line, LineAdjacency, Triangle, TriangleAdjacency. Any other modifier value (including compound or unexpected modifier flags) hits the default arm and throws this NotSupportedException. It guards against emitting an invalid OpExecutionMode.","triggerScenarios":"The first parameter of a geometry shader carries a modifier that is non-None (passing the earlier check) but not one of the five recognized primitive modifiers — e.g. a combined/flag value, an 'out' modifier on the input parameter, or a custom modifier added in a newer SDSL version that this switch doesn't handle.","commonSituations":"Custom SDSL dialects adding new primitive modifiers; modifier flags accidentally OR-combined (e.g. In | Point) so the exact-match switch arms fail; version skew between shader parser and generator where a modifier enum was extended.","solutions":["Use exactly one recognized primitive modifier on the GS input parameter: point, line, lineadj, triangle, or triangleadj","Remove any extra modifier flags accidentally combined onto the parameter (exact switch matching means In|Point will not match Point)","If a new modifier kind is legitimate, extend the switch in EntryPointWrapperGenerator.cs to map it to the corresponding SPIR-V ExecutionMode"],"exampleFix":"// before (combined modifiers fail the exact match)\nvoid GSMain(in triangle StreamsInputStream inputs, TriangleStream<GSOutput> outStream)\n// after\nvoid GSMain(triangle StreamsInputStream inputs, TriangleStream<GSOutput> outStream)","handlingStrategy":"type-guard","validationCode":"var m = entryPointFunctionType.ParameterTypes[0].Modifiers;\nbool ok = m is ParameterModifiers.Point or ParameterModifiers.Line or ParameterModifiers.LineAdjacency\n    or ParameterModifiers.Triangle or ParameterModifiers.TriangleAdjacency;","typeGuard":"static bool IsExactPrimitiveModifier(ParameterModifiers m) => m is\n    ParameterModifiers.Point or ParameterModifiers.Line or ParameterModifiers.LineAdjacency\n    or ParameterModifiers.Triangle or ParameterModifiers.TriangleAdjacency; // exact, no combined flags","tryCatchPattern":"try { wrapperGen.GenerateWrapper(...); }\ncatch (NotSupportedException ex) when (ex.Message.Contains(\"Unsupported geometry input execution mode\"))\n{\n    // report: unrecognized/combined modifier on GS input parameter\n}","preventionTips":["Use exactly one primitive modifier; avoid OR-combining flags like In|Triangle","Keep modifier enums in sync across parser and generator versions","Exact-match guard the modifier before generation"],"tags":["shader-compilation","spirv","geometry-shader","unsupported-value","enum"],"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-15T23:17:13.987Z"}