stride3d/stride · error · NotImplementedException

An unknown EffectParameterClass was found.

Error message

An unknown EffectParameterClass was found.

What it means

While computing member sizes for shader reflection data, the compiler switches on EffectParameterClass (e.g. Vector, MatrixRows) to compute byte size. Encountering a parameter class not handled by the switch means the D3D reflection produced a class the compiler doesn't model, so it throws NotImplementedException.

Solutions

  1. Simplify the offending cbuffer member (use plain floats/vectors/matrices) in the HLSL source.
  2. Identify which member triggers it (the last memberType processed) and rewrite that shader construct.
  3. Update Stride to a version whose EffectParameterClass handling covers the class reported.
  4. If it is a new D3D reflection class from an SDK upgrade, pin the older d3dcompiler or extend the switch locally.

Example fix

// before
struct Params { MyInterface obj; float4 color; }; // interface member in cbuffer
// after
struct Params { float4 color; }; // only scalar/vector/matrix members
Defensive patterns

Strategy: try-catch

Try / catch

try { var bc = ShaderCompiler.Compile(src, ep, stage, profile); }
catch (NotImplementedException ex) when (ex.Message.Contains("EffectParameterClass")) { /* simplify the offending cbuffer member or update Stride */ }

Prevention

When it happens

Trigger: Compiling/reflecting a shader whose constant buffer contains a member with an EffectParameterClass outside the handled set (scalar/vector/matrix classes) — e.g. unusual structured/interface/annotation parameter classes emitted by exotic HLSL constructs or a newer d3dcompiler reflecting new classes.

Common situations: Shaders using interfaces, structured buffers in cbuffers, or toolchain-produced effects with novel reflection classes; upgrading the Windows SDK/D3D compiler so reflection reports classes the old Stride switch never anticipated.

Related errors


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

Appendix: source

Thrown at sources/shaders/Stride.Shaders.Compilers/Direct3D/ShaderCompiler.cs:578

                        }
                        case EffectParameterClass.Color:
                        case EffectParameterClass.Vector:
                        {
                            size = elementSize * memberType.ColumnCount;
                            break;
                        }
                        case EffectParameterClass.MatrixColumns:
                        {
                            size = elementSize * (4 * (memberType.ColumnCount - 1) + memberType.RowCount);
                            break;
                        }
                        case EffectParameterClass.MatrixRows:
                        {
                            size = elementSize * (4 * (memberType.RowCount - 1) + memberType.ColumnCount);
                            break;
                        }
                        default:
                            throw new NotImplementedException("An unknown EffectParameterClass was found.");
                    }

                    // Update element size
                    memberType.ElementSize = size;

                    // Array
                    if (memberType.Elements > 0)
                    {
                        var roundedSize = (size + 15) / 16 * 16; // Round up to 16 bytes (size of float4)
                        size += roundedSize * (memberType.Elements - 1);
                        alignment = 16;
                    }

                    // Align to float4 if it is bigger than leftover space in current float4
                    if (constantBufferOffset / 16 != (constantBufferOffset + size - 1) / 16)
                        alignment = 16;

                    // Align offset and store it as member offset

View on GitHub (pinned to 96fad776d2)