I think this is too hacky way, i.e. there is no guarantee that the API will be the same in the future.
I 100% agree. I have never written an extension before and I’m trying to learn how it works and how it should work (if the right APIs are exposed). Without this knowledge I can’t really make a sensible proposal for what (if anything) needs to change. Seek first to understand and all that.
@Mathias_Westerdahl said this:
You can try using it first by creating a copy of that header file and using it in your extension as a proof of concept.
(source)
And I think it’s a sensible suggestion when an API doesn’t exist yet; first make it “work”, then make it “good”. Also, it provides a demonstrated use-case for exposing something, and provides an extension that can bridge the gap until such proposal is accepted and implemented.
So my methodology is this:
- Solve linker issue and get it linking directly to functions I know exist and should already be present in linked libraries.
- Manually make it work with both Vulkan and OpenGL - since their outputs are different (I think BGR vs. RGB and y-flipped or not are the two main differences). This is an important step before the next one, because in understanding the differences it feeds into the discussion about where problems should be solved (inside or outside those functions?).
- Propose/discuss what would need to be added and any consequences.
I’ve actually partially solved point 1. above since the original post, by calling
VulkanGetContext
directly and then passing that into dmGraphics::*
and got a successfully built extension that works (but with some more work to do, in order to resolve buffer format differences between Vulkan and OpenGL). Although this “works” I say “partially solved” because I still don’t know why I can’t link against the Vulkan functions directly. My guess is something about how C++ mauls symbols that are’t declared extern, but my C++ and ELF (if that’s still relevant) knowledge is 20+ years out of date and very dusty, also it seems to link VulkanGetContext
just fine and I don’t know why this function can be linked but the others can’t.
So, I hope I have defended my approach to your satisfaction… if you can see any better ways please suggest.