stride3d/stride · error · NotSupportedException

StreamType [ ] is not supported

Error message

StreamType [{0}] is not supported

What it means

The same SetStream flow converts a MaterialStreamType into the swizzle (channel mask) used by MaterialSurfaceSetStreamFromComputeColor. If the stream type is not Float, Float2, Float3, or Float4, it throws NotSupportedException naming the unsupported stream type.

Solutions

  1. Use MaterialStreamType.Float, Float2, Float3, or Float4 for the stream
  2. Change the stream's declared type in the shader to a supported float-vector type
  3. Add a case for the extra stream type in MaterialBlendLayerContext if you own the code
  4. Print streamType in your code to confirm which value is being passed

Example fix

// before: unsupported integer stream type
context.SetStream(stage, "IndexStream", MaterialStreamType.Int, classSource);
// after: use a float stream
context.SetStream(stage, "IndexStream", MaterialStreamType.Float, classSource);
Defensive patterns

Strategy: validation

Validate before calling

if (streamType is not (MaterialStreamType.Float or MaterialStreamType.Float2 or MaterialStreamType.Float3 or MaterialStreamType.Float4))
    throw new InvalidOperationException($"StreamType {streamType} not supported");

Type guard

bool IsSupportedStreamType(MaterialStreamType t) =>
    t is MaterialStreamType.Float or MaterialStreamType.Float2 or MaterialStreamType.Float3 or MaterialStreamType.Float4;

Prevention

When it happens

Trigger: Calling SetStream with a MaterialStreamType outside the supported set (e.g. Half, Double, Int types, or a matrix type), so the channel switch falls through to default.

Common situations: Manually specifying a MaterialStreamType for a custom stream with a type the material system cannot map to a swizzle; passing a wrong enum value from custom blend layer code.

Related errors


AI-assisted analysis of stride3d/stride@96fad776d2 (2026-09-14). Data as JSON: /api/errors/1b21c6579f2289c7. Report an issue: GitHub.

Appendix: source

Thrown at sources/engine/Stride.Rendering/Rendering/Materials/MaterialBlendLayerContext.cs:131

            }

            string channel;
            switch (streamType)
            {
                case MaterialStreamType.Float:
                    channel = "r";
                    break;
                case MaterialStreamType.Float2:
                    channel = "rg";
                    break;
                case MaterialStreamType.Float3:
                    channel = "rgb";
                    break;
                case MaterialStreamType.Float4:
                    channel = "rgba";
                    break;
                default:
                    throw new NotSupportedException("StreamType [{0}] is not supported".ToFormat(streamType));
            }

            var mixin = new ShaderMixinSource();
            mixin.Mixins.Add(new ShaderClassSource("MaterialSurfaceSetStreamFromComputeColor", stream, channel));
            mixin.AddComposition("computeColorSource", classSource);

            GetContextPerStage(stage).ShaderSources.Add(mixin);
        }

        public ShaderSource GenerateStreamInitializers(MaterialShaderStage stage)
        {
            // Early exit if nothing to do
            var stageContext = GetContextPerStage(stage);
            if (stageContext.StreamInitializers.Count == 0 && stageContext.ShaderSources.Count == 0 && stage != MaterialShaderStage.Pixel)
            {
                return null;
            }

View on GitHub (pinned to 96fad776d2)