Example #1
0
        public void Render(DX11RenderContext context)
        {
            if (this.lasthandle != this.Handle)
             {
                 if (this.swapchain != null)
                 {
                     if (this.swapchain.Contains(context)) { this.swapchain.Dispose(context); }
                 }
                 this.lasthandle = this.Handle;
             }

             if (!this.swapchain.Contains(context))
             {
                 this.swapchain[context] = new DX11SwapChain(context, this.Handle,
                     SlimDX.DXGI.Format.R8G8B8A8_UNorm, new SampleDescription(1, 0),60,1);
             }

             if (this.resized)
             {
                 this.swapchain[context].Resize();
             }

             if (this.FEnabled[0])
             {
                 context.CurrentDeviceContext.ClearRenderTargetView(this.swapchain[context].RTV,new SlimDX.Color4(0,0,0,0));
             }

             if (this.FIn.IsConnected && this.spreadMax > 0 && this.FEnabled[0])
             {
                 int id = this.FIndex[0];
                 if (this.FIn[id].Contains(context) && this.FIn[id][context] != null)
                 {
                     context.RenderTargetStack.Push(this.swapchain[context]);
                     var rs = new DX11RenderState();

                     if (FAlpha[0])
                     {
                     	rs.Blend = DX11BlendStates.Instance.GetState("Blend");
                     	context.CurrentDeviceContext.ClearRenderTargetView(this.swapchain[context].RTV, FInBgColor[0].Color);
                     }
                     context.RenderStateStack.Push(rs);
                     context.CleanShaderStages();

                     context.Primitives.FullTriVS.GetVariableBySemantic("TEXTURE").AsResource().SetResource(this.FIn[id][context].SRV);

                     EffectSamplerVariable samplervariable = context.Primitives.FullTriVS.GetVariableByName("linSamp").AsSampler();
                     SamplerState state = null;
                     if (this.FInSamplerState.IsConnected)
                     {

                         state = SamplerState.FromDescription(context.Device, this.FInSamplerState[0]);
                         samplervariable.SetSamplerState(0, state);
                     }
                     else
                     {
                         samplervariable.UndoSetSamplerState(0);
                     }

                     context.Primitives.FullScreenTriangle.Bind(null);
                     context.Primitives.ApplyFullTri();
                     context.Primitives.FullScreenTriangle.Draw();

                     context.RenderStateStack.Pop();
                     context.RenderTargetStack.Pop();
                     context.CleanUpPS();
                     samplervariable.UndoSetSamplerState(0); //undo as can be used in other places

                     if (state != null)
                     {
                         state.Dispose();
                     }
                 }
             }
        }
Example #2
0
        public void Render(DX11RenderContext context)
        {
            if (this.lasthandle != this.Handle)
             {
                 if (this.swapchain != null)
                 {
                     if (this.swapchain.Contains(context)) { this.swapchain.Dispose(context); }
                 }
                 this.lasthandle = this.Handle;
             }

             if (!this.swapchain.Contains(context))
             {
                 this.swapchain[context] = new DX11SwapChain(context, this.Handle, SlimDX.DXGI.Format.R8G8B8A8_UNorm, new SampleDescription(1, 0));
             }

             if (this.resized)
             {
                 this.swapchain[context].Resize();
             }

             if (this.FEnabled[0])
             {
                 context.CurrentDeviceContext.ClearRenderTargetView(this.swapchain[context].RTV,new SlimDX.Color4(0,0,0,0));
             }

             if (this.FIn.PluginIO.IsConnected && this.FEnabled[0])
             {
                 int id = this.FIndex[0];
                 if (this.FIn[id].Contains(context))
                 {
                     context.RenderTargetStack.Push(this.swapchain[context]);
                     var rs = new DX11RenderState();

                     if (FAlpha[0])
                     {
                     	rs.Blend = DX11BlendStates.Instance.GetState("Blend");
                     	context.CurrentDeviceContext.ClearRenderTargetView(this.swapchain[context].RTV, FInBgColor[0].Color);
                     }
                     context.RenderStateStack.Push(rs);
                     context.CleanShaderStages();

                     context.Primitives.FullTriVS.GetVariableBySemantic("TEXTURE").AsResource().SetResource(this.FIn[id][context].SRV);
                     context.Primitives.FullScreenTriangle.Bind(null);
                     context.Primitives.ApplyFullTri();
                     context.Primitives.FullScreenTriangle.Draw();

                     context.RenderStateStack.Pop();
                     context.RenderTargetStack.Pop();
                     context.CleanUpPS();
                 }
             }
        }
Example #3
0
        public void Render(DX11RenderContext context)
        {
            if (!this.swapchain.Contains(context))
             {
                 this.swapchain[context] = new DX11SwapChain(context, this.Handle, SlimDX.DXGI.Format.R8G8B8A8_UNorm, new SampleDescription(1, 0));
             }

             if (this.resized)
             {
                 this.swapchain[context].Resize();
             }

             if (this.FEnabled[0])
             {
                 context.CurrentDeviceContext.ClearRenderTargetView(this.swapchain[context].RTV,new SlimDX.Color4(0,0,0,0));
             }

             if (this.FIn.PluginIO.IsConnected && this.FEnabled[0])
             {
                 int id = this.FIndex[0];
                 if (this.FIn[id].Contains(context))
                 {

                     context.RenderTargetStack.Push(this.swapchain[context]);
                     context.RenderStateStack.Push(new DX11RenderState());

                     context.Primitives.FullTriVS.GetVariableBySemantic("TEXTURE").AsResource().SetResource(this.FIn[id][context].SRV);
                     context.Primitives.FullScreenTriangle.Bind(null);
                     context.Primitives.ApplyFullTri();
                     context.Primitives.FullScreenTriangle.Draw();

                     context.RenderStateStack.Pop();
                     context.RenderTargetStack.Pop();
                     context.CleanUpPS();
                 }
             }
        }