Vulkan black screen

I’m currently trying to switch my project over to use Vulkan (for Rive). At first, I had a couple shader issues (that I was able to solve) that made the game crash on launch. Now that those are fixed, the game screen is all black when I launch. There don’t appear to be any errors in the console.

If I switch back to OpenGL, everything renders correctly.

I’m not sure how to debug this at all.

  • I’m on macOS
  • Sonoma 14.6.1, Radeon Pro 575X 4 GB.

I’ve seen suggestions to debug Vulkan rendering issues with Xcode, but I don’t know how to set up the Xcode project. When I try it, it fails to launch with the error FATAL:ENGINE: Unable to load project file: 'YES' (-1)

I finally managed to get it running through Xcode, but I don’t know what I’m doing. How do I start going about debugging Vulkan / MoltenVK issues with Xcode?

Here’s the relevant output in Defold. The only thing that really stands out is VK_EXT_metal_objects was not supported but I don’t know what that means.
mvk-output.txt (7.8 KB)

And here’s what I see in Xcode. Like I said, I don’t know where to even begin:

I really have no idea what I’m doing here. I have no idea what to look for or how to look for it.

Also for me, moving from openGL to Vulkan, resulted in some issue. And I was not able to debug my game with Xcode. The VK_EXT_metal_objects warning is not a problem. I had (and still have it) and my game now works in Vulkan.

My problem with Vulkan was due to an incorrect way of clearing the depth buffer in my custom render script. Are you using a custom render script?

Does the Rive example project work with your Mac? It uses Vulkan.

I am trying to help but I am not an expert with Vulkan…

1 Like

I am using a pretty heavily customized version of the orthographic render_script. I’m sure I’m doing several things “wrong” but it does work as intended with OpenGL. I just wish I knew what was different between OpenGL & Vulkan so I’d know where to start looking… but I’ll look at clearing the depth buffer & see if I notice any issues there.

The Rive example project does work. so it’s definitely something to do with my render script or shaders or something.

1 Like

I’ve made some progress in cleaning up some minor issues with my render script (some deprecated methods, render => graphics constants, etc.) but nothing has actually fixed the issue.

custom.render_script.lua (8.6 KB)

I have some logic in here that forces the game to use a specific resolution (640x400) and locks everything to that, including the GUI (the lowrez render uses the native for the GUI, which isn’t what I want). Then I render that to a texture & blow it up if necessary, e.g. for a retina display or if the game is fullscreened.

this works as intended with OpenGL on macOS (I haven’t tested on Windows in a while, but it at least used to work there).

I’m pretty sure it’s this logic that’s failing in Vulkan, but I still don’t have a reference for what’s different between the 2, so this is pretty much still a shot-in-the-dark.

Does it work if you skip the render target and just render everything to native resolutions? Render targets are fine in vulkan, but perhaps you are hitting some edge case when calculating sizes or something

Yes (sorta). I also had to comment out the scaling logic, but if I render the first pass normally (i.e. not to the render target) and skip the upscaling step, it will actually display. There’s some issues, like some screens being rendered entirely upside-down, but that’s probably due to the clumsy way I did the test.

Ok thanks, that’s a good lead :+1: