Skip to content

Conversation

@micahscopes
Copy link

@micahscopes micahscopes commented May 3, 2023

For #11 I got inspired to just go ahead and implement what I was imagining.

This PR adds some utility functions for copying framebuffer data to a single buffer (readPixelsToWebGLBuffer) and also to multiple buffers (readPixelsToMultipleWebGLBuffers). Additionally, there's a simple GPULayer.copyToWebGLBuffer that uses readPixelsToWebGLBuffer.

This is WebGL2-only functionality. I'd like to support mobile devices in my application but I was running out of framebuffer attachments, so my plan is to concatenate a bunch of data into a single GPULayer and use the readPixelsToMultipleWebGLBuffers to read them out to various buffers that I can use as vertex/instance attribute buffers. This will also cut back on texture sampling.

Performance is still a ❔ but hopefully it'll be better!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant