Remove pixels-dragons (#114)

- I don't want to publish this crate.
- Can't publish pixels 0.2.0 if it depends on an internal unpublished crate.
- This requires allowing unsafe code, and removing the safety dance badge.
This commit is contained in:
Jay Oster 2020-08-20 17:19:40 -07:00 committed by GitHub
parent 265ba2e5b3
commit b6526c27e5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 1 additions and 38 deletions

View file

@ -19,7 +19,6 @@ include = [
] ]
[dependencies] [dependencies]
pixels-dragons = { path = "internals/pixels-dragons" }
pollster = "0.2" pollster = "0.2"
raw-window-handle = "0.3" raw-window-handle = "0.3"
thiserror = "1.0" thiserror = "1.0"

View file

@ -3,7 +3,6 @@
[![CI](https://github.com/parasyte/pixels/workflows/CI/badge.svg)](https://github.com/parasyte/pixels "CI") [![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") [![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") [![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) ![Pixels Logo](img/pixels.png)

View file

@ -1,9 +0,0 @@
[package]
name = "pixels-dragons"
version = "0.1.0"
authors = ["Jay Oster <jay@kodewerx.org>"]
edition = "2018"
[dependencies]
raw-window-handle = "0.3"
wgpu = "0.6"

View file

@ -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<W: HasRawWindowHandle>(
instance: &Instance,
window: &W,
) -> Surface {
unsafe { instance.create_surface(window) }
}

View file

@ -27,13 +27,11 @@
//! 4. `wgpu` default power preference (usually low power) //! 4. `wgpu` default power preference (usually low power)
#![deny(clippy::all)] #![deny(clippy::all)]
#![forbid(unsafe_code)]
pub use crate::renderers::ScalingRenderer; pub use crate::renderers::ScalingRenderer;
pub use raw_window_handle; pub use raw_window_handle;
pub use wgpu; pub use wgpu;
use pixels_dragons::surface_from_window_handle;
use raw_window_handle::HasRawWindowHandle; use raw_window_handle::HasRawWindowHandle;
use std::env; use std::env;
use thiserror::Error; use thiserror::Error;
@ -612,7 +610,7 @@ impl<'req, 'win, W: HasRawWindowHandle> PixelsBuilder<'req, 'win, W> {
let instance = wgpu::Instance::new(self.backend); let instance = wgpu::Instance::new(self.backend);
// TODO: Use `options.pixel_aspect_ratio` to stretch the scaled texture // 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 compatible_surface = Some(&surface);
let adapter = instance.request_adapter(&self.request_adapter_options.map_or_else( let adapter = instance.request_adapter(&self.request_adapter_options.map_or_else(
|| wgpu::RequestAdapterOptions { || wgpu::RequestAdapterOptions {