stride3d/stride · error · NotSupportedException

Only array of 2D textures are currently supported as output

Error message

Only array of 2D textures are currently supported as output

What it means

RadiancePrefilteringGGXNoCompute.DrawCore validates the PrefilteredRadiance output texture before rendering. It throws NotSupportedException when the output is null, is not a 2D texture or cube view, or has ArraySize != 6 (i.e. it requires a 6-face 2D texture array used to emulate a cubemap render target).

Solutions

  1. Allocate PrefilteredRadiance as a Texture2D with ArraySize = 6 and usage as render target (GraphicsDevice.AllocateTexture with TextureDescription.New2D(width, height, format, TextureFlags.RenderTarget, arraySize: 6)).
  2. Ensure PrefilteredRadiance is assigned before the effect is drawn.
  3. If you only have a cubemap texture, create it as render-targetable 2D array or use the compute-based RadiancePrefilteringGGX effect instead.
  4. Wrap the draw in validation of ViewDimension/ArraySize before invoking.

Example fix

// before
var output = Texture.New2D(device, 256, 256, PixelFormat.R16G16B16A16_Float); // ArraySize=1
prefilter.PrefilteredRadiance = output;
// after
var output = Texture.New2D(device, 256, 256, PixelFormat.R16G16B16A16_Float, TextureFlags.ShaderResource | TextureFlags.RenderTarget, 6, 0);
prefilter.PrefilteredRadiance = output;
Defensive patterns

Strategy: validation

Validate before calling

if (prefilter.PrefilteredRadiance == null || (prefilter.PrefilteredRadiance.ViewDimension != TextureDimension.Texture2D && prefilter.PrefilteredRadiance.ViewDimension != TextureDimension.TextureCube) || prefilter.PrefilteredRadiance.ArraySize != 6)
    throw new ArgumentException("PrefilteredRadiance must be a 2D texture (or cube view) with ArraySize == 6");

Type guard

bool IsValidPrefilterOutput(Texture t) => t != null && t.IsRenderTarget && t.ArraySize == 6 && (t.ViewDimension == TextureDimension.Texture2D || t.ViewDimension == TextureDimension.TextureCube);

Try / catch

try { prefilter.Draw(context); } catch (NotSupportedException ex) { log.Error(ex, "PrefilteredRadiance must be a 6-slice 2D render-target array"); }

Prevention

When it happens

Trigger: Calling Draw on RadiancePrefilteringGGXNoCompute with PrefilteredRadiance set to a non-2D texture (e.g. Texture3D), or a 2D texture with ArraySize other than 6, or leaving PrefilteredRadiance null.

Common situations: Preallocating the prefiltered radiance target with default ArraySize=1, swapping in a different texture format for testing, or forgetting to allocate a 6-slice texture array for cubemap prefiltering in the IBL pipeline.

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/69434edf08215421. Report an issue: GitHub.

Appendix: source

Thrown at sources/engine/Stride.Rendering/Rendering/ComputeEffect/GGXPrefiltering/RadiancePrefilteringGGXNoCompute.cs:79

        {
            get { return samplingsCount; }
            set
            {
                if (value > 1024)
                    throw new ArgumentOutOfRangeException(nameof(value));

                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.IsRenderTarget)
                throw new NotSupportedException("Only render targets are supported as output");

            var input = RadianceMap;
            if (input == null || input.ViewDimension != 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 mipLevel = 0; mipLevel < mipCount; mipLevel++)
            {
                for (int faceIndex = 0; faceIndex < faceCount; faceIndex++)
                {
                    using var outputView = output.ToTextureView(ViewType.Single, faceIndex, mipLevel);

View on GitHub (pinned to 96fad776d2)