Hello,
I am new to Skia and had a few questions. I have built the Hello World example and set it to use the Vulkan backend. I would like to potentially work Skia into an existing 3D Vulkan renderer, where Skia would be the UI. To do so, I believe the following would have to be done (using the Hello World as an example):
- Initialize the base Vulkan objects: Instance, Physical Device, Device, Graphics Queue, and Graphics Queue Index on my end. Pass those values in the GrVkBackendContext struct. Update/edit VulkanWindowContext::initializeContext() to take the struct where eventually GrDirectContext::MakeVulkan() gets called. This seems to roughly follow the guidelines here: https://skia.org/docs/user/special/vulkan. The VulkanWindowContext class initializes the swapchain/surface/layout etc. This is the class located in tools/sk_app/VulkanWindowContext.h.
- On my end (not with Skia): Create pipelines, depth buffer, etc. for 3D rendering. Draw to the shared VkImages (VkImageViews on my end using the VkImage objects created from VulkanWindowContext)
- Use fences/semaphores to ensure that my drawing finishes before Skia draws
- Skia draws on top. Depth testing is disabled.
- Use fences/semaphores to ensure Skia finishes drawing
Unfortunately, I have not found too much on working Skia into an existing 3D Vulkan renderer, and I wonder if this approach is the best way to go about it. This leads me to a few questions:
- Is Skia expecting all features on the Physical Device to be activated? I am concerned that passing the logical device with minimal features enabled may lead to crashes due to Skia expecting an enabled feature.
- Is this a normal use case for Skia?
- Are there any major pitfalls with this approach?
Thank you,
Paul