Conversation
|
I'll fix CI failures and address comments from users with write access that start with 'Devin'.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds an opt-in Skia Graphite backend to
SkiaWindowRendereron macOS/iOS (Metal). Ganesh stays the default everywhere, and Linux/Windows are unchanged (Ganesh via OpenGL).Cargo features
ganesh(default) andgraphitefeatures.glis now only enabled on non-Apple targets. The Metal backend never used it, and dropping it lets Apple builds match the publishedganesh-…-metal-pdf/graphite-…-metal-pdfprebuilt binaries.graphite = ["dep:skia-safe"]activates an optional, Apple-onlyskia-safeentry that has thegraphitefeature. So on Linux/Windows (including CI's--all-features)graphitedoesn't touch the Skia build.ganesh/vulkanuse the weakskia-safe?/…syntax. Without it,skia-safe/ganeshwould also activate that optional Graphite entry.Resolved skia-bindings features, from
cargo tree -e features:--no-default-features --features graphite--all-featuresCode
metal.rs→metal/{ganesh,graphite}.rs. TheCAMetalLayersetup is shared inmetal::create_metal_layer.MetalGraphiteBackendon each frame:prepare: wraps the drawable's texture viagraphite::mtl::backend_textures::make_metalandgraphite::surfaces::wrap_backend_texture.flush:recorder.snap()→context.insert_recording→context.submit, then presents on the sameMTLCommandQueue.ImageProviderdrops raster images: they aren't drawn, and Skia logsCouldn't convert SkImage to a Graphite-backed representation. skia-safe doesn't expose custom image providers, so:SkiaScenePaintergets an optional&mut graphite::Recorder. The window renderer gets it from the newSkiaBackend::recorder().graphite::images::texture_from_imagebefore the image shader is built. The result goes into the existingimage_shadercache.shader_from_image_brushis split intoimage_from_image_data+shader_from_imagefor this.SkiaScenePainter::new_graphite(canvas, cache, recorder)for painting into your own Graphite surfaces, e.g. offscreen. It's used by the Blitz benchmark in [Testing] anyrender_skia Graphite backend (anyrender#103) + skia_paint_bench blitz#983.Known gaps
texture_from_imagedoesn't takeRequiredProperties. WithImageQuality::Medium/High, Skia falls back to linear, non-mipmapped sampling for these images.VkImageas a GraphiteBackendTexture.Performance
Testing (macOS arm64)
bunnymarkrelease builds with each engine; both render correctly. Blitzrdmealso renders correctly on Graphite (see blitz#983). Graphite logged no warnings.cargo clippy -D warningsfor the workspace (default features) and foranyrender_skiawith--no-default-features --features graphite(with and withoutpixels_window_renderer).cargo docwith Graphite.Graphite (1000 bunnies):

Ganesh (default, 500 bunnies), for comparison:

Link to Devin session: https://dioxus.staging.devinenterprise.com/sessions/7b8d8492640e46d08ea6cd8b5ab63dbb
Open in Devin Desktop: https://dioxus.staging.devinenterprise.com/desktop/session/7b8d8492640e46d08ea6cd8b5ab63dbb?variant=devin-insiders
Requested by: @nicoburns