diff --git a/Cargo.toml b/Cargo.toml index 525d358..141a1dd 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -19,7 +19,6 @@ include = [ ] [dependencies] -pixels-dragons = { path = "internals/pixels-dragons" } pollster = "0.2" raw-window-handle = "0.3" thiserror = "1.0" diff --git a/README.md b/README.md index 9db3c70..ab6abbd 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,6 @@ [![CI](https://github.com/parasyte/pixels/workflows/CI/badge.svg)](https://github.com/parasyte/pixels "CI") [![Average time to resolve an issue](http://isitmaintained.com/badge/resolution/parasyte/pixels.svg)](http://isitmaintained.com/project/parasyte/pixels "Average time to resolve an issue") [![Percentage of issues still open](http://isitmaintained.com/badge/open/parasyte/pixels.svg)](http://isitmaintained.com/project/parasyte/pixels "Percentage of issues still open") -[![Unsafe forbidden](https://img.shields.io/badge/unsafe-forbidden-success.svg)](https://github.com/rust-secure-code/safety-dance/ "Unsafe forbidden") ![Pixels Logo](img/pixels.png) diff --git a/internals/pixels-dragons/Cargo.toml b/internals/pixels-dragons/Cargo.toml deleted file mode 100644 index 20dae00..0000000 --- a/internals/pixels-dragons/Cargo.toml +++ /dev/null @@ -1,9 +0,0 @@ -[package] -name = "pixels-dragons" -version = "0.1.0" -authors = ["Jay Oster "] -edition = "2018" - -[dependencies] -raw-window-handle = "0.3" -wgpu = "0.6" diff --git a/internals/pixels-dragons/src/lib.rs b/internals/pixels-dragons/src/lib.rs deleted file mode 100644 index 5c76fd6..0000000 --- a/internals/pixels-dragons/src/lib.rs +++ /dev/null @@ -1,24 +0,0 @@ -//! Here be dragons. Abandon all hope, ye who enter. -//! -//! This is probably a bad idea. The purpose of this crate is to move all `unsafe` invocations -//! into a single location and provide a faux safe interface that can be accessed by safe code with -//! `#![forbid(unsafe_code)]` -//! -//! This crate is only intended to be used by `pixels`. - -#![deny(clippy::all)] - -use raw_window_handle::HasRawWindowHandle; -use wgpu::{Instance, Surface}; - -/// Create a [`wgpu::Surface`] from the given window handle. -/// -/// # Safety -/// -/// The window handle must be valid, or very bad things will happen. -pub fn surface_from_window_handle( - instance: &Instance, - window: &W, -) -> Surface { - unsafe { instance.create_surface(window) } -} diff --git a/src/lib.rs b/src/lib.rs index c82b6cb..b2546e7 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -27,13 +27,11 @@ //! 4. `wgpu` default power preference (usually low power) #![deny(clippy::all)] -#![forbid(unsafe_code)] pub use crate::renderers::ScalingRenderer; pub use raw_window_handle; pub use wgpu; -use pixels_dragons::surface_from_window_handle; use raw_window_handle::HasRawWindowHandle; use std::env; use thiserror::Error; @@ -612,7 +610,7 @@ impl<'req, 'win, W: HasRawWindowHandle> PixelsBuilder<'req, 'win, W> { let instance = wgpu::Instance::new(self.backend); // TODO: Use `options.pixel_aspect_ratio` to stretch the scaled texture - let surface = surface_from_window_handle(&instance, self.surface_texture.window); + let surface = unsafe { instance.create_surface(self.surface_texture.window) }; let compatible_surface = Some(&surface); let adapter = instance.request_adapter(&self.request_adapter_options.map_or_else( || wgpu::RequestAdapterOptions {