Skip to content

Conversation

russelltg
Copy link

use ash for the vulkan types. Requires a bit of effort to rename the ash types.

Alternative is just letting bindgen do it's thing and generate all of vulkan.h, but that feels pretty messy....

@dmtrKovalenko
Copy link
Collaborator

I wonder about your usecase could you please clarify how are you using a pure vulkan flag

@russelltg
Copy link
Author

Right. My usecase is russelltg/wl-screenrec#90

I'll add some comments around that. Ideally those lifetimes would be bubbled up through the bindgen interfaces but I don't think that's possible.

@russelltg
Copy link
Author

Added a good comment about why 'static and ran cargo fmt

@russelltg
Copy link
Author

Weird, rustup failed?

@russelltg russelltg force-pushed the vulkan branch 2 times, most recently from 3c76b04 to 79d2728 Compare November 13, 2024 07:47
@russelltg
Copy link
Author

Is there interest in this? If so, what is needed to move forward?

I'd like to make a release of wl-screenrec with vulkan support and would prefer to not fork.

@dmtrKovalenko
Copy link
Collaborator

All the build flags are working. I’m using vulkan accelerated decoders and encoders just fine with rust ffmleg sys

@russelltg
Copy link
Author

The issue isn't with using the vulkan encoders/decoders, it's with calling the functions/using struct definitions in hwcontext_vulkan.h, like I do in https://github.com/russelltg/wl-screenrec/pull/90/files#diff-38d46369f3ed2b03aa1e4e905b9d0af3cd8b60badbe7c250903a9b2ad58a1a49R166

@russelltg
Copy link
Author

@dmtrKovalenko freshly rebased. Let me know if you have other thoughts on how this could be handled--I'd really like to be able to call those ffmpeg functions!

Copy link
Collaborator

@dmtrKovalenko dmtrKovalenko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I still do not understand why do you need ffmpeg sys to be dependent on ash if you can continue working with the ash types and call the functions directly.

The av api is build around the C pointers so you can perfectly fine call aw_hw_create_device with your ash returned pointer (let me know if You need an example I have it)

@dmtrKovalenko
Copy link
Collaborator

Please can you give me an example of a single function call that you can not call rn?

@russelltg
Copy link
Author

russelltg commented Jun 24, 2025

I need bindings to the AVVulkanFramesContext, which has vulkan types within it.

I could have ffmpeg-sys generate the bindings for the vulkan types itself, but ash already has good (ABI correct) bindings for all vulkan structs.

I suppose it is just a few enum/typedefs then a void* to vulkan stuff, so I guess we could maybe get away with something more minimal for the moment?

@russelltg
Copy link
Author

Bindings to AVVulkanDeviceContext (which I don't need right now, but may eventually...) is more complex and requires access to some vulkan structs. With this PR I figured I'd allow generating bindings to all the important structs in hwcontext_vulkan.h

@russelltg
Copy link
Author

Same with AVVkFrame

@russelltg
Copy link
Author

In addition to the structs, I need av_vkfmt_from_pixfmt

@dmtrKovalenko
Copy link
Collaborator

Okay let's make the CI to pass, I'll run my test suite against this patch and if everything works alright we can merge it

@russelltg
Copy link
Author

Ping on approving CI for this

russelltg added a commit to russelltg/wl-screenrec that referenced this pull request Sep 9, 2025
@russelltg
Copy link
Author

russelltg commented Sep 13, 2025

Another gentle ping on this :).

I can't publish the latest wl-screenrec release to crates.io unless I publish a fork, which I would really like to avoid...

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.

2 participants