mirror of
https://github.com/ryujinx-mirror/ryujinx.git
synced 2025-09-08 18:16:28 -05:00
Add inbuilt Opengl renderer to window (#922)
* add gl rendering widget * embed renderer into main window * add input * fix mouse input * fix mouse coords * refresh game list after closing game, remove profiler method * rebase, hide game list progress bar while game is running * Some bug fixes Changelog: - Reapply some changes that got lost while rebasing from #904 - Make sure to guarantee exclusivity on the GL context (fixing multiple possible race conditions on Windows) - Avoid making GLRenderer disposed multiple time * add fullscreen, enable input on focus, disable aplha * addressed comments * Disable transparency in the window * fix fullscreen state, fix focus, addressed comments * nit * addressed nit Co-authored-by: Thog <thog@protonmail.com>
This commit is contained in:
35
Ryujinx/Ui/ScopedGlContext.cs
Normal file
35
Ryujinx/Ui/ScopedGlContext.cs
Normal file
@@ -0,0 +1,35 @@
|
||||
using OpenTK.Graphics;
|
||||
using OpenTK.Platform;
|
||||
using System;
|
||||
using System.Threading;
|
||||
|
||||
namespace Ryujinx.Ui
|
||||
{
|
||||
class ScopedGlContext : IDisposable
|
||||
{
|
||||
private IGraphicsContext _graphicsContext;
|
||||
|
||||
private static readonly object _lock = new object();
|
||||
|
||||
public ScopedGlContext(IWindowInfo windowInfo, IGraphicsContext graphicsContext)
|
||||
{
|
||||
_graphicsContext = graphicsContext;
|
||||
|
||||
Monitor.Enter(_lock);
|
||||
|
||||
MakeCurrent(windowInfo);
|
||||
}
|
||||
|
||||
private void MakeCurrent(IWindowInfo windowInfo)
|
||||
{
|
||||
_graphicsContext.MakeCurrent(windowInfo);
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
MakeCurrent(null);
|
||||
|
||||
Monitor.Exit(_lock);
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user