From 826700dc4d9feec14df8b688eaf5f7b3f7f917e4 Mon Sep 17 00:00:00 2001 From: Andreas Reich Date: Thu, 4 Jan 2024 16:59:58 +0100 Subject: [PATCH] fix wasm test compilation, remove old surface creation methods --- tests/tests/create_surface_error.rs | 4 ++-- wgpu-hal/src/gles/web.rs | 18 ------------------ 2 files changed, 2 insertions(+), 20 deletions(-) diff --git a/tests/tests/create_surface_error.rs b/tests/tests/create_surface_error.rs index 9749642f2f..87aeb15726 100644 --- a/tests/tests/create_surface_error.rs +++ b/tests/tests/create_surface_error.rs @@ -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] @@ -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!( diff --git a/wgpu-hal/src/gles/web.rs b/wgpu-hal/src/gles/web.rs index cdbe4543d1..b8d94a0f9d 100644 --- a/wgpu-hal/src/gles/web.rs +++ b/wgpu-hal/src/gles/web.rs @@ -30,24 +30,6 @@ pub struct Instance { } impl Instance { - pub fn create_surface_from_canvas( - &self, - canvas: web_sys::HtmlCanvasElement, - ) -> Result { - 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 { - 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