hrydgard / ppsspp

A PSP emulator for Android, Windows, Mac and Linux, written in C++. Want to contribute? Join us on Discord at https://discord.gg/5NJB6dD or just send pull requests / issues. For discussion use the forums at forums.ppsspp.org.
https://www.ppsspp.org
Other
11.03k stars 2.15k forks source link

Tactics Ogre: Multiple Graphical Issues #2758

Closed TallgeeseHeaven closed 11 years ago

TallgeeseHeaven commented 11 years ago

Initially this issue note was for the world map, but it was deemed to be better to consolidate all of this game's various graphics issues into one ticket.

First, attached is a screen of what the world map looks like on a PSP system:

Imgur

Buffered rendering of this map has had around five distinct stages. I hope that this is helpful in diagnosing the issue.

Stage 1: Completely black screen except for the text.

Stage 2:

All further screens are with Buffered Rendering ON and Skip Updating PSP Memory OFF. This is from around when Skip Updating PSP Memory was first implemented:

Imgur

Stage 3: https://github.com/hrydgard/ppsspp/commit/0eadfdcf62f8a60dfb2f83243ad9c700acc55bec

This commit suddenly breaks the map. Result:

Imgur

Stage 4: https://github.com/hrydgard/ppsspp/commit/76c3f16b5cf238a8c6548d05e4873b9a2ef1f7b2

This commit makes the map display again, like so:

Imgur

Stage 5: https://github.com/hrydgard/ppsspp/commit/605cf266211d4630800da2cbcc9cda53b0953378

This reversion breaks the map again, returning us to Stage 3. This is where it remains as of the latest GIT build, as well as raven02's recent build that fixed the logo.

I have an HD Radeon 7850, if that matters. If there is any other information I can give, please ask.

unknownbrackets commented 11 years ago

That last one is interesting. What if you change this: AttachFramebufferInvalid(entry, framebuffer);

To Valid? Although, that seems wrong, they are different types.

-[Unknown]

raven02 commented 11 years ago

If remember correctly, change that one to valid should be no effect as it directs to the subarea texture routine

        } else if ((entry->addr - address) / entry->bufw < framebuffer->height) {
            WARN_LOG_REPORT_ONCE(subarea, HLE, "Render to area containing texture at %08x", address);
            // TODO: Keep track of the y offset.
            // Affected game List : God of War Ghost of Sparta , Tactic Orge , Sword Art Online
            AttachFramebufferValid(entry, framebuffer); 
raven02 commented 11 years ago

I think it is safe to comment out that entry->invalidHint == -1 without breaking things.

unknownbrackets commented 11 years ago

Well, I guess that's fine, its purpose was to avoid rendering garbage but most of the checks are Valid anyway now.

-[Unknown]

raven02 commented 11 years ago

Thanks .If no one beats me , i will send out a pull for it .

solarmystic commented 11 years ago

@raven02 @unknownbrackets

Heh, that https://github.com/raven02/ppsspp/commit/7f5b87361eeeb917383398b8b167e9ec03304a6d commit in https://github.com/hrydgard/ppsspp/pull/3640 pull request may have solved the map flickering problem, but it introduced another graphical issue.

0.9.1-578 https://github.com/hrydgard/ppsspp/commit/20f6e4b0dec0ecfdb3dec014dd4ecfa373c399b4 :- capture

This did not exist in the previous revision without the commit (0.9.1-576) https://github.com/hrydgard/ppsspp/commit/f5375b794b508368b99f5cd4019069aeffb9948f :- capture2

Temporary solution for this issue is the same like the previous one, resize your window, switch rendering modes, and the problem will go away. Until the next time it happens of course.

Video demonstration of the issue:- http://www.youtube.com/watch?v=5ou6N0WXAm0&feature=youtu.be http://www.mediafire.com/?0xarh1bli4jcsc1

raven02 commented 11 years ago

Alright .I just back home and test again .Looks like even though i put back the || entry->invalidHint == -1 in latest source code here now , it still show the above graphical error , can you confrim from your side as well ?

Only comment out the keep framebuffer alive one fixes both issues.

    // Keep the framebuffer alive.
    // TODO: Dangerous if it sets a new one?
    //entry->framebuffer->last_frame_used = gpuStats.numFlips;
solarmystic commented 11 years ago

@raven02

If I put back the || entry->invalidHint == -1 in the latest source code I don't get the above error (blue screen error) for my ATI card. I get the world map flickering error again though, like I would expect, since we reverted the fix.

Same results as in my previous post, just altered the single line like you instructed on latest source code based on the v0.9.1-580-g515874c https://github.com/hrydgard/ppsspp/commit/515874c14743e33e5eb48d9ca347798c7a1d3e97 master.

capture

capture1

Perhaps it's an NVIDIA only thing. Commenting out the keep framebuffer alive commit does fix both issues though.

raven02 commented 11 years ago

@unknownbrackets , any alternative we can try here or it is safe to comment out that keep framebuffer alive at this time being?

unknownbrackets commented 11 years ago

It's strange in the first place, I've been busy lately but I'll have to just list out the framebuffers and textures again and build a story of what the game is trying to do, then figure out how to make PPSSPP sing a long with that story.

-[Unknown]

raven02 commented 11 years ago

Sure @unknownbrackets .

unknownbrackets commented 11 years ago

It's confused because there are multiple framebuffers at the same address. If I switch it to just force the format:

    // Find a matching framebuffer
    VirtualFramebuffer *vfb = 0;
    for (size_t i = 0; i < vfbs_.size(); ++i) {
        VirtualFramebuffer *v = vfbs_[i];
        if (MaskedEqual(v->fb_address, fb_address)) {
            // Let's not be so picky for now. Let's say this is the one.
            vfb = v;
            // Update fb stride in case it changed
            vfb->fb_stride = fb_stride;
            vfb->format = fmt;
            if (v->bufferWidth >= drawing_width && v->bufferHeight >= drawing_height) { 
                v->width = drawing_width;
                v->height = drawing_height;
            } 
            break; 
        } 
    }

It works fine (blur on map, no flicker, dialog is fine.)

-[Unknown]

raven02 commented 11 years ago

That's good .Just tested put back the following one that i previously remove , also works fine.

    if (!entry->framebuffer || entry->invalidHint == -1) {
unknownbrackets commented 11 years ago

It may break other games, I didn't really try it. The above reuses buffers (and more importantly, does not resize / embiggen them afaik) used at the same address even with a different format.

-[Unknown]

raven02 commented 11 years ago

Alright. I will try it with other games and report here.

raven02 commented 11 years ago

This one definitely a lot better for games.

It fixes Kurohyou 2, Evangelion Jo and Kingdom Hearts https://github.com/hrydgard/ppsspp/issues/3237

-Kurohyou 2, Before screen00014

After screen00022

-Evangelion Jo

Before screen00013

After screen00018

-Kingdom Heart Before screen00015

After screen00020

unknownbrackets commented 11 years ago

Note that this is only safe when true color is enabled/forced.

-[Unknown]

raven02 commented 11 years ago

I see. Those above screenshots is using TrueColor = True.

BTW, also fixes the Midnight Club 4 .https://github.com/hrydgard/ppsspp/issues/3578

unknownbrackets commented 11 years ago

Oh, and alternative might be to scan fbCache_ in DetachFramebuffer().

-[Unknown]

raven02 commented 11 years ago

I just tried the new code above but seesm to be not working propertly when compared to previous one.

raven02 commented 11 years ago

FYI. The old code fixes the shadow in the Kingdom Heart as well . screen00024

unknownbrackets commented 11 years ago

When you say the new code, you mean deleting the old framebuffer, right? In other words, 69e4b34 works but b56c9e5 doesn't?

-[Unknown]

raven02 commented 11 years ago

Yes , correct . Only 69e4b34 works okay but not b56c9e5

raven02 commented 11 years ago

Just wonder what does it mean ?

        if (v->bufferWidth > drawing_width && v->bufferHeight >= drawing_height) { 
            v->width = drawing_width;
            v->height = drawing_height;
        } 
raven02 commented 11 years ago

As with that ifdef check , Kingdom Heart scene looks like this

screen00026

Remove the check which is

        v->width = drawing_width;
        v->height = drawing_height;

screen00025

unknownbrackets commented 11 years ago

This is with the old code right? That's the problem I'm trying to avoid. The framebuffer is not resized.

Probably scanning fbCache_ will help, don't have time now.

-[Unknown]

raven02 commented 11 years ago

Yes , it is with old code.

raven02 commented 11 years ago

May be later we can try the scanning fbCache_ in DetachFramebuffer()

raven02 commented 11 years ago

Unfornaturely , the old code causes some artifact in GOW . Seems to be rendered some garbages.

screen00027

unknownbrackets commented 11 years ago

Aha. I found a better fix. Testing more, this is likely to fix KH and others.

-[Unknown]