Skip to content

Instantly share code, notes, and snippets.

@jqly
Created June 22, 2018 02:40
Show Gist options
  • Save jqly/b6dd03511f3563da3cc634c9583e0e83 to your computer and use it in GitHub Desktop.
Save jqly/b6dd03511f3563da3cc634c9583e0e83 to your computer and use it in GitHub Desktop.
glCreateTextures(GL_TEXTURE_2D, 1, &headptr_tex_);
glTextureStorage2D(headptr_tex_, 1, GL_R32UI, window_width, window_height);
glBindImageTexture(0, headptr_tex_, 0, GL_FALSE, 0, GL_READ_WRITE, GL_R32UI);
// glsl
layout(binding=0, r32ui) uniform uimage2D headptrs;
...
for (uint kthnode = imageLoad(headptrs, ivec2(gl_FragCoord.xy)).r;
kthnode != 0xffffffff;
kthnode = nodes[kthnode]) {
frags[num_frags++] = nodes[kthnode];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment