{"record":{"id":"6a33fe4a5d921d97","repo":"stride3d/stride","slug":"input-and-output-texture-cannot-have-same-size-0","errorCode":null,"errorMessage":"Input and output texture cannot have same size [{0}]","messagePattern":"Input and output texture cannot have same size \\[(.+?)\\]","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"sources/engine/Stride.Rendering/Rendering/Images/ImageScaler/ImageMultiScaler.cs","lineNumber":139,"sourceCode":"                {\n                    // Verify pixel format\n                    if (outputPixelFormat != PixelFormat.None && outputPixelFormat != outputTexture.ViewFormat)\n                    {\n                        throw new InvalidOperationException(\"Output texture format [{0}] is not matching other output texture format [{1}]\".ToFormat(outputTexture.ViewFormat, outputPixelFormat));\n                    }\n                    outputPixelFormat = outputTexture.ViewFormat;\n\n                    var outputSize = outputTexture.Size;\n\n                    // Verify pixel format\n                    if (outputSize < minSize || outputSize > maxSize)\n                    {\n                        throw new InvalidOperationException(\"Unsupported texture size [{0}] out of limit [{1} - {2}]\".ToFormat(outputTexture.Size, minSize, maxSize));\n                    }\n\n                    if (inputSize == outputSize)\n                    {\n                        throw new InvalidOperationException(\"Input and output texture cannot have same size [{0}]\".ToFormat(inputSize));\n                    }\n\n                    int newScalingDirection = outputSize.CompareTo(inputSize);\n                    if (scalingDirection != 0 && Math.Sign(scalingDirection) != Math.Sign(newScalingDirection))\n                    {\n                        throw new InvalidOperationException(\"Support only output scaling to the same direction\");\n                    }\n                    scalingDirection = newScalingDirection;\n\n                    // Check that we are scaling to different texture sizes\n                    foreach (var existingOutput in outputTextures)\n                    {\n                        if (existingOutput.Size == outputTexture.Size)\n                        {\n                            throw new InvalidOperationException(\"A texture with size [{0}] already exist with the same output size\".ToFormat(existingOutput.Size));\n                        }\n                    }\n","sourceCodeStart":121,"sourceCodeEnd":157,"githubUrl":"https://github.com/stride3d/stride/blob/96fad776d210c221682aac1ccdf4c79dc046fc38/sources/engine/Stride.Rendering/Rendering/Images/ImageScaler/ImageMultiScaler.cs#L121-L157","documentation":"ImageMultiScaler is a scaling pass; it requires input and output textures to have different sizes. PrepareScaling throws InvalidOperationException when an output texture's size equals the input size, since upscaling/downscaling a texture onto one of identical dimensions is unsupported by this effect.","triggerScenarios":"Connecting an output texture with exactly the same dimensions as the input texture (inputSize == outputSize) and rendering, so DrawCore calls PrepareScaling.","commonSituations":"Auto-sizing an output to match the input 'to keep it simple'; a resize handler that makes the backbuffer equal the source resolution; copy intent where the developer should have used a blit/copy pass instead of a scaler.","solutions":["Ensure the output is strictly smaller or larger than the input; use a copy/blit (e.g. ImageScaler in copy mode or a SpriteBatch copy) if you need same-size transfer.","Skip adding the texture as a multi-scaler output when its size equals the input size.","Log/compare inputSize vs requested output size during setup to catch the equality early."],"exampleFix":"// before\nscaler.SetOutput(0, RenderTexture(inputWidth, inputHeight)); // same size\n// after\nscaler.SetOutput(0, RenderTexture(inputWidth / 2, inputHeight / 2));","handlingStrategy":"validation","validationCode":"if (outputSize == inputSize)\n    throw new InvalidOperationException(\"Use a copy/blit pass, not ImageMultiScaler, for same-size transfer\");","typeGuard":null,"tryCatchPattern":"try { scaler.Draw(context); }\ncatch (InvalidOperationException) { FallbackCopyPass(input, output); }","preventionTips":["Compute output size as a strict fraction/multiple (e.g. half) of input, never 1:1.","Use a dedicated copy pass for same-size transfers.","Assert outputSize != inputSize in texture setup helpers."],"tags":["texture-size","unsupported-operation","rendering","stride"],"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"}