The Linux graphics stack in a nutshell, part 1
The Linux graphics stack in a nutshell, part 1
Posted Dec 19, 2023 20:06 UTC (Tue) by randomguy3 (subscriber, #71063)In reply to: The Linux graphics stack in a nutshell, part 1 by adobriyan
Parent article: The Linux graphics stack in a nutshell, part 1
the way i understand it, it would be a bit like complaining that it's hard to program in LLVM's intermediate representation - sure, but what did you expect?
Posted Dec 19, 2023 20:17 UTC (Tue)
by adobriyan (subscriber, #30858)
[Link] (6 responses)
But who is going to write 3d engine if everyone should be using one?
My comment is a warning for the uninitiated.
Posted Dec 19, 2023 22:27 UTC (Tue)
by excors (subscriber, #95769)
[Link] (5 responses)
I think most of the verbosity of Vulkan is because it exposes the complex architecture of modern GPUs; but if you're trying to write a decent engine in OpenGL then you'll have to use various OpenGL features and extensions that similarly expose the architecture of modern GPUs, so there's not so much difference. There is a big difference in learning curves though: you need to learn quite a lot about how GPUs work before drawing that first triangle in Vulkan (but then you can steadily progress to rendering many more triangles), whereas OpenGL provides many shortcuts so you can get something onto the screen quickly (and then rewrite your code several times as you learn new concepts and realise those shortcuts were actually traps).
Posted Dec 20, 2023 12:55 UTC (Wed)
by Sesse (subscriber, #53779)
[Link] (1 responses)
AFAIU, Khronos intended for there to be some sort of middle layer for those who didn't want to use a full engine, but it never really materialized. The situation is pretty atrocious, and it means we can basically never kill OpenGL even though it doesn't get any new features.
Posted Dec 20, 2023 14:26 UTC (Wed)
by pta2002 (guest, #168664)
[Link]
WebGPU's API, from what people seem to say, is basically identical to Apple's Metal, which most people also seem to agree is the nicest of the three, and massively reduces the boilerplate.
Took a bit, but I think we finally do have the graphics API to rule them all now :)
Posted Dec 20, 2023 16:32 UTC (Wed)
by kolAflash (subscriber, #168136)
[Link] (2 responses)
Hmm. Sounds like there's a higher risk, that outdated Vulkan applications might not run on newer GPUs. At least higher than it is with OpenGL or WebGL.
Posted Dec 21, 2023 5:50 UTC (Thu)
by joib (subscriber, #8541)
[Link]
Then again, it's hard to imagine OpenGL with all its implicit state and fundamentally single threaded architecture, being a particularly good match to any conceivable future GPU architecture either, despite being a somewhat higher level interface than Vulkan.
Posted Dec 21, 2023 11:16 UTC (Thu)
by farnz (subscriber, #17727)
[Link]
Not really. OpenGL comes from an era where the GPU was expected to have a lot of stateful, fixed-function hardware, and thus the only way to program it was to set the state in registers and trigger the hardware to do its thing. That's not the current direction of travel for any form of compute, and hasn't been for a long time, and we have emulated this model by having all the state live in software that sends GPU programs over to the GPU to execute.
Vulkan's underlying model is of multiple execution engines processing queues of commands, where the state for each engine is stored in a block of memory, and the execution engine is responsible for managing state changes when the state pointer is changed. This is a common model for compute acceleration hardware like GPUs, because it's trivial to context-switch; change the state pointer associated with the engine, and you've changed contexts. And in practice, this also works well if your hardware is designed to be stateless; when you submit a block of work to the hardware, you include the necessary state from a software copy.
Further, Vulkan's model works well if the GPU is a shared resource; you submit work in batches, and can wait for a batch to complete; the underlying drivers and hardware can choose which batches to execute when. The OpenGL model doesn't work in this case; you are expected to claim the hardware, do your graphics stuff, release the hardware.
Posted Dec 19, 2023 20:18 UTC (Tue)
by randomguy3 (subscriber, #71063)
[Link]
Posted Dec 19, 2023 22:14 UTC (Tue)
by atnot (subscriber, #124910)
[Link] (1 responses)
I don't think this is a perfect analogy. Vulkan is actually pretty fine to program it once you've got it set up. There is just a lot to configure, because it turns out that displaying a triangle on a screen is actually an incredibly complex task. The beauty of GPUs and the Vulkan API compared to it's predecessors is that once you've done all of that work to set things up, displaying a single triangle is about as hard as displaying a billion triangles. Once you've got a triangle, it's up to you what you want to fill your buffers with.
It kind of actually is like LLVM IR in that respect actually. Making a code generator that outputs the basic arithmetic instructions and control flow is a lot of work. But once you've got that, it's 90% of what you'll ever need.
Posted Dec 20, 2023 9:41 UTC (Wed)
by WolfWings (subscriber, #56790)
[Link]
Vulkan is nothing like that or LLVM intermediate, it's just... not hiding ANY complexity. It's like writing code for a PSX era hardware where you literally have to track EVERYTHING.
Posted Dec 20, 2023 1:11 UTC (Wed)
by animats (guest, #168630)
[Link] (1 responses)
I use Rend3/WGPU. WGPU is an abstraction layer which supports Vulkan, Direct-X 11 and 12, and Apple's Metal. This is a standard 3D graphics library for Rust.
Above that, you have a choice of game engines and libraries. Godot is widely used for C++ game dev. There's Bevy, for Rust game dev, and the somewhat bleeding edge Rend3, which offers a clean, safe interface for Rust 3D graphics but is not a full game engine. All open source, of course.
Here's some video generated with Rend3, running on Ubuntu Linux 22.04.3 LTS with an NVidia 3070 GPU.
Posted Dec 20, 2023 16:29 UTC (Wed)
by kolAflash (subscriber, #168136)
[Link]
The Linux graphics stack in a nutshell, part 1
The Linux graphics stack in a nutshell, part 1
The Linux graphics stack in a nutshell, part 1
The Linux graphics stack in a nutshell, part 1
The Linux graphics stack in a nutshell, part 1
> I think most of the verbosity of Vulkan is because it exposes the complex architecture of modern GPUs;
Is that correct?
The Linux graphics stack in a nutshell, part 1
The Linux graphics stack in a nutshell, part 1
The Linux graphics stack in a nutshell, part 1
The Linux graphics stack in a nutshell, part 1
The Linux graphics stack in a nutshell, part 1
Useful levels above Vulkan
Useful levels above Vulkan
https://www.phoronix.com/news/SuperTuxKart-1.4
And there are a lot of commercial engines with Vulkan support like Unity3D or the Unreal Engine.