Created
November 7, 2013 04:13
-
-
Save rygorous/7348868 to your computer and use it in GitHub Desktop.
It's more fun to compute!
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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