stride3d/stride · error · NotSupportedException
Multi-sampling is only supported for 2D Render Target…
Error message
Multi-sampling is only supported for 2D Render Target Textures
What it means
For a regular texture (ArraySize <= 1) bound as a render target, multi-sampling is only representable in D3D11 via the Texture2DMS RTV dimension. Stride throws this NotSupportedException when an RTV is requested for a multi-sampled texture whose ViewDimension is not Texture2D.
Solutions
- Set ViewDimension/Dimension to TextureDimension.Texture2D for any multi-sampled render target.
- Remove multi-sampling (MultisampleCount.None) if a 1D/3D render target is genuinely required.
Example fix
// before desc.Dimension = TextureDimension.Texture1D; desc.MultisampleCount = MultisampleCount.X8; desc.Flags = TextureFlags.RenderTarget; // after desc.Dimension = TextureDimension.Texture2D; desc.MultisampleCount = MultisampleCount.X8; desc.Flags = TextureFlags.RenderTarget;
Defensive patterns
Strategy: validation
Validate before calling
if (desc.MultisampleCount > MultisampleCount.None && desc.Dimension != TextureDimension.Texture2D && (desc.Flags & TextureFlags.RenderTarget) != 0)
throw new InvalidOperationException("MSAA render targets must be 2D"); Type guard
bool IsMsaaRenderTargetSafe(TextureDescription d) =>
d.MultisampleCount == MultisampleCount.None ||
(d.Dimension == TextureDimension.Texture2D && (d.Flags & TextureFlags.RenderTarget) != 0) ||
(d.Flags & TextureFlags.RenderTarget) == 0; Prevention
- Validate dimension when changing MultisampleCount on existing descriptions.
- Centralize MSAA render-target creation in one helper that enforces Texture2D.
When it happens
Trigger: Creating a multi-sampled texture (MultisampleCount > None) with ViewDimension = Texture1D or Texture3D and ArraySize <= 1, then using it as a render target; a description where Dimension and MultisampleCount are set inconsistently.
Common situations: Hand-built TextureDescription for a post-process MSAA target where the Dimension field was copied from another texture; changing MultisampleCount on an existing description without checking the dimension; serialization round-trips that lost the Texture2D dimension.
Understand the failure class
Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.
Related errors
- Texture Array is not supported for 3D Textures
- Multi-sampling is only supported for 2D Textures
- . is not supported for Render Targets
- Multi-sampling is not supported for Unordered Access Views
- Multisample is only supported for 2D Render Target Textures
AI-assisted analysis of stride3d/stride@96fad776d2 (2026-09-14).
Data as JSON: /api/errors/b2ae578faaee6fde.
Report an issue: GitHub.
Appendix: source
Thrown at sources/engine/Stride.Graphics/Direct3D11/Texture.Direct3D11.cs:649
}
rtvDescription.ViewDimension = Dimension is TextureDimension.Texture2D or TextureDimension.TextureCube
? RtvDimension.Texture2Darray
: RtvDimension.Texture1Darray;
// Use rtvDescription.Texture1DArray as it matches also Texture2DArray memory layout
rtvDescription.Texture1DArray.ArraySize = (uint) arrayCount;
rtvDescription.Texture1DArray.FirstArraySlice = (uint) arrayOrDepthSlice;
rtvDescription.Texture1DArray.MipSlice = (uint) mipIndex;
}
}
else // Regular Texture Array
{
if (IsMultiSampled)
{
if (ViewDimension != TextureDimension.Texture2D)
{
throw new NotSupportedException("Multi-sampling is only supported for 2D Render Target Textures");
}
rtvDescription.ViewDimension = RtvDimension.Texture2Dms;
}
else // Not multi-sampled
{
switch (ViewDimension)
{
case TextureDimension.Texture1D:
rtvDescription.ViewDimension = RtvDimension.Texture1D;
rtvDescription.Texture1D.MipSlice = (uint) mipIndex;
break;
case TextureDimension.Texture2D:
rtvDescription.ViewDimension = RtvDimension.Texture2D;
rtvDescription.Texture2D.MipSlice = (uint) mipIndex;
break;
View on GitHub (pinned to 96fad776d2)