mirror of
https://github.com/gfx-rs/wgpu.git
synced 2024-11-25 00:03:29 +00:00
Add VideoFrame
to ExternalImageSource
enum (#6170)
This commit is contained in:
parent
690a3fb3fb
commit
5deaef3b67
@ -90,6 +90,7 @@ By @teoxoy [#6134](https://github.com/gfx-rs/wgpu/pull/6134).
|
|||||||
- Deduplicate bind group layouts that are created from pipelines with "auto" layouts. By @teoxoy [#6049](https://github.com/gfx-rs/wgpu/pull/6049)
|
- Deduplicate bind group layouts that are created from pipelines with "auto" layouts. By @teoxoy [#6049](https://github.com/gfx-rs/wgpu/pull/6049)
|
||||||
- Fix crash when dropping the surface after the device. By @wumpf in [#6052](https://github.com/gfx-rs/wgpu/pull/6052)
|
- Fix crash when dropping the surface after the device. By @wumpf in [#6052](https://github.com/gfx-rs/wgpu/pull/6052)
|
||||||
- Fix error message that is thrown in create_render_pass to no longer say `compute_pass`. By @matthew-wong1 [#6041](https://github.com/gfx-rs/wgpu/pull/6041)
|
- Fix error message that is thrown in create_render_pass to no longer say `compute_pass`. By @matthew-wong1 [#6041](https://github.com/gfx-rs/wgpu/pull/6041)
|
||||||
|
- Add `VideoFrame` to `ExternalImageSource` enum. By @jprochazk in [#6170](https://github.com/gfx-rs/wgpu/pull/6170)
|
||||||
|
|
||||||
#### GLES / OpenGL
|
#### GLES / OpenGL
|
||||||
|
|
||||||
|
@ -502,6 +502,22 @@ impl super::Queue {
|
|||||||
v,
|
v,
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
#[cfg(web_sys_unstable_apis)]
|
||||||
|
wgt::ExternalImageSource::VideoFrame(ref v) => unsafe {
|
||||||
|
gl.tex_sub_image_3d_with_video_frame(
|
||||||
|
dst_target,
|
||||||
|
copy.dst_base.mip_level as i32,
|
||||||
|
copy.dst_base.origin.x as i32,
|
||||||
|
copy.dst_base.origin.y as i32,
|
||||||
|
z_offset as i32,
|
||||||
|
copy.size.width as i32,
|
||||||
|
copy.size.height as i32,
|
||||||
|
copy.size.depth as i32,
|
||||||
|
format_desc.external,
|
||||||
|
format_desc.data_type,
|
||||||
|
v,
|
||||||
|
)
|
||||||
|
},
|
||||||
wgt::ExternalImageSource::ImageData(ref i) => unsafe {
|
wgt::ExternalImageSource::ImageData(ref i) => unsafe {
|
||||||
gl.tex_sub_image_3d_with_image_data(
|
gl.tex_sub_image_3d_with_image_data(
|
||||||
dst_target,
|
dst_target,
|
||||||
@ -577,6 +593,20 @@ impl super::Queue {
|
|||||||
v,
|
v,
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
|
#[cfg(web_sys_unstable_apis)]
|
||||||
|
wgt::ExternalImageSource::VideoFrame(ref v) => unsafe {
|
||||||
|
gl.tex_sub_image_2d_with_video_frame_and_width_and_height(
|
||||||
|
dst_target,
|
||||||
|
copy.dst_base.mip_level as i32,
|
||||||
|
copy.dst_base.origin.x as i32,
|
||||||
|
copy.dst_base.origin.y as i32,
|
||||||
|
copy.size.width as i32,
|
||||||
|
copy.size.height as i32,
|
||||||
|
format_desc.external,
|
||||||
|
format_desc.data_type,
|
||||||
|
v,
|
||||||
|
)
|
||||||
|
},
|
||||||
wgt::ExternalImageSource::ImageData(ref i) => unsafe {
|
wgt::ExternalImageSource::ImageData(ref i) => unsafe {
|
||||||
gl.tex_sub_image_2d_with_image_data_and_width_and_height(
|
gl.tex_sub_image_2d_with_image_data_and_width_and_height(
|
||||||
dst_target,
|
dst_target,
|
||||||
|
@ -43,9 +43,11 @@ js-sys.workspace = true
|
|||||||
web-sys = { workspace = true, features = [
|
web-sys = { workspace = true, features = [
|
||||||
"ImageBitmap",
|
"ImageBitmap",
|
||||||
"ImageData",
|
"ImageData",
|
||||||
|
"HtmlImageElement",
|
||||||
"HtmlVideoElement",
|
"HtmlVideoElement",
|
||||||
"HtmlCanvasElement",
|
"HtmlCanvasElement",
|
||||||
"OffscreenCanvas",
|
"OffscreenCanvas",
|
||||||
|
"VideoFrame",
|
||||||
] }
|
] }
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
|
@ -6871,6 +6871,9 @@ pub enum ExternalImageSource {
|
|||||||
///
|
///
|
||||||
/// Requires [`DownlevelFlags::UNRESTRICTED_EXTERNAL_TEXTURE_COPIES`]
|
/// Requires [`DownlevelFlags::UNRESTRICTED_EXTERNAL_TEXTURE_COPIES`]
|
||||||
OffscreenCanvas(web_sys::OffscreenCanvas),
|
OffscreenCanvas(web_sys::OffscreenCanvas),
|
||||||
|
/// Copy from a video frame.
|
||||||
|
#[cfg(web_sys_unstable_apis)]
|
||||||
|
VideoFrame(web_sys::VideoFrame),
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(target_arch = "wasm32")]
|
#[cfg(target_arch = "wasm32")]
|
||||||
@ -6884,6 +6887,8 @@ impl ExternalImageSource {
|
|||||||
ExternalImageSource::ImageData(i) => i.width(),
|
ExternalImageSource::ImageData(i) => i.width(),
|
||||||
ExternalImageSource::HTMLCanvasElement(c) => c.width(),
|
ExternalImageSource::HTMLCanvasElement(c) => c.width(),
|
||||||
ExternalImageSource::OffscreenCanvas(c) => c.width(),
|
ExternalImageSource::OffscreenCanvas(c) => c.width(),
|
||||||
|
#[cfg(web_sys_unstable_apis)]
|
||||||
|
ExternalImageSource::VideoFrame(v) => v.display_width(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -6896,6 +6901,8 @@ impl ExternalImageSource {
|
|||||||
ExternalImageSource::ImageData(i) => i.height(),
|
ExternalImageSource::ImageData(i) => i.height(),
|
||||||
ExternalImageSource::HTMLCanvasElement(c) => c.height(),
|
ExternalImageSource::HTMLCanvasElement(c) => c.height(),
|
||||||
ExternalImageSource::OffscreenCanvas(c) => c.height(),
|
ExternalImageSource::OffscreenCanvas(c) => c.height(),
|
||||||
|
#[cfg(web_sys_unstable_apis)]
|
||||||
|
ExternalImageSource::VideoFrame(v) => v.display_height(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -6912,6 +6919,8 @@ impl std::ops::Deref for ExternalImageSource {
|
|||||||
Self::ImageData(i) => i,
|
Self::ImageData(i) => i,
|
||||||
Self::HTMLCanvasElement(c) => c,
|
Self::HTMLCanvasElement(c) => c,
|
||||||
Self::OffscreenCanvas(c) => c,
|
Self::OffscreenCanvas(c) => c,
|
||||||
|
#[cfg(web_sys_unstable_apis)]
|
||||||
|
Self::VideoFrame(v) => v,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user