Skip to content

Commit e02da58

Browse files
committed
Use IOSurface
Write directly into a shared memory buffer that can be shared directly with the compositor and avoids copying bytes when presenting (QuartzCore was copying stuff before). This also implements double and triple buffering of the surface, to avoid creating a bunch of unnecessary buffers. The compositor seems to sometimes work on two buffers at the same time? A bit unsure why. The way we wait for the compositor to stop using the buffer(s) is kinda bad, but that can be resolved later, and shouldn't be a problem for applications that do proper frame-pacing (which Winit doesn't yet provide though).
1 parent 061aca8 commit e02da58

File tree

3 files changed

+282
-86
lines changed

3 files changed

+282
-86
lines changed

Cargo.toml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,9 @@ objc2-core-graphics = { version = "0.3.2", default-features = false, features =
104104
objc2-core-foundation = { version = "0.3.2", default-features = false, features = [
105105
"std",
106106
"CFCGTypes",
107+
"CFNumber",
108+
"CFString",
109+
"CFDictionary",
107110
] }
108111
objc2-foundation = { version = "0.3.2", default-features = false, features = [
109112
"std",
@@ -121,6 +124,14 @@ objc2-quartz-core = { version = "0.3.2", default-features = false, features = [
121124
"CALayer",
122125
"CATransaction",
123126
] }
127+
objc2-io-surface = { version = "0.3.2", default-features = false, features = [
128+
"std",
129+
"libc",
130+
"objc2",
131+
"objc2-core-foundation",
132+
"IOSurfaceRef",
133+
"IOSurfaceTypes",
134+
] }
124135

125136
# Web dependencies.
126137
[target.'cfg(target_family = "wasm")'.dependencies]

0 commit comments

Comments
 (0)