浏览代码

Merge pull request #1402 from Unity-Technologies/Don't-clear-Gbuffer-in-player

Optimization: Don't clear Gbuffer (but clear in debug mode)
/main
GitHub 7 年前
当前提交
9c056f50
共有 1 个文件被更改,包括 22 次插入20 次删除
  1. 42
      com.unity.render-pipelines.high-definition/HDRP/HDRenderPipeline.cs

42
com.unity.render-pipelines.high-definition/HDRP/HDRenderPipeline.cs


cmd.SetGlobalInt(HDShaderIDs._SSReflectionEnabled, hdCamera.frameSettings.enableSSR ? 1 : 0);
PushGlobalRTHandle(
cmd,
hdCamera.GetPreviousFrameRT((int)HDCameraFrameHistoryType.DepthPyramid),
HDShaderIDs._DepthPyramidTexture,
HDShaderIDs._DepthPyramidSize,
cmd,
hdCamera.GetPreviousFrameRT((int)HDCameraFrameHistoryType.DepthPyramid),
HDShaderIDs._DepthPyramidTexture,
HDShaderIDs._DepthPyramidSize,
cmd,
hdCamera.GetPreviousFrameRT((int)HDCameraFrameHistoryType.ColorPyramid),
HDShaderIDs._ColorPyramidTexture,
HDShaderIDs._ColorPyramidSize,
cmd,
hdCamera.GetPreviousFrameRT((int)HDCameraFrameHistoryType.ColorPyramid),
HDShaderIDs._ColorPyramidTexture,
HDShaderIDs._ColorPyramidSize,
cmd,
m_VelocityBuffer,
HDShaderIDs._CameraMotionVectorsTexture,
HDShaderIDs._CameraMotionVectorsSize,
cmd,
m_VelocityBuffer,
HDShaderIDs._CameraMotionVectorsTexture,
HDShaderIDs._CameraMotionVectorsSize,
HDShaderIDs._CameraMotionVectorsScale
);

HDUtils.SetRenderTarget(cmd, hdCamera, m_CameraSssDiffuseLightingBuffer, ClearFlag.Color, CoreUtils.clearColorAllBlack);
}
// TODO: As we are in development and have not all the setup pass we still clear the color in emissive buffer and gbuffer, but this will be removed later.
// Clear GBuffers
// We don't need to clear the GBuffers as scene is rewrite and we are suppose to only access valid data (invalid data are tagged with stencil as StencilLightingUsage.NoLighting),
// This is to save some performance
using (new ProfilingSample(cmd, "Clear GBuffer", CustomSamplerId.ClearGBuffer.GetSampler()))
// We still clear in case of debug mode
if (m_CurrentDebugDisplaySettings.IsDebugDisplayEnabled())
HDUtils.SetRenderTarget(cmd, hdCamera, m_GbufferManager.GetBuffersRTI(), m_CameraDepthStencilBuffer, ClearFlag.Color, CoreUtils.clearColorAllBlack);
using (new ProfilingSample(cmd, "Clear GBuffer", CustomSamplerId.ClearGBuffer.GetSampler()))
{
HDUtils.SetRenderTarget(cmd, hdCamera, m_GbufferManager.GetBuffersRTI(), m_CameraDepthStencilBuffer, ClearFlag.Color, CoreUtils.clearColorAllBlack);
}
// END TEMP
}
}

{
cmd.SetGlobalTexture(textureID, rth);
cmd.SetGlobalVector(
sizeID,
sizeID,
new Vector4(
rth.referenceSize.x,
rth.referenceSize.y,

);
cmd.SetGlobalVector(
scaleID,
scaleID,
new Vector4(
rth.referenceSize.x / (float)rth.rt.width,
rth.referenceSize.y / (float)rth.rt.height,

正在加载...
取消
保存