Here are the examples of the csharp api UnityEngine.Rendering.LWRP.ScriptableRenderer.SetRenderTarget(UnityEngine.Rendering.CommandBuffer, UnityEngine.Rendering.RenderTargetIdentifier, UnityEngine.Rendering.RenderBufferLoadAction, UnityEngine.Rendering.RenderBufferStoreAction, UnityEngine.Rendering.RenderTargetIdentifier, UnityEngine.Rendering.RenderBufferLoadAction, UnityEngine.Rendering.RenderBufferStoreAction, ClearFlag, UnityEngine.Color, UnityEngine.Rendering.TextureDimension) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
2 Examples
19
View Source File : ScriptableRenderer.cs
License : GNU Lesser General Public License v3.0
Project Creator : pepeizq
License : GNU Lesser General Public License v3.0
Project Creator : pepeizq
internal static void SetRenderTarget(CommandBuffer cmd, RenderTargetIdentifier colorAttachment, RenderTargetIdentifier depthAttachment, ClearFlag clearFlag, Color clearColor)
{
m_ActiveColorAttachment = colorAttachment;
m_ActiveDepthAttachment = depthAttachment;
RenderBufferLoadAction colorLoadAction = clearFlag != ClearFlag.None ?
RenderBufferLoadAction.DontCare : RenderBufferLoadAction.Load;
RenderBufferLoadAction depthLoadAction = CoreUtils.HasFlag(clearFlag, ClearFlag.Depth) ?
RenderBufferLoadAction.DontCare : RenderBufferLoadAction.Load;
TextureDimension dimension = (m_InsideStereoRenderBlock) ? XRGraphics.eyeTextureDesc.dimension : TextureDimension.Tex2D;
SetRenderTarget(cmd, colorAttachment, colorLoadAction, RenderBufferStoreAction.Store,
depthAttachment, depthLoadAction, RenderBufferStoreAction.Store, clearFlag, clearColor, dimension);
}
19
View Source File : ScriptableRenderer.cs
License : GNU Lesser General Public License v3.0
Project Creator : pepeizq
License : GNU Lesser General Public License v3.0
Project Creator : pepeizq
void ExecuteRenderPreplaced(ScriptableRenderContext context, ScriptableRenderPreplaced renderPreplaced, ref RenderingData renderingData)
{
CommandBuffer cmd = CommandBufferPool.Get(k_SetRenderTarget);
renderPreplaced.Configure(cmd, renderingData.cameraData.cameraTargetDescriptor);
RenderTargetIdentifier preplacedColorAttachment = renderPreplaced.colorAttachment;
RenderTargetIdentifier preplacedDepthAttachment = renderPreplaced.depthAttachment;
ref CameraData cameraData = ref renderingData.cameraData;
// When render preplaced doesn't call ConfigureTarget we replacedume it's expected to render to camera target
// which might be backbuffer or the framebuffer render textures.
if (!renderPreplaced.overrideCameraTarget)
{
preplacedColorAttachment = m_CameraColorTarget;
preplacedDepthAttachment = m_CameraDepthTarget;
}
if (preplacedColorAttachment == m_CameraColorTarget && !m_FirstCameraRenderPreplacedExecuted)
{
m_FirstCameraRenderPreplacedExecuted = true;
Camera camera = cameraData.camera;
ClearFlag clearFlag = GetCameraClearFlag(camera.clearFlags);
SetRenderTarget(cmd, m_CameraColorTarget, m_CameraDepthTarget, clearFlag,
CoreUtils.ConvertSRGBToActiveColorSpace(camera.backgroundColor));
context.ExecuteCommandBuffer(cmd);
cmd.Clear();
if (cameraData.isStereoEnabled)
{
context.StartMultiEye(cameraData.camera);
XRUtils.DrawOcclusionMesh(cmd, cameraData.camera);
}
}
// Only setup render target if current render preplaced attachments are different from the active ones
else if (preplacedColorAttachment != m_ActiveColorAttachment || preplacedDepthAttachment != m_ActiveDepthAttachment)
SetRenderTarget(cmd, preplacedColorAttachment, preplacedDepthAttachment, renderPreplaced.clearFlag, renderPreplaced.clearColor);
context.ExecuteCommandBuffer(cmd);
CommandBufferPool.Release(cmd);
renderPreplaced.Execute(context, ref renderingData);
}