Skip to content

feat(renderer): Vulkan render target and test path - #29

Merged
nongio merged 1 commit into
mainfrom
feat/vulkan-test-path
Sep 25, 2026
Merged

nongio merged 1 commit into
mainfrom
feat/vulkan-test-path

Conversation

@nongio

@nongio nongio commented Sep 25, 2026

Copy link
Copy Markdown
Owner

Adds renderer::skia_vk, behind a new vulkan feature. It wraps a VkImage the host owns as a Skia render target with a top-left origin, and draws a scene into it, much as skia_fbo does for a GL framebuffer. lay-rs still loads no Vulkan itself: the host creates the instance, the device, the DirectContext and the image, and passes raw handles as Skia's own Vulkan types.

skia_fbo and the C renderer API now sit behind a gl feature. It is in the default set, so crates that keep default features see no change. gl-rs was only used by tests, so it moves to dev-dependencies. The unused GL direct_contexts import in drawing/scene.rs is gone. The engine is untouched.

tests/vulkan_image_cache.rs is a headless test of the GPU image-cache path on Vulkan. It uses ash, which is a dev-dependency only, to pick a device with a graphics queue and create a device-local RGBA8 image, then renders a scene with an image-cached layer through skia_vk. It checks that the cache surface was allocated on the Vulkan context and reused on the next frame, and that both the frame and a GPU subtree buffer match the raster render. Where no Vulkan device is available the test prints a note and returns.

Run it with:

cargo test --features vulkan --test vulkan_image_cache

Add renderer::skia_vk behind a `vulkan` feature: it wraps a host-owned
VkImage as a top-left Skia render target and draws a scene into it,
the counterpart of skia_fbo. skia_fbo and the C renderer API move
behind a `gl` feature, on by default; gl-rs becomes a dev-dependency
and the unused GL import in drawing/scene.rs goes.

tests/vulkan_image_cache.rs renders an image-cached layer into a
VkImage created with ash (dev-dependency only) and checks it against
the raster path. It skips where no Vulkan device is available.
@nongio
nongio merged commit c7d8ec7 into main Sep 25, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant