public void Update(IPluginIO pin, DX11RenderContext context)
        {
            if (this.FOutGeom.SliceCount == 0) { return; }

            if (this.dispatchBuffer == null)
            {
                this.dispatchBuffer = new DispatchIndirectBuffer(context);
            }

            if (!this.FOutGeom[0].Contains(context))
            {
                this.indirectDispatch = new DX11NullIndirectDispatcher();
                this.indirectDispatch.IndirectArgs = this.dispatchBuffer;

                DX11NullGeometry nullgeom = new DX11NullGeometry(context);
                nullgeom.AssignDrawer(this.indirectDispatch);

                this.FOutGeom[0][context] = nullgeom;
            }

            var countuav = this.FInArgBuffer[0][context];

            var argBuffer = this.dispatchBuffer.Buffer;

            int argOffset = this.FInArgOffset[0];
            ResourceRegion region = new ResourceRegion(argOffset, 0, 0, argOffset + 12, 1, 1); //Packed xyz value here
            context.CurrentDeviceContext.CopySubresourceRegion(this.FInArgBuffer[0][context].Buffer, 0, region, argBuffer, 0, 0, 0, 0);
        }
        public void Update(IPluginIO pin, DX11RenderContext context)
        {
            if (this.FOutGeom.SliceCount == 0) { return; }

            if (this.generateShader == null)
            {
                this.generateShader = ShaderUtils.GetShader(context, "GenerateDispatch1D");
                this.dispatchBuffer = new DispatchIndirectBuffer(context);
                this.countBuffer = new DX11RawBuffer(context.Device, 16);
            }

            if (!this.FOutGeom[0].Contains(context))
            {
                this.indirectDispatch = new DX11NullIndirectDispatcher();
                this.indirectDispatch.IndirectArgs = this.dispatchBuffer;

                DX11NullGeometry nullgeom = new DX11NullGeometry(context);
                nullgeom.AssignDrawer(this.indirectDispatch);

                this.FOutGeom[0][context] = nullgeom;
                this.FOutCounter[0][context] = this.dispatchBuffer.RWBuffer;
            }

            var countuav = this.FInArgBuffer[0][context];

            context.CurrentDeviceContext.CopyStructureCount(countuav.UAV, this.countBuffer.Buffer, 0);

            this.generateShader.SetBySemantic("WARPSIZE", this.FInWarpX[0]);
            this.generateShader.SetBySemantic("COUNTERBUFFER", this.countBuffer.SRV);
            this.generateShader.SetBySemantic("RWDISPATCHBUFFER", this.dispatchBuffer.UAV);

            this.generateShader.ApplyPass(0);

            context.CurrentDeviceContext.Dispatch(1, 1, 1);
            this.generateShader.CleanUp();

            this.dispatchBuffer.UpdateBuffer();
        }