stride3d/stride · error · ArgumentException
Source Texture is not a MSAA Texture
Error message
Source Texture is not a MSAA Texture
What it means
CommandList.Resolve(sourceMultiSampledTexture, ...) performs an MSAA resolve on D3D12 via ResolveSubresource. It throws ArgumentException when the source texture's IsMultiSampled is false, because resolving a non-multisampled resource is meaningless on D3D12 and would fail at the native level.
Solutions
- Pass a texture created with MultiSampleCount > 1 as the source.
- Check source.IsMultiSampled before calling Resolve and branch to a plain Copy for non-MSAA sources.
- Verify source/destination arguments were not swapped.
Example fix
// before var src = Texture.New2D(device, w, h, fmt, TextureFlags.RenderTarget); // not MSAA commandList.Resolve(src, dst, 0); // throws // after var src = Texture.New2D(device, w, h, fmt, TextureFlags.RenderTarget, 4); // 4x MSAA commandList.Resolve(src, dst, 0);
Defensive patterns
Strategy: validation
Validate before calling
if (sourceMultiSampledTexture == null || destinationTexture == null)
throw new ArgumentNullException(nameof(sourceMultiSampledTexture));
if (!sourceMultiSampledTexture.IsMultiSampled)
throw new InvalidOperationException("Resolve requires a multisampled source texture"); Type guard
bool IsMsaaSource(Texture t) => t != null && t.IsMultiSampled;
Try / catch
try
{
commandList.Resolve(source, destination, subResourceIndex);
}
catch (ArgumentException ex) when (ex.ParamName == nameof(sourceMultiSampledTexture))
{
commandList.Copy(source, destination, subResourceIndex); // non-MSAA fallback path
} Prevention
- Create MSAA render targets with MultiSampleCount > 1 when a resolve will follow.
- Branch between Resolve and Copy based on IsMultiSampled at a single helper method.
- Check that source/destination arguments were not swapped at call sites.
When it happens
Trigger: Calling CommandList.Resolve(source, destination, ...) where source.MultiSampleCount is 1 / TextureFlags not created with multisampling — i.e. a plain single-sample texture passed as the MSAA source.
Common situations: Passing the wrong texture (the resolved target instead of the MSAA source) after swapping arguments; MSAA disabled in device settings but resolve path still executed; textures created without TextureFlags or multisample count > 1.
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
- Expecting texture supporting UAV
- The Graphics Resource is a Texture, but its dimension is…
- Multisample is only supported for 2D Textures
- Multisample is only supported for 2D Textures
- Multisample is only supported for 2D RenderTarget Textures
AI-assisted analysis of stride3d/stride@96fad776d2 (2026-09-14).
Data as JSON: /api/errors/8a30e7ecae4e9da6.
Report an issue: GitHub.
Appendix: source
Thrown at sources/engine/Stride.Graphics/Direct3D12/CommandList.Direct3D12.cs:1656
/// <item>The source (or destination) format could be <see cref="PixelFormat.R16G16B16A16_UNorm"/>.</item>
/// <item>The destination (or source) format could be <see cref="PixelFormat.R16G16B16A16_Float"/>.</item>
/// </list>
/// </para>
/// </description>
/// </item>
/// </list>
/// </remarks>
public void CopyMultisample(Texture sourceMultiSampledTexture, int sourceSubResourceIndex,
Texture destinationTexture, int destinationSubResourceIndex,
PixelFormat format = PixelFormat.None)
{
ArgumentNullException.ThrowIfNull(sourceMultiSampledTexture);
ArgumentNullException.ThrowIfNull(destinationTexture);
RecordDebugCounter(DebugCounterKind.Copy);
if (!sourceMultiSampledTexture.IsMultiSampled)
throw new ArgumentException("Source Texture is not a MSAA Texture", nameof(sourceMultiSampledTexture));
ResourceBarrierTransition(sourceMultiSampledTexture, BarrierLayout.ResolveSource);
ResourceBarrierTransition(destinationTexture, BarrierLayout.ResolveDest);
FlushResourceBarriers();
currentCommandList.NativeCommandList.ResolveSubresource(sourceMultiSampledTexture.NativeResource, (uint) sourceSubResourceIndex,
destinationTexture.NativeResource, (uint) destinationSubResourceIndex,
(Format)(format == PixelFormat.None ? destinationTexture.Format : format));
}
/// <summary>
/// Copies a region from a source Graphics Resource to a destination Graphics Resource.
/// </summary>
/// <param name="source">The source Graphics Resource to copy from.</param>
/// <param name="sourceSubResourceIndex">The index of the sub-resource of <paramref name="source"/> to copy from.</param>
/// <param name="sourceRegion">
/// <para>
/// An optional <see cref="ResourceRegion"/> that defines the source sub-resource to copy from.View on GitHub (pinned to 96fad776d2)