/// <inheritdoc/> public override void Execute(ScriptableRenderer renderer, ScriptableRenderContext context, ref RenderingData renderingData) { if (renderer == null) { throw new ArgumentNullException(nameof(renderer)); } CommandBuffer cmd = CommandBufferPool.Get(k_FinalBlitTag); if (renderingData.cameraData.isStereoEnabled || renderingData.cameraData.isSceneViewCamera) { cmd.Blit(colorAttachmentHandle.Identifier(), BuiltinRenderTextureType.CameraTarget); } else { cmd.SetGlobalTexture("_BlitTex", colorAttachmentHandle.Identifier()); SetRenderTarget( cmd, BuiltinRenderTextureType.CameraTarget, RenderBufferLoadAction.DontCare, RenderBufferStoreAction.Store, ClearFlag.None, Color.black, descriptor.dimension); cmd.SetViewProjectionMatrices(Matrix4x4.identity, Matrix4x4.identity); cmd.SetViewport(renderingData.cameraData.camera.pixelRect); ScriptableRenderer.RenderFullscreenQuad(cmd, renderer.GetMaterial(MaterialHandle.Blit)); } context.ExecuteCommandBuffer(cmd); CommandBufferPool.Release(cmd); }
/// <inheritdoc/> public override void Execute(ScriptableRenderer renderer, ScriptableRenderContext context, ref RenderingData renderingData) { if (m_BlitMaterial == null) { Debug.LogErrorFormat("Missing {0}. {1} render pass will not execute. Check for missing reference in the renderer resources.", m_BlitMaterial, GetType().Name); return; } if (renderer == null) { throw new ArgumentNullException(nameof(renderer)); } CommandBuffer cmd = CommandBufferPool.Get(k_FinalBlitTag); if (requiresSRGConversion) { cmd.EnableShaderKeyword(ShaderKeywordStrings.LinearToSRGBConversion); } else { cmd.DisableShaderKeyword(ShaderKeywordStrings.LinearToSRGBConversion); } if (killAlpha) { cmd.EnableShaderKeyword(ShaderKeywordStrings.KillAlpha); } else { cmd.DisableShaderKeyword(ShaderKeywordStrings.KillAlpha); } if (renderingData.cameraData.isStereoEnabled || renderingData.cameraData.isSceneViewCamera) { cmd.Blit(colorAttachmentHandle.Identifier(), BuiltinRenderTextureType.CameraTarget); } else { cmd.SetGlobalTexture("_BlitTex", colorAttachmentHandle.Identifier()); SetRenderTarget( cmd, BuiltinRenderTextureType.CameraTarget, RenderBufferLoadAction.DontCare, RenderBufferStoreAction.Store, ClearFlag.None, Color.black, descriptor.dimension); cmd.SetViewProjectionMatrices(Matrix4x4.identity, Matrix4x4.identity); cmd.SetViewport(renderingData.cameraData.camera.pixelRect); ScriptableRenderer.RenderFullscreenQuad(cmd, m_BlitMaterial); } context.ExecuteCommandBuffer(cmd); CommandBufferPool.Release(cmd); }