{"record":{"id":"462d1a57bd1b3e52","repo":"stride3d/stride","slug":"stream-stream-value-name-readby-is-expected-as-a-vertex","errorCode":null,"errorMessage":"Stream '{stream.Value.Name}'{readBy} is expected as a vertex shader input and is never written by any shader stage before being read. Without a semantic it cannot be sourced from a vertex buffer, so it has to be produced by a shader: write to streams.{stream.Value.Name} before reading it, or give it a semantic if it really is a vertex buffer input.","messagePattern":"Stream '(.+?)'(.+?) is expected as a vertex shader input and is never written by any shader stage before being read\\. Without a semantic it cannot be sourced from a vertex buffer, so it has to be produced by a shader: write to streams\\.(.+?) before reading it, or give it a semantic if it really is a vertex buffer input\\.","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"sources/shaders/Stride.Shaders.Parsers/Spirv/Processing/Interfaces/InterfaceProcessor.cs","lineNumber":342,"sourceCode":"                            {\n                                stream.Value.Output = true;\n                                requirePosition = false;\n                            }\n                        }\n                    }\n\n                    entryPoints.Add(GenerateStreamWrapper(table, buffer, context, ExecutionModel.Vertex, entryPointVS, analysisResult, liveAnalysis, true));\n\n                    // Process shader input attributes\n                    foreach (var stream in streams)\n                    {\n                        // Note: built-ins won't have a inputLayoutLocation so they will be skipped\n                        if (stream.Value.Input && stream.Value.InputLayoutLocation is { } inputLayoutLocation)\n                        {\n                            if (stream.Value.Semantic == null)\n                            {\n                                var readBy = stream.Value.ReadByMethod is { } m ? $\" (read by '{m}')\" : \"\";\n                                throw new InvalidOperationException(\n                                    $\"Stream '{stream.Value.Name}'{readBy} is expected as a vertex shader input and is never written by any shader stage before being read. \" +\n                                    $\"Without a semantic it cannot be sourced from a vertex buffer, so it has to be produced by a shader: \" +\n                                    $\"write to streams.{stream.Value.Name} before reading it, or give it a semantic if it really is a vertex buffer input.\");\n                            }\n                            var semantic = SemanticAnalyzer.ParseSemantic(stream.Value.Semantic);\n                            inputAttributes.Add(new ShaderInputAttributeDescription { Location = inputLayoutLocation, SemanticName = semantic.Name, SemanticIndex = semantic.Index });\n                        }\n                    }\n                }\n            }\n\n            // Emit all OpEntryPoints (deferred to allow fixups like adding dummy DS inputs for HS-internal outputs)\n            foreach (var ep in entryPoints)\n                context.Add(new OpEntryPoint(ep.Model, ep.Id, ep.Name, [.. ep.InterfaceVariables]));\n\n            // Entry points had their geometry stream parameter removed as their wrapper was\n            // generated; any other method carrying one has to lose it too.\n            RemoveGeometryStreamParameters(buffer, context);","sourceCodeStart":324,"sourceCodeEnd":360,"githubUrl":"https://github.com/stride3d/stride/blob/96fad776d210c221682aac1ccdf4c79dc046fc38/sources/shaders/Stride.Shaders.Parsers/Spirv/Processing/Interfaces/InterfaceProcessor.cs#L324-L360","documentation":"After stream analysis, InterfaceProcessor.Process builds the vertex input layout from streams read by the vertex shader. A stream that is a vertex-shader input with an input-layout location but no semantic cannot come from a vertex buffer, so it must be produced by an earlier stage; since no stage writes it before being read, the processor throws with the stream name and reading method.","triggerScenarios":"MergeSDSL where the vertex entry point reads a streams.X member that (a) has no Semantic attached and (b) is never written by any earlier stage — e.g. a stream declared as input and read in VSMain without ever being assigned.","commonSituations":"Forgetting to assign a streams field in a previous stage or in the vertex shader itself; typo in the stream name so the write targets a different member; porting HLSL code where the semantic attribute was lost; a mixin expects another mixin to write the stream but is not composed in.","solutions":["Write to the stream before reading it, e.g. assign streams.MyValue at the top of VSMain or in an earlier stage","Add a semantic (e.g. [Semantic(\"POSITION\")] / SV semantics) to the stream member so it is treated as a vertex-buffer input","Check the composition for the missing mixin that was supposed to produce this stream, or fix the stream-name typo"],"exampleFix":"// before\nstruct StreamsOutput { [Location(0)] float4 Value; } // no semantic, never written\npublic override void Main() { float4 v = streams.Value; }\n// after\nstruct StreamsOutput { [Location(0)][Semantic(\"POSITION\")] float4 Value; }\npublic override void Main() { streams.Value = float4(0,0,0,1); float4 v = streams.Value; }","handlingStrategy":"validation","validationCode":"// Static review helper: every stream read in VSMain must be written or carry a semantic\nforeach (var stream in vertexInputs)\n{\n    if (!stream.IsWrittenByAnyStage && string.IsNullOrEmpty(stream.Semantic))\n        throw new InvalidOperationException($\"Stream '{stream.Name}' has no semantic and no producer; add [Semantic(...)] or write to streams.{stream.Name} before reading.\");\n}","typeGuard":null,"tryCatchPattern":"try\n{\n    mixer.MergeSDSL(shaderSource, options, log, out var bytecode, out _, out _, out _);\n}\ncatch (InvalidOperationException ex) when (ex.Message.Contains(\"expected as a vertex shader input\"))\n{\n    log.Error(\"Unsourced vertex stream: \" + ex.Message);\n}","preventionTips":["Assign every streams member before reading it in the vertex shader","Give vertex-buffer-sourced streams explicit [Semantic] attributes","After renaming streams, grep all stages for reads of the old name","Verify every mixin that promises to produce a stream is actually composed in"],"tags":["spirv","shader-compilation","vertex-input","missing-semantic"],"backgroundTag":"missing-required-argument","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"}