stride3d/stride · error · NotSupportedException
Multisample is only supported for 2D Render Target Textures
Error message
Multisample is only supported for 2D Render Target Textures
What it means
For a single (ArraySize == 1) render-target texture that is multisampled, the D3D12 backend uses a Texture2DMS RTV, which only exists for 2D textures. A multisampled 1D or 3D render target has no matching D3D12 view dimension, so InitializeFromImpl throws.
Solutions
- Use Dimension = TextureDimension.Texture2D for any multisampled render target.
- Set MultisampleCount = MultisampleCount.None on non-2D render targets.
- Render into a plain 1D/3D target without MSAA, or resolve from a 2D MSAA source.
Example fix
// before var desc = TextureDescription.New1D(1024, PixelFormat.R8G8B8A8.UNorm, usage: GraphicsResourceUsage.RenderTarget); desc.MultisampleCount = MultisampleCount.X8; // after var desc = TextureDescription.New1D(1024, PixelFormat.R8G8B8A8.UNorm, usage: GraphicsResourceUsage.RenderTarget); desc.MultisampleCount = MultisampleCount.None;
Defensive patterns
Strategy: validation
Validate before calling
if (desc.IsRenderTarget && desc.MultisampleCount > MultisampleCount.None && desc.Dimension != TextureDimension.Texture2D)
throw new InvalidOperationException("MSAA render targets must be 2D textures."); Try / catch
try { texture.InitializeFrom(device, desc); }
catch (NotSupportedException ex) { logger.Warn(ex); desc.MultisampleCount = MultisampleCount.None; texture.InitializeFrom(device, desc); } Prevention
- Only enable MultisampleCount on Texture2D render targets.
- Add a debug-time assertion in texture factory helpers.
- Keep MSAA configuration in a single settings object that enforces the 2D-only rule.
When it happens
Trigger: Creating a Texture with ArraySize == 1, MultisampleCount > MultisampleCount.None, IsRenderTarget true, and Dimension equal to Texture1D or Texture3D.
Common situations: Enabling MSAA on a 1D gradient/lookup render target; leaving a global MultisampleCount setting enabled while switching a render target to 3D; template-based texture creation that copies MSAA flags.
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
- Multi-sampling is only supported for 2D Textures
- Multi-sampling is only supported for 2D Render Target…
- Expecting texture supporting UAV
- Source Texture is not a MSAA Texture
- The Graphics Resource is a Texture, but its dimension is…
AI-assisted analysis of stride3d/stride@96fad776d2 (2026-09-14).
Data as JSON: /api/errors/b89c9fe1b2be3da8.
Report an issue: GitHub.
Appendix: source
Thrown at sources/engine/Stride.Graphics/Direct3D12/Texture.Direct3D12.cs:710
throw new NotSupportedException("Texture Array is not supported for 3D Textures");
}
rtvDescription.ViewDimension = Dimension is TextureDimension.Texture2D or TextureDimension.TextureCube
? RtvDimension.Texture2Darray
: RtvDimension.Texture1Darray;
// Use rtvDescription.Texture1DArray as it matches also Texture memory layout
rtvDescription.Texture1DArray.ArraySize = (uint) arrayCount;
rtvDescription.Texture1DArray.FirstArraySlice = (uint) arrayOrDepthSlice;
rtvDescription.Texture1DArray.MipSlice = (uint) mipIndex;
}
}
else // Regular Texture (1D, 2D, 3D)
{
if (IsMultiSampled)
{
if (Dimension != TextureDimension.Texture2D)
{
throw new NotSupportedException("Multisample is only supported for 2D Render Target Textures");
}
rtvDescription.ViewDimension = RtvDimension.Texture2Dms;
}
else // Non-multisampled Texture
{
switch (Dimension)
{
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;
case TextureDimension.Texture3D:View on GitHub (pinned to 96fad776d2)