stride3d/stride · error · InvalidOperationException
Support only output scaling to the same direction
Error message
Support only output scaling to the same direction
What it means
ImageMultiScaler tracks the scaling direction (up vs down) established by its first output. Once set, all outputs must scale the same way; PrepareScaling throws InvalidOperationException if a later output's size relative to the input reverses that direction (e.g. first output is half-size downscale, second is double-size upscale).
Solutions
- Use one ImageMultiScaler per scaling direction: one for all downscaled outputs, another for all upscaled outputs.
- Ensure every output added to the same scaler is consistently smaller than the input, or consistently larger.
- Compute output sizes from a single ratio direction (all factors < 1 or all > 1) in setup code.
Example fix
// before scaler.SetOutput(0, rtHalf); // downscale scaler.SetOutput(1, rtDouble); // upscale -> throws // after downScaler.SetOutput(0, rtHalf); upScaler.SetOutput(0, rtDouble);
Defensive patterns
Strategy: validation
Validate before calling
bool allDown = outputs.All(o => o.Size < inputSize);
bool allUp = outputs.All(o => o.Size > inputSize);
if (!allDown && !allUp) throw new InvalidOperationException("Mixing upscale and downscale outputs on one ImageMultiScaler is unsupported"); Try / catch
try { scaler.Draw(context); }
catch (InvalidOperationException) { Log.Warning("Mixed scaling directions; splitting scalers at next init"); } Prevention
- Keep one ImageMultiScaler per scaling direction (downscales on one, upscales on another).
- Derive all output sizes from ratios consistently < 1 or > 1.
- Document the direction constraint next to the scaler setup code.
When it happens
Trigger: Mixing larger-than-input and smaller-than-input output textures on a single ImageMultiScaler instance, then rendering a frame that triggers PrepareScaling via DrawCore.
Common situations: Using one multi-scaler for both a blurred downsample chain and an upscaled bloom target; refactored code reusing one scaler where two directionally distinct scalers are needed.
Understand the failure class
Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.
Related errors
- Only array of 2D textures are currently supported as output
- Only render targets are supported as output
- Only cubemaps are currently supported as input
- Input and output texture cannot have same size
- Changing the panel from a user library type is currently…
AI-assisted analysis of stride3d/stride@96fad776d2 (2026-09-14).
Data as JSON: /api/errors/6a30abfb5c99ba53.
Report an issue: GitHub.
Appendix: source
Thrown at sources/engine/Stride.Rendering/Rendering/Images/ImageScaler/ImageMultiScaler.cs:145
outputPixelFormat = outputTexture.ViewFormat;
var outputSize = outputTexture.Size;
// Verify pixel format
if (outputSize < minSize || outputSize > maxSize)
{
throw new InvalidOperationException("Unsupported texture size [{0}] out of limit [{1} - {2}]".ToFormat(outputTexture.Size, minSize, maxSize));
}
if (inputSize == outputSize)
{
throw new InvalidOperationException("Input and output texture cannot have same size [{0}]".ToFormat(inputSize));
}
int newScalingDirection = outputSize.CompareTo(inputSize);
if (scalingDirection != 0 && Math.Sign(scalingDirection) != Math.Sign(newScalingDirection))
{
throw new InvalidOperationException("Support only output scaling to the same direction");
}
scalingDirection = newScalingDirection;
// Check that we are scaling to different texture sizes
foreach (var existingOutput in outputTextures)
{
if (existingOutput.Size == outputTexture.Size)
{
throw new InvalidOperationException("A texture with size [{0}] already exist with the same output size".ToFormat(existingOutput.Size));
}
}
// If the textrue is valid use it
outputTextures.Add(outputTexture);
}
}
return outputTextures.Count > 0;View on GitHub (pinned to 96fad776d2)