{"record":{"id":"18f9cfc05e8f3916","repo":"stride3d/stride","slug":"argumentsbuffer","errorCode":null,"errorMessage":"argumentsBuffer","messagePattern":"argumentsBuffer","errorType":"exception","errorClass":"ArgumentNullException","httpStatus":null,"severity":"error","filePath":"sources/engine/Stride.Graphics/Vulkan/CommandList.Vulkan.cs","lineNumber":700,"sourceCode":"        public void DrawIndexedInstanced(int indexCountPerInstance, int instanceCount, int startIndexLocation = 0, int baseVertexLocation = 0, int startInstanceLocation = 0)\n        {\n            PrepareDraw();\n\n            GraphicsDevice.NativeDeviceApi.vkCmdDrawIndexed(currentCommandList.NativeCommandBuffer, (uint) indexCountPerInstance, (uint) instanceCount, (uint) startIndexLocation, baseVertexLocation, (uint) startInstanceLocation);\n            //NativeCommandList.DrawIndexedInstanced(indexCountPerInstance, instanceCount, startIndexLocation, baseVertexLocation, startInstanceLocation);\n\n            GraphicsDevice.FrameDrawCalls++;\n            GraphicsDevice.FrameTriangleCount += (uint) (indexCountPerInstance * instanceCount);\n        }\n\n        /// <summary>\n        /// Draw indexed, instanced, GPU-generated primitives.\n        /// </summary>\n        /// <param name=\"argumentsBuffer\">A buffer containing the GPU generated primitives.</param>\n        /// <param name=\"alignedByteOffsetForArgs\">Offset in <em>pBufferForArgs</em> to the start of the GPU generated primitives.</param>\n        public void DrawIndexedInstanced(Buffer argumentsBuffer, int alignedByteOffsetForArgs = 0)\n        {\n            if (argumentsBuffer == null) throw new ArgumentNullException(\"argumentsBuffer\");\n\n            PrepareDraw();\n\n            throw new NotImplementedException();\n            //NativeCommandBuffer.DrawIndirect(argumentsBuffer.NativeBuffer, (ulong) alignedByteOffsetForArgs, );\n            //NativeDeviceContext.DrawIndexedInstancedIndirect(argumentsBuffer.NativeBuffer, alignedByteOffsetForArgs);\n\n            GraphicsDevice.FrameDrawCalls++;\n        }\n\n        /// <summary>\n        /// Draw non-indexed, instanced primitives.\n        /// </summary>\n        /// <param name=\"vertexCountPerInstance\">Number of vertices to draw.</param>\n        /// <param name=\"instanceCount\">Number of instances to draw.</param>\n        /// <param name=\"startVertexLocation\">Index of the first vertex.</param>\n        /// <param name=\"startInstanceLocation\">A value added to each index before reading per-instance data from a vertex buffer.</param>\n        public void DrawInstanced(int vertexCountPerInstance, int instanceCount, int startVertexLocation = 0, int startInstanceLocation = 0)","sourceCodeStart":682,"sourceCodeEnd":718,"githubUrl":"https://github.com/stride3d/stride/blob/96fad776d210c221682aac1ccdf4c79dc046fc38/sources/engine/Stride.Graphics/Vulkan/CommandList.Vulkan.cs#L682-L718","documentation":"CommandList.DrawIndexedInstanced on the Vulkan backend validates that the indirect arguments buffer is non-null (ArgumentNullException \"argumentsBuffer\"), but the method itself is not implemented for Vulkan and immediately throws NotImplementedException after the guard.","triggerScenarios":"Calling CommandList.DrawIndexedInstanced on Stride's Vulkan backend (Linux/Android or Vulkan forced on Windows) with any Buffer; even with a valid argumentsBuffer the call throws NotImplementedException.","commonSituations":"Porting an indirect/instanced draw pipeline from D3D11/D3D12 to Vulkan-backed platforms; code paths shared across graphics platforms hitting an unimplemented Vulkan API surface.","solutions":["Avoid DrawIndexedInstanced on Vulkan; use Draw/DrawIndexed with CPU-side instancing arguments.","Implement the indirect draw by extending CommandList.Vulkan.cs with vkCmdDrawIndexedIndirect via the NativeCommandBuffer.","Branch on the active GraphicsPlatform and use a supported indirect-draw path for Vulkan.","Null-check the argumentsBuffer anyway (also throws ArgumentNullException before the NotImplementedException)."],"exampleFix":"// before\ncommandList.DrawIndexedInstanced(indirectArgsBuffer);\n\n// after\nif (graphicsDevice.Platform == GraphicsPlatform.Vulkan)\n{\n    commandList.DrawIndexed(indexCount, instanceCount);\n}\nelse\n{\n    commandList.DrawIndexedInstanced(indirectArgsBuffer);\n}","handlingStrategy":"try-catch","validationCode":"if (argumentsBuffer == null) throw new InvalidOperationException(\"Indirect arguments buffer must be created before DrawIndexedInstanced\");\nif (graphicsDevice.Platform == GraphicsPlatform.Vulkan) throw new NotSupportedException(\"DrawIndexedInstanced is not implemented on Vulkan\");","typeGuard":"bool CanIndirectDraw(GraphicsDevice device) => device.Platform != GraphicsPlatform.Vulkan && device.Platform != GraphicsPlatform.OpenGL;","tryCatchPattern":"try { commandList.DrawIndexedInstanced(argsBuffer); }\ncatch (NotImplementedException) { log.Warn(\"Indirect draw unsupported on this backend; falling back to CPU instancing\"); }\ncatch (ArgumentNullException ex) { log.Error(\"Arguments buffer missing\", ex); }","preventionTips":["Gate indirect-draw APIs behind a graphics-platform check","Keep a CPU-side instancing fallback path (DrawIndexed with instance count)","Track Stride updates for Vulkan vkCmdDrawIndexedIndirect support before using indirect draws"],"tags":["vulkan","not-implemented","graphics","indirect-draw"],"backgroundTag":"method-not-implemented","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"}