Skip to content
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

[Request] r57shell's PAL shader: add "USE RAW" / "USE LUT" to user-settings #165

Open
eugene-s-nesdev opened this issue Jun 15, 2021 · 10 comments

Comments

@eugene-s-nesdev
Copy link

eugene-s-nesdev commented Jun 15, 2021

https://github.com/libretro/common-shaders/blob/master/pal/shaders/pal-r57shell.cg

Most of retroarch NES cores (and puNES standalone emulator with shaders support) have RAW-palette option.
If you're set emulator palette to RAW, and uncomment line 70 same time (#define USE_RAW)
shader will generate true-palnes palette

If you're uncomment line 74 (#define USE_LUT) shader will generate less accurate colors, but performance will increase.
NOTE: USE LUT works only when USE RAW enabled, otherwise it does nothing

This is very uncomfortable to comment/uncomment these parameters in shader source every time.
Users use this shader not only with NES but with another systems too, like snes, genesis etc, which requires keep use_raw disabled.
So if you're can, please, make GUI setting for this.

Default values must be OFF (0) for compatibility reasons.
Value ON (1) is preferred for NES systems, but it works correct only if you're set raw-palette in emulator core options.

This issue relates to all versions of r57shell PAL shader (glsl/gles, cg, etc)

@eugene-s-nesdev eugene-s-nesdev changed the title [Request] r57pal shader: add "USE RAW" / "USE LUT" settings to user-settings [Request] r57pal shader: add "USE RAW" / "USE LUT" to user-settings Jun 15, 2021
@eugene-s-nesdev eugene-s-nesdev changed the title [Request] r57pal shader: add "USE RAW" / "USE LUT" to user-settings [Request] r57shell's PAL shader: add "USE RAW" / "USE LUT" to user-settings Jun 15, 2021
@hizzlekizzle
Copy link
Collaborator

I just tried this and it works well enough but has a very significant impact on performance, it seems. My framerate dropped by almost 50%. Is that worth the performance hit, you think? Here's a copy of the modified shader if you'd like to try it: https://pastebin.com/eJ4kCnQ9

@eugene-s-nesdev
Copy link
Author

eugene-s-nesdev commented Jun 15, 2021

Thank you. Is this CG or GLSL code? Tried on puNES but it can't load it. Can you attach it?

Is that worth the performance hit, you think?

Yep, it worth. r57shell is once shader at this moment which can generate PAL NES palette very close to hardware.
Maybe default values isn't very accurate yet, but user can adjust it. I will try to find more accurate values in the future.
There are some hardware capturing screenshots: avermedia305.zip
USE RAW (enabled) + //USE LUT (disabled) options works fullspeed at 1050ti. This is slowest mode.

@hizzlekizzle
Copy link
Collaborator

Ah, the pastebin is for slang, sorry. I'll try to get the other formats updated, as well, ASAP.

@eugene-s-nesdev
Copy link
Author

eugene-s-nesdev commented Jun 15, 2021

Mistake about use USE LUT, it reduce quality but increase performance. Topic post fixed.
Also USE LUT works only when USE RAW enabled, otherwise it does nothing
(Look at comments in the shader's source code)

@hizzlekizzle
Copy link
Collaborator

Ok, here's a GLSL version to test:
https://pastebin.com/LXaFngiS

Let me know how it treats you.

@eugene-s-nesdev
Copy link
Author

Saved code to pal-r57shell.glsl and puNES crashes every time at startup.
test.zip

@hizzlekizzle
Copy link
Collaborator

does it give you any kind of error? It seems to be working fine here in RetroArch.

@eugene-s-nesdev
Copy link
Author

eugene-s-nesdev commented Jun 16, 2021

No. But it happens only on windows-glsl build. Emulator crashes with no-warnings.
I've just compiled punes from scratch on mint 19.3 and both (old and new) shaders works perfectly.
Strange thing.

Source and autobuilds are here: https://github.com/punesemu/puNES

@eugene-s-nesdev
Copy link
Author

Fresh commit punesemu/puNES@31a7bd2 fixes crash. For now it works.

@hizzlekizzle
Copy link
Collaborator

hizzlekizzle commented Jun 19, 2021

Ok, great to hear! I guess I'll get those changes pushed up to the repo, then :)

EDIT: alright, done, for glsl and slang, at least. I'll try to find time to handle the Cg version soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants