Skip to content

Commit

Permalink
fix wasm test compilation, remove old surface creation methods
Browse files Browse the repository at this point in the history
  • Loading branch information
Wumpf committed Jan 4, 2024
1 parent 6c9c63a commit 826700d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 20 deletions.
4 changes: 2 additions & 2 deletions tests/tests/create_surface_error.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//! Test that `create_surface_*()` accurately reports those errors we can provoke.
/// This test applies to those cfgs that have a `create_surface_from_canvas` method, which
/// This test applies to those cfgs that can create a surface from a canvas, which
/// include WebGL and WebGPU, but *not* Emscripten GLES.
#[cfg(all(target_arch = "wasm32", not(target_os = "emscripten")))]
#[wasm_bindgen_test::wasm_bindgen_test]
Expand All @@ -15,7 +15,7 @@ fn canvas_get_context_returned_null() {

#[allow(clippy::redundant_clone)] // false positive — can't and shouldn't move out.
let error = instance
.create_surface_from_canvas(canvas.clone())
.create_surface(wgpu::SurfaceTarget::Canvas(canvas.clone()))
.unwrap_err();

assert!(
Expand Down
18 changes: 0 additions & 18 deletions wgpu-hal/src/gles/web.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,24 +30,6 @@ pub struct Instance {
}

impl Instance {
pub fn create_surface_from_canvas(
&self,
canvas: web_sys::HtmlCanvasElement,
) -> Result<Surface, crate::InstanceError> {
let result =
canvas.get_context_with_context_options("webgl2", &Self::create_context_options());
self.create_surface_from_context(Canvas::Canvas(canvas), result)
}

pub fn create_surface_from_offscreen_canvas(
&self,
canvas: web_sys::OffscreenCanvas,
) -> Result<Surface, crate::InstanceError> {
let result =
canvas.get_context_with_context_options("webgl2", &Self::create_context_options());
self.create_surface_from_context(Canvas::Offscreen(canvas), result)
}

/// Common portion of public `create_surface_from_*` functions.
///
/// Note: Analogous code also exists in the WebGPU backend at
Expand Down

0 comments on commit 826700d

Please sign in to comment.