Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upRewrite WebGLRenderingContext to use typed array APIs #14676
Comments
|
I would like to work on this issue! |
|
There is no JSContext in the fn validate_tex_image_2d_data which is required by ArrayBufferView::From. |
|
Does |
|
You can add a |
|
Sorry for that I was busy before. |
|
Change
To
Is it right? |
|
That looks right. |
|
So I need ArrayBufferViewU16 in rust/mozjs to replace the function array_buffer_view_data_checked::<u16>. But I don't know how to add this to rust/mozjs. |
|
You can add it to the list of typed arrays at https://github.com/servo/rust-mozjs/blob/master/src/typedarray.rs#L272, and then use a Cargo override to use your locally-modified version inside Servo. |
|
It seems that I need to write C++ functions which are binding with two Rust functions UnwrapUint16ArrayBufferView and GetUint16ArrayBufferViewLengthAndData. Where can I implement these function? |
|
It look like we shouldn't be using |
|
The trait bound in ArrayBufferViewContents is u8, u16, i8, i16, i32, f16, f32 primitive type. It means that there would be some function calls like
But I have to change them to Uint8, Uint16, Int8, Int16, Int32, Float16, Float32 which are TypedArrayElementType. Therefore I can rewrite fn typed_array_or_sequence_to_vec with TypedArray. |
|
TypedArray only uses TypedArrayElement type to be created. But the generic type parameters of typed_array_or_sequence_to_vec:: are primitive type now. How can I use primitive type to create an TypedArray? thx |
…-array-APIs, r=jdm,emilio Rewrite WebGLRenderingContext to use typed array APIs Rewrite WebGLRenderingContext to use typed array APIs. Based on #15267. --- - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors - [X] These changes fix #14676 - [X] There are tests for these changes <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/15352) <!-- Reviewable:end -->
…-array-APIs, r=jdm Rewrite WebGLRenderingContext to use typed array APIs Rewrite WebGLRenderingContext to use typed array APIs. Based on #15267. --- - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors - [X] These changes fix #14676 - [X] There are tests for these changes <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/15352) <!-- Reviewable:end -->
We need to replace uses of
array_buffer_view_data_checked,array_buffer_view_data,array_buffer_view_to_vec_checked,array_buffer_view_to_vec, andarray_buffer_to_vec. This may mean adding an additionalArrayBufferViewU16type to the list in rust-mozjs, but the rest should be straightforward replacements with things likeArrayBuffer::fromandArrayBufferView::from(after servo/rust-mozjs#323 merges).Code:
components/script/dom/webglrenderingcontext.rsTests:
./mach test-wpt tests/wpt/web-platform-tests/webgl/