private void ScreenQuadPass(StandardFrameData frameData, DepthStencilView depthStencilView, RenderTargetView renderTargetView) { GetContext.OutputMerger.SetRenderTargets(null, downSamplingTargetView); SetDepthStencilState(DepthStencilStates.Greater); SetBlendState(BlendStates.Opaque); GetContext.Rasterizer.SetViewport(new Viewport( 0, 0, RenderBackend.DisplayRef.Width / 4, RenderBackend.DisplayRef.Height / 4, 0.0f, 1.0f )); SetVertexShader("ScreenQuadVS"); //GetContext.VertexShader.SetConstantBuffer(0, null); //GetContext.VertexShader.SetConstantBuffer(1, null); GetContext.InputAssembler.InputLayout = QuadLayoyt; //GetContext.InputAssembler.PrimitiveTopology = PrimitiveTopology.PointList; SetPixelShader("DownSamplingPS"); GetContext.PixelShader.SetConstantBuffer(0, ScreenParameters); ScreenParametersBuffer.CurrentFPS = (int)(1.0f / RenderBackend.EngineRef.Time.DeltaTime); GetContext.UpdateSubresource(ref ScreenParametersBuffer, ScreenParameters); GetContext.PixelShader.SetShaderResource(0, hdrSRV); GetContext.PixelShader.SetShaderResource(1, null); GetContext.PixelShader.SetShaderResource(2, null); GetContext.PixelShader.SetSampler(0, RenderBackend.SharedRenderItems.GetSamplerState(SamplerType.BilinearClamp)); RenderBackend.DrawWrapper(4, 0); GetContext.Rasterizer.SetViewport(new Viewport( 0, 0, RenderBackend.DisplayRef.Width, RenderBackend.DisplayRef.Height, 0.0f, 1.0f )); GetContext.OutputMerger.SetRenderTargets(null, renderTargetView); SetPixelShader("ScreenQuadPS"); GetContext.PixelShader.SetConstantBuffer(0, ScreenParameters); ScreenParametersBuffer.CurrentFPS = (int)(1.0f / RenderBackend.EngineRef.Time.DeltaTime); GetContext.UpdateSubresource(ref ScreenParametersBuffer, ScreenParameters); GetContext.PixelShader.SetShaderResource(0, hdrSRV); GetContext.PixelShader.SetShaderResource(1, velocitySRV); GetContext.PixelShader.SetShaderResource(2, RenderBackend.DisplayRef.DepthStencilSRVRef); GetContext.PixelShader.SetSampler(0, RenderBackend.SharedRenderItems.GetSamplerState(SamplerType.BilinearClamp)); RenderBackend.DrawWrapper(4, 0); GetContext.PixelShader.SetConstantBuffer(0, PerObjConstantBuffer); }
/// <summary> /// Draw non-indexed, non-instanced primitives. Wrapper for collect drawcalls statistics. /// </summary> /// <param name="vertexCount"></param> /// <param name="startVertexLocation"></param> protected void DX_Draw(int vertexCount, int startVertexLocation) { RenderBackend.DrawWrapper(vertexCount, startVertexLocation); }