Esempio n. 1
0
        public void Update(DX11RenderContext context)
        {
            Device        device = context.Device;
            DeviceContext ctx    = context.CurrentDeviceContext;

            for (int i = 0; i < this.FOutGeom.SliceCount; i++)
            {
                DX11IndexedGeometry geom;
                if (this.invalidate || (!this.FOutGeom[i].Contains(context)))
                {
                    if (this.FOutGeom[i].Contains(context))
                    {
                        var g = this.FOutGeom[i][context];
                        DX11IndexedIndirectDrawer d = (DX11IndexedIndirectDrawer)g.Drawer;

                        if (d != null)
                        {
                            d.IndirectArgs.Dispose();
                        }
                    }

                    geom = (DX11IndexedGeometry)this.FInGeom[i][context].ShallowCopy();

                    DX11IndexedIndirectDrawer ind = new DX11IndexedIndirectDrawer();
                    geom.AssignDrawer(ind);

                    ind.Update(context, this.FInCnt[i]);

                    this.invalidate = false;
                }
                else
                {
                    geom = this.FOutGeom[i][context];
                }

                DX11IndexedIndirectDrawer drawer = (DX11IndexedIndirectDrawer)geom.Drawer;

                if (this.FInIdx.PluginIO.IsConnected)
                {
                    drawer.IndirectArgs.CopyIndicesCount(ctx, this.FInIdx[i][context].UAV);
                }

                if (this.FInInst.PluginIO.IsConnected)
                {
                    drawer.IndirectArgs.CopyInstanceCount(ctx, this.FInInst[i][context].UAV);
                }

                this.FOutGeom[i][context] = geom;
            }
        }
Esempio n. 2
0
        public void Destroy(DX11RenderContext OnDevice, bool force)
        {
            for (int i = 0; i < this.FOutGeom.SliceCount; i++)
            {
                try
                {
                    var geom = this.FOutGeom[i][OnDevice];
                    DX11IndexedIndirectDrawer drawer = (DX11IndexedIndirectDrawer)geom.Drawer;
                    drawer.IndirectArgs.Dispose();
                }
                catch
                { }

                this.FOutGeom[i].Remove(OnDevice);
            }
        }
Esempio n. 3
0
        public void Update(IPluginIO pin, DX11RenderContext context)
        {
            Device        device = context.Device;
            DeviceContext ctx    = context.CurrentDeviceContext;

            for (int i = 0; i < this.FOutGeom.SliceCount; i++)
            {
                DX11IndexedGeometry geom;
                if (this.invalidate || (!this.FOutGeom[i].Contains(context)))
                {
                    geom = (DX11IndexedGeometry)this.FInGeom[i][context].ShallowCopy();

                    DX11IndexedIndirectDrawer ind = new DX11IndexedIndirectDrawer();
                    geom.AssignDrawer(ind);

                    ind.Update(context, this.FInCnt[i]);

                    this.invalidate = false;
                }
                else
                {
                    geom = this.FOutGeom[i][context];
                }

                DX11IndexedIndirectDrawer drawer = (DX11IndexedIndirectDrawer)geom.Drawer;

                var argBuffer = drawer.IndirectArgs.Buffer;
                if (this.FInIdx.PluginIO.IsConnected)
                {
                    int idxOffset = this.FInIdxOffset[i];

                    ResourceRegion region = new ResourceRegion(idxOffset, 0, 0, idxOffset + 4, 1, 1);
                    context.CurrentDeviceContext.CopySubresourceRegion(this.FInIdx[i][context].Buffer, 0, region, argBuffer, 0, 0, 0, 0);
                }

                if (this.FInInst.PluginIO.IsConnected)
                {
                    int            instOffset = this.FInInstOffset[i];
                    ResourceRegion region     = new ResourceRegion(instOffset, 0, 0, instOffset + 4, 1, 1);
                    context.CurrentDeviceContext.CopySubresourceRegion(this.FInInst[i][context].Buffer, 0, region, argBuffer, 0, 4, 0, 0);
                }

                this.FOutGeom[i][context] = geom;
            }
        }
Esempio n. 4
0
        public void Update(IPluginIO pin, DX11RenderContext context)
        {
            Device        device = context.Device;
            DeviceContext ctx    = context.CurrentDeviceContext;

            for (int i = 0; i < this.FOutGeom.SliceCount; i++)
            {
                DX11IndexedGeometry geom;
                if (this.FInGeom.IsChanged || this.FInCnt.IsChanged || !this.FOutGeom[i].Contains(context))
                {
                    geom = (DX11IndexedGeometry)this.FInGeom[i][context].ShallowCopy();

                    DX11IndexedIndirectDrawer ind = new DX11IndexedIndirectDrawer();
                    geom.AssignDrawer(ind);

                    ind.Update(context, this.FInCnt[i]);
                }
                else
                {
                    geom = this.FOutGeom[i][context];
                }

                DX11IndexedIndirectDrawer drawer = (DX11IndexedIndirectDrawer)geom.Drawer;

                if (this.FInIdx.PluginIO.IsConnected)
                {
                    drawer.IndirectArgs.CopyIndicesCount(ctx, this.FInIdx[i][context].UAV);
                }

                if (this.FInInst.PluginIO.IsConnected)
                {
                    drawer.IndirectArgs.CopyInstanceCount(ctx, this.FInInst[i][context].UAV);
                }

                this.FOutGeom[i][context] = geom;
            }
        }
        public void Update(IPluginIO pin, DX11RenderContext context)
        {
            Device device = context.Device;
            DeviceContext ctx = context.CurrentDeviceContext;

            for (int i = 0; i < this.FOutGeom.SliceCount; i++)
            {
                DX11IndexedGeometry geom;
                if (this.FInGeom.IsChanged || this.FInCnt.IsChanged || !this.FOutGeom[i].Contains(context))
                {
                    geom = (DX11IndexedGeometry)this.FInGeom[i][context].ShallowCopy();

                    DX11IndexedIndirectDrawer ind = new DX11IndexedIndirectDrawer();
                    geom.AssignDrawer(ind);

                    ind.Update(context, this.FInCnt[i]);
                }
                else
                {
                    geom = this.FOutGeom[i][context];
                }

                DX11IndexedIndirectDrawer drawer = (DX11IndexedIndirectDrawer)geom.Drawer;

                if (this.FInIdx.PluginIO.IsConnected)
                {
                    drawer.IndirectArgs.CopyIndicesCount(ctx, this.FInIdx[i][context].UAV);
                }

                if (this.FInInst.PluginIO.IsConnected)
                {
                    drawer.IndirectArgs.CopyInstanceCount(ctx, this.FInInst[i][context].UAV);
                }

                this.FOutGeom[i][context] = geom;
            }
        }
        public void Update(IPluginIO pin, DX11RenderContext context)
        {
            Device device = context.Device;
            DeviceContext ctx = context.CurrentDeviceContext;

            for (int i = 0; i < this.FOutGeom.SliceCount; i++)
            {
                DX11IndexedGeometry geom;
                if (this.invalidate || (!this.FOutGeom[i].Contains(context)))
                {
                    geom = (DX11IndexedGeometry)this.FInGeom[i][context].ShallowCopy();

                    DX11IndexedIndirectDrawer ind = new DX11IndexedIndirectDrawer();
                    geom.AssignDrawer(ind);

                    ind.Update(context, this.FInCnt[i]);

                    this.invalidate = false;
                }
                else
                {
                    geom = this.FOutGeom[i][context];
                }

                DX11IndexedIndirectDrawer drawer = (DX11IndexedIndirectDrawer)geom.Drawer;

                var argBuffer = drawer.IndirectArgs.Buffer;
                if (this.FInIdx.PluginIO.IsConnected)
                {
                    int idxOffset = this.FInIdxOffset[i];

                    ResourceRegion region = new ResourceRegion(idxOffset, 0, 0, idxOffset+ 4, 1, 1);
                    context.CurrentDeviceContext.CopySubresourceRegion(this.FInIdx[i][context].Buffer, 0, region, argBuffer, 0, 0, 0, 0);
                }

                if (this.FInInst.PluginIO.IsConnected)
                {
                    int instOffset = this.FInInstOffset[i];
                    ResourceRegion region = new ResourceRegion(instOffset, 0, 0,instOffset + 4, 1, 1);
                    context.CurrentDeviceContext.CopySubresourceRegion(this.FInInst[i][context].Buffer, 0, region, argBuffer, 0, 4, 0, 0);
                }

                this.FOutGeom[i][context] = geom;
            }
        }