T14: disable T10.5 surface() path; GPUI 0.2.2 Surface asserts NV12 YUV

This commit is contained in:
2026-05-11 00:53:18 -04:00
parent b70fa71a9f
commit 5269853ec8
+19 -24
View File
@@ -3,8 +3,6 @@ use gpui::{
AnyElement, App, Entity, ImageSource, InteractiveElement, IntoElement, MouseButton, ObjectFit, AnyElement, App, Entity, ImageSource, InteractiveElement, IntoElement, MouseButton, ObjectFit,
ParentElement, Styled, StyledImage, Window, canvas, div, img, px, rgb, ParentElement, Styled, StyledImage, Window, canvas, div, img, px, rgb,
}; };
#[cfg(target_os = "macos")]
use gpui::surface;
use super::{ElyShell, web_surface_frame::WebSurfaceFrame}; use super::{ElyShell, web_surface_frame::WebSurfaceFrame};
use ely_design_system::colors; use ely_design_system::colors;
@@ -14,24 +12,22 @@ pub(super) fn render_ready_web_surface(
tab: &BrowserTab, tab: &BrowserTab,
state_entity: Entity<ElyShell>, state_entity: Entity<ElyShell>,
) -> AnyElement { ) -> AnyElement {
// Prefer the hardware path when the sidecar published an // T14: the `gpui::surface(...)` hardware path is disabled.
// IOSurface and we successfully imported it into a CVPixelBuffer. //
// GPUI's `surface(...)` hands the buffer to its Blade Metal // GPUI 0.2.2's Blade Metal renderer hard-asserts that any
// renderer, which samples the IOSurface directly — no // CVPixelBuffer handed to `surface(...)` is NV12 YUV
// RGBA→texture upload, no LAST_FRAME_IMAGE dedup needed. The // (kCVPixelFormatType_420YpCbCr8BiPlanarFullRange). See
// sidecar drops the RGBA payload from the wire whenever it // ~/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/
// populates `pixel_buffer`, so `image` is `None` on this branch // gpui-0.2.2/src/platform/blade/blade_renderer.rs:832
// and there's no software memcpy to fall back on. // for the assert. Our sidecar produces BGRA IOSurfaces, so
#[cfg(target_os = "macos")] // calling `surface()` with that buffer panics the renderer on
if let Some(pixel_buffer) = frame.pixel_buffer.as_ref() { // the first frame.
return render_web_surface( //
tab, // We keep `services::iosurface_metal` and
state_entity, // `WebSurfaceFrame::pixel_buffer` intact so the wire-side
surface(pixel_buffer.clone()).size_full().object_fit(ObjectFit::Fill), // IOSurfaceHandle import path stays exercised; once GPUI gains a
); // BGRA-capable Surface element this branch can come back. Until
} // then every frame must go through `img()` below.
// Software path: the sidecar streamed the RGBA payload and the
// receiver decoded it into an Arc<RenderImage>.
if let Some(image) = frame.image.as_ref() { if let Some(image) = frame.image.as_ref() {
return render_web_surface( return render_web_surface(
tab, tab,
@@ -39,10 +35,9 @@ pub(super) fn render_ready_web_surface(
img(ImageSource::Render(image.clone())).size_full().object_fit(ObjectFit::Fill), img(ImageSource::Render(image.clone())).size_full().object_fit(ObjectFit::Fill),
); );
} }
// Both image variants empty: shouldn't happen because the sidecar // Both image variants empty: the sidecar should always publish
// only drops RGBA when it has a hardware surface to publish, but // RGBA while the hardware path is disabled, but a blank canvas is
// a blank canvas is the honest user-facing fallback if it ever // the honest user-facing fallback if it ever does not.
// does.
render_web_surface(tab, state_entity, div().size_full()) render_web_surface(tab, state_entity, div().size_full())
} }