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

GL/Vulkan : Hatsune Miku Dreamy Theater 2nd\Extend graphical issue #2145

Closed
Nezarn opened this issue Sep 20, 2016 · 67 comments
Closed

GL/Vulkan : Hatsune Miku Dreamy Theater 2nd\Extend graphical issue #2145

Nezarn opened this issue Sep 20, 2016 · 67 comments

Comments

@Nezarn
Copy link

Nezarn commented Sep 20, 2016

The game looks like the colors (for the 3D stuff) are semi-inverted(?)

vy0vqmx

Taking a look at the game with renderdoc, you can see that at some point, the game is rendered correctly (just miku's skirt is broken)

https://www.dropbox.com/s/6pkncvlgl2tfijv/dt2ndogl.rdc?dl=0

renderdocui_2016-09-20_17-00-28

shaders: https://www.dropbox.com/s/sj5psv7of60hc7y/dt2ndogl.zip?dl=0

Vulkan is ofc broken on amd (like with the other issue), but behind the garbage it looks the same as ogl.

@kd-11
Copy link
Contributor

kd-11 commented Sep 20, 2016

Seems to be using unbound textures in shader calculations. Will check why the texture would be null in this case. Might be an issue with determining whether to disable textures or maybe bind a dummy textre instead of binding null.

Its a shader bug actually.

@RainKikyou
Copy link

RainKikyou commented Sep 21, 2016

in fact the vulkan shader perform worse( the graphics is broken)
qq 20160921100536
qq 20160921100623
But in the cartoon rendering repertoire shaders more normal work
qq 20160921102615
video:https://youtu.be/_zv6a_NDFT0

@kd-11
Copy link
Contributor

kd-11 commented Sep 21, 2016

@RainKikyou Vulkan validation layers are extremely slow. If you have debug output turned on, you should turn it off for performance. If that is not the case, I'm unsure why your performance is so slow. From the trace sent to me, its not a very complex game to render.

@Nezarn
Copy link
Author

Nezarn commented Sep 22, 2016

@kd-11 yep, its a 60 fps game, and with vulkan (and LLVM) it can nearly run on fullspeed https://www.youtube.com/watch?v=u5ll_B_UHAs (also you can see the amd issue how it looks in this game xD) so idk what did he do

@RainKikyou
Copy link

RainKikyou commented Sep 23, 2016

@kd-11 I have been a default, and does not turn debug output,also can not call llvm
The number of frames is such
qq 20160925101102

2and vullkan https://youtu.be/9nHwrw2JkYQ extend vullkan https://youtu.be/uKaa_0SeINg

@Sarania
Copy link

Sarania commented Sep 23, 2016

@kd-11 (I realize this is off topic but I hope it's okay since it's in response to what you said. I apologize if it's not) I have that extremely slow effect too even with LLVM. I get about 45FPS(Vulkan)/27FPS(OGL) according to the titlebar and the rhythm game part plays normal speed but the background PV plays just as slowly as in @RainKikyou video. My system is i7 3770k @ 4.2Ghz and AMD R9 290 and I'm using latest rpcs3. I'm seeing about 20% CPU usage and 15% GPU usage. I'm using the same settings as @Nezarn (I know this because he gave them to me).

Perhaps there's an actual issue going here that should have it's own report? Again apologies for the off topic.

@Nezarn
Copy link
Author

Nezarn commented Sep 26, 2016

@kd-11 i forgot to mention, but i get this spammed in the log with ogl sometimes (idk if its relevant):

·E {rsx::thread} RSX: reserved allocation exceeded. check for corruption!

@kd-11
Copy link
Contributor

kd-11 commented Sep 26, 2016

That issue is fixed with my latest pull request. It was a regression introduced by the refactoring.

@Nezarn
Copy link
Author

Nezarn commented Sep 29, 2016

This issue affects Virtua Fighter 5 too (by the looks of it, when that game booted before http://www.emunewz.net/forum/showthread.php?tid=158744&pid=233400#pid233400)

@Nezarn
Copy link
Author

Nezarn commented Oct 5, 2016

@kd-11 I've played around in Renderdoc, maybe this is a Vertex Shader issue, since if i comment out this,

tmp1.x = vec4(exp2(-tmp1.xxxx)).x;

or this

tmp0.x = vc[467].wwww.x;

in the vertex shader, it looks semi-fine (except that its a little bit dark, as if the saturation is less than it should be)

renderdocui_2016-10-05_22-06-57

and the final rendered pic would look like this
renderdocui_2016-10-05_22-08-35

@kd-11
Copy link
Contributor

kd-11 commented Oct 6, 2016

Thanks. I now know where to start looking. The first step is usually to figure out what the shader is trying to do and then fix whats broken in the pipeline. Hopefully I can find some time over the weekend to analyze this.

@kd-11
Copy link
Contributor

kd-11 commented Oct 6, 2016

@Sarania Did you solve your sluggish performance? I'll try to restore and improve the performance counters so we can see where the game is spending all that time. Hatsune miku games are usually easy to run.

@RainKikyou
Copy link

RainKikyou commented Oct 6, 2016

@kd-11 There are some performance improvements but not enough,Such as the following picture
This is the 4.1 GHZ
qq 20161006201358
qq 20161006195659
qq 20161006201335
This scene 4.0GHZ state only 18fps
qq 20161006195721

@Nezarn
Copy link
Author

Nezarn commented Oct 6, 2016

@kd-11 btw in this game there are some extreme slowdowns, for example https://youtu.be/KumW8B-hpJY?t=2m27s (this is a video from PS3, and at ~2:27 you can see bunch of neon lights, now those are killing FPS big time (50+ -> ~10-20) )

@kd-11
Copy link
Contributor

kd-11 commented Oct 6, 2016

Based on GPU-Z the GPU is starved (load is at 37%). I'm assuming the problem is that we're probably stalling on synchronization since I don't see any CPU core getting maxed out. You can test by running with null renderer. You cant see output since it doesnt use the GPU, but it gives a baseline CPU performance.

@RainKikyou
Copy link

RainKikyou commented Oct 6, 2016

@kd-11 Romeo & Cinderella Is still around 40fps
qq 20161006202723

@Nezarn
Copy link
Author

Nezarn commented Oct 6, 2016

@kd-11 now that i've checked GPU-Z, my card has yet another issue in Vulkan, yay. xD (always 100% gpu usage in Vulkan, even on 2D stuff, and its not any game's fault, since even Hello World sample has 100% gpu usage too O.o)

Also in this game for me, GPU usage in OGL is weird, sometimes i hit as low as 2%, max it hits is like ~80%, but it fluctuates a lot, also there are slowdowns even when the gpu usage is at only 60%

@RainKikyou what if you use LLVM? With LLVM i get fullspeed with Null renderer + my cpu starts to slow down its turbo boost since cpu usage is so low (with null renderer, also i've used Romeo and Cinderella too)

2016-10-06_14-50-31

without LLVM:
2016-10-06_14-54-15

Im not a dev, but i think we have a bottleneck or threading\timing issue somewhere.

@kd-11
Copy link
Contributor

kd-11 commented Oct 6, 2016

Usually caused by synchronization stalling, so yeah, its probably a threading issue. I need to optimize OGL backend again but I usually tackle that when there isn't much to work on. Vulkan could use some minor optimizations as well.

@RainKikyou
Copy link

RainKikyou commented Oct 6, 2016

Again, once again. 6700K can not use llvm
qq 20161006212742

@Nekotekina
Copy link
Member

Utilities/JIT.cpp:254

        .setMCPU(llvm::sys::getHostCPUName() == "skylake" ? "haswell" : llvm::sys::getHostCPUName())

Something like this.

@RainKikyou
Copy link

@Nekotekina thank,can use llvm.but the number of frames is extremely unstable, and there will be broken sound appears
Up to 50 FPS or so
qq 20161006220305

@Nezarn
Copy link
Author

Nezarn commented Oct 6, 2016

@RainKikyou @Nekotekina yep, in the 2nd game sound is stuttering with LLVM, but in the Extend version its not. (another sample for threading issue?)

@RainKikyou
Copy link

RainKikyou commented Oct 6, 2016

This is the case, but the number of frames is still not as stable as 2and so bad
use llvm:裏表ラバーズ,Rolling Girl,初音ミクの激唱-pv
https://youtu.be/F7xkNW3aJYc
I feel this game is not real 60fps, I played PDFT (the same 60fps) so I can clearly feel this video reached full speed but did not reach 60fps
初音ミクの激唱, Look this Way, Baby
https://youtu.be/NpvW_MnuKGY
as well as with the PDF 2d material can not read Take the question
http://imgsrc.baidu.com/forum/cp%3Dtieba%2C10%2C727%3Bap%3Drpcs3%B0%C9%2C90%2C735/sign=c8dfbdbaa0d3fd1f2244aa7e592b477e/f1a281025aafa40f01afe049a364034f79f0198e.jpg
http://imgsrc.baidu.com/forum/pic/item/5f9652da81cb39dbdf6eb7acd8160924aa183074.jpg

@RainKikyou
Copy link

RainKikyou commented Oct 7, 2016

I recorded the emulator and ps4 FT comparison video, although there is something wrong, but still want to be able to help, ps4 the FT and ps3 DT is essentially not very different
https://www.youtube.com/watch?v=NDf9G4uQD3o&index=2&list=PLSIFK7HFXCRYdRdo8E6BHzQcGeI7SoLds

@Nezarn
Copy link
Author

Nezarn commented Oct 8, 2016

@kd-11 i see you made some work towards ogl debug overlay, so i thought i try it (if it works already), if i stop emulation it crashes the emulator with one file from amd driver (i guess ogl), but ingame it can show stuff already, so i made some pics:
http://i.imgur.com/8moKHDD.png
http://i.imgur.com/PDTFwRR.png
http://i.imgur.com/PR6TgBC.png
http://i.imgur.com/0XJ0j9O.jpg
http://i.imgur.com/Ge8ujjT.jpg

@kd-11
Copy link
Contributor

kd-11 commented Oct 9, 2016

Some of the counters aren't done yet, although it seems at least on opengl we are limited by buffer uploads which is expected. I'll work on that. Vulkan should be more interesting once I'm done with it as buffer uploads are not as problematic, and we can easily tell if we are limited in cell emulation or rsx emulation.

@kd-11
Copy link
Contributor

kd-11 commented Oct 9, 2016

@Nezarn You can try from that branch again. Counters are mostly done, so you should see the bottleneck pretty easily.

@Nezarn
Copy link
Author

Nezarn commented Oct 9, 2016

@kd-11

Vulkan: http://imgur.com/a/mPdYj (from some strange bug GPU usage is always 100 (even on master, and even with for example the Hello World sample)
OpenGL: http://imgur.com/a/STZvN (GPU usage is fluctuating a lot, sometimes it even hits 0, then 28, 45, 78, the highest i've seen was 90%, but that wasn't at where\when the slowdowns came)

@Nezarn
Copy link
Author

Nezarn commented Oct 10, 2016

@kd-11 https://www.dropbox.com/s/y6itoa9ecbx0hn0/vulkan.zip?dl=0 (if log isn't enough, i will try get a renderdoc too (and that will take a while since the version that works for you is quite unstable for me >.<)

@kd-11
Copy link
Contributor

kd-11 commented Oct 10, 2016

Log is enough.

@kd-11
Copy link
Contributor

kd-11 commented Oct 10, 2016

@Nezarn https://ci.appveyor.com/project/kd-11/rpcs3/build/1.0.329 should be a proper fix for both vulkan and ogl. if it doesnt work, just post the shader log.

@Nezarn
Copy link
Author

Nezarn commented Oct 10, 2016

@kd-11
Copy link
Contributor

kd-11 commented Oct 10, 2016

Is it fixed on opengl? The shaders looks correct.

@Nezarn
Copy link
Author

Nezarn commented Oct 10, 2016

@kd-11 yep, only Vulkan is still broken

@kd-11
Copy link
Contributor

kd-11 commented Oct 10, 2016

Capture a renderdoc vulkan trace, version 0.31. To ensure that it does not crash for me, after capturing a single frame, exit the emulator first by closing the window by clicking the X and then immediately close the emulator. Renderdoc will then load the trace automatically. Traces captured using this method work for me somehow.

@Nezarn
Copy link
Author

Nezarn commented Oct 10, 2016

@kd-11
Copy link
Contributor

kd-11 commented Oct 10, 2016

Crashes my driver :(
I'm not sure why vulkan would still not be fixed. Try https://ci.appveyor.com/project/kd-11/rpcs3/build/1.0.330 and see if anything changes.

@Nezarn
Copy link
Author

Nezarn commented Oct 10, 2016

Still looks the same

rpcs3_2016-10-10_17-22-48

edit: actually its a little bit darker compared to master
rpcs3_2016-10-10_17-33-49

@RaulDJ
Copy link

RaulDJ commented Oct 10, 2016

Here's mine too, @kd-11 : https://aww.moe/x1vsme.rdc

I hope it helps a bit.

@Waelwindows
Copy link

@RainKikyou that problem is easy, the textures have an alpha map, it seems that the shader isn't using the alpha or is set to an incorrect alpha mode, i currently can't run extend. because i don't have a save. but when i can. il try digging around in render doc to find a fix for this myself

@kd-11
Copy link
Contributor

kd-11 commented Oct 10, 2016

@Nezarn option 2. Use vktrace commandline utility. You can find it in your /bin
To record, run "vktrace -p rpcs3.exe" from the rpcs3 directory. Use the command window for this because even after you close the app it continues recording until you kill it with Ctrl+C. It will capture a very large trace file, so be quick to test and close it. Compressing using something like 7-zip should make the size much smaller after you're done.

@Nezarn
Copy link
Author

Nezarn commented Oct 10, 2016

@kd-11 https://www.dropbox.com/s/ygt4oe6yw4h5cqb/vktrace_out.7z?dl=0

I've looked at this and it will be interesting at playback, i hope theres a pause option XD (ingame with this trace, it ran too fast, and since i didn't recorded a lot, it will end soon)

Should i try and make another (with a full song in PV mode where i don't need to press anything since its slow with vktrace) ?

@kd-11
Copy link
Contributor

kd-11 commented Oct 10, 2016

as long as the error is visible, it should be fine. If it fails, I'll just have to modify the emulator to dump info to the log as usual.

@Waelwindows
Copy link

Waelwindows commented Oct 10, 2016

i've managed to get the code, i've added some comments to help explain what each line does. funfact this shader is the exact same one found in pdf.
(it's layman talk, so please bear with it, it's probably not gonna explain what it does effect wise, it just explains what the code does)
here it is
http://pastebin.com/SjgyUtkr

@kd-11
Copy link
Contributor

kd-11 commented Oct 10, 2016

That shader is common in these games. The bugs usually originate elsewhere in the emu though, might be a texture swizzle mapping; those .yw swizzles might actually match .xz components if the texture was not properly set up.

@kd-11
Copy link
Contributor

kd-11 commented Oct 10, 2016

@Nezarn https://ci.appveyor.com/project/kd-11/rpcs3/build/1.0.331
The trace also crashed, but I think the sdk version i'm using is outdated. I'll update and retry. In the meantime dump rpcs3.log generated by that build.

@RaulDJ
Copy link

RaulDJ commented Oct 10, 2016

@kd-11 Here is mine: https://aww.moe/cf1kq5.log

@Nezarn
Copy link
Author

Nezarn commented Oct 10, 2016

@kd-11 https://www.dropbox.com/s/25uqs2guan6dasp/log.zip?dl=0

edit: just in case i've uploaded another trace, with a full song this time https://www.dropbox.com/s/kj4ed9qkp5actlr/vktrace_out_fullsong.7z?dl=0 (if you can sort out your crash, this is more useful than the first one, since you can see an extra minor bug in it at title screen)

@kd-11
Copy link
Contributor

kd-11 commented Oct 10, 2016

I finally found the issue. It affected some samples as well, and I kept wondering why my register decode fix did not fix this.
Anyway here it is: https://ci.appveyor.com/project/kd-11/rpcs3/build/1.0.332
Oops. Forgot to commit a file

@kd-11
Copy link
Contributor

kd-11 commented Oct 10, 2016

Proper build https://ci.appveyor.com/project/kd-11/rpcs3/build/1.0.334
The fix has been added to the pending PR so we can close this as soon as its merged.

@RaulDJ
Copy link

RaulDJ commented Oct 10, 2016

@kd-11 Holy s***, the absolute madman:

http://i.imgur.com/3CteyiJ.jpg
http://i.imgur.com/YqV55mH.jpg
http://i.imgur.com/mmUcAXF.jpg
http://i.imgur.com/9Relc4l.jpg

Lightning is still a bit strange in some situations but the main problem is fixed.

@RainKikyou
Copy link

RainKikyou commented Oct 10, 2016

@Waelwindows
savadata
https://drive.google.com/open?id=0B4z-S0oOZ2FgWW5IVlVDN3FDNmc
I hope to use skylake llvm do not need to re-compile their own, so too much trouble, hoping to merge as soon as possible to the master

@RaulDJ
Copy link

RaulDJ commented Oct 11, 2016

I would like to point out that with this game the emulator runs at higher framerate with the FPS cap set at "60" instead of "Off". I don't think it makes much sense...

Moreover, with "Off" it never gets past ~63 FPS even when looking at the sky or some plain texture except when the game shows only pictures, which some PVs have.

@Waelwindows
Copy link

@kd-11 well good job. however there's a problem.
1st thing's first. when playing the game the fps is stuck at 30. this could be from my end.
2nd thing is. when sometimes the lighting is stuck on a previous level's lighting
e.g. i played sound which has orange lighting, then played packaged which has white lighting
the game uses that orange lighting of sound

https://youtu.be/VwXOIHuWJDc

@kd-11
Copy link
Contributor

kd-11 commented Oct 16, 2016

We ought to close this ticket as the original problem of broken color indexing was fixed.

@Nezarn Nezarn closed this as completed Oct 16, 2016
@Nezarn
Copy link
Author

Nezarn commented Oct 16, 2016

I'm gonna open another issue for the speed issues

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

No branches or pull requests

8 participants