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

Color-convert framebuffers that are bound as CLUT textures #5767

Merged
merged 24 commits into from
May 27, 2014

Conversation

hrydgard
Copy link
Owner

Not quite ready to merge yet, just requesting comments and testing. Needs cleanup and, well, testing.

Shadows look correct in FF Type 0 with this. Don't really know if it will fix anything else atm. It probably does something in 3rd Birthday.

@@ -1,309 +1,315 @@
<?xml version="1.0" encoding="utf-8"?>
Copy link
Collaborator

Choose a reason for hiding this comment

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

Hmm, this keeps happening...

-[Unknown]

Copy link
Owner Author

Choose a reason for hiding this comment

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

Something is really broken with my VS, it's not just this. Think I'll reinstall soon. Anyway, I'll squash this before merging, thanks.

@solarmystic
Copy link
Contributor

@hrydgard @unknownbrackets
Will do the usual testing once the pull request has been finalized a bit. It seems to be in a state of flux at the moment, so the results will not accurately reflect the final outcome.

@solarmystic
Copy link
Contributor

Scratch that thought, I just did a git checkout and decided to try it out anyway.

The 3rd Birthday is visibly improved by these commits using default settings (that means Enable Alpha Hack is disabled), but is still not quite right (look at the lower left hand corner of the screen):-

ulus10567_00001

Using the Alpha Mask Hack doesn't do anything anymore, which makes the hack useless when this pull request is merged to master:-

ulus10567_00002

I can also confirm that FF Type 0's shadows are definitely "fixed" (blobby, but black now), even on my ATI card:-

npjh50443_00000

case 8: strcpy(lookupMethod, "index.b"); break;
case 12: strcpy(lookupMethod, "index.a"); break;
}
multiplier = (1.0f / 16.0f) * 255.0f / 256.0f; // Need the fudge factor to not "wrap"...
Copy link
Collaborator

Choose a reason for hiding this comment

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

Hmm, I'm having trouble with this logic.

Let's assume the color is fully opaque white. All components are therefore 1.0.

The goal state is palette entry 15 (which is the 16th palette entry, of course.) The above code will generate 0.062256 or so, which is pretty much 16. But since vec2(0.0, 0.0) is a valid coordinate, won't that pick entry 16 (the 17th?)

Maybe it needs a floor() at some stage...

-[Unknown]

@solarmystic
Copy link
Contributor

Anyway, here's the complete (for now) table of results for the current clut branch in this pull request for your perusal:-

capture

General observations:-
a. FF Type 0's shadows are fixed as expected.

b. The 3rd Birthday's blue fog is mostly cleared up, but some graphical artifacts can be observed on the lower left corner of the screen. These artifacts change according to the action on the main screen.

c. Interestingly, MGS Peace Walker undergoes a graphical regression (change?) with this change. In the introductory real time cutscene and the part where Snake trains with his subordinates is now white tinted instead of green tinted as has been the case for all previous revisions.

ulus10509_00000

ulus10509_00001

Previously (correct, according to http://youtu.be/yiEeX5zChr4?t=18m21s) :-

ulus10509_00003

ulus10509_00004

d. The rest of the games tested are graphically unaffected by this pull request.

@unknownbrackets
Copy link
Collaborator

Unfortunately, this doesn't work in Dragon Ball Z Tag Team right now. There is a demo:
http://www.pspdemocenter.com/page.php?id=3650

Dragon Ball uses:

  • pixel=8888, clut=5650, mask 0x7f, shift 24, base 0 (clut 32)
  • pixel=8888, clut=5650, mask 0xff, shift 5, base 0 (clut 16)
  • pixel=5650, clut=5650, mask 0xff, shift 5, base 0 (clut 16)
  • pixel=4444, clut=5650, mask 0xff, shift 5, base 0 (clut 16)
  • pixel=8888, clut=8888, mask 0x01, shift 0, base 0 (clut 16)
  • pixel=4444, clut=8888, mask 0x01, shift 0, base 0 (clut 16)
  • pixel=4444, clut=8888, mask 0x01, shift 1, base 0 (clut 16)
  • pixel=4444, clut=8888, mask 0x01, shift 2, base 0 (clut 16)
  • pixel=4444, clut=8888, mask 0x01, shift 3, base 0 (clut 16)
  • pixel=5650, clut=5650, mask 0x7f, shift 24, base 0 (clut 32)
  • pixel=8888, clut=8888, mask 0xff, shift 0, base 0 (clut 4)

This game may be receiving the prestigious "evilest game of the month" award.

I'm pretty sure the alpha is correct, because iirc when I downloaded the texture and sent it through our normal clut routines, it did display right (this was of course not fast.) Dunno if we're gonna be able to do this one accurately though...

3rd Birthday uses: (all even during the video, weirdly enough...)

  • pixel=8888, clut=4444, mask 0xf, shift 12, base 0
  • pixel=4444, clut=4444, mask 0xf, shift 0, base 0
  • pixel=8888, clut=4444, mask 0xf, shift 0, base 0
  • pixel=4444, clut=4444, mask 0xf, shift 12, base 0
  • pixel=8888, clut=8888, mask 0xff, shift 0, base 0

This does fix 3rd Birthday, but only at 1x. So that sounds easy to fix. I'm not sure if the effect is perfectly accurate but it seems mostly to be working.

I think we've got some lag/issues with the framebuffer format.

-[Unknown]

@dbz400
Copy link
Contributor

dbz400 commented Mar 30, 2014

Dragon Ball Z Tag looks bit better now though still have some artifacts.

uljs00311_00000

@daniel229
Copy link
Collaborator

Kurohyou 2 a white square on the corner in some case,and it remove the over bright.
03
04

@unknownbrackets
Copy link
Collaborator

@solarmystic based on this video I'm assuming the previous effect was correct, does that sound/look right?

http://youtu.be/yiEeX5zChr4?t=18m21s

-[Unknown]

@solarmystic
Copy link
Contributor

@unknownbrackets
Yep, the previous effect was correct, so this is definitely a confirmed graphical regression for MGS Peace Walker. Thanks for the video.

@dbz400
Copy link
Contributor

dbz400 commented Mar 30, 2014

God of War both series still look correct . Downsteam Panic still got missing background .
ulus10322_00000

@dbz400
Copy link
Contributor

dbz400 commented Mar 30, 2014

@unknownbrackets , can we still have the link of report with those "Render to texture with different formats" ? so we can check them .

@unknownbrackets
Copy link
Collaborator

http://report.ppsspp.org/logs/kind/254

-[Unknown]

@dbz400
Copy link
Contributor

dbz400 commented Mar 30, 2014

Thanks @unknownbrackets

@dbz400
Copy link
Contributor

dbz400 commented Mar 30, 2014

Probaby the shadow is only good in some areas only ? It renders as a square one here .

npjh50444_00000
npjh50444_00001

@hrydgard
Copy link
Owner Author

@unknownbrackets , if we allow ourselves use of modern desktop GL we can do anything, as we can just create a secondary view of the texture as single-channel I32 and go to town with integer math, like Dolphin is doing for everything pixel-related nowadays. However as we aspire to maintain ES 2.0 compatibility we should try to avoid that. Possibly we should make two paths here, one easy-to-debug integer one and one downlevel mobile.

It does appear that our framebuffer format may be going off sync sometimes, as some of those really don't make much sense.

@dbz400
Copy link
Contributor

dbz400 commented Mar 30, 2014

3rd birthday artifact at the lower left hand corner looks like have been fixed now.

FF type-0 snow area nows renders full screen though wrong color. Humm menu also looks wrong somehow
npjh50444_00002
npjh50444_00003

@hrydgard
Copy link
Owner Author

@raven02 , can you grab me some savestates in areas with problems, like the snowy one?

@dbz400
Copy link
Contributor

dbz400 commented Mar 30, 2014

@hrydgard
Copy link
Owner Author

@raven02 , doesn't seem I have permission to access it, sent you an access request.

@dbz400
Copy link
Contributor

dbz400 commented Mar 30, 2014

First time use it :) .Change it to share to public .

@solarmystic
Copy link
Contributor

The white coloration issue in Peace Walker during the opening sequence is still present, even after the newest commits have been added to the clut branch:-

ulus10509_00005

A reminder of what it's supposed to look like and how it is in the current master:-

ulus10509_00003

@hrydgard
Copy link
Owner Author

Thanks for testing, but don't need reminders, can just scroll up the thread :)

@hrydgard
Copy link
Owner Author

@raven02 ,strange, for me it looks pretty normal in the snow area (although the shadow is quite blurry). What GPU do you have?

@dbz400
Copy link
Contributor

dbz400 commented Mar 30, 2014

My one is Gtx690

@hrydgard
Copy link
Owner Author

Rebased the whole thing on master, getting rid of the silly .filter file issue and such. Also included attempt to fix the red/blue swap in manhunt (yeah, typo in commit name...).

hrydgard added a commit that referenced this pull request May 27, 2014
Color-convert framebuffers that are bound as CLUT textures
@hrydgard hrydgard merged commit 1445d5a into master May 27, 2014
@hrydgard hrydgard deleted the framebuffer-clut branch May 27, 2014 22:26
@daniel229
Copy link
Collaborator

Dragon ball and manhunt 2 look fine
01
02

Kurohyou 2 missing some screen in battle.
03
04

@hrydgard
Copy link
Owner Author

Please create a new issue about Kurohyou, it clearly needs investigation...

@daniel229
Copy link
Collaborator

Have created #6162

@solarmystic
Copy link
Contributor

Looking good so far in terms of functionality, but I'd like to do a comprehensive before and after comparison for the performance hit after this is commited to master. Will post results later.

Comparison is between v0.9.8-890-g1445d5a (latest master + clut branch) and v0.9.8-865-g585050d (last master without clut branch).

@solarmystic
Copy link
Contributor

@hrydgard @unknownbrackets Results for your perusal:-

capture

General observations:-

  1. Results are mixed across the board, i.e. there is no clear trend across the board.
  2. Some games exhibit significant gains in performance, like Tactics Ogre, Persona 2 and Ys Seven.
  3. Others experience very minor to non-existent performance losses. The Monster Hunter games are examples that belong to this category, with the highest net losses after this clut branch was merged to master.
  4. Surprisingly enough, games that were fixed by this clut branch in the test list (like Peace Walker, and the 3rd Birthday) perform roughly the same as before.

Conclusion:-

Performance-wise the branch is a wash, but there have been no major performance regressions in any game in testlist.

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.

10 participants