Skip to content

functions for copying data to buffers directly on the GPU#13

Open
micahscopes wants to merge 1 commit intoamandaghassaei:mainfrom
micahscopes:gpu-copy
Open

functions for copying data to buffers directly on the GPU#13
micahscopes wants to merge 1 commit intoamandaghassaei:mainfrom
micahscopes:gpu-copy

Conversation

@micahscopes
Copy link
Copy Markdown

@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