stride3d/stride · error · NotImplementedException

Creating a texture from a SRV with dimension

Error message

Creating a texture from a SRV with dimension {srvDescription.ViewDimension} is not implemented

What it means

Texture.InitializeFromImpl can create a D3D11 texture resource from an existing shader resource view, but only for certain view dimensions. When the SRV's ViewDimension is one of the unimplemented view types, the method throws NotImplementedException, as the TODO in the source notes that other view types are not yet supported.

Solutions

  1. Create the texture from a plain 2D (non-view) resource description instead of an SRV with an unsupported dimension.
  2. Use an SRV whose ViewDimension matches a supported case (e.g. Texture2D) when calling InitializeFrom.
  3. Keep the external resource as a raw ID3D11ShaderResourceView and bind it directly rather than wrapping it in a Stride Texture.

Example fix

// before
texture.InitializeFrom(device, srvOfCubeTexture); // ViewDimension = TextureCube
// after
var texture = Texture.Load(device, cubeFaceImageData); // or wrap a 2D SRV
Defensive patterns

Strategy: type-guard

Validate before calling

if (srvDescription.ViewDimension != D3DSrvDimension.D3D11SrvDimensionTexture2D)
    throw new NotSupportedException("Only 2D SRVs can be wrapped into a Stride Texture on D3D11.");

Type guard

static bool IsSupportedSrvDimension(D3DSrvDimension d) => d == D3DSrvDimension.D3D11SrvDimensionTexture2D;

Try / catch

try { texture.InitializeFrom(device, viewDesc); }
catch (NotImplementedException ex) when (ex.Message.Contains("SRV")) { texture = RecreateFromResourceDescription(); }

Prevention

When it happens

Trigger: Calling Texture.InitializeFrom (or Recreate) with a texture view description whose SRV ViewDimension is not a handled type (e.g. cube or MS array views depending on the supported path) on the Direct3D 11 backend.

Common situations: Wrapping swap-chain or external textures as full Texture objects with unusual view dimensions; code sharing textures across APIs where the source resource is a typed view rather than a plain 2D resource.

Related errors


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

Appendix: source

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

                SetNativeDeviceChild(texture.AsDeviceChild());

                SkipInit(out Texture2DDesc textureDesc);
                texture.GetDesc(ref textureDesc);

                var newTextureDescription = ConvertFromNativeDescription(textureDesc);
                var newTextureViewDescription = new TextureViewDescription
                {
                    Format = (PixelFormat) srvDescription.Format,
                    Flags = newTextureDescription.Flags
                };

                return InitializeFrom(parentTexture: null, in newTextureDescription, in newTextureViewDescription, textureDatas: null);
            }
            else
            {
                // TODO: Implement other view types?
                throw new NotImplementedException($"Creating a texture from a SRV with dimension {srvDescription.ViewDimension} is not implemented");
            }
        }

        /// <summary>
        ///   Swaps the Texture's internal data with another Texture.
        /// </summary>
        /// <param name="other">The other Texture.</param>
        internal override void SwapInternal(GraphicsResourceBase other)
        {
            var otherTexture = (Texture)other;

            base.SwapInternal(other);

            var rtv = renderTargetView;
            renderTargetView = otherTexture.renderTargetView;
            otherTexture.renderTargetView = rtv;

            var dsv = depthStencilView;

View on GitHub (pinned to 96fad776d2)