public void Dispose() { ResourceManager.WriteResourceDescriptions(); LogHistogram(); Logger.Info("Unintializing ..."); Bass.BASS_ChannelStop(_soundStream); Utilities.DisposeObj(ref _renderTargetView); Utilities.DisposeObj(ref _renderTargetDepthView); Utilities.DisposeObj(ref _renderDepth); Utilities.DisposeObj(ref _texture); Utilities.DisposeObj(ref _renderer); Utilities.DisposeObj(ref _model); Utilities.DisposeObj(ref D3DDevice.SwapChain); Utilities.DisposeObj(ref D3DDevice.DX10_1Device); Utilities.DisposeObj(ref D3DDevice.Direct2DFactory); Utilities.DisposeObj(ref D3DDevice.DirectWriteFactory); Utilities.DisposeObj(ref D3DDevice.Device); Bass.BASS_StreamFree(_soundStream); Utilities.DisposeObj(ref _form); Cursor.Show(); }
public void Dispose() { DisposeTargets(); Utilities.DisposeObj(ref _sceneGridOperator); Utilities.DisposeObj(ref _imageBackgroundOperator); Utilities.DisposeObj(ref _cubemapSphereOperator); Utilities.DisposeObj(ref _plotValueOperator); Utilities.DisposeObj(ref _D3DImageContainer); }
public void CleanUp() { Utilities.DisposeObj(ref _renderer); Utilities.DisposeObj(ref _shaderResourceView); Utilities.DisposeObj(ref _depthStencilView); Utilities.DisposeObj(ref _depthTex); Utilities.DisposeObj(ref _renderTargetView); Utilities.DisposeObj(ref _swapChain); }
private void DisposeTargets() { Utilities.DisposeObj(ref _renderView); Utilities.DisposeObj(ref _renderTargetDepthView); Utilities.DisposeObj(ref _inputLayout); Utilities.DisposeObj(ref _sharedTexture); Utilities.DisposeObj(ref _depthTexture); Utilities.DisposeObj(ref _texture); Utilities.DisposeObj(ref _renderDepth); Utilities.DisposeObj(ref _screenQuadMesh); Utilities.DisposeObj(ref _gpuSyncer); }
public FullScreenView(RenderViewConfiguration renderConfig) { _renderConfig = renderConfig; App.Current.MainWindow.Hide(); System.Windows.Forms.Cursor.Hide(); KeyDown += KeyDownHandler; KeyUp += KeyUpHandler; MouseDown += MouseDownHandler; MouseUp += MouseUpHandler; MouseWheel += MouseWheelHandler; MouseMove += MouseMoveHandler; MouseDoubleClick += MouseDoubleClickHandler; CurrentTime = 0; PlaySpeed = 0; FormBorderStyle = FormBorderStyle.None; var settings = new ContextSettings(); settings.DisplayMode = new SharpDX.Direct3D9.DisplayMode() { Width = (int)App.Current.ProjectSettings.GetOrSetDefault("Tooll.FullScreen.Resolution.Width", 1920), Height = (int)App.Current.ProjectSettings.GetOrSetDefault("Tooll.FullScreen.Resolution.Height", 1080), RefreshRate = 60, Format = SharpDX.Direct3D9.Format.A8R8G8B8 }; settings.AspectRatio = settings.DisplayMode.AspectRatio; var displayNumber = int.Parse(App.Current.ProjectSettings.GetOrSetDefault("Tooll.FullScreen.DisplayNumber", "1")); displayNumber = Utilities.Clamp(displayNumber, 0, Screen.AllScreens.GetLength(0) - 1); Location = Screen.AllScreens[displayNumber].WorkingArea.Location; CurrentTime = App.Current.Model.GlobalTime; PlaySpeed = App.Current.MainWindow.CompositionView.PlaySpeed; App.Current.MainWindow.CompositionView.PlaySpeed = 0; Run(settings); App.Current.Model.GlobalTime = CurrentTime; App.Current.MainWindow.CompositionView.PlaySpeed = PlaySpeed; App.Current.MainWindow.Show(); App.Current.MainWindow.Activate(); App.Current.MainWindow.InvalidateVisual(); App.Current.MainWindow.XCompositionViewDock.Focus(); System.Windows.Forms.Cursor.Show(); }
private void SetupRenderBuffers() { if (D3DDevice.SwapChain == null) { return; } Utilities.DisposeObj(ref _renderTargetView); Utilities.DisposeObj(ref _renderTargetDepthView); Utilities.DisposeObj(ref _renderDepth); D3DDevice.SwapChain.ResizeBuffers(3, _form.ClientSize.Width, _form.ClientSize.Height, D3DDevice.SwapChain.Description.ModeDescription.Format, D3DDevice.SwapChain.Description.Flags); using (var texture = Texture2D.FromSwapChain <Texture2D>(D3DDevice.SwapChain, 0)) { _renderTargetView = new RenderTargetView(D3DDevice.Device, texture); } Texture2DDescription depthdesc = new Texture2DDescription(); depthdesc.BindFlags = BindFlags.DepthStencil; depthdesc.Format = Format.D32_Float_S8X24_UInt; depthdesc.Width = _form.ClientSize.Width; depthdesc.Height = _form.ClientSize.Height; depthdesc.MipLevels = 1; depthdesc.SampleDescription = new SampleDescription(1, 0); depthdesc.Usage = ResourceUsage.Default; depthdesc.OptionFlags = ResourceOptionFlags.None; depthdesc.CpuAccessFlags = CpuAccessFlags.None; depthdesc.ArraySize = 1; _renderDepth = new Texture2D(D3DDevice.Device, depthdesc); _renderTargetDepthView = new DepthStencilView(D3DDevice.Device, _renderDepth); D3DDevice.Device.ImmediateContext.OutputMerger.SetTargets(_renderTargetDepthView, _renderTargetView); _viewport = new ViewportF(0, 0, _form.ClientSize.Width, _form.ClientSize.Height, 0.0f, 1.0f); D3DDevice.Device.ImmediateContext.Rasterizer.SetViewport(_viewport); }
private static void RunTests() { Logger.Initialize(Dispatcher.CurrentDispatcher); var operatorTester = new OperatorTester(); try { Directory.CreateDirectory("logs"); var consoleWriter = new ConsoleWriter(); consoleWriter.Filter = LogEntry.EntryLevel.INF | LogEntry.EntryLevel.WRN | LogEntry.EntryLevel.ERR; Logger.AddWriter(consoleWriter); var logWriter = new FileWriter(String.Format("logs/{0}.log", DateTime.Now.ToString("yyyy_MM_dd-HH_mm_ss_fff"))); logWriter.Filter = LogEntry.EntryLevel.ALL; Logger.AddWriter(logWriter); Logger.Info("Version: {0}.{1} ({2}, {3})", Constants.VersionAsString, BuildProperties.Build, BuildProperties.Branch, BuildProperties.CommitShort); try { string filterPattern = String.Empty; if (Environment.GetCommandLineArgs().Count() > 1) { filterPattern = Environment.GetCommandLineArgs()[1]; } try { new Regex(filterPattern); } catch (Exception ex) { Console.WriteLine("error: filter pattern is not a valid regular expression: {0}", ex.Message); Console.WriteLine("usage: {0} [<filter-pattern> [<test-reference-path>]]", new FileInfo(Environment.GetCommandLineArgs()[0]).Name); Logger.Dispose(); return; } string referencePath = "assets-ff/test-references/"; if (Environment.GetCommandLineArgs().Count() > 2) { referencePath = Environment.GetCommandLineArgs()[2]; } if (referencePath.Count() > 0 && !Directory.Exists(referencePath)) { Console.WriteLine("error: given test reference path is das not exist"); Console.WriteLine("usage: {0} [<filter-pattern> [<test-reference-path>]]", new FileInfo(Environment.GetCommandLineArgs()[0]).Name); Logger.Dispose(); return; } Logger.Info("Initializing ..."); Bass.BASS_Init(-1, 44100, BASSInit.BASS_DEVICE_LATENCY, IntPtr.Zero); var featureLevels = new[] { FeatureLevel.Level_11_0, FeatureLevel.Level_10_1 }; D3DDevice.Device = new Device(DriverType.Hardware, DeviceCreationFlags.None | DeviceCreationFlags.BgraSupport, featureLevels); using (var dxgiDevice = D3DDevice.Device.QueryInterface <SharpDX.DXGI.Device1>()) { var adapter = dxgiDevice.Adapter; D3DDevice.DX10_1Device = new SharpDX.Direct3D10.Device1(adapter, SharpDX.Direct3D10.DeviceCreationFlags.BgraSupport, SharpDX.Direct3D10.FeatureLevel.Level_10_1); } D3DDevice.Direct2DFactory = new SharpDX.Direct2D1.Factory(); D3DDevice.DirectWriteFactory = new SharpDX.DirectWrite.Factory(); SharpDX.RawInput.Device.RegisterDevice(UsagePage.Generic, UsageId.GenericKeyboard, SharpDX.RawInput.DeviceFlags.None); SharpDX.RawInput.Device.RegisterDevice(UsagePage.Generic, UsageId.GenericMouse, SharpDX.RawInput.DeviceFlags.None); SharpDX.RawInput.Device.RegisterDevice(UsagePage.Generic, UsageId.GenericJoystick, SharpDX.RawInput.DeviceFlags.None); MetaManager.Instance.LoadMetaOperators(); Logger.Info("Using test filter pattern \"{0}\"", filterPattern); MetaManager.OPERATOR_TEST_REFERENCE_PATH = referencePath; Logger.Info("Using test reference path \"{0}\"", MetaManager.OPERATOR_TEST_REFERENCE_PATH); Logger.Info("Testing ..."); var allTestsMetaOpID = Guid.Parse("7dccfa46-2551-4efb-a802-5ed3be914c54"); var result = TestUtilities.EvaluateTests(allTestsMetaOpID, filterPattern); Environment.ExitCode = result.Item1 ? 0 : 1; Logger.Info("Result:"); Logger.Info("\n" + result.Item2); Logger.Info("Finalizing ..."); ResourceManager.DisposeAll(); Utilities.DisposeObj(ref D3DDevice.DX10_1Device); Utilities.DisposeObj(ref D3DDevice.Direct2DFactory); Utilities.DisposeObj(ref D3DDevice.DirectWriteFactory); Utilities.DisposeObj(ref D3DDevice.Device); } catch (Exception ex) { ResourceManager.DisposeAll(); Utilities.DisposeObj(ref D3DDevice.Device); String reportString = "Message:".PadRight(15) + ex.Message + "\n\n"; reportString += "Source:".PadRight(15) + ex.Source + "\n"; reportString += "InnerException:".PadRight(15) + ex.InnerException + "\n\n"; reportString += "Stacktrace:\n--------------" + "\n"; reportString += CrashReporter.GetFormattedStackTrace(ex) + "\n"; Logger.Error(reportString); } Logger.Dispose(); } catch (Exception ex) { Console.WriteLine("\n\nFATAL: Exception thrown where it never should happen: " + ex.Message); } }
public void Dispose() { DisposeTargets(); Utilities.DisposeObj(ref _sceneGridOperator); Utilities.DisposeObj(ref _imageBackgroundOperator); }
public void Dispose() { Utilities.DisposeObj(ref _renderView); }