stride3d/stride · error · ArgumentOutOfRangeException
Source texture is not a MSAA texture.
Error message
Source texture is not a MSAA texture.
What it means
MSAAResolver exists to convert a multisampled (MSAA) texture into a regular resolved texture. DrawCore validates input.IsMultiSampled and throws ArgumentOutOfRangeException when the source texture is NOT multisampled, because the MSAA-resolve shader is meaningless (and would sample garbage) on a plain texture.
Solutions
- Create the source render target with MultisampleCount > 1 so it is genuinely an MSAA texture.
- Enable MSAA in the game settings / GraphicsDevice profile so upstream targets are multisampled.
- Remove or bypass MSAAResolver when the pipeline is not using MSAA.
Example fix
// before var target = PushRenderTexture(width, height); // non-MSAA resolver.SetInput(0, target, null); // after var msaaTarget = PushRenderTexture(width, height, 0, PixelFormat.R8G8B8A8_UNorm, TextureFlags.ShaderResource | TextureFlags.RenderTarget, 4); // 4x MSAA resolver.SetInput(0, msaaTarget, null);
Defensive patterns
Strategy: validation
Validate before calling
if (!input.IsMultiSampled)
throw new InvalidOperationException("MSAAResolver input must be an MSAA texture");
resolver.SetInput(0, input, null); Type guard
bool IsMsaaSource(Texture t) => t != null && t.IsMultiSampled;
Try / catch
try { resolver.SetInput(0, texture, null); }
catch (ArgumentOutOfRangeException ex) { Log.Error("Input texture must be MSAA; enable MSAA or remove resolver.", ex); } Prevention
- Create source targets with MultisampleCount > 1 whenever MSAA is enabled.
- Check GraphicsProfile / anti-aliasing settings match pipeline expectations.
- Bypass MSAAResolver entirely when MSAA is disabled.
When it happens
Trigger: Assigning a non-MSAA texture (MultisampleCount == 1 / IsMultiSampled == false) to MSAAResolver's input slot 0 and rendering.
Common situations: MSAA disabled in the graphics profile/device settings so the color target is created single-sampled; binding the already-resolved output of a previous resolve pass back into the resolver; switching anti-aliasing mode from MSAA to FXAA/none without removing the resolver from the compositing graph.
Understand the failure class
Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.
Related errors
AI-assisted analysis of stride3d/stride@96fad776d2 (2026-09-14).
Data as JSON: /api/errors/a1b8e9e32d256fab.
Report an issue: GitHub.
Appendix: source
Thrown at sources/engine/Stride.Rendering/Rendering/Compositing/MSAAResolver.cs:153
}
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");
// Resolve using custom pixel shader (output depth only)
msaaDepthResolver.DepthStencilState = new DepthStencilStateDescription(true, true) { DepthBufferFunction = CompareFunction.Always };
msaaDepthResolver.Parameters.Set(MSAAResolverParams.MSAASamples, samplesCount);View on GitHub (pinned to 96fad776d2)