11 ms·
As someone who's kinda hovered around graphics land but never really stepped foot into it, it's pretty difficult to determine what Vulkan represents. Is it goin
by danielvaughn 3y ago
As someone who's kinda hovered around graphics land but never really stepped foot into it, it's pretty difficult to determine what Vulkan represents. Is it going to replace OpenGL? If I'm going to start learning graphics for the first time, would it still be useful to start with OpenGL or should I just dive into Vulkan?
- auggierose 3y agoI would start with WebGPU. Gives you hands-on cross platform knowledge and good foundations. Can't hurt to also look into WebGL, as that is more mature and deployed everywhere.
- Chabsff 3y agoSeconding the first recommendation. WebGPU is currently the sweet spot between classic and modern approaches. Also, don't be fooled by the name. While WebGPU was designed for the web browser, there are already some solid native implementations (wgpu and Dawn), and can definitely fill in the same role as Vulkan/DX12/Metal for most casual usages.
- Buttons840 3y agohttps://webgpufundamentals.org/ https://webgpufundamentals.org/ is the best learning material I've found. I've been learning Rust's WGPU and I appreciate that the tutorial uses a different language and a slightly different API[0], it keeps me thinking instead of just copy/pasting. I never learned OpenGL, but think I will have to eventually refer to some OpenGL material, because there's no WebGPU material except the spec and like 3 incomplete tutorials. [0]: WebGPU is a JavaScript API, so Rust cannot implement it exactly, but it's very close.
- bobajeff 3y agoI also used webgpufundamentals.org to learn webgpu native. Only for me I was porting the examples to C. (I also used WGPU as the backend as I find it easier to debug than Dawn.) I agree it keeps you thinking about how to do things as opposed to just copy pasting. It also helps that the examples are small and in JavaScript so it's easier to figure out the logic that need for them to work.
- adrian17 3y agoNote that wgpu, while mostly mirroring WebGPU (and being used to implement WebGPU in Firefox), doesn't have an identical API; WebGPU being the lowest common denominator* of the underlying low-level APIs, while wgpu offering some minor platform-dependent features on top of that. For exaple wgpu's PrimitiveState has an additional polygon_mode field (that can be used to easily draw wireframes) that doesn't have a WebGPU equivalent. (* meaning, while simplified, it's also missing some convenience features sprinkled in the lower-level APIs. For example, from what I've seen, pipeline explosion is much harder to deal with here.)
- slimsag 3y agoIn some cases wgpu has extensions that fundamentally change usage (e.g. bindless) which aren't supported in browsers at all, right? i.e. wgpu natively and WebGPU in a browser are really just two different topics entirely
- pjmlp 3y agoUsing WebGPU as native API, instead of a proper middleware, means only using 2015 hardware features, which I guess it is fine for casual stuff.
- midnightclubbed 3y agoIf you've not touched 3d graphics before start with OpenGL with a view to moving on to a modern API soon after. OpenGL does a lot of work for you behind the scenes and abstracts away most of the memory management, state management and GPU/CPU synchronization. It lets you worry about 'what' you are rendering and handles a lot of the 'how' internally. Vulcan and its peers (DirectX12, Metal) assume the programmer knows best and requires you to do everything manually. You have more control that way but for a beginner it will swamp you with minutia and make it far more difficult to things up and running.
- jameskilton 3y agoVulkan, Metal, and DirectX 12 are lower-level graphics APIs that provide abstractions better suited towards the GPUs of today (big, big buffers of data, processed by shaders). These new APIs came about because OpenGL and DirectX have grown into handling too many things are are now themselves the source of many bottlenecks for pushing data to your GPU. These APIs being lower level means they are harder to get into, you really have to understand how GPUs work to understand why these APIs are the way they are. If you want to know that then by all means, dive in! It's fascinating stuff, IMO. To answer your specific question, yes, Vulkan is intended to replace OpenGL.
- whstl 3y agoGood answer. I would add that, despite all of them being low-level, Metal is quite easier than the other two, and DirectX 12 is also easier than Vulkan, despite having very similar concepts and ideas. This is in part due to API decisions and differences in verbosity, in part due to the "easier" ones having less flexibility. If your ultimate goal is to master Vulkan, starting with another can help. Also: OpenGL and DirectX are easier than those 3. If I were learning those APIs today, I would personally start with either OpenGL, Metal or DirectX 11 (or 12 if you're slightly braver). They can give someone lots of insights that one can use when learning Vulkan. Like other people mentioned, WebGPU or WebGL are also more straightforward and a good starting point.
- alexarnesen 3y agoIf you are looking to dig into Metal, this site and book might be useful. I have no graphics background and found it accessible. Metal By Example https://metalbyexample.com/ https://metalbyexample.com/
- pjmlp 3y agoA better one with Swift, https://www.amazon.com/Metal-Programming-Guide-Tutorial-Reference/dp/0134668944 https://www.amazon.com/Metal-Programming-Guide-Tutorial-Refe...
- 3y ago
- Deukhoofd 3y agoVulkan was designed to tackle several issues OpenGL had. For example, OpenGL does not do multithreading, while Vulkan is able to, and OpenGL has a single global state, while with Vulkan you're able to create multiple different command buffers to hold the state in. In general Vulkan is also a lot faster at rendering, as it's closer to modern GPUs in design. While Vulkan has been slowly replacing OpenGL, it's also more complex than OpenGL is. This means that OpenGL is still great for many simple use-cases, as you won't be overwhelmed by the complexity that Vulkan can bring along with it.
- qiine 3y agoOpenGL is recommended to get started and learn the base concept then if you survive that you can try Vulkan. Will Vulkan replace everything? Seems unlikely considering Microsoft is not dropping DirectX anytime soon, and apple pretty much despise The khronos group, while the web seems to want to go the WebGPU route now. And openGL seems to simply not die.
- danielvaughn 3y agoI'd heard about this, which I think added to my confusion. My general impression is that Vulkan, Metal, and WebGPU are all separate attempts at modernizing graphics, so they're all kind of related in some sense but they're also distinct and incompatible with each other. So graphics in general are moving away from the legacy OpenGL model (good), but it's also fragmenting (bad). Fair take or no?
- dist-epoch 3y agoYour average graphics developer is not supposed to use Vulkan/Metal/Direct3D directly, but through an engine. So in a way it doesn't really matter what these low level APIs are like.
- TheRoque 3y agoWebGPU is different because it's an abstraction of Vulkan, Metal or DX. Yes, the fragmenting is bad and annoying, WebGPU is the only graphics API that Apple agreed on and that would be truly natively cross-platform, but it's still new, lacking some features, and evolving.
- troupo 3y ago> WebGPU is the only graphics API that Apple agreed on It's was an API they and Firefox presented as a proposal for new graphics API. And it was Google who agreed to follow suit (they had their own proposal)
- qiine 3y agoThe moving away part is taking decade of slow and confusing but still huge progress indeed. And as other have stated the absolutely CRUCIAL question in picking your API, is going to be : what do you want to do ?
- LandStander 3y ago[dead]
- deleted 3y ago[deleted]
- bitwize 3y agoVulkan represents a low-level way of talking to the GPU more or less on the GPU's terms. As opposed to OpenGL which is a way of talking to the GPU on boomer CAD programmers' terms. As for whether Vulkan is going to replace OpenGL... yes and no. Over the next 10 or so years we may see OpenGL drivers for GPUs get replaced with Vulkan drivers plus an OpenGL layer based on Vulkan. But you will still be able to develop to OpenGL. Ad for what you should start with... what do you plan on doing? If you're looking to write a game, use a widely available engine like Unreal or Godot that abstracts the graphics library details. If you're looking to write your own engine... seriously, seriously reconsider. If you're still interested in programming immediate-mode graphics below the engine layer, start with DirectX 11 and 12. They're much more tractable than OpenGL and Vulkan and have unbeatable tooling support from Microsoft. Even if you're targeting Linux, you will have much more binary compatibility across distros by shipping it as a Windows program and running it under Wine.
- z3phyr 3y agoRegarding the last statement, segregation of game and engine is one way of thinking. But many a times, you do not need a full fledged map editor, sculptor etc. You just implement the parts you need for your game.
- lawlessone 3y agoYeah Vulkans great if you are in the business of making Game Engines / or 3d tools. You are not going to want work in it developing your own game... unless you really want to, it shouldn't be necessary.
- bitwize 3y agoThat still needs to be seriously, seriously reconsidered in favor of basing your game on a major engine. There's just so much tooling and workflow around the big engines. Personnel to help will also be easier to obtain.
- kaveh808 3y ago"Vulkan represents a low-level way of talking to the GPU more or less on the GPU's terms. As opposed to OpenGL which is a way of talking to the GPU on boomer CAD programmers' terms." Kind of like that description. I've been doing GL since before it was OpenGL. In my Common Lisp 3D system [1], I've been happily using very simple immediate mode OpenGL calls, taking advantage of CAD-like features such as drawing wireframes of various thickness over shaded polygons. OpenGL provides specific Z-buffer API calls to facilitate such things. Is there a simple way of doing such CAD-centric things in Vulkan? [1] https://github.com/kaveh808/kons-9 https://github.com/kaveh808/kons-9
- z3phyr 3y agoStart with WebGPU, DirectX11 or OpenGL. Do learnopengl, try to write a gITF model viewer in it. Then rewrite the gITF renderer in DirectX12, Vulkan or Metal.
- dist-epoch 3y agoOpenGL is Python, Vulkan is C++.
- WithinReason 3y agoAs a car analogy, OpenGL is a Toyota. Vulkan is the pieces to a Ferrari.
- jchw 3y agoVulkan is positioned to replace OpenGL, but possibly OpenCL/CUDA, vaapi/video acceleration libraries, and probably more. So honestly, it's sort of understandable why things get confusing here. It's quite abstract as well as sprawling in scope.
- deleted 3y ago[deleted]
- flohofwoe 3y agoBoth APIs are not all that great, Vulkan has a steep learning curve and requires tons of boilerplate code to even get a triangle on screen, and OpenGL is 30 years of sediment layers all pressed into a single 3D API. WebGPU is currently probably the best balance between: - easy to learn - easy to tinker with (in web browsers at least) - modern concepts (close enough to Metal, Vulkan and D3D12 that what you learned carries over) - platform-agnostic If you are on Windows, D3D11 is also a good native option, as is Metal on macOS.
- Akronymus 3y ago> Vulkan has a steep learning curve and requires tons of boilerplate code to even get a triangle on screen In regards to the boilerplate: Yes, for the first draw you require a lot, but after that, it quickly becomes almost neglible.
- hajile 3y agoHopefully, WebGPU will eat all its competition and we can finally have just one standard moving forward.
- flohofwoe 3y agoNah, competition is good :) E.g. without Metal as example of what a modern user-friendly 3D API can look like, WebGPU would probably look very different, and not in a good way. My personal hope is that the concept of a "3D API" will eventually disappear into compilers like Clang and GCC and their standard libs. E.g. WebGPU has a pretty big API surface just for ensuring that the CPU-provided data is compatible with what the GPU expects, and any mismatches manifest as runtime errors, not compile-time errors. Most of this API surface would simply disappear if the same compiler can see both the CPU and GPU side code, integrated into the same compilation process.
- pjmlp 3y agoGood luck convincing console vendors.
- no_time 3y ago
- reactordev 3y agoOpenGL has been deprecated on everything but Android, Windows, Linux, and PS4. Vulkan is the new open standard modeled after Metal (macos, ios) and DirectX 12 (windows,xbox). Vulkan, like Metal and DX12, offer direct memory access to GPU resources. Modern OpenGL (buffers and vao’s) is close to what vulkan is but vulkan takes it further. With command queues for multithreaded rendering and everything is a buffer. Indices, vertices, shader uniforms, everything. WebGPU (wgpu) is another abstraction on top of all of them that I feel is the modern bgfx, that is, a modern abstraction of those buffers and queues that work across DX12, Metal, and Vulkan. If you aren’t in the graphics space, I would skip learning vulkan and learn webgpu wgpu-native.
- msk-lywenn 3y agoOpenGL has never ever been used on PS4, it has always been a custom API. Unless you're talking homebrew stuff. Vulkan was modeled after Mantle, AMD's own API that was basically what was available on consoles but less specific (ie. supporting more than a few custom GPUs). Direct3D 12 was modeled after consoles and Mantle, just like Vulkan. Same for Metal, that was made available in 2014, same year D3D12 was publicly announced. https://en.wikipedia.org/wiki/Mantle_(API) https://en.wikipedia.org/wiki/Mantle_(API) https://twitter.com/repi/status/446718535616585730 https://twitter.com/repi/status/446718535616585730
- reactordev 3y agoYeah for PS4 OpenGL worked but wasn’t their API, they have GNM. Yes but they all have a similar design around treating the GPU as a buffer store. You’re right about Mantle but that was the inspiration of many. They each took some concepts. I’m not an expert on driving decisions behind them. Just from my own experience. Vulkan is much more difficult and verbose than the others. This is one of the main hurtles to Vulkan.
- SotCodeLaureate 3y ago> I'm going to start learning graphics for the first time Vulkan is a quagmire of very low-level concepts, the danger of getting stuck in them and give up without learning anything is just too high. At the same time making something with OpenGL that is more interesting than a simple rotating cube is not that difficult and you will get a lot of mid-level understanding - how rendering pipeline implemented and organized, what kind of task it is. "Porting" this knowledge to Vk is straightforward.
- indigoabstract 3y agoOpenGL is definitely easier to learn and use than Vulkan, but it's reached the end of life so it won't be updated anymore. I'm not sure Vulkan can ever replace OpenGL since it's much more complex and low level. I think a better option for a beginner would be to use a rendering library like bgfx, sokol_gfx or even facebook's igl, since you can learn the basic concepts of rendering triangles and not bother too much with all the minute rendering details. One can get an idea of the complexity build-up of the current graphics APIs by measuring how much code it takes make a triangle show up on screen. Compared to the OpenGL fixed function days, the required Vulkan setup code is massive.
- dyingkneepad 3y agoIn practice a lot of Vulkan documents assume you already know GL! So for learning purposes, modern GL is probably best. Start learning modern GL: if the Hello Triangle doesn't use 2 shaders you're not learning modern GL. Hello Triangle for GL requires about 80 lines of code, while Hello Triangle for Vulkan requires about 1000 lines of code. I highly recommend learnopengl.com and vulkan-tutorial.com. If you're going to write a simple game, it's probably better to stick with GL. If you're going to write a real complex engine, Vulkan is the only acceptable path these days. Gl deviates way too much from what the GPU does, so there's a lot of CPU overhead and synchronization choke-points. Vulkan is way similar to an actual GPU and gives you more power to uses the resources in the appropriate way.
- GuB-42 3y agoDon't start with Vulkan, it is extremely complex, and even seasoned graphics programmers have a hard time with it. Its purpose is to give as much control as possible to 3D engine developers. If you don't want to use an engine and don't want to make an engine, OpenGL is still the answer, and I don't think it will disappear anytime soon. If you want still want to learn Vulkan, at least use something simpler (like OpenGL) to get familiar with the basics, it is simply too much for a beginner.
- hmry 3y agoJust want to add: As far as I know, the "V" in Vulkan is actually supposed to represent 5. As in, the next thing after OpenGL 4, which will be the last version of OpenGL. That, and the volcanic theme to fit with Mantle, the AMD experiment that sort of... inspired Vulkan? Got merged with it? Not sure on the organizational history there.