stride3d/stride · error · NotSupportedException

Platform is not supported by TextureTool

Error message

Platform {platform} is not supported by TextureTool

What it means

TextureHelper.DetermineOutputFormat switches on the target GraphicsPlatform to pick a compatible compressed/uncompressed pixel format; the switch has no case for the given platform, so the default arm throws NotSupportedException. The texture pipeline cannot produce an output format for an unknown platform.

Solutions

  1. Set the target platform on the texture import/compile parameters to a supported one (Windows/Linux/Android/iOS, etc.).
  2. Check how the build pipeline derives Parameters.Platform; ensure it maps from the solution's target platform.
  3. If targeting a new platform, add a case to the format switch in TextureHelper (or upgrade Stride to a version that supports it).

Example fix

// before
parameters.Platform = GraphicsPlatform.Null;
// after
parameters.Platform = GraphicsPlatform.Direct3D11; // or Vulkan/Metal per target
Defensive patterns

Strategy: validation

Validate before calling

var supported = new[] { GraphicsPlatform.Direct3D11, GraphicsPlatform.Vulkan, GraphicsPlatform.Metal, GraphicsPlatform.OpenGL };
if (!supported.Contains(parameters.Platform))
    throw new NotSupportedException($"TextureTool cannot process platform {parameters.Platform}");

Type guard

bool IsTextureToolPlatform(GraphicsPlatform p) =>
    p is GraphicsPlatform.Direct3D11 or GraphicsPlatform.Vulkan or GraphicsPlatform.Metal or GraphicsPlatform.OpenGL;

Try / catch

try
{
    var fmt = TextureHelper.DetermineOutputFormat(parameters, logger, quality, ...);
}
catch (NotSupportedException ex) when (ex.Message.Contains("TextureTool"))
{
    logger.Error($"Fix Parameters.Platform: {ex.Message}");
}

Prevention

When it happens

Trigger: Importing/compiling a texture asset whose Parameters.Platform is a GraphicsPlatform value not handled by the switch (e.g. Null platform, or a platform added in a newer Stride than the tool).

Common situations: Building with a customized/patched build pipeline that sets an unexpected platform; running the texture toolchain headless where platform defaults to Null; platform enum extended without updating TextureHelper.

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/57ab175fae032048. Report an issue: GitHub.

Appendix: source

Thrown at sources/engine/Stride.Assets/Textures/TextureHelper.cs:311

                                            outputFormat = PixelFormat.BC4_UNorm;
                                        }
                                        else if (inputImageFormat.IsHDR)
                                        {
                                            // TODO BC6H for HDR (modern GPU/ISPC encoders make encode time tractable; profile ≥11.0, AlphaFormat.None).
                                            outputFormat = inputImageFormat;
                                        }
                                        // TODO BC7 for Quality=High color / UI (modern GPU/ISPC encoders make encode time tractable).
                                    }
                                    break;
                                default:
                                    // Null platform
                                    outputFormat = parameters.IsSRgb ? PixelFormat.R8G8B8A8_UNorm_SRgb : PixelFormat.R8G8B8A8_UNorm;
                                    break;
                            }
                            break;

                        default:
                            throw new NotSupportedException("Platform " + parameters.Platform + " is not supported by TextureTool");
                    }
                    break;
                case false:
                    outputFormat = inputImageFormat;
                    break;
                default:
                    throw new ArgumentOutOfRangeException();
            }

            return outputFormat;
        }

        public static ResultStatus ImportTextureImageRaw(TextureTool textureTool, TexImage texImage, ImportParameters parameters, CancellationToken cancellationToken, Logger logger)
        {
            // Apply transformations
            textureTool.Decompress(texImage, parameters.IsSRgb);

            // Special case when the input texture is monochromatic but it is supposed to be a color and we are working in SRGB

View on GitHub (pinned to 96fad776d2)