/// <summary> /// Renders the post proc. /// </summary> /// <param name="context">The context.</param> /// <param name="renderables">The renderables.</param> /// <param name="parameter">The parameter.</param> public virtual void RenderPostProc(RenderContext context, FastList <SceneNode> renderables, ref RenderParameter parameter) { int count = renderables.Count; for (int i = 0; i < count; ++i) { renderables[i].Render(context, ImmediateContext); } if (context.RenderHost.FeatureLevel >= global::SharpDX.Direct3D.FeatureLevel.Level_11_0 && context.RenderHost.RenderConfiguration.FXAALevel != FXAALevel.None) { postFXAACore.FXAALevel = context.RenderHost.RenderConfiguration.FXAALevel; postFXAACore.Render(context, ImmediateContext); } }
/// <summary> /// Renders to back buffer. /// </summary> /// <param name="context">The context.</param> /// <param name="parameter">The parameter.</param> public virtual void RenderToBackBuffer(RenderContext context, ref RenderParameter parameter) { if (context.RenderHost.FeatureLevel >= global::SharpDX.Direct3D.FeatureLevel.Level_11_0 && context.RenderHost.RenderConfiguration.FXAALevel != FXAALevel.None) { postFXAACore.FXAALevel = context.RenderHost.RenderConfiguration.FXAALevel; postFXAACore.Render(context, ImmediateContext); } ImmediateContext.Flush(); var buffer = context.RenderHost.RenderBuffer; if (parameter.IsMSAATexture) { ImmediateContext.ResolveSubresource(parameter.CurrentTargetTexture, 0, buffer.BackBuffer.Resource, 0, buffer.Format); } else { ImmediateContext.CopyResource(parameter.CurrentTargetTexture, buffer.BackBuffer.Resource); } }
/// <summary> /// Renders to ping pong buffer. /// </summary> /// <param name="context">The context.</param> /// <param name="parameter">The parameter.</param> public virtual void RenderToPingPongBuffer(RenderContext context, ref RenderParameter parameter) { var buffer = context.RenderHost.RenderBuffer; buffer.FullResPPBuffer.Initialize(); if (context.RenderHost.FeatureLevel < global::SharpDX.Direct3D.FeatureLevel.Level_11_0 || context.RenderHost.RenderConfiguration.FXAALevel == FXAALevel.None || parameter.IsMSAATexture) { if (parameter.IsMSAATexture) { ImmediateContext.ResolveSubresource(parameter.CurrentTargetTexture, 0, buffer.FullResPPBuffer.CurrentTexture, 0, buffer.Format); } else { ImmediateContext.CopyResource(parameter.CurrentTargetTexture, buffer.FullResPPBuffer.CurrentTexture); } } else { ImmediateContext.CopyResource(parameter.CurrentTargetTexture, buffer.FullResPPBuffer.CurrentTexture); postFXAACore.FXAALevel = context.RenderHost.RenderConfiguration.FXAALevel; postFXAACore.Render(context, ImmediateContext); } }
public virtual void RenderToBackBuffer(RenderContext context, ref RenderParameter parameter) { var buffer = context.RenderHost.RenderBuffer; if (context.RenderHost.RenderConfiguration.FXAALevel == FXAALevel.None || buffer.ColorBufferSampleDesc.Count > 1) { ImmediateContext.DeviceContext.Flush(); switch (buffer.ColorBufferSampleDesc.Count) { case 1: ImmediateContext.DeviceContext.CopyResource(buffer.ColorBuffer.Resource, buffer.BackBuffer.Resource); break; default: ImmediateContext.DeviceContext.ResolveSubresource(buffer.ColorBuffer.Resource, 0, buffer.BackBuffer.Resource, 0, Format.B8G8R8A8_UNorm); break; } } else { postFXAACore.FXAALevel = context.RenderHost.RenderConfiguration.FXAALevel; postFXAACore.Render(context, ImmediateContext); } }