stride3d/stride · error · NotSupportedException

Only cubemaps are currently supported as input

Error message

Only cubemaps are currently supported as input

What it means

RadiancePrefilteringGGX.DrawCore throws NotSupportedException when RadianceMap is null or its Dimension is not TextureCube. The prefiltering shader importance-samples the environment by cube-face lookups, so only a cubemap input is implemented; 2D panorama or array inputs are rejected.

Solutions

  1. Convert the equirectangular panorama to a cubemap first (Stride's pano-to-cube pass), then assign it to RadianceMap.
  2. Ensure RadianceMap is a Texture with Dimension == TextureCube.
  3. Assign RadianceMap before running the prefilter in your IBL setup.

Example fix

// before
prefilter.RadianceMap = panoramaTexture2D; // 2D equirect
// after
var cube = panoramaTexture2D.ToCubeView(); // run Stride's pano->cubemap conversion
prefilter.RadianceMap = cube;
Defensive patterns

Strategy: validation

Validate before calling

if (input == null || input.Dimension != TextureDimension.TextureCube)
    throw new InvalidOperationException("RadianceMap must be a cubemap texture");

Type guard

bool IsCubemap(Texture t) => t != null && t.Dimension == TextureDimension.TextureCube;

Try / catch

try { prefilter.Render(context); }
catch (NotSupportedException ex) { Log.Error("RadianceMap must be a cubemap; convert panoramas first.", ex); }

Prevention

When it happens

Trigger: Leaving RadianceMap unset, or assigning a 2D texture / texture array (e.g. equirectangular panorama not yet converted to cubemap) as RadianceMap.

Common situations: Loading an HDR panorama and feeding it directly into the prefilter without the pano-to-cubemap conversion pass; asset pipeline emitting non-cube environment textures; forgetting to set RadianceMap before rendering.

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


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

Appendix: source

Thrown at sources/engine/Stride.Rendering/Rendering/ComputeEffect/GGXPrefiltering/RadiancePrefilteringGGX.cs:83

                if (!MathUtil.IsPow2(value))
                    throw new ArgumentException("The provided value should be a power of 2");

                samplingsCount = Math.Max(1, value);
            }
        }

        protected override void DrawCore(RenderDrawContext context)
        {
            var output = PrefilteredRadiance;
            if (output == null || (output.ViewDimension != TextureDimension.Texture2D && output.ViewDimension != TextureDimension.TextureCube) || output.ArraySize != 6)
                throw new NotSupportedException("Only array of 2D textures are currently supported as output");

            if (!output.IsUnorderedAccess || output.IsRenderTarget)
                throw new NotSupportedException("Only non-rendertarget unordered access textures are supported as output");

            var input = RadianceMap;
            if (input == null || input.Dimension != TextureDimension.TextureCube)
                throw new NotSupportedException("Only cubemaps are currently supported as input");

            var roughness = 0f;
            var faceCount = output.ArraySize;
            var levelSize = new Int2(output.Width, output.Height);
            var mipCount = MipmapGenerationCount == 0 ? output.MipLevelCount : MipmapGenerationCount;

            for (int l = 0; l < mipCount; l++)
            {
                if (l == 0 && DoNotFilterHighestLevel && input.Width >= output.Width)
                {
                    var inputLevel = MathUtil.Log2(input.Width / output.Width);
                    for (int f = 0; f < 6; f++)
                    {
                        var inputSubresource = inputLevel + f * input.MipLevelCount;
                        var outputSubresource = 0 + f * output.MipLevelCount;
                        context.CommandList.CopyRegion(input, inputSubresource, null, output, outputSubresource);
                    }
                }

View on GitHub (pinned to 96fad776d2)