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

When creating an RTV for a non-multi-sampled texture with ArraySize > 1, a 3D texture cannot have an array view: D3D11 has no Texture3DArray view dimension. Stride throws this NotSupportedException when ViewDimension is Texture3D while ArraySize > 1.

Solutions

  1. Use TextureDimension.Texture2D with ArraySize > 1 for a 2D texture array instead of Texture3D.
  2. Set ArraySize = 1 (or leave default) on 3D textures used as render targets.

Example fix

// before
var desc = TextureDescription.New3D(256, 256, 64, false, PixelFormat.R8G8B8A8_UNorm,
    TextureFlags.RenderTarget);
desc.ArraySize = 4;
// after
var desc = TextureDescription.New2D(256, 256, PixelFormat.R8G8B8A8_UNorm,
    TextureFlags.RenderTarget, arraySize: 4);
Defensive patterns

Strategy: validation

Validate before calling

if (desc.Dimension == TextureDimension.Texture3D && desc.ArraySize > 1 && (desc.Flags & TextureFlags.RenderTarget) != 0)
    throw new InvalidOperationException("3D textures cannot be texture arrays for RTVs");

Type guard

bool IsValid3dRenderTarget(TextureDescription d) =>
    d.Dimension != TextureDimension.Texture3D || d.ArraySize <= 1 ||
    (d.Flags & TextureFlags.RenderTarget) == 0;

Prevention

When it happens

Trigger: Creating a Texture3D whose description has ArraySize > 1 (other than the default) and then binding it as a render target; manually populating TextureDescription with Dimension = Texture3D and ArraySize > 1 and Flags |= TextureFlags.RenderTarget.

Common situations: Copying a texture description and overriding ArraySize for array/layered rendering while leaving Dimension as Texture3D; tooling that generically sets ArraySize on all textures; porting Vulkan/GL layered 3D (GL_TEXTURE_2D_ARRAY) code and mistakenly using Texture3D instead of a 2D texture array.

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/39721c250c68e365. Report an issue: GitHub.

Appendix: source

Thrown at sources/engine/Stride.Graphics/Direct3D11/Texture.Direct3D11.cs:630

            // Initialize for Texture Array or Texture Cube
            if (ArraySize > 1)
            {
                if (MultisampleCount > MultisampleCount.None)
                {
                    if (ViewDimension != TextureDimension.Texture2D)
                    {
                        throw new NotSupportedException("Multi-sampling is only supported for 2D Textures");
                    }

                    rtvDescription.ViewDimension = RtvDimension.Texture2Dmsarray;
                    rtvDescription.Texture2DMSArray.ArraySize = (uint) arrayCount;
                    rtvDescription.Texture2DMSArray.FirstArraySlice = (uint) arrayOrDepthSlice;
                }
                else // Not multi-sampled
                {
                    if (ViewDimension == 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 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)
                    {

View on GitHub (pinned to 96fad776d2)