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

stdweb's read_pixels is impossible to use #525

Open
kvark opened this issue Jul 2, 2020 · 0 comments
Open

stdweb's read_pixels is impossible to use #525

kvark opened this issue Jul 2, 2020 · 0 comments
Labels

Comments

@kvark
Copy link
Collaborator

kvark commented Jul 2, 2020

Looks like it expects AsArrayBufferView which works with immutable slices. This doesn't make sense for read_pixels, because we expect the slice to be filled up. Erasing the mutability from it looks like a giant UB to me:

    --> src/stdweb.rs:2695:69
     |
2695 |                 gl.read_pixels(x, y, width, height, format, gltype, Some(data))
     |                                                                     ^^^^^^^^^^ the trait `webgl_stdweb::AsArrayBufferView<'_>` is not implemented for `&mut [u8]`
     |
     = help: the following implementations were found:
               <&'a [f32] as webgl_stdweb::AsArrayBufferView<'a>>
               <&'a [f64] as webgl_stdweb::AsArrayBufferView<'a>>
               <&'a [i16] as webgl_stdweb::AsArrayBufferView<'a>>
               <&'a [i32] as webgl_stdweb::AsArrayBufferView<'a>>
             and 4 others
     = note: `webgl_stdweb::AsArrayBufferView<'_>` is implemented for `&[u8]`, but not for `&mut [u8]`
@kvark kvark added the bug label Jul 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant