Esempio n. 1
0
        public override async System.Threading.Tasks.Task <bool> Init(CRenderContext RHICtx, UInt32 width, UInt32 height, CGfxCamera camera, IntPtr WinHandle)
        {
            if (mOpaqueSE == null)
            {
                mOpaqueSE = CEngine.Instance.ShadingEnvManager.GetGfxShadingEnv <CGfxMobileOpaqueSE>();
            }

            if (mCustomTranslucentSE == null)
            {
                mCustomTranslucentSE = CEngine.Instance.ShadingEnvManager.GetGfxShadingEnv <CGfxMobileCustomTranslucentSE>();
            }

            if (mTranslucentSE == null)
            {
                mTranslucentSE = CEngine.Instance.ShadingEnvManager.GetGfxShadingEnv <CGfxMobileTranslucentSE>();
            }

            if (mCopySE == null)
            {
                mCopySE = CEngine.Instance.ShadingEnvManager.GetGfxShadingEnv <CGfxMobileCopySE>();
            }

            if (mGizmosSE == null)
            {
                mGizmosSE = CEngine.Instance.ShadingEnvManager.GetGfxShadingEnv <CGfxGizmosSE>();
            }

            if (mSE_MobileSky == null)
            {
                mSE_MobileSky = CEngine.Instance.ShadingEnvManager.GetGfxShadingEnv <CGfxSE_MobileSky>();
            }

            if (mOpaqueSE == null || mCustomTranslucentSE == null || mTranslucentSE == null || mCopySE == null || mGizmosSE == null || mSE_MobileSky == null)
            {
                return(false);
            }

            {
                //base scene view;
                CGfxSceneViewInfo BaseViewInfo = new CGfxSceneViewInfo();
                BaseViewInfo.mUseDSV = true;
                BaseViewInfo.Width   = width;
                BaseViewInfo.Height  = height;
                BaseViewInfo.mDSVDesc.Init();
                BaseViewInfo.mDSVDesc.Format = EngineNS.EPixelFormat.PXF_D24_UNORM_S8_UINT;
                BaseViewInfo.mDSVDesc.Width  = width;
                BaseViewInfo.mDSVDesc.Height = height;

                CRenderTargetViewDesc rtDesc0 = new CRenderTargetViewDesc();
                rtDesc0.Init();
                //rtDesc0.Format = EPixelFormat.PXF_R8G8B8A8_UNORM;
                rtDesc0.Format = EPixelFormat.PXF_R16G16B16A16_FLOAT;
                rtDesc0.Width  = width;
                rtDesc0.Height = height;
                BaseViewInfo.mRTVDescArray.Add(rtDesc0);

                BaseSceneView = new CGfxSceneView();
                if (false == BaseSceneView.Init(RHICtx, null, BaseViewInfo))
                {
                    return(false);
                }
                BaseSceneView.UIHost = new UISystem.UIHost();
                await BaseSceneView.UIHost.Initialize(RHICtx, new UISystem.UIHostInitializer());

                BaseSceneView.UIHost.WindowSize = new SizeF(width, height);

                mForwardBasePass = new CGfxFramePass(RHICtx, "OffSrcFWBasePass");
                mForwardBasePass.mBaseSceneView = BaseSceneView;

                mForwardBasePass.SetRLayerParameter(ERenderLayer.RL_Opaque, PrebuildPassIndex.PPI_OpaquePbr, mOpaqueSE);
                mForwardBasePass.SetRLayerParameter(ERenderLayer.RL_CustomOpaque, PrebuildPassIndex.PPI_OpaquePbr, mOpaqueSE);
                mForwardBasePass.SetRLayerParameter(ERenderLayer.RL_Sky, PrebuildPassIndex.PPI_Sky, mSE_MobileSky);
                mForwardBasePass.SetRLayerParameter(ERenderLayer.RL_CustomTranslucent, PrebuildPassIndex.PPI_CustomTranslucentPbr, mCustomTranslucentSE);
                mForwardBasePass.SetRLayerParameter(ERenderLayer.RL_Translucent, PrebuildPassIndex.PPI_Gizmos, mTranslucentSE);
                mForwardBasePass.SetRLayerParameter(ERenderLayer.RL_Gizmos, PrebuildPassIndex.PPI_TransparentPbr, mGizmosSE);

                FrameBufferClearColor TempClearColor = new FrameBufferClearColor();
                TempClearColor.r = 0.0f;
                TempClearColor.g = 0.0f;
                TempClearColor.b = 0.0f;
                TempClearColor.a = 0.0f;
                mForwardBasePass.mRenderPassDesc.mFBLoadAction_Color    = FrameBufferLoadAction.LoadActionClear;
                mForwardBasePass.mRenderPassDesc.mFBStoreAction_Color   = FrameBufferStoreAction.StoreActionStore;
                mForwardBasePass.mRenderPassDesc.mFBClearColorRT0       = TempClearColor;
                mForwardBasePass.mRenderPassDesc.mFBLoadAction_Depth    = FrameBufferLoadAction.LoadActionClear;
                mForwardBasePass.mRenderPassDesc.mFBStoreAction_Depth   = FrameBufferStoreAction.StoreActionStore;
                mForwardBasePass.mRenderPassDesc.mDepthClearValue       = 1.0f;
                mForwardBasePass.mRenderPassDesc.mFBLoadAction_Stencil  = FrameBufferLoadAction.LoadActionClear;
                mForwardBasePass.mRenderPassDesc.mFBStoreAction_Stencil = FrameBufferStoreAction.StoreActionStore;
                mForwardBasePass.mRenderPassDesc.mStencilClearValue     = 0u;
            }

            {
                //ufo scene view;
                CGfxScreenViewDesc UFOViewInfo = new CGfxScreenViewDesc();
                UFOViewInfo.IsSwapChainBuffer   = false;
                UFOViewInfo.UseDepthStencilView = false;
                UFOViewInfo.Width  = width;
                UFOViewInfo.Height = height;

                var rtDesc1 = new CRenderTargetViewDesc();
                rtDesc1.Init();
                rtDesc1.mCanBeSampled = vBOOL.FromBoolean(true);
                rtDesc1.Format        = EPixelFormat.PXF_R8G8B8A8_UNORM;
                rtDesc1.Width         = width;
                rtDesc1.Height        = height;
                UFOViewInfo.mRTVDescArray.Add(rtDesc1);

                mCopyPostprocessPass = new CGfxPostprocessPass();
                await mCopyPostprocessPass.Init(RHICtx, SwapChain, UFOViewInfo, mCopySE, RName.GetRName("Material/defaultmaterial.instmtl"), "OffSrcCopyPost");

                FrameBufferClearColor TempClearColor = new FrameBufferClearColor();
                TempClearColor.r = 0.0f;
                TempClearColor.g = 0.0f;
                TempClearColor.b = 0.0f;
                TempClearColor.a = 0.0f;
                mCopyPostprocessPass.mRenderPassDesc.mFBLoadAction_Color    = FrameBufferLoadAction.LoadActionClear;
                mCopyPostprocessPass.mRenderPassDesc.mFBStoreAction_Color   = FrameBufferStoreAction.StoreActionStore;
                mCopyPostprocessPass.mRenderPassDesc.mFBClearColorRT0       = TempClearColor;
                mCopyPostprocessPass.mRenderPassDesc.mFBLoadAction_Depth    = FrameBufferLoadAction.LoadActionClear;
                mCopyPostprocessPass.mRenderPassDesc.mFBStoreAction_Depth   = FrameBufferStoreAction.StoreActionStore;
                mCopyPostprocessPass.mRenderPassDesc.mDepthClearValue       = 1.0f;
                mCopyPostprocessPass.mRenderPassDesc.mFBLoadAction_Stencil  = FrameBufferLoadAction.LoadActionClear;
                mCopyPostprocessPass.mRenderPassDesc.mFBStoreAction_Stencil = FrameBufferStoreAction.StoreActionStore;
                mCopyPostprocessPass.mRenderPassDesc.mStencilClearValue     = 0u;
            }

            Camera = camera;
            Camera.SetSceneView(RHICtx, BaseSceneView);

            bool IsReady = await mSSM.Init(RHICtx);

            if (IsReady == false)
            {
                Profiler.Log.WriteLine(Profiler.ELogTag.Error, "@Graphic", $"SSM Error", "");
                return(false);
            }

            IsReady = await mBloomMobile.Init(RHICtx, width, height, BaseSceneView);

            if (IsReady == false)
            {
                Profiler.Log.WriteLine(Profiler.ELogTag.Error, "@Graphic", $"BloomError", "");
                return(false);
            }

            //sun shaft;
            IsReady = await mSunShaftMobile.Init(RHICtx, width, height);

            if (IsReady == false)
            {
                System.Diagnostics.Debug.Assert(false);
                return(false);
            }

            //mobile ao;
            IsReady = await mMobileAO.Init(RHICtx, width, height, BaseSceneView);

            if (IsReady == false)
            {
                System.Diagnostics.Debug.Assert(false);
                return(false);
            }

            //
            mOpaqueSE.mTex_ShadowMap = mSSM.mShadowMapView.FrameBuffer.GetSRV_DepthStencil();
            mOpaqueSE.EnvMapName     = CEngine.Instance.Desc.DefaultEnvMap;
            mOpaqueSE.EyeEnvMapName  = CEngine.Instance.Desc.DefaultEyeEnvMap;

            mCustomTranslucentSE.EnvMapName     = CEngine.Instance.Desc.DefaultEnvMap;
            mCustomTranslucentSE.mTex_ShadowMap = mSSM.mShadowMapView.FrameBuffer.GetSRV_DepthStencil();

            mTranslucentSE.EnvMapName = CEngine.Instance.Desc.DefaultEnvMap;

            mCopySE.mBaseSceneView = BaseSceneView.FrameBuffer.GetSRV_RenderTarget(0);
            if (CEngine.EnableBloom == true)
            {
                mCopySE.mBloomTex = mBloomMobile.mUSView8.FrameBuffer.GetSRV_RenderTarget(0);
            }
            else
            {
                mCopySE.mBloomTex = BaseSceneView.FrameBuffer.GetSRV_RenderTarget(0);
            }
            mCopySE.VignetteTex  = CEngine.Instance.Desc.DefaultVignette;
            mCopySE.mSunShaftTex = mSunShaftMobile.mView_Blur.FrameBuffer.GetSRV_RenderTarget(0);
            //mCopySE.mSRV_MobileAo = mMobileAO.mView_BlurV.FrameBuffer.GetSRV_RenderTarget(0);
            mCopySE.mSRV_MobileAo = mMobileAO.mView_AoMask.FrameBuffer.GetSRV_RenderTarget(0);

            {
                var Tex2DDesc = mOpaqueSE.EnvMap.TxPicDesc;
                BaseSceneView.mEnvMapMipMaxLevel = Tex2DDesc.MipLevel - 1;

                Tex2DDesc = mOpaqueSE.EyeEnvMap.TxPicDesc;
                BaseSceneView.mEyeEnvMapMaxMipLevel = Tex2DDesc.MipLevel - 1;

                var ViewportSizeAndRcp = new Vector4(width, height, 1.0f / width, 1.0f / height);
                mCopyPostprocessPass.mScreenView.ViewportSizeAndRcp = ViewportSizeAndRcp;
            }

            return(true);
        }
Esempio n. 2
0
        public override async System.Threading.Tasks.Task <bool> Init(CRenderContext RHICtx, UInt32 width, UInt32 height, CGfxCamera camera, IntPtr WinHandle)
        {
            CGfxSceneViewInfo SnapshotViewInfo = new CGfxSceneViewInfo();

            SnapshotViewInfo.mUseDSV = true;
            SnapshotViewInfo.Width   = width;
            SnapshotViewInfo.Height  = height;
            SnapshotViewInfo.mDSVDesc.Init();
            SnapshotViewInfo.mDSVDesc.Format = EngineNS.EPixelFormat.PXF_D24_UNORM_S8_UINT;
            SnapshotViewInfo.mDSVDesc.Width  = width;
            SnapshotViewInfo.mDSVDesc.Height = height;

            CRenderTargetViewDesc rtDesc0 = new CRenderTargetViewDesc();

            rtDesc0.Init();
            rtDesc0.Format = EPixelFormat.PXF_R8G8B8A8_UNORM;
            rtDesc0.Width  = width;
            rtDesc0.Height = height;
            SnapshotViewInfo.mRTVDescArray.Add(rtDesc0);

            BaseSceneView = new CGfxSceneView();
            if (false == BaseSceneView.Init(RHICtx, null, SnapshotViewInfo))
            {
                return(false);
            }

            Camera = camera;
            //mCamera.SetSceneView(RHICtx, mBaseSceneView);

            mRenderPassDesc_Snapshot = new CRenderPassDesc();
            FrameBufferClearColor TempClearColor = new FrameBufferClearColor();

            TempClearColor.r = 0.0f;
            TempClearColor.g = 0.0f;
            TempClearColor.b = 0.0f;
            TempClearColor.a = 0.0f;
            mRenderPassDesc_Snapshot.mFBLoadAction_Color    = FrameBufferLoadAction.LoadActionClear;
            mRenderPassDesc_Snapshot.mFBStoreAction_Color   = FrameBufferStoreAction.StoreActionStore;
            mRenderPassDesc_Snapshot.mFBClearColorRT0       = TempClearColor;
            mRenderPassDesc_Snapshot.mFBLoadAction_Depth    = FrameBufferLoadAction.LoadActionClear;
            mRenderPassDesc_Snapshot.mFBStoreAction_Depth   = FrameBufferStoreAction.StoreActionStore;
            mRenderPassDesc_Snapshot.mDepthClearValue       = 1.0f;
            mRenderPassDesc_Snapshot.mFBLoadAction_Stencil  = FrameBufferLoadAction.LoadActionClear;
            mRenderPassDesc_Snapshot.mFBStoreAction_Stencil = FrameBufferStoreAction.StoreActionStore;
            mRenderPassDesc_Snapshot.mStencilClearValue     = 0u;

            mRenderPassDesc_Final = new CRenderPassDesc();
            TempClearColor.r      = 0.0f;
            TempClearColor.g      = 1.0f;
            TempClearColor.b      = 0.0f;
            TempClearColor.a      = 0.0f;
            mRenderPassDesc_Final.mFBLoadAction_Color    = FrameBufferLoadAction.LoadActionClear;
            mRenderPassDesc_Final.mFBStoreAction_Color   = FrameBufferStoreAction.StoreActionStore;
            mRenderPassDesc_Final.mFBClearColorRT0       = TempClearColor;
            mRenderPassDesc_Final.mFBLoadAction_Depth    = FrameBufferLoadAction.LoadActionClear;
            mRenderPassDesc_Final.mFBStoreAction_Depth   = FrameBufferStoreAction.StoreActionStore;
            mRenderPassDesc_Final.mDepthClearValue       = 1.0f;
            mRenderPassDesc_Final.mFBLoadAction_Stencil  = FrameBufferLoadAction.LoadActionClear;
            mRenderPassDesc_Final.mFBStoreAction_Stencil = FrameBufferStoreAction.StoreActionStore;
            mRenderPassDesc_Final.mStencilClearValue     = 0u;

            if (mSnapshotSE == null)
            {
                mSnapshotSE = CEngine.Instance.ShadingEnvManager.GetGfxShadingEnv <CGfxSnapshotSE>();
            }
            if (mCopySE == null)
            {
                mCopySE = CEngine.Instance.ShadingEnvManager.GetGfxShadingEnv <CGfxMobileCopySE>();
            }

            var ufoViewInfo = new CGfxScreenViewDesc();

            ufoViewInfo.IsSwapChainBuffer   = false;
            ufoViewInfo.UseDepthStencilView = false;
            ufoViewInfo.Width  = width;
            ufoViewInfo.Height = height;

            var rtDesc1 = new CRenderTargetViewDesc();

            rtDesc1.Init();
            rtDesc1.mCanBeSampled = vBOOL.FromBoolean(true);
            rtDesc1.Format        = EPixelFormat.PXF_R8G8B8A8_UNORM;
            rtDesc1.Width         = width;
            rtDesc1.Height        = height;
            ufoViewInfo.mRTVDescArray.Add(rtDesc1);

            var screenAlignedTriangle = CEngine.Instance.MeshPrimitivesManager.GetMeshPrimitives(RHICtx, CEngineDesc.ScreenAlignedTriangleName, true);

            mScreenAlignedTriangle = CEngine.Instance.MeshManager.CreateMesh(RHICtx, screenAlignedTriangle);
            var mtl = await CEngine.Instance.MaterialInstanceManager.GetMaterialInstanceAsync(RHICtx, RName.GetRName("Material/defaultmaterial.instmtl"));

            mScreenAlignedTriangle.SetMaterialInstance(RHICtx, 0, mtl, CEngine.Instance.PrebuildPassData.DefaultShadingEnvs);
            //await mScreenAlignedTriangle.AwaitEffects();
            mFinalView = new CGfxScreenView();
            await mFinalView.Init(RHICtx, null, ufoViewInfo, mCopySE, mtl, mScreenAlignedTriangle);

            var viewportSizeAndRcp = new Vector4(width, height, 1.0f / width, 1.0f / height);

            mFinalView.ViewportSizeAndRcp = viewportSizeAndRcp;

            return(true);
        }
Esempio n. 3
0
        public override async System.Threading.Tasks.Task <bool> Init(CRenderContext RHICtx, UInt32 width, UInt32 height, CGfxCamera camera, IntPtr WinHandle)
        {
            if (RHICtx == null)
            {
                RHICtx = CEngine.Instance.RenderContext;
            }

            if (mOpaqueSE == null)
            {
                mOpaqueSE = CEngine.Instance.ShadingEnvManager.GetGfxShadingEnv <CGfxMobileOpaqueSE>();
            }

            if (mCustomTranslucentSE == null)
            {
                mCustomTranslucentSE = CEngine.Instance.ShadingEnvManager.GetGfxShadingEnv <CGfxMobileCustomTranslucentSE>();
            }

            if (mTranslucentSE == null)
            {
                mTranslucentSE = CEngine.Instance.ShadingEnvManager.GetGfxShadingEnv <CGfxMobileTranslucentSE>();
            }

            if (mCopySE == null)
            {
                mCopySE = CEngine.Instance.ShadingEnvManager.GetGfxShadingEnv <CGfxMobileCopySE>();
            }

            if (mSE_MobileSky == null)
            {
                mSE_MobileSky = CEngine.Instance.ShadingEnvManager.GetGfxShadingEnv <CGfxSE_MobileSky>();
            }

            if (mOpaqueSE == null || mCustomTranslucentSE == null || mTranslucentSE == null || mCopySE == null || mSE_MobileSky == null)
            {
                return(false);
            }

            {
                //base scene view;
                CGfxSceneViewInfo BaseViewInfo = new CGfxSceneViewInfo();
                BaseViewInfo.mUseDSV = true;
                BaseViewInfo.Width   = width;
                BaseViewInfo.Height  = height;
                BaseViewInfo.mDSVDesc.Init();
                BaseViewInfo.mDSVDesc.Format = EngineNS.EPixelFormat.PXF_D24_UNORM_S8_UINT;
                BaseViewInfo.mDSVDesc.Width  = width;
                BaseViewInfo.mDSVDesc.Height = height;

                CRenderTargetViewDesc rtDesc0 = new CRenderTargetViewDesc();
                rtDesc0.Init();
                if (RHICtx.ContextCaps.SupportHalfRT == 0)
                {
                    CEngine.Instance.ShadingEnvManager.GetGfxShadingEnv <EnvShader.CGfxMobileOpaqueSE>().SetMacroDefineValue("ENV_DISABLE_AO", "1");
                    CEngine.Instance.ShadingEnvManager.GetGfxShadingEnv <EnvShader.CGfxMobileCopySE>().SetMacroDefineValue("ENV_DISABLE_AO", "1");
                    CEngine.Instance.ShadingEnvManager.GetGfxShadingEnv <Bricks.GpuDriven.GpuScene.CGfxMergeInstanceSE>().SetMacroDefineValue("ENV_DISABLE_AO", "1");
                    rtDesc0.Format = EPixelFormat.PXF_R8G8B8A8_UNORM;
                }
                else
                {
                    CEngine.Instance.ShadingEnvManager.GetGfxShadingEnv <EnvShader.CGfxMobileOpaqueSE>().SetMacroDefineValue("ENV_DISABLE_AO", "0");
                    CEngine.Instance.ShadingEnvManager.GetGfxShadingEnv <EnvShader.CGfxMobileCopySE>().SetMacroDefineValue("ENV_DISABLE_AO", "0");
                    CEngine.Instance.ShadingEnvManager.GetGfxShadingEnv <Bricks.GpuDriven.GpuScene.CGfxMergeInstanceSE>().SetMacroDefineValue("ENV_DISABLE_AO", "0");
                    rtDesc0.Format = EPixelFormat.PXF_R16G16B16A16_FLOAT;
                }
                Profiler.Log.WriteLine(Profiler.ELogTag.Info, "Graphics", $"MobileGame render texture format: {rtDesc0.Format}");
                rtDesc0.Width  = width;
                rtDesc0.Height = height;
                BaseViewInfo.mRTVDescArray.Add(rtDesc0);

                BaseSceneView = new CGfxSceneView();
                if (false == BaseSceneView.Init(RHICtx, null, BaseViewInfo))
                {
                    return(false);
                }
                BaseSceneView.UIHost = await CEngine.Instance.UIManager.RegisterHost("Game");

                BaseSceneView.UIHost.IsInputActive = true;
                BaseSceneView.UIHost.WindowSize    = new SizeF(width, height);

                mForwardBasePass = new CGfxFramePass(RHICtx, "GameForwordBasePse");
                mForwardBasePass.mBaseSceneView = BaseSceneView;

                mForwardBasePass.SetRLayerParameter(ERenderLayer.RL_Opaque, PrebuildPassIndex.PPI_OpaquePbr, mOpaqueSE);
                mForwardBasePass.SetRLayerParameter(ERenderLayer.RL_CustomOpaque, PrebuildPassIndex.PPI_OpaquePbr, mOpaqueSE);
                mForwardBasePass.SetRLayerParameter(ERenderLayer.RL_Sky, PrebuildPassIndex.PPI_Sky, mSE_MobileSky);
                mForwardBasePass.SetRLayerParameter(ERenderLayer.RL_CustomTranslucent, PrebuildPassIndex.PPI_CustomTranslucentPbr, mCustomTranslucentSE);
                mForwardBasePass.SetRLayerParameter(ERenderLayer.RL_Translucent, PrebuildPassIndex.PPI_TransparentPbr, mTranslucentSE);

                FrameBufferClearColor TempClearColor = new FrameBufferClearColor();
                TempClearColor.r = 0.0f;
                TempClearColor.g = 0.0f;
                TempClearColor.b = 0.0f;
                TempClearColor.a = 1.0f;
                mForwardBasePass.mRenderPassDesc.mFBLoadAction_Color    = FrameBufferLoadAction.LoadActionClear;
                mForwardBasePass.mRenderPassDesc.mFBStoreAction_Color   = FrameBufferStoreAction.StoreActionStore;
                mForwardBasePass.mRenderPassDesc.mFBClearColorRT0       = TempClearColor;
                mForwardBasePass.mRenderPassDesc.mFBLoadAction_Depth    = FrameBufferLoadAction.LoadActionClear;
                mForwardBasePass.mRenderPassDesc.mFBStoreAction_Depth   = FrameBufferStoreAction.StoreActionStore;
                mForwardBasePass.mRenderPassDesc.mDepthClearValue       = 1.0f;
                mForwardBasePass.mRenderPassDesc.mFBLoadAction_Stencil  = FrameBufferLoadAction.LoadActionClear;
                mForwardBasePass.mRenderPassDesc.mFBStoreAction_Stencil = FrameBufferStoreAction.StoreActionStore;
                mForwardBasePass.mRenderPassDesc.mStencilClearValue     = 0u;
            }

            {
                EngineNS.CSwapChainDesc SwapChainDesc;
                SwapChainDesc.Format       = EngineNS.EPixelFormat.PXF_R8G8B8A8_UNORM;
                SwapChainDesc.Width        = width;
                SwapChainDesc.Height       = height;
                SwapChainDesc.WindowHandle = WinHandle;
                SwapChainDesc.ColorSpace   = EColorSpace.COLOR_SPACE_SRGB_NONLINEAR;
                SwapChain = RHICtx.CreateSwapChain(SwapChainDesc);
                //RHICtx.BindCurrentSwapChain(mSwapChain);

                //ufo scene view;
                CGfxScreenViewDesc UFOViewInfo = new CGfxScreenViewDesc();
                UFOViewInfo.IsSwapChainBuffer   = true;
                UFOViewInfo.UseDepthStencilView = false;
                UFOViewInfo.Width  = width;
                UFOViewInfo.Height = height;

                var rtDesc1 = new CRenderTargetViewDesc();
                rtDesc1.mCanBeSampled = vBOOL.FromBoolean(false);
                UFOViewInfo.mRTVDescArray.Add(rtDesc1);

                mCopyPostprocessPass = new CGfxPostprocessPass();
                await mCopyPostprocessPass.Init(RHICtx, SwapChain, UFOViewInfo, mCopySE, RName.GetRName("Material/defaultmaterial.instmtl"), "GameCopyPost");

                FrameBufferClearColor TempClearColor = new FrameBufferClearColor();
                TempClearColor.r = 0.0f;
                TempClearColor.g = 0.0f;
                TempClearColor.b = 0.0f;
                TempClearColor.a = 0.0f;
                mCopyPostprocessPass.mRenderPassDesc.mFBLoadAction_Color    = FrameBufferLoadAction.LoadActionClear;
                mCopyPostprocessPass.mRenderPassDesc.mFBStoreAction_Color   = FrameBufferStoreAction.StoreActionStore;
                mCopyPostprocessPass.mRenderPassDesc.mFBClearColorRT0       = TempClearColor;
                mCopyPostprocessPass.mRenderPassDesc.mFBLoadAction_Depth    = FrameBufferLoadAction.LoadActionClear;
                mCopyPostprocessPass.mRenderPassDesc.mFBStoreAction_Depth   = FrameBufferStoreAction.StoreActionStore;
                mCopyPostprocessPass.mRenderPassDesc.mDepthClearValue       = 1.0f;
                mCopyPostprocessPass.mRenderPassDesc.mFBLoadAction_Stencil  = FrameBufferLoadAction.LoadActionClear;
                mCopyPostprocessPass.mRenderPassDesc.mFBStoreAction_Stencil = FrameBufferStoreAction.StoreActionStore;
                mCopyPostprocessPass.mRenderPassDesc.mStencilClearValue     = 0u;
            }

            Camera = camera;
            Camera.SetSceneView(RHICtx, BaseSceneView);

            //shadow ssm;
            bool IsReady = await mSSM.Init(RHICtx);

            if (IsReady == false)
            {
                Profiler.Log.WriteLine(Profiler.ELogTag.Error, "@Graphic", $"SSM Error", "");
                return(false);
            }

            //post effect;
            IsReady = await mBloomMobile.Init(RHICtx, width, height, BaseSceneView);

            if (IsReady == false)
            {
                Profiler.Log.WriteLine(Profiler.ELogTag.Error, "@Graphic", $"BloomError", "");
                return(false);
            }

            //sun shaft;
            IsReady = await mSunShaftMobile.Init(RHICtx, width, height);

            if (IsReady == false)
            {
                System.Diagnostics.Debug.Assert(false);
                return(false);
            }

            //mobile ao;
            IsReady = await mMobileAO.Init(RHICtx, width, height, BaseSceneView);

            if (IsReady == false)
            {
                System.Diagnostics.Debug.Assert(false);
                return(false);
            }

            //
            mOpaqueSE.mTex_ShadowMap = mSSM.mShadowMapView.FrameBuffer.GetSRV_DepthStencil();
            mOpaqueSE.EnvMapName     = CEngine.Instance.Desc.DefaultEnvMap;
            mOpaqueSE.EyeEnvMapName  = CEngine.Instance.Desc.DefaultEyeEnvMap;

            mCustomTranslucentSE.EnvMapName     = CEngine.Instance.Desc.DefaultEnvMap;
            mCustomTranslucentSE.mTex_ShadowMap = mSSM.mShadowMapView.FrameBuffer.GetSRV_DepthStencil();

            mTranslucentSE.EnvMapName = CEngine.Instance.Desc.DefaultEnvMap;

            mCopySE.mBaseSceneView = BaseSceneView.FrameBuffer.GetSRV_RenderTarget(0);
            if (CEngine.EnableBloom == true)
            {
                mCopySE.mBloomTex = mBloomMobile.mUSView8.FrameBuffer.GetSRV_RenderTarget(0);
            }
            else
            {
                mCopySE.mBloomTex = BaseSceneView.FrameBuffer.GetSRV_RenderTarget(0);
            }
            mCopySE.VignetteTex  = CEngine.Instance.Desc.DefaultVignette;
            mCopySE.mSunShaftTex = mSunShaftMobile.mView_Blur.FrameBuffer.GetSRV_RenderTarget(0);
            //mCopySE.mSRV_MobileAo = mMobileAO.mView_BlurV.FrameBuffer.GetSRV_RenderTarget(0);
            mCopySE.mSRV_MobileAo = mMobileAO.mView_AoMask.FrameBuffer.GetSRV_RenderTarget(0);

            {
                var Tex2DDesc = mOpaqueSE.EnvMap.TxPicDesc;
                BaseSceneView.mEnvMapMipMaxLevel = Tex2DDesc.MipLevel - 1;

                Tex2DDesc = mOpaqueSE.EyeEnvMap.TxPicDesc;
                BaseSceneView.mEyeEnvMapMaxMipLevel = Tex2DDesc.MipLevel - 1;

                var ViewportSizeAndRcp = new Vector4(width, height, 1.0f / width, 1.0f / height);
                mCopyPostprocessPass.mScreenView.ViewportSizeAndRcp = ViewportSizeAndRcp;
            }

            return(true);
        }