stride3d/stride · error · NotImplementedException

Exception of type 'System.NotImplementedException' was…

Error message

Exception of type 'System.NotImplementedException' was thrown.

What it means

CompileGatherCmpGreen implements the SPIR-V backend for TextureGatherCmp with green-component results. It supports optional offsets variants but does not implement the 'status' (query-fragment) parameter; if a non-null status value is supplied it throws NotImplementedException. The bare message is the default NotImplementedException text.

Solutions

  1. Remove the status argument from the GatherCmpGreen call — use the plain or const-offsets overload instead.
  2. Switch to an overload with offset parameters only (o1..o4) which is implemented via CompileGatherDrefConstOffsets.
  3. If status support is required, implement it in CompileGatherCmpGreen (TextureMethodsImplementations.cs:334) rather than relying on the throw.

Example fix

// before
Texture2D.GatherCmpGreen(sampler, uv, dref, offset, status);
// after
Texture2D.GatherCmpGreen(sampler, uv, dref, offset); // status not supported
Defensive patterns

Strategy: try-catch

Validate before calling

if (status != null) throw new NotSupportedException("GatherCmpGreen with status is not implemented in the SPIR-V backend");

Type guard

bool StatusSupported => status is null;

Try / catch

try { result = impl.CompileGatherCmpGreen(table, context, builder, fnType, tex, s, x, dref, o, o1, o2, o3, o4, status); }
catch (NotImplementedException) { result = FallbackGatherWithoutStatus(); }

Prevention

When it happens

Trigger: Calling GatherCmpGreen (or the mapped texture.gatherRed/green comparison API) while passing a status/result-fragment argument, e.g. an overload with a status output parameter.

Common situations: Porting HLSL gather_with_cmp_overloads that include the optional status parameter; automatic translation of HLSL intrinsic overloads to SDSL hitting an unimplemented path.

Related errors


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

Appendix: source

Thrown at sources/shaders/Stride.Shaders.Parsers/Parsing/SDSL/AST/TextureMethodsImplementations.cs:338

    {
        if (status != null)
            throw new NotImplementedException();
        return CompileGatherDref(table, context, builder, functionType, texture, s, x, compareValue, o, location);
    }

    public override SpirvValue CompileGatherCmpRed(SymbolTable table, SpirvContext context, SpirvBuilder builder, FunctionType functionType, SpirvValue texture, SpirvValue s, SpirvValue x, SpirvValue compareValue, SpirvValue? o = null, SpirvValue? o1 = null, SpirvValue? o2 = null, SpirvValue? o3 = null, SpirvValue? o4 = null, SpirvValue? status = null, TextLocation location = default)
    {
        if (status != null)
            throw new NotImplementedException();
        if (o1 != null)
            return CompileGatherDrefConstOffsets(table, context, builder, functionType, texture, s, x, compareValue, o1.Value, o2!.Value, o3!.Value, o4!.Value, location);
        return CompileGatherDref(table, context, builder, functionType, texture, s, x, compareValue, o, location);
    }

    public override SpirvValue CompileGatherCmpGreen(SymbolTable table, SpirvContext context, SpirvBuilder builder, FunctionType functionType, SpirvValue texture, SpirvValue s, SpirvValue x, SpirvValue compareValue, SpirvValue? o = null, SpirvValue? o1 = null, SpirvValue? o2 = null, SpirvValue? o3 = null, SpirvValue? o4 = null, SpirvValue? status = null, TextLocation location = default)
    {
        if (status != null)
            throw new NotImplementedException();
        if (o1 != null)
            return CompileGatherDrefConstOffsets(table, context, builder, functionType, texture, s, x, compareValue, o1.Value, o2!.Value, o3!.Value, o4!.Value, location);
        return CompileGatherDref(table, context, builder, functionType, texture, s, x, compareValue, o, location);
    }

    public override SpirvValue CompileGatherCmpBlue(SymbolTable table, SpirvContext context, SpirvBuilder builder, FunctionType functionType, SpirvValue texture, SpirvValue s, SpirvValue x, SpirvValue compareValue, SpirvValue? o = null, SpirvValue? o1 = null, SpirvValue? o2 = null, SpirvValue? o3 = null, SpirvValue? o4 = null, SpirvValue? status = null, TextLocation location = default)
    {
        if (status != null)
            throw new NotImplementedException();
        if (o1 != null)
            return CompileGatherDrefConstOffsets(table, context, builder, functionType, texture, s, x, compareValue, o1.Value, o2!.Value, o3!.Value, o4!.Value, location);
        return CompileGatherDref(table, context, builder, functionType, texture, s, x, compareValue, o, location);
    }

    public override SpirvValue CompileGatherCmpAlpha(SymbolTable table, SpirvContext context, SpirvBuilder builder, FunctionType functionType, SpirvValue texture, SpirvValue s, SpirvValue x, SpirvValue compareValue, SpirvValue? o = null, SpirvValue? o1 = null, SpirvValue? o2 = null, SpirvValue? o3 = null, SpirvValue? o4 = null, SpirvValue? status = null, TextLocation location = default)
    {
        if (status != null)
            throw new NotImplementedException();

View on GitHub (pinned to 96fad776d2)