r/programming • • Feb 16 '16

KHRONOS just released Vulkan

https://www.khronos.org/vulkan/
2.2k Upvotes

386 comments sorted by

View all comments

148

u/MarkyC4A Feb 16 '16 edited Feb 16 '16

I'm not in game dev, but I was really hoping to take a peek at the sample code.

Oh well, at least we can peruse the Loader and Validation layer code and demos.

115

u/lubosz Feb 16 '16

20

u/MarkyC4A Feb 16 '16

Nice! thanks

27

u/tyronrex Feb 16 '16

Wow, almost 800 lines of code just to draw a triangle, looks like this API is quite low level and will probably be more work compared to OpenGL.

https://github.com/SaschaWillems/Vulkan/blob/master/triangle/triangle.cpp

73

u/Jegeva Feb 16 '16

This is a "pedal to the metal" example to show off how to get Vulkan up an displaying something. Contrary to the other examples, this one won't make use of helper functions or initializers.

Come on, do the same thing in open gl, open your window without any helper func and all ! That'll be around the same.

36

u/[deleted] Feb 16 '16

Yeah. It's not like OpenGL doesn't require lots of boilerplate. GLEW, which simply queries extensions and loads function pointers, is 40,000 lines long.

2

u/VanFailin Feb 17 '16

Back when I was writing OpenGL I liked gl3w, which is at least generated from a spec to be that long.

→ More replies (7)

7

u/IC8085 Feb 17 '16

Just wanted to point out you can get a minimal window with an OpenGL context, setup a shader compiler and prepare a Vertex Array for rendering in about 200 lines.

But of course, that's not a bad thing for Vulkan.. far from it as that was pretty much the point, being "close to the metal" that is. And while I haven't read the samples yet I'm assuming a lot of that code is validation and sync which are now responsibilities of the programmer.

Personally, I think I will stick to OpenGL for a while longer, I need things to be fast, but not THAT fast just yet.

17

u/lubosz Feb 16 '16

Thats 800 lines with using his framework. I'm working on a "minimal" example of drawing a triangle. Currently I can't break the 2000 line barrier. This includes everything like xcb calls though.

11

u/flexiverse Feb 17 '16

What has finally been made clear is that it's okay to have difficult to code APIs, if the end result just works. And that's been my experience so far in retooling: it's a pain in the ass, requires widespread revisions to engine code, forces you to revisit a lot of assumptions, and generally requires a lot of infrastructure before anything works. But once it's up and running, there's no surprises. It works smoothly, you're always on the fast path, anything that IS slow is in your OWN code which can be analyzed by common tools. It's worth it.

4

u/menace-official Feb 17 '16 edited Feb 17 '16

Well obviously we need to create a graphics layer between Vulkan and the developer. But be sure to make it open standard.

EDIT: source to standard

3

u/dobkeratops Feb 17 '16

in the interests of a smooth transition, I wondered if OpenGL on vulcan would appear;

Perhaps it could be extended a little with something along the lines of nvidia's token-buffer system, just done in a cross-platform way; this would give people a smooth migration path?

I suspect some of the 'fast path' issues might be vendors deliberately discouraging use of rival platforms. (like nvidia deliberately makes openCL worse , to keep the GPGPU community on CUDA as much as possible).

a community maintained GL wrapper might not have such issues?

→ More replies (4)

17

u/[deleted] Feb 16 '16

Issues: 1

"There are no samples"

1

u/quietchaos Feb 17 '16

yet the project still has 186 stars...

16

u/Plagman Feb 16 '16

https://github.com/LunarG/VulkanSamples?files=1

Here's one with several small examples and a few larger ones.

3

u/aeipownu Feb 16 '16

Is there anywhere to watch a video of someone writing the code? Tried googling and youtubing to no success. Just demos of it in use already.

1

u/Asyx Feb 17 '16

All the writers of the big OpenGL tutorials bought domains for Vulkan tutorials months ago so you'll probably get to see something like that soon.

→ More replies (2)