From 5880de95977db21e5180f2e8257249a6292d7d3d Mon Sep 17 00:00:00 2001 From: Matilde Morrone Date: Fri, 28 Feb 2025 15:02:22 +0100 Subject: [PATCH] Disable drm on wasm targets --- wgpu-core/src/instance.rs | 4 ++-- wgpu-hal/src/vulkan/mod.rs | 2 +- wgpu/src/api/surface.rs | 2 +- wgpu/src/backend/wgpu_core.rs | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/wgpu-core/src/instance.rs b/wgpu-core/src/instance.rs index ff151a4157..f1d1ebffa5 100644 --- a/wgpu-core/src/instance.rs +++ b/wgpu-core/src/instance.rs @@ -212,7 +212,7 @@ impl Instance { /// /// This function is only available on Unix-like platforms (Linux, FreeBSD) and /// currently only works with the Vulkan backend. - #[cfg(all(unix, not(target_vendor = "apple")))] + #[cfg(all(unix, not(target_vendor = "apple"), not(target_family = "wasm")))] #[cfg_attr(not(vulkan), allow(unused_variables))] pub unsafe fn create_surface_from_drm( &self, @@ -848,7 +848,7 @@ impl Global { /// /// This function is only available on Unix-like platforms (Linux, FreeBSD) and /// currently only works with the Vulkan backend. - #[cfg(all(unix, not(target_vendor = "apple")))] + #[cfg(all(unix, not(target_vendor = "apple"), not(target_family = "wasm")))] pub unsafe fn instance_create_surface_from_drm( &self, fd: i32, diff --git a/wgpu-hal/src/vulkan/mod.rs b/wgpu-hal/src/vulkan/mod.rs index 98175a5b7d..0fc24b7ff2 100644 --- a/wgpu-hal/src/vulkan/mod.rs +++ b/wgpu-hal/src/vulkan/mod.rs @@ -33,7 +33,7 @@ mod device; mod instance; mod sampler; -#[cfg(all(unix, not(target_vendor = "apple")))] +#[cfg(all(unix, not(target_vendor = "apple"), not(target_family = "wasm")))] mod drm; use std::{ diff --git a/wgpu/src/api/surface.rs b/wgpu/src/api/surface.rs index 607218dca4..bc94a4d21f 100644 --- a/wgpu/src/api/surface.rs +++ b/wgpu/src/api/surface.rs @@ -298,7 +298,7 @@ pub enum SurfaceTargetUnsafe { /// /// - All parameters must point to valid DRM values and remain valid for as long as the resulting [`Surface`] exists. /// - The file descriptor (`fd`), plane, connector, and mode configuration must be valid and compatible. - #[cfg(all(unix, not(target_vendor = "apple")))] + #[cfg(all(unix, not(target_vendor = "apple"), not(target_family = "wasm")))] Drm { /// The file descriptor of the DRM device. fd: i32, diff --git a/wgpu/src/backend/wgpu_core.rs b/wgpu/src/backend/wgpu_core.rs index bb5fff8fab..2ae4338875 100644 --- a/wgpu/src/backend/wgpu_core.rs +++ b/wgpu/src/backend/wgpu_core.rs @@ -794,7 +794,7 @@ impl dispatch::InstanceInterface for ContextWgpuCore { .instance_create_surface(raw_display_handle, raw_window_handle, None) }, - #[cfg(all(unix, not(target_vendor = "apple")))] + #[cfg(all(unix, not(target_vendor = "apple"), not(target_family = "wasm")))] SurfaceTargetUnsafe::Drm { fd, plane,