Skip to content

Commit 3c8ac6e

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 672d180 commit 3c8ac6e

File tree

3 files changed

+293
-101
lines changed

3 files changed

+293
-101
lines changed

Cargo.toml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,9 @@ objc2-core-graphics = { version = "0.3.2", default-features = false, features =
105105
objc2-core-foundation = { version = "0.3.2", default-features = false, features = [
106106
"std",
107107
"CFCGTypes",
108+
"CFNumber",
109+
"CFString",
110+
"CFDictionary",
108111
] }
109112
objc2-foundation = { version = "0.3.2", default-features = false, features = [
110113
"std",
@@ -122,6 +125,14 @@ objc2-quartz-core = { version = "0.3.2", default-features = false, features = [
122125
"CALayer",
123126
"CATransaction",
124127
] }
128+
objc2-io-surface = { version = "0.3.2", default-features = false, features = [
129+
"std",
130+
"libc",
131+
"objc2",
132+
"objc2-core-foundation",
133+
"IOSurfaceRef",
134+
"IOSurfaceTypes",
135+
] }
125136

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

0 commit comments

Comments
 (0)