-
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
Avoid alpha test when vertexFullAlpha && textureFullAlpha #5710
Conversation
Not sure what efficient method to use on x86...
…unknownbrackets-vertexalpha
Conflicts: GPU/GLES/VertexDecoderX86.cpp
The important thing is to ensure that no graphical breakage occurs in as many games as possible. I'll do the usual testing for functionality regressions and performance on my game suite when the pull request has been finalized, kinda at work at the moment. |
In the not equal case, if the ref is 255, then we should actually skip full alpha verts. So I think we need a check there. As far as ambient, I think: if (throughmode) {
stillFullAlpha = hasColor || gstate.getMaterialAmbientA() == 255;
} else {
stillFullAlpha = ((hasColor && (gstate.materialupdate & 1)) || gstate.getMaterialAmbientA() == 255) && (!gstate.isLightingEnabled() || gstate.getAmbientA() == 255);
} Or something like that. -[Unknown] |
Not-equal with REF=255 is likely to be rare, might as well let the alpha test take care of that (returning false). Doing that. |
Alright, I've decided to compile a test build (v0.9.8-108-gdc07d34) based on the Preliminary results indicate no graphical regressions in any game, which is good. Performance gains are minimal to nil, but that is to be expected on a desktop/laptop graphics card architecture where the impact of Alpha Tested Draws weren't as heavy to begin with. Seems alright, at least with the games tested and using my Core 2/ATI 4670 based laptop. |
Thanks for your testing solarmystic. I think I'll just merge it. |
Avoid alpha test when vertexFullAlpha && textureFullAlpha
Thanx alot! You can consider this a similar idea to what I requested here: |
@VIRGINKLM , yes it's an old idea, it's a tricky one to get right though :) |
Helps ALOT on PowerVR SGX 544MP on games and scenes that contain ALOT of object textures that pass through alpha. Almost the same performance as disabling it via hack. Great Job! |
Great! Maybe can kill the hack soon. @VIRGINKLM , if you find a game where the hack still helps a lot, let me know. |
The hack and this commit usually help those games that have objects that their textures have alpha on all of their axes, usually that's elements like trees, leaves and particles. Having in mind that usually these come at a huge population when they get used, the games that get huge slowdowns are the ones that the have alot of them rendered onscreen. Now, if you disable it with the hack, you will break alot of things (since the population is high) so, I don't know how much sense the hack makes having in mind this fact, since you will end up with a pretty weird visual result, maybe even game-breaking. You could experiment for now using it as a full/half check if you want, half for the optimized and full for disabled. |
Actually, this commit helps many games that just leave alpha testing enabled when rendering solid geometry. It doesn't actually speed up alpha testing, it just makes sure it's turned off when not needed. While the hack helps games that do use alpha testing for real, but just breaks them :) I think I'll just kill the hack soon. |
Fro this issue , revert 2c76e6d exactly will show the missing stuff again. |
This reduces the amount of alpha tested draws calls from 98% to about 20% in Grand Theft Auto - LCS.
Won't have as drastic results in all games but will help some.
This is important because alpha testing is terribly expensive on mobile chips, especially PowerVR and Tegra 3 but also others. PSP games just use it willy nilly without caring because on PSP it's free, so we need to rule out when it will have an effect and disable it as often as possible without breaking graphics.
This is not yet taking into account that the lighting equation could possibly change alpha. All games I've tested still draw fine though, but this will also need to be addressed.