示例#1
0
        void CreateRenderGraph()
        {
            Dependency.Complete();
#if RENDERING_FORCE_DIRECT
            Assert.IsTrue(false, "Obsolete script define RENDERING_FORCE_DIRECT enabled. Use the RenderGraphConfig singleton to configure a render graph");
#endif
            if (!HasSingleton <RenderGraphConfig>())
            {
                Entity eConfig = GetSingletonEntity <DisplayInfo>();
                EntityManager.AddComponentData <RenderGraphConfig>(eConfig, RenderGraphConfig.Default);
            }

            RenderGraphConfig config = GetSingleton <RenderGraphConfig>();
            if (!config.Equals(currentConfig) || eMainViewNode == Entity.Null)
            {
                RenderDebug.LogAlways("RenderGraphConfig changed, building a new render graph!");
                DestroyRenderGraph();
                // we should run the bgfx system here once, so textures are cleaned up and ready for re-use
                currentConfig = config;
                // we only build a default graph if there are no existing nodes - otherwise assume they are already built
                eMainViewNode = BuildRenderGraph();
                CreateScreenToWorldChain(RenderPassType.Opaque, ScreenToWorldId.MainCamera);
                CreateScreenToWorldChain(RenderPassType.Sprites, ScreenToWorldId.Sprites);
                CreateScreenToWorldChain(RenderPassType.UI, ScreenToWorldId.UILayer);
            }

            // build light nodes for lights that have no node associated - need to do this always
            BuildAllLightNodes(eMainViewNode);
        }