ash icon indicating copy to clipboard operation
ash copied to clipboard

Safe wrapper for the video extension

Open pingpongcat opened this issue 2 years ago • 10 comments

Hello everyone, as a member of vulkan video working group under Khronos I would like contribute to this project by providing safe wrapper for the video extension. Spec for the encode is still in flux but I volunteer to ensure compatibility in future releases.

For I while Im have ash fork with added extensions: https://github.com/neurotok/ash.git And a basic encode example: https://github.com/neurotok/ash-video.git

But the problem which I cannot overcome is a panic when calling even basic functions from the encode: https://docs.rs/ash/latest/ash/vk/struct.KhrVideoQueueFn.html# (using my ash-video example)

I had some success when I wrote this wrapper as an instance extension, but I'm running out of ideas on how the wrapper should be designed as device one.

@MarijnS95 , @MaikKlein ? Could you please take a look at my ash fork and provided example ?

pingpongcat avatar Mar 24 '23 20:03 pingpongcat

What is the panic message?

Ralith avatar Mar 24 '23 20:03 Ralith

Hi @Ralith Im getting "thread 'main' panicked at 'Unable to load get_physical_device_video_capabilities_khr'"

This is caused by calling get_physical_device_video_capabilities in ash-video\src\main.rs:224

This function is implemented here ash/src/extensions/khr/video_encode_queue.rs:25

To run the examples you'll need nvidia beta drivers with video support

pingpongcat avatar Mar 24 '23 21:03 pingpongcat

Your code is using vkGetDeviceProcAddr to load that function. vkGetDeviceProcAddr is specified to return null for physical-device-level commands such as vkGetPhysicalDeviceVideoCapabilities.

Ralith avatar Mar 24 '23 22:03 Ralith

@neurotok Do you want to use this as tracking issue or can we close it now that the initial problem has been resolved (nothing to do with Ash it seems, just general Vulkan usage)?

Also keep in mind that the Video bindings are currently generated from the headers because they landed in an era where video.xml with bitfield struct members did not yet exist. We might change that in the future, though most likely with the generator rewrite and not in the current setup.

MarijnS95 avatar Mar 28 '23 22:03 MarijnS95

Hi @MarijnS95, of course you were right, I already update m fork but let's keep this as a issue tracker for now please. At least until I have a working sample project with decoding.

Do you want some help with the generator to pull video extension from xml?

pingpongcat avatar Mar 29 '23 05:03 pingpongcat

We already generate the full video extension bindings, don't need help for that but it'll likely change with the generator rewrite. In the event that you do need to make changes, use this tracking issue to discuss so first please.

MarijnS95 avatar Mar 29 '23 07:03 MarijnS95