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

Do depth copy in through mode as well #5071

Closed
wants to merge 3 commits into from
Closed

Do depth copy in through mode as well #5071

wants to merge 3 commits into from

Conversation

dbz400
Copy link
Contributor

@dbz400 dbz400 commented Jan 10, 2014

As always , not too sure if it is totally correct and may need more testing .Tested on my NV system and better performance loss than previously .(less than 10 FPS in unthrottling mode)

Tested with the following games that may require depth copy to work propertly

  1. Saint Seiya Omega
  2. Ys 7
  3. Gundam AGE Universe
  4. Jeanne D Arc

@dbz400
Copy link
Contributor Author

dbz400 commented Jan 10, 2014

Also fixes #5068 .May help #5028 and #5070

@@ -879,7 +879,7 @@ void FramebufferManager::SetRenderFrameBuffer() {

#ifdef MAY_HAVE_GLES3
// Let's only do this if not clearing.
if (!gstate.isModeClear() || !gstate.isClearModeDepthMask()) {
if (!gstate.isClearModeDepthMask() && gstate.isModeThrough()) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did you remove the gstate.isModeClear() check? What is the rationale/reasoning for not allowing this in throughmode?

I'm pretty sure that throughmode is just as capable of doing depth testing.

-[Unknown]

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed , I only test it based on real game to see if it works propertly and how's the compability in general case .

Of course it may not cover all cases and only best effort .

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I still don't understand the clearmode check removal.

At the least it should have a comment saying that why throughmode is excluded, and that it is a hack to attempt to improve performance.

-[Unknown]

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have added comment to specific mention it is a hack and why throughmode is excluded.

if (!gstate.isModeClear() || !gstate.isClearModeDepthMask()) {
// Note : It is a hack to improve performance in general case .Exclude throughmode is used for the
// intermittent sprite missing in Star Wars Force Unleashed
if (!gstate.isClearModeDepthMask() && gstate.isModeThrough()) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I still don't understand why you removed the isModeClear() check, and if I read this correctly, you're ONLY doing it during throughmode, not excluding throughmode.

-[Unknown]

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done .I put the !gstate.isModeClear() back :)

@psennermann
Copy link

And what about #5064 ? Wouldn't it be fixed as well?

@daniel229
Copy link
Collaborator

It does not fix #5064

@solarmystic
Copy link
Contributor

@raven02

The newly changed commit in this pull request causes the performance to be bad again.

To clarify, for line 882 in GPU/GLES/Framebuffer.cpp, when if (!gstate.isModeClear() || !gstate.isClearModeDepthMask()) { (current master line) is changed to

if (!gstate.isClearModeDepthMask() && gstate.isModeThrough()) { which you originally suggested in your #5070 (comment) helps restore performance close to what it used to be while still fixing the Jeanne D'arc issue with missing characters..

screen00330

However, putting back !gstate.isModeClear() into that line,

if ((!gstate.isClearModeDepthMask() && gstate.isModeThrough()) || !gstate.isModeClear()) { which is what the current pull request has now been changed to does nothing to improve the performance in GBE.

screen00331

Just an observation, since if this pull request is merged as it is right now, #5070 will not be fixed since the commit has been altered. It seems like adding back the !gstate.isModeClear() line makes the performance awful again for some reason.

@unknownbrackets
Copy link
Collaborator

Well, as I said, it's necessary to check both, but the code didn't make sense in the beginning and still doesn't make sense.

If gstate.isClearModeDepthMask() is true, AND gstate.isModeClear() is true, then we definitely do not want to copy the framebuffer. It'd be pointless, since it's about to clear it with 95%+ certainty.

if (!(gstate.isModeClear() && gstate.isClearModeDepthMask()))

It happens that this is logically identical to:

if (!gstate.isModeClear() || !gstate.isClearModeDepthMask())

That's what the code currently does. If a hack is added to skip this except in throughmode, (which I still expect there may be better ways, and sitll doesn't really make sense to me), then it would be one of:

if (gstate.isModeThrough() && !(gstate.isModeClear() && gstate.isClearModeDepthMask()))

if (gstate.isModeThrough() && (!gstate.isModeClear() || !gstate.isClearModeDepthMask()))

The current code does not make sense. It says to copy the framebuffer always if clear mode is off, OR if (clear depth is off AND it's not throughmode.)

The point is that gstate.isClearModeDepthMask() is an invalid value when gstate.isModeClear() is false. A check of only gstate.isClearModeDepthMask() (without some related check of gstate.isModeClear()) is ALWAYS A BUG, imho, because its value is meaningless without knowing if it's in clear mode. So you must also check gstate.isModeClear().

-[Unknown]

@dbz400
Copy link
Contributor Author

dbz400 commented Jan 12, 2014

Anyway , I gonna close this and hopefully we can have a better option here :)

@dbz400 dbz400 closed this Jan 12, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants