internal DeviceResourceManager(EngineDevice device)
 {
     _device              = device;
     _deviceResources     = new List <IEngineDeviceResource?>(1024);
     _deviceResourcesPrev = new List <IEngineDeviceResource?>(1024);
     _cleanupNeeded       = false;
 }
예제 #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="DeviceHandlerD3D11" /> class.
        /// </summary>
        internal DeviceHandlerD2D(GraphicsDeviceConfiguration deviceConfig, EngineFactory engineFactory, EngineDevice engineDevice)
        {
            try
            {
                // Simulate exception if requested
                if (deviceConfig.CoreConfiguration.ThrowD2DInitDeviceError)
                {
                    throw new SeeingSharpGraphicsException("Simulation Direct2D device init exception");
                }

                using (var dxgiDevice = engineDevice.DeviceD3D11_1.QueryInterface <IDXGIDevice>())
                {
                    _deviceD2D        = engineFactory.FactoryD2D_2.CreateDevice(dxgiDevice);
                    _deviceContextD2D = _deviceD2D
                                        .CreateDeviceContext(D2D.DeviceContextOptions.None);
                    _renderTarget = _deviceContextD2D;
                }
            }
            catch (Exception)
            {
                SeeingSharpUtil.SafeDispose(ref _deviceContextD2D);
                SeeingSharpUtil.SafeDispose(ref _deviceD2D);
                SeeingSharpUtil.SafeDispose(ref _renderTarget);
            }
        }