private void UpdateGPUInfo() { numGPUs = NvidiaUtil.GetNumberOfGPUs(); if (numGPUs <= 0) { MessageBox.Show("Could not get GPU data!", "Error", MessageBoxButton.OK, MessageBoxImage.Error); Application.Current.Shutdown(); } else { var gpuInfo = new GPUInfo(); if (NvidiaUtil.GetGPUInfo((UInt32)numGPUs, ref gpuInfo)) { TextBox_GPU_Name.Text = gpuInfo.name; TextBox_GPU_Bios.Text = gpuInfo.bios; TextBox_GPU_vRam_Type.Text = gpuInfo.ramType; TextBox_GPU_vRam_Size.Text = (gpuInfo.ramSize / 1024) + " MB"; TextBox_GPU_CoreClock.Text = (gpuInfo.currentCoreClock / 1000) + " MHz"; TextBox_GPU_vRamClock.Text = (gpuInfo.currentRamClock / 1000) + " MHz"; TextBox_GPU_CoreOverclock.Text = (gpuInfo.currentCoreOverclock / 1000) + " MHz"; TextBox_GPU_vRamOverclock.Text = (gpuInfo.currentRamOverclock / 1000) + " MHz"; } else { MessageBox.Show("Could not get info for GPU!", "Error", MessageBoxButton.OK, MessageBoxImage.Error); Application.Current.Shutdown(); } } }
public static void Start(uint width, uint height, Type rootType) { GPUInfo.PrintGPUInfo(); #if DEBUG OpenGLDebugCallback.Init(); #endif if (rootType == null) { throw new InvalidOperationException("Root cannot be null!"); } if (Root != null) { throw new InvalidOperationException("App already initialized!"); } RenderSupport.HasOpenGLError = false; Stage = new Stage(width, height); DefaultJuggler = new Juggler(); Context = new Context(); renderSupport = new RenderSupport(); Root = (DisplayObject)Activator.CreateInstance(rootType); Stage.AddChild(Root); }
public void TestGPUInfo() { Assert.IsTrue(GPUInfo.TotalGPUs > 0); GPUInfo gpu = new GPUInfo(0); Trace.WriteLine(gpu); }
private void gPUInfoToolStripMenuItem_Click(object sender, EventArgs e) { string GPUId = FrSelectMSIGPU.SelectGPU(this, ""); Log.Clear(); if (GPUId != "") { GPUInfo gPUInfo = new GPUInfo(GPUId); OHGPUInformation OHGPUInf = gPUInfo.OHGPUInf; Log.Wrl("GPUIndex : " + OHGPUInf.GPUIndex); Log.Wrl("CoreClock : " + OHGPUInf.CoreClock); Log.Wrl("MemoryClock : " + OHGPUInf.MemoryClock); Log.Wrl("ControlFan : " + OHGPUInf.ControlFan); Log.Wrl("CoreTemperature: " + OHGPUInf.CoreTemperature); } }
public static void Render(bool doRedraw) { UpdateViewPort(); if (doRedraw) { //dispatchEventWith(starling.events.Event.RENDER); float scaleX = _viewPort.Width / Stage.StageWidth; float scaleY = _viewPort.Height / Stage.StageHeight; _painter.NextFrame(); _painter.PixelSize = 1.0f / ContentScaleFactor; _painter.State.SetProjectionMatrix( _viewPort.X < 0f ? -_viewPort.X / scaleX : 0.0f, _viewPort.Y < 0f ? -_viewPort.Y / scaleY : 0.0f, _clippedViewPort.Width / scaleX, _clippedViewPort.Height / scaleY, Stage.StageWidth, Stage.StageHeight, Stage.CameraPosition); _painter.Clear(Stage.Color); Stage.Render(_painter); _painter.FinishFrame(); _painter.FrameId = ++_frameId; _painter.Present(); } if (_statsDisplay != null) { _statsDisplay.DrawCount = _painter.DrawCount; if (!doRedraw) { _statsDisplay.MarkFrameAsSkipped(); } } if (_enableErrorChecking) { GPUInfo.CheckForOpenGLError(); } }
/// <summary> /// Start your app. /// </summary> /// <param name="width">Stage width</param> /// <param name="height">Stage height</param> /// <param name="viewportHeight"></param> /// <param name="viewportWidth"></param> /// <param name="rootType">The root class of your app</param> /// <exception cref="InvalidOperationException">When rootType is null or this function is called twice</exception> /// <exception cref="NotSupportedException">When the OpenGL framebuffer creation fails.</exception> /// <exception cref="ArgumentException">When width or height are less than 32.</exception> public static void Start(uint width, uint height, uint viewportWidth, uint viewportHeight, Type rootType) { Debug.WriteLine("Sparrow starting"); if (width < 32 || height < 32 || viewportWidth < 32 || viewportHeight < 32) { throw new ArgumentException($"Invalid dimensions: {width}x{height}"); } var ver = Gl.CurrentVersion; if (ver.Api == "gl") { if (ver.Major < 4) { throw new NotSupportedException("You need at least OpenGL 4.0 to run Sparrow!"); } } else { if (ver.Major < 3) { throw new NotSupportedException("You need at least OpenGL ES 3.0 to run Sparrow!"); } IsRunningOpenGLES = true; } Gl.Disable(EnableCap.CullFace); Gl.Disable(EnableCap.Dither); Gl.Enable(EnableCap.DepthTest); Gl.DepthFunc(DepthFunction.Always); BlendMode.Get(BlendMode.NORMAL).Activate(); FramebufferStatus status = Gl.CheckFramebufferStatus(FramebufferTarget.Framebuffer); if (status != FramebufferStatus.FramebufferComplete) { throw new NotSupportedException("GL Framebuffer creation error. Status: " + status); } _viewPort = Rectangle.Create(0, 0, viewportWidth, viewportHeight); _previousViewPort = Rectangle.Create(); GPUInfo.PrintGPUInfo(); // Desktop GL core profile needs a VAO for vertex attrib pointers to work. uint vao = Gl.GenVertexArray(); Gl.BindVertexArray(vao); if (rootType == null) { throw new InvalidOperationException("Root cannot be null!"); } if (Root != null) { throw new InvalidOperationException("App already initialized!"); } _painter = new Painter(width, height); Stage = new Stage(width, height); DefaultJuggler = new Juggler(); UpdateViewPort(true); Root = (DisplayObject)Activator.CreateInstance(rootType); Stage.AddChild(Root); _frameId = 1; // starts with 1, so things on the first frame are cached }