stride3d/stride · error · NotSupportedException

The view type [ViewType.MipBand] is not supported for…

Error message

The view type [ViewType.MipBand] is not supported for Render Targets

What it means

Stride's Direct3D12 backend creates render-target views (RTVs) in GetRenderTargetView during InitializeFromImpl. An RTV always addresses a full mip chain or a single mip of a specific array/depth slice; the MipBand view type (a contiguous range of mips) has no D3D12 RTV equivalent, so the library rejects it up front with NotSupportedException.

Solutions

  1. Use ViewType.Single or ViewType.Full (per mip-level views) instead of ViewType.MipBand for render-target textures.
  2. Create one texture per mip level you need to render into, and bind each as its own render target.
  3. Render to mip 0 and generate the remaining mips via GraphicsDevice.GenerateMipmaps instead of rendering into a mip band.

Example fix

// before
texture.GetRenderTargetView(ViewType.MipBand, 0, 1);
// after
texture.GetRenderTargetView(ViewType.Single, 0, 1);
Defensive patterns

Strategy: validation

Validate before calling

if (viewType == ViewType.MipBand && texture.IsRenderTarget)
    throw new InvalidOperationException("Render-target views cannot use ViewType.MipBand; use ViewType.Single or Full.");

Try / catch

try { return texture.GetRenderTargetView(ViewType.MipBand, slice, mip); }
catch (NotSupportedException) { return texture.GetRenderTargetView(ViewType.Single, slice, mip); }

Prevention

When it happens

Trigger: Calling Texture.InitializeFromImpl (via GraphicsDevice.AllocateTexture / Texture.New2D etc.) with GraphicsResourceUsage/TextureDescription flags that make IsRenderTarget true while a later view request uses ViewType.MipBand, e.g. requesting a render-target view over a mip band via GetRenderTargetView(viewType: ViewType.MipBand, ...).

Common situations: Porting DirectX11-style mip-band render targets to Stride; building cascaded shadow or clipmap renderers that render into a sub-range of mips; copying viewport code that assumed MipBand views were legal for RTVs.

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/8558dd560984c4ec. Report an issue: GitHub.

Appendix: source

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

                    }
                }

                var descriptorHandle = GraphicsDevice.ShaderResourceViewAllocator.Allocate(1);

                NativeDevice.CreateShaderResourceView(NativeResource, in srvDescription, descriptorHandle);
                return descriptorHandle;
            }

            //
            // Gets a specific Render Target View from the Texture.
            //
            CpuDescriptorHandle GetRenderTargetView(ViewType viewType, int arrayOrDepthSlice, int mipIndex)
            {
                if (!IsRenderTarget)
                    return default;

                if (viewType == ViewType.MipBand)
                    throw new NotSupportedException($"The view type [{nameof(ViewType)}.{nameof(ViewType.MipBand)}] is not supported for Render Targets");

                GetViewSliceBounds(viewType, ref arrayOrDepthSlice, ref mipIndex, out var arrayCount, out _);

                var rtvDescription = new RenderTargetViewDesc { Format = (Format) ViewFormat };

                // 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;
                    }

View on GitHub (pinned to 96fad776d2)