Skip to content

Instantly share code, notes, and snippets.

@dnevera
Created June 3, 2018 09:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dnevera/dca448da4ead6756fe2b6c3f8b97dfac to your computer and use it in GitHub Desktop.
Save dnevera/dca448da4ead6756fe2b6c3f8b97dfac to your computer and use it in GitHub Desktop.
constexpr sampler lutSampler(address::clamp_to_edge, filter::linear, coord::normalized);
kernel void kernel_clutColorMapper(
texture3d<float, access::sample> clut [[texture(0)]],
device float3 *reference [[buffer(0)]],
device float3 *target [[buffer(1)]],
uint gid [[thread_position_in_grid]]
)
{
float3 rgb = reference[gid];
target[gid] = clut.sample(lutSampler, rgb).rgb;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment