stride3d/stride · error · NotImplementedException

NotImplementedException

Error message

NotImplementedException

What it means

CommandList.Dispatch(Buffer indirectBuffer, int offsetInBytes) on D3D12 is an unimplemented stub that immediately throws NotImplementedException. GPU indirect dispatch is not yet implemented in this backend.

Solutions

  1. Use the non-indirect CommandList.Dispatch(int threadGroupsX, Y, Z) with CPU-computed group counts.
  2. Switch the GraphicsDevice to the Direct3D11 or Vulkan backend, where indirect dispatch may be implemented.
  3. Track/patch the Stride source and implement DispatchIndirect via CommandDispatcher.Dispatch with a GPU virtual address.

Example fix

// before
commandList.Dispatch(indirectArgsBuffer, 0);
// after
commandList.Dispatch(groupCountX, groupCountY, groupCountZ);
Defensive patterns

Strategy: try-catch

Validate before calling

if (device.Backend == GraphicsBackend.Direct3D12)
    throw new PlatformNotSupportedException("Indirect dispatch is not implemented on D3D12 backend");

Type guard

static bool SupportsIndirectDispatch(GraphicsDevice d) => d.GraphicsProfile >= GraphicsProfile.Level_10_0 && d.Backend != GraphicsBackend.Direct3D12;

Try / catch

try { commandList.Dispatch(indirectBuffer, offset); }
catch (NotImplementedException) { commandList.Dispatch(cpuGroupCountX, cpuGroupCountY, cpuGroupCountZ); }

Prevention

When it happens

Trigger: Calling commandList.Dispatch(indirectBuffer, offset) to issue a DispatchIndirect on the Direct3D12 graphics backend.

Common situations: Running a compute-shader feature that uses GPU-generated dispatch arguments (e.g. particle simulation, culling) on the D3D12 backend when it works elsewhere.

Related errors


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

Appendix: source

Thrown at sources/engine/Stride.Graphics/Direct3D12/CommandList.Direct3D12.cs:945

        {
            PrepareDraw(isDispatch: true); // TODO: PrepareDraw for Compute dispatch?

            currentCommandList.NativeCommandList.Dispatch((uint) threadCountX, (uint) threadCountY, (uint) threadCountZ);
        }

        /// <summary>
        ///   Dispatches a Compute Shader workload using an Indirect Buffer, allowing the thread group count to be determined at runtime.
        /// </summary>
        /// <param name="indirectBuffer">
        ///   A Buffer containing the dispatch parameters, structured as <c>(threadCountX, threadCountY, threadCountZ)</c>.
        /// </param>
        /// <param name="offsetInBytes">
        ///   The byte offset within the <paramref name="indirectBuffer"/> where the dispatch parameters are located.
        /// </param>
        /// <exception cref="ArgumentNullException"><paramref name="indirectBuffer"/> is <see langword="null"/>.</exception>
        public void Dispatch(Buffer indirectBuffer, int offsetInBytes)
        {
            throw new NotImplementedException(); // TODO: Implement DispatchIndirect
        }

        /// <summary>
        ///   Issues a non-indexed draw call, rendering a sequence of vertices directly from the bound Vertex Buffer.
        /// </summary>
        /// <param name="vertexCount">The number of vertices to draw.</param>
        /// <param name="startVertexLocation">
        ///   Index of the first vertex in the Vertex Buffer to begin rendering from;
        ///   it could also be used as the first vertex id generated for a shader parameter marked with the <c>SV_TargetId</c> system-value semantic.
        /// </param>
        public void Draw(int vertexCount, int startVertexLocation = 0)
        {
            PrepareDraw();

            currentCommandList.NativeCommandList.DrawInstanced((uint) vertexCount, InstanceCount: 1,
                                                               (uint) startVertexLocation, StartInstanceLocation: 0);

            GraphicsDevice.FrameTriangleCount += (uint)vertexCount;

View on GitHub (pinned to 96fad776d2)