-
Notifications
You must be signed in to change notification settings - Fork 543
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
Persistent Metal swapchain #2169
Conversation
8de0506
to
5482b73
Compare
I've been looking at the resize issue with this approach, and haven't got a working solution yet. It appears that
... except that it decides to not clean up those images we use persistently. I did confirm that the refcount on them (meaning |
a132708
to
0d8c23f
Compare
src/backend/metal/src/window.rs
Outdated
(drawable, msg_send![drawable, texture]) | ||
}; | ||
|
||
//debug!("looking for {:?}", texture_temp); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: comment
} | ||
} | ||
// wait for new frames to come until we meet the chosen one | ||
while self.surface.next_frame(&self.frames).0 != self.index as usize { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a low-cost alternative to spinning here? I don't know how long these waits commonly last, but it seems like there's potential to run faster than presents occur sometimes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we could do a better job at locking here, even though locking a mutex would only hurt on contention (and these frame locks are unlikely to content).
there's potential to run faster than presents occur sometimes
The method is only called at submission time, this is as late as we could possibly be for obtaining CAMetalDrawable
. I don't think we can do better atm.
src/backend/metal/src/window.rs
Outdated
//TODO: only set it where supported | ||
msg_send![render_layer, setDisplaySyncEnabled: display_sync]; | ||
//msg_send![render_layer, setPresentsWithTransaction: true]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: comment
src/backend/metal/src/window.rs
Outdated
// when resizing, this trick frees up the currently shown frame | ||
drawable.present(); | ||
} | ||
//info!("\tframe[{}] = {:?}", index, texture); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: comment
Thanks for the review! Comments are addressed now, let's ship this hack :) |
2169: Persistent Metal swapchain r=grovesNL a=kvark Includes #2164 Fixes #2168 Fixes #2143 Removes deferred image resolution (yay!), and also renames some of the outdated concepts. We have no flickering, and proper frame sync now. PR checklist: - [x] `make` succeeds (on *nix) - [x] `make reftests` succeeds - [x] tested examples with the following backends: Co-authored-by: Dzmitry Malyshau <[email protected]>
Includes #2164Fixes #2168
Fixes #2143
Removes deferred image resolution (yay!), and also renames some of the outdated concepts.
We have no flickering, and proper frame sync now.
PR checklist:
make
succeeds (on *nix)make reftests
succeeds