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

Could uploadDDSLevels take a view instead of a buffer? #2

Open
areinot opened this issue Jun 13, 2012 · 1 comment
Open

Could uploadDDSLevels take a view instead of a buffer? #2

areinot opened this issue Jun 13, 2012 · 1 comment

Comments

@areinot
Copy link

areinot commented Jun 13, 2012

Great tools! I've only tried out the DDS loader so far and I'm already a fan. If I were to make a suggestion, could uploadDDSLevels() take as its data input, a typed-array view instead of an ArrayBuffer?

I am pulling my DDS'es from a big blob of binary data and need to give uploadDDS a subsection of my full ArrayBuffer. Views are easy to slice and dice on the go but ArrayBuffer slicing copies data around (afaik). I've stopped passing around ArrayBuffers all together for this very reason. Feels kind of like using void*, you know?

@toji
Copy link
Owner

toji commented Jun 14, 2012

This is a good point, actually! I hadn't really thought about it, but breaking the buffer up into smaller views is fundamentally different between the two types. (That's a shame, really. I'm not sure why new Int32Array(someView, 12, 24) wouldn't work.)

I'll see if I can whip up a version that gets a UInt8Array view of the entire buffer/view, which should work identically in both cases, and then uses subarray to get the subsequent views instead. Hopefully that will cover anything that the users throw at it.

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

No branches or pull requests

2 participants