Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
9eaeb09
[render] add transform, assets, input, window and render
HellButcher Jan 31, 2022
37da3d8
move pipeline descriptors
HellButcher Jan 7, 2023
d80527a
fixes for window
HellButcher Jan 8, 2023
d94e695
`pulz-render` improvements; render-graph, core-pipeline
HellButcher Jan 8, 2023
75fb33a
pulz-render-ash
HellButcher Jan 8, 2023
27ea491
fixes for android
HellButcher Jan 9, 2023
76a5eb6
fmt
HellButcher Jan 9, 2023
0279da5
adjust to simplified systems
HellButcher Jan 28, 2023
9060b1e
refactored graph
HellButcher Jan 28, 2023
0508008
pipeline serialization & cache
HellButcher Jan 28, 2023
d0ac6b4
refactored renderers & window-system to create surface after Resumed-…
HellButcher Jan 28, 2023
ae81f73
changed logging of vulkan debug-utils
HellButcher Jan 28, 2023
298bdf2
android example
HellButcher Jan 28, 2023
7ef408a
update winit
HellButcher Feb 5, 2023
c900212
update wgpu
HellButcher Feb 5, 2023
0a448ae
update deps
HellButcher Apr 1, 2023
6be66fd
calculate graph resource assignments
HellButcher Apr 1, 2023
480cb31
updates & fmt
HellButcher May 4, 2023
4ab5191
exclude benches from tests
HellButcher May 4, 2023
944dfcb
update window-winit docs to use doc_auto_cfg feature
HellButcher May 5, 2023
d2147c3
enable avx on x86(_64) + fmt
HellButcher May 6, 2023
e726b0c
removed typemap dependenc + fmt + clippy fixes
HellButcher May 6, 2023
7741b5f
[render] allocate images, updates, assign physical ressources
HellButcher Dec 28, 2023
a34dd28
[render] fix graph physical resources hash
HellButcher Dec 28, 2023
cf1c92b
[render] fix aquire-image timeout
HellButcher Dec 28, 2023
95edc82
[render] keep ownership of window
HellButcher Dec 28, 2023
2c038a2
[render] cleanup render graph in currect order
HellButcher Dec 29, 2023
a44ab28
fix(deps): various updates
HellButcher Jan 20, 2024
795cb33
refactor(render): new Access bitflag, seperate from Texture/Buffer-Usage
HellButcher Jan 28, 2024
885215a
feat(render): PhysicalResourceAccessTracker (wip)
HellButcher Jan 28, 2024
4db9983
fix: updates
HellButcher Apr 14, 2024
beb7ef0
fix: update ash
HellButcher Apr 14, 2024
7418d1a
style: fmt
HellButcher Apr 14, 2024
9e5653d
fix(deps): update deps, mifrate new winit version, refactored windowing
HellButcher Sep 1, 2024
cad313a
fix(deps): updates
HellButcher Nov 24, 2024
11e3086
fix(deps): update deps, edition, format, clippy
HellButcher Apr 26, 2025
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
9 changes: 9 additions & 0 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@

[target.'cfg(any(target_arch = "x86", target_arch = "x86_64"))']
rustflags = ["-C", "target-feature=+avx"]

[target.wasm32-unknown-unknown]
rustflags = ["--cfg=web_sys_unstable_apis"]

[alias]
run-wasm = "run --release --package run-wasm --"
2 changes: 1 addition & 1 deletion .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
cargo build --workspace --all-targets
- name: Run tests
run: |
cargo test --workspace --all-targets
cargo test --workspace --all-targets --exclude benches

check:
name: Rustfmt & Clippy
Expand Down
29 changes: 29 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ resolver = "2"
members = [
"crates/*",
"crates/*/macros",
"run-wasm",
"benches"
]
default-members = [
Expand All @@ -18,14 +19,42 @@ edition = "2024"
rust-version = "1.86"

[workspace.dependencies]
glam = "0.30"
serde = "1.0"
raw-window-handle = "0.6"
slotmap = "1.0"
thiserror = "2.0"
tracing = "0.1"
bitflags = "2.9"
fnv = "1.0"
radsort = "0.1"
bytemuck = "1.22"
blink-alloc = "0.3"
dynsequence = { version = "0.1.0-alpha.4" }
blocking = "1.6"
threadpool = "1.8"
backtrace = "0.3"
gametime = "0.5"
atomic_refcell = "0.1"
palette = { version = "0.7", default-features = false }
image = { version = "0.25", default-features = false }
encase = { version = "0.11", features = ["glam"], default-features = false }
encase_derive_impl = { version = "0.11" }
crossbeam-utils = "0.8"
crossbeam-queue = "0.3"
tracing-subscriber = { version = "0.3", features = ["env-filter"] }
tracing-wasm = "0.2"
tracing-log = "0.2"
console_error_panic_hook = "0.1"
wasm-bindgen = "0.2"
wasm-bindgen-futures = "0.4"
js-sys = "0.3"
web-sys = "0.3"
ndk = "0.9"
ndk-glue = "0.7"
darling = "0.20"
proc-macro2 = "1.0"
syn = "2.0"
quote = "1.0"
proc-macro-crate = "3.3"

6 changes: 6 additions & 0 deletions crates/assets-loader/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# `pulz-assets-loader` Changelog
All notable changes to this crate will be documented in this file.

## Unreleased (DATE)

* Initial version
24 changes: 24 additions & 0 deletions crates/assets-loader/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
[package]
name = "pulz-assets-loader"
version.workspace = true
authors.workspace = true
license.workspace = true
edition.workspace = true
repository.workspace = true
readme = "README.md"

[dependencies]
pulz-ecs = { path = "../ecs" }
pulz-assets = { path = "../assets" }

[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
blocking = { workspace = true }

[target.'cfg(target_arch = "wasm32")'.dependencies]
wasm-bindgen = { workspace = true }
wasm-bindgen-futures = { workspace = true }
js-sys = { workspace = true }
web-sys = { workspace = true, features = [ 'Request', 'Response', "Window", ]}

[target.'cfg(target_os = "android")'.dependencies]
ndk = { workspace = true }
34 changes: 34 additions & 0 deletions crates/assets-loader/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# `pulz-assets-loader`

<img align="right" src="https://raw.githubusercontent.com/HellButcher/pulz/master/docs/logo-full.png"/>

[![Crates.io](https://img.shields.io/crates/v/pulz-assets-loader.svg?label=pulz-assets-loader)](https://crates.io/crates/pulz-assets-loader)
[![docs.rs](https://docs.rs/pulz-assets-loader/badge.svg)](https://docs.rs/pulz-assets-loader/)
[![license: MIT/Apache-2.0](https://img.shields.io/badge/license-MIT%2FApache--2.0-blue.svg)](#license)
[![Rust CI](https://github.com/HellButcher/pulz/actions/workflows/rust.yml/badge.svg)](https://github.com/HellButcher/pulz/actions/workflows/rust.yml)

<!-- TODO: Short Introduction -->
**TODO**

## Example

<!-- TODO: basic Usage Example -->
**TODO**

## License

[license]: #license

This project is licensed under either of

* MIT license ([LICENSE-MIT] or <http://opensource.org/licenses/MIT>)
* Apache License, Version 2.0, ([LICENSE-APACHE] or <http://www.apache.org/licenses/LICENSE-2.0>)

at your option.

Unless you explicitly state otherwise, any contribution intentionally submitted
for inclusion in the work by you, as defined in the Apache-2.0 license, shall be
dual licensed as above, without any additional terms or conditions.

[LICENSE-MIT]: ../../LICENSE-MIT
[LICENSE-APACHE]: ../../LICENSE-APACHE
165 changes: 165 additions & 0 deletions crates/assets-loader/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,165 @@
#![warn(
// missing_docs,
// rustdoc::missing_doc_code_examples,
future_incompatible,
rust_2018_idioms,
unused,
trivial_casts,
trivial_numeric_casts,
unused_lifetimes,
unused_qualifications,
unused_crate_dependencies,
clippy::cargo,
clippy::multiple_crate_versions,
clippy::empty_line_after_outer_attr,
clippy::fallible_impl_from,
clippy::redundant_pub_crate,
clippy::use_self,
clippy::suspicious_operation_groupings,
clippy::useless_let_if_seq,
// clippy::missing_errors_doc,
// clippy::missing_panics_doc,
clippy::wildcard_imports
)]
#![doc(html_logo_url = "https://raw.githubusercontent.com/HellButcher/pulz/master/docs/logo.png")]
#![doc(html_no_source)]
#![doc = include_str!("../README.md")]

use std::{future::Future, io::Cursor};

use path::{AssetPath, AssetPathBuf};
use platform::AssetOpen;

pub mod path;
pub mod platform;

pub trait LoadAsset<A> {
type Future: Future<Output = Result<A, Self::Error>>;
type Error: From<std::io::Error>;
fn load(&self, load: Load<'_>) -> Self::Future;
}

impl<A, E, F, T> LoadAsset<A> for T
where
T: Fn(Load<'_>) -> F,
F: Future<Output = Result<A, E>>,
E: From<std::io::Error>,
{
type Future = F;
type Error = E;
fn load(&self, load: Load<'_>) -> Self::Future {
self(load)
}
}

pub struct Load<'a> {
buffer: Cursor<Vec<u8>>,
path: AssetPathBuf,
server: &'a AssetServer,
}

impl Load<'_> {
#[inline]
pub fn path(&self) -> &AssetPath {
&self.path
}

#[inline]
pub fn into_vec(self) -> Vec<u8> {
self.buffer.into_inner()
}

#[inline]
pub fn cursor_mut(&mut self) -> &'_ mut Cursor<impl AsRef<[u8]>> {
&mut self.buffer
}

#[inline]
pub fn as_slice(&self) -> &'_ [u8] {
self.buffer.get_ref()
}

#[inline]
pub async fn load(&self, path: impl AsRef<AssetPath>) -> std::io::Result<Load<'_>> {
self._load(path.as_ref()).await
}
async fn _load(&self, path: &AssetPath) -> std::io::Result<Load<'_>> {
let full_path = if self.path.is_directory() {
self.path.join(path)
} else if let Some(parent) = self.path.parent() {
parent.join(path)
} else {
let mut p = AssetPathBuf::from("/");
p.push(path);
p
};
self.server._load(full_path).await
}
}

impl AsRef<[u8]> for Load<'_> {
#[inline]
fn as_ref(&self) -> &[u8] {
self.as_slice()
}
}

pub struct AssetServer {
io: Box<dyn AssetOpen>,
}

impl Default for AssetServer {
fn default() -> Self {
Self::new()
}
}

impl AssetServer {
#[cfg(not(target_os = "android"))]
pub fn new() -> Self {
#[cfg(not(any(target_os = "android", target_arch = "wasm32")))]
let io = platform::fs::FileSystemAssetLoaderIo::new();

#[cfg(target_arch = "wasm32")]
let io = platform::wasm::WasmFetchAssetLoaderIo::new();

Self::with(io)
}

#[cfg(target_os = "android")]
pub fn with_asset_manager(manager: ::ndk::asset::AssetManager) -> Self {
let io = platform::android::AndroidAssetLoaderIo::with_asset_manager(manager);
Self::with(io)
}

#[inline]
pub fn with(io: impl AssetOpen + 'static) -> Self {
Self { io: Box::new(io) }
}
}

impl AssetServer {
pub async fn load_with<A, L: LoadAsset<A>>(
&self,
path: impl AsRef<AssetPath>,
loader: L,
) -> Result<A, L::Error> {
let load = self.load(path).await?;
loader.load(load).await
}

pub async fn load(&self, path: impl AsRef<AssetPath>) -> std::io::Result<Load<'_>> {
let mut abs_base = AssetPathBuf::from("/");
abs_base.push(path);
self._load(abs_base).await
}

async fn _load(&self, path: AssetPathBuf) -> std::io::Result<Load<'_>> {
let buffer = self.io.load(&path).await?;
Ok(Load {
buffer: Cursor::new(buffer),
path,
server: self,
})
}
}
Loading