当前位置: 首页>>代码示例>>C#>>正文


C# DX11RenderContext.CleanUp方法代码示例

本文整理汇总了C#中FeralTic.DX11.DX11RenderContext.CleanUp方法的典型用法代码示例。如果您正苦于以下问题:C# DX11RenderContext.CleanUp方法的具体用法?C# DX11RenderContext.CleanUp怎么用?C# DX11RenderContext.CleanUp使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在FeralTic.DX11.DX11RenderContext的用法示例。


在下文中一共展示了DX11RenderContext.CleanUp方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Update

        public void Update(IPluginIO pin, DX11RenderContext context)
        {
            Device device = context.Device;
            DeviceContext ctx = context.CurrentDeviceContext;

            if ( !this.FOutPointcloudRingBuffer[0].Contains(context) || !this.FOutUpdatedBuffer[0].Contains(context) || !this.bCounter.Contains(context) || !this.bOffset.Contains(context) || this.FInPointcloudRingBufferSize.IsChanged || this.FInEleCount.IsChanged)
            {

                this.FOutPointcloudRingBuffer[0].Dispose(context);
                DX11RWStructuredBuffer brPointcloud = new DX11RWStructuredBuffer(device, FInPointcloudRingBufferSize[0], FInStride[0], eDX11BufferMode.Counter);
                this.FOutPointcloudRingBuffer[0][context] = brPointcloud;

                this.FOutUpdatedBuffer[0].Dispose(context);
                DX11RWStructuredBuffer brUpdated = new DX11RWStructuredBuffer(device, FInPointcloudRingBufferSize[0], 4, eDX11BufferMode.Counter);
                this.FOutUpdatedBuffer[0][context] = brUpdated;

                this.bOffset.Dispose(context);
                this.bOffset[context] = new DX11RawBuffer(device, 16);

                this.bCounter.Dispose(context);
                this.bCounter[context] = new DX11RWStructuredBuffer(device, FInEleCount[0], 4, eDX11BufferMode.Counter);

            }

            // load shader
            if (this.shader == null)
            {
                string basepath = "RingBuffer.effects.RingBuffer.fx";
                DX11Effect effect = DX11Effect.FromResource(Assembly.GetExecutingAssembly(), basepath);
                this.shader = new DX11ShaderInstance(context, effect);
            }

            if (this.FInPointcloudBuffer.PluginIO.IsConnected && FInSet[0] && currentFrame != FHDEHost.FrameTime)
            {

                currentFrame = FHDEHost.FrameTime; // prevents to execute this a second time

                int[] mask = new int[4] { 0, 0, 0, 0 };
                ctx.ClearUnorderedAccessView(FOutUpdatedBuffer[0][context].UAV, mask);

                shader.SelectTechnique("AddPoints");
                shader.SetBySemantic("POINTCLOUDBUFFER", FInPointcloudBuffer[0][context].SRV);
                shader.SetBySemantic("POINTCLOUDCOUNTBUFFER", FInCountBuffer[0][context].SRV);
                shader.SetBySemantic("POINTCLOUDRINGBUFFER", FOutPointcloudRingBuffer[0][context].UAV, FInPointcloudRingBufferSize[0]);
                shader.SetBySemantic("UPDATEDRINGBUFFER", FOutUpdatedBuffer[0][context].UAV, FInPointcloudRingBufferSize[0]);
                shader.SetBySemantic("POINTCLOUDRINGBUFFERSIZE", FInPointcloudRingBufferSize[0]);
                shader.SetBySemantic("OFFSETBUFFER", this.bOffset[context].SRV);
                shader.SetBySemantic("COUNTERBUFFER", this.bCounter[context].UAV, 0);
                shader.ApplyPass(0);
                ctx.Dispatch((FInEleCount[0] + 63) / 64, 1, 1);

                ctx.CopyStructureCount(this.bCounter[context].UAV, this.bOffset[context].Buffer, 0);
                shader.SelectTechnique("CalcOffset");
                shader.ApplyPass(0);
                ctx.Dispatch(1, 1, 1);

                context.CleanUp();
                context.CleanUpCS();
                
            }

        }
开发者ID:sebescudie,项目名称:dx11-pointcloud,代码行数:62,代码来源:RingBufferNode.cs

示例2: Update

        public void Update(IPluginIO pin, DX11RenderContext context)
        {
            Device device = context.Device;
            DeviceContext ctx = context.CurrentDeviceContext;

            if (!this.FOutLinkBuffer[0].Contains(context) || !this.FOutOffsetBuffer[0].Contains(context) || FInGridcellCount.IsChanged)
           	{
                this.FOutLinkBuffer[0].Dispose(context);
                this.FOutOffsetBuffer[0].Dispose(context);
            	DX11RWStructuredBuffer lb = new DX11RWStructuredBuffer(device, FInEleCount[0], 8, eDX11BufferMode.Counter);
            	DX11RWStructuredBuffer ob = new DX11RWStructuredBuffer(device, FInGridcellCount[0] * FInGridcellCount[0] * FInGridcellCount[0], 4, eDX11BufferMode.Counter);
                this.FOutLinkBuffer[0][context] = lb;
            	this.FOutOffsetBuffer[0][context] = ob;

            }

            // clear offsetbuffer
            int[] mask = new int[4] { -1, -1, -1, -1 };
        	ctx.ClearUnorderedAccessView(FOutOffsetBuffer[0][context].UAV,mask);
        	
            // load shader
            if (this.shader == null)
            {
                string basepath = "LinkedList.effects.LinkedList.fx";
                DX11Effect effect = DX11Effect.FromResource(Assembly.GetExecutingAssembly(), basepath);
                this.shader = new DX11ShaderInstance(context, effect);
            }
            
        	if (this.FInPcBuffer.PluginIO.IsConnected)
            {
                
            	shader.SelectTechnique("BuildHash");            	
            	shader.SetBySemantic("POINTCLOUDBUFFER", FInPcBuffer[0][context].SRV);
                shader.SetBySemantic("POINTTRANSFORM", FInTransform[0]);
                shader.SetBySemantic("RWLINKBUFFER", FOutLinkBuffer[0][context].UAV, 0);
            	shader.SetBySemantic("RWOFFSETBUFFER", FOutOffsetBuffer[0][context].UAV);
            	shader.SetBySemantic("GRIDCELLSIZE", FInGridcellCount[0]);
                            	
            	shader.ApplyPass(0);
            	ctx.Dispatch((FInEleCount[0] + 63) / 64, 1, 1);
                context.CleanUp();
            	context.CleanUpCS();
            }        	
        	
        }
开发者ID:sebescudie,项目名称:dx11-pointcloud,代码行数:45,代码来源:LinkedListNode.cs

示例3: Update

		public void Update(IPluginIO pin, DX11RenderContext context)
        {
            Device device = context.Device;
            DeviceContext ctx = context.CurrentDeviceContext;

            if (!this.FOutPointcloudBuffer[0].Contains(context) || !this.FOutIndexBuffer[0].Contains(context) || this.FInEleCount.IsChanged )
           	{
                this.FOutPointcloudBuffer[0].Dispose(context);
                this.FOutIndexBuffer[0].Dispose(context);
            	DX11RWStructuredBuffer pcBuffer = new DX11RWStructuredBuffer(device, FInEleCount[0], FInStride[0], eDX11BufferMode.Counter);
            	DX11RWStructuredBuffer idBuffer = new DX11RWStructuredBuffer(device, FInEleCount[0], 4, eDX11BufferMode.Counter);
                this.FOutPointcloudBuffer[0][context] = pcBuffer;
            	this.FOutIndexBuffer[0][context] = idBuffer;

            }

            // clear offsetbuffer
            int[] mask = new int[4] { -1, -1, -1, -1 };
        	ctx.ClearUnorderedAccessView(FOutIndexBuffer[0][context].UAV,mask);
        	
            // load shader
            if (this.shader == null)
            {
                string basepath = "RingBufferIndexing.effects.RingBufferIndexing.fx";
                DX11Effect effect = DX11Effect.FromResource(Assembly.GetExecutingAssembly(), basepath);
                this.shader = new DX11ShaderInstance(context, effect);
            }
            
        	if (this.FInPointcloudBuffer.PluginIO.IsConnected /* && currentFrame != FHDEHost.FrameTime*/)
            {
                
                currentFrame = FHDEHost.FrameTime; // prevents to execute this a second time

            	shader.SelectTechnique("BuildHash");            	
            	shader.SetBySemantic("POINTCLOUDBUFFERIN", FInPointcloudBuffer[0][context].SRV);
                shader.SetBySemantic("POINTCLOUDBUFFEROUT", FOutPointcloudBuffer[0][context].UAV, 0);
            	shader.SetBySemantic("INDEXBUFFER", FOutIndexBuffer[0][context].UAV);
                            	
            	shader.ApplyPass(0);
            	ctx.Dispatch((FInEleCount[0] + 63) / 64, 1, 1);
                context.CleanUp();
            	context.CleanUpCS();
            }        	
        	
        }
开发者ID:sebescudie,项目名称:dx11-pointcloud,代码行数:45,代码来源:RingBufferIndexingNode.cs


注:本文中的FeralTic.DX11.DX11RenderContext.CleanUp方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。