wgpu4k has reached the beta stage and is now avail...
# feed
a
wgpu4k has reached the beta stage and is now available on Maven Central. Running WebGPU on all platforms has never been easier. https://github.com/wgpu4k/wgpu4k/releases/tag/0.0.3 As always, the starter project has been updated: https://github.com/wgpu4k/hello-cube Check out the migration guide if you used the previous version: https://github.com/wgpu4k/wgpu4k/blob/main/PREVIEW-TO-BETA-MIGRATION.md
kodee happy 1
🔥 1
m
Can such a rendering be integrated into a Compose Multiplatform application?
1
s
If you meant replacing Skiko (Skia), I’m not a Compose developer, but Compose is designed so that its UI renderer can be swapped or new rendering targets can be added on demand, similar to how JetBrains implemented Desktop and iOS targets after Android, both of which rely on the Skiko library. However, I’m not sure if this can be done using public APIs alone. It may not be accessible out of the box and could require forking.
On the other hand, WebGPU is a graphics API that only provides high-level access to GPU hardware but lacks built-in functionality for rendering text, shapes, or paths. Unlike full-fledged graphics libraries(Skia, etc), WebGPU only offers low-level building blocks for executing GPU commands.
But is it worth implementing your own graphical library? That remains an open question. From what I know, Skia already has experimental WebGPU support through its new Graphite backend. Skia is designed to work with modern GPU APIs, including Vulkan, Metal, and WebGPU
m
No, that was not the intention of my question. I should have been more precise. What I meant is whether it is possible to integrate such a rendering frame into compose for high-performance 3D graphics. I do not want to replace Skia.
s
Oh, I see. A quick look at the repository shows that the library doesn’t provide a common Compose renderable surface for WebGPU. To use it in Compose projects, need to manually embed WebGPU using platform-specific tools. As the examples showing it. However, since the library is already KMP, adding a Compose widget for platform-specific initialization shouldn’t be too difficult.
a
Currently, there is no built-in Compose component to do that. The current implementation by JetBrains does not support Vulkan, so we have to use OpenGL as the backend for WebGPU. However, some features are missing or not fully implemented with OpenGL. If you want to draw on the whole surface, you could use this sample: https://github.com/JetBrains/compose-multiplatform/tree/master/experimental/lwjgl-integration and configure WebGPU to use OpenGL. Another way would be to render to a texture and put that on a bitmap to display it on a Compose component that supports bitmaps. This is easy to do but adds overhead.
👍 1
f
@alexandre mommers Is it really possible to target opengl with webgpu? I thought it's only implemented on top of the modern graphics apis