ThreadedWindow.cs 1.2 KB

123456789101112131415161718192021222324252627282930313233343536
  1. using Ryujinx.Graphics.GAL.Multithreading.Commands.Window;
  2. using Ryujinx.Graphics.GAL.Multithreading.Model;
  3. using Ryujinx.Graphics.GAL.Multithreading.Resources;
  4. using System;
  5. namespace Ryujinx.Graphics.GAL.Multithreading
  6. {
  7. public class ThreadedWindow : IWindow
  8. {
  9. private ThreadedRenderer _renderer;
  10. private IRenderer _impl;
  11. public ThreadedWindow(ThreadedRenderer renderer, IRenderer impl)
  12. {
  13. _renderer = renderer;
  14. _impl = impl;
  15. }
  16. public void Present(ITexture texture, ImageCrop crop, Action swapBuffersCallback)
  17. {
  18. // If there's already a frame in the pipeline, wait for it to be presented first.
  19. // This is a multithread rate limit - we can't be more than one frame behind the command queue.
  20. _renderer.WaitForFrame();
  21. _renderer.New<WindowPresentCommand>().Set(new TableRef<ThreadedTexture>(_renderer, texture as ThreadedTexture), crop, new TableRef<Action>(_renderer, swapBuffersCallback));
  22. _renderer.QueueCommand();
  23. }
  24. public void SetSize(int width, int height)
  25. {
  26. _impl.Window.SetSize(width, height);
  27. }
  28. public void ChangeVSyncMode(bool vsyncEnabled) { }
  29. }
  30. }