/// <inheritdoc/> public override void Execute(ScriptableRenderer renderer, ScriptableRenderContext context, ref RenderingData renderingData) { if (renderer == null) { throw new ArgumentNullException("renderer"); } CommandBuffer cmd = CommandBufferPool.Get(k_RenderTransparentsTag); using (new ProfilingSample(cmd, k_RenderTransparentsTag)) { RenderBufferLoadAction loadOp = RenderBufferLoadAction.Load; RenderBufferStoreAction storeOp = RenderBufferStoreAction.Store; SetRenderTarget(cmd, colorAttachmentHandle.Identifier(), loadOp, storeOp, depthAttachmentHandle.Identifier(), loadOp, storeOp, ClearFlag.None, Color.black, descriptor.dimension); context.ExecuteCommandBuffer(cmd); cmd.Clear(); Camera camera = renderingData.cameraData.camera; var drawSettings = CreateDrawingSettings(camera, SortingCriteria.CommonTransparent, rendererConfiguration, renderingData.supportsDynamicBatching, renderingData.lightData.mainLightIndex); context.DrawRenderers(renderingData.cullResults, ref drawSettings, ref m_TransparentFilterSettings); // Render objects that did not match any shader pass with error shader renderer.RenderObjectsWithError(context, ref renderingData.cullResults, camera, m_TransparentFilterSettings, SortingCriteria.None); } context.ExecuteCommandBuffer(cmd); CommandBufferPool.Release(cmd); }
/// <inheritdoc/> public override void Execute(ScriptableRenderer renderer, ScriptableRenderContext context, ref RenderingData renderingData) { if (renderer == null) { throw new ArgumentNullException("renderer"); } CommandBuffer cmd = CommandBufferPool.Get(k_RenderOpaquesTag); using (new ProfilingSample(cmd, k_RenderOpaquesTag)) { RenderBufferLoadAction colorLoadOp = (CoreUtils.HasFlag(clearFlag, ClearFlag.Color)) ? RenderBufferLoadAction.DontCare : RenderBufferLoadAction.Load; RenderBufferStoreAction colorStoreOp = RenderBufferStoreAction.Store; RenderBufferLoadAction depthLoadOp = (CoreUtils.HasFlag(clearFlag, ClearFlag.Depth)) ? RenderBufferLoadAction.DontCare : RenderBufferLoadAction.Load; RenderBufferStoreAction depthStoreOp = RenderBufferStoreAction.Store; SetRenderTarget(cmd, colorAttachmentHandle.Identifier(), colorLoadOp, colorStoreOp, depthAttachmentHandle.Identifier(), depthLoadOp, depthStoreOp, clearFlag, clearColor, descriptor.dimension); // TODO: We need a proper way to handle multiple camera/ camera stack. Issue is: multiple cameras can share a same RT // (e.g, split screen games). However devs have to be dilligent with it and know when to clear/preserve color. // For now we make it consistent by resolving viewport with a RT until we can have a proper camera management system //if (colorAttachmentHandle == -1 && !cameraData.isDefaultViewport) // cmd.SetViewport(camera.pixelRect); context.ExecuteCommandBuffer(cmd); cmd.Clear(); Camera camera = renderingData.cameraData.camera; XRUtils.DrawOcclusionMesh(cmd, camera, renderingData.cameraData.isStereoEnabled); var sortFlags = renderingData.cameraData.defaultOpaqueSortFlags; var drawSettings = CreateDrawingSettings(camera, sortFlags, rendererConfiguration, renderingData.supportsDynamicBatching, renderingData.lightData.mainLightIndex); context.DrawRenderers(renderingData.cullResults, ref drawSettings, ref m_OpaqueFilterSettings); // Render objects that did not match any shader pass with error shader renderer.RenderObjectsWithError(context, ref renderingData.cullResults, camera, m_OpaqueFilterSettings, SortingCriteria.None); } context.ExecuteCommandBuffer(cmd); CommandBufferPool.Release(cmd); }