aclysma / skulpin

Skia + Vulkan = Skulpin

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Example broken on macOS Catalina and Vulkan 1.2.148. Yes I installed SDK.

ctrlcctrlv opened this issue · comments

Greetings,

This might be a duplicate of #58, but I can't reopen closed issues, and anyway I fixed the problem @FrankenApps failed to.

I am writing a font editor I call MFEQ. A big part of it is a program that needs 2D graphics acceleration to work well, Qglif.

Qglif does not build on macOS. (MFEK/glif#2). This made me sad. I figured out actually Reclutch itself, the library that wraps Skia for me, is the problem. (jazzfool/reclutch#26). @jazzfool could not fix this issue and said it's probably due to OpenGL deprecation on Mac; therefore I should update to Vulkan. I agree, probably it can't be helped, and I didn't really know MoltenVK was a thing.

So, trying your library since it seems to be just what I wanted anyway: literally exactly, ImGui and Skia!.

Vulkan behaving badly

$ VK_LOADER_DEBUG=all cargo run --example winit_imgui

https://gist.github.com/ctrlcctrlv/38ee9eeca3b27a6b8cc1f6acbcf3bb67#file-skulpin-crash-txt-L131-L132

ERROR: loaderValidateLayers: Layer 0 does not exist in the list of available layers
Error during renderer construction: CreateInstanceError(InstanceError(VkError(ERROR_LAYER_NOT_PRESENT))) 

My proposed patch

diff --git a/skulpin-renderer/src/instance.rs b/skulpin-renderer/src/instance.rs
index 6729173..418d928 100644
--- a/skulpin-renderer/src/instance.rs
+++ b/skulpin-renderer/src/instance.rs
@@ -112,7 +112,7 @@ impl VkInstance {
             .api_version(api_version);
 
         // Determine what layers to use
-        let validation_layer_name = CString::new("VK_LAYER_LUNARG_standard_validation").unwrap();
+        let validation_layer_name = CString::new("VK_LAYER_KHRONOS_validation").unwrap();
 
         let mut layer_names = vec![];
         if !validation_layer_debug_report_flags.is_empty() {

I do not know why you did not get this error yet @aclysma, but yes, it is real, and luckily not so hard to fix. I guess standard_validation is finally past deprecated and removed entirely.

I see, they removed the old one in 1.2.131.5 (April).
https://www.lunarg.com/new-vulkan-1-2-sdks-support-provisional-ray-tracing-extension/

I'll put something in soon (probably today). I'd like to also add checking that the layer exists and give a better error message.

Fixed with #63, I'll release it as 0.10.0 if there aren't any issues found in the next few days.

I closed #54 but I'll leave this open for a few days in case anyone wants to give any feedback on the change. @ctrlcctrlv I'd particularly appreciate if you could verify that this change fixes the issue for you. (i.e. turn validation back on in one of the examples and try running it without your patch)

@aclysma It does fix the issue for me and I hope you make a release soon so I can stop relying on Git. :-)

I sent you a private message on LinkedIn, as well.

Published 0.10.0