Vulkan support

For code related discussions and questions

Vulkan support

Postby Vincent » 27 Sep 2016, 01:37

I'm intending to add a Vulkan backend to Warzone 2100. Obviously the goal is not to reduce cpu overhead since the game doesn't draw a lot of thing on screen at the moment (there's around 100-200 draw call per frame), but to improve current code architecture. WZ codebase could be described as state oriented : everything is stored in globals and almost every functions have side effect. This was likely guided by the constraints of C before 99 but it makes hard to reason on code by devs and compiler.
Vulkan API makes multithreading of graphic code possible and I'd like to take advantage of this and extract some code that can be threaded in wz2100 code. It's likely to improve wz2100 code by making more explicit which variables a given function is using or modifying, having more pure functions...To ensure compatibility with gl such functions would be run in sequential mode if it does touch openGL context.
Vincent
Trained
Trained
 
Posts: 64
Joined: 06 Aug 2016, 17:24

Re: Vulkan support

Postby Jorzi » 27 Sep 2016, 18:15

Just to make sure, what kind of hardware does vulkan run on? The same as directx 12?
ImageImage
-insert deep philosophical statement here-
Jorzi
Regular
Regular
 
Posts: 1943
Joined: 11 Apr 2010, 00:14

Re: Vulkan support

Postby Vincent » 27 Sep 2016, 22:24

Yes, it runs on Nvidia/AMD cards released after 2012 and Intel Skylake (core iX-6xxx) and Broadwell (core iX-5XXX) on Windows and Linux. Linux drivers have some sort of support for Haswell and Ivy Bridge too but it's considered experimental.

On Android side afaik only Galaxy S7 and Note 7 and latest Nexus phones support Vulkan. I think no tablet does yet.

Obviously GL renderer will be kept.
Vincent
Trained
Trained
 
Posts: 64
Joined: 06 Aug 2016, 17:24

Re: Vulkan support

Postby Tzeentch » 28 Sep 2016, 09:09

How do you find time to do this?

Good. Multi threads what we need. Tons of sync overhead from messages being displayed and half the time warzone doesn't run on older systems unless you get download for intel driver on cpu.
More or less grey
User avatar
Tzeentch
Trained
Trained
 
Posts: 234
Joined: 14 Oct 2012, 14:24

Re: Vulkan support

Postby Cyp » 28 Sep 2016, 18:34

Is there any fallback wrapper for Vulkan → OpenGL so it runs everywhere if Vulkan is not present? Haven't looked at Vulkan at all, but given how archaic some parts of OpenGL seem, I'd expect it to be better.
Cyp
Evitcani
Evitcani
 
Posts: 679
Joined: 17 Jan 2010, 23:35

Re: Vulkan support

Postby Per » 28 Sep 2016, 20:34

I would not object to having a Vulkan backend, in addition to an OpenGL backend, but removing the OpenGL backend in favour of Vulkan at this point is way premature, given the early and buggy state of Vulkan drivers. Also, unfortunately, the big challenge and most of the work is changing the design of the rendering so that it aligns with modern GPU architectures. That is work that has to be done for either backend, and is where we should start.
Per
Warzone 2100 Team Member
Warzone 2100 Team Member
 
Posts: 3571
Joined: 03 Aug 2006, 19:39

Re: Vulkan support

Postby Vincent » 13 Oct 2016, 22:43

Actually adding Vulkan support is taking more time than I initially expected. I have basic 2d menu support atm but the modifications are huge.
The issue is that wz2100 quietly assumes OpenGL support in a lot of place. Blending depth stencil modifications are often spread in separate place and texture binding too.
Vincent
Trained
Trained
 
Posts: 64
Joined: 06 Aug 2016, 17:24

Re: Vulkan support

Postby Per » 13 Oct 2016, 23:16

Yes, a lot of funky fixed function hacks are littered around the codebase...
Per
Warzone 2100 Team Member
Warzone 2100 Team Member
 
Posts: 3571
Joined: 03 Aug 2006, 19:39

Re: Vulkan support

Postby Ezio » 14 Oct 2016, 12:34

you push it to your github master Vinc?, i'd like to test it too.
i used vulkan with dota 2 although from my experience with it, when i jump from one place to another by clicking map my fps drops 60 -> 20 or even lower. and spike like that are bad for strategy game.
Image
Please Read FAQ, Dev Wiki and Search forum for same post before posting
User avatar
Ezio
Trained
Trained
 
Posts: 305
Joined: 24 Apr 2010, 16:42

Re: Vulkan support

Postby Vincent » 15 Oct 2016, 18:30

There's nothing to see currently, only the menu is displayed so it's hard to know how well performance will be. Plus there are a lot of glitches (no alpha blending so black boxes around letter for instance).

I can't comment on Dota2, I'm also having some very small freeze especially at the beginning of games. I don't know if that's because of some technical choice of Valve or if it's just because it's still work in progress (afaik the fastest backend is the dx9 one). In my opinion the best Vulkan game availble at the moment is Doom 2016, it's faster to use Vulkan than GL on every hardware vendor and frame stuttering is almost eliminated.
Vincent
Trained
Trained
 
Posts: 64
Joined: 06 Aug 2016, 17:24

Re: Vulkan support

Postby Vincent » 24 Oct 2016, 03:46

I'm making some progress on the 3d part (terrain rendering actually). Hopefully I can have something "good enough" in a week or 2 that could be candidate for merge. Since I'm focusing on introducing a layer between current code and GL callbacks it won't actually bring any performance difference ; however having a cross API basis as quick as possible in the engine will help rewrite some part of the code in a more "explicit" way and show some multithreading opportunities.
Vincent
Trained
Trained
 
Posts: 64
Joined: 06 Aug 2016, 17:24

Re: Vulkan support

Postby Vincent » 26 Oct 2016, 00:59

Here a screenshot of work in progress :

wzvulkan.PNG


There's a lot to do, 3d interface is not working, particles shadows and construction effects are missing. And there are some bugs, terrain layers are not properly blended (hence the dark tone).
Vincent
Trained
Trained
 
Posts: 64
Joined: 06 Aug 2016, 17:24

Re: Vulkan support

Postby Per » 26 Oct 2016, 01:09

Very cool!
Per
Warzone 2100 Team Member
Warzone 2100 Team Member
 
Posts: 3571
Joined: 03 Aug 2006, 19:39

Re: Vulkan support

Postby MaNGusT » 26 Oct 2016, 15:48

And very dark and blurry :D just joking. Good to see that it works.
Image
User avatar
MaNGusT
Art contributor
 
Posts: 941
Joined: 22 Sep 2006, 10:31
Location: Polar region, Russia

Re: Vulkan support

Postby Tzeentch » 26 Oct 2016, 20:23

I have to ask... why are you doing all this Vincent? Should be cool.
More or less grey
User avatar
Tzeentch
Trained
Trained
 
Posts: 234
Joined: 14 Oct 2012, 14:24

Next

Return to Coding

cron