stride3d/stride · error · NotSupportedException
Multisample is only supported for 2D Textures
Error message
Multisample is only supported for 2D Textures
What it means
GetImageView throws NotSupportedException when a multisampled texture is created with a dimension other than Texture2D. Vulkan multisampling is only defined for 2D images (and cube arrays in limited form), so Stride rejects MSAA on Texture1D or Texture3D at view creation time. A separate NotImplementedException guard also blocks MSAA views entirely in this backend.
Solutions
- Set MultisampleCount to 1 (MultisampleCount.None) for 1D/3D textures; only apply MSAA to Texture2D.
- If antialiasing of volumetric/3D content is needed, use a 2D MSAA render target plus shader-based techniques instead.
- Note that even for 2D, this backend currently throws NotImplementedException for multisampled views — resolve MSAA rendering without shader-resource views of MSAA textures or implement that path.
Example fix
// before
var desc = new TextureDescription { Dimension = TextureDimension.Texture3D, MultisampleCount = MultisampleCount.X4, ... };
// after
var desc = new TextureDescription { Dimension = TextureDimension.Texture3D, MultisampleCount = MultisampleCount.None, ... }; Defensive patterns
Strategy: validation
Validate before calling
if (desc.MultisampleCount > 1 && desc.Dimension != TextureDimension.Texture2D)
throw new ArgumentException("MSAA is only supported for Texture2D on Vulkan"); Type guard
bool IsMsaaCandidate(TextureDescription d) => d.MultisampleCount > 1 && d.Dimension == TextureDimension.Texture2D;
Try / catch
try
{
texture.InitializeFromImpl(...);
}
catch (NotSupportedException)
{
// recreate with MultisampleCount.None or as Texture2D
} Prevention
- Set MultisampleCount.None for 1D/3D textures
- Apply MSAA only to 2D render targets
- Note this backend also throws NotImplementedException for MSAA views — plan MSAA resolve without SRV access
- Validate texture descriptions before creation, not at render time
When it happens
Trigger: Creating a texture with MultisampleCount > 1 and Dimension == Texture1D or Texture3D, then initializing it (InitializeFromImpl -> GetImageView). Also any multisampled texture hits the earlier NotImplementedException in the same path.
Common situations: Porting a renderer from D3D (which allows MSAA on more resource shapes) to Stride/Vulkan; misconfiguring a TextureDescription with MultisampleCount set for a 3D/volume texture; copy-pasted description structs where MSAA flags were left on.
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
- Multisample is only supported for 2D RenderTarget Textures
- Source Texture is not a MSAA Texture
- Missing content storage.
- Data chunk is not loaded.
- Trying to serialize a Texture without CPU info.
AI-assisted analysis of stride3d/stride@96fad776d2 (2026-09-14).
Data as JSON: /api/errors/064f1d0f2fe80b12.
Report an issue: GitHub.
Appendix: source
Thrown at sources/engine/Stride.Graphics/Vulkan/Texture.Vulkan.cs:540
sType = VkStructureType.ImageViewUsageCreateInfo,
usage = viewUsage,
};
var createInfo = new VkImageViewCreateInfo
{
sType = VkStructureType.ImageViewCreateInfo,
pNext = &viewUsageInfo,
format = NativeFormat, //VulkanConvertExtensions.ConvertPixelFormat(ViewFormat),
image = NativeImage,
components = VkComponentMapping.Identity,
// For shader resource views, use only the depth aspect (not stencil) when sampling depth-stencil textures
subresourceRange = new VkImageSubresourceRange(HasStencil ? VkImageAspectFlags.Depth : NativeImageAspect, (uint) mipIndex, (uint) mipCount, (uint) arrayOrDepthSlice, (uint) layerCount)
};
if (IsMultiSampled)
throw new NotImplementedException();
if (IsMultiSampled && Dimension != TextureDimension.Texture2D)
throw new NotSupportedException("Multisample is only supported for 2D Textures");
if (layerCount > 1)
{
if (Dimension == TextureDimension.Texture3D)
throw new NotSupportedException("Texture Array is not supported for Texture3D");
switch (Dimension)
{
case TextureDimension.Texture1D:
createInfo.viewType = VkImageViewType.Image1DArray;
break;
case TextureDimension.Texture2D:
createInfo.viewType = VkImageViewType.Image2DArray;
break;
case TextureDimension.TextureCube:
if (layerCount % 6 != 0) throw new NotSupportedException("Texture cube views require a layerCount which is a multiple of 6");
createInfo.viewType = layerCount > 6 ? VkImageViewType.ImageCubeArray : VkImageViewType.ImageCube;View on GitHub (pinned to 96fad776d2)