Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Vulkan -New Replacement For OpenGL

Discussion in 'General Discussion' started by ippdev, Mar 5, 2015.

  1. ippdev

    ippdev

    Joined:
    Feb 7, 2010
    Posts:
    3,793
    https://www.khronos.org/vulkan

    Trying to get my head round what this means so i thought I would toss it on the forums here for all you graphics/shader programmer heads to chime in and delineate what this means for game dev.I notice Unity had it's logo on the page as well..so how in particular will this affect how we use Unity, affecting frame rates, new grfx capabilities etc.
     
    wccrawford likes this.
  2. Deleted User

    Deleted User

    Guest

    In short it's not bloatware anymore, all-in-one API with a bunch of tweaks written from the ground up. So in essence should be a lot faster, contain all the latest graphics options and combines mobile and desktop into a singular package.

    I think Unity might of known about this for a while, so it was a good move not to upgrade to GL4. Then again, they could of just said that.
     
    aer0ace likes this.
  3. Ostwind

    Ostwind

    Joined:
    Mar 22, 2011
    Posts:
    2,804
    cl9-2 likes this.
  4. HemiMG

    HemiMG

    Joined:
    Jan 17, 2014
    Posts:
    911
    It seems to have similar goals to what Metal did on iOS. I never really messed around with Metal, so I don't know if it lived up to the hype or not.
     
  5. Breyer

    Breyer

    Joined:
    Nov 10, 2012
    Posts:
    412
    i doubt, you know, NDA and all that stuff...

    btw very minor note on bloatware this isnt 100% true until Microsoft open source their DirectX so DirectX could be incorporated to SPIR-V too... but yes there should be definitely less bloatwares
     
  6. Deleted User

    Deleted User

    Guest

    What's DX got to do with Khronos API's? I suppose they might of had an NDA. Anyway explains why things are the way they are..
     
  7. Breyer

    Breyer

    Joined:
    Nov 10, 2012
    Posts:
    412
    cl9-2 likes this.
  8. goldbug

    goldbug

    Joined:
    Oct 12, 2011
    Posts:
    766
    Here is the gist of it:

    Under OpenGL:

    Code (csharp):
    1.  
    2. Game   ----->  Driver -----> videocard
    3.         GLSL          Instr
    4.  
    The game sends shaders written in GLSL to the driver. The driver parses and compiles them into video card instructions and sends them to the video card.
    The parsing and compilation that the driver does is CPU intensive, complicated, and leads to subtle differences between vendors.

    Under Vulkan:

    Code (csharp):
    1.  
    2. Developer -----> Unity   --------> Game ------->  Driver ------>  videocard
    3.            GLSL           SPIR-V         SPIR-V           Instr
    4.  
    You the developer write the shader in GLSL (or cg). Unity, or whatever development tool you are using will compile it into SPIR-V, which is a binary bytecode, similar to .net CLR but for shaders. You ship the game with the compiled shader. At Runtime, the game sends the SPIR-V to the driver, which converts it to video card instructions.

    Compiling SPIR-V is a lot simpler than GLSL, so this should reduce the CPU overhead of draw calls as well as make drivers more consistent.

    There are other improvements in the API such as thread support. There is no Vulkan ES, Vulkan is designed to work across all devices.

    So Vulkan means for you lower CPU cost per draw call, which in most cases can result in higher fps than OpenGL.

    My guess is that Vulkan will be adopted in Android first, since apple already has Metal which is a competitor, and Microsoft has DirectX 12.
     
    Last edited: Mar 6, 2015
  9. thxfoo

    thxfoo

    Joined:
    Apr 4, 2014
    Posts:
    515
    I assume the main point is like with Mantle and DX12: the driver overhead is massively reduced, but the engine programmers have to handle all resource management themselves (so the driver does no longer try to handle that for you).

    [Kind of like going from C# back to C++ because it is just more effective if you handle the resources yourself as long as you know what you do]
     
    cl9-2 likes this.
  10. cl9-2

    cl9-2

    Joined:
    May 31, 2013
    Posts:
    417
    Apple, which has the Metal API, also has their logo on the Vulkan homepage.

    I believe the Metal shading language, based on C++, uses LLVM. Vulkan will use SPIR-V, which also uses LLVM. It will be interesting to see the parallels between Metal and Vulkan. Both are said to be command-buffer based.

    According to the sources, any device with OpenGL ES 3.1 support can also support Vulkan. Vulkan drivers are supposed to be leaner than OpenGL. I'm curious if graphics vendors will create Vulkan drivers for their older chips.
     
    Last edited: Mar 5, 2015
  11. RichardKain

    RichardKain

    Joined:
    Oct 1, 2012
    Posts:
    1,261
    The development community has been clamoring for a less cluttered OpenGL for some time. For a while, OpenGL has bloated from the need to support older versions of the API. Vulkan sounds like it is a ground-up rebuild, and will likely excise all of the outdated code of the original OpenGL.

    The focus of graphics has changed so much since the early days that a shift like this was inevitable. I find it encouraging that the Khronos group is speaking with all of the major interested parties in order to get feedback on the active development of the system. Sony took a similar approach when designing the PS4, and the results were very favorable.
     
    Deleted User likes this.
  12. cl9-2

    cl9-2

    Joined:
    May 31, 2013
    Posts:
    417
  13. thxfoo

    thxfoo

    Joined:
    Apr 4, 2014
    Posts:
    515
    Very nice one, Valve:
    http://tech.slashdot.org/story/15/0...open-source-intel-vulkan-gpu-driver-for-linux
     
    Deon-Cadme and cl9-2 like this.
  14. cl9-2

    cl9-2

    Joined:
    May 31, 2013
    Posts:
    417
  15. Velo222

    Velo222

    Joined:
    Apr 29, 2012
    Posts:
    1,437
    Mantle is now defunct? Didn't it just come out? I'm confused.
     
  16. Valvy1

    Valvy1

    Joined:
    Aug 24, 2014
    Posts:
    3
    Well it"s About time they ditch the legacy opengl 1.0 code. But the average unity developer might not notice the difference since The graphic api is abstracted from developer.
     
  17. cl9-2

    cl9-2

    Joined:
    May 31, 2013
    Posts:
    417
    Mantle is DOA (dead on arrival) since its feature set has been absorbed in Vulkan, but AMD decided to still share the specifications.
     
  18. elbows

    elbows

    Joined:
    Nov 28, 2009
    Posts:
    2,502
    Some of the ideas in Mantle were so good that everyone else (Apple Metal, DX12, OpenGL) got in on the action before Mantle development was even fully opened up to the masses.
     
  19. Velo222

    Velo222

    Joined:
    Apr 29, 2012
    Posts:
    1,437
    Interesting. Yeah I've been reading a little bit about it since then. Cool stuff.
     
  20. zombiegorilla

    zombiegorilla

    Moderator

    Joined:
    May 8, 2012
    Posts:
    8,986
    We are involved with it's development (though not me). At GDC Unity showed off the core mine demo running using WebGL 2.0. Presumably it is Vulkan, but they didn't say specifically. It was just amazing though.
     
  21. goldbug

    goldbug

    Joined:
    Oct 12, 2011
    Posts:
    766
    WebGL users OpenGL not Vulkan.

    I would assume that at some point in the future if Vulkan is successful we will see a WebVulkan standard emerge, but it won't be backward compatible with WebGL.
     
  22. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,337
    Don't miss the talk about Vulkan:

     
    thxfoo likes this.
  23. zombiegorilla

    zombiegorilla

    Moderator

    Joined:
    May 8, 2012
    Posts:
    8,986
    Interesting. I misunderstood, I thought it was leveraging web/OpenGL Now I am more curious what unity's demo was.
     
  24. goldbug

    goldbug

    Joined:
    Oct 12, 2011
    Posts:
    766
    Unity generates code is asm.js, which is a subset of javascript that browsers can optimize quite a bit.

    The generated code accesses the graphics card using WebGL. WebGL is a standard api for javascript that browsers provide for using OpenGL inside your web page. So WebGL is very much tied to OpenGL.

    Unity will support Vulkan at some point, but NOT for WebGL, only for your standalone apps. As of this writing, there is no way to access Vulkan from javascript in any browser.

    The demo they had was running on WebGL (therefore OpenGL). The reason this is good, is that the customer will no longer need to download a plugin, he just opens the web page and the game starts. This demo in no way used Vulkan. The impressive thing about this demo is that performance was really good for a game written entirely in javascript. For the first time, it becomes viable to make games for the web in unity that don't require plugins.

    At some point, if Vulkan gains marketshare, browsers should develop an api similar to WebGL but for Vulkan, i.e. WebVulkan. Then games in javascript will also be able to benefit from Vulkan.
     
    Last edited: Mar 24, 2015
  25. zombiegorilla

    zombiegorilla

    Moderator

    Joined:
    May 8, 2012
    Posts:
    8,986
    That I get. I meant the 2.0 demo at GDC. Was that just a more optimized export? The alluded that it was a different tech than the current webgl export.
     
  26. ZJP

    ZJP

    Joined:
    Jan 22, 2010
    Posts:
    2,649
    So, "Life Long and Prosper" Vulkan. :D
     
    cl9-2 and darkhog like this.
  27. Lockethane

    Lockethane

    Joined:
    Sep 15, 2013
    Posts:
    114
    It's WebGL 2 that they showed which is a subset of OpenGL ES 3. But FF and Chrome use ANGLE to map that to DX9/11. WebGL is just OpenGL ES 2.
     
    zombiegorilla likes this.
  28. Lockethane

    Lockethane

    Joined:
    Sep 15, 2013
    Posts:
    114
    The faster load times, huge increase in allowed drawcalls, and things like faster shadowmapping will certainly be noticable.
     
  29. Tomnnn

    Tomnnn

    Joined:
    May 23, 2013
    Posts:
    4,148
  30. Lockethane

    Lockethane

    Joined:
    Sep 15, 2013
    Posts:
    114
    From what I have seen in the Metal benchmarks for IOS it's nice. Though rumor from Carmack has Android using their own, which will not be good since we don't need any more fragmentation.
     
  31. Tomnnn

    Tomnnn

    Joined:
    May 23, 2013
    Posts:
    4,148
    Maybe not, but you have to admit Carmack working on anything is exciting.
     
  32. Lockethane

    Lockethane

    Joined:
    Sep 15, 2013
    Posts:
    114
    Oops, I didn't mean Carmack is working on it, he is the one that doesn't want it.
     
  33. Tomnnn

    Tomnnn

    Joined:
    May 23, 2013
    Posts:
    4,148
    Oh I misread that. Well that's disappointing :p

    Fragmentation, eh? Damn. Hopefully it's not as bad as the rift between open-gl and directx. I hate that directx is windows only, but damn, look at the difference in how many materials you can overlay with pbr shaders!
     
  34. cl9-2

    cl9-2

    Joined:
    May 31, 2013
    Posts:
    417
    I think WebGL 2.0 will be the web browser equivalent OpenGL ES 3.0. Also from what I've read, all of the extensions in WebGL 1.0 (including floating point textures and multiple rendering targets) will be supported by default in WebGL 2.0.
     
  35. Deleted User

    Deleted User

    Guest

    So I don't see Vulkan on the roadmap for the next 9 months. I honestly can't see using OpenGL for my Linux port, so I'm hoping Vulkan support slips into Unity at some point so I can port to Linux. Any word from Unity staff on the state of Vulkan with Unity?

    EDIT: Well maybe Unity 5.3 with OpenGL 4.x will work for the port. Still looking forward to Vulkan.
     
    Last edited by a moderator: Jun 27, 2015
  36. Ryiah

    Ryiah

    Joined:
    Oct 11, 2012
    Posts:
    20,150
    Vulkan isn't out yet.
     
  37. Tomnnn

    Tomnnn

    Joined:
    May 23, 2013
    Posts:
    4,148
    Godot and Valve support vulkan. The will of GabeN.
     
  38. Ryiah

    Ryiah

    Joined:
    Oct 11, 2012
    Posts:
    20,150
    If Unity were to put it on their roadmap, it would likely go in much the same location as the Linux port.
     
    Deleted User and Tomnnn like this.
  39. Arowx

    Arowx

    Joined:
    Nov 12, 2009
    Posts:
    8,194
    Any Unity updates on Vulkan as it sounds like some developers are saying it is better than DirectX 12?
     
  40. Dantus

    Dantus

    Joined:
    Oct 21, 2009
    Posts:
    5,667
    At a Unite talk (can't remember which one, I watched it on YouTube), they mentioned to work on it as soon as it is available.
     
  41. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,507
    Hard to say, it's not out yet.
     
  42. imaginaryhuman

    imaginaryhuman

    Joined:
    Mar 21, 2010
    Posts:
    5,834
    Not sure what's going on with Vulcan but Apple OSX Mavericks now runs on `Metal for Mac`, and the upgrade from the previous version did provide a noticeable speedup. Apple seems to like doing everything custom so I presume they are not going to support Vulcan as their core graphics tech.
     
  43. Dantus

    Dantus

    Joined:
    Oct 21, 2009
    Posts:
    5,667
    The platforms on which Vulkan will be relevant as primary solution will most likely be the Linux ones including Android. I would be surprised if it was adapted by Apple at all.
     
  44. Arowx

    Arowx

    Joined:
    Nov 12, 2009
    Posts:
    8,194
    Well if Vulkan makes an appearance this or early next year there are still a lot of windows users who have not upgraded to 10 and could benefit from the Vulkan API.

    42% of steam users have a DX12 capable graphics card on a < Windows 10 OS.

    It would be a shame if Apple did not support Vulkan as it could be a great cross technology platform for developers and game engines to work with.
     
    Tomnnn likes this.
  45. Ryiah

    Ryiah

    Joined:
    Oct 11, 2012
    Posts:
    20,150
    Unfortunately that's the catch... if it makes an appearance. Khronos was never known for speed. :p
     
  46. Tomnnn

    Tomnnn

    Joined:
    May 23, 2013
    Posts:
    4,148
    That's an interesting stat.
     
  47. Kiupe

    Kiupe

    Joined:
    Feb 1, 2013
    Posts:
    528
    Arowx and Ryiah like this.
  48. zenGarden

    zenGarden

    Joined:
    Mar 30, 2013
    Posts:
    4,538
    Will Unity announce Vulkan support at GDC ? :rolleyes:
     
  49. neginfinity

    neginfinity

    Joined:
    Jan 27, 2013
    Posts:
    13,328
    Wouldn't bet on it.

    You'd need a driver support first. Although it seems that NVidia has it covered.
    https://developer.nvidia.com/vulkan-driver

    I think I'll need to take a closer look at this, since my hardware should be supported.
     
  50. zenGarden

    zenGarden

    Joined:
    Mar 30, 2013
    Posts:
    4,538
    It should be interesting when it's available to test a complete game scene before and after using Vulkan new driver.