-
Notifications
You must be signed in to change notification settings - Fork 39
Description
TL;DR: I propose that the UIKit-cross-platform project adopt Google's Skia library for its graphics rendering needs instead of using SDL. Skia's support for modern APIs like Vulkan, alongside its proven performance in UI-centric environments (like Jetpack Compose), makes it the most future-proof and strategic choice for this project.
Key Reasons to Use Skia Over SDL-GPU:
-
OpenGL ES is Becoming Obsolete on Android:
OpenGL ES, which SDL_gpu primarily relies on, is gradually being phased out on Android in favor of Vulkan. Google's focus is now on Vulkan as the preferred graphics API due to its superior performance, reduced overhead, and better support for multi-threading. Skia's native support for Vulkan allowsUIKit-cross-platformto leverage modern graphics capabilities on Android without being tied to outdated technologies, ensuring long-term compatibility and performance. -
Proven Industry Standard for UI Rendering (Used by Jetpack Compose):
Skia is already the graphics engine behind Jetpack Compose, Android's modern UI toolkit. This shows its effectiveness and reliability in rendering high-performance, smooth UIs at scale. By using the same technology as Jetpack Compose,UIKit-cross-platformcan achieve a similar level of graphical fidelity and efficiency, providing a seamless user experience on Android. -
High-Level Abstraction and Rich Feature Set:
Skia's higher-level API simplifies UI development by offering built-in support for crucial features like sub-pixel anti-aliasing, vector graphics, hardware-accelerated compositing, and image filtering. This approach reduces development complexity compared to SDL's OpenGL-based rendering, which requires more low-level code to achieve the same results. With Skia, the focus can remain on building high-quality UI components rather than managing graphics pipelines. -
Cross-Platform Flexibility and Modern API Support:
Skia supports multiple backends, including Vulkan, Metal, OpenGL, and Direct3D, making it highly versatile across different platforms. As graphics technology continues to evolve, this flexibility ensures thatUIKit-cross-platformcan adapt easily to new trends without requiring major architectural changes. In contrast, SDL_gpu's focus on OpenGL limits its ability to integrate seamlessly with these newer APIs, making it less future-proof. -
Performance Optimization Tailored for UI Workloads:
Skia is specifically optimized for rendering interactive user interfaces and handling complex text and graphics operations. Its pipeline is designed to make the most of hardware acceleration, which is essential for smooth animations and responsive touch interactions. While SDL_gpu can be efficient for general-purpose 2D graphics, achieving the same level of optimization for UI-heavy scenarios would require considerable custom development. -
Wide Adoption and Active Development Community:
Skia is backed by Google and used in major products like Chrome, Android, and Flutter, ensuring it is well-supported and continuously optimized for modern use cases. The library benefits from a large developer community and frequent updates, keeping it aligned with the latest advancements in graphics technology. This strong ecosystem support provides a level of reliability that SDL cannot match.
Personally:
First of all, I love this project! I was just looking into building my own UIKit-like cross platform framework and then I discovered this project, although I was a bit dismayed to see that it uses an obsolete technology for the vector graphics rendering side of things. I’ve used Skia before and it’s amazing! Very simple and easy to use, and it supports a multitude of platforms among other things (see above points).
More broadly I was thinking, with regard to UIKit's dependencies, the dependency tree is roughly:
UIKit
├─ TextKit
│ ├─ CoreText
│ └─ CoreGraphics
├─ CoreGraphics
│ ├─ CoreFoundation
│ ├─ QuartzCore
│ ├─ ImageIO
│ └─ IOSurface
├─ Foundation
├─ QuartzCore
├─ CoreImage
├─ CoreData
├─ AVFoundation
├─ CoreAnimation
├─ Metal
├─ SceneKit
├─ SpriteKit
├─ CoreMotion
└─ CoreLocation
CoreFoundation
(Although I'm mostly concerned with CoreGraphics, CoreText, and TextKit.)
Organizationally, shouldn’t you start with the lower-level frameworks and then work your way up to UIKit?
This is the direction I was going down before I noticed this project. As an amateur compiler engineer, I’ve been working on a parser and AST for the Objective-C and Swift Interface Files located under /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks (thought this would be a good place to start and see what I can learn).
My ultimate plan was to use what public info I have on my Mac to bootstrap the project. Then I’d try building specialized tools to autogenerate as much of the API implementation as possible using AI text generation models (although as someone who's done similar work before I'm concerned about the cost)... After I’ve gone as far as I could with autogenerated code, my plan was to then open up the work for contributions from the community.
If there’s any interest on your end, I’d be interested in collaborating with ya’ll on this!