6 ms·
Vulkan Tutorial
- prideout 10y agoThis looks like a great tutorial; it builds up a "Hello Triangle" using a nice balance of English and C.
- Narishma 10y agoI think you mean C++.
- raverbashing 10y agoI don't see any C++ there, besides a file extension (I might be wrong)
- Narishma 10y agoHe allocates memory with new/delete and passes arguments with references among other things.
- raverbashing 10y agoAh you're absolutely right Still there are some C quirks, search for "This extension adds three new functions" and see the code block above
- shmerl 10y agoInteresting, but I'd start with a Linux program for educational purposes. It wouldn't assume one must have Windows to run it. > First things first, let me just warn you that this is not a beginners tutorial to rendering APIs. I assume you have some experience with something like OpenGL or DirectX and you are here just to get to know the particularities of Vulkan. Is there some book / tutorial that both introduces rendering APIs to beginners and is using Vulkan for it at the same time?
- slimsag 10y agoThere might be more game devs using Windows than Linux, just due to market share, so I'd say Windows was the right choice here.
- shmerl 10y agoI think educational materials should have different considerations than just market share. But that's my personal opinion.
- sbarre 10y agoThis is a strange thing to say. Educational materials are of the most value when they reach their largest relevant audience. In this case, the largest relevant audience for this kind of thing at the moment is probably game developers, and most of them target Windows in their work. Are you suggesting this material should have been developed in a way that is less relevant to that largest audience? I don't see how that would be a good idea. Perhaps you are getting tripped up on the phrase "market share", thinking only of it in a commercial context, when it simply meant targeting the largest segment of users who will find this useful.
- bottled_poe 10y ago> most of them target Windows in their work Windows? I would have guessed iOS as the top target platform.
- Narishma 10y agoiOS doesn't support Vulkan.
- bottled_poe 10y agoThat doesn't seem relevant to the argument about largest game development target platform.
- educar 10y agoThe take away for me is that vulkan is similar to opengl. Mindlessly complex APIs just to play around with basic stuff. Graphics really doesn't need to be this complicated :/
- shmerl 10y agoIt's very low level. Khronos noted, that they didn't have time / resources to create a higher level API (on top of Vulkan) that would at least match the level of OpenGL in usability (but would avoid its downsides like stateful nature). Hopefully someone will make such higher level library. Engines can't fill that role - they are too high level and specialized already. So that middle layer is still missing.
- zerr 10y agoWhy missing? Is OpenGL deprecated? (or any such plans..)
- shmerl 10y agoBecause OpenGL is stateful by design. Since there isn't anything else high level enough, OpenGL is still useful, but yes, I expect it to remain only for legacy applications once something better based on Vulkan will emerge.
- ericflo 10y agoWith all due respect, you're definitely not the target market for Vulkan. It's an incredibly low level abstraction layer over GPUs intended to allow rendering engine developers to control the intricate details of the pipeline. For something simple, you'll want to use a game engine like Unity or Unreal, which build on top of this low level stuff to build nice, high level abstractions.
- zerr 10y agoI wander if mass adoption of Vulkan for engine development would initiate "gentrification" - I mean, currently, engine devs enjoy working with OpenGL (or D3D), and there is a big chance many people simply won't enjoy using Vulkan so they won't use it or just leave the field altogether. I suspect using Vulkan will be comfortable for GPU hardware people (hence different demographic).
- taspeotis 10y agoSerious case of NIH... I have also created the helper function assert() that does what you would expect ... ... int *base = 0; *base = 1; Just call abort [1]. Or better yet, just call assert [2]. Then, in favour of using the Vulcan SDK, it continues: just need to copy vulkan.h and vk_platform.h to our application folder ... [i]f you run this piece of code you will notice that you might have found no layer... This is because, at leat on my system, the loader could not find any layer. To get some validation layers we need the SDK ... [w]hat I found out during the process of trying to figure out if you needed the SDK or not is that you only need the .json and the .dll of the layer you want somewhere on your project folder and then you can setup the VK_LAYER_PATH environment variable to the path to the folder with those files. This is not how you build reliable software. Use the IDE/SDK/standard libraries already! You'll be done quicker. With less undefined behaviour. [1] http://pubs.opengroup.org/onlinepubs/9699919799/functions/abort.html http://pubs.opengroup.org/onlinepubs/9699919799/functions/ab... [2] http://pubs.opengroup.org/onlinepubs/009695399/functions/assert.html http://pubs.opengroup.org/onlinepubs/009695399/functions/ass...
- asgeir 10y agoIn support of this. Dereferencing a NULL pointer is undefined behaviour. http://blog.llvm.org/2011/05/what-every-c-programmer-should-know.html http://blog.llvm.org/2011/05/what-every-c-programmer-should-... C Standard http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1570.pdf http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1570.pdf 6.5.3.2 Address and indirection operators ... If an invalid value has been assigned to the pointer, the behavior of the unary * operator is undefined. ... Among the invalid values for dereferencing a pointer by the unary * operator are a null pointer
- gulpahum 10y agoI've always wondered how Vulkan is bootstrapped and its drawing surface attached to a window. Now I know. I would assume that the code for Linux and Android is similar.
- smegel 10y agoWhat is Vulkan and why are we programming in Win32 in 2016?
- clippingpaths42 10y agoYes C++
- raverbashing 10y agoOh, the niceties of C Windows programming I wonder how anyone got anything done in that time. Really And the wrong (but very common) type of Hungarian Notation - http://www.joelonsoftware.com/articles/Wrong.html http://www.joelonsoftware.com/articles/Wrong.html Edit: I don't get the downvotes
- akx 10y agoI guess you're being downvoted because there's about 60 lines of Win32 code -- the rest is the verbose Vulkan API, which is the same on every platform.
- andrewclunn 10y agoGonna be honest, was hoping for an into for a Star Trek languange.
- Amanjeev 10y agoI think that is spelt "Vulcan".
- Keyframe 10y agoThey weren't kidding when they were saying it's a lot more work.
- aarongolliver 10y ago*(void **)&vkCreateDebugReportCallbackEXT = vkGetInstanceProcAddr( ... ); Is there a cleaner/more idiomatic way to do this?
- jra101 10y agoPFN_vkCreateDebugReportCallbackEXT dbgCreateDebugReportCallback = (PFN_vkCreateDebugReportCallbackEXT)vkGetInstanceProcAddr(instance, "vkCreateDebugReportCallbackEXT");
- ucs 10y agoIs there a cleaner/more idiomatic way to do this? I'm afraid this is the C idiom for assigning a void pointer to a function pointer: *(void **) &fptr = getvoidptr(); Without the silly cast you'd get the following warning when compiling with -Wpedantic: warning: ISO C forbids assignment between function pointer and 'void *' Once you learn the idiom, and the reason behind it, it makes things (slightly) easier to parse than dealing with a bunch of typedefs, IMHO.
- bronz 10y agowhat is the current status with driver support for vulkan? are they being rolled out steadily at this point? and does anyone have an opinion on how quickly we will see vulkan drivers become reliable and ubiquitous? also, check out this awesome demo of DOOM using vulkan. https://www.youtube.com/watch?v=0y3LaLJoo0s https://www.youtube.com/watch?v=0y3LaLJoo0s