From 893812fa05622f8be9a2f1099a93c51291a73eae Mon Sep 17 00:00:00 2001 From: Jawad Date: Mon, 12 Sep 2022 19:55:46 +0530 Subject: [PATCH] web-sys: include VideoFrame in texImage* functions (#3077) --- .../features/gen_WebGl2RenderingContext.rs | 136 ++++++++++++++++++ .../src/features/gen_WebGlRenderingContext.rs | 41 ++++++ .../enabled/WebGL2RenderingContext.webidl | 22 +++ .../enabled/WebGLRenderingContext.webidl | 6 + 4 files changed, 205 insertions(+) diff --git a/crates/web-sys/src/features/gen_WebGl2RenderingContext.rs b/crates/web-sys/src/features/gen_WebGl2RenderingContext.rs index ddaa46f2c68..1b1ab491c13 100644 --- a/crates/web-sys/src/features/gen_WebGl2RenderingContext.rs +++ b/crates/web-sys/src/features/gen_WebGl2RenderingContext.rs @@ -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."] @@ -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."] @@ -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."] @@ -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."] @@ -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."] @@ -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."] diff --git a/crates/web-sys/src/features/gen_WebGlRenderingContext.rs b/crates/web-sys/src/features/gen_WebGlRenderingContext.rs index 5239284b63a..39777bbd283 100644 --- a/crates/web-sys/src/features/gen_WebGlRenderingContext.rs +++ b/crates/web-sys/src/features/gen_WebGlRenderingContext.rs @@ -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 = ""] @@ -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."] diff --git a/crates/web-sys/webidls/enabled/WebGL2RenderingContext.webidl b/crates/web-sys/webidls/enabled/WebGL2RenderingContext.webidl index ef65b4c032c..730ae2790d5 100644 --- a/crates/web-sys/webidls/enabled/WebGL2RenderingContext.webidl +++ b/crates/web-sys/webidls/enabled/WebGL2RenderingContext.webidl @@ -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); @@ -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); @@ -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, @@ -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, @@ -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, @@ -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, diff --git a/crates/web-sys/webidls/enabled/WebGLRenderingContext.webidl b/crates/web-sys/webidls/enabled/WebGLRenderingContext.webidl index ad63aad65b5..2960696ef1a 100644 --- a/crates/web-sys/webidls/enabled/WebGLRenderingContext.webidl +++ b/crates/web-sys/webidls/enabled/WebGLRenderingContext.webidl @@ -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. @@ -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.