flutter_texture_rgba_renderer/macos/test
yunchan 9a377b6155 macos: add headless texture tests (Kitedesk T-4204)
Standalone Objective-C tests for the macOS texture, built against
FlutterMacOS.framework of the active Flutter SDK by macos/test/run_tests.sh
(optionally with ASan or TSan). The plugin sources are compiled into the
test; the plugin registers through a fake plugin registrar and is driven
through handleMethodCall:result:. The fake engine follows
FlutterTextureRegistrar.mm and FlutterExternalTexture.mm of engine a18df97c:
the texture id is the texture's address, the registrar keeps registered
textures, and copyPixelBuffer is wrapped into a Metal texture whose
CVMetalTexture and pixel buffer are released at once while the Metal texture
stays drawn. Frames come through FlutterRgbaRendererPluginOnRgba on a thread
without an autorelease pool. Memory is the task's phys_footprint, which counts
IOSurfaces, read after the engine's CVMetalTextureCache has let go of what it
wrapped (it keeps that until it makes a texture a second later, measured);
it is not checked under ASan, whose shadow of each new IOSurface mapping
counts in it. No app, window or screen capture.

On 50efc18e ten of the thirteen tests fail (Mac mini M4, macOS 26.5.2):
every frame gets a new IOSurface (60 for 60 frames), the raster thread waits
for the copy (median 0.9 to 1.1 ms in three runs, up to 537 of 600 calls over
1 ms, with 4K frames), frames are announced off the main thread, closed
textures keep their last frame (634 MB more after 20 4K textures) and still
take and announce late frames, a texture closed with recycle is never freed,
and rows of another stride than the pixel buffer's are copied in one piece
(shifted rows for 1366, 1001, 1279 and 3838 pixels wide with stride_align 1,
and 1001 with 256), short frames included. The two tests on frames the engine
was handed pass, as no buffer is ever written twice yet.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 09:56:22 +09:00
..
run_tests.sh macos: add headless texture tests (Kitedesk T-4204) 2026-11-15 09:56:22 +09:00
texture_rgba_renderer_plugin_test.m macos: add headless texture tests (Kitedesk T-4204) 2026-11-15 09:56:22 +09:00