{"record":{"id":"463b96585f869364","repo":"stride3d/stride","slug":"multi-sampling-is-not-supported-for-unordered-access-views-463b96","errorCode":null,"errorMessage":"Multi-sampling is not supported for Unordered Access Views","messagePattern":"Multi-sampling is not supported for Unordered Access Views","errorType":"exception","errorClass":"NotSupportedException","httpStatus":null,"severity":"error","filePath":"sources/engine/Stride.Graphics/Direct3D12/Texture.Direct3D12.cs","lineNumber":813,"sourceCode":"                        depthStencilViewDescription.Flags |= DsvFlags.ReadOnlyStencil;\n                }\n\n                var descriptorHandle = GraphicsDevice.DepthStencilViewAllocator.Allocate(1);\n\n                NativeDevice.CreateDepthStencilView(NativeResource, in depthStencilViewDescription, descriptorHandle);\n                return descriptorHandle;\n            }\n\n            //\n            // Gets a specific Unordered Access View from the Texture.\n            //\n            CpuDescriptorHandle GetUnorderedAccessView(ViewType viewType, int arrayOrDepthSlice, int mipIndex)\n            {\n                if (!IsUnorderedAccess)\n                    return default;\n\n                if (IsMultiSampled)\n                    throw new NotSupportedException(\"Multi-sampling is not supported for Unordered Access Views\");\n\n                GetViewSliceBounds(viewType, ref arrayOrDepthSlice, ref mipIndex, out var arrayCount, out _);\n\n                var uavDescription = new UnorderedAccessViewDesc\n                {\n                    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:","sourceCodeStart":795,"sourceCodeEnd":831,"githubUrl":"https://github.com/stride3d/stride/blob/96fad776d210c221682aac1ccdf4c79dc046fc38/sources/engine/Stride.Graphics/Direct3D12/Texture.Direct3D12.cs#L795-L831","documentation":"Unordered-access views (UAVs) in D3D12 have no multisampled view dimension, so the backend rejects any texture with MultisampleCount > None that requests UAV usage (IsUnorderedAccess) during InitializeFromImpl.","triggerScenarios":"Creating a Texture with TextureFlags.UnorderedAccess combined with MultisampleCount.X2/X4/X8, then initializing it on Direct3D12 (e.g. for a compute pass writing to an MSAA texture).","commonSituations":"Attempting MSAA resolve-in-place via compute shaders; copying compute-shader code that writes to a target previously made MSAA; enabling global MSAA flags on a storage texture.","solutions":["Set MultisampleCount = MultisampleCount.None on textures flagged UnorderedAccess.","Write per-sample data into a non-MSAA texture with explicit array/2D layout and sample manually in shaders.","Do the multisample resolve with a graphics pipeline (resolve pass) instead of a UAV compute write."],"exampleFix":"// before\nvar desc = TextureDescription.New2D(w, h, PixelFormat.R32.UInt, usage: GraphicsResourceUsage.UnorderedAccess);\ndesc.MultisampleCount = MultisampleCount.X4;\n// after\nvar desc = TextureDescription.New2D(w, h, PixelFormat.R32.UInt, usage: GraphicsResourceUsage.UnorderedAccess);\ndesc.MultisampleCount = MultisampleCount.None;","handlingStrategy":"validation","validationCode":"if (desc.Usage.HasFlag(GraphicsResourceUsage.UnorderedAccess) && desc.MultisampleCount > MultisampleCount.None)\n    throw new InvalidOperationException(\"UAV textures cannot be multisampled.\");","typeGuard":null,"tryCatchPattern":"try { texture.InitializeFrom(device, desc); }\ncatch (NotSupportedException) { desc.MultisampleCount = MultisampleCount.None; texture.InitializeFrom(device, desc); }","preventionTips":["Never combine TextureFlags.UnorderedAccess with MultisampleCount > None.","Use a resolve pass or manual per-sample storage for MSAA + compute.","Add a texture-factory guard that strips MSAA from storage textures."],"tags":["direct3d12","unordered-access","multisampling","compute-shader"],"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"}