Skip to content

Instantly share code, notes, and snippets.

@kunofellasleep
Last active October 15, 2018 08:16
Show Gist options
  • Save kunofellasleep/5d0711ccd3df24a88748e00aa56b4eaf to your computer and use it in GitHub Desktop.
Save kunofellasleep/5d0711ccd3df24a88748e00aa56b4eaf to your computer and use it in GitHub Desktop.
kernel void contrast(
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.2;
float4 c = inTex.read(gid).rgba;
c = float4((c.rgb - float3(0.5)) * filterLevel + float3(0.5), 1.0);
outTex.write(c.rgba, gid);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment