stride3d/stride · error · NotSupportedException
Unsupported Depth Format
Error message
Unsupported Depth Format [{textureDescription.Format}] for the Depth-Stencil Buffer What it means
Thrown in ConvertToNativeDescription2D when a depth-stencil texture is created on a Level_9_0 graphics profile with a PixelFormat not among the four depth formats D3D11 supports for the low-profile path (D16_UNorm, D32_Float, D24_UNorm_S8_UInt, D32_Float_S8X24_UInt). The library throws NotSupportedException because the mapping to a native DXGI format is undefined for any other format in a depth-stencil buffer.
Solutions
- Set the texture's Format to one of PixelFormat.D16_UNorm, D32_Float, D24_UNorm_S8_UInt, or D32_Float_S8X24_UInt when creating a depth-stencil buffer.
- Raise GraphicsDevice.GraphicsProfile to Level_10_0 or higher so the typeless-format path is used.
- Verify the texture Flags actually require DepthStencil; if the texture is color-only, remove the DepthStencil flag so the color format path is used.
Example fix
// before var tex = Texture.New2D(device, 1024, 1024, PixelFormat.R32_Typeless, TextureFlags.DepthStencil); // after var tex = Texture.New2D(device, 1024, 1024, PixelFormat.D32_Float, TextureFlags.DepthStencil);
Defensive patterns
Strategy: validation
Validate before calling
var validDepthFormats = new[] { PixelFormat.D16_UNorm, PixelFormat.D32_Float, PixelFormat.D24_UNorm_S8_UInt, PixelFormat.D32_Float_S8X24_UInt };
bool ok = !desc.Flags.HasFlag(TextureFlags.DepthStencil)
|| (device.GraphicsProfile >= GraphicsProfile.Level_10_0
? new[] { PixelFormat.D16_UNorm, PixelFormat.D32_Float, PixelFormat.D24_UNorm_S8_UInt, PixelFormat.D32_Float_S8X24_UInt, PixelFormat.R16_Typeless, PixelFormat.R32_Typeless, PixelFormat.R24G8_Typeless, PixelFormat.R32G8X24_Typeless }.Contains(desc.Format)
: validDepthFormats.Contains(desc.Format)); Type guard
static bool IsLowProfileDepthFormat(PixelFormat f) => f is PixelFormat.D16_UNorm or PixelFormat.D32_Float or PixelFormat.D24_UNorm_S8_UInt or PixelFormat.D32_Float_S8X24_UInt;
Try / catch
try { texture = Texture.New2D(device, w, h, format, TextureFlags.DepthStencil); }
catch (NotSupportedException ex) { log.Error(ex); texture = Texture.New2D(device, w, h, PixelFormat.D16_UNorm, TextureFlags.DepthStencil); } Prevention
- Always use a dedicated depth PixelFormat for depth-stencil textures; never a color format.
- Pin GraphicsProfile explicitly instead of relying on device fallback.
- Add a unit test that creates each depth texture used by your renderer at the target profile.
When it happens
Trigger: Calling Texture.InitializeFromImpl / Texture.New (or description) with TextureDescription whose Flags include DepthStencil and Format set to a color or typeless format (e.g. R16_Typeless, R32_Typeless, R24G8_Typeless, R32G8X24_Typeless, or any color format) while GraphicsDevice.GraphicsProfile == Level_9_0.
Common situations: Migrating a project that renders shadows or post effects from a higher profile down to Level_9_0, hand-building a depth texture description with a typeless format copied from the Level_10+ code path, or letting a misconfigured GraphicsProfile fall back to Level_9_0 on limited hardware.
Related errors
- Unsupported depth format
- Cannot clear a stencil buffer without a Stencil Buffer…
- Image format not supported
- This file format is not yet implemented.
- Element size must be greater than zero for structured…
AI-assisted analysis of stride3d/stride@96fad776d2 (2026-09-14).
Data as JSON: /api/errors/9cbb4017c9325b3a.
Report an issue: GitHub.
Appendix: source
Thrown at sources/engine/Stride.Graphics/Direct3D11/Texture.Direct3D11.cs:996
if (needsTypelessDepth)
{
if (IsShaderResource && GraphicsDevice.Features.CurrentProfile < GraphicsProfile.Level_10_0)
{
throw new NotSupportedException($"Shader Resource Views for Depth-Stencil Textures are not supported for Graphics profile < 10.0 (Current: [{GraphicsDevice.Features.CurrentProfile}])");
}
else
{
// Determine a typeless format and a Shader Resource View Format
if (GraphicsDevice.Features.CurrentProfile < GraphicsProfile.Level_10_0)
{
format = textureDescription.Format switch
{
PixelFormat.D16_UNorm => Silk.NET.DXGI.Format.FormatD16Unorm,
PixelFormat.D32_Float => Silk.NET.DXGI.Format.FormatD32Float,
PixelFormat.D24_UNorm_S8_UInt => Silk.NET.DXGI.Format.FormatD24UnormS8Uint,
PixelFormat.D32_Float_S8X24_UInt => Silk.NET.DXGI.Format.FormatD32FloatS8X24Uint,
_ => throw new NotSupportedException($"Unsupported Depth Format [{textureDescription.Format}] for the Depth-Stencil Buffer")
};
}
else // GraphicsProfile.Level_10_0 or higher
{
format = textureDescription.Format switch
{
PixelFormat.D16_UNorm => Silk.NET.DXGI.Format.FormatR16Typeless,
PixelFormat.D32_Float => Silk.NET.DXGI.Format.FormatR32Typeless,
PixelFormat.D24_UNorm_S8_UInt => Silk.NET.DXGI.Format.FormatR24G8Typeless,//Silk.NET.DXGI.Format.FormatD24UnormS8Uint
PixelFormat.D32_Float_S8X24_UInt => Silk.NET.DXGI.Format.FormatR32G8X24Typeless,
_ => throw new NotSupportedException($"Unsupported Depth Format [{textureDescription.Format}] for the Depth-Stencil Buffer")
};
}
}
}
int quality = 0;View on GitHub (pinned to 96fad776d2)