libretro / flycast

Flycast is a multiplatform Sega Dreamcast emulator. NOTE: No longer actively developed, use upstream repo for libretro from now on - https://github.com/flyinghead/flycast
http://reicast.com
GNU General Public License v2.0
155 stars 78 forks source link

Reicast OIT - Crash on AMD GPU #79

Closed ghost closed 6 years ago

ghost commented 6 years ago

OS : Windows 10 x64 CPU : Intel 8550U 4 Cores 8 Threads GPU : AMD Radeon 530 4GB . RAM : 8 GB. When i try to load a game I get a black screen and then RetroArch crashes. The AMD driver version i use is : 18.5.1. This is what i get in RetroArch log : retroarch-log.txt

inactive123 commented 6 years ago

Can you turn on Logging to On, set Logging Level to 'Debug' in RetroArch and then give us a new log? It might contain more information since the information contained in this log is not very useful.

inactive123 commented 6 years ago

@flyinghead I have gotten some reports over the past week or so that AMD and Intel users are having issues getting Reicast OIT to run on Windows, so it might be useful to gather some feedback here from them and see if we can increase the renderers' compatibility with these cards.

ghost commented 6 years ago

This was done by someone else who is on the RetroArch Discord : https://cdn.discordapp.com/attachments/434713532341288961/456553092566220822/retroarch-log.txt

Kilimbi commented 6 years ago

Adding my crash logs... Reicast OIT crashes to desktop with AMD Radeon RX Vega M graphics card. Hope this will gets fixed soon! :)

retrolog4.txt

inactive123 commented 6 years ago

Unfortunately this is one of the problems with GL -

http://www.joshbarczak.com/blog/?p=154

The GL model, placing the compiler in the driver, is WRONG. It was a worthwhile experiment, one that seemed viable at the time, but history has proven it wrong.

Driver compilation incurs unnecessary runtime costs. When I ship a product, I have been compiling my shaders dozens of times a day. I know that my shaders are well-formed and correct. All I need the driver to do is translate them into efficient executable code as quickly as possible. There is no value added by having the driver do semantic analysis. This removes value. The driver should not parse my shader, it should not validate my shader, it should not search for undeclared identifiers or missing semicolons.

So the issue is that just because you get your shaders compiled and linked on say an Nvidia GPU, is no guarantee it will compile on an AMD and/or Intel GPU as well, because shader validation/analysis is done on the driver level.

So that is what we are running into here. So far, the OIT renderer has been mainly tested against nvidia GPUs and their drivers. We now need to keep whipping it into shape until the shaders start compiling and linking on AMD/Intel (Windows), at the same time this should be done without introducing regressions on the Nvidia side of things. And then at the same time we need to check whether the rendering comes out all broken or not... fun times ahead...

@flyinghead Looks like something that we definitely need your guiding hand on.

flyinghead commented 6 years ago

Unfortunately I don't have access to Intel or ATI GPUs at the moment. Looks like I need to buy some hardware ;)

@Kilimbi Regarding your issue, the code that was causing this error has now been removed so you might want to test again with latest.

Kilimbi commented 6 years ago

@flyinghead I'm using latest core - MD5 08E684D0E912B6EBE5366A328E30B11A Downloaded from buildbot. Also latest Catalyst drivers available for my gpu.

ghost commented 6 years ago

Managed to do create a debug log : retroarch-log.txt

Kilimbi commented 6 years ago

I'm getting the exact same error log that @MojoJojoDojo has. Using 18.10 AMD Radeon driver.

ghost commented 6 years ago

I tried on Linux(Manjaro). This is what i get : retroarch.log

flyinghead commented 6 years ago

0:1(10): error: GLSL 4.30 is not supported. Supported versions are: 1.10, 1.20, 1.30, 1.40, 1.00 ES, 3.00 ES, 3.10 ES, and 3.20 ES

In that case, there's not much we can do. The OIT core requires OpenGL 4.3 or better.

inactive123 commented 6 years ago

I will try to start requiring a GL 4.3 core context for OIT, hopefully that does the trick for Intel/AMD.

flyinghead commented 6 years ago

@MojoJojoDojo @Kilimbi There has been some changes towards GPU compatibility in the last nightly build I believe. Please retry on recent AMD / Intel GPUs when you get a chance.

inactive123 commented 6 years ago

@flyinghead Unfortunately I cannot require GL 4.3 core context either for Reicast OIT, look at the graphical corruption it causes -

image

inactive123 commented 6 years ago

Here is a log file of what happens with GL 4.3 core context -

https://hastebin.com/oconoqaloc.sql

inactive123 commented 6 years ago

On the subject - do the GLES ifdefs in the OIT renderer still serve a purpose? Is it the intent to get this working with GLES 3.1 / 3.2 eventually, and if so, would these GLES ifdefs that we have right now even work, since they seem to be using outdated syntax anyway?

I guess what I am trying to say is, can we start removing some of these GLES preprocessor conditionals in the OIT renderer to de-obfuscate some of the source or do we still keep them there?

inactive123 commented 6 years ago

Here is a diff patch to set it to a core 4.3 context -

https://hastebin.com/egayujoyun.go

unfortunately, when you do, you can see that the fogging gets broken, leading to the kind of bugs you see above.

You will also get log messages then with GLSL warnings like this -

https://hastebin.com/oconoqaloc.sql

flyinghead commented 6 years ago

do the GLES ifdefs in the OIT renderer still serve a purpose?

No, you can get rid of them. They are for GLES2 only. Generally speaking, there's no need to be compatible with anything pre-GL 4.3 in the OIT renderer.

ghost commented 6 years ago

@MojoJojoDojo @Kilimbi There has been some changes towards GPU compatibility in the last nightly build I believe. Please retry on recent AMD / Intel GPUs when you get a chance.

It still crashes and gives some error about "fragment shaders" and about shaders. A similar issue happend with Citra in the past when they implemented GLSL GPU support , it gave a black screen and crashed right after. Maybe you can ask Citra dev's for a solution

flyinghead commented 6 years ago

I doubt we use the same rendering technique and the same OpenGL features as Citra. Do you have a log or a more precise error message?

Kilimbi commented 6 years ago

Here are my crash logs using the latest reicast_oit_libretro.dll from buildbot (03-07-2018). retrolog6.txt

flyinghead commented 6 years ago

Vertex link error: INVALID_OPERATION. unexpected error. fragment link error: INVALID_OPERATION. unexpected error.

Well, the error has changed. Unfortunately that doesn't really help much.

Thanks for the log anyway.

inactive123 commented 6 years ago

OK, I removed the GLES ifdefs. Can you do the same in your fork so there will be minimal changes between the two?

inactive123 commented 6 years ago

@Kilimbi Can you get some more verbose logging? Try enable Logging in RetroArch and set Logging Level to Debug, hopefully we can see them which line is causing trouble in specific. If not, and you know how to compile from source, it might be helpful to compile RetroArch with GL_DEBUG=1, that way it will spit out more verbose GL error logs.

flyinghead commented 6 years ago

Can you do the same in your fork so there will be minimal changes between the two?

will do

xchimp commented 6 years ago

Here is my log with the latest core, doesn't seem to have changed since I last posted in #72.

retroarch-log.txt

ghost commented 6 years ago

This got fixed in the latest revision.

xchimp commented 6 years ago

I'm still experiencing crashing on the latest version.

retroarch-log.txt

ghost commented 6 years ago

Wait for the buildbot to get updated

xchimp commented 6 years ago

Seems to not crash now, but I'm only presented with a black screen with audio.

retroarch-log.txt