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


C# DX11RenderContext.GetMultisampleFormatInfo方法代码示例

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


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

示例1: Update

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

            if (this.updateddevices.Contains(context)) { return; }

            int samplecount = Convert.ToInt32(FInAASamplesPerPixel[0].Name);

            SampleDescription sd = new SampleDescription(samplecount, 0);

            if (this.FResized || this.FInvalidateSwapChain || this.FOutBackBuffer[0][context] == null)
            {
                this.FOutBackBuffer[0].Dispose(context);

                List<SampleDescription> sds = context.GetMultisampleFormatInfo(Format.R8G8B8A8_UNorm);
                int maxlevels = sds[sds.Count - 1].Count;

                if (sd.Count > maxlevels)
                {
                    logger.Log(LogType.Warning, "Multisample count too high for this format, reverted to: " + maxlevels);
                    sd.Count = maxlevels;
                }

                this.FOutBackBuffer[0][context] = new DX11SwapChain(context, this.Handle, Format.R8G8B8A8_UNorm, sd, 60,
                    this.FInBufferCount[0]);

                #if DEBUG
                this.FOutBackBuffer[0][context].Resource.DebugName = "BackBuffer";
                #endif
                this.depthmanager.NeedReset = true;
            }

            DX11SwapChain sc = this.FOutBackBuffer[0][context];

            if (this.FResized)
            {

                //if (!sc.IsFullScreen)
                //{
                   // sc.Resize();
               // }
               //this.FInvalidateSwapChain = true;
            }

            if (!this.renderers.ContainsKey(context)) { this.renderers.Add(context, new DX11GraphicsRenderer(this.FHost, context)); }

            this.depthmanager.Update(context, sc.Width, sc.Height, sd);

            this.updateddevices.Add(context);
        }
开发者ID:sunep,项目名称:dx11-vvvv,代码行数:50,代码来源:DX11RendererNode.cs

示例2: OnUpdate

        protected override void OnUpdate(DX11RenderContext context)
        {
            //Grab a temp target if enabled

            TexInfo ti = this.rtm.GetRenderTarget(context);

            if (ti.w != this.width || ti.h != this.height || !this.targets.ContainsKey(context) || this.FInAASamplesPerPixel.IsChanged
                || ti.format !=this.format)
            {
                this.width = ti.w;
                this.height = ti.h;
                this.format = ti.format;

                this.depthmanager.NeedReset = true;

                if (targets.ContainsKey(context))
                {
                    context.ResourcePool.Unlock(targets[context]);
                }

                if (targetresolve.ContainsKey(context))
                {
                    context.ResourcePool.Unlock(targetresolve[context]);
                }

                int aacount = Convert.ToInt32(this.FInAASamplesPerPixel[0].Name);
                int aaquality = 0;

                if (aacount > 1)
                {
                    List<SampleDescription> sds = context.GetMultisampleFormatInfo(ti.format);
                    int maxlevels = sds[sds.Count - 1].Count;

                    if (aacount > maxlevels)
                    {
                        FHost.Log(TLogType.Warning, "Multisample count too high for this format, reverted to: " + maxlevels);
                        aacount = maxlevels;
                    }

                    DX11RenderTarget2D temptarget = context.ResourcePool.LockRenderTarget(this.width, this.height, ti.format, new SampleDescription(aacount,aaquality), this.FInDoMipMaps[0], this.FInMipLevel[0]).Element;
                    DX11RenderTarget2D temptargetresolve = context.ResourcePool.LockRenderTarget(this.width, this.height, ti.format, new SampleDescription(1, 0), this.FInDoMipMaps[0], this.FInMipLevel[0]).Element;

                    targets[context] = temptarget;
                    targetresolve[context] = temptargetresolve;

                    this.FOutBuffers[0][context] = temptargetresolve;
                    this.FOutAABuffers[0][context] = temptarget;
                }
                else
                {
                    //Bind both texture as same output
                    DX11RenderTarget2D temptarget = context.ResourcePool.LockRenderTarget(this.width, this.height, ti.format, new SampleDescription(aacount, aaquality), this.FInDoMipMaps[0], this.FInMipLevel[0]).Element;
                    targets[context] = temptarget;

                    this.FOutBuffers[0][context] = temptarget;
                    this.FOutAABuffers[0][context] = temptarget;
                }

            }
        }
开发者ID:nissidis,项目名称:dx11-vvvv,代码行数:60,代码来源:DX11TempTargetRendererNode.cs

示例3: Update

        public void Update(DX11RenderContext context, int w, int h,SampleDescription sd)
        {
            if (this.currentmode == eDepthBufferMode.Standard)
            {
                DX11DepthStencil ds;
                if (this.NeedReset || !this.depthoutputpin.IOObject[0].Data.ContainsKey(context))
                {
                    if (this.depthoutputpin.IOObject[0] != null)
                    {
                        this.depthoutputpin.IOObject[0].Dispose(context);
                    }

                    if (sd.Count > 1)
                    {
                        if (!context.IsAtLeast101)
                        {
                            host.Log(TLogType.Warning, "Device Feature Level Needs at least 10.1 to create Multisampled Depth Buffer, rolling back to 1");
                            sd.Count = 1;
                        }
                    }

                    Format depthfmt = DeviceFormatHelper.GetFormat(this.depthformatpin.IOObject[0].Name);

                    List<SampleDescription> sds = context.GetMultisampleFormatInfo(depthfmt);
                    int maxlevels = sds[sds.Count - 1].Count;

                    if (sd.Count > maxlevels)
                    {
                        host.Log(TLogType.Warning, "Multisample count too high for this depth format, reverted to: " + maxlevels);
                        sd.Count = maxlevels;
                    }

                    ds = new DX11DepthStencil(context, w, h, sd, depthfmt);
                    #if DEBUG
                    ds.Resource.DebugName = "DepthStencil";
                    #endif
                    this.depthoutputpin.IOObject[0][context] = ds;
                }
            }
        }
开发者ID:dotprodukt,项目名称:dx11-vvvv,代码行数:40,代码来源:DepthBufferManager.cs


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