Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DX12 and Vulkan backends? #1047

Closed
ADormant opened this issue Dec 20, 2015 · 179 comments
Closed

DX12 and Vulkan backends? #1047

ADormant opened this issue Dec 20, 2015 · 179 comments

Comments

@ADormant
Copy link

I wonder if there is a chance for DX12 backend in PCSX2 it gives huge performance increase.

dolphin-emu/dolphin#3364
https://forums.dolphin-emu.org/Thread-unofficial-dolphin-dx12-backend?page=5

@willkuer
Copy link
Contributor

Maybe gabest will show up again and provide a dx12 backend (as he does from time to time). I guess no other active dev would consider this.

Also this is a typical question for a forum and was answered there several times to all extends.

@Blackbird88
Copy link
Contributor

Vulkan would be better for obvious reasons. But still it's not like PCSX2 needs fast GPU that much.

@ADormant
Copy link
Author

Okay I ping gabest @gabest11

@Dokman
Copy link
Contributor

Dokman commented Dec 21, 2015

idk what i am talking about, but i will ask you.
EE is really important but his job it can be done by a gpu no? if you use another instructions it can work with the gpu or not?
how it works?

@gabest11
Copy link
Contributor

Maybe once I move to Windows 10.

@mirh
Copy link

mirh commented Dec 21, 2015

Wasn't this already discussed tons of times on the forums?
And with Vulkan coming imminently (a month? Which I'd say is more or less the time needed for a somewhat usable new renderer) I wouldn't know

@Sarania
Copy link
Contributor

Sarania commented Dec 21, 2015

You guys heard the man - he will randomly probably add it when he randomly moves to Windows 10 XD

IMO Vulkan is a much better choice because of portability.

@ghost
Copy link

ghost commented Jan 8, 2016

I disagree, better to focus on cross-platform stuff

@mrcmunir
Copy link

DX12 must exist both with vulkan because some manufacturers have poor outside opengl/ vulkan api in windows version and that's the harsh reality .

@mirh
Copy link

mirh commented Jan 11, 2016

It's not like those very some manufacturers aren't the same manufacturer that released Mantle spec the whole Vulkan api is based upon.

tl;dr: there's no correlation between GL and vulkan.
Pcsx2 is definitively going to support the later, someday, considering where most of the graphic "team" is. As for the former who knows. Nobody is going to say no to a nice addition. But first you have to code it. And it's not a priority atm.

@gregory38
Copy link
Contributor

So far we've found 2 games that might benefit from newer API.

  • Zone of the Ender
  • Juiced

@Sarania
Copy link
Contributor

Sarania commented Apr 26, 2016

How'd you find them? Based on # of draw calls?

@nicman23
Copy link

AMD people would also benefit, as the current opengl backend runs very poorly :(

@gregory38
Copy link
Contributor

@Sarania more or less. I profile them too. If I have a high usages of function 0x2351521, I infer the driver is busy. (note that I need to double check ZoE, I debug/profile some much dump). However those games are very heavy on texture/state change. So you don't have any guarantee that new API will really improve the situation (as you still need to flush your GPU).

@nicman23
No. What AMD users need is a multi-thread API dispatcher. Nvidia provides it in the GL driver, I guess DX provides it for all vendors. Remains the others... In all cases, it won't be provided by newer API, so GSdx would need to provide this code too (like thousand of projects... AKA useless code duplication)

@ghost
Copy link

ghost commented Aug 1, 2016

@gregory38 Vulkan and DX12 reduce the strain on an AMD CPU. If they chose to implement Async Compute in the plugin you'd see quite an increase. Newer APIs would absolutely provide a significant performance boost to AMD GPU setups.

@Enverex
Copy link

Enverex commented Aug 1, 2016

I'd say Vulkan, as there's no real point implementing both DX12 and Vulkan when they do the same thing, but the advantage of Vulkan would be that it would work cross-platform (whereas DX12 would be limited to Windows 10 exclusively).

@ghost
Copy link

ghost commented Aug 25, 2016

As far as I know, Dolphin itself isn't using DX12 Feature level, the rewrite of the graphic backend itself discovered some severe bugs in dolphin, which so got solved. DX12 hasn't been totally tested out.

@nicman23
Copy link

Iirc a dev team just randomly, posted the patches to dolphin.

The initial effort wasn't by the dolphin devs

@ghost
Copy link

ghost commented Aug 25, 2016

As I said.

@Two-Tone
Copy link

So far we've found 2 games that might benefit from newer API.

The Ratchet and Clank games would likely see a benefit as well as those games really stress the CPU, unless you heavily underclock the EE which can cause the in-game FPS to dip at times.

Any reduction in CPU overhead would help, honestly.

@gregory38
Copy link
Contributor

But are you sure that the issue is the overhead of the driver. And not the GSdx overhead. It is really a complex topic.

Any reduction in CPU overhead would help, honestly.

Sure but it doesn't come for free. I'm pretty sure people prefer a slow openGL rendering with nice mipmap texture and shadows rather than a fast Vulkan mipmap garbage.

@Two-Tone
Copy link

I'm not saying that the issue is the driver, just that the reduction in
driver overhead would give the emulator more room to breathe.

Well of course people would prefer a more full features yet slower renderer
compared to one that is fast but lacking vital features. But it's a moot
point as there is no Vulkan backend currently.
I
On Sep 27, 2016 4:14 AM, "Gregory Hainaut" notifications@github.com wrote:

But are you sure that the issue is the overhead of the driver. And not the
GSdx overhead. It is really a complex topic.

Any reduction in CPU overhead would help, honestly.

Sure but it doesn't come for free. I'm pretty sure people prefer a slow
openGL rendering with nice mipmap texture and shadows rather than a fast
Vulkan mipmap garbage.


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
#1047 (comment), or mute
the thread
https://github.com/notifications/unsubscribe-auth/AEJES-qs3rVozeYM83yoUSNxvR6-9uh1ks5quN5bgaJpZM4G41S4
.

@gregory38
Copy link
Contributor

I'm not saying that the issue is the driver, just that the reduction in driver overhead would give the emulator more room to breathe.

No. The driver is running is own thread. If you're not limited by the driver overhead, it could be 10x time faster that you will barely notice any speed impact on the emulation. Well you're right that it will reduce the load on 2 core CPU but it is maybe time (and faster) to upgrade to a 4 core CPU (with AMD comes back, I hope it will become more standard).

But it's a moot point as there is no Vulkan backend currently.

There is no Vulkan backend but emulation of Ratchet and Clank games is nearly perfect. So it isn't moot, I already made the choice to improve the quality over a potential speedup.

@jcdenton2k
Copy link

jcdenton2k commented Sep 28, 2016

@Two-Tone:

I've looked through your github contribution history and it seems you're more of a tester/issue commiter than an actual coder. I'm of a somewhat similar ilk. Just be sure you know that gregory38 is an actual coder and intimately involved deep in the nuts and bolts of maintaining a PCSX2 codebase that has been around for several years and has over 95% compatibility with PS2 games.

That said, perhaps you should realize that neither Vulkan nor DX12 are 'magic bullets' when it comes to improving performance. The primary benefit comes from those who have the HARDWARE to handle things and that hardware isn't going to happen from people who (time and again) complain their Intel Integrated HD-shit graphics have bugs or won't run X game despite bold stickied caps threads on the PCSX2 forums.

The overwhelming majority of users are not on Win10 nor have any inclination of 'updating' to Win10. I've made this comparison elsewhere but Win7 is your rock solid STABLE OS while Win8.1 is a BETA OS and Win10 is your DEV/ALPHA OS that isn't ready for prime time and won't be ready for at least another year or two. Microsoft fired most of their testing team and the buggy broken garbage 'updates' they've released to break people's systems time and again have unfortunately caused a backlash where NOBODY is updating their computers even for crucial security updates. GG, Micro$oft.

Win10 is not the answer and DX12 is not the answer. It would be utterly insane to bother with DX12 support for less than 20% of the market and have that 'support' change on a near-daily basis with every random forced untested Windows Update for Win10 causing nothing but headaches for both users and developers of programs like PCSX2.

And all that said, Vulkan is by far the most promising of the APIs but from personal experience and poking around it is NOT ready for prime time. Maybe 85% ready but still not quite there yet. I know of Doom being one of the few high-profile games that have Vulkan support and that is because John Carmack is a programming genius and managed to get it done within a reasonable amount of time. Not every project has a John Carmack on staff (if only we were so lucky) so we work with what we have.

DX12 is a lost cause and Win10-only while Vulkan is still at least a year away from being a mature-enough API for regular production use. Neither of those APIs are going to provide a significant performance increase in enough PS2 games to justify the (unpaid volunteer) coders here to set aside significant time & resources to work on it.

TLDR: Please do your research before spewing your ignorant vomit all over this project, thanks.

Here's a video that even a simpleton like you can understand; you should do an internet search for more detail if you like:
https://www.youtube.com/watch?v=r0fgEVEgK_k

@v-fox
Copy link

v-fox commented Sep 11, 2020

@gregory38 @NEOAethyr

Yes interlock is rov. It needs a modern GPU. But AMD stated they don't want to export the feature on vulkan even on recent GPU.
If driver doesn't support it, nothing can be done. No translation layer will change it. End of story.

Well, closed AMD driver is irrelevant for Linux, unless you need it for a supercomputer render cluster or something. I'm sure such implementation will not be blocked from merging for RADV… but it will not be written by AMD staff either :(
In fact… https://gitlab.freedesktop.org/mesa/mesa/-/issues/3511 - and there is Intel implementation to work from.

Worst case, people will reduce the upscaling factor ;) Or buy a better GPU

You say that but in all the years to today upscaling factor has have not been changing a single fps for me and my RX580 and previous HD6870. Strangely, same thing happens with RPCS3: changing rendering resolution from 720 to 1440p with same other settings doesn't change anything other than picture quality, it's entirely bottlenecked by something else. I tested recent git snapshots of PCSX2 with MGS2 (intro cutscene, particularly wide shots of the ship and view of upper deck) and RPCS3 with MGS4 (main menu and training range) and they both exude this behaviour while erratically loading the CPU.

You may remember me getting on your nerves previously on some other issue with screenshots with driver performance overlay of PS2 and GC versions of RE4 where PCSX2 completely failed on lowest resolution of famously gimped PS2 RE4 version while Dolphin was giving out perfect 60 on highest upscaling of the original. You were blaming "bad drivers" but now Mesa's AMD OpenGL implementation is probably the most exemplary implementation there is (missing optional extensions such as this notwithstanding). And OpenGL spec is deprecated, driver implementations are largely on life-support while Vulkan drivers are developed, if there were new GPU makers (in a world where blatant global oligopolies are not welcomed by corrupt politicians) they would probably skip making their own OpenGL implementation and use a OpenGL->Vulkan shim.

You may try to quickly benchmark apps in Mesa with these (per-core CPU usage matters over overall stat though)

environmental variables.

GALLIUM_HUD_VISIBLE=false
# SIGUSR1, use `kill -10 $(pidof <proc-name>)`
GALLIUM_HUD_TOGGLE_SIGNAL=10
# per-frame accounting
GALLIUM_HUD_PERIOD=0
# tune for >96 DPI display
#GALLIUM_HUD_SCALE=1
# use `GALLIUM_HUD=help glxgears` for options
GALLIUM_HUD="cpu+GPU-load,.dfps+.dframetime,.dbuffer-wait-time;requested-VRAM+VRAM-vis-usage+mapped-VRAM+requested-GTT+GTT-usage+GFX-IB-size,GPU-shaders-busy+GPU-ta-busy+GPU-vgt-busy+GPU-sx-busy+GPU-wd-busy+GPU-sc-busy+GPU-pa-busy+GPU-db-busy+GPU-cp-busy+GPU-cb-busy;.dprimitives-generated+.dclipper-primitives-generated+.ddraw-calls,.dsamples-passed+.dps-invocations"
GALLIUM_PRINT_OPTIONS=true
GALLIUM_DUMP_CPU=true

Well, now Dolphin has Vulkan with genius "async shader compilation / ubershaders" and still rocking with perfection. It's different architecture with different hurdles, sure, but how much is it really the drivers and how much is it inoptimal approach ? Is that use-case is so unique that no driver dev stumbled on it otherwise while not bothering with emulation their whole lives and keeping that one code-path extremely, orders-of-magnitude sucky but not completely broken ?

@OtavioRaposo
Copy link

OtavioRaposo commented Nov 20, 2020

Windows users with AMD GPUs desperatly needs Vulkan backend on PCXS2.
Right now I'm using software mode (burning my CPU) because DX11 has a lot of glitches and Opengl has unplayable performance (worst than software mode).
If I knew PCXS2 had such terrible performance with AMD GPUs I would have bought a Nvidia GPU, but I didn't and I'm not going to buy another GPU just to play PS2 emulation.

@mercuriete
Copy link

@OtavioRaposo you can try to install:
https://www.microsoft.com/en-us/p/opencl-and-opengl-compatibility-pack/9nqpsl29bfff?activetab=pivot:overviewtab

maybe opengl on top of mesa on top of DX12 is faster xD.

Not sure if I am talking seriously or if this is a joke.

@TheLastRar
Copy link
Contributor

TheLastRar commented Nov 20, 2020

"OpenGL version 3.3 and earlier" PCSX2 is needing features from GL 4.5 iirc
similar issue with zink (Vulkan on mesa)

Cool that it's on the store, was wondering where it was going to turnup

Edit: maybe it will support newer OpenGL versions in the future, not been able to find roadmap regarding it

@ghost
Copy link

ghost commented Nov 20, 2020

I find DX11 to perform alright on an RX 580, though I'm certain Vulkan could do so much better.

Most games run perfectly fluent on 2560x1440 (custom), however they end up looking blurry due to the PS2 Interlacing thing.

If I choose the 5K preset the Interlace-Blurryness is completely negated but some games don't run fluently anymore.

Also there is this issue of playing in Windowed vs Fullscreen mode (for me at least). In Windowed Mode the game overall will appear much more fluent while on Fullscreen it'll look like it's at 30 FPS or lower.

I assume Vulkan would be able to get fully rid of those issues on AMD, while in general being the best option for both AMD and nVidia graphics cards.

@OtavioRaposo
Copy link

@OtavioRaposo you can try to install:
https://www.microsoft.com/en-us/p/opencl-and-opengl-compatibility-pack/9nqpsl29bfff?activetab=pivot:overviewtab

maybe opengl on top of mesa on top of DX12 is faster xD.

Not sure if I am talking seriously or if this is a joke.

Have you tried this? At this point, I'm accepting any suggestions.

I find DX11 to perform alright on an RX 580, though I'm certain Vulkan could do so much better.

Most games run perfectly fluent on 2560x1440 (custom), however they end up looking blurry due to the PS2 Interlacing thing.

If I choose the 5K preset the Interlace-Blurryness is completely negated but some games don't run fluently anymore.

Also there is this issue of playing in Windowed vs Fullscreen mode (for me at least). In Windowed Mode the game overall will appear much more fluent while on Fullscreen it'll look like it's at 30 FPS or lower.

I assume Vulkan would be able to get fully rid of those issues on AMD, while in general being the best option for both AMD and nVidia graphics cards.

My main problem with DX11 is that it's full of glitches and innacuracies. It's a big turnoff for me.
And the hacks don't solve the problem, cause they impact so much on performance, the games become unplayable.
An exemple of this is Jak 2 and Ratchet & Clank, completly broken shadows.
PCXS2 team should be really taking Vulkan more seriously.

@RedDevilus
Copy link
Contributor

You should read into what Vulkan does and what benefit it gives to PCSX2. Vulkan is not Superman carrying everything, sure there is some benefit but AMD isn't implementing fragment shader interlock. You can be as certain as much as you want ofcourse. Same thing that happened to x64, if you don't believe me then wait till it's here and compare between the renderers.

@OtavioRaposo
Copy link

You should read into what Vulkan does and what benefit it gives to PCSX2. Vulkan is not Superman carrying everything, sure there is some benefit but AMD isn't implementing fragment shader interlock. You can be as certain as much as you want ofcourse. Same thing that happened to x64, if you don't believe me then wait till it's here and compare between the renderers.

Windows + AMD + Opengl = unplayable.
Windows + AMD + Vulkan = playable.

These words are fact, not opinion.
AMD drivers poorly support Opengl, and they aint never gonna fix that.
On the other side, Vulkan is constantly being updated and there's hope.

@mercuriete
Copy link

@OtavioRaposo sorry, i havent tried It.
I have an AMD fury maybe I will give I try but @TheLastRar said OpenGL 3.3 is not enough so probably It wont work.
Anyways, zink and mesa d3d12 is expected to support OpenGL > 3 somewhere in the future.

@OtavioRaposo
Copy link

Still hoping for that.

@F0bes
Copy link
Member

F0bes commented Dec 21, 2020

Still hoping for that.

Continue hoping my friend 😉

@divadsn
Copy link

divadsn commented Jan 21, 2021

Windows + AMD + Opengl = unplayable.
Windows + AMD + Vulkan = playable.

Yeah, it's easy to blame AMD for crappy OpenGL drivers on Windows, but the same can be said about Nvidia on Linux.

To sum up, Vulkan will provide same good performance for both GPU teams, some emulators already have, so why not?

@GovanifY
Copy link
Member

Because it's work, and not any kind of work: it is hard work.
We have priorities to make the current codebase much better off in the long term and we are focusing on that right now.
We will work on vulkan once those are dealt with. Unless you want to contribute a patch then that's how it's going to be with our limited manpower. Obviously you're welcomed to try to work on that!

@divadsn
Copy link

divadsn commented Jan 21, 2021

@GovanifY sure it's work, that's not doubt. But as I read these comments, it's rather abandoned and blamed on AMD.

I'd definitely consider contributing with support and bounty if this will be picked up in the future!

@GovanifY
Copy link
Member

@divadsn Only very early work has been done on a vulkan backend. I myself cannot say anything about the state of affairs with AMD as I didn't get involved much with the GPU side of things but that'll change rather quickly.

We do not do bounties, if there's one thing that has been constant for the project it's that we haven't asked for any kind of financial support. Money won't do us any good if we don't have the people to work on that nor if it isn't a priority.

I am giving out a talk about PCSX2 at FOSDEM which will highlight the current state of the project and our current and future priorities if you are interested to see what we are working on, some of those features are, arguably, more important than vulkan from an end user perspective!

@refractionpcsx2
Copy link
Member

refractionpcsx2 commented Jan 21, 2021

Part of our issue is this GPUOpen-Drivers/AMDVLK#108

This functionality is something we use on PCSX2 to emulate the blending on the PS2, so if we were to do the easiest method of implementing Vulkan by copying existing functionality, while AMD would be much faster than on their OpenGL driver, the Blending would not work properly and would be as compatible as DX11 currently is. So once again, AMD lets us down.

There is other ways of doing things like Per Pixel Linked Lists, however none of the team currently knows how to implement it and if it will even be any good, part of the problem is it requires a buffer of a known size, something you can't do with PS2 emulation (because the whole memory is like one big texture buffer), but it might be a possible solution but it's not going to be something we can throw together in 5 minutes, and it very well may just suck.

We would like to get some more modern API's working, but we have other things which are a priority right now.

@OtavioRaposo
Copy link

OtavioRaposo commented Jan 22, 2021

Could you guys at least let us know what are your projections, maybe how much estimated time until you start working on improving the API side of the emulator?

@refractionpcsx2
Copy link
Member

We don't have a set timeline, but it won't be before the next release, which will happen sometime this year

@okt04175

This comment has been minimized.

@JordanTheToaster

This comment has been minimized.

@Squall-Leonhart

This comment has been minimized.

@lonkelle
Copy link

I'm v happy that Vulkan support is planned. Can't wait!

@Undeon
Copy link

Undeon commented Nov 1, 2021

+1 hopping for the Vulkan support.

@RinMaru
Copy link

RinMaru commented Nov 1, 2021

+1 hopping for the Vulkan support.

Even if they added it it wouldn't do much better then DX11 because AMD doesn't support a critical feature needed for shading

@Undeon
Copy link

Undeon commented Nov 1, 2021

+1 hopping for the Vulkan support.

Even if they added it it wouldn't do much better then DX11 because AMD doesn't support a critical feature needed for shading

I understand that, but any performance improvement is welcome, since not everyone can have the option to use an discrete graphics card and are stuck with integrated Radeon Vega.

@RedDevilus
Copy link
Contributor

Vulkan is not a magic bullet to get something like a 300% performance uplift. It can have some benefits but not as drastic without Fragment_Shader_Interlock. Besides it is not helpful bumping threads, it will be here when it's here not sooner or later.

@tadanokojin
Copy link
Member

tadanokojin commented Nov 1, 2021

VK doesn't need FSI, it's just easier (and accurate) to do with it.

Anyway I'm sure there are things we all want to see done, but it's kind of a waste of everyone's time to keep bumping threads. We haven't forgotten this thread or any number of threads exists, I mean how could we we only get bothered about this once a week on basically every platform.

If all you have to say is "I want this" then there's not much point in adding it to the list of thousands of other people expressing the exact same idea all over the place. I'm kind of getting tired of people bumping threads with useless or redundant information and creating urgency over stuff that doesn't need it. The thread will be updated when we have more information.

@PCSX2 PCSX2 locked as off-topic and limited conversation to collaborators Nov 1, 2021
@lightningterror
Copy link
Contributor

Closing as Vulkan has been implemented.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests