flyinghead / flycast

Flycast is a multiplatform Sega Dreamcast, Naomi, Naomi 2 and Atomiswave emulator
GNU General Public License v2.0
1.36k stars 167 forks source link

Feature Request - LLE video renderer using GPU compute shaders (ala parallels-rdp, redream, etc) #1390

Closed ehw closed 6 months ago

ehw commented 7 months ago

Is your feature request related to a problem? Please describe. Flycast currently supports OpenGL/Vulkan/DirectX video backends for HLE video rendering. I don't believe Flycast has any software video renderer, which can be more accurate at the cost of system performance since it would be implemented entirely to run on the host CPU. The added accuracy helps in many small edge cases that are difficult to solve with HLE video renderers and having to deal with various vendor driver updates and changes. There might be some other advantages as well, such as interlacing support and eliminating instances of z-fighting. It might also cut down on the number of video settings one might need to enable otherwise to have a better/accurate experience in some other video renderer.

Describe the solution you'd like Recently, redream implemented an LLE video renderer that utilizes a compute shader (like parallels-rdp for Nintendo 64 emulation) that allows low-level graphics emulation to be run on the GPU. This can provide great performance to those who want more of an accurate experience but have some decent computer hardware to handle it comfortably. Since using a computer shader will net you some massive performance benefits, it could also allow you to upscaling/downscaling in the same manner that parallels-rdp can which can be a lot of fun too. Couple the accurate video renderer with a good video shader within libretro and it seems very appealing, at least to me.

Describe alternatives you've considered I can't really think of an alternative to this. I suppose some low-level video rendering is better than none, even if compute shaders are hard to implement.

Additional context See the latest developer builds of redream. Set the render mode to "LLE". You need to have a license key to try it out though...

I know this feature request would require a lot of work but it would definitely be a "nice to have" kind of thing for me anyway. :) I wanted to at least make an issue on the tracker to keep track on where this might go.

flyinghead commented 7 months ago

I'll be waiting for your pull request. Thank you for volunteering!

Immersion95 commented 6 months ago

LLE seems to be a lot of work, would a software renderer be more feasible/realistic ?

The thing is that flycast has few graphical bugs at the moment so it doesn't seem that useful for the majority of games.

ehw commented 6 months ago

That would be up to @flyinghead to decide ultimately, but guessing from his reaction the work would be astronomical. A straight software renderer that runs holistically on the CPU would be less performant in comparison to a hardware renderer, so aside from being used as a source of reference to look for bugs in the hardware renderers, it's not useful for most users - unless it's possible to do something like what PCSX2 does with its own software renderer and somehow scale it to multiple threads to improve performance. But maybe it's not even necessary? I think it's something only a few people would know for sure.

I don't know what to say about the accuracy of the current hardware renderers as far as what issues currently exist. My worry is that more bugs will be introduced through the video driver changes that vendors like to silently make that will cause headaches to diagnose since they aren't as anticipated. A software renderer would be less susceptible to that. I know a compute shader would still be subjected to that, but I think it would be a lot more manageable in theory.

Immersion95 commented 6 months ago

That would be up to @flyinghead to decide ultimately, but guessing from his reaction the work would be astronomical. A straight software renderer that runs holistically on the CPU would be less performant in comparison to a hardware renderer, so aside from being used as a source of reference to look for bugs in the hardware renderers, it's not useful for most users - unless it's possible to do something like what PCSX2 does with its own software renderer and somehow scale it to multiple threads to improve performance. But maybe it's not even necessary? I think it's something only a few people would know for sure.

I don't know what to say about the accuracy of the current hardware renderers as far as what issues currently exist. My worry is that more bugs will be introduced through the video driver changes that vendors like to silently make that will cause headaches to diagnose since they aren't as anticipated. A software renderer would be less susceptible to that. I know a compute shader would still be subjected to that, but I think it would be a lot more manageable in theory.

Tested Capcom vs. SNK Pro with LLE and it was perfect. The ending portrait was finally displayed, it's the only emulator that does that. I do see the use now.

flyinghead commented 6 months ago

I have no plan for such a feature. If someone wants to contribute, feel free to do so.