Cg shader to slang (Vulkan) shader

Hello!!

I have a shader called bsnes-gamma-ramp in Cg format. I need to convert this to .slang to use it with Vulkan driver. The reason is simple: Vulkan performance is x10 when I used it in combination with other shaders (with Hard GPU Sync activated).

This is the shader:

And this is the result:

Thanks for the help!!!

There’s already a slang version of the image adjustment shader, which originally was based on that bsnes gamma ramp shader. Your version handles both grayscale and gamma strangely, so I switched them to use more established/accepted calculations and the tweakables are all runtime parameters, so you can adjust them on the fly.

Thanks!! Yes, the image-adjustment is the answer (Monitor gamma = 1.50). Unfortunatelly, I can’t combine it with other shaders. This is my .slangp configuration file (I put a copy of the crt-easymode and the image-adjustment shaders in the “shader” sub-folder of “ntsc”):

This is based on the ntsc-256px.slangp and the crt-easymode.slangp files.

I try to load that preset but don’t work.

Any idea of how I must combine those shaders?

Thanks!!!

those should be:

shader2 = …/misc/image-adjustment.slang shader3 = …/crt/shaders/crt-easymode.slang

assuming the preset lives in the ntsc subdirectory.

Really, though, you should probably put image-adjustment first, so it would be:

shaders = 4 shader0 = …/misc/image-adjustment.slang shader1 = shaders/ntsc-pass1-composite-3phase.slang shader2 = shaders/ntsc-pass2-3phase.slang shader3 = shaders/crt-easymode.slang

filter_linear0 = false filter_linear1 = false filter_linear2 = false

scale_type_x1 = absolute scale_type_y1 = source scale_x1 = 1024 scale_y1 = 1.0 frame_count_mod1 = 2 float_framebuffer1 = true

scale_type2 = source scale_x2 = 0.5 scale_y2 = 1.0

filter_linear3 = false scale_type_3 = source

Thanks!! put image-adjustment first don’t work. The only solution has use the original path of “…/misc/image-adjustment.slang” and “…/crt/shaders/crt-easymode.slang”. Now, it works without problem :smiley:

Thanks for the help!!!