Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ash v0.38 support #75

Merged
merged 22 commits into from
Aug 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,17 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project
adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## Unreleased

### Changed

- Updated `ash` to v0.38
- Updated `winit` to v0.30 (_and moved related functionality to new `screen-13-window` crate_)

### Removed

- `log` and `winit` are no longer exported by `use screen_13::prelude::*`

## [0.11.4] - 2024-07-16

### Fixed
Expand Down
19 changes: 10 additions & 9 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "screen-13"
version = "0.11.4"
version = "0.12.0"
authors = ["John Wells <[email protected]>"]
edition = "2021"
license = "MIT OR Apache-2.0"
Expand All @@ -20,22 +20,21 @@ profile-with-superluminal = ["profiling/profile-with-superluminal"]
profile-with-tracy = ["profiling/profile-with-tracy"]

[dependencies]
ash = ">=0.37.1, <0.38"
ash-window = "0.12"
ash = "0.38"
ash-window = "0.13"
derive_builder = "0.20"
gpu-allocator = "0.26"
gpu-allocator = "0.27"
log = "0.4"
ordered-float = "4.1"
parking_lot = { version = "0.12", optional = true }
paste = "1.0"
profiling = "1.0"
raw-window-handle = "0.5"
raw-window-handle = "0.6"
spirq = "1.2"
vk-sync = { version = "0.4.0", package = "vk-sync-fork" } # // SEE: https:/gwihlidal/vk-sync-rs/pull/4 -> https:/expenses/vk-sync-rs
winit = { version = "0.29", features = ["rwh_05"] }
vk-sync = { git = "https:/attackgoat/vk-sync-rs.git", rev = "19fc3f811cc1d38b2231cdb8840fddf271879ac1", package = "vk-sync-fork" } #version = "0.4.0", package = "vk-sync-fork" } # // SEE: https:/gwihlidal/vk-sync-rs/pull/4 -> https:/expenses/vk-sync-rs

[target.'cfg(target_os = "macos")'.dependencies]
ash-molten = "0.17"
ash-molten = "0.19"

[dev-dependencies]
anyhow = "1.0"
Expand All @@ -58,5 +57,7 @@ reqwest = { version = "0.12", features = ["blocking"] }
screen-13-fx = { path = "contrib/screen-13-fx" }
screen-13-imgui = { path = "contrib/screen-13-imgui" }
screen-13-egui = { path = "contrib/screen-13-egui" }
screen-13-window = { path = "contrib/screen-13-window" }
tobj = "4.0"
winit_input_helper = "0.16"
winit = "0.30"
winit_input_helper = { git = "https:/stefnotch/winit_input_helper.git", rev = "6e76a79d01ce836c01b9cdeaa98846a6f0955dc4" } #"0.16"
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ screen-13 = "0.11"

_Screen 13_ provides a high performance [Vulkan](https://www.vulkan.org/) driver using smart
pointers. The driver may be created manually for headless rendering or automatically using the
built-in event loop abstraction:
built-in window abstraction:

```rust
use screen_13::prelude::*;
use screen_13_window::{Window, WindowError};

fn main() -> Result<(), DisplayError> {
EventLoop::new().build()?.run(|frame| {
fn main() -> Result<(), WindowError> {
Window::new()?.run(|frame| {
// It's time to do some graphics! 😲
})
}
Expand Down
15 changes: 13 additions & 2 deletions contrib/rel-mgmt/check
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,25 @@ cargo fmt --manifest-path examples/skeletal-anim/Cargo.toml && diff || fail "Unf
cargo fmt --manifest-path examples/vr/Cargo.toml && diff || fail "Unformatted rust code (vr)"

# Rust code errors
echo "Checking screen-13"
cargo check --all-targets
echo "Checking screen-13 (w/ parking_lot)"
cargo check --all-targets --features parking_lot
echo "Checking contrib/screen-13-egui"
cargo check --manifest-path contrib/screen-13-egui/Cargo.toml --all-targets --all-features
echo "Checking contrib/screen-13-fx"
cargo check --manifest-path contrib/screen-13-fx/Cargo.toml --all-targets --all-features
echo "Checking contrib/screen-13-hot"
cargo check --manifest-path contrib/screen-13-hot/Cargo.toml --all-targets --all-features
cargo check --manifest-path contrib/screen-13-imgui/Cargo.toml --all-targets --all-features
#echo "Checking contrib/screen-13-imgui"
#cargo check --manifest-path contrib/screen-13-imgui/Cargo.toml --all-targets --all-features
echo "Checking contrib/screen-13-window"
cargo check --manifest-path contrib/screen-13-window/Cargo.toml --all-targets --all-features
echo "Checking examples/shader-toy"
cargo check --manifest-path examples/shader-toy/Cargo.toml --all-targets --all-features
echo "Checking examples/skeletal-anim"
cargo check --manifest-path examples/skeletal-anim/Cargo.toml --all-targets --all-features
echo "Checking examples/vr"
cargo check --manifest-path examples/vr/Cargo.toml --all-targets --all-features

# Rust code lints
Expand All @@ -41,7 +52,7 @@ cargo clippy --all-targets --features parking_lot
cargo clippy --manifest-path contrib/screen-13-egui/Cargo.toml --all-targets --all-features
cargo clippy --manifest-path contrib/screen-13-fx/Cargo.toml --all-targets --all-features
cargo clippy --manifest-path contrib/screen-13-hot/Cargo.toml --all-targets --all-features
cargo clippy --manifest-path contrib/screen-13-imgui/Cargo.toml --all-targets --all-features
#cargo clippy --manifest-path contrib/screen-13-imgui/Cargo.toml --all-targets --all-features
cargo clippy --manifest-path examples/shader-toy/Cargo.toml --all-targets --all-features
cargo clippy --manifest-path examples/skeletal-anim/Cargo.toml --all-targets --all-features
cargo clippy --manifest-path examples/vr/Cargo.toml --all-targets --all-features
Expand Down
5 changes: 3 additions & 2 deletions contrib/rel-mgmt/run-all-examples
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ set -e
# Update everything
cargo update
cargo update --manifest-path contrib/screen-13-hot/Cargo.toml
cargo update --manifest-path contrib/screen-13-window/Cargo.toml
cargo update --manifest-path examples/skeletal-anim/Cargo.toml
cargo update --manifest-path examples/shader-toy/Cargo.toml
cargo update --manifest-path examples/vr/Cargo.toml
Expand All @@ -13,10 +14,10 @@ cargo update --manifest-path examples/vr/Cargo.toml
cargo build --examples

# Run the "test" example first
# cargo run --example fuzzer
cargo run --example fuzzer

# Run all regular examples, in debug mode, next
cargo run --example hello_world
cargo run --manifest-path contrib/screen-13-window/Cargo.toml --example hello_world
cargo run --example aliasing
cargo run --example cpu_readback
cargo run --example subgroup_ops
Expand Down
7 changes: 3 additions & 4 deletions contrib/screen-13-egui/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,9 @@ readme = "README.md"

[dependencies]
bytemuck = "1.14"
egui = { version = "0.26", features = [
"bytemuck"
] }
egui-winit = "0.26"
# TODO: Waiting for egui to update winit version
egui = { git = "https:/emilk/egui.git", rev = "3777b8d2741f298eaa1409dc08062902f7541990" } #{ version = "0.28", features = ["bytemuck"] }
egui-winit = { git = "https:/emilk/egui.git", rev = "3777b8d2741f298eaa1409dc08062902f7541990" } #"0.28"
inline-spirv = "0.2"
screen-13 = { path = "../.." }
screen-13-fx = { path = "../screen-13-fx" }
12 changes: 4 additions & 8 deletions contrib/screen-13-egui/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ pub use egui;

use {
bytemuck::cast_slice,
egui_winit::winit::{event::Event, event_loop::EventLoop, window::Window},
screen_13::prelude::*,
std::{borrow::Cow, collections::HashMap, sync::Arc},
};
Expand All @@ -21,10 +22,7 @@ pub struct Egui {
}

impl Egui {
pub fn new(
device: &Arc<Device>,
event_loop: &egui_winit::winit::event_loop::EventLoopWindowTarget<()>,
) -> Self {
pub fn new(device: &Arc<Device>, event_loop: &EventLoop<()>) -> Self {
let ppl = Arc::new(
GraphicPipeline::create(
device,
Expand Down Expand Up @@ -58,9 +56,6 @@ impl Egui {
);

let ctx = egui::Context::default();
let native_pixels_per_point = event_loop
.primary_monitor()
.map(|monitor| monitor.scale_factor() as f32);
let max_texture_side = Some(
device
.physical_device
Expand All @@ -72,7 +67,8 @@ impl Egui {
ctx.clone(),
egui::ViewportId::ROOT,
event_loop,
native_pixels_per_point,
None,
None,
max_texture_side,
);

Expand Down
1 change: 1 addition & 0 deletions contrib/screen-13-fx/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ bmfont = { version = "0.3", default-features = false }
bytemuck = "1.14"
parking_lot = "0.12"
inline-spirv = "0.2"
log = "0.4"
screen-13 = { path = "../.."}
anyhow = "1.0"
glam = "0.27"
5 changes: 4 additions & 1 deletion contrib/screen-13-fx/src/image_loader.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
use {
super::BitmapFont, anyhow::Context, bmfont::BMFont, inline_spirv::include_spirv,
super::BitmapFont, anyhow::Context, bmfont::BMFont, inline_spirv::include_spirv, log::info,
screen_13::prelude::*, std::sync::Arc,
};

#[cfg(debug_assertions)]
use log::warn;

fn align_up_u32(val: u32, atom: u32) -> u32 {
(val + atom - 1) & !(atom - 1)
}
Expand Down
1 change: 1 addition & 0 deletions contrib/screen-13-fx/src/transition.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use {
inline_spirv::include_spirv,
log::trace,
screen_13::prelude::*,
std::{collections::HashMap, sync::Arc},
};
Expand Down
2 changes: 2 additions & 0 deletions contrib/screen-13-hot/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,10 @@ description = "Hot-reloading shader pipelines for Screen-13"
[dependencies]
anyhow = "1.0"
derive_builder = "0.13"
log = "0.4"
notify = "6.1"
screen-13 = { path = "../.."}
screen-13-window = { path = "../screen-13-window" }
shader-prepper = "0.3.0-pre.3"
shaderc = "0.8"

Expand Down
17 changes: 10 additions & 7 deletions contrib/screen-13-hot/examples/glsl.rs
Original file line number Diff line number Diff line change
@@ -1,28 +1,31 @@
use {screen_13::prelude::*, screen_13_hot::prelude::*, std::path::PathBuf};
use {
screen_13::prelude::*,
screen_13_hot::prelude::*,
screen_13_window::{Window, WindowError},
std::path::PathBuf,
};

/// This program draws a noise signal to the swapchain - make changes to fill_image.comp or the
/// noise.glsl file it includes to see those changes update while the program is still running.
///
/// Run with RUST_LOG=info to get notification of shader compilations.
fn main() -> Result<(), DisplayError> {
fn main() -> Result<(), WindowError> {
pretty_env_logger::init();

let event_loop = EventLoop::new()
.desired_surface_format(Surface::linear_or_default)
.build()?;
let window = Window::new()?;

// Create a compute pipeline - the same as normal except for "Hot" prefixes and we provide the
// shader source code path instead of the shader source code bytes
let cargo_manifest_dir = PathBuf::from(env!("CARGO_MANIFEST_DIR"));
let mut pipeline = HotComputePipeline::create(
&event_loop.device,
&window.device,
ComputePipelineInfo::default(),
HotShader::new_compute(cargo_manifest_dir.join("examples/res/fill_image.comp")),
)?;

let mut frame_index: u32 = 0;

event_loop.run(|frame| {
window.run(|frame| {
frame
.render_graph
.begin_pass("make some noise")
Expand Down
15 changes: 10 additions & 5 deletions contrib/screen-13-hot/examples/hlsl.rs
Original file line number Diff line number Diff line change
@@ -1,20 +1,25 @@
use {screen_13::prelude::*, screen_13_hot::prelude::*, std::path::PathBuf};
use {
screen_13::prelude::*,
screen_13_hot::prelude::*,
screen_13_window::{Window, WindowError},
std::path::PathBuf,
};

/// This program draws a noise signal to the swapchain - make changes to fill_image.hlsl or the
/// noise.hlsl file it includes to see those changes update while the program is still running.
///
/// Run with RUST_LOG=info to get notification of shader compilations.
fn main() -> Result<(), DisplayError> {
fn main() -> Result<(), WindowError> {
pretty_env_logger::init();

let event_loop = EventLoop::new().build()?;
let window = Window::new()?;

// Create a graphic pipeline - the same as normal except for "Hot" prefixes and we provide the
// shader source code path instead of the shader source code bytes
let cargo_manifest_dir = PathBuf::from(env!("CARGO_MANIFEST_DIR"));
let fill_image_path = cargo_manifest_dir.join("examples/res/fill_image.hlsl");
let mut pipeline = HotGraphicPipeline::create(
&event_loop.device,
&window.device,
GraphicPipelineInfo::default(),
[
HotShader::new_vertex(&fill_image_path).entry_name("vertex_main".to_string()),
Expand All @@ -24,7 +29,7 @@ fn main() -> Result<(), DisplayError> {

let mut frame_index: u32 = 0;

event_loop.run(|frame| {
window.run(|frame| {
frame
.render_graph
.begin_pass("make some noise")
Expand Down
1 change: 1 addition & 0 deletions contrib/screen-13-hot/src/compute.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use {
super::{compile_shader_and_watch, create_watcher, shader::HotShader},
log::info,
notify::RecommendedWatcher,
screen_13::prelude::*,
std::sync::{
Expand Down
1 change: 1 addition & 0 deletions contrib/screen-13-hot/src/graphic.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use {
super::{compile_shader_and_watch, create_watcher, shader::HotShader},
log::info,
notify::RecommendedWatcher,
screen_13::prelude::*,
std::sync::{
Expand Down
1 change: 1 addition & 0 deletions contrib/screen-13-hot/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ pub mod prelude {

use {
self::shader::HotShader,
log::{error, info},
notify::{recommended_watcher, Event, EventKind, RecommendedWatcher},
screen_13::prelude::*,
shader_prepper::{
Expand Down
1 change: 1 addition & 0 deletions contrib/screen-13-hot/src/ray_trace.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use {
super::{compile_shader_and_watch, create_watcher, shader::HotShader},
log::info,
notify::RecommendedWatcher,
screen_13::prelude::*,
std::sync::{
Expand Down
1 change: 1 addition & 0 deletions contrib/screen-13-hot/src/shader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ pub use shaderc::{OptimizationLevel, SourceLanguage, SpirvVersion};
use {
super::{compile_shader, guess_shader_source_language},
derive_builder::{Builder, UninitializedFieldError},
log::{debug, error},
notify::{RecommendedWatcher, RecursiveMode, Watcher},
screen_13::prelude::*,
shaderc::{CompileOptions, EnvVersion, ShaderKind, TargetEnv},
Expand Down
4 changes: 2 additions & 2 deletions contrib/screen-13-imgui/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ readme = "README.md"
[dependencies]
bytemuck = "1.14"

imgui = { git = "https:/imgui-rs/imgui-rs", rev = "ca05418cb449dadaabf014487c5c965908dfcbdd" }
imgui-winit-support = { git = "https:/imgui-rs/imgui-rs", rev = "ca05418cb449dadaabf014487c5c965908dfcbdd" }
imgui = "0.12"
imgui-winit-support = { git = "https:/julcst/imgui-winit-support.git", rev = "29584c863c5517a7f30e09205b84e1601f4ddb92" } # TODO: https:/imgui-rs/imgui-rs/issues/781

inline-spirv = "0.2"
screen-13 = { path = "../.." }
Expand Down
19 changes: 4 additions & 15 deletions contrib/screen-13-imgui/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@ pub use imgui::{self, Condition, Ui};
use {
bytemuck::cast_slice,
imgui::{Context, DrawCmd, DrawCmdParams},
imgui_winit_support::{HiDpiMode, WinitPlatform},
imgui_winit_support::{
winit::{event::Event, window::Window},
{HiDpiMode, WinitPlatform},
},
inline_spirv::include_spirv,
screen_13::prelude::*,
std::{sync::Arc, time::Duration},
Expand Down Expand Up @@ -216,20 +219,6 @@ impl ImGui {
image
}

pub fn draw_frame(
&mut self,
frame: &mut FrameContext<'_>,
ui_func: impl FnOnce(&mut Ui),
) -> ImageLeaseNode {
self.draw(
frame.dt,
frame.events,
frame.window,
frame.render_graph,
ui_func,
)
}

fn lease_font_atlas_image(&mut self, render_graph: &mut RenderGraph) {
use imgui::{FontConfig, FontGlyphRanges, FontSource};

Expand Down
Loading
Loading