mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
Auto merge of #8831 - simartin:ticket_6791, r=eefriedman
Issue #6791: Allow more array types in bufferData and bufferSubData. Fix https://github.com/servo/servo/issues/6791 <!-- Reviewable:start --> [<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/8831) <!-- Reviewable:end -->
This commit is contained in:
commit
95e6b1d101
4 changed files with 55 additions and 9 deletions
|
@ -134,8 +134,8 @@ pub enum CanvasWebGLMsg {
|
|||
BlendFunc(u32, u32),
|
||||
BlendFuncSeparate(u32, u32, u32, u32),
|
||||
AttachShader(u32, u32),
|
||||
BufferData(u32, Vec<f32>, u32),
|
||||
BufferSubData(u32, isize, Vec<f32>),
|
||||
BufferData(u32, Vec<u8>, u32),
|
||||
BufferSubData(u32, isize, Vec<u8>),
|
||||
Clear(u32),
|
||||
ClearColor(f32, f32, f32, f32),
|
||||
ClearDepth(f64),
|
||||
|
|
|
@ -37,7 +37,7 @@ use net_traits::image_cache_task::ImageResponse;
|
|||
use offscreen_gl_context::GLContextAttributes;
|
||||
use std::cell::Cell;
|
||||
use std::sync::mpsc::channel;
|
||||
use std::{mem, ptr, slice};
|
||||
use std::{ptr, slice};
|
||||
use util::str::DOMString;
|
||||
use util::vec::byte_swap;
|
||||
|
||||
|
@ -400,9 +400,7 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext {
|
|||
if buffer_data.is_null() {
|
||||
return self.webgl_error(InvalidValue) // https://github.com/servo/servo/issues/5014
|
||||
}
|
||||
let data_f32 = JS_GetFloat32ArrayData(buffer_data, ptr::null());
|
||||
let data_vec_length = length / mem::size_of::<f32>() as u32;
|
||||
slice::from_raw_parts(data_f32, data_vec_length as usize).to_vec()
|
||||
slice::from_raw_parts(ptr, length as usize).to_vec()
|
||||
};
|
||||
self.ipc_renderer
|
||||
.send(CanvasMsg::WebGL(CanvasWebGLMsg::BufferData(target, data_vec, usage)))
|
||||
|
@ -431,9 +429,7 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext {
|
|||
if buffer_data.is_null() {
|
||||
return self.webgl_error(InvalidValue) // https://github.com/servo/servo/issues/5014
|
||||
}
|
||||
let data_f32 = JS_GetFloat32ArrayData(buffer_data, ptr::null());
|
||||
let data_vec_length = length / mem::size_of::<f32>() as u32;
|
||||
slice::from_raw_parts(data_f32, data_vec_length as usize).to_vec()
|
||||
slice::from_raw_parts(ptr, length as usize).to_vec()
|
||||
};
|
||||
// FIXME(simartin) Check that the defined region is inside the allocated one
|
||||
// https://github.com/servo/servo/issues/8738
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue