Пример #1
0
        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(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);
        }
Пример #3
0
        public void CreateDispatch()
        {
            DispatchIndirectBuffer buffer = new DispatchIndirectBuffer(this.Device);

            Assert.IsNotNull(buffer.ArgumentBuffer, "Argument buffer Is Null");
            Assert.IsNotNull(buffer.WriteBuffer, "Write buffer Is Null");

            buffer.Dispose();
        }
        public void Update(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();
        }
Пример #5
0
        public void Update(DX11RenderContext context)
        {
            if (this.dispatchBuffer == null)
            {
                this.dispatchBuffer = new DispatchIndirectBuffer(context);
            }
            if (!indirectGeom.Contains(context))
            {
                indirectDispatch = new DX11NullIndirectDispatcher();
                indirectDispatch.IndirectArgs = dispatchBuffer;

                DX11NullGeometry nullgeom = new DX11NullGeometry(context);
                nullgeom.AssignDrawer(this.indirectDispatch);
                indirectGeom[context] = nullgeom;
            }
            if (!this.FOutLayer[0].Contains(context))
            {
                this.FOutLayer[0][context]        = new DX11Layer();
                this.FOutLayer[0][context].Render = this.Render;
            }
        }
        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();
        }