Vulkan vs. OpenGL

  Рет қаралды 23,352

ForceofPhoenix

ForceofPhoenix

2 ай бұрын

I remade the same minecraft like game in OpenGL and Vulkan. Both versions rendering 64x64 chunks. (vulkan renders slightly more verticies than opengl because outer walls are also meshed). As you can see vulkan is pushing more frames than GL because of little cpu overhead. Instead of submitting each vertex one after another you can pass all draw commands with one submit command to the gpu. Both projects are completely coded in C. Vulkan utelizes my own allocator.

Пікірлер: 111
@forceofphoenix
@forceofphoenix 22 күн бұрын
Reminder: OpenGL Example uses multiple gldraw commands while vulkans submits one command buffer for one frame
@brockdaniel8845
@brockdaniel8845 2 ай бұрын
The length of the OpenGL code vs Vulkan 😵
@0011110000111110
@0011110000111110 14 күн бұрын
How could anyone call this a step forward?
@iambored1528
@iambored1528 14 күн бұрын
@@0011110000111110ah yes, because more code = worse 🤪 vulkan has much less abstraction than opengl, making it much faster but taking a bit more code to get working
@mek101whatif7
@mek101whatif7 13 күн бұрын
​@@0011110000111110 literally 3+ times the performance
@0011110000111110
@0011110000111110 12 күн бұрын
@@mek101whatif7 But the code length.. if the same exact behavior was already described concisely with what seemed like less than 3x shorter code, they should have written the longer version with a compiler, not required the programmer to do all the extra work.
@SchitzPseudonym
@SchitzPseudonym 9 күн бұрын
@@0011110000111110 What do you actually mean by "written a longer version with a compiler"? Are you suggesting someone write assembly? or write their own compiler? Have you considered the implications of the scope of such a project? Is the verbose but finer control more detrimental to DX than the worth of improved runtime performance? What opinion are you even sharing?
@thetastefultoastie6077
@thetastefultoastie6077 Ай бұрын
This is an apples-to-oranges comparison: The Vulkan application draws the entire scene with a single API call, but you didn't do this for the OpenGL application, instead drawing each chunk one-by-one, and therefore it is slower. Using glMultiDrawElementsIndirect the performance should be practically the same. That might actually be a meaningful API comparison for a more complex scene.
@MaDPuPPeTgames
@MaDPuPPeTgames Күн бұрын
the example looks bad since its rendering the same static trees over and over. if your rendering completely differnt meshes and moving them, vulkan would also outperform opengl but this time it would be much harder for opengl to catch up.
@126sivgucsivanshgupta2
@126sivgucsivanshgupta2 Күн бұрын
Not exactly Yes vulkan does a single command buffer submit, but to record that command buffer, they might have used the same amounts of vkDraws (which is same as glDraw commands) Opengl also does the same thing, it batches all the draws and executes them together at the end (unless you specifically try to flush the draws) In this case, this comparison is comparing 2 baddly implemented renderers in 2 different apis Opengl renderers can be much better using indirect draws (essentially trying to achieve zero driver overhead, aka azdo) The reason why vulkan is better is because it allows for better manual sync opportunities which is required for true azdo renderers, which in case of openGL, u don't because each sync call will have some overhead
@ALEKSCRAFTPLAYY
@ALEKSCRAFTPLAYY Ай бұрын
For me. OpenGL: Compatibility Vulkan: Performance
@somedudenamedanthony
@somedudenamedanthony 27 күн бұрын
Not particularly, Vulkan can be terrible for platforms and hardware that has a bad implementation of Vulkan. An example is amdvlk vs. vulkan-radeon on Linux/BSD. Same goes for OpenGL(ES). Bottom of the line is that you use should the graphics API best suited for whatever platform. Direct3D/2D for Windows NT, Metal for (Desktop) Darwin (e.g. macOS/Mac OS X), Vulkan for Modern (Desktop) Linux/BSD, OpenGLES for Mobile Darwin and Linux (e.g. Android, IOS/tvOS/iPadOS,etc) OpenGL for legacy kernels like System (x) UNIX or Linux 4 or older.
@nic5973
@nic5973 25 күн бұрын
​@@somedudenamedanthonyI have always had a performance problem of Vulkan in my computer. It also has problems in Direct8 and 9 games, but runs Direct 10 and above just fine Is there any fix to those issues?
@somedudenamedanthony
@somedudenamedanthony 25 күн бұрын
​@@nic5973 Assuming you're on Windows, I've also had a lot of problems with Direct3D8/9 games running horribly, either with tons of micro-stutter or graphics bugs, (an example being Sonic Adventure DX.) This might be an issue exclusive to AMD hardware (the computer I have, like a driver issue. It could possibly a Windows bug too.
@fyfbifvodefin9383
@fyfbifvodefin9383 24 күн бұрын
It’s better to use wgpu library, which available for many languages and which abstracts multiple graphics apis in one mid level api. Using wgpu you will get both cross platform support and cross api support
@somedudenamedanthony
@somedudenamedanthony 24 күн бұрын
@@fyfbifvodefin9383 I think you're forgetting the fact that webgpu requires a WEB BROWSER to function. Sometimes creating a web application just isn't feasible, and no Node WebKit "nwjs" and Electron do NOT count as "native" alternatives.
@Qohist
@Qohist 2 ай бұрын
the drawback of vulkan is that it needs more boilerplate and is more explicit than opengl so most people that are doing a real game just alone by them selves would choose opengl or webgpu which has abstractions over graphics apis and is easier than vulkan and is comparable
@networkgeekstuff9090
@networkgeekstuff9090 2 ай бұрын
Yeah, remins me of what John Carmack once said when multi-CPU systems started to took off in early 2000s that he would always rather prefer one infinitelly fast core than to introduce the complexity of scaling on any milti-cpu system. Those boilerplates are exactly the manifestation of negatives of the fact that we hit silicone limits in the frequencies some 15 years ago. Let's see what AI assisted programmings will do with indie scene as a compensation. The best gaming creativity today is in very small indie teams and for them anything that introduces more background coding work can mean a death of a project.
@overdev1993
@overdev1993 Ай бұрын
yeah and most people won't write their own renderer / engine to begin with if they just want to a game on their own
@_GhostMiner
@_GhostMiner Ай бұрын
Webgpu? So webgl is obsolete now?
@Qohist
@Qohist Ай бұрын
@@_GhostMiner yes but wgpu can also run natively it compiles into vulkan opengl directx12 and metal
@_GhostMiner
@_GhostMiner Ай бұрын
@@Qohist wdym "and metal"?
@diguifi0fficial
@diguifi0fficial 2 ай бұрын
When I saw 500+ fps I though it couldnt get much better than this. I was wrong.
@marclurr
@marclurr Ай бұрын
Fps is kind of meaningless for this kind of benchmark. For example, 500fps is 2ms per frame, 1000fps is only 1ms per frame faster. The more useful metric to look at is frame time.
@j2sk
@j2sk 2 ай бұрын
I dont remember the last time i see a raw direct and simple comparison of ogl vs vulkan, does vulkan win this big too under max workload at capped fps? Like how many workload it can take before dipping below capped fps?
@forceofphoenix
@forceofphoenix 2 ай бұрын
the diffrence would be not as huge. With low fps the gpu is the bottleneck
@kolosso305
@kolosso305 2 ай бұрын
didn't know the difference was that stark, thanks for posting this
@forceofphoenix
@forceofphoenix 2 ай бұрын
Vulkan is just utelizing more of the gpu due to lower cpu bottleneck
@tacokoneko
@tacokoneko Ай бұрын
is it the same on linux? also on linux the zink opengl driver implemented on top of the system vulkan driver has been reported to have better performance than the traditional opengl driver by itself. could you test all 3?
@volchonokilliR
@volchonokilliR Ай бұрын
Note that power consumption is 100 W vs 280 W. A big giveaway on the actual hardware utilization
@andyandrew2453
@andyandrew2453 Ай бұрын
No wonder phones back then were considered slow... It was actually the Vulkan slowing them down...
@KimTiger777
@KimTiger777 2 ай бұрын
It bogles my mind that Notch didn't use C, it would have been soo much faster and efficient than Java. Also the loading time would be magnitude faster. I just heard that he is trying to make a dungeon crawler in Java, like dude WTF why use the slow tech? For me performance is alpha omega.
@outervale
@outervale 2 ай бұрын
Java is what he knew. He simply chose to use what he was familiar with. It's worth noting that nobody ever really expected Minecraft to get to the size it has.
@clavicol6875
@clavicol6875 2 ай бұрын
And right now, he is also coding a dungeon game with javascript. I guess he just likes those languages.
@forceofphoenix
@forceofphoenix 2 ай бұрын
My goal is to make it as fast as possible. The world you see here is created in 0.012 seconds and meshed in 0.18 seconds. Vulkan instance creation takes ~ 0,15 seconds (because its doing very much stuff in the background). The rest of the 0,9 seconds is copying data on the gpu due to poor optimization from myself. But when i start 1.20.2 i wonder why tf it takes 20 seconds to just open the world creation menu ....
@thelocalespada5956
@thelocalespada5956 2 ай бұрын
@@forceofphoenixWhat are your specs? The good thing about having it coded by java is that without java sodium and iris or rubidium and oculus probably wouldn't exist, I mean do you see sodium on minecraft bedrock which is coded with c++? I generally think the java version is just better in general with how much freedom it has, and the way you turn feels a lot better than in the c++ version. The game just feels better in the java one for me. Right now I have an i7 4790, a gtx 1650 super, and 32 gb ram. but I will be upgrading to an i5 11400f, an rtx 3060, and 64 gb ram on my birthday in 2 months
@forceofphoenix
@forceofphoenix 2 ай бұрын
@@thelocalespada5956 As a mod dev with 6 mio downloads on cf i can totally agree. But modding the closed source minecraft is ripping up the bytecode from Java inserting your own Code and hope that it starts. My plan is to implement a native luaJIT modding system that has full access over the internal functions
@0011110000111110
@0011110000111110 14 күн бұрын
I wish you'd used the same allocator on both scenes, and tried to do both APIs as similarly as possible otherwise. But this was helpful, thanks.
@vephovandenberg3181
@vephovandenberg3181 2 ай бұрын
So basically it is possible to write a efficient voxel raytracer, if I noticed correctly with your demonstration, in OpenGL. And what is the chunk size, friend?
@forceofphoenix
@forceofphoenix 2 ай бұрын
This is Not a raytracer. It meshes the chunks (16x16x256)
@vephovandenberg3181
@vephovandenberg3181 2 ай бұрын
@@forceofphoenix I see
@orangehatmusic225
@orangehatmusic225 2 ай бұрын
I don't think you are getting enough FPS there with the vulkan one.
@forceofphoenix
@forceofphoenix 2 ай бұрын
Especially memory transfer operations could be optimized further ...
@avarise5607
@avarise5607 2 ай бұрын
Vulkan is bug difference not only in single GPU utilization, but also in multiple GPU utilization! Maybe some of you remember nvidia attempts to make dual GPU work, but in the end you always end up with something like maybe 150% of 1 GPU power, instead of 200%. Vulkan allows you to get that 200%, without any crosslinks, because of the software differences. Essentially, Vulkan treats each GPU separately, you can issue vastly different parts of workflow to any number of GPUs connected. You can do this for example, by creating 1 Graphics queue and separate compute queue. PCI is your crosslink to transfer data between CPUs, but even then, if you get GPU's which by design can pool their memory, then you can truly achieve ridiculous compute power, all synced by single CPU.
@jd_bruce
@jd_bruce 2 ай бұрын
Can't you just create a single vertex buffer in OpenGL instead of submitting each vertex one after the other?
@forceofphoenix
@forceofphoenix 2 ай бұрын
Of course, but when you break a block the whole map needs to be remashed, which is 4096 times slower than meshing one chunk
@xeqqail3546
@xeqqail3546 2 ай бұрын
This is nice!
@king_james_official
@king_james_official 2 ай бұрын
in r6s it doesn't make a big difference, but i guess that they just didn't really optimize it too much?
@ew2430
@ew2430 2 ай бұрын
Hey is there any specific reason why you don’t use c++?
@forceofphoenix
@forceofphoenix 2 ай бұрын
I think C is much cleaner and I Write more performant Code
@valsk01
@valsk01 Ай бұрын
@@forceofphoenix agreed + there is no "dynamic memory allocation with the functionaly static overloaded operator named '+' (plus) which takes in int x"
@Nodal488
@Nodal488 Ай бұрын
C++ is bloated, sometimes it feels really great to go back to C. Until you need a generic container x)
@valsk01
@valsk01 Ай бұрын
@@Nodal488 ye... im in that cycle xD
@Pedro-S1lva
@Pedro-S1lva 2 ай бұрын
really cool
@valentinleguizamon9957
@valentinleguizamon9957 21 күн бұрын
THANKSSS!!
@alejandro9609
@alejandro9609 2 ай бұрын
opengl tambien puede enviar todos los comandos en un buffer....te felicito buen video
@DurpMustard
@DurpMustard 26 күн бұрын
And this is why SGI workstations used GL
@Marius-ir1qn
@Marius-ir1qn Ай бұрын
Man, if you don't know OpenGL, don't make a video about it. Yes, OpenGL cope harder with threading but if you do it right even in single instance you could get to a relatively close performance to vulkan.
@forceofphoenix
@forceofphoenix Ай бұрын
Is there a way in opengl to copy multiple buffers inside the gpu in parallel? In my newer videos you see that this reduces time for copying -> higher fps single threaded
@Marius-ir1qn
@Marius-ir1qn Ай бұрын
@@forceofphoenix Yes, use buffer objects. Though I would argue that for a simple scene with repetitive objects you could get very far by using batching or instancing.
@forceofphoenix
@forceofphoenix Ай бұрын
@@Marius-ir1qn In the end, performance mostly depends not on the API or GPU, but on the skill of the programmer.
@oh-facts
@oh-facts Ай бұрын
@Marius-ir1qn Could you elaborate on the problem he had with opengl + your solution? Why does using a buffer object (ssbo?) help with copying? What is being copied? Why is it being copied? Thanks!
@iogilarb
@iogilarb Ай бұрын
i don't get it, which one is the best?
@forceofphoenix
@forceofphoenix Ай бұрын
The Coder who uses the full capabilities of vulkan will probably get more performance out of the hardware
@maxiluaces505
@maxiluaces505 2 ай бұрын
awesome. ps: 1608 line code Vulkan - 145 line code OGL lol
@forceofphoenix
@forceofphoenix 2 ай бұрын
Its not the hole code, opengl projekt is about 77k chars and vulkan 137k chars
@volchonokilliR
@volchonokilliR Ай бұрын
When saw 500 FPS thought "Hm... Not much, but alright for an experiment I guess" then I saw it was on 4090 xwx ...
@volchonokilliR
@volchonokilliR Ай бұрын
Nice layout of initializing Vulkan
@novygaming5713
@novygaming5713 Ай бұрын
You can easily get up to 14000 fps with memory optimization and optimizing communication between cpu and gpu
@forceofphoenix
@forceofphoenix Ай бұрын
do you know a monitor that has 14000 fps? xD
@novygaming5713
@novygaming5713 Ай бұрын
@forceofphoenix well no I'm not talking about speed. If flying around and looking at cool simple shaded cubes is all there is to the game, then it's good enough. I'm talking about optimizing the rendering for stability and actual use.
@depralexcrimson
@depralexcrimson Ай бұрын
@@novygaming5713 yeah honestly the comparison isn't even impressive. OGL with a couple of chunks with some blocks and very basic trees - wow very cool, but nothing is happening of value and everything is opaque, compare it to default minecraft written in java which is an actual fully-fledged game that actually renders and calculates stuff... you can manage that fps even on non-modded minecraft.
@AE4i1
@AE4i1 27 күн бұрын
In vulkan or opengl? If you have any resources for vulkan how to optimize communication between cpu and gpu, please give me a link 🙏
@rostus_official
@rostus_official 23 күн бұрын
Minuses of Vulkan: HLSL Pluses of Vulkan: RTX Library
@wouf_
@wouf_ Ай бұрын
Yea but vulkan is a pain to work with
@clement8181
@clement8181 11 күн бұрын
3% gpu usage is crazy
@forceofphoenix
@forceofphoenix 11 күн бұрын
i think the overlay was broken. i doubt at 300W its running at 3%
@artemmentiy7107
@artemmentiy7107 Ай бұрын
Cool, but i'm sure you can get much better fps in these scenes with your 4090 )))
@forceofphoenix
@forceofphoenix Ай бұрын
look at my newer videos
@_GhostMiner
@_GhostMiner Ай бұрын
Why are you rendering million minecraft trees?
@forceofphoenix
@forceofphoenix Ай бұрын
because i can
@mon1star215
@mon1star215 28 күн бұрын
openGL is old, are Vulkan is new?
@forceofphoenix
@forceofphoenix 28 күн бұрын
yes
@supermamoru
@supermamoru 28 күн бұрын
Both: Minecraft
@kfj795
@kfj795 Ай бұрын
It's time to leave opengl behind as it is outdated and more modern APIs such as Vulcan perform much better. Especially for mobile, Vulkan is king
@shekspirept
@shekspirept 10 күн бұрын
окак
@jamesblackburn8378
@jamesblackburn8378 25 күн бұрын
This is a misleading comparison, I assure you that you can achieve almost the same level as performance as Vulkan with a better OpenGL implementation.
@forceofphoenix
@forceofphoenix 25 күн бұрын
yeah you can totally do it, but i didnt.
@jamesblackburn8378
@jamesblackburn8378 24 күн бұрын
@@forceofphoenix me when i spread misinformation on the internet
@SlayerDUDE1993
@SlayerDUDE1993 27 күн бұрын
bruh
@forceofphoenix
@forceofphoenix 27 күн бұрын
please explain what you mean with "bruh"
@SlayerDUDE1993
@SlayerDUDE1993 27 күн бұрын
@@forceofphoenix i mean that's some crazy performance increase my dawg
@kushzei
@kushzei 2 ай бұрын
I understood that Vulkan can be helps faster if you know what your doing
I'm making a *tiny* voxel renderer
1:49
Daniel Schroeder
Рет қаралды 187 М.
Per Voxel Lighting! Good Idea or Bad Idea
0:41
capslpop
Рет қаралды 9 М.
Be kind🤝
00:22
ISSEI / いっせい
Рет қаралды 23 МЛН
когда достали одноклассники!
00:49
БРУНО
Рет қаралды 4,2 МЛН
Learning VULKAN by Rendering a GALAXY
6:10
frozein
Рет қаралды 27 М.
Creating a Blood Desert with ASEPRITES New TILEMAP Feature
18:04
I rewrote my dungeon generator!
4:27
UnitOfTime
Рет қаралды 143 М.
Code htfPPavi6F
2:12
WlodekM3
Рет қаралды 1
I Made a Neural Network with just Redstone!
17:23
mattbatwings
Рет қаралды 493 М.
Two Decades of Hardware Optimizations Down The Drain
10:20
Lavafroth
Рет қаралды 107 М.
How much charging is in your phone right now? 📱➡️ 🔋VS 🪫
0:11
ПК с Авито за 3000р
0:58
ЖЕЛЕЗНЫЙ КОРОЛЬ
Рет қаралды 2 МЛН
cool watercooled mobile phone radiator #tech #cooler #ytfeed
0:14
Stark Edition
Рет қаралды 8 МЛН
Интереснее чем Apple Store - шоурум BigGeek
0:42
ПРОБЛЕМА МЕХАНИЧЕСКИХ КЛАВИАТУР!🤬
0:59
Корнеич
Рет қаралды 3,8 МЛН
Эффект Карбонаро и бумажный телефон
1:01
История одного вокалиста
Рет қаралды 2,8 МЛН
Задача APPLE сделать iPHONE НЕРЕМОНТОПРИГОДНЫМ
0:57