Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[metal] Improve layer initialization and resizing #6107

Merged
merged 7 commits into from
Sep 8, 2024

Commits on Aug 25, 2024

  1. [metal]: Create a new layer instead of overwriting the existing one

    Overriding the `layer` on `NSView` makes the view "layer-hosting", see
    [wantsLayer], which disables drawing functionality on the view like
    `drawRect:`/`updateLayer`.
    
    This prevents crates like Winit from providing a robust rendering
    callback that integrates well with the rest of the system.
    
    Instead, if the layer is not CAMetalLayer, we create a new sublayer, and
    render to that instead.
    
    [wantsLayer]: https://developer.apple.com/documentation/appkit/nsview/1483695-wantslayer?language=objc
    madsmtm committed Aug 25, 2024
    Configuration menu
    Copy the full SHA
    e782be1 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    0170dfe View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    1b153ae View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    bd427b7 View commit details
    Browse the repository at this point in the history
  5. [metal] Do not keep the view around that the surface was created from

    We do not need to use it, and the layer itself is already retained, so
    it won't be de-allocated from under our feet.
    madsmtm committed Aug 25, 2024
    Configuration menu
    Copy the full SHA
    9192c90 View commit details
    Browse the repository at this point in the history

Commits on Sep 4, 2024

  1. Configuration menu
    Copy the full SHA
    d6e3e30 View commit details
    Browse the repository at this point in the history
  2. More docs on contentsGravity

    madsmtm committed Sep 4, 2024
    Configuration menu
    Copy the full SHA
    b43f8bd View commit details
    Browse the repository at this point in the history