Playing around with vulkan

Hello,

I am trying to play around a bit with Panda3D’s Vulkan implementation. I successfully built Panda3D from the vulkan branch. However, I can’t seem to determine how to use the vulkan engine. Something like loadPrcFileData('', 'load-display vulkandisplay') or loadPrcFileData('', 'load-display vulkan') fails with Unable to load: Path not found. The only vulkan-related dll that resulted from the build is libp3vulkandisplay.dll. I am probably missing something trivial. Can someone please enlighten me?

Thanks.

The correct string is load-display p3vulkandisplay.
You may also want to put notify-level-vulkandisplay debug in there so you can get some more debugging information printed out.

At the moment it’s not very powerful; it relies on a hardcoded pair of SPIR-V shaders that just do very basic rendering at the moment, and it isn’t very good at passing inputs to those shaders yet. We’re planning to work on a new SPIR-V-based shader compilation pipeline very soon.

When I start the asteroids sample with those strings, I get the following error in vulkanGraphicsPipe.cxx:

Unhandled exception at 0x00007FF9157492D8 (libp3vulkandisplay.dll) in python.exe: 0xC00000FD: Stack overflow (parameters: 0x0000000000000001, 0x0000004296913000). occurred

I am 90% sure that this is because my virtualized hardware doesn’t have vulkan support. I’m assuming there isn’t code to handle this gracefully yet.

Could you print out the value of num_inst_extensions before that line, using something like:

  std::cerr << "num_inst_extensions: " << num_inst_extensions << std::endl;

Although, maybe MSVC means the error happened before that line, which would indeed suggest it happened inside the call to vkEnumerateInstanceExtensionProperties (inside the Vulkan loader).

Known pipe types:
  VulkanGraphicsPipe
(all display modules loaded.)
num_inst_extensions: 1298609200

Resulting output.

Code:

Try initialising num_inst_extensions to 0, and if necessary, commenting out the enumerate call. It seems you have a broken Vulkan runtime, but we could see how far we can get.

Initializing num_inst_extensions to 0 fixed it. Now I get the more or less expected error:

C:\Panda3D-1.11.0-x64-vulkan\samples\asteroids>C:\Panda3D-1.11.0-x64-vulkan\python\python main.py
Known pipe types:
  VulkanGraphicsPipe
(all display modules loaded.)
num_inst_extensions: 0
:display:vulkandisplay(error): Failure to create Vulkan instance: Initialization failed.
:ShowBase(warning): Unable to open 'onscreen' window.
Traceback (most recent call last):
...

BTW, I installed the vulkan runtime directly from the official site.

I think this just means you don’t have a Vulkan-capable driver installed or set-up correctly. Can you run other Vulkan programs, like vkcube or vulkaninfo? If not, this is not something we can fix in Panda.

I’ve checked in a fix for the zero-initialization.