{"record":{"id":"8b711323705ba7cf","repo":"stride3d/stride","slug":"source-texture-is-not-a-msaa-texture","errorCode":null,"errorMessage":"Source Texture is not a MSAA Texture","messagePattern":"Source Texture is not a MSAA Texture","errorType":"exception","errorClass":"ArgumentException","httpStatus":null,"severity":"error","filePath":"sources/engine/Stride.Graphics/Direct3D11/CommandList.Direct3D11.cs","lineNumber":1128,"sourceCode":"        ///          <list type=\"bullet\">\n        ///            <item>The source (or destination) format could be <see cref=\"PixelFormat.R16G16B16A16_UNorm\"/>.</item>\n        ///            <item>The destination (or source) format could be <see cref=\"PixelFormat.R16G16B16A16_Float\"/>.</item>\n        ///          </list>\n        ///        </para>\n        ///      </description>\n        ///    </item>\n        ///   </list>\n        /// </remarks>\n        public void CopyMultisample(Texture sourceMultiSampledTexture, int sourceSubResourceIndex,\n                                     Texture destinationTexture, int destinationSubResourceIndex,\n                                     PixelFormat format = PixelFormat.None)\n        {\n            ArgumentNullException.ThrowIfNull(sourceMultiSampledTexture);\n            ArgumentNullException.ThrowIfNull(destinationTexture);\n            RecordDebugCounter(DebugCounterKind.Copy);\n\n            if (!sourceMultiSampledTexture.IsMultiSampled)\n                throw new ArgumentException(\"Source Texture is not a MSAA Texture\", nameof(sourceMultiSampledTexture));\n\n            nativeDeviceContext->ResolveSubresource(destinationTexture.NativeResource, (uint) destinationSubResourceIndex,\n                                                    sourceMultiSampledTexture.NativeResource, (uint) sourceSubResourceIndex,\n                                                    (Format)(format == PixelFormat.None ? destinationTexture.Format : format));\n        }\n\n        /// <summary>\n        ///   Copies a region from a source Graphics Resource to a destination Graphics Resource.\n        /// </summary>\n        /// <param name=\"source\">The source Graphics Resource to copy from.</param>\n        /// <param name=\"sourceSubResourceIndex\">The index of the sub-resource of <paramref name=\"source\"/> to copy from.</param>\n        /// <param name=\"sourceRegion\">\n        ///   <para>\n        ///     An optional <see cref=\"ResourceRegion\"/> that defines the source sub-resource to copy from.\n        ///     Specify <see langword=\"null\"/> the entire source sub-resource is copied.\n        ///   </para>\n        ///   <para>\n        ///     An empty region makes this method to not perform a copy operation.","sourceCodeStart":1110,"sourceCodeEnd":1146,"githubUrl":"https://github.com/stride3d/stride/blob/96fad776d210c221682aac1ccdf4c79dc046fc38/sources/engine/Stride.Graphics/Direct3D11/CommandList.Direct3D11.cs#L1110-L1146","documentation":"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'.","triggerScenarios":"Calling commandList.Resolve(sourceTexture, destTexture, ...) where sourceTexture.IsMultiSampled is false, i.e. the source was created with MSAALevel.None (1 sample).","commonSituations":"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.","solutions":["Pass an MSAA texture (MsaalLevel > 1) as the source; verify sourceMultiSampledTexture.IsMultiSampled first.","If both textures are single-sampled and same size, use Copy instead of Resolve.","Fix argument order if the single-sampled texture was accidentally passed as source."],"exampleFix":"// before\ncommandList.Resolve(singleSampledTexture, resolveTarget, PixelFormat.None);\n// after\nif (source.IsMultiSampled)\n    commandList.Resolve(source, resolveTarget, PixelFormat.None);\nelse\n    commandList.Copy(source, resolveTarget);","handlingStrategy":"type-guard","validationCode":"if (!source.IsMultiSampled)\n    throw new InvalidOperationException(\"Resolve requires an MSAA source texture; use Copy for single-sampled resources\");\ncommandList.Resolve(source, destination, PixelFormat.None);","typeGuard":"static bool CanResolve(Texture source) => source is not null && source.IsMultiSampled;","tryCatchPattern":"try { commandList.Resolve(source, dest, PixelFormat.None); }\ncatch (ArgumentException ex) when (ex.ParamName == \"sourceMultiSampledTexture\") { commandList.Copy(source, dest); }","preventionTips":["Check source.IsMultiSampled before calling Resolve.","Keep MSAA state in one settings object that controls both creation and resolve paths.","Use Copy for single-sampled same-format copies; Resolve only for MSAA downsampling."],"tags":["direct3d11","graphics","msaa","resolve","invalid-argument"],"backgroundTag":"incompatible-source-type","analyzedSha":"96fad776d210c221682aac1ccdf4c79dc046fc38","analyzedAt":"2026-09-14T02:59:31.279Z","contentChangedAt":"2026-09-14T02:59:31.279Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}