stride3d/stride · error · NotImplementedException

D3D12 shader compilation is not supported on this platform

Error message

D3D12 shader compilation is not supported on this platform

What it means

For D3D12 backends, EffectCompiler converts SPIR-V to DXIL via Spv2DXIL (spirv_to_dxil) only when the platform supports it (guarded by a platform #if). On platforms without the native Spv2DXIL dependency the else branch throws NotImplementedException. D3D12 shader compilation is simply unavailable in that build/environment.

Solutions

  1. Select a supported graphics backend (e.g. Vulkan) instead of Direct3D12 in the game's graphics profile/platform settings.
  2. Run on a supported desktop platform where the Spv2DXIL native library ships with Stride (Windows x64).
  3. Rebuild/restore the native dependencies so the D3D12 path is compiled in (check the Spv2DXIL native package/binaries in the output folder).
  4. If targeting a custom platform, port or stub the spirv_to_dxil step and implement the DXIL pipeline path yourself.

Example fix

// before (game settings / code): D3D12 on unsupported platform
GameSettings.GraphicsProfile = GraphicsProfile.Level_11_1;
graphicsDevice = new GraphicsDevice(Direct3D12); // NotImplementedException

// after
graphicsDevice = new GraphicsDevice(Vulkan); // supported backend on this platform
Defensive patterns

Strategy: fallback

Validate before calling

// check backend availability before requesting D3D12
#if !STRIDE_PLATFORM_DESKTOP
#error D3D12 shader compilation requires a supported desktop platform build.
#endif

if (requestedBackend == GraphicsBackend.Direct3D12 && !Direct3D12Device.IsSupported())
    graphicsBackend = GraphicsBackend.Vulkan; // fallback before compiling effects

Type guard

static bool IsD3D12CompilationAvailable() =>
#if STRIDE_PLATFORM_DESKTOP
        true; // plus verify Spv2DXIL native library loads
#else
        false;
#endif

Try / catch

try
{
    var effect = effectCompiler.Compile(effectSource, parameters);
}
catch (NotImplementedException ex) when (ex.Message.Contains("D3D12 shader compilation is not supported"))
{
    log.Warn("D3D12/DXIL path unavailable on this platform; retrying with a supported backend.");
    effect = CompileWithFallbackBackend(effectSource, parameters); // e.g. Vulkan
}

Prevention

When it happens

Trigger: EffectCompiler.Compile runs with a D3D12 graphics device on a platform where the STRIDE_PLATFORM_DESKTOP / Spv2DXIL code path is compiled out, so spirv_to_dxil cannot be used — e.g. requesting D3D12 rendering on unsupported or non-desktop configurations.

Common situations: Running a Stride build without the D3D12/DXIL native dependencies; forcing D3D12 as the graphics backend on Linux/unsupported platforms; a game.config or platform setting selecting Direct3D12 where only Vulkan/other backends are viable; missing Spv2DXIL native binaries in the deployment.

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/6b822753911bb270. Report an issue: GitHub.

Appendix: source

Thrown at sources/shaders/Stride.Shaders.Compilers/EffectCompiler.cs:337

                        // When this is a compute shader, there is no need to scan other stages
                        if (shaderStage == ShaderStage.Compute)
                            break;
                    }
                }
                // TODO: Move that code inside ShaderCompiler (need a new interface for processing SPIR-V)
                else if (effectParameters.Platform == GraphicsPlatform.Direct3D12)
                {
#if STRIDE_PLATFORM_DESKTOP
                    if (OperatingSystem.IsWindows())
                    {
                        // Check API
                        Spv2DXIL.spirv_to_dxil_get_version();
                        CompileDxilPipeline(spirvBytecode, entryPoints, shaderStageBytecodes);
                    }
                    else
#endif
                    {
                        throw new NotImplementedException("D3D12 shader compilation is not supported on this platform");
                    }
                }
                else
                {
                    var spirvBytecodeArray = spirvBytecode.ToArray();
                    var spirvBytecodeId = ObjectId.FromBytes(spirvBytecodeArray);
                    foreach (var entryPoint in entryPoints)
                    {
                        var entryPointName = new byte[Encoding.UTF8.GetByteCount(entryPoint.Name) + 1];
                        entryPointName[^1] = 0;
                        Encoding.UTF8.GetBytes(entryPoint.Name.AsSpan(), entryPointName);

                        shaderStageBytecodes.Add(new ShaderBytecode
                        {
                            Stage = entryPoint.Stage,
                            Data = spirvBytecodeArray,
                            Id = spirvBytecodeId,
                            EntryPoint = entryPointName,

View on GitHub (pinned to 96fad776d2)