stride3d/stride · error · NotSupportedException

Shader Resource Views for Depth-Stencil Textures are not…

Error message

Shader Resource Views for Depth-Stencil Textures are not supported for Graphics profile < 10.0 (Current: [{GraphicsDevice.Features.CurrentProfile}])

What it means

Depth formats bound as shader resources must be created typeless, which requires D3D10+ features. In ConvertToNativeDescription2D, if a texture is a depth-stencil or depth-format texture also flagged as ShaderResource while GraphicsDevice.Features.CurrentProfile < GraphicsProfile.Level_10_0, Stride throws this NotSupportedException because SRVs on depth textures cannot be set up on such a profile.

Solutions

  1. Raise the GraphicsDevice's GraphicsProfile to at least GraphicsProfile.Level_10_0 when creating the device.
  2. Remove TextureFlags.ShaderResource from depth-format textures on level 9.x profiles (restructure e.g. shadow passes to not sample depth directly).
  3. Copy the depth into a regular color texture via a render pass on profiles < 10.0 and sample that copy instead.

Example fix

// before
var device = GraphicsDevice.New(Platform, DeviceContext, GraphicsProfile.Level_9_3);
var shadow = Texture.New2D(GraphicsDevice, 2048, 2048, PixelFormat.D32_Float,
    TextureFlags.ShaderResource | TextureFlags.DepthStencil);
// after
var device = GraphicsDevice.New(Platform, DeviceContext, GraphicsProfile.Level_10_0);
var shadow = Texture.New2D(GraphicsDevice, 2048, 2048, PixelFormat.D32_Float,
    TextureFlags.ShaderResource | TextureFlags.DepthStencil);
Defensive patterns

Strategy: validation

Validate before calling

if ((flags & TextureFlags.ShaderResource) != 0 && IsDepthFormat(format)
    && GraphicsDevice.Features.CurrentProfile < GraphicsProfile.Level_10_0)
    throw new InvalidOperationException("Depth SRVs require GraphicsProfile >= Level_10_0");

Type guard

bool SupportsDepthSrv(GraphicsDevice gd) =>
    gd != null && gd.Features != null && gd.Features.CurrentProfile >= GraphicsProfile.Level_10_0;

Try / catch

try { var shadow = Texture.New2D(gd, 2048, 2048, PixelFormat.D32_Float, TextureFlags.ShaderResource | TextureFlags.DepthStencil); }
catch (NotSupportedException ex) when (ex.Message.Contains("profile < 10.0"))
{
    // fall back to rendering depth into a color RT and sampling that
}

Prevention

When it happens

Trigger: Creating a texture with a depth format and TextureFlags.ShaderResource (with or without DepthStencil) on a GraphicsDevice initialized with GraphicsProfile.Level_9_1/9_2/9_3 — ConvertToNativeDescription2D during texture initialization.

Common situations: Targeting very old hardware or feature level 9.x (some emulators, old integrated GPUs, certain mobile/ARM Windows devices); a project-wide GraphicsProfile lowered to Level_9_x for compatibility while the renderer samples depth maps (shadow mapping); running tests on a device that clamps the profile down.

Understand the failure class

Background: "unsupported platform" / "not supported on this platform" errors: what they mean and how to fix them — this error's family across 47 libraries.

Related errors


AI-assisted analysis of stride3d/stride@96fad776d2 (2026-09-14). Data as JSON: /api/errors/6e8627b8a6649340. Report an issue: GitHub.

Appendix: source

Thrown at sources/engine/Stride.Graphics/Direct3D11/Texture.Direct3D11.cs:982

        /// <exception cref="NotSupportedException">
        ///   For a <see cref="GraphicsProfile"/> lower than <see cref="GraphicsProfile.Level_10_0"/>, creating Shader Resource Views
        ///   for Depth-Stencil Textures is not supported,
        /// </exception>
        /// <exception cref="NotSupportedException">
        ///   The specified pixel format is not supported for Depth-Stencil Textures.
        /// </exception>
        private Texture2DDesc ConvertToNativeDescription2D()
        {
            var format = (Format) textureDescription.Format;
            var flags = textureDescription.Flags;

            // Depth formats bound as shader resources must be created as typeless — covers both DS+SR and SR-only.
            var needsTypelessDepth = IsDepthStencil || (IsShaderResource && IsDepthFormat(textureDescription.Format));
            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
                    {

View on GitHub (pinned to 96fad776d2)