Vulkan update: version 1.2 conformance for Raspberry Pi 4
raspberrypi.com
raspberrypi.com
Jan 31st, 2020 First Triangle - https://www.raspberrypi.com/news/vulkan-raspberry-pi-first-t...
Jun 9th, 2020 Vulkan Youtube Demos From Mike Hooper - https://www.youtube.com/watch?v=ygBB3D5vryw
Jun 9th, 2020 Progress Report 2 - https://www.raspberrypi.com/news/vulkan-update-now-with-adde...
Nov 24th, 2020 Vulkan 1 Conformance - https://www.raspberrypi.com/news/vulkan-update-were-conforma...
August 10, 2021 Nearing Vulkan 1.1 conformance - https://blogs.igalia.com/itoral/2021/08/10/an-update-on-feat...
Oct 26th, 2021 Vulkan 1.1 conformance - https://www.raspberrypi.com/news/vulkan-update-version-1-1-c... Vulkan 1.2 conformance
Aug 1st 2022 Vulkan 1.2 conformance - https://www.raspberrypi.com/news/vulkan-update-version-1-2-c...
Lets see if we can hit Vulkan 1.3 conformance next!
For someone who knows nothing but triangles=good, why OpenGL is a bad abstraction and how Vulkan avoids the same problems?
When OpenGL was designed, the thinking was that graphics programming is hard, and so the API should do the heavy lifting and make the application's job easy. It turns out, though, that graphics programming is so hard that the majority of folk tend to use even higher level graphics libraries to write their applications.
The folk writing those graphics libraries want to make their libraries as optimally performant as possible, and the abstract nature of the OpenGL API stands in the way of doing that. They would rather just directly access the hardware. Vulkan is an API that gives that direct access, within the limitations of running in an unprivileged userspace process.
The Metal API from Apple seems to be just the right abstraction for general graphics programming, though it sucks that you can only use it on Apple devices. Maybe SDL_gpu can take this role once it’s finished, but till then I’m toiling away with Vulkan… yeah it’s still better than OpenGL, but its usability can definitely be improved. Maybe I should have just gone to DirectX 11… since the drivers there are ridiculously optimized.
Though I have my complaints about it, I think bgfx gives a good powerful-but-not-too-complicated abstraction over graphics programming; for some design info, see: https://bkaradzic.github.io/bgfx/internals.html
Would be interested to discuss architecture as there aren't many of us out there and not much of a shared knowledge base. I looked for contact info in your profile but didn't immediately turn it up.
https://www.raylib.com/ https://www.sfml-dev.org/
Or is something like this not what you're looking for?
Are you planning on displaying all/most of them every frame, or just to control that many of them, then draw those nearby/visible?
If it's the former (but how exactly?) then perhaps Vk is the way to go, if the latter, then it's hard to see how Vulkan vs OpenGL is all that relevant here.
The AI for the flying enemies isn’t going to be too complex, it will probably going to be some variation of boid simulation. However I still expect this to be computationally intensive, particularly when it comes to querying nearby entities and terrain. I am expecting some of the expensive geometric querying can be moved to the GPU via compute shaders.
The reason for using Vulkan instead of OpenGL was more of a pragmatic one: I’ve heard that OpenGL drivers can be hilariously bad on Windows, when it comes to both conformance and performance. Vulkan seems to be better in that respect, since both Nvidia and Amd has incentive to develop decent enough Vulkan drivers since some high-profile AAA games use it. Also, it is a pain in the ass to debug issues in OpenGL, and Vulkan is at least better than that.
Here's my fav. rant about it, tldr; GPU Vendors needed a lean API to expose the capabilities of their hardware, and OpenGL: https://www.gamedev.net/forums/topic/666419-what-are-your-op...
* ANGLE ( https://github.com/google/angle ) - An OpenGL ES implementation with Direct3D 9, Direct3D 11, Desktop GL, GL ES, Vulkan and Metal backends. This is what we used to use for shipping our Qt 3D application, that used a bunch of OpenGL Shaders. We used to get bug reports about various shaders not working properly on various hardware. After switching to this, all those bug reports vanished.
* Zinc ( https://www.supergoodcode.com/do-not/ ) - A more recent, OpenGL implementation on top of Vulkan. I haven't used this one yet. But they are making a lot of progress and it is almost as performant as vendor provided OpenGL Drivers these days. So if I ever have to ship a desktop app, needing opengl, I'd strongly consider using this.
By the way do you know how is the current status of the next version of Ogre3D? I’ve heard they were doing a complete overhaul (with a new much performant render system), but I’m not sure if it was actually finished.
Probably not at this stage of your development.
It has been a decade since I really messed with it, but looking at their site Ogre3D Next seems to be coming along, including Vulkan support.
do you think vulkan will progress into being easier and easier to use? is it mature enough? are there good resource to learn the most basics?
The idea is that you use high-level APIs built on top of Vulkan (usually engines like Unity, Unreal or Godot) that then leverage the underlying hardware.
Of course, there can be extensions, but use enough of them and it starts not to make sense to use it for native code.
I don't think that is the goal for Vulkan, nor should it be. Vulkan is a low-level, high-performance API that can be used as the backend for high-level, high-performance libraries and frameworks.
> is it mature enough?
Mature enough for what? It's mature and stable enough that you can develop high-level libraries on top of it. wgpu [1], for example, has a Vulkan backend.
[1] wgpu is a WebGPU implementation; https://github.com/gfx-rs/wgpu
But if you wanted something that was "vulkan but without 1000 lines to make a triangle", that's what Open GL was trying to be 25 years ago. So Vulkan naturally diverged from that model after seeing the weaknesses. I'm unsure if there's any maintained package trying to wrap this stuff; that's something a graphics engineer would end up doing anyways.
OpenGL holds a lot of implicit state in the driver. This makes writing your code a lot easier as you don't have to track all that state yourself. If you want to learn 3D graphics, I'd either start with OpenGL or some "engine" that makes an abstraction that looks a lot like OpenGL.
The problem is that OpenGL state is implicit. Every driver does it differently and there is no way to get at the state via OpenGL. This becomes an issue when you want to optimize--either for maximum performance or for maximum battery life.
Vulkan, on the other hand, makes EVERYTHING explicit. This means that every single transition, barrier, matrix change, byte transfer, etc. is all in your hands. You know exactly what is going on because you have to specify it exactly. But don't get it wrong or your pixels will get eaten by a grue. This is precisely what you want when you absolutely need to optimize your graphics, but, man, is it painful to get right.
One side benefit of the explicit nature of Vulkan carries over to concurrency. Vulkan can actually do multithreading--OpenGL has no hope because of all its implicit state.
The public API state of OpenGL can be queried programmatically and with tooling such as Renderdoc, and it is of course standardized. The hidden state in drivers that you are talking about should only ("only") matter for performance, not correctness. Sometimes it matters for correctness when drivers are buggy, which many are. Driver quality varies widely, with mobile platform OpenGL drivers generally being the worst.
Also if one is feelig adventurous they can make use of switching the OpenGL context on the active thread, although I wouldn't advise that given it isn't portable anyway.
https://docs.microsoft.com/en-us/windows/win32/api/wingdi/nf...
Ironically on Windows, the OS that isn't that much keen into OpenGL.
Vulkan fixes that by stripping these problematic higher-level abstraction layers from the GL. Instead, Vulkan provides low-level access to the GPU hardware.
The triangles are still there usually, but the Vulkan has no GL-like high-level APIs to render them. Instead, in Vulkan we create and update GPU buffers and textures with the source data, create pipeline states (an object containing shaders, input layout, alpha blending, and quite a few other relevant parameters), and finally submit draw calls rendering triangles from buffers, using some pipeline state.
However, others issues are still present. There’s no shaders bytecode, they have an extension to grab compiled shaders from GPU driver to cache on disk, but it doesn’t work. The only way to create shaders is separate compile and link API calls. Texture loading and binding API is still less than ideal.
It's not actually “closer” to the hardware than OpenGL was though, it's just an attempt to define a more predictable abstraction. The underlying architecture of two Vulkan GPUs can be wildly different.
Cool. When I read that bit about exposing hardware I was afraid that meant having to query for various capabilities and adapt ones code to it, which is not an abstraction at all. I'm guessing you can ask which Vulkan capabilities are present, but not actual hardware details?
modern graphics hardware does not work well in this model. they’re really much closer to whole other systems. you want to push the triangle data into the card in a single (or few) API calls, then submit as few draw calls as you can manage.
fun fact, OpenGL 3, originally code named “longs peak”, was supposed to upend the stateful model, and advance the API ahead of its proprietary counter part(s) - DirectX. for what ever reason this completely fell apart, and OpenGL just sort of.. stopped improving :/
we have Vulkan now basically thanks to AMD opening their more modern GPU oriented Mantle API, and valve for running with it.
The biggest problem with OpenGL for is/was the context model that made multi-threading almost impossible. And yes, it being stateful is a big part of it. Plenty advances and low level functionality was available in OpenGL before vulkan was released.
Vulkan also reduces overhead since its abstractions better match today's hardware and it allows excplicitly moving more calculations up front that had to be done just in time with OpenGL.
Also, it's not like Khronos (a standards body made up of industry participants) "refused to advance" but rather that different interests had different ideas - e.g. some care more about backwards compat - so that they can tell their clients that their legacy software runs on the latest OpenGL - than getting the last edge on performance so having a separate 100% performance-oriented API was probably an eventuality anyway.
Also, remember that Microsoft and Apple are/were part of Khronos too and giving these two comanies' incentives and past behaviors it would not be entirely surprising if they did their part to hold back the standard.
const int oldTexture = currentTexture();
switchToTexture(myTexture)
setTextureData(myRgbImage);
switchToTexture(oldTexture);
to: setTextureDataDSA(myTexture, myRgbImage);glBufferSubData?
>then submit as few draw calls as you can manage
glDrawElements?
Nobody used glBegin/glEnd in the past 20 years...
OpenGL 3 deprecated glBegin/glEnd, but there is still state, and a lot of it. none of the OpenGL API is re-entrant, for instance..
However this time they seem to have learned profiles like in proprietary APIs actually make sense.
on the other hand, i'm not so sure that i agree with the approach of advertising even basic functionality (e.g. swapchain) through extensions. i understand vulkan has uses outside of graphics. i think that could have been better exposed with hard profile boundaries or something..
You end up with several code paths, where you have an architecture similar to multiple APIs middleware, but actually it is only using OpenGL, or Vulkan, and jungling among all possible cases.
At least now they got why proprietary APIs use profiles.
Both entertaining and (very) insightful; one of my favorites ever :)
It can't be summarized, although the most significant quote probably is:
> Nearly every game ships broken. We're talking major AAA titles from vendors who are everyday names in the industry.
The correct link (to Promit's comment) is: https://www.gamedev.net/forums/topic/666419-what-are-your-op...
GL is based on a very outdated model of the GPU as a register-based state machine that grew bigger and bigger for decades. Meanwhile, the hardware moved towards being able to switch rapidly between pre-configured structs representing chunks of state. GL drivers have had to reconcile an interface where you make changes incrementally grinding against an implementation where dynamic state is super expensive and lots of pre-configured state is super cheap. Vulkan presents an interface much closer to the current hardware implementations —with all of their problems and opportunities brought to the surface.
It’s one of the reasons OpenWRT has poor support for Broadcom SoCs and Broadcom WiFi-controllers, and in general Broadcom-based devices are shunned in the OpenWRT community.
It seems to be a company-wide thing.
Was it a buddy deal to start with, isn't the rpi founder ex-Broadcom?
1: https://web.archive.org/web/20111024203123/http://www.raspbe...
So that's why it's difficult to run open WRT on BCM chips.
Caveat: I did not get this first or second hand.
There are good ARM SBC alternatives with good community by ODroid and a few other brands for $30-$100. ODroid probably has the biggest and best community outside RPi.
Used thin and zero clients can be had for very cheap and used for low power, low resource needs.
Alternatively, the new ultra low power Jasper Lake CPUs are pretty insane for the price/power and you can get complete mini PCs with "real" nvme or sata storage, dual 4k@60Hz video output, 1 or 2.5Gbit Ethernet for $150-250. Search for n5095 (15W TDP), n5100 (6W), n5105 (10W), n6000 (6W), or n6105 (10 W) mini PC on Amazon. The iGPUs on these are killer and can handle 2-3 4k transcodes too. They make great media/storage servers (that's what I'm using one I just bought for)
I love SBCs, homelabbing, and squeezing as much out of hardware per watt and dollar. Liliputing and ServetheHome have been great resources.
A 4-thread machine with case, heat sink, power supply, 8gb ram, and an SSD can be had for less than the MSRP of a bare 8GB RPi 4.
One downside is power: the thin clients generally idle around 5-10W and use 20W or more at peak; compared to the Pi which will idle at 2 watts and use 10W peak.
http://parkytowers.me.uk/thin/ is a great resource for understanding the different models that are available.
Adafruit appears to be the best resource for ordering Pis in the US as they require you log in with MFA and limit purchases. That is, if you're just in the market for a single unit.
Also, as the article mentions, there's a fork of Android that runs on a Raspberry Pi, and there are already Android games that will take advantage of Vulkan 1.2 support.
Also probably Android games.