Skip to content

Instantly share code, notes, and snippets.

@rygorous
Last active December 25, 2015 13:39
Embed
What would you like to do?
uint i = gl_LocalInvocationID.x; // 0 <= i < 64
int coeff = 0;
uint nonzero_lo = ac_nonzero_lo[block_idx];
uint nonzero_hi = ac_nonzero_hi[block_idx];
uint lane_mask = 1 << (i & 31);
if (i < 32)
{
if ((nonzero_lo & lane_mask) != 0)
{
uint fetch_offs = ptr + bitCount(nonzero_lo & (lane_mask - 1));
coeff = get_int16(fetch_offs);
}
}
else
{
if ((nonzero_hi & lane_mask) != 0)
{
uint fetch_offs = ptr + bitCount(nonzero_lo) + bitCount(nonzero_hi & (lane_mask - 1));
coeff = get_int16(fetch_offs);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment