{"record":{"id":"69434edf08215421","repo":"stride3d/stride","slug":"only-array-of-2d-textures-are-currently-supported-as-output-69434e","errorCode":null,"errorMessage":"Only array of 2D textures are currently supported as output","messagePattern":"Only array of 2D textures are currently supported as output","errorType":"exception","errorClass":"NotSupportedException","httpStatus":null,"severity":"error","filePath":"sources/engine/Stride.Rendering/Rendering/ComputeEffect/GGXPrefiltering/RadiancePrefilteringGGXNoCompute.cs","lineNumber":79,"sourceCode":"        {\n            get { return samplingsCount; }\n            set\n            {\n                if (value > 1024)\n                    throw new ArgumentOutOfRangeException(nameof(value));\n\n                if (!MathUtil.IsPow2(value))\n                    throw new ArgumentException(\"The provided value should be a power of 2\");\n\n                samplingsCount = Math.Max(1, value);\n            }\n        }\n\n        protected override void DrawCore(RenderDrawContext context)\n        {\n            var output = PrefilteredRadiance;\n            if (output == null || (output.ViewDimension != TextureDimension.Texture2D && output.ViewDimension != TextureDimension.TextureCube) || output.ArraySize != 6)\n                throw new NotSupportedException(\"Only array of 2D textures are currently supported as output\");\n\n            if (!output.IsRenderTarget)\n                throw new NotSupportedException(\"Only render targets are supported as output\");\n\n            var input = RadianceMap;\n            if (input == null || input.ViewDimension != TextureDimension.TextureCube)\n                throw new NotSupportedException(\"Only cubemaps are currently supported as input\");\n\n            var roughness = 0f;\n            var faceCount = output.ArraySize;\n            var levelSize = new Int2(output.Width, output.Height);\n            var mipCount = MipmapGenerationCount == 0 ? output.MipLevelCount : MipmapGenerationCount;\n\n            for (int mipLevel = 0; mipLevel < mipCount; mipLevel++)\n            {\n                for (int faceIndex = 0; faceIndex < faceCount; faceIndex++)\n                {\n                    using var outputView = output.ToTextureView(ViewType.Single, faceIndex, mipLevel);","sourceCodeStart":61,"sourceCodeEnd":97,"githubUrl":"https://github.com/stride3d/stride/blob/96fad776d210c221682aac1ccdf4c79dc046fc38/sources/engine/Stride.Rendering/Rendering/ComputeEffect/GGXPrefiltering/RadiancePrefilteringGGXNoCompute.cs#L61-L97","documentation":"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).","triggerScenarios":"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.","commonSituations":"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.","solutions":["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)).","Ensure PrefilteredRadiance is assigned before the effect is drawn.","If you only have a cubemap texture, create it as render-targetable 2D array or use the compute-based RadiancePrefilteringGGX effect instead.","Wrap the draw in validation of ViewDimension/ArraySize before invoking."],"exampleFix":"// before\nvar output = Texture.New2D(device, 256, 256, PixelFormat.R16G16B16A16_Float); // ArraySize=1\nprefilter.PrefilteredRadiance = output;\n// after\nvar output = Texture.New2D(device, 256, 256, PixelFormat.R16G16B16A16_Float, TextureFlags.ShaderResource | TextureFlags.RenderTarget, 6, 0);\nprefilter.PrefilteredRadiance = output;","handlingStrategy":"validation","validationCode":"if (prefilter.PrefilteredRadiance == null || (prefilter.PrefilteredRadiance.ViewDimension != TextureDimension.Texture2D && prefilter.PrefilteredRadiance.ViewDimension != TextureDimension.TextureCube) || prefilter.PrefilteredRadiance.ArraySize != 6)\n    throw new ArgumentException(\"PrefilteredRadiance must be a 2D texture (or cube view) with ArraySize == 6\");","typeGuard":"bool IsValidPrefilterOutput(Texture t) => t != null && t.IsRenderTarget && t.ArraySize == 6 && (t.ViewDimension == TextureDimension.Texture2D || t.ViewDimension == TextureDimension.TextureCube);","tryCatchPattern":"try { prefilter.Draw(context); } catch (NotSupportedException ex) { log.Error(ex, \"PrefilteredRadiance must be a 6-slice 2D render-target array\"); }","preventionTips":["Always allocate cubemap-like outputs via TextureDescription.New2D(..., arraySize: 6).","Include TextureFlags.RenderTarget for the NoCompute variant.","Add an asset-load assertion validating ViewDimension/ArraySize before scene use."],"tags":["stride","rendering","textures","unsupported-operation"],"backgroundTag":"invalid-argument-value","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"}