浏览代码

HDRenderPipeline: Move postprocessRenderContext per camera

/main
sebastienlagarde 7 年前
当前提交
61f5b7f5
共有 2 个文件被更改,包括 6 次插入9 次删除
  1. 2
      ScriptableRenderPipeline/HDRenderPipeline/Camera/HDCamera.cs
  2. 13
      ScriptableRenderPipeline/HDRenderPipeline/HDRenderPipeline.cs

2
ScriptableRenderPipeline/HDRenderPipeline/Camera/HDCamera.cs


public Plane[] frustumPlanes;
public Vector4[] frustumPlaneEquations;
public Camera camera;
public PostProcessRenderContext postprocessRenderContext;
public Matrix4x4 viewProjMatrix
{

camera = cam;
frustumPlanes = new Plane[6];
frustumPlaneEquations = new Vector4[6];
postprocessRenderContext = new PostProcessRenderContext();
Reset();
}

13
ScriptableRenderPipeline/HDRenderPipeline/HDRenderPipeline.cs


RenderTargetIdentifier[] m_MRTCache2 = new RenderTargetIdentifier[2];
// Post-processing context and screen-space effects (recycled on every frame to avoid GC alloc)
readonly PostProcessRenderContext m_PostProcessContext;
// Stencil usage in HDRenderPipeline.
// Currently we use only 2 bits to identify the kind of lighting that is expected from the render pipeline
// Usage is define in LightDefinitions.cs

m_SkyManager.Build(asset.renderPipelineResources);
m_SkyManager.skySettings = skySettingsToUse;
m_PostProcessContext = new PostProcessRenderContext();
m_DebugDisplaySettings.RegisterDebug();
m_DebugFullScreenTempRT = HDShaderIDs._DebugFullScreenTexture;

AccumulateDistortion(m_CullResults, camera, renderContext, cmd);
RenderDistortion(cmd, m_Asset.renderPipelineResources);
RenderPostProcesses(camera, cmd, postProcessLayer);
RenderPostProcesses(hdCamera, cmd, postProcessLayer);
}
}

}
}
void RenderPostProcesses(Camera camera, CommandBuffer cmd, PostProcessLayer layer)
void RenderPostProcesses(HDCamera hdcamera, CommandBuffer cmd, PostProcessLayer layer)
{
using (new ProfilingSample(cmd, "Post-processing", GetSampler(CustomSamplerId.PostProcessing)))
{

cmd.SetGlobalTexture(HDShaderIDs._CameraDepthTexture, m_CameraDepthStencilBuffer);
cmd.SetGlobalTexture(HDShaderIDs._CameraMotionVectorsTexture, m_VelocityBufferRT);
var context = m_PostProcessContext;
var context = hdcamera.postprocessRenderContext;
context.camera = camera;
context.camera = hdcamera.camera;
context.sourceFormat = RenderTextureFormat.ARGBHalf;
context.flip = true;

正在加载...
取消
保存