Bez popisu
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

IDevicePerformanceControl.cs 5.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. using System;
  2. namespace UnityEngine.AdaptivePerformance
  3. {
  4. /// <summary>
  5. /// The device performance control interface handles all control elements related to the device performance. You can
  6. /// change the <see cref="IDevicePerformanceControl.AutomaticPerformanceControl"/> settings or retrieve information about the <see cref="CpuLevel"/> and <see cref="GpuLevel"/>.
  7. /// </summary>
  8. public interface IDevicePerformanceControl
  9. {
  10. /// <summary>
  11. /// When set to true, which is the default value, Adaptive Performance automatically sets <see cref="CpuLevel"/> and <see cref="GpuLevel"/>.
  12. /// </summary>
  13. /// <value>True when Adaptive Performance controls <see cref="CpuLevel"/> and <see cref="GpuLevel"/>, otherwise false. The default value is true. </value>
  14. bool AutomaticPerformanceControl { get; set; }
  15. /// <summary>
  16. /// The current PerformanceControlMode.
  17. /// PerformanceControlMode is affected by <see cref="AutomaticPerformanceControl"/>.
  18. /// </summary>
  19. /// <value>The current PerformanceControlMode</value>
  20. PerformanceControlMode PerformanceControlMode { get; }
  21. /// <summary>
  22. /// The maximum valid CPU performance level you use with <see cref="CpuLevel"/>.
  23. /// The minimum value returned is <see cref="Constants.MinCpuPerformanceLevel"/>.
  24. /// This value does not change after startup is complete.
  25. /// </summary>
  26. int MaxCpuPerformanceLevel { get; }
  27. /// <summary>
  28. /// The maximum valid GPU performance level you use with <see cref="GpuLevel"/>.
  29. /// The minimum value returned is <see cref="Constants.MinGpuPerformanceLevel"/>.
  30. /// This value does not change after startup is complete.
  31. /// </summary>
  32. int MaxGpuPerformanceLevel { get; }
  33. /// <summary>
  34. /// The requested CPU performance level.
  35. /// Higher levels typically allow CPU cores to run at higher clock speeds.
  36. /// The consequence is that thermal warnings and throttling might happen sooner when the device cannot sustain high clock speeds.
  37. /// Changes are applied once per frame.
  38. /// It is recommended to set the CpuLevel as low as possible to save power.
  39. /// The valid value range is [<see cref="Constants.MinCpuPerformanceLevel"/>, <see cref="IDevicePerformanceControl.MaxCpuPerformanceLevel"/>].
  40. /// </summary>
  41. /// <value>The requested CPU performance level</value>
  42. int CpuLevel { get; set; }
  43. /// <summary>
  44. /// The requested GPU performance level.
  45. /// Higher levels typically allow the GPU to run at higher clock speeds.
  46. /// The consequence is that thermal warnings and throttling might happen sooner when the device cannot sustain high clock speeds.
  47. /// Changes are applied once per frame.
  48. /// It is recommended to set the GpuLevel as low as possible to save power.
  49. /// The valid value range is [<see cref="Constants.MinGpuPerformanceLevel"/>, <see cref="IDevicePerformanceControl.MaxGpuPerformanceLevel"/>].
  50. /// </summary>
  51. /// <value>The requested GPU performance level</value>
  52. int GpuLevel { get; set; }
  53. /// <summary>
  54. /// The requested CPU boost mode state.
  55. /// Enabled typically allows CPU cores to run at higher clock speeds.
  56. /// The consequence is that thermal warnings and throttling might happen sooner when the device cannot sustain high clock speeds.
  57. /// Changes are applied once per frame.
  58. /// It is recommended to not use a boost often and certainly not continuously to save power.
  59. /// </summary>
  60. /// <value>True when CPU boost is active, otherwise false. The default value is false.</value>
  61. bool CpuPerformanceBoost { get; set; }
  62. /// <summary>
  63. /// The requested GPU boost mode state.
  64. /// Enabled typically allows GPU cores to run at higher clock speeds.
  65. /// The consequence is that thermal warnings and throttling might happen sooner when the device cannot sustain high clock speeds.
  66. /// Changes are applied once per frame.
  67. /// It is recommended to not use a boost often and certainly not continuously to save power.
  68. /// </summary>
  69. /// <value>True when CPU boost is active, otherwise false. The default value is false.</value>
  70. bool GpuPerformanceBoost { get; set; }
  71. }
  72. /// <summary>
  73. /// Enum used to describe the performance control mode used by Adaptive Performance. Can be read from <see cref="IDevicePerformanceControl.PerformanceControlMode"/>.
  74. /// </summary>
  75. public enum PerformanceControlMode
  76. {
  77. /// <summary>
  78. /// Adaptive Performance controls performance levels automatically (default).
  79. /// This mode is enabled by setting <see cref="IDevicePerformanceControl.AutomaticPerformanceControl"/> to true.
  80. /// </summary>
  81. Automatic,
  82. /// <summary>
  83. /// You can control performance levels via <see cref="IDevicePerformanceControl.CpuLevel"/> and <see cref="IDevicePerformanceControl.GpuLevel"/>.
  84. /// This mode is enabled by setting <see cref="IDevicePerformanceControl.AutomaticPerformanceControl"/> to false.
  85. /// </summary>
  86. Manual,
  87. /// <summary>
  88. /// The operating system controls performance levels.
  89. /// This happens if manual control is not supported or if the system is in a thermal throttling state, at which point the operating system takes over control automatically.
  90. /// </summary>
  91. System
  92. }
  93. }