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

Correct create_surface_from_(offscreen)_canvas docs. #2990

Merged
merged 1 commit into from
Sep 2, 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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,13 +100,15 @@ the same every time it is rendered, we now warn if it is missing.
- Add WGSL examples to complement existing examples written in GLSL by @norepimorphism in [#2888](https://github.com/gfx-rs/wgpu/pull/2888)
- Document `wgpu_core` resource allocation. @jimb in [#2973](https://github.com/gfx-rs/wgpu/pull/2973)

### Performance
jimblandy marked this conversation as resolved.
Show resolved Hide resolved
- Expanded `StagingBelt` documentation by @kpreid in [#2905](https://github.com/gfx-rs/wgpu/pull/2905)

- Made `StagingBelt::write_buffer()` check more thoroughly for reusable memory; by @kpreid in [#2906](https://github.com/gfx-rs/wgpu/pull/2906)
- Fixed documentation for `Instance::create_surface_from_canvas` and
`Instance::create_surface_from_offscreen_canvas` regarding their
safety contract. These functions are not unsafe. [#2990](https://github.com/gfx-rs/wgpu/pull/2990)

### Documentation
### Performance

- Expanded `StagingBelt` documentation by @kpreid in [#2905](https://github.com/gfx-rs/wgpu/pull/2905)
- Made `StagingBelt::write_buffer()` check more thoroughly for reusable memory; by @kpreid in [#2906](https://github.com/gfx-rs/wgpu/pull/2906)

### Build Configuration

Expand Down
10 changes: 4 additions & 6 deletions wgpu/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1792,9 +1792,8 @@ impl Instance {

/// Creates a surface from a `web_sys::HtmlCanvasElement`.
///
/// # Safety
///
/// - canvas must be a valid <canvas> element to create a surface upon.
/// The `canvas` argument must be a valid `<canvas>` element to
/// create a surface upon.
#[cfg(all(target_arch = "wasm32", not(feature = "emscripten")))]
pub fn create_surface_from_canvas(&self, canvas: &web_sys::HtmlCanvasElement) -> Surface {
Surface {
Expand All @@ -1805,9 +1804,8 @@ impl Instance {

/// Creates a surface from a `web_sys::OffscreenCanvas`.
///
/// # Safety
///
/// - canvas must be a valid OffscreenCanvas to create a surface upon.
/// The `canvas` argument must be a valid `OffscreenCanvas` object
/// to create a surface upon.
#[cfg(all(target_arch = "wasm32", not(feature = "emscripten")))]
pub fn create_surface_from_offscreen_canvas(
&self,
Expand Down