stride3d/stride · error · NotImplementedException

$funcT not supported for

Error message

$funcT not supported for {thisType}

What it means

When a parameter's match index is -3 (match $funcT base type), only ByteAddressBufferType has a defined mapping (to ScalarType.UInt). Any other thisType reaching this branch triggers this NotImplementedException at expansion time.

Solutions

  1. Only invoke $funcT-parameterized intrinsics on ByteAddressBuffer values
  2. If you control the intrinsic declaration, change the parameter from $funcT to an explicit type (e.g. uint)
  3. File/patch upstream to add switch cases for additional types if support is genuinely needed

Example fix

// before
uint word = myStructuredBuffer.Load$funcT(offset);
// after
uint word = myByteAddressBuffer.Load(offset);
Defensive patterns

Strategy: validation

Validate before calling

if (paramMatchIndex == -3 && thisType is not ByteAddressBufferType)
    throw new NotSupportedException($"$funcT intrinsic requires ByteAddressBuffer, got {thisType}");

Type guard

bool SupportsFuncT(TypeBase t) => t is ByteAddressBufferType;

Try / catch

try { Expand(intrinsic, thisType); }
catch (NotImplementedException ex) when (ex.Message.Contains("$funcT not supported")) { /* fall back to explicit-type intrinsic */ }

Prevention

When it happens

Trigger: An intrinsic declared with intrin(..., $funcT) style matching (index -3) invoked with thisType being a Texture*, StructuredBuffer, regular Buffer, or any non-ByteAddressBuffer type.

Common situations: Reusing a $funcT-parameterized intrinsic (typically word-addressed buffer helpers) on structured or typed resources.

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

Appendix: source

Thrown at sources/shaders/Stride.Shaders.Parsers/Parsing/SDSL/AST/IntrinsicTemplateExpander.cs:242

                                parameterTypeHelper[index].BaseType = thisType switch
                                {
                                    TextureType t => t.ReturnType.GetElementType(),
                                    BufferType b => b.BaseType.GetElementType(),
                                    AppendStructuredBufferType b => b.BaseType,
                                    ConsumeStructuredBufferType b => b.BaseType,
                                    StructuredBufferType b => b.BaseType,
                                    null => throw new ArgumentNullException(nameof(thisType)),
                                    _ => throw new InvalidOperationException($"Can't resolve thisType base type for {thisType}"),
                                };
                            }
                            else if (matchBaseTypeIndex == -3)
                            {
                                // Match funcT base type
                                parameterTypeHelper[index].BaseType = thisType switch
                                {
                                    ByteAddressBufferType => ScalarType.UInt,
                                    null => throw new ArgumentNullException(nameof(thisType)),
                                    _ => throw new NotImplementedException($"$funcT not supported for {thisType}"),
                                };
                            }
                            else
                            {
                                parameterTypeHelper[index].BaseType = parameterTypeHelper[matchBaseTypeIndex].BaseType;
                            }
                        }
                    }

                    // Now, iterate on size permutations
                    bool firstIteration = true;
                    foreach (var sizePermutationList in sizePermutations)
                    {
                        // Reset Sizes
                        for (var index = 0; index < intrinsicDefinition.Parameters.Length + 1; index++)
                        {
                            parameterTypeHelper[index].Size1 = default;
                            parameterTypeHelper[index].Size2 = default;

View on GitHub (pinned to 96fad776d2)