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 requires the source texture to be multisampled (MSAA), since ResolveSubresource downsamples an MSAA resource into a single-sampled one. Passing a non-MSAA source throws an ArgumentException naming 'sourceMultiSampledTexture'.

Solutions

  1. Pass an MSAA texture (MsaalLevel > 1) as the source; verify sourceMultiSampledTexture.IsMultiSampled first.
  2. If both textures are single-sampled and same size, use Copy instead of Resolve.
  3. Fix argument order if the single-sampled texture was accidentally passed as source.

Example fix

// before
commandList.Resolve(singleSampledTexture, resolveTarget, PixelFormat.None);
// after
if (source.IsMultiSampled)
    commandList.Resolve(source, resolveTarget, PixelFormat.None);
else
    commandList.Copy(source, resolveTarget);
Defensive patterns

Strategy: type-guard

Validate before calling

if (!source.IsMultiSampled)
    throw new InvalidOperationException("Resolve requires an MSAA source texture; use Copy for single-sampled resources");
commandList.Resolve(source, destination, PixelFormat.None);

Type guard

static bool CanResolve(Texture source) => source is not null && source.IsMultiSampled;

Try / catch

try { commandList.Resolve(source, dest, PixelFormat.None); }
catch (ArgumentException ex) when (ex.ParamName == "sourceMultiSampledTexture") { commandList.Copy(source, dest); }

Prevention

When it happens

Trigger: Calling commandList.Resolve(sourceTexture, destTexture, ...) where sourceTexture.IsMultiSampled is false, i.e. the source was created with MSAALevel.None (1 sample).

Common situations: Shared resolve helpers invoked for both MSAA and non-MSAA targets; an MSAA setting toggled off elsewhere (quality settings) while the resolve path remained; swapping source/destination arguments so a single-sampled texture lands in the source slot.

Understand the failure class

Background: "is not a compatible type" / "cannot merge" errors: when a value's type doesn't match what the library requires — this error's family across 65 libraries.

Related errors


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

Appendix: source

Thrown at sources/engine/Stride.Graphics/Direct3D11/CommandList.Direct3D11.cs:1128

        ///          <list type="bullet">
        ///            <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));

            nativeDeviceContext->ResolveSubresource(destinationTexture.NativeResource, (uint) destinationSubResourceIndex,
                                                    sourceMultiSampledTexture.NativeResource, (uint) sourceSubResourceIndex,
                                                    (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.
        ///     Specify <see langword="null"/> the entire source sub-resource is copied.
        ///   </para>
        ///   <para>
        ///     An empty region makes this method to not perform a copy operation.

View on GitHub (pinned to 96fad776d2)