{"record":{"id":"39721c250c68e365","repo":"stride3d/stride","slug":"texture-array-is-not-supported-for-3d-textures","errorCode":null,"errorMessage":"Texture Array is not supported for 3D Textures","messagePattern":"Texture Array is not supported for 3D Textures","errorType":"exception","errorClass":"NotSupportedException","httpStatus":null,"severity":"error","filePath":"sources/engine/Stride.Graphics/Direct3D11/Texture.Direct3D11.cs","lineNumber":630,"sourceCode":"            // Initialize for Texture Array or Texture Cube\n            if (ArraySize > 1)\n            {\n                if (MultisampleCount > MultisampleCount.None)\n                {\n                    if (ViewDimension != TextureDimension.Texture2D)\n                    {\n                        throw new NotSupportedException(\"Multi-sampling is only supported for 2D Textures\");\n                    }\n\n                    rtvDescription.ViewDimension = RtvDimension.Texture2Dmsarray;\n                    rtvDescription.Texture2DMSArray.ArraySize = (uint) arrayCount;\n                    rtvDescription.Texture2DMSArray.FirstArraySlice = (uint) arrayOrDepthSlice;\n                }\n                else // Not multi-sampled\n                {\n                    if (ViewDimension == TextureDimension.Texture3D)\n                    {\n                        throw new NotSupportedException(\"Texture Array is not supported for 3D Textures\");\n                    }\n\n                    rtvDescription.ViewDimension = Dimension is TextureDimension.Texture2D or TextureDimension.TextureCube\n                        ? RtvDimension.Texture2Darray\n                        : RtvDimension.Texture1Darray;\n\n                    // Use rtvDescription.Texture1DArray as it matches also Texture2DArray memory layout\n                    rtvDescription.Texture1DArray.ArraySize = (uint) arrayCount;\n                    rtvDescription.Texture1DArray.FirstArraySlice = (uint) arrayOrDepthSlice;\n                    rtvDescription.Texture1DArray.MipSlice = (uint) mipIndex;\n                }\n            }\n            else // Regular Texture Array\n            {\n                if (IsMultiSampled)\n                {\n                    if (ViewDimension != TextureDimension.Texture2D)\n                    {","sourceCodeStart":612,"sourceCodeEnd":648,"githubUrl":"https://github.com/stride3d/stride/blob/96fad776d210c221682aac1ccdf4c79dc046fc38/sources/engine/Stride.Graphics/Direct3D11/Texture.Direct3D11.cs#L612-L648","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Use TextureDimension.Texture2D with ArraySize > 1 for a 2D texture array instead of Texture3D.","Set ArraySize = 1 (or leave default) on 3D textures used as render targets."],"exampleFix":"// before\nvar desc = TextureDescription.New3D(256, 256, 64, false, PixelFormat.R8G8B8A8_UNorm,\n    TextureFlags.RenderTarget);\ndesc.ArraySize = 4;\n// after\nvar desc = TextureDescription.New2D(256, 256, PixelFormat.R8G8B8A8_UNorm,\n    TextureFlags.RenderTarget, arraySize: 4);","handlingStrategy":"validation","validationCode":"if (desc.Dimension == TextureDimension.Texture3D && desc.ArraySize > 1 && (desc.Flags & TextureFlags.RenderTarget) != 0)\n    throw new InvalidOperationException(\"3D textures cannot be texture arrays for RTVs\");","typeGuard":"bool IsValid3dRenderTarget(TextureDescription d) =>\n    d.Dimension != TextureDimension.Texture3D || d.ArraySize <= 1 ||\n    (d.Flags & TextureFlags.RenderTarget) == 0;","tryCatchPattern":null,"preventionTips":["Never set ArraySize manually on 3D texture descriptions.","Use TextureDescription.New2D with arraySize for texture arrays instead of hand-rolled New3D mutations."],"tags":["direct3d11","textures","texture-array","render-target"],"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"}