stride3d/stride · error · NotSupportedException
Multi-sampling is not supported for Unordered Access Views
Error message
Multi-sampling is not supported for Unordered Access Views
What it means
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.
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.
Example fix
// before var desc = TextureDescription.New2D(w, h, PixelFormat.R32.UInt, usage: GraphicsResourceUsage.UnorderedAccess); desc.MultisampleCount = MultisampleCount.X4; // after var desc = TextureDescription.New2D(w, h, PixelFormat.R32.UInt, usage: GraphicsResourceUsage.UnorderedAccess); desc.MultisampleCount = MultisampleCount.None;
Defensive patterns
Strategy: validation
Validate before calling
if (desc.Usage.HasFlag(GraphicsResourceUsage.UnorderedAccess) && desc.MultisampleCount > MultisampleCount.None)
throw new InvalidOperationException("UAV textures cannot be multisampled."); Try / catch
try { texture.InitializeFrom(device, desc); }
catch (NotSupportedException) { desc.MultisampleCount = MultisampleCount.None; texture.InitializeFrom(device, desc); } Prevention
- 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.
When it happens
Trigger: 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).
Common situations: 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.
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 not supported for Unordered Access Views
- Multisample is only supported for 2D Render Target Textures
- Texture 3D is not supported for Texture Arrays
- Element size must be greater than zero for structured…
- Multi-sampling is only supported for 2D Textures
AI-assisted analysis of stride3d/stride@96fad776d2 (2026-09-14).
Data as JSON: /api/errors/463b96585f869364.
Report an issue: GitHub.
Appendix: source
Thrown at sources/engine/Stride.Graphics/Direct3D12/Texture.Direct3D12.cs:813
depthStencilViewDescription.Flags |= DsvFlags.ReadOnlyStencil;
}
var descriptorHandle = GraphicsDevice.DepthStencilViewAllocator.Allocate(1);
NativeDevice.CreateDepthStencilView(NativeResource, in depthStencilViewDescription, descriptorHandle);
return descriptorHandle;
}
//
// Gets a specific Unordered Access View from the Texture.
//
CpuDescriptorHandle GetUnorderedAccessView(ViewType viewType, int arrayOrDepthSlice, int mipIndex)
{
if (!IsUnorderedAccess)
return default;
if (IsMultiSampled)
throw new NotSupportedException("Multi-sampling is not supported for Unordered Access Views");
GetViewSliceBounds(viewType, ref arrayOrDepthSlice, ref mipIndex, out var arrayCount, out _);
var uavDescription = new UnorderedAccessViewDesc
{
Format = (Format) ViewFormat
};
// Initialize for Texture Arrays or Texture Cube
if (ArraySize > 1)
{
switch (Dimension)
{
case TextureDimension.Texture1D:
uavDescription.ViewDimension = UavDimension.Texture1Darray;
break;
case TextureDimension.TextureCube:View on GitHub (pinned to 96fad776d2)