aclysma / skulpin

Skia + Vulkan = Skulpin

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Idea: Three layers

ctrlcctrlv opened this issue · comments

Since ImGui is quite incomplete on Vulkan, what do you think of the possibility of adding another Skia layer?

So, basically sandwiching ImGui between two Skia layers. Brilliant or horrible hack?

I think your better off doing one of the following:

  • If you're familiar with vulkan, fork imgui and patch in support yourself. (It will be a fairly difficult, involved thing to do if you aren't comfortable writing vulkan code directly.) The patch that was linked in the other issue looked along the right track though.
  • Use a different UI system like iced. You may still need to write vulkan rendering code to integrate with the renderer in skulpin.
  • Write your own immediate-mode UI using skia. Some shipped products like chome, flutter, and sublime merge use skia. Possibly you could adapt an existing rust UI crate to draw to skia as a backend.

As your project grows, you'll likely need to take on more of the responsibilities for managing skia, vulkan, windowing, and whatever UI you want to build within it yourself. The goal of this project is to lower that initial barrier to entry. Projects that grow beyond prototyping will (by design) outgrow it and should start relying on the underlying technologies directly. (For example, neovide still uses the renderer but no longer uses the "app" construct provided in this library because they needed more control over the event loop.)

So wait, you're saying you want me to vendorize skulpin...?

More specifically for the above approaches:

  • Extend the existing imgui plugin (and likely rely on a fork of imgui you maintain that has a patch to support textures)
  • Write your own new plugin that supports a different UI system
  • Build your own UI system on top of skia

My comments about neovide were that they use the skulpin-renderer crate but not the "app" functionality in skulpin-app-winit. There is really not all that much code here, it's skia that's doing the heavy lifting, so if you start doing serious edits to the renderer (i.e. adding more layers to the renderer) it may very well make sense for you to vendor it.

I don't really understand why you dislike the idea of an arbitrary number of layers, or three? Is this "I won't do it" or "I won't accept a patch that does it"?

If you really want me to vendorize, fine, but I like ImGui, and the cases I can think of where I'd want to draw arbitrary bitmap data, that can be fixed with multiple layers.

Sorry to bother you, but would things be any easier for me if I used SDL2?

Could I use SDL2 to draw an image or multiple Skia layers easier?

Hello

Just for Googlers, the best thing to do is use save and restore on the SkCanvas. Consider that internally in your application as layers, but don't really create multiple SkSurface's / SkCanvas's.

I didn't really understand what those functions did, but I get it now. So, at the beginning of each layer in your application, call save() and at the end restore(). That way you can play with the transformation matrices (important for Qglif) but also zoom out and draw a console or overlay on top.

So I understand now why this was closed