UnityAppController+Rendering.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. #pragma once
  2. #include "UnityForwardDecls.h"
  3. #include "UnityAppController.h"
  4. #include "UnityRendering.h"
  5. #if PLATFORM_VISIONOS
  6. #include "UnityAppController+Rendering+visionOS.h"
  7. #endif
  8. #if UNITY_USES_METAL_DISPLAY_LINK
  9. @interface UnityAppController (Rendering) <CAMetalDisplayLinkDelegate>
  10. #else
  11. @interface UnityAppController (Rendering)
  12. #endif
  13. #if !PLATFORM_VISIONOS
  14. @property (readonly) BOOL usingCompositorLayer;
  15. #endif
  16. - (void)createDisplayLink;
  17. - (void)repaintDisplayLink;
  18. - (void)destroyDisplayLink;
  19. - (void)pauseDisplayLink;
  20. - (void)unpauseDisplayLink;
  21. - (void)repaint;
  22. #if UNITY_USES_METAL_DISPLAY_LINK
  23. - (void)metalDisplayLink:(CAMetalDisplayLink *)link needsUpdate:(CAMetalDisplayLinkUpdate *)update API_AVAILABLE(ios(17.0), tvos(17.0));
  24. #endif
  25. #if !PLATFORM_VISIONOS
  26. - (void)repaintCompositorLayer;
  27. #endif
  28. - (void)selectRenderingAPI;
  29. @property (readonly, nonatomic) UnityRenderingAPI renderingAPI;
  30. // These methods switch between CADisplayLink and CAMetalDisplayLink at runtime.
  31. // Both dispatch the actual work to the main thread, outside of the Unity player loop.
  32. // Switch to CADisplayLink is always possible; if already using CADisplayLink, it's a no-op.
  33. // Switch to CAMetalDisplayLink checks shouldUseMetalDisplayLink first
  34. // and stays on CADisplayLink if it returns false.
  35. - (void)switchToCADisplayLink;
  36. #if UNITY_USES_METAL_DISPLAY_LINK
  37. - (void)switchToMetalDisplayLink API_AVAILABLE(ios(17.0), tvos(17.0));
  38. #endif
  39. @end
  40. // helper to run unity loop along with proper handling of the rendering
  41. #ifdef __cplusplus
  42. extern "C" {
  43. #endif
  44. void UnityRepaint();
  45. #ifdef __cplusplus
  46. } // extern "C"
  47. #endif