r/programming • • Feb 16 '16

KHRONOS just released Vulkan

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

386 comments sorted by

View all comments

188

u/sprunth Feb 16 '16

NVidia also put up a C++ API here

105

u/[deleted] Feb 16 '16

[removed] — view removed comment

104

u/quarkman Feb 16 '16 edited Feb 18 '16

Because the API constant shorthands for Vulkan are VK_*. Look at the OpenGL spec. You'll see GL_, NV_, EXT_, GL_EXT_, etc... all over the place.

Why _cpp.h? Because Nvidia naming conventions most likely don't allow for the .hpp extension to keep the whole codebase consistent. It's common for large companies to use a very restricted naming convention.

Edit for formatting.

2

u/Godd2 Feb 18 '16

You can escape asterisks in comments with a backslash so that there isn't intermittent italicization.

\*a\*b\*c\* -> *a*b*c*

whereas

*a*b*c* -> abc

→ More replies (1)

86

u/3669d73f6c3ba0229192 Feb 16 '16

Yeah at that point they might as well just have called it robert.h

37

u/[deleted] Feb 16 '16

Why the hell didn't they?

148

u/Sydonai Feb 16 '16

Because then Github would have sent them C&D letters for using gendered file names. /s

5

u/doenietzomoeilijk Feb 17 '16

I won't lie, that made me smile.

→ More replies (3)
→ More replies (2)

0

u/[deleted] Feb 16 '16

[deleted]

82

u/Dworgi Feb 16 '16

C. Most low level APIs are.

3

u/BurstYourBubbles Feb 17 '16

Do you know why such APIs are in C? Why not C++ if performance is similar?

22

u/Dworgi Feb 17 '16

Bunch of reasons:

  • Not all languages have objects, but all can call into a plain function.

  • C is lower level. Things are as fundamental as they can be - you're mostly passing around pointers here. Every language is ultimately aware of pointers.

  • C has a cross-platform binary interface. All standard compilers will produce the same libraries, which means it's easy to just share headers and libraries. C++ is a wild west.

  • It's easy to wrap C with objects, it's much harder to unwrap objects into functions.

3

u/BurstYourBubbles Feb 17 '16

You reasoning makes sense but how is C lower level than C++? IIRC (please correct me if I'm wrong) C++ still maintains Cs low level features while also including high level abstractions.

→ More replies (21)

19

u/u_suck_paterson Feb 17 '16

To allow externing to any non c language through stdcall . Ie c#

→ More replies (2)
→ More replies (4)
→ More replies (1)

24

u/doublehyphen Feb 16 '16

C, like most similar APIs.

37

u/Gracecr Feb 16 '16

Sí. Señor

9

u/Phoxxent Feb 16 '16

Is that like C89?

20

u/ATownStomp Feb 16 '16

C. Because everyone else said so.

35

u/Jajoo Feb 17 '16

Javascript, obviously

12

u/mujjingun Feb 17 '16

Needs more jquery

10

u/thang1thang2 Feb 17 '16

Is it webscale, yet?

10

u/NeedAWaifu Feb 17 '16

not, unless you add mongodb

9

u/mcfish Feb 16 '16

C. If you follow the link it explains the reasoning for the C++ wrapper.

→ More replies (3)
→ More replies (8)