stride3d/stride · error · ArgumentException
Format ' ' is not supported when using a flip model…
Error message
Format '{pixelFormat}' is not supported when using a flip model swapchain What it means
Flip-model swapchains (DXGI flip presentation) only support a narrow set of back-buffer formats. ToSupportedFlipModelFormat maps the supported PixelFormats (HDR10, scRGB HDR, B8G8R8A8, R8G8B8A8) to their non-sRGB DXGI variants; any other format has no flip-model equivalent, so an ArgumentException is thrown.
Solutions
- Change the back-buffer PixelFormat to one of the supported flip-model formats: R8G8B8A8_UNorm, B8G8R8A8_UNorm, R10G10B10A2_UNorm, or R16G16B16A16_Float.
- For HDR, pair the format with the matching PresenterColorSpace (RgbFullG10NoneP709 for scRGB, RgbFullG2084NoneP2020 for HDR10) instead of changing the format.
- If you truly need another format, switch the swapchain to a non-flip presentation model where supported.
Example fix
// before presenterDescription.ColorSpace = PixelFormat.B8G8R8X8_UNorm; // after presenterDescription.ColorSpace = PixelFormat.B8G8R8A8_UNorm;
Defensive patterns
Strategy: validation
Validate before calling
static readonly PixelFormat[] FlipModelFormats =
{ PixelFormat.R8G8B8A8_UNorm, PixelFormat.B8G8R8A8_UNorm, PixelFormat.R10G10B10A2_UNorm, PixelFormat.R16G16B16A16_Float };
if (!FlipModelFormats.Contains(description.ColorSpace))
throw new InvalidOperationException($"{description.ColorSpace} is not a flip-model compatible back-buffer format"); Type guard
bool IsFlipModelFormat(PixelFormat f) => f is PixelFormat.R8G8B8A8_UNorm or PixelFormat.B8G8R8A8_UNorm or PixelFormat.R10G10B10A2_UNorm or PixelFormat.R16G16B16A16_Float;
Try / catch
try { presenter.ResizeBackBuffer(w, h, format); }
catch (ArgumentException) { presenter.ResizeBackBuffer(w, h, PixelFormat.B8G8R8A8_UNorm); } Prevention
- Stick to the four flip-model formats for back buffers
- Express HDR intent via PresenterColorSpace, not format changes
- Centralize back-buffer format selection in one helper
When it happens
Trigger: Calling ResizeBackBuffer on an existing flip-model swapchain, or creating one via CreateSwapChainForDesktop, with Description.ColorSpace/back-buffer PixelFormat set to an unsupported format such as B8G8R8X8, R16G16B16A16_Float under wrong color-space pairing, or any sRGB/depth/extended format.
Common situations: Switching the back-buffer format for HDR experiments to a format not in the flip-model whitelist; migrating code that used legacy bitblt-model formats; typos in format selection; choosing sRGB variants of the supported formats (mapping picks the non-sRGB form automatically, but other sRGB formats fail).
Related errors
- Unexpected error on Present
- DeviceWindowHandle cannot be null
- SurfaceRotation ' ' is not supported on Direct3D presenters.
- Window context [ ] not supported while creating SwapChain
- The . must not be zero.
AI-assisted analysis of stride3d/stride@96fad776d2 (2026-09-14).
Data as JSON: /api/errors/3e4ea0a962342717.
Report an issue: GitHub.
Appendix: source
Thrown at sources/engine/Stride.Graphics/Direct3D/SwapChainGraphicsPresenter.Direct3D.cs:843
/// The given <paramref name="pixelFormat"/> does not have a direct analog supported by
/// the flip model.
/// </exception>
/// <remarks>
/// To learn more about the DXGI flip model, see <see href="https://learn.microsoft.com/en-us/windows/win32/direct3ddxgi/dxgi-flip-model"/>.
/// <br/>
/// For more information on HDR output, see <see href="https://learn.microsoft.com/en-us/windows/win32/direct3darticles/high-dynamic-range"/>.
/// </remarks>
private static PixelFormat ToSupportedFlipModelFormat(PixelFormat pixelFormat)
{
var nonSRgb = pixelFormat.ToNonSRgb();
return nonSRgb switch
{
PixelFormat.R16G16B16A16_Float or // scRGB HDR, should use PresenterColorSpace.RgbFullG10NoneP709, gets converted by Windows to display color space
PixelFormat.R10G10B10A2_UNorm or // HDR10 / BT.2100 HDR, should use PresenterColorSpace.RgbFullG2084NoneP2020, directly sent to display
PixelFormat.B8G8R8A8_UNorm or
PixelFormat.R8G8B8A8_UNorm => nonSRgb,
_ => throw new ArgumentException($"Format '{pixelFormat}' is not supported when using a flip model swapchain", nameof(pixelFormat))
};
}
/// <summary>
/// Queries the latest DXGI Swap-Chain version supported.
/// </summary>
private static uint GetLatestDxgiSwapChainVersion(IDXGISwapChain1* dxgiSwapChain)
{
HResult result;
uint dxgiSwapChainVersion;
if ((result = dxgiSwapChain->QueryInterface<IDXGISwapChain4>(out _)).IsSuccess)
{
dxgiSwapChainVersion = 4;
dxgiSwapChain->Release();
}
else if ((result = dxgiSwapChain->QueryInterface<IDXGISwapChain3>(out _)).IsSuccess)
{View on GitHub (pinned to 96fad776d2)