What is darkVulkanGen?
A handful of months back, I began working on a game engine for Delphi named darkGlass.
At that time I’d intended to write the rendering part of the game engine using OpenGL, however, for a variety of reasons I decided to use Vulkan instead.
Vulkan is a modern graphics API maintained by the Khronos group (a non-profit organisation which collaborates with many of the major organizations across technology industries to provide cross platform standardization of API’s). They are also responsible for the OpenGL and OpenCL API’s.
The Khronos Group provides a specification for their Vulkan API in the form of an XML document and a set of scripts which transform the XML into documentation and a C/C++ header file. Unfortunately for us Delphi users, a C/C++ header is of little use, and so I needed a pascal equivalent of that header.
The approach I decided to take, was to parse the Vulkan API specification XML document (vk.xml) and use it to generate the pascal sources. This is what darkVulkanGen does.
It’s rough around those edges!
I’d like to stress, as I do in the video below, that this generator is a first draft. It works sufficiently to generate a header that compiles, but I can’t yet claim that header works. This is a work in progress, but should advance quickly, and so I’m sharing early.
If you are attempting to use the header now and find problems, please raise ‘issues’ on the darkGlass github repository.
For more information, please watch this video (and/or keep reading below).
Source code for the darkVulkanGen is contained within the darkGlass repository on GitHub: https://github.com/chapmanworld/DarkGlass
But isn’t there already a Delphi header generator for Vulkan?
Yes there is. It’s called pasVulkan and can be found on GitHub here: https://github.com/BeRo1985/pasvulkan
pasVulkan is more complete than darkVulkanGen, it has been around for longer, and has been used to generate an impressive set of demo applications. None the less, I decided not to use it, my reasons are all quite thin, but each added weight to the decision. Here they are:
pasVulkan is not just a header it’s a game engine in progress.
I’m already working on a game engine and therefore don’t need most of the pasVulkan code.
pasVulkan uses a slightly different style of coding to my own.
pasVulkan would have introduced the zlib license to my project.
I also noticed a minor bug in pasVulkan while using it’s output as a comparative reference for darkVulkanGen. I reported the bug and it was fixed almost immediately, however, had Benjamin Rosseaux not been so quick to respond, I’d have been forced to fork the project and study the code to repair it myself.
Getting the header.
In my video I describe how to get the source code for the header generator and use it to generate the header. In coming days this will not be necessary, as I’ll put a copy of the header into the darkGlass source. You’ll then be able to simply browse the GitHub repository and download that one file (and the darkDynLib directory it depends on). I’ll post an update here when that’s done.
Will it support Lazarus/FPC?
Possibly in the future yes, but certainly not in it’s present state.
The darkGlass project is for Delphi, and I work for Embarcadero. This means that I always have the latest version of Delphi available to me, and that makes supporting Lazarus and FPC a lower priority for me. Having said that, I’ve also used Lazarus and FPC quite heavily, and as a point of habit I tend to keep my code compatible with the syntax differences. So it’s not impossible that I’ll patch it up for FPC in the future, but that’s not happening today.
Today actually brings about another reason to lower my priority for FPC support.
Embarcadero officially released the Community Edition of Delphi and C++ Builder! https://www.embarcadero.com/products/delphi
The Community Edition of Delphi gives you all the same features that you get with the Professional Edition, but for FREE!
The Community Edition is intended for student, hobby, and start-up organizations and comes with license restrictions appropriate to it’s intended audience. However, if you fall into one of these categories, you get to write applications for Windows, Mac OSX, Android and IOS using a single code base, and single UI designer, at no cost!
I hope this header generator is useful to you.
Thanks for Reading!