stride3d/stride · error · ArgumentOutOfRangeException

Unsupported format [ ] (must be not none, compressed…

Error message

Unsupported format [{0}] (must be not none, compressed, packed or typeless)

What it means

The LuminanceFormat property of LuminanceEffect rejects pixel formats that are compressed, packed, typeless, or PixelFormat.None, because the effect renders to and samples this format directly on the GPU. Any such value throws ArgumentOutOfRangeException with the formatted message.

Solutions

  1. Assign a plain color format such as PixelFormat.R16_Float or R32_Float
  2. Guard the assignment with checks on IsCompressed/IsPacked/IsTypeless/None
  3. Keep the default LuminanceFormat unless a specific HDR format is required

Example fix

// before
luminanceEffect.LuminanceFormat = PixelFormat.None;
// after
luminanceEffect.LuminanceFormat = PixelFormat.R16_Float;
Defensive patterns

Strategy: validation

Validate before calling

bool IsValidLuminanceFormat(PixelFormat f) =>
    f != PixelFormat.None && !f.IsCompressed() && !f.IsPacked() && !f.IsTypeless();

Try / catch

try { effect.LuminanceFormat = format; }
catch (ArgumentOutOfRangeException) { effect.LuminanceFormat = PixelFormat.R16_Float; }

Prevention

When it happens

Trigger: Assigning e.g. PixelFormat.None, a block-compressed format like BC1/BC7, a packed format like R11G11B10 or typeless variants to LuminanceEffect.LuminanceFormat.

Common situations: Reusing a render-target format constant from elsewhere in the pipeline that happens to be compressed, or leaving the format as None when wiring up a custom tone-mapping chain.

Understand the failure class

Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.

Related errors


AI-assisted analysis of stride3d/stride@96fad776d2 (2026-09-14). Data as JSON: /api/errors/565eb11451343308. Report an issue: GitHub.

Appendix: source

Thrown at sources/engine/Stride.Rendering/Rendering/Images/LuminanceEffect/LuminanceEffect.cs:68

            // Readback is always going to be done on the 1x1 texture
            readback = ToLoadAndUnload(readback);

            // Blur used before upscaling
            blur = ToLoadAndUnload(new GaussianBlur());
            blur.Radius = 4;
        }

        /// <summary>
        /// Luminance texture format.
        /// </summary>
        public PixelFormat LuminanceFormat
        {
            get => luminanceFormat;
            set
            {
                if (value.IsCompressed || value.IsPacked || value.IsTypeless || value == PixelFormat.None)
                {
                    throw new ArgumentOutOfRangeException(nameof(value), "Unsupported format [{0}] (must be not none, compressed, packed or typeless)".ToFormat(value));
                }
                luminanceFormat = value;
            }
        }

        /// <summary>
        /// Luminance log effect.
        /// </summary>
        public ImageEffectShader LuminanceLogEffect { get; set; }

        /// <summary>
        /// Gets or sets down scale count used to downscale the input intermediate texture used for local luminance (if no
        /// output is given). By default 1/64 of the input texture size.
        /// </summary>
        /// <value>Down scale count.</value>
        public int DownscaleCount { get; set; }

        /// <summary>

View on GitHub (pinned to 96fad776d2)