Ejemplo n.º 1
0
        public DX11NodesFactory(IHDEHost hdehost, DotNetPluginFactory dnfactory, INodeInfoFactory ni, IORegistry ioreg, ILogger logger)
        {
            DX11EnumFormatHelper.CreateNullDeviceFormat();

            this.hdehost = hdehost;
            this.ioreg   = ioreg;
            this.logger  = logger;
            this.hdehost.RootNode.Removed += new Core.CollectionDelegate <INode2>(RootNode_Removed);

            DX11ResourceRegistry reg = new DX11ResourceRegistry();

            this.ioreg.Register(reg, true);

            this.hdehost.MainLoop.OnPresent      += GraphEventService_OnPresent;
            this.hdehost.MainLoop.OnPrepareGraph += GraphEventService_OnPrepareGraph;
            this.hdehost.MainLoop.OnRender       += GraphEventService_OnRender;

            this.displaymanager = new DX11DisplayManager();
            this.devicemanager  = new DX11AutoAdapterDeviceManager(this.logger, this.displaymanager);

            this.graphbuilder = new DX11GraphBuilder <IDX11ResourceProvider>(hdehost, reg);
            this.graphbuilder.RenderRequest += graphbuilder_OnRenderRequest;
            this.rendermanager = new DX11RenderManager(this.devicemanager, this.graphbuilder, this.logger);

            DX11GlobalDevice.DeviceManager = this.devicemanager;
            DX11GlobalDevice.RenderManager = this.rendermanager;

            this.BuildAAEnum();
        }
Ejemplo n.º 2
0
        public DX11NodesFactory(IHDEHost hdehost, DotNetPluginFactory dnfactory, INodeInfoFactory ni, IORegistry ioreg, ILogger logger)
        {
            //Attach lib core path and plugins path

            string path     = Path.GetDirectoryName(typeof(DX11DeviceRenderer).Assembly.Location);
            string vvvvpath = Path.GetDirectoryName(Application.ExecutablePath);

            string varpath = Environment.GetEnvironmentVariable("Path", EnvironmentVariableTarget.Process);

            varpath += ";" + path;

            vvvvpath = Path.Combine(vvvvpath, "packs\\dx11\\nodes\\plugins");
            varpath += ";" + path;

            Environment.SetEnvironmentVariable("Path", varpath, EnvironmentVariableTarget.Process);

            DX11EnumFormatHelper.CreateNullDeviceFormat();


            this.hdehost = hdehost;
            this.ioreg   = ioreg;
            this.logger  = logger;

            //Workaround for vvvv < 35.6
            var versionProperty = hdehost.GetType().GetProperty("Version");

            if (versionProperty == null)
            {
                this.hdehost.RootNode.Removed += new Core.CollectionDelegate <INode2>(RootNode_Removed);
            }

            DX11ResourceRegistry reg = new DX11ResourceRegistry();

            this.ioreg.Register(reg, true);

            this.hdehost.MainLoop.OnPresent      += GraphEventService_OnPresent;
            this.hdehost.MainLoop.OnPrepareGraph += GraphEventService_OnPrepareGraph;
            this.hdehost.MainLoop.OnRender       += GraphEventService_OnRender;

            this.displaymanager = new DX11DisplayManager();

            this.DirectWriteFactory = new DWriteFactory(SlimDX.DirectWrite.FactoryType.Shared);
            DirectWriteFontUtils.SetFontEnum(this.hdehost, this.DirectWriteFactory);

            string[] args = Environment.GetCommandLineArgs();

            foreach (string s in args)
            {
                string sl = s.ToLower();
                if (sl.StartsWith("/dx11mode:"))
                {
                    sl = sl.Replace("/dx11mode:", "");

                    if (sl == "permonitor")
                    {
                        this.devicemanager = new DX11PerMonitorDeviceManager(this.logger, this.displaymanager);
                    }
                    else if (sl == "nvidia")
                    {
                        this.devicemanager = new DX11AutoAdapterDeviceManager(this.logger, this.displaymanager);
                    }
                    else if (sl == "peradapter")
                    {
                        this.devicemanager = new DX11PerAdapterDeviceManager(this.logger, this.displaymanager);
                    }
                    else if (sl == "all")
                    {
                        this.devicemanager = new DX11AllAdapterDeviceManager(this.logger, this.displaymanager);
                    }
                    else if (sl.StartsWith("force"))
                    {
                        sl = sl.Replace("force", "");
                        try
                        {
                            int i = int.Parse(sl);
                            if (i >= 0 && i < this.displaymanager.AdapterCount)
                            {
                                this.devicemanager = new DX11AutoAdapterDeviceManager(this.logger, this.displaymanager, i);
                            }
                        }
                        catch
                        {
                        }
                    }
                    else if (sl.StartsWith("pooled"))
                    {
                        sl = sl.Replace("pooled", "");
                        try
                        {
                            int i = 0;
                            int.TryParse(sl, out i);

                            this.devicemanager = new DX11PooledAdapterDeviceManager(this.logger, this.displaymanager, i);
                        }
                        catch
                        {
                        }
                    }
                }
            }

            if (this.devicemanager == null)
            {
                this.devicemanager = new DX11AutoAdapterDeviceManager(this.logger, this.displaymanager);
            }

            this.graphbuilder = new DX11GraphBuilder(hdehost, reg);
            this.graphbuilder.RenderRequest += graphbuilder_OnRenderRequest;
            this.rendermanager = new DX11RenderManager(this.devicemanager, this.graphbuilder, this.logger);

            DX11GlobalDevice.DeviceManager = this.devicemanager;
            DX11GlobalDevice.RenderManager = this.rendermanager;

            this.BuildAAEnum();
            this.RegisterStateEnums();
            this.BuildVertexLayoutsEnum();
        }
Ejemplo n.º 3
0
        public DX11NodesFactory(IHDEHost hdehost, DotNetPluginFactory dnfactory, INodeInfoFactory ni, IORegistry ioreg, ILogger logger)
        {
            DX11EnumFormatHelper.CreateNullDeviceFormat();

            this.hdehost = hdehost;
            this.ioreg   = ioreg;
            this.logger  = logger;
            this.hdehost.RootNode.Removed += new Core.CollectionDelegate <INode2>(RootNode_Removed);

            DX11ResourceRegistry reg = new DX11ResourceRegistry();

            this.ioreg.Register(reg, true);

            this.hdehost.MainLoop.OnPresent      += GraphEventService_OnPresent;
            this.hdehost.MainLoop.OnPrepareGraph += GraphEventService_OnPrepareGraph;
            this.hdehost.MainLoop.OnRender       += GraphEventService_OnRender;

            this.displaymanager = new DX11DisplayManager();

            string[] args = Environment.GetCommandLineArgs();

            foreach (string s in args)
            {
                string sl = s.ToLower();
                if (sl.StartsWith("/dx11mode:"))
                {
                    sl = sl.Replace("/dx11mode:", "");

                    if (sl == "permonitor")
                    {
                        this.devicemanager = new DX11PerMonitorDeviceManager(this.logger, this.displaymanager);
                    }
                    else if (sl == "peradapter")
                    {
                        this.devicemanager = new DX11PerAdapterDeviceManager(this.logger, this.displaymanager);
                    }
                    else if (sl.StartsWith("force"))
                    {
                        sl = sl.Replace("force", "");
                        try
                        {
                            int i = int.Parse(sl);
                            if (i >= 0 && i < this.displaymanager.AdapterCount)
                            {
                                this.devicemanager = new DX11AutoAdapterDeviceManager(this.logger, this.displaymanager, i);
                            }
                        }
                        catch
                        {
                        }
                    }
                }
            }

            if (this.devicemanager == null)
            {
                this.devicemanager = new DX11AutoAdapterDeviceManager(this.logger, this.displaymanager);
            }

            this.graphbuilder = new DX11GraphBuilder <IDX11ResourceProvider>(hdehost, reg);
            this.graphbuilder.RenderRequest += graphbuilder_OnRenderRequest;
            this.rendermanager = new DX11RenderManager(this.devicemanager, this.graphbuilder, this.logger);

            DX11GlobalDevice.DeviceManager = this.devicemanager;
            DX11GlobalDevice.RenderManager = this.rendermanager;

            this.BuildAAEnum();
        }