Skip to content

Instantly share code, notes, and snippets.

@byBretema
Created April 30, 2024 09:36
Show Gist options
  • Save byBretema/72b1a4a32c2addde8a10b32b6c497daa to your computer and use it in GitHub Desktop.
Save byBretema/72b1a4a32c2addde8a10b32b6c497daa to your computer and use it in GitHub Desktop.
// Global
ivec3 gi_id = ivec3(gl_GlobalInvocationID);
// Group
ivec3 wg_id = ivec3(gl_WorkGroupID);
ivec3 wg_size = ivec3(gl_NumWorkGroups);
int wg_index = (wg_id.z * wg_size.x * wg_size.y) + (wg_id.y * wg_size.x) + wg_id.x;
// Local
ivec3 li_id = ivec3(gl_LocalInvocationID);
ivec3 li_size = ivec3(gl_WorkGroupSize);
int li_index = (li_id.z * li_size.x * li_size.y) + (li_id.y * li_size.x) + li_id.x;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment