Skip to content

Instantly share code, notes, and snippets.

@kunofellasleep
Created October 15, 2018 08:17
Show Gist options
  • Select an option

  • Save kunofellasleep/fec757b9e41d4e43392c080af583602b to your computer and use it in GitHub Desktop.

Select an option

Save kunofellasleep/fec757b9e41d4e43392c080af583602b to your computer and use it in GitHub Desktop.
kernel void saturation(
texture2d<float, access::write> outTex [[texture(0)]],
texture2d<float, access::read> inTex [[texture(1)]],
uint2 gid [[thread_position_in_grid]]) {
//HIGH: More than 1, LOW: Less than 1
float filterLevel = 1.1;
float4 c = inTex.read(gid).rgba;
float3 hsv = rgb2hsv(c.rgb);
hsv[1] = hsv[1] * filterLevel;
c.rgb = hsv2rgb(hsv);
outTex.write(c.rgba, gid);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment