Writing a filter (alias editing the "darken" one)

I have a nice handheld (rg280m) running retroarch.

Unfortunately I damaged its screen and it now has a significant and annoying light bleed on its right side.

I considered editing the “darken” filter so to actually enable it on the bled pixels so to even the brightness out.

I could not find a guide about how to do that though, and admittedly I couldn’t still find the difference between shaders and filters so I could admittedly be too clueless to hope to achieve that lol.

Any pointers would be really helpful.

Many thanks.

Filters run on the CPU and are compiled into a dynamic library. Shaders run on the GPU and are compiled at runtime, making them easier to work on.

This is where you would edit the ‘darken’ filter: https://github.com/libretro/RetroArch/blob/0ddfbd976c478f154100fababa3aea76270d12be/gfx/video_filters/darken.c

1 Like

Thank you! That must be why shaders are not included in that version of RA. I guess the hardware doesn’t have any GPUs.

Geez, there isn’t a single comment in that file. But also if there were any, it’s probably much cheaper to throw the device away and get a new one LOL

Thanks for answering, that did help.

BTW, may combining filters and shaders make any sense? When could that be desirable?

Thanks again, this is enlightening.

Yes, many people combine the port of blargg/NRS’ NTSC filter with CRT shaders for various reasons.

1 Like

You only need to edit these lines to apply the filter to your set of pixels: https://github.com/libretro/RetroArch/blob/master/gfx/video_filters/darken.c#L148-L155

1 Like