/// <summary> /// Create a specific level of the the buffer /// </summary> /// <param name="renderContext"></param> /// <param name="level"></param> /// <param name="cmd"></param> /// <param name="format"></param> internal void CreateTemporary(RenderContext[] renderContext, int level, CommandBuffer cmd, RenderTextureFormat format, RenderPipeline renderPipeline) { if (renderPipeline == RenderPipeline.SRP) { #if UNITY_2017_1_OR_NEWER cmd.GetTemporaryRT(renderTargets[level].identifier, renderContext[level].descriptor, FilterMode.Bilinear); #else cmd.GetTemporaryRT(renderTargets[level].identifier, renderContext[level].width, renderContext[level].height, 0, FilterMode.Bilinear, format, RenderTextureReadWrite.Default, 1); #endif } else { renderTargets[level].renderTexture = PipelineExtensions.GetTemporary(renderContext[level], format); } }
/// <summary> /// Renders the effect from source into destination buffer /// </summary> /// <param name="source"></param> /// <param name="destination"></param> internal void Build(RenderTargetIdentifier source, RenderTargetIdentifier destination, Settings settings, CommandBuffer cmd, Camera renderingCamera) { _commandBuffer = cmd; _settings = settings; _renderingCamera = renderingCamera; _commandBuffer.BeginSample(PipelineProperties.CommandBufferProperties.samplePrepare); CheckFeatureSupport(); _sourceFrameBuffer = source; #if UNITY_2018_2_OR_NEWER _destinationFrameBuffer = new RenderTargetIdentifier(destination, 0, CubemapFace.Unknown, -1); #else _destinationFrameBuffer = destination; #endif UpdateRenderBuffers(); _commandBuffer.EndSample(PipelineProperties.CommandBufferProperties.samplePrepare); //Prepare for selective glow if (_settings.workflow == Workflow.Selective) { _commandBuffer.BeginSample(PipelineProperties.CommandBufferProperties.sampleReplacement); _selectiveRenderContext.UpdateRenderContext(_renderingCamera, _renderTextureFormat, 16, _sourceContext[0].renderDimension); _selectiveRenderTexture = PipelineExtensions.GetTemporary(_selectiveRenderContext, _renderTextureFormat); SetupSelectiveGlowCamera(); selectiveGlowCamera.RenderWithShader(_resources.selectiveRenderShader, _selectiveReplacementTag); _commandBuffer.EndSample(PipelineProperties.CommandBufferProperties.sampleReplacement); } _commandBuffer.BeginSample(PipelineProperties.CommandBufferProperties.sampleSetup); UpdateConstantBuffers(); _commandBuffer.EndSample(PipelineProperties.CommandBufferProperties.sampleSetup); PreSample(); Downsample(); Upsample(); Composite(); }
/// <summary> /// Create a specific level of the the buffer /// </summary> /// <param name="renderContext"></param> /// <param name="level"></param> /// <param name="format"></param> internal void CreateTemporary(RenderContext[] renderContext, int level, RenderTextureFormat format) { renderTargets[level] = PipelineExtensions.GetTemporary(renderContext[level], format); }