stride3d/stride · error · NotSupportedException

Texture Array is not supported for 3D Textures

Error message

Texture Array is not supported for 3D Textures

What it means

A non-multisampled render-target texture with ArraySize > 1 maps to a Texture2DArray/Texture1DArray RTV in D3D12. D3D12 has no arrayed RTV dimension for 3D textures, so when Dimension is Texture3D and ArraySize > 1 the backend throws during InitializeFromImpl.

Solutions

  1. Set ArraySize = 1 for 3D render-target textures; encode layers in the texture's depth instead.
  2. Use a 2D texture array (Dimension = Texture2D) if you need multiple renderable layers.
  3. Render volumetric data by slicing: bind individual Z slices via a 2D view or use compute shaders with UAVs instead.

Example fix

// before
var desc = TextureDescription.New3D(128, 128, 64, false, PixelFormat.R16G16B16A16.Float);
desc.ArraySize = 4;
// after
var desc = TextureDescription.New3D(128, 128, 64, false, PixelFormat.R16G16B16A16.Float);
desc.ArraySize = 1;
Defensive patterns

Strategy: validation

Validate before calling

if (desc.IsRenderTarget && desc.ArraySize > 1 && desc.Dimension == TextureDimension.Texture3D)
    throw new InvalidOperationException("3D render targets cannot have ArraySize > 1.");

Try / catch

try { texture.InitializeFrom(device, desc); }
catch (NotSupportedException) { desc.ArraySize = 1; texture.InitializeFrom(device, desc); }

Prevention

When it happens

Trigger: Creating a 3D texture (TextureDescription.New3D or Dimension = Texture3D) with ArraySize > 1 and IsRenderTarget true, then initializing it on the Direct3D12 device.

Common situations: Confusing the depth dimension of a 3D texture (DimensionCount/Z) with array slices; setting ArraySize on a volumetric render target by mistake; porting Vulkan-style 3D-array images.

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


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

Appendix: source

Thrown at sources/engine/Stride.Graphics/Direct3D12/Texture.Direct3D12.cs:692

                // Initialize for Texture Arrays or Texture Cube
                if (ArraySize > 1)
                {
                    if (MultisampleCount > MultisampleCount.None)
                    {
                        if (Dimension != TextureDimension.Texture2D)
                        {
                            throw new NotSupportedException("Multisample is only supported for 2D Textures");
                        }
                        rtvDescription.ViewDimension = RtvDimension.Texture2Dmsarray;
                        rtvDescription.Texture2DMSArray.ArraySize = (uint)arrayCount;
                        rtvDescription.Texture2DMSArray.FirstArraySlice = (uint)arrayOrDepthSlice;
                    }
                    else // Non-multisampled
                    {
                        if (Dimension == TextureDimension.Texture3D)
                        {
                            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");

View on GitHub (pinned to 96fad776d2)