stride3d/stride · error · ArgumentNullException

input

Error message

input

What it means

Inside DrawCore (an ImageEffect stage), the MSAA resolver requires input slot 0 to be a multisampled source texture and output slot 0 to be non-null. This ArgumentNullException is thrown when GetInput(0) returns null — no texture was bound to the effect's first input before the resolve pass ran.

Solutions

  1. Ensure the upstream MSAA render pass writes its color target and it is bound via SetInput(0, texture) before Draw
  2. Verify the compositing stage order: render to MSAA target, then MSAAResolver, then output
  3. Null-check/diagnose the compositing graph — a null input usually indicates a missing/renamed upstream stage

Example fix

// before
resolver.Draw(context); // input 0 never bound
// after
resolver.SetInput(0, msaaColorTarget, context.Parameters);
resolver.Draw(context);
Defensive patterns

Strategy: validation

Validate before calling

var input = resolver.GetInput(0);
if (input == null || !input.IsMultiSampled)
    throw new InvalidOperationException("MSAA resolver input 0 must be a bound MSAA texture before Draw.");

Type guard

static bool HasValidMsaaInput(ImageEffectShader resolver) =>
    resolver.GetInput(0) is { } tex && tex.IsMultiSampled;

Try / catch

try { resolver.Draw(drawContext); }
catch (ArgumentNullException ex) when (ex.ParamName == "input") {
    // upstream MSAA pass did not run or was not bound; fix compositing graph
}

Prevention

When it happens

Trigger: Running the MSAAResolver compositor when input 0 was never set (upstream pass produced no texture, or SetInput wasn't called); pipeline wired with a missing render stage.

Common situations: Misconfigured compositing graph where an upstream pass is disabled or renamed so the MSAA input is never produced; camera/render stage wiring mistakes.

Related errors


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

Appendix: source

Thrown at sources/engine/Stride.Rendering/Rendering/Compositing/MSAAResolver.cs:149

        {
            SetInput(0, input);
            SetOutput(output);
            Draw(drawContext);
        }

        protected override void InitializeCore()
        {
            base.InitializeCore();
            ToLoadAndUnload(msaaResolver);
            ToLoadAndUnload(msaaDepthResolver);
        }

        protected override void DrawCore(RenderDrawContext drawContext)
        {
            var input = GetInput(0);
            var output = GetOutput(0);
            if (input == null)
                throw new ArgumentNullException(nameof(input));
            if (output == null)
                throw new ArgumentNullException(nameof(output));
            if (!input.IsMultiSampled)
                throw new ArgumentOutOfRangeException(nameof(input), "Source texture is not a MSAA texture.");
            if (output.IsMultiSampled)
                throw new ArgumentOutOfRangeException(nameof(input), "Destination texture is a MSAA texture.");

            // Prepare
            int samplesCount = (int)input.MultisampleCount;
            var inputSize = input.Size;
            // SvPosUnpack = float4(float2(0.5, -0.5) * TextureSize, float2(0.5, 0.5) * TextureSize))
            // TextureSizeLess1 = TextureSize - 1
            var svPosUnpack = new Vector4(0.5f * inputSize.Width, -0.5f * inputSize.Height, 0.5f * inputSize.Width, 0.5f * inputSize.Height);
            var textureSizeLess1 = new Vector2(inputSize.Width - 1.0f, inputSize.Height - 1.0f);

            if (input.IsDepthStencil)
            {
                System.Diagnostics.Debug.Assert(output.IsDepthStencil, "input and output IsDepthStencil don't match");

View on GitHub (pinned to 96fad776d2)