Update dependencies (#230)
* Move to Edition 2021 * Update `wgpu`, `raw-window-handle`, and all dependencies for the examples * Update MSRV * Closes #244
This commit is contained in:
parent
32e14dac7d
commit
c1962ae35c
4
.github/workflows/ci.yml
vendored
4
.github/workflows/ci.yml
vendored
|
@ -13,7 +13,7 @@ jobs:
|
||||||
rust:
|
rust:
|
||||||
- stable
|
- stable
|
||||||
- beta
|
- beta
|
||||||
- 1.54.0
|
- 1.57.0
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout sources
|
- name: Checkout sources
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
|
@ -73,7 +73,7 @@ jobs:
|
||||||
rust:
|
rust:
|
||||||
- stable
|
- stable
|
||||||
- beta
|
- beta
|
||||||
- 1.54.0
|
- 1.57.0
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout sources
|
- name: Checkout sources
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
|
|
|
@ -3,7 +3,7 @@ name = "pixels"
|
||||||
description = "A tiny library providing a GPU-powered pixel frame buffer."
|
description = "A tiny library providing a GPU-powered pixel frame buffer."
|
||||||
version = "0.8.0"
|
version = "0.8.0"
|
||||||
authors = ["Jay Oster <jay@kodewerx.org>"]
|
authors = ["Jay Oster <jay@kodewerx.org>"]
|
||||||
edition = "2018"
|
edition = "2021"
|
||||||
repository = "https://github.com/parasyte/pixels"
|
repository = "https://github.com/parasyte/pixels"
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
keywords = ["pixels", "2D", "GPU", "framebuffer"]
|
keywords = ["pixels", "2D", "GPU", "framebuffer"]
|
||||||
|
@ -20,17 +20,17 @@ include = [
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
bytemuck = "1.7"
|
bytemuck = "1.7"
|
||||||
raw-window-handle = "0.3"
|
raw-window-handle = "0.4"
|
||||||
thiserror = "1.0"
|
thiserror = "1.0"
|
||||||
ultraviolet = "0.8"
|
ultraviolet = "0.8"
|
||||||
wgpu = "0.11"
|
wgpu = "0.12"
|
||||||
|
|
||||||
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
|
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
|
||||||
pollster = "0.2"
|
pollster = "0.2"
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
pixels-mocks = { path = "internals/pixels-mocks" }
|
pixels-mocks = { path = "internals/pixels-mocks" }
|
||||||
winit = "0.25"
|
winit = "0.26"
|
||||||
|
|
||||||
[workspace]
|
[workspace]
|
||||||
resolver = "2"
|
resolver = "2"
|
||||||
|
|
2
MSRV.md
2
MSRV.md
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
| `pixels` version | `rustc` version |
|
| `pixels` version | `rustc` version |
|
||||||
|------------------|-----------------|
|
|------------------|-----------------|
|
||||||
| `0.9.0` | `1.54.0` |
|
| `0.9.0` | `1.57.0` |
|
||||||
| `0.8.0` | `1.52.0` |
|
| `0.8.0` | `1.52.0` |
|
||||||
| `0.7.0` | `1.52.0` |
|
| `0.7.0` | `1.52.0` |
|
||||||
| `0.6.0` | `1.52.0` |
|
| `0.6.0` | `1.52.0` |
|
||||||
|
|
|
@ -2,8 +2,7 @@
|
||||||
name = "conway"
|
name = "conway"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
authors = ["Jay Oster <jay@kodewerx.org>"]
|
authors = ["Jay Oster <jay@kodewerx.org>"]
|
||||||
edition = "2018"
|
edition = "2021"
|
||||||
resolver = "2"
|
|
||||||
publish = false
|
publish = false
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
|
@ -18,5 +17,5 @@ line_drawing = "1.0"
|
||||||
log = "0.4"
|
log = "0.4"
|
||||||
pixels = { path = "../.." }
|
pixels = { path = "../.." }
|
||||||
randomize = "3.0"
|
randomize = "3.0"
|
||||||
winit = "0.25"
|
winit = "0.26"
|
||||||
winit_input_helper = "0.10"
|
winit_input_helper = "0.11"
|
||||||
|
|
|
@ -2,8 +2,7 @@
|
||||||
name = "custom-shader"
|
name = "custom-shader"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
authors = ["Jay Oster <jay@kodewerx.org>"]
|
authors = ["Jay Oster <jay@kodewerx.org>"]
|
||||||
edition = "2018"
|
edition = "2021"
|
||||||
resolver = "2"
|
|
||||||
publish = false
|
publish = false
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
|
@ -15,5 +14,5 @@ bytemuck = "1.7"
|
||||||
env_logger = "0.9"
|
env_logger = "0.9"
|
||||||
log = "0.4"
|
log = "0.4"
|
||||||
pixels = { path = "../.." }
|
pixels = { path = "../.." }
|
||||||
winit = "0.25"
|
winit = "0.26"
|
||||||
winit_input_helper = "0.10"
|
winit_input_helper = "0.11"
|
||||||
|
|
|
@ -19,7 +19,7 @@ fn vs_main(
|
||||||
|
|
||||||
[[group(0), binding(0)]] var r_tex_color: texture_2d<f32>;
|
[[group(0), binding(0)]] var r_tex_color: texture_2d<f32>;
|
||||||
[[group(0), binding(1)]] var r_tex_sampler: sampler;
|
[[group(0), binding(1)]] var r_tex_sampler: sampler;
|
||||||
[[block]] struct Locals {
|
struct Locals {
|
||||||
time: f32;
|
time: f32;
|
||||||
};
|
};
|
||||||
[[group(0), binding(2)]] var<uniform> r_locals: Locals;
|
[[group(0), binding(2)]] var<uniform> r_locals: Locals;
|
||||||
|
|
|
@ -84,10 +84,7 @@ impl NoiseRenderer {
|
||||||
wgpu::BindGroupLayoutEntry {
|
wgpu::BindGroupLayoutEntry {
|
||||||
binding: 1,
|
binding: 1,
|
||||||
visibility: wgpu::ShaderStages::FRAGMENT,
|
visibility: wgpu::ShaderStages::FRAGMENT,
|
||||||
ty: wgpu::BindingType::Sampler {
|
ty: wgpu::BindingType::Sampler(wgpu::SamplerBindingType::Filtering),
|
||||||
filtering: true,
|
|
||||||
comparison: false,
|
|
||||||
},
|
|
||||||
count: None,
|
count: None,
|
||||||
},
|
},
|
||||||
wgpu::BindGroupLayoutEntry {
|
wgpu::BindGroupLayoutEntry {
|
||||||
|
@ -139,6 +136,7 @@ impl NoiseRenderer {
|
||||||
write_mask: wgpu::ColorWrites::ALL,
|
write_mask: wgpu::ColorWrites::ALL,
|
||||||
}],
|
}],
|
||||||
}),
|
}),
|
||||||
|
multiview: None,
|
||||||
});
|
});
|
||||||
|
|
||||||
Self {
|
Self {
|
||||||
|
|
|
@ -2,8 +2,7 @@
|
||||||
name = "imgui-winit"
|
name = "imgui-winit"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
authors = ["Jay Oster <jay@kodewerx.org>"]
|
authors = ["Jay Oster <jay@kodewerx.org>"]
|
||||||
edition = "2018"
|
edition = "2021"
|
||||||
resolver = "2"
|
|
||||||
publish = false
|
publish = false
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
|
@ -13,9 +12,9 @@ default = ["optimize"]
|
||||||
[dependencies]
|
[dependencies]
|
||||||
env_logger = "0.9"
|
env_logger = "0.9"
|
||||||
imgui = "0.8"
|
imgui = "0.8"
|
||||||
imgui-wgpu = "0.18"
|
imgui-wgpu = "0.19"
|
||||||
imgui-winit-support = { version = "0.8", default-features = false, features = ["winit-25"] }
|
imgui-winit-support = { version = "0.8", default-features = false, features = ["winit-26"] }
|
||||||
log = "0.4"
|
log = "0.4"
|
||||||
pixels = { path = "../.." }
|
pixels = { path = "../.." }
|
||||||
winit = "0.25"
|
winit = "0.26"
|
||||||
winit_input_helper = "0.10"
|
winit_input_helper = "0.11"
|
||||||
|
|
|
@ -2,8 +2,7 @@
|
||||||
name = "invaders"
|
name = "invaders"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
authors = ["Jay Oster <jay@kodewerx.org>"]
|
authors = ["Jay Oster <jay@kodewerx.org>"]
|
||||||
edition = "2018"
|
edition = "2021"
|
||||||
resolver = "2"
|
|
||||||
publish = false
|
publish = false
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
|
@ -19,5 +18,5 @@ log = "0.4"
|
||||||
pixels = { path = "../.." }
|
pixels = { path = "../.." }
|
||||||
randomize = "3.0"
|
randomize = "3.0"
|
||||||
simple-invaders = { path = "simple-invaders" }
|
simple-invaders = { path = "simple-invaders" }
|
||||||
winit = "0.25"
|
winit = "0.26"
|
||||||
winit_input_helper = "0.10"
|
winit_input_helper = "0.11"
|
||||||
|
|
|
@ -2,8 +2,7 @@
|
||||||
name = "minimal-egui"
|
name = "minimal-egui"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
authors = ["Jay Oster <jay@kodewerx.org>"]
|
authors = ["Jay Oster <jay@kodewerx.org>"]
|
||||||
edition = "2018"
|
edition = "2021"
|
||||||
resolver = "2"
|
|
||||||
publish = false
|
publish = false
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
|
@ -11,11 +10,11 @@ optimize = ["log/release_max_level_warn"]
|
||||||
default = ["optimize"]
|
default = ["optimize"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
egui = "0.15"
|
egui = "0.16"
|
||||||
egui_wgpu_backend = "0.14"
|
egui_wgpu_backend = "0.16"
|
||||||
egui-winit = { version = "0.15", default-features = false, features = ["links"] }
|
egui-winit = { version = "0.16", default-features = false, features = ["links"] }
|
||||||
env_logger = "0.9"
|
env_logger = "0.9"
|
||||||
log = "0.4"
|
log = "0.4"
|
||||||
pixels = { path = "../.." }
|
pixels = { path = "../.." }
|
||||||
winit = "0.25"
|
winit = "0.26"
|
||||||
winit_input_helper = "0.10"
|
winit_input_helper = "0.11"
|
||||||
|
|
|
@ -65,15 +65,13 @@ impl Framework {
|
||||||
|
|
||||||
/// Prepare egui.
|
/// Prepare egui.
|
||||||
pub(crate) fn prepare(&mut self, window: &Window) {
|
pub(crate) fn prepare(&mut self, window: &Window) {
|
||||||
// Begin the egui frame.
|
// Run the egui frame and create all paint jobs to prepare for rendering.
|
||||||
let raw_input = self.egui_state.take_egui_input(window);
|
let raw_input = self.egui_state.take_egui_input(window);
|
||||||
self.egui_ctx.begin_frame(raw_input);
|
let (output, paint_commands) = self.egui_ctx.run(raw_input, |egui_ctx| {
|
||||||
|
|
||||||
// Draw the demo application.
|
// Draw the demo application.
|
||||||
self.gui.ui(&self.egui_ctx);
|
self.gui.ui(egui_ctx);
|
||||||
|
});
|
||||||
|
|
||||||
// End the egui frame and create all paint jobs to prepare for rendering.
|
|
||||||
let (output, paint_commands) = self.egui_ctx.end_frame();
|
|
||||||
self.egui_state
|
self.egui_state
|
||||||
.handle_output(window, &self.egui_ctx, output);
|
.handle_output(window, &self.egui_ctx, output);
|
||||||
self.paint_jobs = self.egui_ctx.tessellate(paint_commands);
|
self.paint_jobs = self.egui_ctx.tessellate(paint_commands);
|
||||||
|
@ -88,7 +86,7 @@ impl Framework {
|
||||||
) -> Result<(), BackendError> {
|
) -> Result<(), BackendError> {
|
||||||
// Upload all resources to the GPU.
|
// Upload all resources to the GPU.
|
||||||
self.rpass
|
self.rpass
|
||||||
.update_texture(&context.device, &context.queue, &self.egui_ctx.texture());
|
.update_texture(&context.device, &context.queue, &self.egui_ctx.font_image());
|
||||||
self.rpass
|
self.rpass
|
||||||
.update_user_textures(&context.device, &context.queue);
|
.update_user_textures(&context.device, &context.queue);
|
||||||
self.rpass.update_buffers(
|
self.rpass.update_buffers(
|
||||||
|
@ -119,9 +117,10 @@ impl Gui {
|
||||||
fn ui(&mut self, ctx: &CtxRef) {
|
fn ui(&mut self, ctx: &CtxRef) {
|
||||||
egui::TopBottomPanel::top("menubar_container").show(ctx, |ui| {
|
egui::TopBottomPanel::top("menubar_container").show(ctx, |ui| {
|
||||||
egui::menu::bar(ui, |ui| {
|
egui::menu::bar(ui, |ui| {
|
||||||
egui::menu::menu(ui, "File", |ui| {
|
ui.menu_button("File", |ui| {
|
||||||
if ui.button("About...").clicked() {
|
if ui.button("About...").clicked() {
|
||||||
self.window_open = true;
|
self.window_open = true;
|
||||||
|
ui.close_menu();
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
|
|
@ -2,8 +2,7 @@
|
||||||
name = "minimal-fltk"
|
name = "minimal-fltk"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
authors = ["Jay Oster <jay@kodewerx.org>"]
|
authors = ["Jay Oster <jay@kodewerx.org>"]
|
||||||
edition = "2018"
|
edition = "2021"
|
||||||
resolver = "2"
|
|
||||||
publish = false
|
publish = false
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
|
|
|
@ -26,7 +26,6 @@ fn main() -> Result<(), Error> {
|
||||||
let mut win = Window::default()
|
let mut win = Window::default()
|
||||||
.with_size(WIDTH as i32, HEIGHT as i32)
|
.with_size(WIDTH as i32, HEIGHT as i32)
|
||||||
.with_label("Hello Pixels");
|
.with_label("Hello Pixels");
|
||||||
win.make_resizable(true);
|
|
||||||
win.end();
|
win.end();
|
||||||
win.show();
|
win.show();
|
||||||
|
|
||||||
|
|
|
@ -2,8 +2,7 @@
|
||||||
name = "minimal-sdl2"
|
name = "minimal-sdl2"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
authors = ["Jay Oster <jay@kodewerx.org>"]
|
authors = ["Jay Oster <jay@kodewerx.org>"]
|
||||||
edition = "2018"
|
edition = "2021"
|
||||||
resolver = "2"
|
|
||||||
publish = false
|
publish = false
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
|
@ -11,7 +10,9 @@ optimize = ["log/release_max_level_warn"]
|
||||||
default = ["optimize"]
|
default = ["optimize"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
beryllium = { version = "0.3", features = ["extern_crate_raw_window_handle"] }
|
beryllium = { version = "0.7", features = ["use-raw-window-handle"] }
|
||||||
env_logger = "0.9"
|
env_logger = "0.9"
|
||||||
|
fermium = { version = "20016.1.1", default-features = false }
|
||||||
log = "0.4"
|
log = "0.4"
|
||||||
pixels = { path = "../.." }
|
pixels = { path = "../.." }
|
||||||
|
zstring = "0.1"
|
||||||
|
|
|
@ -2,8 +2,14 @@
|
||||||
#![forbid(unsafe_code)]
|
#![forbid(unsafe_code)]
|
||||||
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]
|
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]
|
||||||
|
|
||||||
use beryllium::*;
|
use beryllium::{
|
||||||
|
event::Event,
|
||||||
|
init::{InitFlags, Sdl},
|
||||||
|
window::WindowFlags,
|
||||||
|
};
|
||||||
|
use fermium::keycode;
|
||||||
use pixels::{Pixels, SurfaceTexture};
|
use pixels::{Pixels, SurfaceTexture};
|
||||||
|
use zstring::zstr;
|
||||||
|
|
||||||
const WIDTH: u32 = 320;
|
const WIDTH: u32 = 320;
|
||||||
const HEIGHT: u32 = 240;
|
const HEIGHT: u32 = 240;
|
||||||
|
@ -19,35 +25,37 @@ struct World {
|
||||||
|
|
||||||
fn main() -> Result<(), Box<dyn std::error::Error>> {
|
fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||||
env_logger::init();
|
env_logger::init();
|
||||||
let sdl = SDL::init(InitFlags::default())?;
|
let sdl = Sdl::init(InitFlags::EVERYTHING)?;
|
||||||
let window =
|
let window = sdl.create_vk_window(
|
||||||
sdl.create_raw_window("Hello Pixels", WindowPosition::Centered, WIDTH, HEIGHT, 0)?;
|
zstr!("Hello Pixels"),
|
||||||
|
None,
|
||||||
|
(WIDTH as i32, HEIGHT as i32),
|
||||||
|
WindowFlags::ALLOW_HIGHDPI,
|
||||||
|
)?;
|
||||||
|
|
||||||
let mut pixels = {
|
let mut pixels = {
|
||||||
// TODO: Beryllium does not expose the SDL2 `GetDrawableSize` APIs, so choosing the correct
|
// TODO: Beryllium does not expose the SDL2 `GetDrawableSize` APIs, so choosing the correct
|
||||||
// surface texture size is not possible.
|
// surface texture size is not possible.
|
||||||
let surface_texture = SurfaceTexture::new(WIDTH, HEIGHT, &window);
|
let surface_texture = SurfaceTexture::new(WIDTH, HEIGHT, &*window);
|
||||||
Pixels::new(WIDTH, HEIGHT, surface_texture)?
|
Pixels::new(WIDTH, HEIGHT, surface_texture)?
|
||||||
};
|
};
|
||||||
let mut world = World::new();
|
let mut world = World::new();
|
||||||
|
|
||||||
'game_loop: loop {
|
'game_loop: loop {
|
||||||
match sdl.poll_events().and_then(Result::ok) {
|
while let Some(event) = sdl.poll_event() {
|
||||||
|
match event {
|
||||||
// Close events
|
// Close events
|
||||||
Some(Event::Quit { .. }) => break 'game_loop,
|
Event::Quit { .. } => break 'game_loop,
|
||||||
Some(Event::Keyboard(KeyboardEvent {
|
Event::Keyboard { keycode: key, .. } if key == keycode::SDLK_ESCAPE => {
|
||||||
key: KeyInfo { keycode: key, .. },
|
break 'game_loop
|
||||||
..
|
}
|
||||||
})) if key == Keycode::ESCAPE => break 'game_loop,
|
|
||||||
|
|
||||||
// Resize the window
|
// Resize the window
|
||||||
Some(Event::Window(WindowEvent {
|
Event::WindowResized { width, height, .. } => pixels.resize_surface(width, height),
|
||||||
event: WindowEventEnum::Resized { w, h },
|
|
||||||
..
|
|
||||||
})) => pixels.resize_surface(w as u32, h as u32),
|
|
||||||
|
|
||||||
_ => (),
|
_ => (),
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Update internal state
|
// Update internal state
|
||||||
world.update();
|
world.update();
|
||||||
|
|
|
@ -2,21 +2,20 @@
|
||||||
name = "minimal-web"
|
name = "minimal-web"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
authors = ["Jay Oster <jay@kodewerx.org>"]
|
authors = ["Jay Oster <jay@kodewerx.org>"]
|
||||||
edition = "2018"
|
edition = "2021"
|
||||||
resolver = "2"
|
|
||||||
publish = false
|
publish = false
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
optimize = ["log/release_max_level_warn"]
|
optimize = ["log/release_max_level_warn"]
|
||||||
web = ["wgpu/webgl", "winit/web-sys"]
|
web = ["wgpu/webgl"]
|
||||||
default = ["optimize"]
|
default = ["optimize"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
log = "0.4"
|
log = "0.4"
|
||||||
pixels = { path = "../.." }
|
pixels = { path = "../.." }
|
||||||
wgpu = "0.11"
|
wgpu = "0.12"
|
||||||
winit = "0.25"
|
winit = "0.26"
|
||||||
winit_input_helper = "0.10"
|
winit_input_helper = "0.11"
|
||||||
|
|
||||||
[target.'cfg(target_arch = "wasm32")'.dependencies]
|
[target.'cfg(target_arch = "wasm32")'.dependencies]
|
||||||
console_error_panic_hook = "0.1"
|
console_error_panic_hook = "0.1"
|
||||||
|
|
|
@ -2,8 +2,7 @@
|
||||||
name = "minimal-winit"
|
name = "minimal-winit"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
authors = ["Jay Oster <jay@kodewerx.org>"]
|
authors = ["Jay Oster <jay@kodewerx.org>"]
|
||||||
edition = "2018"
|
edition = "2021"
|
||||||
resolver = "2"
|
|
||||||
publish = false
|
publish = false
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
|
@ -14,5 +13,5 @@ default = ["optimize"]
|
||||||
env_logger = "0.9"
|
env_logger = "0.9"
|
||||||
log = "0.4"
|
log = "0.4"
|
||||||
pixels = { path = "../.." }
|
pixels = { path = "../.." }
|
||||||
winit = "0.25"
|
winit = "0.26"
|
||||||
winit_input_helper = "0.10"
|
winit_input_helper = "0.11"
|
||||||
|
|
|
@ -2,8 +2,7 @@
|
||||||
name = "raqote-winit"
|
name = "raqote-winit"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
authors = ["Jay Oster <jay@kodewerx.org>"]
|
authors = ["Jay Oster <jay@kodewerx.org>"]
|
||||||
edition = "2018"
|
edition = "2021"
|
||||||
resolver = "2"
|
|
||||||
publish = false
|
publish = false
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
|
@ -15,8 +14,8 @@ env_logger = "0.9"
|
||||||
euclid = "0.22"
|
euclid = "0.22"
|
||||||
log = "0.4"
|
log = "0.4"
|
||||||
pixels = { path = "../.." }
|
pixels = { path = "../.." }
|
||||||
winit = "0.25"
|
winit = "0.26"
|
||||||
winit_input_helper = "0.10"
|
winit_input_helper = "0.11"
|
||||||
|
|
||||||
[dependencies.raqote]
|
[dependencies.raqote]
|
||||||
git = "https://github.com/jrmuizel/raqote.git"
|
git = "https://github.com/jrmuizel/raqote.git"
|
||||||
|
|
|
@ -2,8 +2,8 @@
|
||||||
name = "pixels-mocks"
|
name = "pixels-mocks"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
authors = ["Jay Oster <jay@kodewerx.org>"]
|
authors = ["Jay Oster <jay@kodewerx.org>"]
|
||||||
edition = "2018"
|
edition = "2021"
|
||||||
publish = false
|
publish = false
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
raw-window-handle = "0.3"
|
raw-window-handle = "0.4"
|
||||||
|
|
|
@ -5,9 +5,7 @@ pub struct Rwh;
|
||||||
unsafe impl raw_window_handle::HasRawWindowHandle for Rwh {
|
unsafe impl raw_window_handle::HasRawWindowHandle for Rwh {
|
||||||
fn raw_window_handle(&self) -> raw_window_handle::RawWindowHandle {
|
fn raw_window_handle(&self) -> raw_window_handle::RawWindowHandle {
|
||||||
#[cfg(target_os = "macos")]
|
#[cfg(target_os = "macos")]
|
||||||
return raw_window_handle::RawWindowHandle::MacOS(
|
return raw_window_handle::RawWindowHandle::AppKit(raw_window_handle::AppKitHandle::empty());
|
||||||
raw_window_handle::macos::MacOSHandle::empty(),
|
|
||||||
);
|
|
||||||
#[cfg(any(
|
#[cfg(any(
|
||||||
target_os = "linux",
|
target_os = "linux",
|
||||||
target_os = "dragonfly",
|
target_os = "dragonfly",
|
||||||
|
@ -16,13 +14,11 @@ unsafe impl raw_window_handle::HasRawWindowHandle for Rwh {
|
||||||
target_os = "openbsd",
|
target_os = "openbsd",
|
||||||
))]
|
))]
|
||||||
return raw_window_handle::RawWindowHandle::Wayland(
|
return raw_window_handle::RawWindowHandle::Wayland(
|
||||||
raw_window_handle::unix::WaylandHandle::empty(),
|
raw_window_handle::WaylandHandle::empty(),
|
||||||
);
|
);
|
||||||
#[cfg(target_os = "windows")]
|
#[cfg(target_os = "windows")]
|
||||||
return raw_window_handle::RawWindowHandle::Windows(
|
return raw_window_handle::RawWindowHandle::Win32(raw_window_handle::Win32Handle::empty());
|
||||||
raw_window_handle::windows::WindowsHandle::empty(),
|
|
||||||
);
|
|
||||||
#[cfg(target_os = "ios")]
|
#[cfg(target_os = "ios")]
|
||||||
return raw_window_handle::RawWindowHandle::IOS(raw_window_handle::ios::IOSHandle::empty());
|
return raw_window_handle::RawWindowHandle::UiKit(raw_window_handle::UiKitHandle::empty());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@ struct VertexOutput {
|
||||||
[[builtin(position)]] position: vec4<f32>;
|
[[builtin(position)]] position: vec4<f32>;
|
||||||
};
|
};
|
||||||
|
|
||||||
[[block]] struct Locals {
|
struct Locals {
|
||||||
transform: mat4x4<f32>;
|
transform: mat4x4<f32>;
|
||||||
};
|
};
|
||||||
[[group(0), binding(2)]] var<uniform> r_locals: Locals;
|
[[group(0), binding(2)]] var<uniform> r_locals: Locals;
|
||||||
|
|
|
@ -425,6 +425,8 @@ const fn get_texture_format_size(texture_format: wgpu::TextureFormat) -> f32 {
|
||||||
R16Uint
|
R16Uint
|
||||||
| R16Sint
|
| R16Sint
|
||||||
| R16Float
|
| R16Float
|
||||||
|
| R16Unorm
|
||||||
|
| R16Snorm
|
||||||
| Rg8Unorm
|
| Rg8Unorm
|
||||||
| Rg8Snorm
|
| Rg8Snorm
|
||||||
| Rg8Uint
|
| Rg8Uint
|
||||||
|
@ -438,6 +440,8 @@ const fn get_texture_format_size(texture_format: wgpu::TextureFormat) -> f32 {
|
||||||
| Rg16Uint
|
| Rg16Uint
|
||||||
| Rg16Sint
|
| Rg16Sint
|
||||||
| Rg16Float
|
| Rg16Float
|
||||||
|
| Rg16Unorm
|
||||||
|
| Rg16Snorm
|
||||||
| Rgba8Unorm
|
| Rgba8Unorm
|
||||||
| Rgba8UnormSrgb
|
| Rgba8UnormSrgb
|
||||||
| Rgba8Snorm
|
| Rgba8Snorm
|
||||||
|
@ -457,7 +461,9 @@ const fn get_texture_format_size(texture_format: wgpu::TextureFormat) -> f32 {
|
||||||
| Rg32Float
|
| Rg32Float
|
||||||
| Rgba16Uint
|
| Rgba16Uint
|
||||||
| Rgba16Sint
|
| Rgba16Sint
|
||||||
| Rgba16Float => 8.0, // 64.0 / 8.0
|
| Rgba16Float
|
||||||
|
| Rgba16Unorm
|
||||||
|
| Rgba16Snorm => 8.0, // 64.0 / 8.0
|
||||||
|
|
||||||
// 128-bit formats, 8 bits per component
|
// 128-bit formats, 8 bits per component
|
||||||
Rgba32Uint
|
Rgba32Uint
|
||||||
|
@ -471,12 +477,12 @@ const fn get_texture_format_size(texture_format: wgpu::TextureFormat) -> f32 {
|
||||||
| Bc1RgbaUnormSrgb
|
| Bc1RgbaUnormSrgb
|
||||||
| Bc4RUnorm
|
| Bc4RUnorm
|
||||||
| Bc4RSnorm
|
| Bc4RSnorm
|
||||||
| Etc2RgbUnorm
|
| Etc2Rgb8Unorm
|
||||||
| Etc2RgbUnormSrgb
|
| Etc2Rgb8UnormSrgb
|
||||||
| Etc2RgbA1Unorm
|
| Etc2Rgb8A1Unorm
|
||||||
| Etc2RgbA1UnormSrgb
|
| Etc2Rgb8A1UnormSrgb
|
||||||
| EacRUnorm
|
| EacR11Unorm
|
||||||
| EacRSnorm => 0.5, // 4.0 * 4.0 / 8.0
|
| EacR11Snorm => 0.5, // 4.0 * 4.0 / 8.0
|
||||||
|
|
||||||
// 4x4 blocks, 16 bytes per block
|
// 4x4 blocks, 16 bytes per block
|
||||||
Bc2RgbaUnorm
|
Bc2RgbaUnorm
|
||||||
|
@ -489,8 +495,10 @@ const fn get_texture_format_size(texture_format: wgpu::TextureFormat) -> f32 {
|
||||||
| Bc6hRgbSfloat
|
| Bc6hRgbSfloat
|
||||||
| Bc7RgbaUnorm
|
| Bc7RgbaUnorm
|
||||||
| Bc7RgbaUnormSrgb
|
| Bc7RgbaUnormSrgb
|
||||||
| EacRgUnorm
|
| EacRg11Unorm
|
||||||
| EacRgSnorm
|
| EacRg11Snorm
|
||||||
|
| Etc2Rgba8Unorm
|
||||||
|
| Etc2Rgba8UnormSrgb
|
||||||
| Astc4x4RgbaUnorm
|
| Astc4x4RgbaUnorm
|
||||||
| Astc4x4RgbaUnormSrgb => 1.0, // 4.0 * 4.0 / 16.0
|
| Astc4x4RgbaUnormSrgb => 1.0, // 4.0 * 4.0 / 16.0
|
||||||
|
|
||||||
|
|
|
@ -96,10 +96,7 @@ impl ScalingRenderer {
|
||||||
wgpu::BindGroupLayoutEntry {
|
wgpu::BindGroupLayoutEntry {
|
||||||
binding: 1,
|
binding: 1,
|
||||||
visibility: wgpu::ShaderStages::FRAGMENT,
|
visibility: wgpu::ShaderStages::FRAGMENT,
|
||||||
ty: wgpu::BindingType::Sampler {
|
ty: wgpu::BindingType::Sampler(wgpu::SamplerBindingType::Filtering),
|
||||||
filtering: true,
|
|
||||||
comparison: false,
|
|
||||||
},
|
|
||||||
count: None,
|
count: None,
|
||||||
},
|
},
|
||||||
wgpu::BindGroupLayoutEntry {
|
wgpu::BindGroupLayoutEntry {
|
||||||
|
@ -108,7 +105,7 @@ impl ScalingRenderer {
|
||||||
ty: wgpu::BindingType::Buffer {
|
ty: wgpu::BindingType::Buffer {
|
||||||
ty: wgpu::BufferBindingType::Uniform,
|
ty: wgpu::BufferBindingType::Uniform,
|
||||||
has_dynamic_offset: false,
|
has_dynamic_offset: false,
|
||||||
min_binding_size: None, // TODO: More efficent to specify this
|
min_binding_size: None, // TODO: More efficient to specify this
|
||||||
},
|
},
|
||||||
count: None,
|
count: None,
|
||||||
},
|
},
|
||||||
|
@ -159,6 +156,7 @@ impl ScalingRenderer {
|
||||||
write_mask: wgpu::ColorWrites::ALL,
|
write_mask: wgpu::ColorWrites::ALL,
|
||||||
}],
|
}],
|
||||||
}),
|
}),
|
||||||
|
multiview: None,
|
||||||
});
|
});
|
||||||
|
|
||||||
// Create clipping rectangle
|
// Create clipping rectangle
|
||||||
|
|
Loading…
Reference in a new issue