www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Vulkan bindings

reply Satoshi <satoshi gshost.eu> writes:
Hello Vulkan API 1.0 is here and I just wrapped it into D.

https://github.com/Rikarin/VulkanizeD

Have fun!
Feb 16 2016
next sibling parent reply Rikki Cattermole <alphaglosined gmail.com> writes:
On 17/02/16 8:01 AM, Satoshi wrote:
 Hello Vulkan API 1.0 is here and I just wrapped it into D.

 https://github.com/Rikarin/VulkanizeD

 Have fun!
Btw you removed Khronos header/license declaration. I'm copying back the original to my variation of these bindings.
Feb 17 2016
parent Satoshi <satoshi gshost.eu> writes:
On Wednesday, 17 February 2016 at 10:55:22 UTC, Rikki Cattermole 
wrote:
 On 17/02/16 8:01 AM, Satoshi wrote:
 Hello Vulkan API 1.0 is here and I just wrapped it into D.

 https://github.com/Rikarin/VulkanizeD

 Have fun!
Btw you removed Khronos header/license declaration. I'm copying back the original to my variation of these bindings.
Fixed.
Feb 17 2016
prev sibling next sibling parent reply Alex Parrill <initrd.gz gmail.com> writes:
On Tuesday, 16 February 2016 at 19:01:58 UTC, Satoshi wrote:
 Hello Vulkan API 1.0 is here and I just wrapped it into D.

 https://github.com/Rikarin/VulkanizeD

 Have fun!
Please consider making it a Dub package! (IMO It would be cool to generate OpenGL and Vulkan bindings directly from the XML spec; std.xml doesn't work in CTFE. Though it would probably take a long time to compile)
Feb 17 2016
next sibling parent reply Kapps <opantm2+spam gmail.com> writes:
On Thursday, 18 February 2016 at 03:27:55 UTC, Alex Parrill wrote:
 On Tuesday, 16 February 2016 at 19:01:58 UTC, Satoshi wrote:
 Hello Vulkan API 1.0 is here and I just wrapped it into D.

 https://github.com/Rikarin/VulkanizeD

 Have fun!
Please consider making it a Dub package! (IMO It would be cool to generate OpenGL and Vulkan bindings directly from the XML spec; std.xml doesn't work in CTFE. Though it would probably take a long time to compile)
This is what I did with OpenGL for my own bindings. It had some nice benefits like having the documentation be (mostly) accessible. Unfortunately, turns out the spec contains a lot of typos, including wrong arguments / function names.
Feb 17 2016
parent reply Kapps <opantm2+spam gmail.com> writes:
On Thursday, 18 February 2016 at 03:38:42 UTC, Kapps wrote:
 This is what I did with OpenGL for my own bindings. It had some 
 nice benefits like having the documentation be (mostly) 
 accessible.

 Unfortunately, turns out the spec contains a lot of typos, 
 including wrong arguments / function names.
And I should clarify, ahead of time to generate a .d file, not at compile-time. :P
Feb 17 2016
parent reply Alex Parrill <initrd.gz gmail.com> writes:
On Thursday, 18 February 2016 at 03:39:30 UTC, Kapps wrote:
 On Thursday, 18 February 2016 at 03:38:42 UTC, Kapps wrote:
 This is what I did with OpenGL for my own bindings. It had 
 some nice benefits like having the documentation be (mostly) 
 accessible.

 Unfortunately, turns out the spec contains a lot of typos, 
 including wrong arguments / function names.
And I should clarify, ahead of time to generate a .d file, not at compile-time. :P
Yea, by "directly", I meant using D templates and CTFE, not a script that generates a D file. For my own project, since I just need the function names, I'm using a Python script to generate a CSV file from the OpenGL spec, then importing/parsing that with D. It's neat, but slows down the build a lot. I haven't had any issues with typos, though.
Feb 18 2016
parent ParticlePeter <ParticlePeter gmx.de> writes:
On Friday, 19 February 2016 at 01:49:12 UTC, Alex Parrill wrote:
 On Thursday, 18 February 2016 at 03:39:30 UTC, Kapps wrote:
 On Thursday, 18 February 2016 at 03:38:42 UTC, Kapps wrote:
 This is what I did with OpenGL for my own bindings. It had 
 some nice benefits like having the documentation be (mostly) 
 accessible.

 Unfortunately, turns out the spec contains a lot of typos, 
 including wrong arguments / function names.
And I should clarify, ahead of time to generate a .d file, not at compile-time. :P
Yea, by "directly", I meant using D templates and CTFE, not a script that generates a D file. For my own project, since I just need the function names, I'm using a Python script to generate a CSV file from the OpenGL spec, then importing/parsing that with D. It's neat, but slows down the build a lot. I haven't had any issues with typos, though.
What about all the other layers (currently) found in the LunarG SDK? Without them its just toying around with Vulkan. Porting them manually seems a lot of work, how can this be tackled automatically?
Feb 19 2016
prev sibling next sibling parent reply ZombineDev <valid_email he.re> writes:
On Thursday, 18 February 2016 at 03:27:55 UTC, Alex Parrill wrote:
 On Tuesday, 16 February 2016 at 19:01:58 UTC, Satoshi wrote:
 Hello Vulkan API 1.0 is here and I just wrapped it into D.

 https://github.com/Rikarin/VulkanizeD

 Have fun!
Please consider making it a Dub package! (IMO It would be cool to generate OpenGL and Vulkan bindings directly from the XML spec; std.xml doesn't work in CTFE. Though it would probably take a long time to compile)
I started working on that. I've been reading the Python C Header generator code and I'm wondering if would be easier to just re-implement it in D, rather than trying to extend it. Currently the XML is very C oriented (e.g. has C macros in it), unlike the OpenGL spec which was written in a language agnostic way. The advantages of using the vk.xml is that once the generator is complete you can easily adapt it for newer revisions of the spec. Also you have much more freedom in how you can organize the bindings (split by functions/structs/enums or logically by e.g. instance, device, command recording, queues, synchronization, shaders, pipelines, etc.), also it's easier to do other stuff like using D's builtin types instead of cstdint, generating ddoc-formatted function/struct/enum documentation and also ddoc-ed unittests from the spec examples. And maybe also provide two versions - one with vanilla names (easier if you are following tutorials) and one that's written in D style (http://dlang.org/dstyle.html) for those who prefer a more uniform syntax with the rest of the other D libraries out there. I have completed the SPIR-V D header (which was trivial to generate from the .json file) and I'm also hoping to translate the other stuff from the LunarG SDK like the debug layers (no auto-generation would be possible there). Given the advancements in the recent years of the D ecosystem (dub, high quality doc generators, CT generation of boilerplate, etc.), I think that D can offer even better developer experience than C++ for which the API was primary targeted.
Feb 17 2016
parent reply Nicholas Wilson <iamthewilsonator hotmail.com> writes:
On Thursday, 18 February 2016 at 04:11:39 UTC, ZombineDev wrote:
 On Thursday, 18 February 2016 at 03:27:55 UTC, Alex Parrill 
 wrote:
 [...]
I started working on that. I've been reading the Python C Header generator code and I'm wondering if would be easier to just re-implement it in D, rather than trying to extend it. Currently the XML is very C oriented (e.g. has C macros in it), unlike the OpenGL spec which was written in a language agnostic way. The advantages of using the vk.xml is that once the generator is complete you can easily adapt it for newer revisions of the spec. Also you have much more freedom in how you can organize the bindings (split by functions/structs/enums or logically by e.g. instance, device, command recording, queues, synchronization, shaders, pipelines, etc.), also it's easier to do other stuff like using D's builtin types instead of cstdint, generating ddoc-formatted function/struct/enum documentation and also ddoc-ed unittests from the spec examples. And maybe also provide two versions - one with vanilla names (easier if you are following tutorials) and one that's written in D style (http://dlang.org/dstyle.html) for those who prefer a more uniform syntax with the rest of the other D libraries out there. I have completed the SPIR-V D header (which was trivial to generate from the .json file) and I'm also hoping to translate the other stuff from the LunarG SDK like the debug layers (no auto-generation would be possible there). Given the advancements in the recent years of the D ecosystem (dub, high quality doc generators, CT generation of boilerplate, etc.), I think that D can offer even better developer experience than C++ for which the API was primary targeted.
Hey I've started work on a more D like vulkan http://dpaste.dzfl.pl/1ecfa367b966 I switched to adapting Satoshi bindings (I gave up on trying to gen it from the xml too much like hard work Waaaaay too many inconsistencies ) If you have any further ideas for improvements let me know! (I think a tool to autogen the descriptor layouts would be awesome But that will take a while and Uni starts soon so I probably won't have time) Nic
Feb 24 2016
parent Thomas Brix Larsen <brix brix-verden.dk> writes:
On Wednesday, 24 February 2016 at 12:45:13 UTC, Nicholas Wilson 
wrote:
 On Thursday, 18 February 2016 at 04:11:39 UTC, ZombineDev wrote:
 [...]
Hey I've started work on a more D like vulkan http://dpaste.dzfl.pl/1ecfa367b966 I switched to adapting Satoshi bindings (I gave up on trying to gen it from the xml too much like hard work Waaaaay too many inconsistencies ) If you have any further ideas for improvements let me know! (I think a tool to autogen the descriptor layouts would be awesome But that will take a while and Uni starts soon so I probably won't have time) Nic
Did you look into adapting VkCppGenerator for the task? https://github.com/nvpro-pipeline/vkcpp
Feb 24 2016
prev sibling parent Mike Parker <aldacron gmail.com> writes:
On Thursday, 18 February 2016 at 03:27:55 UTC, Alex Parrill wrote:

 (IMO It would be cool to generate OpenGL and Vulkan bindings 
 directly from the XML spec; std.xml doesn't work in CTFE. 
 Though it would probably take a long time to compile)
https://github.com/Dav1dde/glad
Feb 17 2016
prev sibling parent reply ParticlePeter <ParticlePeter gmx.de> writes:
On Tuesday, 16 February 2016 at 19:01:58 UTC, Satoshi wrote:
 Hello Vulkan API 1.0 is here and I just wrapped it into D.

 https://github.com/Rikarin/VulkanizeD

 Have fun!
I think your usage of const pointer is wrong. E.g. c const char* maps to d const(char)* etc.
Feb 19 2016
parent Satoshi <satoshi gshost.eu> writes:
On Saturday, 20 February 2016 at 07:59:13 UTC, ParticlePeter 
wrote:
 On Tuesday, 16 February 2016 at 19:01:58 UTC, Satoshi wrote:
 Hello Vulkan API 1.0 is here and I just wrapped it into D.

 https://github.com/Rikarin/VulkanizeD

 Have fun!
I think your usage of const pointer is wrong. E.g. c const char* maps to d const(char)* etc.
Thanks, I just fixed it.
Feb 21 2016