浏览代码

Fix clear code in LightweightPipeline

The clear code wasn't clearing depth if the camera clear flag was set to Skybox.  The skybox rendering is dependent on depth being cleared initially, so it can fill in areas that opaque rendering hasn't covered.  But right now, depth is not being cleared, which breaks rendering.

This is a temporary fix for the clear code, as it isn't entirely optimal for TBDR GPUs.  Ideally, the first camera in the camera stack will clear both depth and color in order to prevent tile initialization.  Then the following cameras will avoid color clearing as they will need to load the contents from the previous camera render.  This code will be amended when Felipe adds camera stack support to LightweightPipeline.
/RenderPassXR_Sandbox
robbiesri 7 年前
当前提交
4ebf9cfd
共有 1 个文件被更改,包括 6 次插入1 次删除
  1. 7
      Assets/ScriptableRenderPipeline/LightweightPipeline/LightweightPipeline.cs

7
Assets/ScriptableRenderPipeline/LightweightPipeline/LightweightPipeline.cs


// Clear RenderTarget to avoid tile initialization on mobile GPUs
// https://community.arm.com/graphics/b/blog/posts/mali-performance-2-how-to-correctly-handle-framebuffers
if (camera.clearFlags != CameraClearFlags.Nothing)
cmd.ClearRenderTarget(camera.clearFlags == CameraClearFlags.Color, camera.clearFlags == CameraClearFlags.Color || camera.clearFlags == CameraClearFlags.Depth, camera.backgroundColor);
{
bool clearDepth = (camera.clearFlags != CameraClearFlags.Nothing);
bool clearColor = (camera.clearFlags == CameraClearFlags.Color);
cmd.ClearRenderTarget(clearDepth, clearColor, camera.backgroundColor);
}
context.ExecuteCommandBuffer(cmd);
CommandBufferPool.Release(cmd);

正在加载...
取消
保存