Skip to content

Instantly share code, notes, and snippets.

@rygorous
Created November 7, 2013 04:13
Show Gist options
  • Save rygorous/7348868 to your computer and use it in GitHub Desktop.
Save rygorous/7348868 to your computer and use it in GitHub Desktop.
It's more fun to compute!
// compute weights
// this is just a packed LUT of the tap weights; phrasing it like this
// gives *much* better code than using a table.
uint lane = gl_LocalInvocationID.x;
int shift = int(min(lane, 7-lane)) * 8;
ivec2 weights = bitfieldExtract(ivec2(0x0e182434, 0x08040100), shift, 8);
weights = (lane < 4) ? weights.xy : weights.yx;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment