stride3d/stride · error · NotSupportedException

Texture 3D is not supported for Texture Arrays

Error message

Texture 3D is not supported for Texture Arrays

What it means

When a UAV texture has ArraySize > 1, the backend selects UavDimension.Texture2DArray; D3D12 has no arrayed UAV dimension for 3D textures in this path, so Texture3D with ArraySize > 1 throws in InitializeFromImpl (3D textures use UavDimension.Texture3D only with ArraySize == 1).

Solutions

  1. Set ArraySize = 1 for 3D UAV textures; store layers along the Z axis instead.
  2. Use Texture2D arrays for layered UAV storage.
  3. Bind 3D texture slices individually as separate UAVs if per-layer writes are needed.

Example fix

// before
var desc = TextureDescription.New3D(64, 64, 64, false, PixelFormat.R32.Float, TextureFlags.UnorderedAccess);
desc.ArraySize = 8;
// after
var desc = TextureDescription.New3D(64, 64, 64, false, PixelFormat.R32.Float, TextureFlags.UnorderedAccess);
desc.ArraySize = 1;
Defensive patterns

Strategy: validation

Validate before calling

if (desc.Dimension == TextureDimension.Texture3D && desc.ArraySize > 1 && desc.Usage.HasFlag(GraphicsResourceUsage.UnorderedAccess))
    throw new InvalidOperationException("3D UAV textures require 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 Texture with Dimension = Texture3D, ArraySize > 1, and TextureFlags.UnorderedAccess on Direct3D12.

Common situations: Confusing a 3D texture's Z depth with array layers; porting Vulkan image3D arrays; auto-generating texture descriptions where ArraySize defaults were applied to volumetric storage.

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/1fc17bd959ead7ed. Report an issue: GitHub.

Appendix: source

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

                    Format = (Format) ViewFormat
                };

                // Initialize for Texture Arrays or Texture Cube
                if (ArraySize > 1)
                {
                    switch (Dimension)
                    {
                        case TextureDimension.Texture1D:
                            uavDescription.ViewDimension = UavDimension.Texture1Darray;
                            break;

                        case TextureDimension.TextureCube:
                        case TextureDimension.Texture2D:
                            uavDescription.ViewDimension = UavDimension.Texture2Darray;
                            break;

                        case TextureDimension.Texture3D:
                            throw new NotSupportedException("Texture 3D is not supported for Texture Arrays");
                    }
                    uavDescription.Texture2DArray.ArraySize = (uint) arrayCount;
                    uavDescription.Texture2DArray.FirstArraySlice = (uint)arrayOrDepthSlice;
                    uavDescription.Texture2DArray.MipSlice = (uint) mipIndex;
                }
                else // Regular Texture (1D, 2D, 3D)
                {
                    switch (Dimension)
                    {
                        case TextureDimension.Texture1D:
                            uavDescription.ViewDimension = UavDimension.Texture1D;
                            uavDescription.Texture1D.MipSlice = (uint) mipIndex;
                            break;

                        case TextureDimension.Texture2D:
                            uavDescription.ViewDimension = UavDimension.Texture2D;
                            uavDescription.Texture2D.MipSlice = (uint) mipIndex;
                            break;

View on GitHub (pinned to 96fad776d2)