{"record":{"id":"1fc17bd959ead7ed","repo":"stride3d/stride","slug":"texture-3d-is-not-supported-for-texture-arrays-direct3d12","errorCode":null,"errorMessage":"Texture 3D is not supported for Texture Arrays","messagePattern":"Texture 3D is not supported for Texture Arrays","errorType":"exception","errorClass":"NotSupportedException","httpStatus":null,"severity":"error","filePath":"sources/engine/Stride.Graphics/Direct3D12/Texture.Direct3D12.cs","lineNumber":837,"sourceCode":"                    Format = (Format) ViewFormat\n                };\n\n                // Initialize for Texture Arrays or Texture Cube\n                if (ArraySize > 1)\n                {\n                    switch (Dimension)\n                    {\n                        case TextureDimension.Texture1D:\n                            uavDescription.ViewDimension = UavDimension.Texture1Darray;\n                            break;\n\n                        case TextureDimension.TextureCube:\n                        case TextureDimension.Texture2D:\n                            uavDescription.ViewDimension = UavDimension.Texture2Darray;\n                            break;\n\n                        case TextureDimension.Texture3D:\n                            throw new NotSupportedException(\"Texture 3D is not supported for Texture Arrays\");\n                    }\n                    uavDescription.Texture2DArray.ArraySize = (uint) arrayCount;\n                    uavDescription.Texture2DArray.FirstArraySlice = (uint)arrayOrDepthSlice;\n                    uavDescription.Texture2DArray.MipSlice = (uint) mipIndex;\n                }\n                else // Regular Texture (1D, 2D, 3D)\n                {\n                    switch (Dimension)\n                    {\n                        case TextureDimension.Texture1D:\n                            uavDescription.ViewDimension = UavDimension.Texture1D;\n                            uavDescription.Texture1D.MipSlice = (uint) mipIndex;\n                            break;\n\n                        case TextureDimension.Texture2D:\n                            uavDescription.ViewDimension = UavDimension.Texture2D;\n                            uavDescription.Texture2D.MipSlice = (uint) mipIndex;\n                            break;","sourceCodeStart":819,"sourceCodeEnd":855,"githubUrl":"https://github.com/stride3d/stride/blob/96fad776d210c221682aac1ccdf4c79dc046fc38/sources/engine/Stride.Graphics/Direct3D12/Texture.Direct3D12.cs#L819-L855","documentation":"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).","triggerScenarios":"Creating a Texture with Dimension = Texture3D, ArraySize > 1, and TextureFlags.UnorderedAccess on Direct3D12.","commonSituations":"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.","solutions":["Set ArraySize = 1 for 3D UAV textures; store layers along the Z axis instead.","Use Texture2D arrays for layered UAV storage.","Bind 3D texture slices individually as separate UAVs if per-layer writes are needed."],"exampleFix":"// before\nvar desc = TextureDescription.New3D(64, 64, 64, false, PixelFormat.R32.Float, TextureFlags.UnorderedAccess);\ndesc.ArraySize = 8;\n// after\nvar desc = TextureDescription.New3D(64, 64, 64, false, PixelFormat.R32.Float, TextureFlags.UnorderedAccess);\ndesc.ArraySize = 1;","handlingStrategy":"validation","validationCode":"if (desc.Dimension == TextureDimension.Texture3D && desc.ArraySize > 1 && desc.Usage.HasFlag(GraphicsResourceUsage.UnorderedAccess))\n    throw new InvalidOperationException(\"3D UAV textures require ArraySize == 1.\");","typeGuard":null,"tryCatchPattern":"try { texture.InitializeFrom(device, desc); }\ncatch (NotSupportedException) { desc.ArraySize = 1; texture.InitializeFrom(device, desc); }","preventionTips":["Keep ArraySize = 1 for 3D UAV textures.","Use 2D texture arrays for layered compute writes.","Validate texture descriptions in a shared factory before initialization."],"tags":["direct3d12","texture3d","unordered-access","array"],"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"}