/// <inheritdoc/> public override void Execute(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; } bool requiresSRGBConvertion = Display.main.requiresSrgbBlitToBackbuffer; bool killAlpha = renderingData.killAlphaInFinalBlit; CommandBuffer cmd = CommandBufferPool.Get(m_ProfilerTag); if (requiresSRGBConvertion) { 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(m_Source.Identifier(), BuiltinRenderTextureType.CameraTarget); } else { cmd.SetGlobalTexture("_BlitTex", m_Source.GetShaderResource()); SetRenderTarget( cmd, BuiltinRenderTextureType.CameraTarget, RenderBufferLoadAction.DontCare, RenderBufferStoreAction.Store, ClearFlag.None, Color.black, m_TargetDimension); cmd.SetViewProjectionMatrices(Matrix4x4.identity, Matrix4x4.identity); cmd.SetViewport(renderingData.cameraData.camera.pixelRect); cmd.DrawMesh(RenderingUtils.fullscreenMesh, Matrix4x4.identity, m_BlitMaterial); } context.ExecuteCommandBuffer(cmd); CommandBufferPool.Release(cmd); }