libretro / beetle-psx-libretro

Standalone port/fork of Mednafen PSX to the Libretro API.
GNU General Public License v2.0
310 stars 130 forks source link

graphical issues that are not present in standalone mednafen #39

Closed personaone closed 6 years ago

personaone commented 8 years ago

Hi Guys,

Just noticed the issue in FF8 - at the left edge of the bridge in Dollet, when characters pass a certain point they start blinking (flashing) rapidly. This isn't happening in Mednafen 0.9.38.7. Not sure if the Libretro core is behind on the source? The newest one shows that it's 0.9.38.6. Using the latest nighty RA as well with no special settings in the core menu.

inactive123 commented 8 years ago

It might miss some insignificant things here and there. It can probably be backported easily. Try ensuring that resolution is left at 1x, 2x might introduce more bugs, same thing with the overclocking option, etc.

Anyway, at this point, Beetle PSX has enough to recommend itself so it's a fair tradeoff, I am fine with backporting whatever is needed to make things more accurate but first it needs to be found what has to be backported, and I don't want it to bump up compiler requirements, otherwise it needs to be rewritten.

personaone commented 8 years ago

Right, thanks - i'm running all native, no upscaling or anything, haven't changed anything in the core settings :) Even tried turning off shaders and stuff, still the same thing. Interesting issue since it's been occuring ever since I remember. Just failed to report it then. Let me know if there's anything else I can test!

Warriors-Blade commented 8 years ago

I can vouch for this issue, I have encountered it through various parts of the game and just to make sure I tested it with the latest vanilla and the issue is fixed.

Do you need a video sample showcasing the graphical glitch?

inactive123 commented 8 years ago

We should first figure out at which Mednafen version this was fixed, then we can backtrack and figure out what was responsible for fixing this and then backport that.

That we only have tarball diffs to go by for each new Mednafen release complicates this a bit, but it's do-able.

hizzlekizzle commented 8 years ago

Has anyone verified that standalone v0.9.38.6 had the same behavior? That is, is this actually something that can be resolved by backporting a fix, or was it divergent behavior from the start?

Oggom commented 8 years ago

It's probably this change:

December 5, 2014: PSX: Fixed some precision-related bugs in the triangle rendering code; fixes the flickering-characters issue that occurs at several locations in "Final Fantasy 8". Unfortunately, this fix does increase CPU usage a bit more that I would like, and it's going to be tricky to optimize the difference away.

personaone commented 8 years ago

Hm, any way that I can help finding that piece of code in the mednafen code? I haven't done any coding in years :/

simias commented 8 years ago

@personaone you could try diff'ing the version of mednafen that fixed it with the one before that and see what changed in the GPU code (in src/psx/gpu*). At least that's where I'd start, hoping that there haven't been too many changes.

If you do this and the diff ends up being too big or too cryptic don't hesitate to paste it somewhere online, I'll have a look at it.

personaone commented 8 years ago

Yeah I found the source for the version that introduced that change, but the previous to that, 0.9.36.5 - was hosted on Sourceforge and all of mednafen's file are gone from there o_O I wonder where I can find that thing now.

Oggom commented 8 years ago

https://github.com/libretro/mednafen-git/commits/master

personaone commented 8 years ago

@Oggom thanks for that

Here goes... a diff for the gpu.cpp is here:

http://pastebin.com/JVc1dvB6

And gpu.h:

http://pastebin.com/T09qrBZG

Let me know if this even makes sense :p

simias commented 8 years ago

Can I get a savestate that exhibits this issue in FFVIII?

personaone commented 8 years ago

Yep, sure. ff8.state3.zip

personaone commented 8 years ago

@simias any chance you could figure this one out? Let me know if I can help test anything furhter.

mjuzikfrik commented 7 years ago

Any chance to fix this issue?

NelsonRosenberg commented 7 years ago

Also would like to know if there is a fix available. Thank you.

simias commented 6 years ago

I've managed to fix the flickering by porting some of the newer mednafen code, however I seem to have broken something else because now some polygons seem to randomly glitch out. My code is here if somebody wants to play with it: https://github.com/simias/beetle-psx-libretro/tree/gpu-precision

Also note that increasing the internal resolution is also broken, but that I know how to fix.

I'm going to keep trying but this GPU code has been so viciously butchered by our various hacks (increased IR, PGXP...) that it's a bit painful to merge back with upstream mednafen. If I can't figure this out I'm just going to import the current mednafen version as-is and then reimplement our hacks on top of it.

simias commented 6 years ago

Okay, it was easier than I expected, I think the latest commit in my gpu-precision branch should've fixed it.

I haven't thoroughly tested it though, I'd appreciate it if somebody could give it a try and make sure that the issue is fixed and than I haven't introduced any regression.

If it works as intended I'll remove the C++11 code and fix the internal resolution hack and we should be good to go.

Slow and steady.

inactive123 commented 6 years ago

I tested it, couldn't notice any regressions so it appears things are good.

The only thing I did notice in Dead or Alive 1 and wipeout XL was that there is sometimes some unintended geometry being drawn at the right hand side of the screen. This is only if 'memory only ' PGXP and perspective correction is enabled though, so maybe it's just the imperfect nature of those graphics features.

Otherwise, seems good. I also notice that the intro screens in FF8 were previously very slow, now they are fullspeed. This intro sequence also seemed to be interlaced before, so maybe that's also one of the issues people were talking about. Seems like a big improvement.

simias commented 6 years ago

Cool, thank you for testing that!

mjuzikfrik commented 6 years ago

Better late than never. Very good news! :)

personaone commented 6 years ago

Wow it’s happening!:)

simias commented 6 years ago

I've managed to get upscaling to work again mostly, however I have a weird seam in the textures that needs further debugging (probably a rounding error somewhere):

ctr - crash team racing usa -171005-232226

Anyway, progress!

simias commented 6 years ago

I think it works now (needs more testing though). Note that the flickering glitch in FFVIII reappears when I increase the internal resolution, looks like this particular game is very finicky with its triangle drawing code. At least now it seems to work accurately at 1x so we're on a par with upstream.

simias commented 6 years ago

Arg, I've just noted that 4x and up is broken, missing polygons everywhere. I doubt many people use that given the performance but still...

personaone commented 6 years ago

I’ll take accuracy over res anyway;) awesome work!

simias commented 6 years ago

Okay, I fixed the issue at 4+x and tested it with a bunch of games, it seems to work fine as far as I can tell.

Also the flickering in FFVIII is now fixed even with increased IR so that's nice.

Please do report any regression I missed!