Skip to content

armgit / Cap

Public Imported from GitHub
0

Open source Loom alternative. Beautiful, shareable screen recordings.

fix(gpui): keep stream textures alive while comparing them and allow long git paths for Windows patch tests

Richie McIlroyfc37d62230ba
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index f8ff8eb55..992773101 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -409,6 +409,10 @@ jobs:
if: ${{ runner.os == 'Linux' }}
run: sudo apt-get install -y --no-install-recommends mesa-vulkan-drivers libvulkan1 libegl1 libegl-mesa0 libgl1-mesa-dri
+ - name: Allow long paths in Zed's git dependencies
+ if: ${{ runner.os == 'Windows' }}
+ run: git config --global core.longpaths true
+
- name: Rust setup
uses: dtolnay/[email protected]
diff --git a/apps/desktop-gpui/patches/zed-streaming-image.patch b/apps/desktop-gpui/patches/zed-streaming-image.patch
index 6d67d8333..85d0fa11b 100644
--- a/apps/desktop-gpui/patches/zed-streaming-image.patch
+++ b/apps/desktop-gpui/patches/zed-streaming-image.patch
@@ -819,7 +819,7 @@ index e41b097..dac72f9 100644
+ }
}
diff --git a/crates/gpui_macos/src/metal_atlas.rs b/crates/gpui_macos/src/metal_atlas.rs
-index d007abb..f418f88 100644
+index d007abb..007b965 100644
--- a/crates/gpui_macos/src/metal_atlas.rs
+++ b/crates/gpui_macos/src/metal_atlas.rs
@@ -4,11 +4,21 @@ use derive_more::{Deref, DerefMut};
@@ -1140,7 +1140,7 @@ index d007abb..f418f88 100644
use std::borrow::Cow;
fn create_atlas() -> Option<MetalAtlas> {
-@@ -396,4 +619,355 @@ mod tests {
+@@ -396,4 +619,365 @@ mod tests {
let key = make_image_key(999, 0);
atlas.remove(&key);
}
@@ -1170,8 +1170,7 @@ index d007abb..f418f88 100644
+ .expect("stream upload returns a tile")
+ }
+
-+ fn stream_slot_textures(atlas: &MetalAtlas, image: &StreamingImage) -> Vec<usize> {
-+ use metal::foreign_types::ForeignType as _;
++ fn stream_slot_textures(atlas: &MetalAtlas, image: &StreamingImage) -> Vec<metal::Texture> {
+ let lock = atlas.0.lock();
+ let stream = lock
+ .streams
@@ -1181,10 +1180,15 @@ index d007abb..f418f88 100644
+ stream
+ .slots
+ .iter()
-+ .map(|slot| slot.texture.as_ptr() as usize)
++ .map(|slot| slot.texture.0.clone())
+ .collect()
+ }
+
++ fn texture_ptrs(textures: &[metal::Texture]) -> Vec<*mut metal::MTLTexture> {
++ use metal::foreign_types::ForeignType as _;
++ textures.iter().map(|texture| texture.as_ptr()).collect()
++ }
++
+ fn stream_textures_created(atlas: &MetalAtlas) -> u64 {
+ atlas.0.lock().stream_textures_created
+ }
@@ -1251,7 +1255,10 @@ index d007abb..f418f88 100644
+
+ assert_eq!(first.texture_id.kind, AtlasTextureKind::Stream);
+ assert_eq!(first.bounds.size, size);
-+ assert_eq!(stream_slot_textures(&atlas, &image), textures);
++ assert_eq!(
++ texture_ptrs(&stream_slot_textures(&atlas, &image)),
++ texture_ptrs(&textures)
++ );
+ assert_eq!(textures.len(), 1);
+ assert_eq!(stream_textures_created(&atlas), 1);
+ let (texture, _lease) = atlas.lease_stream_texture(first.texture_id).unwrap();
@@ -1308,8 +1315,11 @@ index d007abb..f418f88 100644
+
+ assert_eq!(large.texture_id, small.texture_id);
+ assert_eq!(large.bounds.size, large_size);
-+ assert_ne!(large_textures, small_textures);
-+ assert_eq!(stream_slot_textures(&atlas, &image), large_textures);
++ assert_ne!(texture_ptrs(&large_textures), texture_ptrs(&small_textures));
++ assert_eq!(
++ texture_ptrs(&stream_slot_textures(&atlas, &image)),
++ texture_ptrs(&large_textures)
++ );
+ assert_eq!(stream_textures_created(&atlas), 2);
+ }
+