I've awoken from my slumber
All the way back in early 2021 (I can't believe it's been 2 years) I wrote the compute shader renderer for the Switch port of melonDS as described in my previous post on it. If you don't know much about it the compute shader renderer then I recommend checking that post out.

After more or less completing it for Switch (the port desparately needs an update, it will come, I promise), I didn't really touch the code much. Over the last couple of weeks this finally changed.

The renderer had to be ported from Switch's homebrew GPU API deko3D to OpenGL, which fortunately wasn't that hard, because A. most of the complexity lies within the shader there is not that much buffer jougling and B. Nvidia GPUs (or atleast Maxwell) being somewhat of a OpenGL hardware implementation.

But let's come to the main attraction, besides some fixes, high resolution rendering is finally implemented for it. And it works wonderfully, with far fewer or no artefacts compared to the classic OpenGL renderer. And even on my integrated Intel UHD 620 I can reach up to 3x-4x resolution depending on the game.

With local wireless there is now another reason you might want to use it over the software renderer. If you are short on CPU cores for all the melonDS instances you can offload the rasterisation onto the GPU.

There are still a few things left to do. For some reason the shaders (which are all compiled on startup, so no stuttering while playing) seem to compile quite slowly on Windows for Intel and Nvidia GPUs. Bizzarely this seems to be related to the very large SSBOs, atleast reducing their size seems to lead to speed up. So my plan is to replace the large buffers which scale proportionally to the resolution with ones which have unspecified size or image load and store. If I had to guess the driver performs the layout calculation somehow for every array entry. In case I don't get the compile times low enough, I need to implement a shader binary cache.

The outlines generated through edge marking (e.g. used by the Zelda games) are always only pixel thick, which quickly becomes very thin for higher resolutions. Thus I want to add an option to counteract that (I am still not exactly sure how to do it.

Another issue that currently the compute shader renderer isn't integrated into the GUI at all, it currently just replaces the OpenGL renderer.

And like always there is still some clean up to be done in the code. As a last note, the compute shader renderer already uses a texture cache (which as part of this clean up should also be used by the OpenGL renderer). Implementing texture replacement on top of that is not hard and is on my list as well, but one step after the other.

And yes, it allows you to play Pokemon in higher resolutions with no back lines.
keisui says:
Apr 22nd 2023
this is very interesting news , excited about future texture replacement too
kevincrans says:
Apr 22nd 2023
That's amazing, can't wait to see the new rendering's power!
^.^ says:
Apr 22nd 2023
Glad to see another article from you Generic!
Yeah it would be nice to be able to select the old software render from the GUI.

About the switch port, if I remember correctly Horizon OS doesn't support process forking, and that made it harder to port libslirp for online multiplayer. Any news about that? (and also about netplay maybe?)
^.^ says:
Apr 22nd 2023
Also you guys should post these updates on the Pateron with some videos as well, it's good PR.
Generic aka RSDuck says:
Apr 22nd 2023
> if I remember correctly Horizon OS doesn't support process forking, and that made it harder to port libslirp for online multiplayer

I later discovered that it only uses it in one place for one feature we don't use, so in theory we can just rip that out. Though I haven't tried doing that yet, there might be further issues.
Minessota Klei says:
Apr 22nd 2023
Hi team MelonDS,

Thank you so much for all the development, your work is amazing, I'm looking forward to the next release!
anon says:
Apr 23rd 2023
Wireframes would be 1 pixel thick too, right? Don't forget about those.
Generic aka RSDuck says:
Apr 23rd 2023
yeah right, thanks. I didn't think about wireframe. They would probably need to get a separate handling similarly to the OpenGL renderer.
Mitocondrio33 says:
Apr 27th 2023
Thanks a lot for existing. I was beginning to think that I would never find a decent emulator for the DS!

No$GBA? DeSmuME? Naaah, nonsense... MelonDS rocks, is just hightly superior to them in everything!!!

Please keep up the good work!
^.^ says:
Apr 28th 2023
NoCash made a lot of documentation that's been used in Melon, his emu even allows for debugging.
Drastic is also pretty fast, is Desume that's an Hot mess 😂
Martyste says:
Apr 30th 2023
Wow this is quite the hype!!
About that CSR, i am curious if it could serve as a fix for AMD GPU users like me, who had a driver update massively improving OpenGL performance in games using it, like Minecraft, or Citra Emulator, but at the cost of turning MelonDS's OpenGL renderer into flickery polygon garbage, no matter the resolution scale...
Generic aka RSDuck says:
Apr 30th 2023
someone with AMD graphics has confirmed the compute shader renderer working. Though that it's sounds more like a coincidence than a fix, we just didn't hit a driver bug with it.

It could be possible that we're currently relying on undefined behaviour somewhere, but with all the other drivers working, I rather say AMD fix your driver.
Paperdude says:
May 1st 2023
Texture filtering would be awesome as well. Seeing all games rendered with bilinear, bicubic textures would be fantastic
keisui says:
May 1st 2023
@Paperdude , texture filtering plus custom textures has potential for some serious hd remasters of games desperately needing it
Brankale says:
May 1st 2023
I’ve tested the build on Windows 10 with an integrated AMD GPU and almost all 3D models are completely black with some 2D textures randomly appearing and disappearing, all of this with terrible performance. After a driver update a lot of the problems were fixed and performance was outstanding but some 3D games still renders completely black screens and games become more and more glitched the higher the internal resolution. In the next days I want to test it on an NVIDIA gpu to see how it is. Also, thanks for this amazing work
Post a comment
Name:
DO NOT TOUCH