KhronosGroup / Vulkan-Ecosystem

Public repository for Vulkan Ecosystem issues
Apache License 2.0
133 stars 15 forks source link

Where do I start for new FFI bindings? #43

Closed zyrolasting closed 5 years ago

zyrolasting commented 5 years ago

I'm looking to define C bindings for Vulkan on Linux using Racket's FFI. I have a ton of cobwebs in my C knowledge and am not sure what pieces should fit together in my approach.

My first understanding was that I need to build libvulkan.so myself and link against that. Then I saw the Vulkan-Loader and the architecture diagram and now I am not sure if I should start by having bindings against that. Where do I start?

mikew-lunarg commented 5 years ago

@zyrolasting I'm not clear what you're trying to accomplish. Vulkan is a C API.

I understand FFI mechanisms, but it would help to understand the issue you're trying to solve and why?

PS the LunarG Vulkan SDK provides prebuilt binaries for several platforms.

oddhack commented 5 years ago

I believe Racket is a language that @zyrolasting wants to create bindings for, and he's asking what C library the bindings should be calling out to (please confirm).

BTW @zyrolasting, you may want to look at basing the bindings on code generated from the C API description in vk.xml. This is the canonical machine-readable definition of the API.

zyrolasting commented 5 years ago

Thanks @oddhack, between this and using the Khronos Slack workspace I got the information I needed. For me the answer was to grab the SDK, bind against libvulkan.so and use the XML file as you mentioned. My confusion came from not knowing if it was more worth my time to start by binding against Vulkan-Loader.