stride3d/stride · error · NotSupportedException
. is not supported for Render Targets
Error message
{nameof(ViewType)}.{nameof(ViewType.MipBand)} is not supported for Render Targets What it means
GetRenderTargetView on the Direct3D 11 backend rejects the ViewType.MipBand view type: D3D11 render target views cannot select a band of mip levels (a range), only a single mip slice. Stride throws NotSupportedException to signal this backend limitation.
Solutions
- Use ViewType.Single with the specific mipIndex as the render target instead of MipBand.
- Create one render target view per mip level and bind them individually.
- Keep MipBand views only for shader-resource usage where they are supported.
- Refactor mip-generation code to render each mip level sequentially with single-mip views.
Example fix
// before
var viewDesc = new TextureViewDescription { Type = ViewType.MipBand, MipLevel = 1, MipCount = 3 };
rtTex.InitializeFrom(device, viewDesc);
// after
var viewDesc = new TextureViewDescription { Type = ViewType.Single, MipLevel = 1 };
rtTex.InitializeFrom(device, viewDesc); Defensive patterns
Strategy: validation
Validate before calling
if (viewDesc.Type == ViewType.MipBand && desc.Flags.HasFlag(TextureFlags.RenderTarget))
viewDesc.Type = ViewType.Single; // one mip at a time
var tex = new Texture(device, desc, viewDesc); Type guard
static bool IsRtViewTypeValid(TextureViewDescription v) => v.Type != ViewType.MipBand;
Try / catch
try { tex.InitializeFrom(device, viewDesc); }
catch (NotSupportedException ex) when (ex.Message.Contains("MipBand")) { viewDesc.Type = ViewType.Single; tex.InitializeFrom(device, viewDesc); } Prevention
- Never request MipBand views for render targets on D3D11
- Render mip chains one level at a time with ViewType.Single
- Keep MipBand usage confined to shader-resource views
- Check the target backend's view capabilities in shared rendering code
When it happens
Trigger: Creating a render-target Texture whose view uses ViewType.MipBand (requested multiple consecutive mip levels as a render target) on the Direct3D 11 backend, via InitializeFromImpl.
Common situations: Porting code from Vulkan/OpenGL-style APIs where mip-band render targets were allowed; generating mipmaps by rendering across a band of levels; generic graphics code that uses MipBand views for render targets without a D3D11-specific path.
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
- Multi-sampling is only supported for 2D Textures
- Texture Array is not supported for 3D Textures
- Multi-sampling is only supported for 2D Render Target…
- Element size must be greater than zero for structured…
- Creation of additional Command Lists is not supported for…
AI-assisted analysis of stride3d/stride@96fad776d2 (2026-09-14).
Data as JSON: /api/errors/c6dcf796c79196fb.
Report an issue: GitHub.
Appendix: source
Thrown at sources/engine/Stride.Graphics/Direct3D11/Texture.Direct3D11.cs:606
/// <summary>
/// Gets a specific <see cref="ID3D11RenderTargetView"/> from the Texture.
/// </summary>
/// <param name="viewType">The desired View type of the Render Target View.</param>
/// <param name="arrayOrDepthSlice">The index of the Texture array or depth slice.</param>
/// <param name="mipIndex">The index of the mip-level.</param>
/// <returns>An <see cref="ID3D11RenderTargetView"/> for the Texture.</returns>
/// <exception cref="NotSupportedException">Multi-sampling is only supported for 2D Textures.</exception>
/// <exception cref="NotSupportedException">A Texture Cube must have an array size greater than 1.</exception>
/// <exception cref="NotSupportedException">Texture Arrays are not supported for 3D Textures.</exception>
/// <exception cref="NotSupportedException"><see cref="ViewType.MipBand"/> is not supported for Render Targets.</exception>
private ComPtr<ID3D11RenderTargetView> GetRenderTargetView(ViewType viewType, int arrayOrDepthSlice, int mipIndex)
{
if (!IsRenderTarget)
return null;
if (viewType == ViewType.MipBand)
throw new NotSupportedException($"{nameof(ViewType)}.{nameof(ViewType.MipBand)} is not supported for Render Targets");
GetViewSliceBounds(viewType, ref arrayOrDepthSlice, ref mipIndex, out var arrayCount, out var mipCount);
var rtvDescription = new RenderTargetViewDesc { Format = (Format) ViewFormat };
// 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;View on GitHub (pinned to 96fad776d2)