{"record":{"id":"7ef2076a8c507993","repo":"stride3d/stride","slug":"unsupported-depth-format-format","errorCode":null,"errorMessage":"Unsupported depth format [{format}]","messagePattern":"Unsupported depth format \\[(.+?)\\]","errorType":"exception","errorClass":"NotSupportedException","httpStatus":null,"severity":"error","filePath":"sources/engine/Stride.Engine/Rendering/Compositing/ForwardRenderer.cs","lineNumber":457,"sourceCode":"                case PixelFormat.R32_Typeless:\n                case PixelFormat.D32_Float:\n                    result = PixelFormat.R32_Float;\n                    break;\n\n                // Note: for those formats we lose stencil buffer information during MSAA -> non-MSAA conversion\n                case PixelFormat.R24G8_Typeless:\n                case PixelFormat.D24_UNorm_S8_UInt:\n                case PixelFormat.R24_UNorm_X8_Typeless:\n                    result = PixelFormat.R32_Float;\n                    break;\n                case PixelFormat.R32G8X24_Typeless:\n                case PixelFormat.D32_Float_S8X24_UInt:\n                case PixelFormat.R32_Float_X8X24_Typeless:\n                    result = PixelFormat.R32_Float;\n                    break;\n\n                default:\n                    throw new NotSupportedException($\"Unsupported depth format [{format}]\");\n            }\n\n            return result;\n        }\n\n        /// <summary>\n        /// Resolves the MSAA textures. Converts MSAA currentRenderTargets and currentDepthStencil into currentRenderTargetsNonMSAA and currentDepthStencilNonMSAA.\n        /// </summary>\n        /// <param name=\"drawContext\">The draw context.</param>\n        private void ResolveMSAA(RenderDrawContext drawContext)\n        {\n            // Resolve render targets\n            CollectionsMarshal.SetCount(currentRenderTargetsNonMSAA, currentRenderTargets.Count);\n\n            for (int index = 0; index < currentRenderTargets.Count; index++)\n            {\n                var input = currentRenderTargets[index];\n","sourceCodeStart":439,"sourceCodeEnd":475,"githubUrl":"https://github.com/stride3d/stride/blob/96fad776d210c221682aac1ccdf4c79dc046fc38/sources/engine/Stride.Engine/Rendering/Compositing/ForwardRenderer.cs#L439-L475","documentation":"ComputeNonMSAADepthFormat converts a multisample-compatible depth-stencil PixelFormat into its non-MSAA depth equivalent and throws NotSupportedException for any depth format it does not know how to map. The switch only handles known depth/depth-stencil formats, so a new or unusual format reaching this code is unsupported by the forward renderer's depth handling.","triggerScenarios":"Configuring a RenderStage/render output with a depth buffer PixelFormat outside the supported set (e.g. an exotic typeless or combined format not in the switch) while using ForwardRenderer, causing the format mapping lookup to hit the default case.","commonSituations":"Custom GraphicsCompositor or render stage setups with hand-picked depth formats; migrating between graphics APIs/backends where a format is valid on one backend only; upgrading Stride when new PixelFormat values appear but the mapping wasn't extended.","solutions":["Set the depth-stencil texture format to a standard supported value (D32_Float, D24_UNorm_S8_UInt, D16_UNorm, or the documented MSAA depth formats the renderer maps).","Leave depth format selection to defaults unless you have a specific need; let the renderer/compositor pick the depth format.","If you must support a new format, extend the switch in ComputeNonMSAADepthFormat with the mapping (patching the library).","Log/inspect the incoming format at pipeline setup and clamp unsupported values before creating the render stage output."],"exampleFix":"// before\nrenderStage.Output.DepthStencilState = new DepthStencilState { DepthBufferFormat = PixelFormat.R32G32_Typeless }; // unsupported\n// after\nrenderStage.Output.DepthStencilState = new DepthStencilState { DepthBufferFormat = PixelFormat.D32_Float };","handlingStrategy":"validation","validationCode":"PixelFormat[] supported = { PixelFormat.D32_Float, PixelFormat.D24_UNorm_S8_UInt, PixelFormat.D16_UNorm, PixelFormat.D32_Float_S8X24_UInt, PixelFormat.R32_Float_X8X24_Typeless };\nbool isSupportedDepthFormat(PixelFormat f) => Array.IndexOf(supported, f) >= 0;","typeGuard":null,"tryCatchPattern":"try { var fmt = ComputeNonMSAADepthFormat(format); } catch (NotSupportedException) { format = PixelFormat.D32_Float; }","preventionTips":["Use standard depth formats (D32_Float, D24_UNorm_S8_UInt, D16_UNorm)","Avoid custom typeless formats in render stage depth outputs","Let the renderer choose default depth formats","Re-check format mapping when upgrading Stride versions"],"tags":["rendering","pixel-format","unsupported"],"backgroundTag":"unsupported-operation","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"}