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

GL renderer bugs #43

Open
twinaphex opened this Issue May 22, 2016 · 215 comments

Comments

Projects
None yet
@twinaphex
Copy link
Member

twinaphex commented May 22, 2016

No description provided.

@twinaphex

This comment has been minimized.

Copy link
Member Author

twinaphex commented May 22, 2016

Soul Blade/Edge

Both software rendering at higher than 1x resolution and the GL rendering produce the same graphics errors here. Only 1x software mode renders the water correctly. Top is GL, middle is software renderer at 4x, and bottom is the software renderer at 1x.

https://cloud.githubusercontent.com/assets/1075274/15454927/e5a59762-2045-11e6-9dcf-710af002807d.png

https://cloud.githubusercontent.com/assets/1075274/15454928/e5a6abe8-2045-11e6-8763-96ed56cd7105.png

https://cloud.githubusercontent.com/assets/1075274/15454929/e5a731bc-2045-11e6-963e-375a9911deda.png

@twinaphex

This comment has been minimized.

Copy link
Member Author

twinaphex commented May 22, 2016

@twinaphex

This comment has been minimized.

Copy link
Member Author

twinaphex commented May 22, 2016

Metal Gear Solid
Codec screens.

Seems to be framebuffer readback related issues here.

@twinaphex

This comment has been minimized.

Copy link
Member Author

twinaphex commented May 22, 2016

Dino Crisis 1

When pausing, these games take the last frame on the framebuffer and they modulate it a bit so the image appears darker/fuzzy.

These kind of effects seem to be broken right now with the GL renderer. Here is an example of how the software renderer looks like when this effect is working properly.

https://cloud.githubusercontent.com/assets/1075274/15455071/c30b1c78-2049-11e6-99d2-1f8e48e54c19.png

@orbea

This comment has been minimized.

Copy link
Contributor

orbea commented May 22, 2016

Edit: Fixed.

Playstation Bios

The opengl renderer causes the background to be blue instead of black and with an offset. The game does not seem to make a difference.

@twinaphex

This comment has been minimized.

Copy link
Member Author

twinaphex commented May 22, 2016

Vagrant Story

There seem to be VRAM framebuffer readback issues with this game.

@twinaphex

This comment has been minimized.

Copy link
Member Author

twinaphex commented May 22, 2016

Doom/Final Doom/Hexen/Star Wars Dark Forces

These seem to be all based on the same software rasterization engine, all of them are broken with the GL renderer. Might never be fixable since other GL plugins don't seem to render them properly either in higher resolutions.

This is broken on the software renderer too at resolutions higher than 1x. The GL renderer right now is broken with these games even at 1x though.

https://cloud.githubusercontent.com/assets/1075274/15455126/0d299108-204b-11e6-9fb3-d6e192d20f17.png

@orbea

This comment has been minimized.

Copy link
Contributor

orbea commented May 22, 2016

Edit: Fixed.

Lunar: Silver Star Story

@simias

This comment has been minimized.

Copy link
Collaborator

simias commented May 22, 2016

For the record the problem with repeating textures might be related to this GPU register:

http://problemkaputt.de/psx-spx.htm#gpurenderingattributes


GP0(E2h) - Texture Window setting

  0-4    Texture window Mask X   (in 8 pixel steps)
  5-9    Texture window Mask Y   (in 8 pixel steps)
  10-14  Texture window Offset X (in 8 pixel steps)
  15-19  Texture window Offset Y (in 8 pixel steps)
  20-23  Not used (zero)
  24-31  Command  (E2h)

Mask specifies the bits that are to be manipulated, and Offset contains
the new values for these bits, ie. texture X/Y coordinates are adjusted as so:

  Texcoord = (Texcoord AND (NOT (Mask*8))) OR ((Offset AND Mask)*8)

The area within a texture window is repeated throughout the texture page.
The data is not actually stored all over the texture page but the GPU reads
the repeated patterns as if they were there.

This register is not emulated at all currently. Not sure if that's the problem but it could be.

@orbea

This comment has been minimized.

Copy link
Contributor

orbea commented May 22, 2016

Edit: Fixed

Parasite Eve

Creating and loading savestates temporarily cleans up the title screen, but not the gameplay. Notice the non-opaque chair in the second scrot while the bottom portion of the screen below the black bar has a lot of graphical noise. The opening video when starting the game has surprisingly few issues other than being far slower than the software renderer.

@simias

This comment has been minimized.

Copy link
Collaborator

simias commented May 22, 2016

Ouch, that's pretty bad. I seem to recall that Medievil has text corruption as well.

@simias

This comment has been minimized.

Copy link
Collaborator

simias commented May 22, 2016

That first screenshot could definitely be the texture repeat thingy. I'll try implementing it.

The 2nd is this weird semi-transparency issue we see everywhere. I'd have to dump all the triangles being drawn with their attributes to try and figure out why that's happening. I can't imagine that this sprite is meant to be semi-transparent.

@mac1202

This comment has been minimized.

Copy link

mac1202 commented May 23, 2016

@simias

This comment has been minimized.

Copy link
Collaborator

simias commented May 23, 2016

As far as I can tell FF7 looks pretty good besides the broken text backgrounds and the inaccurate battle transition "twirl".

Chrono Cross looks pretty terrible though. Especially that video playback, something's very broken here.

@simias

This comment has been minimized.

Copy link
Collaborator

simias commented May 23, 2016

Mmh, turns out I do have the semi-transparency issue in Rustation as well. So it's really a problem in the renderer itself. It's weird that I didn't notice it before. Maybe it's a regression. I'll look into it.

https://cloud.githubusercontent.com/assets/7925386/15487664/9024e1de-214f-11e6-8e0a-949c0b2d7dfe.png

@twinaphex

This comment has been minimized.

Copy link
Member Author

twinaphex commented May 23, 2016

@simias - regarding the brokenness in Chrono Cross, I think it's the same issue that is plaguing the Tomb Raider pause screen - framebuffer readback. It takes an image from the previous framebuffer image and then modulates it somewhat (to simulate some kind of fake motion blurring effect or something similar).

Framebuffer readback doesn't seem to work at all, and it's pretty much the same issue that you see happening right now in Chrono Cross, Tomb Raider 1 (pause screen), and Dino Crisis 1 (pause screen again).

@simias

This comment has been minimized.

Copy link
Collaborator

simias commented May 24, 2016

An other thing that's not currently emulated is GP1 command 0x03 which can be used to turn the display on or off. That could explain some of the glitches if the game turns the screen off during certain transitions when it just wants it to be black and keeps doing things in the GPU. In this situation the current renderer will display garbage for those frames. Should be an easy fix too, in finalize_frame you glClear() RA's buffer with a plain black value if the display is turned off. Or something like that.

@simias

This comment has been minimized.

Copy link
Collaborator

simias commented May 25, 2016

I forgot to mention this issue in the commit but PR #47 (now merged in master) should fix many (most?) of those semi-transparency issues. I wasn't resetting the transparency mode correctly in certain cases.

@twinaphex

This comment has been minimized.

Copy link
Member Author

twinaphex commented May 25, 2016

The diagonal split in the middle issues have been resolved at least, and I have updated the screenshots to reflect this development.

@simias

This comment has been minimized.

Copy link
Collaborator

simias commented May 25, 2016

There are weird texture issues on the cars in Rollcage. I don't really get what the game is trying to do here.

https://cloud.githubusercontent.com/assets/7925386/15538051/089a9e26-227a-11e6-86d8-1407a7f05bd8.png

As a side note the core options are a bit of a mess at the moment, there are two sets of options regarding color depth and dithering for instance. And of course we can't change the IR scaling factor dynamically.

Regarding the texture mask issue that could explain some of those corruptions I could try to fix it but editing the shaders in C header form is too much of a headache. Could we put the plain glsm files back (like in my rust code) and use scripts to convert them to .h?

@simias

This comment has been minimized.

Copy link
Collaborator

simias commented May 25, 2016

Somebody on /emugen/ mentioned that since the software renderer is always running at 1x in the background we should be able to display the GL and software output side by side. I don't really know how complicated that would be but it could be useful for comparing, if somebody wants to give it a shot.

@GPDP2

This comment has been minimized.

Copy link

GPDP2 commented May 26, 2016

http://i.imgur.com/Hh55QOH.png

Many spells in FFIX have completely broken effects. This is the Flare spell. Similar stuff happens with other abilities and spells that make use of fancy effects.

Didn't take a shot of it, but the battle swirl is also totally boned.

@GPDP2

This comment has been minimized.

Copy link

GPDP2 commented May 26, 2016

Heavy texture corruption in Tony Hawk's Pro Skater 3. Don't have the game on me, but it's possible this also affects THPS2 since it's built on the same engine:

http://i.imgur.com/BvPSWk5.png

@twinaphex

This comment has been minimized.

Copy link
Member Author

twinaphex commented May 26, 2016

GPDP2 - the Tony Hawk 3 issue seems to be the same as the Tomb Raider 2 water issue - try savestating - most likely the texture will appear normal then. There seems to be some texture update reference count issue going on where it tries to load certain textures too early - at least that is the theory I am going by so far, could be completely wrong.

Regarding FF9, the corrupted dialogue box textures seem similar to FF8, and the swirl and other graphical breakups seem to be all VRAM readback copy-related, just like FF8 and FF7. I think we are mostly running into two of the same issues here for all of the games.

@simias

This comment has been minimized.

Copy link
Collaborator

simias commented May 26, 2016

I can confirm that FFIX seems to use the texture mask thingy, here are a few values I see it use:

TEX WINDOW 1f 1f 12 09
TEX WINDOW 1f 1f 10 09
TEX WINDOW 1f 1f 11 08
TEX WINDOW 1f 1f 11 0a

I only see those values while dialog/menus are displayed (when we have the garbage textures) so it seems like a good lead. Elsewhere (when no texture corruption is visible) I only see TEX WINDOW 00 00 00 00.

If somebody wants to try and implement that command feel free to ask me for pointers, it seems relatively straightforward to implement. Otherwise I'll do it when I have some time.

An other issue in FFIX is that the video appears messed up:

https://cloud.githubusercontent.com/assets/7925386/15588139/c2707484-238c-11e6-89c3-ae65f058ea4c.png

I know that it uses 24bit mode so maybe something is broken here. It's not completely broken though because Spyro's "Universal intertainement" screen is also in 24bpp and that is displayed without any issues as far as I can tell.

Finally the opacity is messed up all across the board in this game. The main menu seems too dark, and here Zidane is supposed to be surrounded by darkness, not blinding light:

https://cloud.githubusercontent.com/assets/7925386/15588273/4bb1450c-238d-11e6-8fb3-88b3c3e3d306.png

I have no idea what causes this, but at least it doesn't seem to difficult to debug. Especially in the main menu, there can't be that many polygons on the screen there.

@twinaphex

This comment has been minimized.

Copy link
Member Author

twinaphex commented May 26, 2016

Regarding the last FF9 screenshot - I keep seeing this recurring behavior where instead of a fade to black for certain screens it does a fade to white instead. The white portions of that screenshot should be completely black instead.

Regarding somebody wanting to implement it - sure, give me the rundown on how/what to implement and some references.

@simias

This comment has been minimized.

Copy link
Collaborator

simias commented May 26, 2016

Well the starting point in mednafen would be G_Command_TexWindow: https://github.com/libretro/beetle-psx-libretro/blob/master/mednafen/psx/gpu.cpp#L639-L647

This function is called when the game changes those parameters. You'd have to add an "rsx_" method to send those values to the external renderer (something similar to rsx_intf_set_draw_area for instance).

In the GL renderer I think the first step would be to call draw() to flush any pending draws, then you'd put those 4 tex window values in uniforms and modify the command fragment shader to mask the coords using the equation given in the No$ spec somewhere around here: https://github.com/libretro/beetle-psx-libretro/blob/master/rustation-libretro/src/renderer/shaders/command_fragment.glsl.h#L81-L85

That should do the trick, hopefully.

@TransparentBlue

This comment has been minimized.

Copy link

TransparentBlue commented May 27, 2016

Legend of Legaïa

Ground horizon affecting effects + multiplicated effects while using the GL renderer (top is GL bottom is SW) fixed

Some effects are the wrong color (top is GL bottom is SW) fixed

Seams on circular transparent effects while in native res using the GL renderer (top is GL bottom is SW), not present in any other resolution
https://cloud.githubusercontent.com/assets/16150597/15618981/7ada18e4-2451-11e6-8d3d-57bf3eeff9c1.png
https://cloud.githubusercontent.com/assets/16150597/15618984/7ae7188c-2451-11e6-8f05-c84ef33be52b.png

And finally a clip with several issues, shockwave effect in the first part are multiplied in the GL renderer, some effects are static while using the GL renderer and massive overbloom in the final part of the clip (which might be the same problem as the effect being multiplied) fixed

@simias

This comment has been minimized.

Copy link
Collaborator

simias commented May 27, 2016

The wrong color could also be a semi-transparency mode issue, if we add instead of subtracting (or vice versa).

I'll debug that as soon as I'm done implementing savestates in rustation.

@simias

This comment has been minimized.

Copy link
Collaborator

simias commented May 28, 2016

@ghost

This comment has been minimized.

Copy link

ghost commented Jul 8, 2017

#43 (comment) is still here

Castlevania - Symphony of the Night
Text is overlapping with past and future text.
https://files.catbox.moe/6mp4i7.webm

@orbea

This comment has been minimized.

Copy link
Contributor

orbea commented Jul 28, 2017

Seems most of my old issues are present still.

Particularly I could reproduce these now (I didn't try them all yet).

#43 (comment) #43 (comment) #43 (comment) #43 (comment) #43 (comment) #43 (comment)

@ghost

This comment has been minimized.

Copy link

ghost commented Jul 29, 2017

@orbea The Breath of Fire III sprite issue is still here too (just tested).

@Serbagz

This comment has been minimized.

Copy link

Serbagz commented Apr 14, 2018

This is still happening to me on Breath of Fire 3 on the latest Beetle Psx HW 0.9.44.1 a24ca2c
Screenshot: https://snag.gy/WYAbkt.jpg

I can get rid of it by setting the resolution back down to 1x but in Pcsx Pgxp it works fine upscaled without the screwy offset pixels. Hoping they can fix it soon, these issues are 2 years old :(

@Papermanzero

This comment has been minimized.

Copy link

Papermanzero commented Jun 23, 2018

The opengl renderer really needs to be updated and fixed. Every game I played so far has issues. Unfortunately libretro has no working ps1 emulator currently on the windows platform.

@saftle

This comment has been minimized.

Copy link

saftle commented Jun 23, 2018

@Papermanzero this is not true at all. I'm using Vulkan without issues, and the software renderer has always worked.

@Papermanzero

This comment has been minimized.

Copy link

Papermanzero commented Jun 23, 2018

That’s why i am saying the opengl renderer is not working. Even the vulkan renderer has issues, which are not so critical as opengl.

@twinaphex

This comment has been minimized.

Copy link
Member Author

twinaphex commented Jun 23, 2018

@Papermanzero

The opengl renderer really needs to be updated and fixed. Every game I played so far has issues. Unfortunately libretro has no working ps1 emulator currently on the windows platform.

This is ridiculous hyperbole. The GL renderer is perfectly fine for 90% of the games out there on my system.

Start some bounties or something. Endlessly complaining about the same things isn't going to help improve anything.

@twinaphex

This comment has been minimized.

Copy link
Member Author

twinaphex commented Jun 23, 2018

Maybe you have an AMD or Intel GPU. I run everything on an nvidia GPU and I don't have all these issues. You are talking about issues too on Reicast which I cannot even reproduce.

I don't own an AMD card, and OpenGL support is known to be spotty on AMD cards. If you start a bounty, somebody with an AMD GPU might be able to look at some of these issues.

@Papermanzero

This comment has been minimized.

Copy link

Papermanzero commented Jun 23, 2018

I have a nvidia gpu =)
I can try to create a list of opengl issues which are reproducible on different systems with nvidea gpu. But it will be a long list =)

Btw. My intention was not to blame the project and the core (really you are doing fatastic stuff). I just wanted to highlight that the recent changes had a lot of regressions.

@orbea

This comment has been minimized.

Copy link
Contributor

orbea commented Jun 23, 2018

I also still have many games in my library still affected by GL bugs. Tales of Phantasia, Xenogears, Breath of Fire III, etc...

Not even the bios renders correctly.

@twinaphex

This comment has been minimized.

Copy link
Member Author

twinaphex commented Jun 23, 2018

Start listing those regressions then instead of beating around the bush about it. Because I cannot see all these issues you people keep pointing out.

I want specifics from this point out instead of just ‘hurr durr it doesnt work’. Also, we obviously need more people with a background in GL as well.

@orbea

This comment has been minimized.

Copy link
Contributor

orbea commented Jun 23, 2018

I wouldn't call them regressions since I'm not sure they ever worked with the GL renderer, but check out these links please.

#246
#43 (comment) #43 (comment) #43 (comment) #43 (comment) #43 (comment) #43 (comment)

If anyone wants to look at these closer I am of course willing to provide more details, but its a waste of time to debug them and then watch the issue stagnate until everyone forgets all the details again...

@twinaphex

This comment has been minimized.

Copy link
Member Author

twinaphex commented Jun 24, 2018

Start providing more details then.

I do not currently have any people that could look at these issues, the GL renderer was more or less @simias’ work. The only way these issues could be getting fixed (in a timely manner) is through bounties.

And I will still reiterate, unless you are more specific about these issues, I would wager I really dont get them in the vast majority of games.

@orbea

This comment has been minimized.

Copy link
Contributor

orbea commented Jun 24, 2018

To be entirely honest I have a lot on my plate now and just don't have the energy to debug issues just to have to do it again every six months when the code base changes enough (I mean mesa or even save states too) to require new details. I am more than happy to devote what little energy I have for this, but if I am the only one trying to do anything not much progress is going to be made. If anyone capable with GL wants to help out please let me know, but till then I'm not in a position do much unfortunately...

@Papermanzero

This comment has been minimized.

Copy link

Papermanzero commented Jun 24, 2018

I will start today to go through my library to provide the games with the issue, a screenshot and debug logs. This is already a starting point.

Edit:
Started the list today. I checked until the letter C.
For every game, I entered a bug with the tag [OpenGL]
Games which did not start: Ape Escape and Breath of Fire 4.
Need further investigations what the reson could be.

@saftle

This comment has been minimized.

Copy link

saftle commented Jun 25, 2018

@Papermanzero as I already stated in one of your bug reports, please use default options with the opengl renderer. You have Software Framebuffer "off", even though by default it is "on", and you are using PGXP options which only work on a game by game basis. Please go back through your bug reports to see if the bugs still exist then on that basis.

@Pat86

This comment has been minimized.

Copy link

Pat86 commented Jun 25, 2018

Flickering textures in Jumping Flash still present (software & hardware renderer).

@Papermanzero

This comment has been minimized.

Copy link

Papermanzero commented Jun 25, 2018

@saftle
As stated in one of the bugs:

I activated the Software Framebuffer meanwhile. All issues are still visible. Did a check and every game had the same issue as before. Textures and Sprites are still flashing, disappearing, distorted etc.

An optimisation for the core would be to deactivate the frame buffer option.

PGXP shall not affect sprites/images. As stated in one on my descriptions, PCSX-PGXP displays all games correct (this is the reference implementation). That means, the implementation of PSX Libretro is not correct, which leads to bugs. But even with deactivated PGXP some issues (like distorted sprites) are visible.

@twinaphex

This comment has been minimized.

Copy link
Member Author

twinaphex commented Jun 25, 2018

The Jumping Flash issue is known about. We don't know how to fix it.

@twinaphex

This comment has been minimized.

Copy link
Member Author

twinaphex commented Jun 25, 2018

If you're expecting PGXP + Memory write to work correctly, I have to disappoint you, it is inherently buggy. You should not really blame any bugs you see with PGXP on the GL renderer itself. It is down to the implementation in Mednafen/Beetle PSX and PGXP in general.

That means, the implementation of PSX Libretro is not correct, which leads to bugs.

We did not implement it, @iCatButler did. And he sent a few bug fixes/improvements sometime ago. From my own personal experience, it is much more reliable now than it once was. Once again, I find the complaints overblown to the point of hyperbole.

Start listing those issues already, it's getting very annoying how we are not talking about specifics here where stuff is verifiable.

Also, by aggravating the main people still leading this repo and creating a negative and toxic environment, you are not really helping the situation here. Just leave it to specific bug reports and leave any kind of personal statements as to the quality of this core or whatnot to the side, none of this is helpful to the situation. Keep it to the specifics and keep it to the facts. We want verifiable bug reports that I can reproduce, and if I can't reproduce them, I can then let you know and we can move on from there.

@twinaphex

This comment has been minimized.

Copy link
Member Author

twinaphex commented Jun 25, 2018

If you want Jumping Flash to render properly, you need to either use the Vulkan renderer or the software renderer.

@Jj0YzL5nvJ

This comment has been minimized.

Copy link

Jj0YzL5nvJ commented Jun 26, 2018

@Papermanzero, I personally appreciate your time and dedication to point out issues in this core and render. On the other hand, you need to follow the guidelines that are being pointed out to you. Is for common sense, respect to those who work in this project and your own good.
Unfortunately, there is currently no one who can fix the specific problems in this render.

Now my personal recommendations, follow them or don't, is to your criteria.
Put all the similar issues together in the same report instead of doing it by per "game specific issue".
Is for try to avoid redundancies. Many of your reports are "2D texture" specific.

If you want to point out problems in PGXP, go ahead. But put them all in one place, currently the only one that can solve them is @iCatButler anyway.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment