stride3d/stride · error · ArgumentOutOfRangeException
Cannot specify the format for more than 8 Render Targets.
Error message
Cannot specify the format for more than 8 Render Targets.
What it means
RenderOutputDescription's constructor validates that the renderTargetFormats span has at most 8 entries, matching the MaximumRenderTargetCount supported by the underlying GPU API (D3D11/Vulkan simultaneous render target limit). The library throws ArgumentOutOfRangeException immediately if more formats are supplied.
Solutions
- Reduce the number of render target formats to 8 or fewer
- Split rendering into multiple passes if more than 8 simultaneous targets are needed
- Assert/span slice: only take the first 8 formats if the extra entries were accidental
Example fix
// before var desc = new RenderOutputDescription(formats); // formats.Length == 12 // after var desc = new RenderOutputDescription(formats.Slice(0, Math.Min(formats.Length, 8)));
Defensive patterns
Strategy: validation
Validate before calling
if (formats.Length > 8) throw new InvalidOperationException("Max 8 render targets supported"); Prevention
- Never exceed 8 simultaneous render target formats
- Split heavy G-buffer setups into multiple passes
When it happens
Trigger: Passing a ReadOnlySpan<PixelFormat> with Length > 8 to the RenderOutputDescription constructor.
Common situations: Building a render frame description for a graphics API that supports more render targets than Stride's 8-MRT limit (e.g. Metal allows more), or programmatically generating formats without checking count.
Understand the failure class
Background: "value must be between 0 and 1" / "out of range" / "must not be negative" errors: fixing range-validation failures across open-source libraries — this error's family across 42 libraries.
Related errors
- Invalid mipmap level
- Invalid z slice index
- Invalid array slice index
- The Graphics Resource is a Texture, but its dimension is…
- Value must be in between 1 and 32
AI-assisted analysis of stride3d/stride@96fad776d2 (2026-09-14).
Data as JSON: /api/errors/81a56d3278d90bda.
Report an issue: GitHub.
Appendix: source
Thrown at sources/engine/Stride.Graphics/RenderOutputDescription.cs:185
/// </param>
/// <param name="depthStencilFormat">
/// The depth format of the Depth-Stencil Buffer.
/// Specify <see cref="PixelFormat.None"/> to disable the Depth-Stencil Buffer.
/// </param>
/// <param name="multisampleCount">
/// The number of samples to use when multi-sampling.
/// Specify <see cref="MultisampleCount.None"/> to disable multi-sampling.
/// </param>
/// <exception cref="ArgumentOutOfRangeException">
/// Cannot specify the format for more than 8 Render Targets in <paramref name="renderTargetFormats"/>.
/// </exception>
public RenderOutputDescription(ReadOnlySpan<PixelFormat> renderTargetFormats,
PixelFormat depthStencilFormat = PixelFormat.None,
MultisampleCount multisampleCount = MultisampleCount.None)
: this()
{
if (renderTargetFormats.Length > 8)
throw new ArgumentOutOfRangeException(nameof(renderTargetFormats), "Cannot specify the format for more than 8 Render Targets.");
int lastSetRenderTarget = -1;
for (int i = 0; i < MaximumRenderTargetCount; i++)
if (renderTargetFormats[i] != PixelFormat.None)
lastSetRenderTarget = i;
RenderTargetCount = lastSetRenderTarget + 1; // +1 so 0 if -1, 1 if 0, etc.
renderTargetFormats.CopyTo(RenderTargetFormats);
DepthStencilFormat = depthStencilFormat;
MultisampleCount = multisampleCount;
}
/// <summary>
/// Captures the description of the pipeline render output from a Command List.
/// </summary>
/// <param name="commandList">The Command List from which to capture the pipeline render output configuration.</param>
public unsafe void CaptureState(CommandList commandList)View on GitHub (pinned to 96fad776d2)