{"record":{"id":"8558dd560984c4ec","repo":"stride3d/stride","slug":"the-view-type-viewtype-mipband-is-not-supported-for-render","errorCode":null,"errorMessage":"The view type [ViewType.MipBand] is not supported for Render Targets","messagePattern":"The view type \\[ViewType\\.MipBand\\] is not supported for Render Targets","errorType":"exception","errorClass":"NotSupportedException","httpStatus":null,"severity":"error","filePath":"sources/engine/Stride.Graphics/Direct3D12/Texture.Direct3D12.cs","lineNumber":669,"sourceCode":"                    }\n                }\n\n                var descriptorHandle = GraphicsDevice.ShaderResourceViewAllocator.Allocate(1);\n\n                NativeDevice.CreateShaderResourceView(NativeResource, in srvDescription, descriptorHandle);\n                return descriptorHandle;\n            }\n\n            //\n            // Gets a specific Render Target View from the Texture.\n            //\n            CpuDescriptorHandle GetRenderTargetView(ViewType viewType, int arrayOrDepthSlice, int mipIndex)\n            {\n                if (!IsRenderTarget)\n                    return default;\n\n                if (viewType == ViewType.MipBand)\n                    throw new NotSupportedException($\"The view type [{nameof(ViewType)}.{nameof(ViewType.MipBand)}] is not supported for Render Targets\");\n\n                GetViewSliceBounds(viewType, ref arrayOrDepthSlice, ref mipIndex, out var arrayCount, out _);\n\n                var rtvDescription = new RenderTargetViewDesc { Format = (Format) ViewFormat };\n\n                // Initialize for Texture Arrays or Texture Cube\n                if (ArraySize > 1)\n                {\n                    if (MultisampleCount > MultisampleCount.None)\n                    {\n                        if (Dimension != TextureDimension.Texture2D)\n                        {\n                            throw new NotSupportedException(\"Multisample is only supported for 2D Textures\");\n                        }\n                        rtvDescription.ViewDimension = RtvDimension.Texture2Dmsarray;\n                        rtvDescription.Texture2DMSArray.ArraySize = (uint)arrayCount;\n                        rtvDescription.Texture2DMSArray.FirstArraySlice = (uint)arrayOrDepthSlice;\n                    }","sourceCodeStart":651,"sourceCodeEnd":687,"githubUrl":"https://github.com/stride3d/stride/blob/96fad776d210c221682aac1ccdf4c79dc046fc38/sources/engine/Stride.Graphics/Direct3D12/Texture.Direct3D12.cs#L651-L687","documentation":"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.","triggerScenarios":"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, ...).","commonSituations":"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.","solutions":["Use ViewType.Single or ViewType.Full (per mip-level views) instead of ViewType.MipBand for render-target textures.","Create one texture per mip level you need to render into, and bind each as its own render target.","Render to mip 0 and generate the remaining mips via GraphicsDevice.GenerateMipmaps instead of rendering into a mip band."],"exampleFix":"// before\ntexture.GetRenderTargetView(ViewType.MipBand, 0, 1);\n// after\ntexture.GetRenderTargetView(ViewType.Single, 0, 1);","handlingStrategy":"validation","validationCode":"if (viewType == ViewType.MipBand && texture.IsRenderTarget)\n    throw new InvalidOperationException(\"Render-target views cannot use ViewType.MipBand; use ViewType.Single or Full.\");","typeGuard":null,"tryCatchPattern":"try { return texture.GetRenderTargetView(ViewType.MipBand, slice, mip); }\ncatch (NotSupportedException) { return texture.GetRenderTargetView(ViewType.Single, slice, mip); }","preventionTips":["Never request MipBand views for render-target or depth-stencil textures.","Render to single mip levels and generate lower mips via GenerateMipmaps.","Centralize view creation behind a helper that maps desired mip ranges to per-mip views."],"tags":["direct3d12","render-target","texture-view","unsupported"],"backgroundTag":"unsupported-operation","analyzedSha":"96fad776d210c221682aac1ccdf4c79dc046fc38","analyzedAt":"2026-09-14T02:59:31.279Z","contentChangedAt":"2026-09-14T02:59:31.279Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}