WindowPresentCommand.cs 1020 B

123456789101112131415161718192021222324252627
  1. using Ryujinx.Graphics.GAL.Multithreading.Model;
  2. using Ryujinx.Graphics.GAL.Multithreading.Resources;
  3. using System;
  4. namespace Ryujinx.Graphics.GAL.Multithreading.Commands.Window
  5. {
  6. struct WindowPresentCommand : IGALCommand
  7. {
  8. public CommandType CommandType => CommandType.WindowPresent;
  9. private TableRef<ThreadedTexture> _texture;
  10. private ImageCrop _crop;
  11. private TableRef<Action<object>> _swapBuffersCallback;
  12. public void Set(TableRef<ThreadedTexture> texture, ImageCrop crop, TableRef<Action<object>> swapBuffersCallback)
  13. {
  14. _texture = texture;
  15. _crop = crop;
  16. _swapBuffersCallback = swapBuffersCallback;
  17. }
  18. public static void Run(ref WindowPresentCommand command, ThreadedRenderer threaded, IRenderer renderer)
  19. {
  20. threaded.SignalFrame();
  21. renderer.Window.Present(command._texture.Get(threaded)?.Base, command._crop, command._swapBuffersCallback.Get(threaded));
  22. }
  23. }
  24. }