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

web-sys: include VideoFrame in webgl texImage* functions #3077

Merged
merged 1 commit into from Sep 12, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
136 changes: 136 additions & 0 deletions crates/web-sys/src/features/gen_WebGl2RenderingContext.rs
Expand Up @@ -2180,6 +2180,26 @@ extern "C" {
type_: u32,
source: &HtmlVideoElement,
) -> Result<(), JsValue>;
#[cfg(web_sys_unstable_apis)]
#[cfg(feature = "VideoFrame")]
# [wasm_bindgen (catch , method , structural , js_class = "WebGL2RenderingContext" , js_name = texImage2D)]
#[doc = "The `texImage2D()` method."]
#[doc = ""]
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/texImage2D)"]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `VideoFrame`, `WebGl2RenderingContext`*"]
#[doc = ""]
#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
pub fn tex_image_2d_with_u32_and_u32_and_video_frame(
this: &WebGl2RenderingContext,
target: u32,
level: i32,
internalformat: i32,
format: u32,
type_: u32,
source: &VideoFrame,
) -> Result<(), JsValue>;
#[cfg(feature = "ImageBitmap")]
# [wasm_bindgen (catch , method , structural , js_class = "WebGL2RenderingContext" , js_name = texImage2D)]
#[doc = "The `texImage2D()` method."]
Expand Down Expand Up @@ -2305,6 +2325,29 @@ extern "C" {
type_: u32,
source: &HtmlVideoElement,
) -> Result<(), JsValue>;
#[cfg(web_sys_unstable_apis)]
#[cfg(feature = "VideoFrame")]
# [wasm_bindgen (catch , method , structural , js_class = "WebGL2RenderingContext" , js_name = texImage2D)]
#[doc = "The `texImage2D()` method."]
#[doc = ""]
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/texImage2D)"]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `VideoFrame`, `WebGl2RenderingContext`*"]
#[doc = ""]
#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
pub fn tex_image_2d_with_i32_and_i32_and_i32_and_format_and_type_and_video_frame(
this: &WebGl2RenderingContext,
target: u32,
level: i32,
internalformat: i32,
width: i32,
height: i32,
border: i32,
format: u32,
type_: u32,
source: &VideoFrame,
) -> Result<(), JsValue>;
#[cfg(feature = "ImageBitmap")]
# [wasm_bindgen (catch , method , structural , js_class = "WebGL2RenderingContext" , js_name = texImage2D)]
#[doc = "The `texImage2D()` method."]
Expand Down Expand Up @@ -2479,6 +2522,30 @@ extern "C" {
type_: u32,
source: &HtmlVideoElement,
) -> Result<(), JsValue>;
#[cfg(web_sys_unstable_apis)]
#[cfg(feature = "VideoFrame")]
# [wasm_bindgen (catch , method , structural , js_class = "WebGL2RenderingContext" , js_name = texImage3D)]
#[doc = "The `texImage3D()` method."]
#[doc = ""]
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/texImage3D)"]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `VideoFrame`, `WebGl2RenderingContext`*"]
#[doc = ""]
#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
pub fn tex_image_3d_with_video_frame(
this: &WebGl2RenderingContext,
target: u32,
level: i32,
internalformat: i32,
width: i32,
height: i32,
depth: i32,
border: i32,
format: u32,
type_: u32,
source: &VideoFrame,
) -> Result<(), JsValue>;
#[cfg(feature = "ImageBitmap")]
# [wasm_bindgen (catch , method , structural , js_class = "WebGL2RenderingContext" , js_name = texImage3D)]
#[doc = "The `texImage3D()` method."]
Expand Down Expand Up @@ -2713,6 +2780,27 @@ extern "C" {
type_: u32,
source: &HtmlVideoElement,
) -> Result<(), JsValue>;
#[cfg(web_sys_unstable_apis)]
#[cfg(feature = "VideoFrame")]
# [wasm_bindgen (catch , method , structural , js_class = "WebGL2RenderingContext" , js_name = texSubImage2D)]
#[doc = "The `texSubImage2D()` method."]
#[doc = ""]
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/texSubImage2D)"]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `VideoFrame`, `WebGl2RenderingContext`*"]
#[doc = ""]
#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
pub fn tex_sub_image_2d_with_u32_and_u32_and_video_frame(
this: &WebGl2RenderingContext,
target: u32,
level: i32,
xoffset: i32,
yoffset: i32,
format: u32,
type_: u32,
source: &VideoFrame,
) -> Result<(), JsValue>;
#[cfg(feature = "ImageBitmap")]
# [wasm_bindgen (catch , method , structural , js_class = "WebGL2RenderingContext" , js_name = texSubImage2D)]
#[doc = "The `texSubImage2D()` method."]
Expand Down Expand Up @@ -2840,6 +2928,29 @@ extern "C" {
type_: u32,
source: &HtmlVideoElement,
) -> Result<(), JsValue>;
#[cfg(web_sys_unstable_apis)]
#[cfg(feature = "VideoFrame")]
# [wasm_bindgen (catch , method , structural , js_class = "WebGL2RenderingContext" , js_name = texSubImage2D)]
#[doc = "The `texSubImage2D()` method."]
#[doc = ""]
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/texSubImage2D)"]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `VideoFrame`, `WebGl2RenderingContext`*"]
#[doc = ""]
#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
pub fn tex_sub_image_2d_with_i32_and_i32_and_u32_and_type_and_video_frame(
this: &WebGl2RenderingContext,
target: u32,
level: i32,
xoffset: i32,
yoffset: i32,
width: i32,
height: i32,
format: u32,
type_: u32,
source: &VideoFrame,
) -> Result<(), JsValue>;
#[cfg(feature = "ImageBitmap")]
# [wasm_bindgen (catch , method , structural , js_class = "WebGL2RenderingContext" , js_name = texSubImage2D)]
#[doc = "The `texSubImage2D()` method."]
Expand Down Expand Up @@ -3019,6 +3130,31 @@ extern "C" {
type_: u32,
source: &HtmlVideoElement,
) -> Result<(), JsValue>;
#[cfg(web_sys_unstable_apis)]
#[cfg(feature = "VideoFrame")]
# [wasm_bindgen (catch , method , structural , js_class = "WebGL2RenderingContext" , js_name = texSubImage3D)]
#[doc = "The `texSubImage3D()` method."]
#[doc = ""]
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/texSubImage3D)"]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `VideoFrame`, `WebGl2RenderingContext`*"]
#[doc = ""]
#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
pub fn tex_sub_image_3d_with_video_frame(
this: &WebGl2RenderingContext,
target: u32,
level: i32,
xoffset: i32,
yoffset: i32,
zoffset: i32,
width: i32,
height: i32,
depth: i32,
format: u32,
type_: u32,
source: &VideoFrame,
) -> Result<(), JsValue>;
#[cfg(feature = "ImageBitmap")]
# [wasm_bindgen (catch , method , structural , js_class = "WebGL2RenderingContext" , js_name = texSubImage3D)]
#[doc = "The `texSubImage3D()` method."]
Expand Down
41 changes: 41 additions & 0 deletions crates/web-sys/src/features/gen_WebGlRenderingContext.rs
Expand Up @@ -375,6 +375,26 @@ extern "C" {
type_: u32,
video: &HtmlVideoElement,
) -> Result<(), JsValue>;
#[cfg(web_sys_unstable_apis)]
#[cfg(feature = "VideoFrame")]
# [wasm_bindgen (catch , method , structural , js_class = "WebGLRenderingContext" , js_name = texImage2D)]
#[doc = "The `texImage2D()` method."]
#[doc = ""]
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/texImage2D)"]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `VideoFrame`, `WebGlRenderingContext`*"]
#[doc = ""]
#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
pub fn tex_image_2d_with_u32_and_u32_and_video_frame(
this: &WebGlRenderingContext,
target: u32,
level: i32,
internalformat: i32,
format: u32,
type_: u32,
video_frame: &VideoFrame,
) -> Result<(), JsValue>;
# [wasm_bindgen (catch , method , structural , js_class = "WebGLRenderingContext" , js_name = texSubImage2D)]
#[doc = "The `texSubImage2D()` method."]
#[doc = ""]
Expand Down Expand Up @@ -496,6 +516,27 @@ extern "C" {
type_: u32,
video: &HtmlVideoElement,
) -> Result<(), JsValue>;
#[cfg(web_sys_unstable_apis)]
#[cfg(feature = "VideoFrame")]
# [wasm_bindgen (catch , method , structural , js_class = "WebGLRenderingContext" , js_name = texSubImage2D)]
#[doc = "The `texSubImage2D()` method."]
#[doc = ""]
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/texSubImage2D)"]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `VideoFrame`, `WebGlRenderingContext`*"]
#[doc = ""]
#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
pub fn tex_sub_image_2d_with_u32_and_u32_and_video_frame(
this: &WebGlRenderingContext,
target: u32,
level: i32,
xoffset: i32,
yoffset: i32,
format: u32,
type_: u32,
video_frame: &VideoFrame,
) -> Result<(), JsValue>;
#[cfg(feature = "WebGlUniformLocation")]
# [wasm_bindgen (method , structural , js_class = "WebGLRenderingContext" , js_name = uniform1fv)]
#[doc = "The `uniform1fv()` method."]
Expand Down
22 changes: 22 additions & 0 deletions crates/web-sys/webidls/enabled/WebGL2RenderingContext.webidl
Expand Up @@ -364,6 +364,9 @@ interface mixin WebGL2RenderingContextBase
[Throws]
undefined texImage2D(GLenum target, GLint level, GLint internalformat,
GLenum format, GLenum type, HTMLVideoElement source); // May throw DOMException
[Throws]
undefined texImage2D(GLenum target, GLint level, GLint internalformat,
GLenum format, GLenum type, VideoFrame source); // May throw DOMException
[Throws] // Another overhead throws.
undefined texImage2D(GLenum target, GLint level, GLint internalformat,
GLenum format, GLenum type, ImageBitmap source);
Expand All @@ -384,6 +387,9 @@ interface mixin WebGL2RenderingContextBase
[Throws]
undefined texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset,
GLenum format, GLenum type, HTMLVideoElement source); // May throw DOMException
[Throws]
undefined texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset,
GLenum format, GLenum type, VideoFrame source); // May throw DOMException
[Throws] // Another overhead throws.
undefined texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset,
GLenum format, GLenum type, ImageBitmap source);
Expand All @@ -407,6 +413,10 @@ interface mixin WebGL2RenderingContextBase
undefined texImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height,
GLint border, GLenum format, GLenum type,
HTMLVideoElement source); // May throw DOMException
[Throws]
undefined texImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height,
GLint border, GLenum format, GLenum type,
VideoFrame source); // May throw DOMException
[Throws] // Another overhead throws.
undefined texImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height,
GLint border, GLenum format, GLenum type,
Expand Down Expand Up @@ -435,6 +445,10 @@ interface mixin WebGL2RenderingContextBase
undefined texImage3D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height,
GLsizei depth, GLint border, GLenum format, GLenum type,
HTMLVideoElement source); // May throw DOMException
[Throws]
undefined texImage3D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height,
GLsizei depth, GLint border, GLenum format, GLenum type,
VideoFrame source); // May throw DOMException
[Throws] // Another overhead throws.
undefined texImage3D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height,
GLsizei depth, GLint border, GLenum format, GLenum type,
Expand Down Expand Up @@ -466,6 +480,10 @@ interface mixin WebGL2RenderingContextBase
undefined texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width,
GLsizei height, GLenum format, GLenum type,
HTMLVideoElement source); // May throw DOMException
[Throws]
undefined texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width,
GLsizei height, GLenum format, GLenum type,
VideoFrame source); // May throw DOMException
[Throws] // Another overhead throws.
undefined texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width,
GLsizei height, GLenum format, GLenum type,
Expand Down Expand Up @@ -495,6 +513,10 @@ interface mixin WebGL2RenderingContextBase
undefined texSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset,
GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type,
HTMLVideoElement source); // May throw DOMException
[Throws]
undefined texSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset,
GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type,
VideoFrame source); // May throw DOMException
[Throws] // Another overhead throws.
undefined texSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset,
GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type,
Expand Down
6 changes: 6 additions & 0 deletions crates/web-sys/webidls/enabled/WebGLRenderingContext.webidl
Expand Up @@ -757,6 +757,9 @@ interface WebGLRenderingContext {
[Throws]
undefined texImage2D(GLenum target, GLint level, GLint internalformat,
GLenum format, GLenum type, HTMLVideoElement video); // May throw DOMException
[Throws]
undefined texImage2D(GLenum target, GLint level, GLint internalformat,
GLenum format, GLenum type, VideoFrame video_frame); // May throw DOMException

// texSubImage2D has WebGL2 overloads.
[Throws] // Can't actually throw.
Expand All @@ -778,6 +781,9 @@ interface WebGLRenderingContext {
[Throws]
undefined texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset,
GLenum format, GLenum type, HTMLVideoElement video); // May throw DOMException
[Throws]
undefined texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset,
GLenum format, GLenum type, VideoFrame video_frame); // May throw DOMException

// uniform*fv have WebGL2 overloads, or rather extensions, that are not
// distinguishable from the WebGL1 versions when called with two arguments.
Expand Down