Simplifying Vulkan one subsystem at a time

(khronos.org)

132 points | by amazari 5 hours ago ago

37 comments

  • kvark 2 hours ago

    The main problem with Vulkan isn't the programming model or the lack of features. These are tackled by Khronos. The problem is with coverage and update distribution. It's all over the place! If you develop general purpose software (like Zed), you can't assume that even the basic things like dynamic rendering are supported uniformly. There are always weird systems with old drivers (looking at Ubuntu 22 LTS), hardware vendors abandoning and forcefully deprecating the working hardware, and of course driver bugs... So, by the time I'm going to be able to rely on the new shiny descriptor heap/buffer features, I'll have more gray hair and other things on the horizon.

    • zamalek 32 minutes ago

      > Ubuntu LTS

      This is why I try to encourage new Linux users away from Ubuntu: it's a laggard with, often important, functionality. It is now an enterprise OS (where durability is more important than functionality), it's not really suitable for a power user (like someone who would use Zed).

      • BadBadJellyBean 12 minutes ago

        You don't have to run LTS. There is a new release every 6 months.

      • adithyassekhar 30 minutes ago

        Which one would you recommend for regular users and power users?

        • zamalek 17 minutes ago

          If you want something relatively uninteresting: Fedora or Debian (honestly, stable is fine).

          If you want something extremely reliable, more modern, but may require some learning to tweak: Silverblue or Kinoite.

        • stalfosknight a minute ago

          Arch or Endeavour

        • horsawlarway 20 minutes ago

          Not joking, Arch. Pick Gnome/KDE/Sway as you please.

          Arch is a wonderful daily driver distro for folks who can deal with even a small amount of configuration.

          Excellent software availability through AUR, excellent update times (pretty much immediate).

          The only downside is there's not a ton of direct commercial software packaged for it by default (ex - most companies they care give a .deb or a .rpm) but that's easily made up for by the rest of AUR.

          It's not even particularly hard to install anymore - run `archinstall` https://wiki.archlinux.org/title/Archinstall make some choices, get a decent distro.

          Throw in that steam support is pretty great... and it's generally one of the best distros available right now for general use by even a moderate user.

          Also fine as a daily driver for kids/spouses as long as there's someone in the house to run pacman every now and then, or help install new stuff.

        • jauntywundrkind 25 minutes ago

          Debian/testing, with stable pinned on at low priority.

          It slows down for a couple months around release, but generally provides pretty reliable & up to date experience with a very good OS.

          Dance dance the red spiral.

    • m-schuetz an hour ago

      Tbh, we should more readily abandon GPU vendors that refuse to go with the times. If we cater to them for too long, they have no reason to adapt.

      • afandian 34 minutes ago

        I had a relatively recent graphics card (5 years old perhaps?). I don't care about 3D or games, or whatever.

        So I was sad not to be able to run a text editor (let's be honest, Zed is nice but it's just displaying text). And somehow the non-accelerated version is eating 24 cores. Just for text.

        https://github.com/zed-industries/zed/discussions/23623

        I ended up buying a new graphics card in the end.

        I just wish everyone could get along somehow.

      • hyperman1 29 minutes ago

        No. I remember a phone app ( Whatsapp?) doggedly supporting every godforsaken phone, even the nokias with the zillion incompatible Java versions. A developer should go where the customers are.

        What does help is an industry accepted benchmark, easily ran by everyone. I remember browser css being all over the place, until that whatsitsname benchmark (with the smiley face) demonstrated which emperors had no clothes. Everyone could surf to the test and check how well their favorite browser did. Scores went up quickly, and today, css is in a lot better shape.

      • Octoth0rpe 25 minutes ago

        > we should more readily abandon GPU vendors

        This was so much more practical before the market coalesced to just 3 players. Matrox, it's time for your comeback arc! and maybe a desktop pcie packaging for mali?

  • pjmlp 2 hours ago

    At least they are making an effort to correct the extension spaghetti, already worse than OpenGL.

    Addiitionally most of these fixes aren't coming into Android, now getting WebGPU for Java/Kotlin[0] after so many refused to move away from OpenGL ES, and naturally any card not lucky to get new driver releases.

    Still, better now than never.

    [0] - https://developer.android.com/jetpack/androidx/releases/webg...

    • kllrnohj 12 minutes ago

      > Addiitionally most of these fixes aren't coming into Android

      The fuck are you talking about? Of course they'll come to Android

  • jabl 15 minutes ago

    Does this evolution of the Vulkan API get closer to the model explained in https://www.sebastianaaltonen.com/blog/no-graphics-api which we discussed in https://news.ycombinator.com/item?id=46293062 ?

    • rkevingibson 3 minutes ago

      Yes, you can get very close to that API with this extension + existing Vulkan extensions. The main difference is that you still kind of need opaque buffer and texture objects instead of raw pointers, but you can get GPU pointers for them and still work with those. In theory I think you could do the malloc API design there but it's fairly unintuitive in Vulkan and you'd still need VkBuffers internally even if you didn't expose them in a wrapper layer. I've got a (not yet ready for public) wrapper on Vulkan that mostly matches this blog post, and so far it's been a really lovely way to do graphics programming.

      The main thing that's not possible at all on top of Vulkan is his signals API, which I would enjoy seeing - it could be done if timeline semaphores could be waited on/signalled inside a command buffer, rather than just on submission boundaries. Not sure how feasible that is with existing hardware though.

    • flohofwoe 3 minutes ago

      It's a baby-step in this direction, e.g. from Seb's article:

      > Vulkan’s VK_EXT_descriptor_buffer (https://www.khronos.org/blog/vk-ext-descriptor-buffer) extension (2022) is similar to my proposal, allowing direct CPU and GPU write. It is supported by most vendors, but unfortunately is not part of the Vulkan 1.4 core spec.

      The new `VK_EXT_descriptor_heap` described in the Khronos post is a followup extension which fixes some problems with `VK_EXT_descriptor_buffer` but otherwise is the same basic idea (e.g. "descriptors are just memory").

  • hmry 4 hours ago

    I'm really enjoying these changes. Going from render passes to dynamic rendering really simplified my code. I wonder how this new feature compares to existing bindless rendering.

    From the linked video, "Feature parity with OpenCL" is the thing I'm most looking forward to.

    • exDM69 4 hours ago

      You can use descriptor heaps with existing bindless shaders if you configure the optional "root signature".

      However it looks like it's simpler to change your shaders (if you can) to use the new GLSL/SPIR-V functionality (or Slang) and don't specify the root signature at all (it's complex and verbose).

      Descriptor heaps really reduce the amount of setup code needed, with pipeline layouts gone you can drop like third of the code needed to get started.

      Similar in magnitude to dynamic rendering.

      • flohofwoe 3 hours ago

        Having quite recently written a (still experimental) Vulkan backend for sokol_gfx.h, my impression is that starting with `VK_EXT_descriptor_buffer` (soon-ish to be replaced with `VK_EXT_descriptor_heap`), the "core API" is in pretty good shape now (with the remaining problem that all the outdated and depreciated sediment layers are still part of the core API, this should really be kicked out - e.g. when I explicitly request a specific API version like 1.4 I don't care about any features that have been deprecated in versions up to 1.4 and I don't care about any extensions that have been incorporated into the core API up until 1.4, so I'd really like to have them at least not show up in the Vulkan header so that code completion cannot sneak in outdated code (like EXT/KHR postfixes for things that have been moved into core).

        The current OpenGL-like sediment-layer-model (e.g. never remove old stuff) is extremely confusing when not following Vulkan development very closely since 2016, since there's often 5 ways to do the same thing, 3 of which are deprecated - but finding out whether a feature is deprecated is its own sidequest.

        What I actually wrestled with most was getting the outer frame-loop right without validation layer errors. I feel like this should be the next thing which the "Eye of Khronos" should focus on.

        All official tutorial/example code I've tried doesn't run without swapchain-sync-related validation errors on one or another configuration. Even this 'best practices' example code which demonstrates how to do the frame-loop scaffolding correctly produces valiation layer errors, so it's also quite useless:

        https://docs.vulkan.org/guide/latest/swapchain_semaphore_reu...

        What's worse: different hardware/driver combos produce different validation layer errors (even in the swapchain-code which really shouldn't have different implementations across GPU vendors - e.g. shouldn't Khronos provide common reference code for those GPU-independent parts of drivers?). I wonder if there is actually any Vulkan code out there which is completely validation-layer-clean across all possible configs (I seriously doubt it).

        Also the VK_[EXT/KHR]_swapchain_maintenance1 extension which is supposed to fix all those little warts has such a low coverage that it's not worth supporting (but it should really be part of the core API by now - the extension is from 2019).

        Anyway... baby steps into the right direction, only a shame that it took a decade ;)

        • reactordev 2 hours ago

          Vulkan is by far the most powerful and the most pain in the ass API I've ever worked with. I agree on every point you just made.

          • jorvi 31 minutes ago

            Isn't the idea that 99% of people use a toolkit atop of Vulkan?

            Like, these days game devs just use Unreal Engine, which abstracts away having to work with the PS5 / PS4, DirectX 12, and Vulkan APIs.

            I imagine unless it's either for A. edification or B. very bespoke purpose code, you're not touching Vulkan.

            • flohofwoe 15 minutes ago

              > Isn't the idea that 99% of people use a toolkit atop of Vulkan?

              This idea creates a serious chicken-egg-problem.

              Two or three popular engine code bases sitting on top of Vulkan isn't enough 'critical mass' to get robust and high performance Vulkan drivers. When there's so little diversity in the code hammering on the Vulkan API it's unlikely that all the little bugs and performance problems lurking in the drivers will be triggered and fixed, especially when most Unity or Unreal game projects will simply select the D3D11 or D3D12 backend since their main target platform is Windows.

              Similar problem to when GLQuake was the only popular OpenGL game, as soon as your own code used the GL API in a slightly different way than Quake did all kinds of things broke since those GL drivers only properly implemented and tested the GL subset used by GLQuake.

              From what I've seen so far, the MESA Vulkan drivers on Linux seem to be in much better shape than the average Windows Vulkan driver. The only explanation I have for this is that there are hardly any Windows games running on top of Vulkan (instead they use D3D11 or D3D12), while running those same D3D11/D3D12 games on Linux via Proton always goes through the Vulkan driver. So on Linux there may be more 'evolutionary pressure' to get high quality Vulkan drivers indirectly via D3D11/D3D12 games that run via Proton.

            • m-schuetz 25 minutes ago

              Many people need something in-between heavy frameworks and engines or oppinionated wrappers with questionable support on top of Vulkan; and Vulkan itself. OpenGL served that purpose perfectly, but it's unfortunately abandoned.

      • sho_hn 2 hours ago

        Are there any good Vulkan tutorials that are continuously updated to reflect these advancement and ease of use improvements?

        It's a similar challenge to the many different historical strata of C++ resources.

        • jsheard 2 hours ago

          https://howtovulkan.com is a recent one which targets the modern flavour of Vulkan that everything supports today.

          Well, all desktop hardware and drivers at least. God help you if you want to ship on Android.

        • dismalaf 2 hours ago

          The one on Vulkan.org recently got updated to use dynamic rendering and a bunch of the newest features (plus modern C++, Slang instead of glsl, etc...).

          https://docs.vulkan.org/tutorial/latest/00_Introduction.html

        • positron26 2 hours ago

          Finding the optimal sub-language is about API coupling with client code, making a moving sweet spot for where bread & butter techniques live.

  • pixelpoet 2 hours ago

    I would like to / am "supposed to" use Vulkan but it's a massive pain coming from OpenCL, with all kinds of issues that need safe handling which simply don't come from OpenCL workloads.

    Everyone keeps telling me OpenCL is deprecated (which is true, although it's also true that it continues to work superbly in 2026) but there isn't a good / official OpenCL to Vulkan wrapper out there to justify it for what I do.

  • jauntywundrkind 19 minutes ago

    How are folks feeling about WebGPU these days?

    Once Vulkan is finally in good order, descriptor_heap and others, I really really hope we can get a WebGPU.next.

    Where are we at with the "what's next for webgpu" post, from 5 quarters ago? https://developer.chrome.com/blog/next-for-webgpu https://news.ycombinator.com/item?id=42209272

    • yu3zhou4 4 minutes ago

      I try my best to push ML things into WebGPU and I think it has a future, but performance is not there yet. I have little experience with Vulkan except toy projects, but WebGPU and Vulkan seem very similar

    • m-schuetz 15 minutes ago

      WebGPU is kinda meh, a 2010s graphic programmers vision of a modern API. It follows Vulkan 1.0, and while Vulkan is finally getting rid of most of the mess like pipelines, WebGPU went all in. It's surprisingly cumbersome to bind stuff to shaders, and everything is static and has to be hashed&cached, which sucks for streaming/LOD systems. Nowadays you can easily pass arbitrary amounts of buffers and entire scene descriptions via GPU memory pointers to OpenGL, Vulkan, CUDA, etc. with BDA and change them dynamically each frame. But not in WebGPU which does not support BDA und is unlikely to support it anytime soon.

      It's also disappointing that OpenGL 4.6, released in 2017, is a decade ahead of WebGPU.

      • kllrnohj 8 minutes ago

        WebGPU has the problem of needing to handle the lowest common denominator (so GLES 3 if not GLES 2 because of low end mobile), and also needing to deal with Apple's refusal to do anything with even a hint of Khronos (hence why no SPIR-V even though literally everything else including DirectX has adopted it)

        Web graphics have never and will never be cutting edge, they can't as they have to sit on top of browsers that have to already have those features available to it. It can only ever build on top of something lower level. That's not inherently bad, not everything needs cutting edge, but "it's outdated" is also just inherently going to be always true.

        • m-schuetz 4 minutes ago

          I understand not being cutting-edge. But having a feature-set from 2010 is...not great.

  • HexDecOctBin 3 hours ago

    I personally just switched to using push descriptors everywhere. On desktops, the real world limits are high enough that it end up working out fine and you get a nice immediate mode API like OpenGL.

    • exDM69 2 hours ago

      That's the right way to go for simple use cases and especially getting started on a new project.

  • m-schuetz 2 hours ago

    I suspect we are only 5-10 years away until Vulkan is finaly usable. There are so many completely needlessly complex things, or things that should have an easy-path for the common case.

    BDA, dynamic rendering and shader objects almost make Vulkan bearable. What's still sorely missing is a single-line device malloc, a default queue that can be used without ever touching the queue family API, and an entirely descriptor-free code path. The latter would involve making the NV bindless extension the standard which simply gives you handles to textures, without making you manage descriptor buffers/sets/heaps. Maybe also put an easy-path for synchronization on that list and making the explicit API optional.

    Until then I'll keep enjoying OpenGL 4.6, which already had BDA with c-style pointer syntax in glsl shaders since 2010 (NV_shader_buffer_load), and which allows hassle-free buffer allocation and descriptor-set-free bindless textures.