Example #1
0
    void PrepareSimpleCB(CommandBuffer cb)
    {
        if (initLut)
        {
            GetLutTex(cb);
            forceUpdate = true;
            initLut     = false;
        }

        RenderTextureFormat    copyFormat    = CommonSet.SelectFormat(RenderTextureFormat.ARGBHalf, RenderTextureFormat.ARGB32);
        RenderTargetIdentifier _SimpleCopyId = new RenderTargetIdentifier(CommonSet.ShaderProperties.simpleCopyTex);

        if (rt)
        {
            cb.GetTemporaryRT(CommonSet.ShaderProperties.simpleCopyTex, rt.width, rt.height, 0, FilterMode.Bilinear, copyFormat, RenderTextureReadWrite.Linear);
            RenderTargetIdentifier _RenderTexId = new RenderTargetIdentifier(rt);
            cb.Blit(_RenderTexId, _SimpleCopyId);
            if (SceneBloomEnable())
            {
                PrepareBloom(cb, _SimpleCopyId, rt.width, rt.height);
            }
            cb.Blit(_SimpleCopyId, BuiltinRenderTextureType.CameraTarget, uberMaterial, (int)DragonPostProcess.MainPass.Simple);
        }
        else
        {
            cb.GetTemporaryRT(CommonSet.ShaderProperties.simpleCopyTex, cam.pixelWidth, cam.pixelHeight, 0, FilterMode.Bilinear, copyFormat, RenderTextureReadWrite.Linear);
            cb.Blit(BuiltinRenderTextureType.CameraTarget, _SimpleCopyId);
            if (SceneBloomEnable())
            {
                PrepareBloom(cb, _SimpleCopyId, cam.pixelWidth, cam.pixelHeight);
            }
            cb.Blit(_SimpleCopyId, BuiltinRenderTextureType.CameraTarget, uberMaterial, (int)DragonPostProcess.MainPass.Simple);
        }

        cb.ReleaseTemporaryRT(CommonSet.ShaderProperties.simpleCopyTex);

        if (SceneBloomEnable())
        {
            FinishBloom(cb, CommonSet.ShaderProperties.bloomTex);
        }
    }