Esempio n. 1
0
        private void SetDevice(ILogger logger, DX11DisplayManager displaymanager, int adapterid)
        {
            Adapter1 adapter = this.DisplayManager.FindAdapter(adapterid);

            logger.Log(LogType.Message, "Creating device for adapter " + adapter.Description.Description);

#if DEBUG
            try
            {
                this.context = new DX11RenderContext(adapter, this.flags);
            }
            catch
            {
                logger.Log(LogType.Warning, "Could not create Debug device, if you want debug informations make sure DirectX SDK is installed");
                logger.Log(LogType.Warning, "Creating default DirectX 11 device");
                this.flags   = DeviceCreationFlags.BgraSupport;
                this.context = new DX11RenderContext(adapter, this.flags);
            }
#else
            this.context = new DX11RenderContext(adapter, this.flags);
#endif

            this.context.Initialize();
            this.contexts.Add(0, this.context);
        }
Esempio n. 2
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();
        }
 public DX11AllAdapterDeviceManager(ILogger logger, DX11DisplayManager displaymanager)
     : base(logger, displaymanager)
 {
     for (int i = 0; i < displaymanager.Factory.GetAdapterCount1(); i++)
     {
         SetDevice(logger, displaymanager, i);
     }
 }
        public DX11PooledAdapterDeviceManager(ILogger logger, DX11DisplayManager displaymanager, int deviceCount)
            : base(logger, displaymanager)
        {
            deviceCount = Math.Max(deviceCount, 1);

            for (int i = 0; i < deviceCount; i++)
            {
                SetDevice(logger, displaymanager, i);
            }
        }
Esempio n. 5
0
        public AbstractDX11RenderContextManager(ILogger logger, DX11DisplayManager displaymanager)
        {
            this.logger = logger;

            #if DEBUG
            this.flags = DeviceCreationFlags.Debug;
            #else
            this.flags = DeviceCreationFlags.None;
            #endif

            this.flags         |= DeviceCreationFlags.BgraSupport;
            this.displaymanager = displaymanager;
        }
Esempio n. 6
0
        public DX11AutoAdapterDeviceManager(ILogger logger, DX11DisplayManager displaymanager)
            : base(logger, displaymanager)
        {
            bool foundnv;
            int  devid = this.DisplayManager.FindNVidia(out foundnv);

            if (!foundnv)
            {
                logger.Log(LogType.Warning, "Did not find NVidia adapter, revert to default");
            }

            SetDevice(logger, displaymanager, devid);
        }
Esempio n. 7
0
        public DX11AutoAdapterDeviceManager(ILogger logger, DX11DisplayManager displaymanager)
            : base(logger, displaymanager)
        {
            #if DEBUG
            try
            {
                this.context = new DX11RenderContext(this.flags);
            }
            catch
            {
                logger.Log(LogType.Warning, "Could not create Debug device, if you want debug informations make sure DirectX SDK is installed");
                logger.Log(LogType.Warning, "Creating default DirectX 11 device");
                this.flags   = DeviceCreationFlags.BgraSupport;
                this.context = new DX11RenderContext(this.flags);
            }
            #else
            this.context = new DX11RenderContext(this.flags);
            #endif

            this.context = new DX11RenderContext(this.flags);
            this.context.Initialize();
            this.contexts.Add(0, this.context);
        }
Esempio n. 8
0
 public DX11PerMonitorDeviceManager(ILogger logger, DX11DisplayManager displaymanager) : base(logger, displaymanager)
 {
 }
Esempio n. 9
0
 public DX11AutoAdapterDeviceManager(ILogger logger, DX11DisplayManager displaymanager, int adapterid)
     : base(logger, displaymanager)
 {
     SetDevice(logger, displaymanager, adapterid);
 }
Esempio n. 10
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;
            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);

            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();
        }
Esempio n. 11
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();
        }