-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Texture upscale shader rework (drastic perf improvement) #15109
Conversation
…ten it for benefit of mobile GPUs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems like we still have an unused computeCopy
bool.
-[Unknown]
|
||
// Rachet down scale factor in low-memory mode. | ||
if (lowMemoryMode_) { | ||
// TODO: I think really we should just turn it off? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe. Nowadays it's most common on mobile:
https://report.ppsspp.org/logs/kind/724
-[Unknown]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Leaving it as is in this PR, but yeah.
The 4xBRZ shader works on ARM Mali GPUs now by the way, so I removed the blacklisting. |
This is also fix my issue #14530 |
The latest ppsspp build 4xBRZ is slow on my phone compare to this build I don't know which commit cause the lag issue. |
Hm. Do you have Texture Filtering set to "Auto Max Quality"? Just wondering if that might be related, since it'll add some extra work at texture creation time. |
Yes I enable it together with 4xBRZ but after I disable auto max quality the game is still slow/lag if 4xBRZ is enable. here's some logs idk if this is useful.
|
Nah, looks like those logs are from some previous crash? I'm going to look into this properly, starting with #15229 (which also disables shader upscaling of video) |
GE Dump using ppsspp v1.12.3-453 |
@Gamemulatorer do you think you could try to find about in which commit it slowed down? Or maybe it's just some changed setting? Anyway, #15230 should make this a little bit faster at least (though Adreno seems to benefit more). |
It's missing due to Gradle / Android SDK stability/quality issues. Requeued again... -[Unknown] |
OK, thanks. I might try to enable the GPU profiler automatically when stats are displayed, but I think I know what's going on here. The game is rendering at 60hz, but it's doing some animation of a large background texture every couple of frames. Unfortunately, running the upscaling shader plus mipmap generation on a 512x512 texture takes ~30ms on hardware similar to yours, while due to the 60hz framerate, we have a 16ms deadline to get it done (and in practice less). So I don't think this could have ever worked smoothly on your hardware with texture upscaling enabled, unless we've changed something that previously caused it to skip upscaling. One thing I will do is disable mipmap generation for 512x512 textures since those are hardly ever used for 3D things, but that would only happen if you had Auto Max Quality enabled anyway.. I still don't think we can hit the deadline here unless we find some really good optimizations of the upscaling algorithm, or switch to a different one. |
I just notice in the latest build that only in menu of Tales Radiant Mythology is lag but in game is smooth with 4xBRZ or 2xBRZ maybe this game is behaving the same as #12463 |
Yeah, it works fine in many games, this game is just a bit "extreme". All I'm saying is that I don't think texture scaling actually slowed down from previous builds, it's just this particular game that's using textures in a tricky way. |
I've been messing around with it a bit more and it seems like older Mali drivers will aggressively downclock to save power if a heavy compute shader happens only every few frames. If I hack out part of the algorithm so it makes it under a frame, GPU clockspeed seems to stay high, and the scaler runs many, many times faster. So weird. I think I'm going to set a limit at Mali-G72 or something, and below that we'll use similar rules as the software scaler - not scaling large textures that change a lot. |
Maybe it's an anti bitcoin miner malware feature... -[Unknown] |
That might actually be interesting to try, I just yesterday saw it mentioned in Android documentation (search for affinity in https://developer.android.com/games/optimize ). However since in this case it's the GPU that's clocking down, it's probably not gonna help much... |
Applies the same rules as for software upscaling in this case. Should fix the stutters seen in #15109
Applies the same rules as for software upscaling in this case. Should fix the stutters seen in #15109
This drastically improves the performance of (Vulkan-only) compute-shader based texture upscaling, making it perform stutter-free on much more lower end GPUs.
Texture upscale shaders now each have a fixed scale factor, and instead of computing each 2x2 or 4x4 for every pixel and sampling from that, each individual thread of the compute shader writes all four or sixteen pixels that it computes anyway.
This does mean that we now only have these two variants of compute shader upscaling, but more can be added:
It also fixes #13679 and #15094, and removes a bunch of unused code.
Verified on NV, Intel, Adreno and Mali GPUs, plus Apple through MoltenVK.