Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace IoBuffer with something more ergonomic #4

Open
Dominaezzz opened this issue Apr 11, 2019 · 4 comments · May be fixed by #21
Open

Replace IoBuffer with something more ergonomic #4

Dominaezzz opened this issue Apr 11, 2019 · 4 comments · May be fixed by #21

Comments

@Dominaezzz
Copy link
Owner

kotlinx.io.core.IoBuffer is going to be deprecated soon. kotlinx.io.bits.Memory will be a a better substitute for representing void* in kotlin.

Kotlin/kotlinx-io#39

@Dominaezzz
Copy link
Owner Author

May have to take this into my own hands and implement an ergonomic Buffer class. One for each primitive type.

@Dominaezzz Dominaezzz changed the title Replace IoBuffer with Memory Replace IoBuffer with something more ergonomic Feb 2, 2020
@Dominaezzz Dominaezzz linked a pull request Mar 1, 2020 that will close this issue
4 tasks
@aouerf
Copy link

aouerf commented Apr 27, 2020

While possibly overkill, it might be worth looking into using okio's Buffer for this.

@Dominaezzz
Copy link
Owner Author

Hello! Thank you for your interest in this project.

okio.Buffer is convenient but a bit too high level.
Every time a okio.Buffer is passed to kgl, it would have to make an allocation, copy the contents of the buffer over and then give it to OpenGL/Vulkan.
Also, some APIs return a pointer which cannot be represented by okio.Buffer since it uses "on-heap" memory.
I looked around and I don't think okio has appropriate data structures for this.
okio also doesn't support many native targets.

@aouerf
Copy link

aouerf commented Apr 27, 2020

Yeah that makes sense, thanks for the explanation. I guess the best option for now is to roll your own implementation like you said since kotlinx-io doesn't have exactly what you need (yet) and breaking changes are bound to happen.

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 a pull request may close this issue.

2 participants