{"record":{"id":"3e4ea0a962342717","repo":"stride3d/stride","slug":"format-pixelformat-is-not-supported-when-using-a-flip-model","errorCode":null,"errorMessage":"Format '{pixelFormat}' is not supported when using a flip model swapchain","messagePattern":"Format '(.+?)' is not supported when using a flip model swapchain","errorType":"exception","errorClass":"ArgumentException","httpStatus":null,"severity":"error","filePath":"sources/engine/Stride.Graphics/Direct3D/SwapChainGraphicsPresenter.Direct3D.cs","lineNumber":843,"sourceCode":"        ///   The given <paramref name=\"pixelFormat\"/> does not have a direct analog supported by\n        ///   the flip model.\n        /// </exception>\n        /// <remarks>\n        ///   To learn more about the DXGI flip model, see <see href=\"https://learn.microsoft.com/en-us/windows/win32/direct3ddxgi/dxgi-flip-model\"/>.\n        ///   <br/>\n        ///   For more information on HDR output, see <see href=\"https://learn.microsoft.com/en-us/windows/win32/direct3darticles/high-dynamic-range\"/>.\n        /// </remarks>\n        private static PixelFormat ToSupportedFlipModelFormat(PixelFormat pixelFormat)\n        {\n            var nonSRgb = pixelFormat.ToNonSRgb();\n            return nonSRgb switch\n            {\n                PixelFormat.R16G16B16A16_Float or // scRGB HDR, should use PresenterColorSpace.RgbFullG10NoneP709, gets converted by Windows to display color space\n                PixelFormat.R10G10B10A2_UNorm or  // HDR10 / BT.2100 HDR, should use PresenterColorSpace.RgbFullG2084NoneP2020, directly sent to display\n                PixelFormat.B8G8R8A8_UNorm or\n                PixelFormat.R8G8B8A8_UNorm => nonSRgb,\n\n                _ => throw new ArgumentException($\"Format '{pixelFormat}' is not supported when using a flip model swapchain\", nameof(pixelFormat))\n            };\n        }\n\n        /// <summary>\n        ///   Queries the latest DXGI Swap-Chain version supported.\n        /// </summary>\n        private static uint GetLatestDxgiSwapChainVersion(IDXGISwapChain1* dxgiSwapChain)\n        {\n            HResult result;\n            uint dxgiSwapChainVersion;\n\n            if ((result = dxgiSwapChain->QueryInterface<IDXGISwapChain4>(out _)).IsSuccess)\n            {\n                dxgiSwapChainVersion = 4;\n                dxgiSwapChain->Release();\n            }\n            else if ((result = dxgiSwapChain->QueryInterface<IDXGISwapChain3>(out _)).IsSuccess)\n            {","sourceCodeStart":825,"sourceCodeEnd":861,"githubUrl":"https://github.com/stride3d/stride/blob/96fad776d210c221682aac1ccdf4c79dc046fc38/sources/engine/Stride.Graphics/Direct3D/SwapChainGraphicsPresenter.Direct3D.cs#L825-L861","documentation":"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.","triggerScenarios":"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.","commonSituations":"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).","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."],"exampleFix":"// before\npresenterDescription.ColorSpace = PixelFormat.B8G8R8X8_UNorm;\n// after\npresenterDescription.ColorSpace = PixelFormat.B8G8R8A8_UNorm;","handlingStrategy":"validation","validationCode":"static readonly PixelFormat[] FlipModelFormats =\n    { PixelFormat.R8G8B8A8_UNorm, PixelFormat.B8G8R8A8_UNorm, PixelFormat.R10G10B10A2_UNorm, PixelFormat.R16G16B16A16_Float };\nif (!FlipModelFormats.Contains(description.ColorSpace))\n    throw new InvalidOperationException($\"{description.ColorSpace} is not a flip-model compatible back-buffer format\");","typeGuard":"bool IsFlipModelFormat(PixelFormat f) => f is PixelFormat.R8G8B8A8_UNorm or PixelFormat.B8G8R8A8_UNorm or PixelFormat.R10G10B10A2_UNorm or PixelFormat.R16G16B16A16_Float;","tryCatchPattern":"try { presenter.ResizeBackBuffer(w, h, format); }\ncatch (ArgumentException) { presenter.ResizeBackBuffer(w, h, PixelFormat.B8G8R8A8_UNorm); }","preventionTips":["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"],"tags":["direct3d","swapchain","pixel-format","hdr","graphics"],"backgroundTag":"unsupported-dtype","analyzedSha":"96fad776d210c221682aac1ccdf4c79dc046fc38","analyzedAt":"2026-09-14T02:59:31.279Z","contentChangedAt":"2026-09-14T02:59:31.279Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}