@@ -5789,25 +5789,36 @@ pub struct SurfaceConfiguration<V> {
57895789 /// `AutoNoVsync` will gracefully do a designed sets of fallbacks if their primary modes are
57905790 /// unsupported.
57915791 pub present_mode : PresentMode ,
5792- /// Desired maximum number of frames that the presentation engine should queue in advance.
5793- ///
5794- /// This is a hint to the backend implementation and will always be clamped to the supported range.
5795- /// As a consequence, either the maximum frame latency is set directly on the swap chain,
5796- /// or waits on present are scheduled to avoid exceeding the maximum frame latency if supported,
5797- /// or the swap chain size is set to (max-latency + 1).
5798- ///
5799- /// Defaults to 2 when created via `Surface::get_default_config`.
5800- ///
5801- /// Typical values range from 3 to 1, but higher values are possible:
5802- /// * Choose 2 or higher for potentially smoother frame display, as it allows to be at least one frame
5803- /// to be queued up. This typically avoids starving the GPU's work queue.
5804- /// Higher values are useful for achieving a constant flow of frames to the display under varying load.
5805- /// * Choose 1 for low latency from frame recording to frame display.
5806- /// ⚠️ If the backend does not support waiting on present, this will cause the CPU to wait for the GPU
5807- /// to finish all work related to the previous frame when calling `Surface::get_current_texture`,
5808- /// causing CPU-GPU serialization (i.e. when `Surface::get_current_texture` returns, the GPU might be idle).
5809- /// It is currently not possible to query this. See <https://github.com/gfx-rs/wgpu/issues/2869>.
5810- /// * A value of 0 is generally not supported and always clamped to a higher value.
5792+ /// Desired maximum number of frames between a [`Surface::get_current_texture`] call and the
5793+ /// texture being presented to the screen. This is sometimes called "Frames in Flight".
5794+ ///
5795+ /// Defaults to `2` when created via [`Surface::get_default_config`] as this is a reasonable default.
5796+ ///
5797+ /// This is ultimately a hint to the backend implementation and will always be clamped
5798+ /// to the supported range.
5799+ ///
5800+ /// Typical values are `1` to `3`, but higher values are valid, though likely to be clamped.
5801+ /// * Choose `1` to minimize latency above all else. This only gives a single frame for all of
5802+ /// the CPU and GPU work to complete. ⚠️ As a result of these short swapchains, the CPU and GPU
5803+ /// cannot run in parallel, prioritizing latency over throughput. For applications like GUIs doing
5804+ /// a small amount of GPU work each frame that need low latency, this is a reasonable choice.
5805+ /// * Choose `2` for a balance between latency and throughput. The CPU and GPU both can each use
5806+ /// a full frame to do their computations. This is a reasonable default for most applications.
5807+ /// * Choose `3` or higher to maximize throughput, sacrificing latency when the the CPU and GPU
5808+ /// are using less than a full frame each. For applications that use CPU-side pipelining of frames
5809+ /// this may be a reasonable choice. ⚠️ On 60hz displays the latency can be very noticeable.
5810+ ///
5811+ /// This maps to the backend in the following ways:
5812+ /// - Vulkan: Number of frames in the swapchain is `desired_maximum_frame_latency + 1`,
5813+ /// clamped to the supported range.
5814+ /// - DX12: Calls [`IDXGISwapChain2::SetMaximumFrameLatency(desired_maximum_frame_latency)`][SMFL].
5815+ /// - Metal: Sets the `maximumDrawableCount` of the underlying `CAMetalLayer` to
5816+ /// `desired_maximum_frame_latency + 1`, clamped to the supported range.
5817+ /// - OpenGL: Ignored
5818+ ///
5819+ /// [`Surface::get_current_texture`]: ../wgpu/struct.Surface.html#method.get_current_texture
5820+ /// [`Surface::get_default_config`]: ../wgpu/struct.Surface.html#method.get_default_config
5821+ /// [SMFL]: https://learn.microsoft.com/en-us/windows/win32/api/dxgi1_3/nf-dxgi1_3-idxgiswapchain2-setmaximumframelatency
58115822 pub desired_maximum_frame_latency : u32 ,
58125823 /// Specifies how the alpha channel of the textures should be handled during compositing.
58135824 pub alpha_mode : CompositeAlphaMode ,
0 commit comments